mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	fix(popup_editor): current tab events interfering
This commit is contained in:
		
							parent
							
								
									5adca76a9a
								
							
						
					
					
						commit
						0c17a13462
					
				@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					import type { EventNames, EventData } from "../../components/app_context.js";
 | 
				
			||||||
import NoteContext from "../../components/note_context.js";
 | 
					import NoteContext from "../../components/note_context.js";
 | 
				
			||||||
import { openDialog } from "../../services/dialog.js";
 | 
					import { openDialog } from "../../services/dialog.js";
 | 
				
			||||||
import froca from "../../services/froca.js";
 | 
					import froca from "../../services/froca.js";
 | 
				
			||||||
@ -28,7 +29,7 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
 | 
				
			|||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
        setTimeout(() => {
 | 
					        setTimeout(() => {
 | 
				
			||||||
            this.openPopupEditorEvent("vdJ8utb0A0Kd");
 | 
					            this.openPopupEditorEvent("f4sIt7iRg0Lc");
 | 
				
			||||||
        }, 750);
 | 
					        }, 750);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -57,9 +58,7 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
 | 
				
			|||||||
        const noteContext = new NoteContext("_popup-editor");
 | 
					        const noteContext = new NoteContext("_popup-editor");
 | 
				
			||||||
        await noteContext.setNote(note.noteId);
 | 
					        await noteContext.setNote(note.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await this.handleEventInChildren("setNoteContext", {
 | 
					        await this.handleEventInChildren("activeContextChanged", { noteContext });
 | 
				
			||||||
            noteContext: noteContext
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -69,4 +68,14 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
 | 
				
			|||||||
            openDialog(this.$widget);
 | 
					            openDialog(this.$widget);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null {
 | 
				
			||||||
 | 
					        // Avoid events related to the current tab interfere with our popup.
 | 
				
			||||||
 | 
					        if (["noteSwitched", "noteSwitchedAndActivated"].includes(name)) {
 | 
				
			||||||
 | 
					            return Promise.resolve();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return super.handleEventInChildren(name, data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user