fix "cut to note", closes #2895, #1182

This commit is contained in:
zadam
2022-06-03 22:05:18 +02:00
parent 8fcc76ad6d
commit 5fbaed61c1
6 changed files with 27 additions and 12 deletions

View File

@@ -24,8 +24,8 @@ async function createNote(parentNotePath, options = {}) {
options.saveSelection = false;
}
if (options.saveSelection && utils.isCKEditorInitialized()) {
[options.title, options.content] = parseSelectedHtml(window.cutToNote.getSelectedHtml());
if (options.saveSelection) {
[options.title, options.content] = parseSelectedHtml(options.textEditor.getSelectedHtml());
}
const parentNoteId = treeService.getNoteIdFromNotePath(parentNotePath);
@@ -46,9 +46,9 @@ async function createNote(parentNotePath, options = {}) {
mime: options.mime
});
if (options.saveSelection && utils.isCKEditorInitialized()) {
if (options.saveSelection) {
// we remove the selection only after it was saved to server to make sure we don't lose anything
window.cutToNote.removeSelection();
options.textEditor.removeSelection();
}
await ws.waitForMaxKnownEntityChangeId();