mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	feat(search): support doc notes (closes #6515)
This commit is contained in:
		| @@ -186,7 +186,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { | |||||||
|  |  | ||||||
|         this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment()); |         this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment()); | ||||||
|  |  | ||||||
|         this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap"].includes(note.type)); |         this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap", "doc"].includes(note.type)); | ||||||
|  |  | ||||||
|         this.toggleDisabled(this.$showAttachmentsButton, !isInOptions); |         this.toggleDisabled(this.$showAttachmentsButton, !isInOptions); | ||||||
|         this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap"].includes(note.type)); |         this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap"].includes(note.type)); | ||||||
|   | |||||||
| @@ -97,6 +97,7 @@ const TPL = /*html*/` | |||||||
|     </div> |     </div> | ||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
|  | const SUPPORTED_NOTE_TYPES = ["text", "code", "render", "mindMap", "doc"]; | ||||||
| export default class FindWidget extends NoteContextAwareWidget { | export default class FindWidget extends NoteContextAwareWidget { | ||||||
|  |  | ||||||
|     private searchTerm: string | null; |     private searchTerm: string | null; | ||||||
| @@ -188,7 +189,7 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!["text", "code", "render", "mindMap"].includes(this.note?.type ?? "")) { |         if (!SUPPORTED_NOTE_TYPES.includes(this.note?.type ?? "")) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -251,6 +252,7 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|                 const readOnly = await this.noteContext?.isReadOnly(); |                 const readOnly = await this.noteContext?.isReadOnly(); | ||||||
|                 return readOnly ? this.htmlHandler : this.textHandler; |                 return readOnly ? this.htmlHandler : this.textHandler; | ||||||
|             case "mindMap": |             case "mindMap": | ||||||
|  |             case "doc": | ||||||
|                 return this.htmlHandler; |                 return this.htmlHandler; | ||||||
|             default: |             default: | ||||||
|                 console.warn("FindWidget: Unsupported note type for find widget", this.note?.type); |                 console.warn("FindWidget: Unsupported note type for find widget", this.note?.type); | ||||||
| @@ -354,7 +356,7 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     isEnabled() { |     isEnabled() { | ||||||
|         return super.isEnabled() && ["text", "code", "render", "mindMap"].includes(this.note?.type ?? ""); |         return super.isEnabled() && SUPPORTED_NOTE_TYPES.includes(this.note?.type ?? ""); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { |     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user