mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Fix corner case preventing notes from being created before ckeditor is initialized (#849)
* Pass deleteId to deleteBranch in ensureNoteIsAbsentFromParent * Add checks for whether window.cutToNote is defined. * check ckEditor initialized.
This commit is contained in:
		
							parent
							
								
									7651c53363
								
							
						
					
					
						commit
						adb8caa8a2
					
				@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user