@@ -13,16 +13,13 @@ import MainTreeExecutors from "./main_tree_executors.js";
1313import toast from "../services/toast.js" ;
1414import ShortcutComponent from "./shortcut_component.js" ;
1515import { t , initLocale } from "../services/i18n.js" ;
16- import type NoteDetailWidget from "../widgets/note_detail.js" ;
1716import type { ResolveOptions } from "../widgets/dialogs/delete_notes.js" ;
1817import type { PromptDialogOptions } from "../widgets/dialogs/prompt.js" ;
1918import type { ConfirmWithMessageOptions , ConfirmWithTitleOptions } from "../widgets/dialogs/confirm.js" ;
2019import type LoadResults from "../services/load_results.js" ;
2120import type { Attribute } from "../services/attribute_parser.js" ;
2221import type NoteTreeWidget from "../widgets/note_tree.js" ;
2322import type { default as NoteContext , GetTextEditorCallback } from "./note_context.js" ;
24- import type TypeWidget from "../widgets/type_widgets/type_widget.js" ;
25- import type EditableTextTypeWidget from "../widgets/type_widgets/editable_text.js" ;
2623import type { NativeImage , TouchBar } from "electron" ;
2724import TouchBarComponent from "./touch_bar.js" ;
2825import type { CKTextEditor } from "@triliumnext/ckeditor5" ;
@@ -33,6 +30,10 @@ import { ColumnComponent } from "tabulator-tables";
3330import { ChooseNoteTypeCallback } from "../widgets/dialogs/note_type_chooser.jsx" ;
3431import type RootContainer from "../widgets/containers/root_container.js" ;
3532import { SqlExecuteResults } from "@triliumnext/commons" ;
33+ import { AddLinkOpts } from "../widgets/dialogs/add_link.jsx" ;
34+ import { IncludeNoteOpts } from "../widgets/dialogs/include_note.jsx" ;
35+ import { ReactWrappedWidget } from "../widgets/basic_widget.js" ;
36+ import type { MarkdownImportOpts } from "../widgets/dialogs/markdown_import.jsx" ;
3637
3738interface Layout {
3839 getRootWidget : ( appContext : AppContext ) => RootContainer ;
@@ -199,7 +200,7 @@ export type CommandMappings = {
199200 resetLauncher : ContextMenuCommandData ;
200201
201202 executeInActiveNoteDetailWidget : CommandData & {
202- callback : ( value : NoteDetailWidget | PromiseLike < NoteDetailWidget > ) => void ;
203+ callback : ( value : ReactWrappedWidget ) => void ;
203204 } ;
204205 executeWithTextEditor : CommandData &
205206 ExecuteCommandData < CKTextEditor > & {
@@ -211,7 +212,7 @@ export type CommandMappings = {
211212 * Generally should not be invoked manually, as it is used by {@link NoteContext.getContentElement}.
212213 */
213214 executeWithContentElement : CommandData & ExecuteCommandData < JQuery < HTMLElement > > ;
214- executeWithTypeWidget : CommandData & ExecuteCommandData < TypeWidget | null > ;
215+ executeWithTypeWidget : CommandData & ExecuteCommandData < ReactWrappedWidget | null > ;
215216 addTextToActiveEditor : CommandData & {
216217 text : string ;
217218 } ;
@@ -221,9 +222,9 @@ export type CommandMappings = {
221222 showPasswordNotSet : CommandData ;
222223 showProtectedSessionPasswordDialog : CommandData ;
223224 showUploadAttachmentsDialog : CommandData & { noteId : string } ;
224- showIncludeNoteDialog : CommandData & { textTypeWidget : EditableTextTypeWidget } ;
225- showAddLinkDialog : CommandData & { textTypeWidget : EditableTextTypeWidget , text : string } ;
226- showPasteMarkdownDialog : CommandData & { textTypeWidget : EditableTextTypeWidget } ;
225+ showIncludeNoteDialog : CommandData & IncludeNoteOpts ;
226+ showAddLinkDialog : CommandData & AddLinkOpts ;
227+ showPasteMarkdownDialog : CommandData & MarkdownImportOpts ;
227228 closeProtectedSessionPasswordDialog : CommandData ;
228229 copyImageReferenceToClipboard : CommandData ;
229230 copyImageToClipboard : CommandData ;
@@ -485,13 +486,8 @@ type EventMappings = {
485486 relationMapResetZoomIn : { ntxId : string | null | undefined } ;
486487 relationMapResetZoomOut : { ntxId : string | null | undefined } ;
487488 activeNoteChanged : { } ;
488- showAddLinkDialog : {
489- textTypeWidget : EditableTextTypeWidget ;
490- text : string ;
491- } ;
492- showIncludeDialog : {
493- textTypeWidget : EditableTextTypeWidget ;
494- } ;
489+ showAddLinkDialog : AddLinkOpts ;
490+ showIncludeDialog : IncludeNoteOpts ;
495491 openBulkActionsDialog : {
496492 selectedOrActiveNoteIds : string [ ] ;
497493 } ;
@@ -670,6 +666,10 @@ export class AppContext extends Component {
670666 this . beforeUnloadListeners . push ( obj ) ;
671667 }
672668 }
669+
670+ removeBeforeUnloadListener ( listener : ( ( ) => boolean ) ) {
671+ this . beforeUnloadListeners = this . beforeUnloadListeners . filter ( l => l !== listener ) ;
672+ }
673673}
674674
675675const appContext = new AppContext ( window . glob . isMainWindow ) ;
0 commit comments