fixed "add date" for ckeditor

This commit is contained in:
azivner 2017-12-09 14:17:03 -05:00
parent 5001e7e630
commit 372cce8f8e
4 changed files with 12 additions and 4 deletions

View File

@ -20,7 +20,7 @@ $(document).bind('keydown', 'alt+t', () => {
const date = new Date(); const date = new Date();
const dateString = formatDateTime(date); const dateString = formatDateTime(date);
$('#note-detail').summernote('insertText', dateString); link.addTextToEditor(dateString);
}); });
$(document).bind('keydown', 'f5', () => { $(document).bind('keydown', 'f5', () => {

View File

@ -70,6 +70,13 @@ const link = (function() {
doc.enqueueChanges(() => editor.data.insertLink(linkTitle, linkHref), doc.selection); doc.enqueueChanges(() => editor.data.insertLink(linkTitle, linkHref), doc.selection);
} }
function addTextToEditor(text) {
const editor = noteEditor.getEditor();
const doc = editor.document;
doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);
}
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior // when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
// of opening the link in new window/tab // of opening the link in new window/tab
$(document).on('click', "a[action='note']", goToInternalNote); $(document).on('click', "a[action='note']", goToInternalNote);
@ -80,6 +87,7 @@ const link = (function() {
getNodePathFromLabel, getNodePathFromLabel,
getNotePathFromLink, getNotePathFromLink,
createNoteLink, createNoteLink,
addLinkToEditor addLinkToEditor,
addTextToEditor
}; };
})(); })();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long