mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	event fixes WIP
This commit is contained in:
		
							parent
							
								
									e10d23289e
								
							
						
					
					
						commit
						091eb8f791
					
				| @ -4,12 +4,12 @@ import utils from "../services/utils.js"; | ||||
| const $dialog = $("#note-source-dialog"); | ||||
| const $noteSource = $("#note-source"); | ||||
| 
 | ||||
| export function showDialog() { | ||||
| export async function showDialog() { | ||||
|     utils.openDialog($dialog); | ||||
| 
 | ||||
|     const noteText = appContext.tabManager.getActiveTabNote().content; | ||||
|     const noteCompletement = await appContext.tabManager.getActiveTabContext().getNoteComplement(); | ||||
| 
 | ||||
|     $noteSource.text(formatHtml(noteText)); | ||||
|     $noteSource.text(formatHtml(noteCompletement.content)); | ||||
| } | ||||
| 
 | ||||
| function formatHtml(str) { | ||||
|  | ||||
| @ -102,8 +102,7 @@ export default class NoteDetailWidget extends TabAwareWidget { | ||||
| 
 | ||||
|             const typeWidget = this.typeWidgets[this.type] = new clazz(); | ||||
|             typeWidget.spacedUpdate = this.spacedUpdate; | ||||
| 
 | ||||
|             this.child(typeWidget); | ||||
|             typeWidget.setParent(this); | ||||
| 
 | ||||
|             const $renderedWidget = typeWidget.render(); | ||||
|             keyboardActionsService.updateDisplayedShortcuts($renderedWidget); | ||||
| @ -112,10 +111,7 @@ export default class NoteDetailWidget extends TabAwareWidget { | ||||
| 
 | ||||
|             await typeWidget.handleEvent('setTabContext', {tabContext: this.tabContext}); | ||||
| 
 | ||||
|             typeWidget.handleEvent('tabNoteSwitched', { | ||||
|                 tabId: this.tabContext.tabId, | ||||
|                 notePath: this.notePath | ||||
|             }); | ||||
|             this.child(typeWidget); | ||||
|         } | ||||
| 
 | ||||
|         this.setupClasses(); | ||||
|  | ||||
| @ -421,7 +421,7 @@ export default class NoteTreeWidget extends TabAwareWidget { | ||||
|     collapseTreeCommand() { this.collapseTree(); } | ||||
| 
 | ||||
|     isEnabled() { | ||||
|         return this.tabContext && this.tabContext.isActive(); | ||||
|         return !!this.tabContext; | ||||
|     } | ||||
| 
 | ||||
|     async refresh() { | ||||
|  | ||||
| @ -80,6 +80,8 @@ export default class TabAwareWidget extends BasicWidget { | ||||
|     setTabContextEvent({tabContext}) { | ||||
|         /** @var {TabContext} */ | ||||
|         this.tabContext = tabContext; | ||||
| 
 | ||||
|         this.refresh(); | ||||
|     } | ||||
| 
 | ||||
|     async newTabOpenedEvent({tabContext}) { | ||||
|  | ||||
| @ -143,7 +143,7 @@ export default class TextTypeWidget extends TypeWidget { | ||||
|     async doRefresh(note) { | ||||
|         this.textEditor.isReadOnly = await note.hasLabel('readOnly'); | ||||
| 
 | ||||
|         const noteComplement = await this.tabContext.getNoteComplement(); | ||||
|         const noteComplement = await treeCache.getNoteComplement(note.noteId); | ||||
| 
 | ||||
|         await this.spacedUpdate.allowUpdateWithoutChange(() => { | ||||
|             this.textEditor.setData(noteComplement.content); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam