diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 3357cacef..bafeaaa60 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -24,6 +24,7 @@ import type NoteTreeWidget from "../widgets/note_tree.js"; import type { default as NoteContext, GetTextEditorCallback } from "./note_context.js"; import type { ContextMenuEvent } from "../menus/context_menu.js"; import type TypeWidget from "../widgets/type_widgets/type_widget.js"; +import type EditableTextTypeWidget from "../widgets/type_widgets/editable_text.js"; interface Layout { getRootWidget: (appContext: AppContext) => RootWidget; @@ -132,10 +133,10 @@ export type CommandMappings = { protectSubtree: ContextMenuCommandData; unprotectSubtree: ContextMenuCommandData; openBulkActionsDialog: - | ContextMenuCommandData - | { - selectedOrActiveNoteIds?: string[]; - }; + | ContextMenuCommandData + | { + selectedOrActiveNoteIds?: string[]; + }; editBranchPrefix: ContextMenuCommandData; convertNoteToAttachment: ContextMenuCommandData; duplicateSubtree: ContextMenuCommandData; @@ -361,6 +362,12 @@ type EventMappings = { relationMapResetPanZoom: { ntxId: string | null | undefined }; relationMapResetZoomIn: { ntxId: string | null | undefined }; relationMapResetZoomOut: { ntxId: string | null | undefined }; + activeNoteChangedEvent: {}; + showAddLinkDialog: { + textTypeWidget: EditableTextTypeWidget; + text: string; + }; + }; export type EventListener = { diff --git a/src/public/app/services/note_autocomplete.ts b/src/public/app/services/note_autocomplete.ts index 7a6cc7eb3..18311733b 100644 --- a/src/public/app/services/note_autocomplete.ts +++ b/src/public/app/services/note_autocomplete.ts @@ -322,9 +322,7 @@ function init() { $.fn.setSelectedNotePath = function (notePath) { notePath = notePath || ""; - $(this).attr(SELECTED_NOTE_PATH_KEY, notePath); - $(this).closest(".input-group").find(".go-to-selected-note-button").toggleClass("disabled", !notePath.trim()).attr("href", `#${notePath}`); // we also set href here so tooltip can be displayed }; @@ -336,11 +334,9 @@ function init() { } }; - $.fn.setSelectedExternalLink = function (externalLink) { - if (externalLink) { - // TODO: This doesn't seem to do anything with the external link, is it normal? - $(this).closest(".input-group").find(".go-to-selected-note-button").toggleClass("disabled", true); - } + $.fn.setSelectedExternalLink = function (externalLink: string | null) { + $(this).attr(SELECTED_EXTERNAL_LINK_KEY, externalLink); + $(this).closest(".input-group").find(".go-to-selected-note-button").toggleClass("disabled", true); }; $.fn.setNote = async function (noteId) { diff --git a/src/public/app/types.d.ts b/src/public/app/types.d.ts index a37df7f74..e4f882aeb 100644 --- a/src/public/app/types.d.ts +++ b/src/public/app/types.d.ts @@ -84,7 +84,7 @@ declare global { getSelectedNotePath(): string | undefined; getSelectedNoteId(): string | null; setSelectedNotePath(notePath: string | null | undefined); - getSelectedExternalLink(this: HTMLElement): string | undefined; + getSelectedExternalLink(): string | undefined; setSelectedExternalLink(externalLink: string | null | undefined); setNote(noteId: string); markRegExp(regex: RegExp, opts: { diff --git a/src/public/app/widgets/dialogs/about.js b/src/public/app/widgets/dialogs/about.ts similarity index 79% rename from src/public/app/widgets/dialogs/about.js rename to src/public/app/widgets/dialogs/about.ts index 918e725af..790e5e578 100644 --- a/src/public/app/widgets/dialogs/about.js +++ b/src/public/app/widgets/dialogs/about.ts @@ -5,6 +5,15 @@ import openService from "../../services/open.js"; import server from "../../services/server.js"; import utils from "../../services/utils.js"; +interface AppInfo { + appVersion: string; + dbVersion: number; + syncVersion: number; + buildDate: string; + buildRevision: string; + dataDirectory: string; +} + const TPL = `