mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	Merge pull request #2055 from TriliumNext/mind-map-find
feat(mindMap): support find
This commit is contained in:
		
						commit
						74a11b5e66
					
				| @ -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"].includes(note.type)); |         this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap"].includes(note.type)); | ||||||
| 
 | 
 | ||||||
|         this.toggleDisabled(this.$showAttachmentsButton, !isInOptions); |         this.toggleDisabled(this.$showAttachmentsButton, !isInOptions); | ||||||
|         this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "geoMap"].includes(note.type)); |         this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "geoMap"].includes(note.type)); | ||||||
|  | |||||||
| @ -188,7 +188,7 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (!["text", "code", "render"].includes(this.note?.type ?? "")) { |         if (!["text", "code", "render", "mindMap"].includes(this.note?.type ?? "")) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @ -250,6 +250,8 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|             case "text": |             case "text": | ||||||
|                 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": | ||||||
|  |                 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); | ||||||
|         } |         } | ||||||
| @ -352,7 +354,7 @@ export default class FindWidget extends NoteContextAwareWidget { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     isEnabled() { |     isEnabled() { | ||||||
|         return super.isEnabled() && ["text", "code", "render"].includes(this.note?.type ?? ""); |         return super.isEnabled() && ["text", "code", "render", "mindMap"].includes(this.note?.type ?? ""); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { |     async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { | ||||||
|  | |||||||
| @ -85,7 +85,7 @@ export default class FindInHtml { | |||||||
|         if (this.$results?.length) { |         if (this.$results?.length) { | ||||||
|             const $current = this.$results.eq(this.currentIndex); |             const $current = this.$results.eq(this.currentIndex); | ||||||
|             this.$results.removeClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); |             this.$results.removeClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); | ||||||
|             $current[0].scrollIntoView(); |             $current[0].scrollIntoView({ block: 'center', inline: 'center'}); | ||||||
|             $current.addClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); |             $current.addClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -286,4 +286,13 @@ export default class MindMapWidget extends TypeWidget { | |||||||
|         utils.downloadSvgAsPng(this.note.title, svg); |         utils.downloadSvgAsPng(this.note.title, svg); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     async executeWithContentElementEvent({ resolve, ntxId }: EventData<"executeWithContentElement">) { | ||||||
|  |         if (!this.isNoteContext(ntxId)) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         await this.initialized; | ||||||
|  | 
 | ||||||
|  |         resolve(this.$content.find('.main-node-container')); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -115,7 +115,7 @@ test("Search works when dismissing a tab", async ({ page, context }) => { | |||||||
| 
 | 
 | ||||||
|     await app.getTab(0).click(); |     await app.getTab(0).click(); | ||||||
|     await app.openAndClickNoteActionMenu("Search in note"); |     await app.openAndClickNoteActionMenu("Search in note"); | ||||||
|     await expect(app.findAndReplaceWidget).toBeVisible(); |     await expect(app.findAndReplaceWidget.first()).toBeVisible(); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test("New tab displays workspaces", async ({ page, context }) => { | test("New tab displays workspaces", async ({ page, context }) => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran