mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	fix note switching in current tab
This commit is contained in:
		
							parent
							
								
									ba500a3a80
								
							
						
					
					
						commit
						7d9b720ea8
					
				@ -52,7 +52,6 @@
 | 
				
			|||||||
    "ini": "1.3.5",
 | 
					    "ini": "1.3.5",
 | 
				
			||||||
    "jimp": "0.9.3",
 | 
					    "jimp": "0.9.3",
 | 
				
			||||||
    "mime-types": "2.1.26",
 | 
					    "mime-types": "2.1.26",
 | 
				
			||||||
    "moment": "2.24.0",
 | 
					 | 
				
			||||||
    "multer": "1.4.2",
 | 
					    "multer": "1.4.2",
 | 
				
			||||||
    "node-abi": "2.13.0",
 | 
					    "node-abi": "2.13.0",
 | 
				
			||||||
    "open": "7.0.0",
 | 
					    "open": "7.0.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -138,15 +138,11 @@ class AppContext {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    activateNote(notePath) {
 | 
					    tabNoteSwitchedListener({tabId}) {
 | 
				
			||||||
        const activeTabContext = this.getActiveTabContext();
 | 
					        if (tabId === this.activeTabId) {
 | 
				
			||||||
 | 
					            this._setTitleBar();
 | 
				
			||||||
        console.log("Setting activeTabContext to " + notePath);
 | 
					            this._setCurrentNotePathToHash();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        activeTabContext.setNote(notePath);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this._setTitleBar();
 | 
					 | 
				
			||||||
        this._setCurrentNotePathToHash();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _setCurrentNotePathToHash() {
 | 
					    _setCurrentNotePathToHash() {
 | 
				
			||||||
 | 
				
			|||||||
@ -95,17 +95,17 @@ export default class NoteDetailWidget extends TabAwareWidget {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async initType() {
 | 
					    async initType() {
 | 
				
			||||||
        do {
 | 
					        let foundType;
 | 
				
			||||||
            this.type = this.getWidgetType();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            console.log(`Note detail type = ${this.type} for ${this.tabContext.tabId}`);
 | 
					        do {
 | 
				
			||||||
 | 
					            foundType = this.type = this.getWidgetType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!(this.type in this.typeWidgetPromises)) {
 | 
					            if (!(this.type in this.typeWidgetPromises)) {
 | 
				
			||||||
                this.typeWidgetPromises[this.type] = this.initWidgetType(this.type);
 | 
					                this.typeWidgetPromises[this.type] = this.initWidgetType(this.type);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await this.typeWidgetPromises[this.type];
 | 
					            await this.typeWidgetPromises[this.type];
 | 
				
			||||||
        } while (this.type !== this.getWidgetType());
 | 
					        } while (foundType !== this.getWidgetType());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupClasses() {
 | 
					    setupClasses() {
 | 
				
			||||||
@ -216,10 +216,4 @@ export default class NoteDetailWidget extends TabAwareWidget {
 | 
				
			|||||||
    protectedSessionStartedListener() {
 | 
					    protectedSessionStartedListener() {
 | 
				
			||||||
        this.refresh();
 | 
					        this.refresh();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    async eventReceived(name, data, sync = false) {
 | 
					 | 
				
			||||||
        console.log("Received ", name, data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        super.eventReceived(name, data, sync);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -107,7 +107,8 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                const notePath = await treeUtils.getNotePath(data.node);
 | 
					                const notePath = await treeUtils.getNotePath(data.node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                this.appContext.activateNote(notePath);
 | 
					                const activeTabContext = this.appContext.getActiveTabContext();
 | 
				
			||||||
 | 
					                await activeTabContext.setNote(notePath);
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            expand: (event, data) => this.setExpandedToServer(data.node.data.branchId, true),
 | 
					            expand: (event, data) => this.setExpandedToServer(data.node.data.branchId, true),
 | 
				
			||||||
            collapse: (event, data) => this.setExpandedToServer(data.node.data.branchId, false),
 | 
					            collapse: (event, data) => this.setExpandedToServer(data.node.data.branchId, false),
 | 
				
			||||||
 | 
				
			|||||||
@ -36,12 +36,6 @@ export default class EmptyTypeWidget extends TypeWidget {
 | 
				
			|||||||
        return this.$widget;
 | 
					        return this.$widget;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    toggle(show) {
 | 
					 | 
				
			||||||
        console.log("EMPTY TOGGLE", show);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        super.toggle(show);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    refresh() {
 | 
					    refresh() {
 | 
				
			||||||
        this.toggle(!this.tabContext.note);
 | 
					        this.toggle(!this.tabContext.note);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user