mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	feat(code): proper search for read-only notes
This commit is contained in:
		| @@ -247,16 +247,16 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     async getHandler() { |     async getHandler() { | ||||||
|         if (this.note?.type === "render") { |         switch (this.note?.type) { | ||||||
|             return this.htmlHandler; |             case "render": | ||||||
|         } |                 return this.htmlHandler; | ||||||
|  |             case "code": | ||||||
|         const readOnly = await this.noteContext?.isReadOnly(); |                 return this.codeHandler; | ||||||
|  |             case "text": | ||||||
|         if (readOnly) { |                 return this.textHandler; | ||||||
|             return this.htmlHandler; |             default: | ||||||
|         } else { |                 const readOnly = await this.noteContext?.isReadOnly(); | ||||||
|             return this.note?.type === "code" ? this.codeHandler : this.textHandler; |                 return readOnly ? this.htmlHandler : this.textHandler; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -99,6 +99,16 @@ export default class AbstractCodeTypeWidget extends TypeWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     async executeWithCodeEditorEvent({ resolve, ntxId }: EventData<"executeWithCodeEditor">) { | ||||||
|  |         if (!this.isNoteContext(ntxId)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         await this.initialized; | ||||||
|  |  | ||||||
|  |         resolve(this.codeEditor); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { |     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { | ||||||
|         if (loadResults.isOptionReloaded("codeNoteTheme")) { |         if (loadResults.isOptionReloaded("codeNoteTheme")) { | ||||||
|             const themeId = options.get("codeNoteTheme"); |             const themeId = options.get("codeNoteTheme"); | ||||||
|   | |||||||
| @@ -71,16 +71,6 @@ export default class EditableCodeTypeWidget extends AbstractCodeTypeWidget { | |||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async executeWithCodeEditorEvent({ resolve, ntxId }: EventData<"executeWithCodeEditor">) { |  | ||||||
|         if (!this.isNoteContext(ntxId)) { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         await this.initialized; |  | ||||||
|  |  | ||||||
|         resolve(this.codeEditor); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     buildTouchBarCommand({ TouchBar, buildIcon }: CommandListenerData<"buildTouchBar">) { |     buildTouchBarCommand({ TouchBar, buildIcon }: CommandListenerData<"buildTouchBar">) { | ||||||
|         const items: TouchBarItem[] = []; |         const items: TouchBarItem[] = []; | ||||||
|         const note = this.note; |         const note = this.note; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user