mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	
							
								
								
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -248,6 +248,13 @@ class NoteContext extends Component { | |||||||
|             ntxId: this.ntxId |             ntxId: this.ntxId | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     async getTypeWidget() { | ||||||
|  |         return new Promise(resolve => appContext.triggerCommand('executeWithTypeWidget', { | ||||||
|  |             resolve, | ||||||
|  |             ntxId: this.ntxId | ||||||
|  |         })); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default NoteContext; | export default NoteContext; | ||||||
|   | |||||||
| @@ -24,8 +24,8 @@ async function createNote(parentNotePath, options = {}) { | |||||||
|         options.saveSelection = false; |         options.saveSelection = false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (options.saveSelection && utils.isCKEditorInitialized()) { |     if (options.saveSelection) { | ||||||
|         [options.title, options.content] = parseSelectedHtml(window.cutToNote.getSelectedHtml()); |         [options.title, options.content] = parseSelectedHtml(options.textEditor.getSelectedHtml()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const parentNoteId = treeService.getNoteIdFromNotePath(parentNotePath); |     const parentNoteId = treeService.getNoteIdFromNotePath(parentNotePath); | ||||||
| @@ -46,9 +46,9 @@ async function createNote(parentNotePath, options = {}) { | |||||||
|         mime: options.mime |         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 |         // 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(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
|   | |||||||
| @@ -292,10 +292,6 @@ function copySelectionToClipboard() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function isCKEditorInitialized() { |  | ||||||
|     return !!(window && window.cutToNote); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function dynamicRequire(moduleName) { | function dynamicRequire(moduleName) { | ||||||
|     if (typeof __non_webpack_require__ !== 'undefined') { |     if (typeof __non_webpack_require__ !== 'undefined') { | ||||||
|         return __non_webpack_require__(moduleName); |         return __non_webpack_require__(moduleName); | ||||||
| @@ -405,7 +401,6 @@ export default { | |||||||
|     clearBrowserCache, |     clearBrowserCache, | ||||||
|     normalizeShortcut, |     normalizeShortcut, | ||||||
|     copySelectionToClipboard, |     copySelectionToClipboard, | ||||||
|     isCKEditorInitialized, |  | ||||||
|     dynamicRequire, |     dynamicRequire, | ||||||
|     timeLimit, |     timeLimit, | ||||||
|     initHelpDropdown, |     initHelpDropdown, | ||||||
|   | |||||||
| @@ -327,7 +327,8 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | |||||||
|         // without await as this otherwise causes deadlock through component mutex |         // without await as this otherwise causes deadlock through component mutex | ||||||
|         noteCreateService.createNote(appContext.tabManager.getActiveContextNotePath(), { |         noteCreateService.createNote(appContext.tabManager.getActiveContextNotePath(), { | ||||||
|             isProtected: note.isProtected, |             isProtected: note.isProtected, | ||||||
|             saveSelection: true |             saveSelection: true, | ||||||
|  |             textEditor: await this.noteContext.getTextEditor() | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -341,4 +342,16 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | |||||||
|             this.refresh(); |             this.refresh(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     async executeWithTypeWidgetEvent({resolve, ntxId}) { | ||||||
|  |         if (!this.isNoteContext(ntxId)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         await this.initialized; | ||||||
|  |  | ||||||
|  |         await this.getWidgetType(); | ||||||
|  |  | ||||||
|  |         resolve(this.getTypeWidget()); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user