mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	fix(mindmap): pane resizer not always working
This commit is contained in:
		
							parent
							
								
									ab4e9db864
								
							
						
					
					
						commit
						ccb98d69fa
					
				| @ -165,8 +165,7 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     cleanup(): void { |     cleanup(): void { | ||||||
|         this.splitInstance?.destroy(); |         this.#destroyResizer(); | ||||||
|         this.splitInstance = undefined; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async doRefresh(note: FNote | null | undefined) { |     async doRefresh(note: FNote | null | undefined) { | ||||||
| @ -189,17 +188,19 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget { | |||||||
| 
 | 
 | ||||||
|         // Vertical vs horizontal layout
 |         // Vertical vs horizontal layout
 | ||||||
|         const layoutOrientation = (!utils.isMobile() ? options.get("splitEditorOrientation") ?? "horizontal" : "vertical"); |         const layoutOrientation = (!utils.isMobile() ? options.get("splitEditorOrientation") ?? "horizontal" : "vertical"); | ||||||
|         if (this.layoutOrientation === layoutOrientation && this.isReadOnly === isReadOnly) { |         if (this.layoutOrientation !== layoutOrientation || this.isReadOnly !== isReadOnly) { | ||||||
|             return; |             this.$widget | ||||||
|  |                 .toggleClass("split-horizontal", !isReadOnly && layoutOrientation === "horizontal") | ||||||
|  |                 .toggleClass("split-vertical", !isReadOnly && layoutOrientation === "vertical") | ||||||
|  |                 .toggleClass("split-read-only", isReadOnly); | ||||||
|  |             this.layoutOrientation = layoutOrientation as ("horizontal" | "vertical"); | ||||||
|  |             this.isReadOnly = isReadOnly; | ||||||
|  |             this.#destroyResizer(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.$widget |         if (!this.splitInstance) { | ||||||
|             .toggleClass("split-horizontal", !isReadOnly && layoutOrientation === "horizontal") |             this.#setupResizer(); | ||||||
|             .toggleClass("split-vertical", !isReadOnly && layoutOrientation === "vertical") |         } | ||||||
|             .toggleClass("split-read-only", isReadOnly); |  | ||||||
|         this.layoutOrientation = layoutOrientation as ("horizontal" | "vertical"); |  | ||||||
|         this.isReadOnly = isReadOnly; |  | ||||||
|         this.#setupResizer(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     #setupResizer() { |     #setupResizer() { | ||||||
| @ -226,6 +227,11 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #destroyResizer() { | ||||||
|  |         this.splitInstance?.destroy(); | ||||||
|  |         this.splitInstance = undefined; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed. |      * Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed. | ||||||
|      */ |      */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran