Merge remote-tracking branch 'origin/master'

This commit is contained in:
zadam 2020-02-09 08:38:47 +01:00
commit 990a84c202
2 changed files with 9 additions and 4 deletions

View File

@ -635,7 +635,7 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
extraOptions.saveSelection = false;
}
if (extraOptions.saveSelection) {
if (extraOptions.saveSelection && utils.isCKEditorInitialized()) {
[extraOptions.title, extraOptions.content] = parseSelectedHtml(window.cutToNote.getSelectedHtml());
}
@ -648,7 +648,7 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
type: extraOptions.type
});
if (extraOptions.saveSelection) {
if (extraOptions.saveSelection && utils.isCKEditorInitialized()) {
// we remove the selection only after it was saved to server to make sure we don't lose anything
window.cutToNote.removeSelection();
}
@ -870,7 +870,7 @@ window.glob.cutIntoNote = () => createNoteInto(true);
keyboardActionService.setGlobalActionHandler('CutIntoNote', () => createNoteInto(true));
keyboardActionService.setGlobalActionHandler('CreateNoteInto', createNoteInto);
keyboardActionService.setGlobalActionHandler('CreateNoteInto', () => createNoteInto(true));
keyboardActionService.setGlobalActionHandler('ScrollToActiveNote', scrollToActiveNote);

View File

@ -248,6 +248,10 @@ function copySelectionToClipboard() {
}
}
function isCKEditorInitialized() {
return !!(window && window.cutToNote);
}
export default {
reloadApp,
parseDate,
@ -281,5 +285,6 @@ export default {
clearBrowserCache,
getUrlForDownload,
normalizeShortcut,
copySelectionToClipboard
copySelectionToClipboard,
isCKEditorInitialized
};