mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
WIP on the dialog for history
This commit is contained in:
@@ -20,25 +20,29 @@ $(function() {
|
||||
jQuery.hotkeys.options.filterInputAcceptingElements = true;
|
||||
jQuery.hotkeys.options.filterContentEditable = true;
|
||||
|
||||
$(document).bind('keydown', 'alt+h', function() {
|
||||
const toggle = $(".hide-toggle");
|
||||
const hidden = toggle.css('display') === 'none';
|
||||
|
||||
toggle.css('display', hidden ? 'block' : 'none');
|
||||
|
||||
$("#noteDetailWrapper").css("width", hidden ? "750px" : "100%");
|
||||
});
|
||||
// $(document).bind('keydown', 'alt+h', function() {
|
||||
// const toggle = $(".hide-toggle");
|
||||
// const hidden = toggle.css('display') === 'none';
|
||||
//
|
||||
// toggle.css('display', hidden ? 'block' : 'none');
|
||||
//
|
||||
// $("#noteDetailWrapper").css("width", hidden ? "750px" : "100%");
|
||||
// });
|
||||
|
||||
$(document).bind('keydown', 'alt+s', function() {
|
||||
$("input[name=search]").focus();
|
||||
});
|
||||
|
||||
function formatDate(date) {
|
||||
const dateString = date.getDate() + ". " + (date.getMonth() + 1) + ". " + date.getFullYear() + " " +
|
||||
date.getHours() + ":" + date.getMinutes();
|
||||
return dateString;
|
||||
}
|
||||
|
||||
// hide (toggle) everything except for the note content for distraction free writing
|
||||
$(document).bind('keydown', 'alt+t', function() {
|
||||
const date = new Date();
|
||||
|
||||
const dateString = date.getDate() + ". " + (date.getMonth() + 1) + ". " + date.getFullYear() + " " +
|
||||
date.getHours() + ":" + date.getMinutes();
|
||||
const dateString = formatDate(date);
|
||||
|
||||
$('#noteDetail').summernote('insertText', dateString);
|
||||
});
|
||||
|
||||
28
static/js/note_history.js
Normal file
28
static/js/note_history.js
Normal file
@@ -0,0 +1,28 @@
|
||||
$(document).bind('keydown', 'alt+h', function() {
|
||||
$("#noteHistoryDialog").dialog({
|
||||
modal: true,
|
||||
width: 800,
|
||||
height: 700
|
||||
});
|
||||
|
||||
$("#noteHistoryList").empty();
|
||||
$("#noteHistoryContent").empty();
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + 'notes-history/' + globalCurrentNote.detail.note_id,
|
||||
type: 'GET',
|
||||
success: function (result) {
|
||||
if (result.length > 0) {
|
||||
$("#noteHistoryContent").html(result[0]["note_text"]);
|
||||
}
|
||||
|
||||
for (row of result) {
|
||||
const dateModified = new Date(row['date_modified'] * 1000);
|
||||
const optionHtml = '<option value="' + row['note_id'] + '">' + formatDate(dateModified) + '</option>';
|
||||
|
||||
$("#noteHistoryList").append(optionHtml);
|
||||
}
|
||||
},
|
||||
error: () => alert("Error getting note history.")
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user