Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(autocomplete): port the CKEditor mention feed
Elian Doran6c40ce2148a1
diff --git a/apps/client/src/services/note_autocomplete.spec.ts b/apps/client/src/services/note_autocomplete.spec.tsnew file mode 100644index 0000000000..a2e55eab6f--- /dev/null+++ b/apps/client/src/services/note_autocomplete.spec.ts@@ -0,0 +1,160 @@+import { beforeEach, describe, expect, it, vi } from "vitest";++const { getActiveContextNoteId, getInboxTarget, translate, logError } = vi.hoisted(() => ({+ getActiveContextNoteId: vi.fn<() => string | null>(() => "activeNote"),+ getInboxTarget: vi.fn<() => Promise<unknown>>(+ async () => ({ kind: "inbox", noteId: "inb", title: "Inbox" })+ ),+ // i18next is never initialized here, so the real `t` returns undefined. Echoing the key keeps+ // the label assertions about which string is chosen rather than about its English.+ translate: vi.fn((key: string, _opts?: Record<string, unknown>) => key),+ logError: vi.fn()+}));++vi.mock("../components/app_context.js", () => ({+ default: { tabManager: { getActiveContextNoteId } }+}));++vi.mock("./date_notes.js", () => ({+ default: { getInboxTarget }+}));++vi.mock("./i18n.js", async (importOriginal) => ({+ ...(await importOriginal<typeof import("./i18n.js")>()),+ t: translate+}));++// Narrows the blanket ws mock from test/setup.ts to a spy, so what the module reports can be asserted.+vi.mock("./ws.js", () => ({+ default: {+ subscribeToMessages() {},+ async waitForMaxKnownEntityChangeId() {}+ },+ subscribeToMessages() {},+ unsubscribeToMessage() {},+ async waitForMaxKnownEntityChangeId() {},+ logError+}));++import noteAutocomplete, { getNoteSuggestions, type Suggestion } from "./note_autocomplete.js";+import server from "./server.js";++beforeEach(() => {+ vi.clearAllMocks();+ getActiveContextNoteId.mockReturnValue("activeNote");+ server.get = vi.fn(async () => []) as typeof server.get;+});++describe("getNoteSuggestions", () => {+ it("queries the server and returns its rows as they are", async () => {+ server.get = vi.fn(async () => [ { noteTitle: "Result", notePath: "root/x" } ]) as typeof server.get;++ expect(await getNoteSuggestions("a b")).toEqual([ { noteTitle: "Result", notePath: "root/x" } ]);+ expect(server.get).toHaveBeenCalledWith("autocomplete?query=a%20b&activeNoteId=activeNote&fastSearch=true");++ await getNoteSuggestions("a", { fastSearch: false });+ expect(server.get).toHaveBeenLastCalledWith(expect.stringContaining("fastSearch=false"));+ expect(getInboxTarget).not.toHaveBeenCalled();+ });++ it("places both creation rows above the results", async () => {+ server.get = vi.fn(async () => [ { noteTitle: "Existing", notePath: "root/y" } ]) as typeof server.get;++ const rows = await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(rows.map((r) => r.action)).toEqual([ "create-note", "create-child-note", undefined ]);+ expect(rows.map((r) => r.noteTitle)).toEqual([ "New", "New", "Existing" ]);+ // The inbox is resolved when the row is picked, so the row carries no parent.+ expect(rows[0].parentNoteId).toBeUndefined();+ expect(rows[1].parentNoteId).toBe("activeNote");+ });++ it("uses root as the child-note parent when there is no active note", async () => {+ getActiveContextNoteId.mockReturnValue(null);++ const rows = await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(rows[1]).toMatchObject({ action: "create-child-note", parentNoteId: "root" });+ });++ it("adds no creation rows for a blank term", async () => {+ server.get = vi.fn(async () => [ { noteTitle: "Recent", notePath: "root/r" } ]) as typeof server.get;++ expect(await getNoteSuggestions(" ", { allowCreatingNotes: true })).toEqual([ { noteTitle: "Recent", notePath: "root/r" } ]);+ expect(getInboxTarget).not.toHaveBeenCalled();+ });++ it.each([+ { kind: "inbox", title: "Inbox" },+ { kind: "workspaceInbox", title: "Work" },+ { kind: "workspaceRoot", title: "Project" }+ ])("names the $kind destination in the create-note row", async ({ kind, title }) => {+ getInboxTarget.mockResolvedValueOnce({ kind, title });++ const rows = await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(rows[0].highlightedNotePathTitle).toBe("note_autocomplete.create-note-into");+ expect(translate).toHaveBeenCalledWith("note_autocomplete.create-note-into", { term: "New", parentTitle: title });+ });++ it.each([+ { kind: "root", key: "note_autocomplete.create-note-into-root" },+ { kind: "dayNote", key: "note_autocomplete.create-note-into-day-note" }+ ])("labels the $kind destination without its title", async ({ kind, key }) => {+ getInboxTarget.mockResolvedValueOnce({ kind, noteId: "root", title: "root" });++ const rows = await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(rows[0].highlightedNotePathTitle).toBe(key);+ expect(translate).toHaveBeenCalledWith(key, { term: "New" });+ });++ it.each([+ { when: "the lookup fails", arrange: () => getInboxTarget.mockRejectedValueOnce(new Error("nope")) },+ { when: "the destination has no title", arrange: () => getInboxTarget.mockResolvedValueOnce({ kind: "inbox" }) }+ ])("falls back to an unqualified label when $when", async ({ arrange }) => {+ arrange();++ const rows = await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(rows[0]).toMatchObject({ action: "create-note", highlightedNotePathTitle: "note_autocomplete.create-note" });+ });++ it("reports a failed inbox lookup", async () => {+ getInboxTarget.mockRejectedValueOnce(new Error("nope"));++ await getNoteSuggestions("New", { allowCreatingNotes: true });+ expect(logError).toHaveBeenCalledWith(expect.stringContaining("nope"));+ });+});++describe("autocompleteSourceForCKEditor", () => {+ it("maps the rows into mention feed items, creation rows first", async () => {+ server.get = vi.fn(async () => [ {+ noteTitle: "Foo",+ notePathTitle: "Root / Foo",+ notePath: "root/abc",+ highlightedNotePathTitle: "<b>Foo</b>",+ icon: "bx bx-note"+ } ]) as typeof server.get;++ const items = await noteAutocomplete.autocompleteSourceForCKEditor("Foo");+ expect(items.map((item) => (item as Suggestion).action)).toEqual([ "create-note", "create-child-note", undefined ]);+ expect(items[2]).toEqual({+ action: undefined,+ noteTitle: "Foo",+ id: "@Root / Foo",+ name: "Root / Foo",+ link: "#root/abc",+ notePath: "root/abc",+ highlightedNotePathTitle: "<b>Foo</b>",+ icon: "bx bx-note"+ });+ // A creation row has no path title of its own.+ expect(items[0]).toMatchObject({ id: "@undefined", name: "" });+ });++ it("omits the creation rows when the host cannot act on them", async () => {+ server.get = vi.fn(async () => [+ { noteTitle: "Foo", notePathTitle: "Root / Foo", notePath: "root/abc" }+ ]) as typeof server.get;++ const items = await noteAutocomplete.autocompleteSourceForCKEditor("Foo", false);+ expect(items.map((item) => (item as Suggestion).action)).toEqual([ undefined ]);+ });+});diff --git a/apps/client/src/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.tsindex 4dc6b41df6..946c755723 100644--- a/apps/client/src/services/note_autocomplete.ts+++ b/apps/client/src/services/note_autocomplete.ts@@ -1,5 +1,12 @@import type { MentionFeedObjectItem } from "@triliumnext/ckeditor5";-import type { AutocompleteResult } from "@triliumnext/commons";+import type { AutocompleteResult, InboxTargetResponse } from "@triliumnext/commons";++import appContext from "../components/app_context.js";+import dateNoteService from "./date_notes.js";+import { t } from "./i18n.js";+import server from "./server.js";+import { escapeHtml } from "./utils.js";+import { logError } from "./ws.js";/*** One row of the dropdown: a note from `GET /api/autocomplete`, or a row added by the client.@@ -28,14 +35,95 @@ export interface Options {isCommandPalette?: boolean;}+/**+ * Feeds a CKEditor mention. Creation entries are offered only where the editor's host component+ * implements `createNoteForReferenceLink`, which is what `MentionCustomization` calls to act on+ * them.+ */+async function autocompleteSourceForCKEditor(queryText: string, allowCreatingNotes = true): Promise<MentionFeedObjectItem[]> {+ const rows = await getNoteSuggestions(queryText, { allowCreatingNotes });++ return rows.map((row) => ({+ action: row.action,+ noteTitle: row.noteTitle,+ id: `@${row.notePathTitle}`,+ name: row.notePathTitle || "",+ link: `#${row.notePath}`,+ notePath: row.notePath,+ highlightedNotePathTitle: row.highlightedNotePathTitle,+ icon: row.icon+ }));+}++/**+ * Returns the notes matching `term`, or the recently visited notes when `term` is blank. With+ * `allowCreatingNotes`, a non-blank term also gets the two note-creation rows, ahead of the notes.+ */+export async function getNoteSuggestions(term: string, { allowCreatingNotes = false, fastSearch = true } = {}): Promise<Suggestion[]> {+ const activeNoteId = appContext.tabManager.getActiveContextNoteId();++ // Runs concurrently with the search, so naming the destination costs a request but no wait.+ const pendingInboxTarget = term.trim().length >= 1 && allowCreatingNotes ? getInboxTarget() : null;++ const results = await server.get<AutocompleteResult[]>(`autocomplete?query=${encodeURIComponent(term)}&activeNoteId=${activeNoteId}&fastSearch=${fastSearch}`);+ if (!pendingInboxTarget) {+ return results;+ }++ // Both rows stay above the results: the CKEditor mention feed renders only the first+ // `mention.dropdownLimit` items.+ return [+ {+ action: "create-note",+ noteTitle: term,+ highlightedNotePathTitle: buildCreateNoteTitle(term, await pendingInboxTarget)+ },+ {+ action: "create-child-note",+ noteTitle: term,+ parentNoteId: activeNoteId || "root",+ highlightedNotePathTitle: t("note_autocomplete.create-child-note", { term: escapeHtml(term) })+ },+ ...results+ ];+}++async function getInboxTarget() {+ try {+ return await dateNoteService.getInboxTarget();+ } catch (e) {+ // The entry falls back to a label with no destination rather than failing the dropdown.+ logError(`Unable to resolve the inbox target: ${e}`);+ return null;+ }+}++/** Labels the creation entry with the note the capture would land in. */+function buildCreateNoteTitle(term: string, target: InboxTargetResponse | null) {+ if (!target) {+ return t("note_autocomplete.create-note", { term: escapeHtml(term) });+ }++ if (target.kind === "dayNote") {+ return t("note_autocomplete.create-note-into-day-note", { term: escapeHtml(term) });+ }++ // The root note's own title is not one the user recognizes in the tree.+ if (target.kind === "root") {+ return t("note_autocomplete.create-note-into-root", { term: escapeHtml(term) });+ }++ if (!target.title) {+ return t("note_autocomplete.create-note", { term: escapeHtml(term) });+ }++ return t("note_autocomplete.create-note-into", { term: escapeHtml(term), parentTitle: escapeHtml(target.title) });+}+// #region Stubs// TODO: Stubs that keep the existing callers compiling and running while the implementation is// rebuilt. None of them searches for or suggests anything.-async function autocompleteSourceForCKEditor(_queryText: string, _allowCreatingNotes = true): Promise<MentionFeedObjectItem[]> {- return [];-}-function initNoteAutocomplete($el: JQuery<HTMLElement>, _options?: Options) {return $el;}diff --git a/apps/client/src/services/note_autocomplete_bak.spec.ts b/apps/client/src/services/note_autocomplete_bak.spec.tsindex f8b3e51b18..7087af7c8a 100644--- a/apps/client/src/services/note_autocomplete_bak.spec.ts+++ b/apps/client/src/services/note_autocomplete_bak.spec.ts@@ -113,65 +113,6 @@ function lastCommandWith(arg: any) {return autocompleteCalls.some((c) => c[0] === arg && c[1] === undefined);}-describe("note_autocomplete", () => {- beforeEach(() => {- vi.clearAllMocks();- getActiveContextNoteId.mockReturnValue("activeNote");- getActiveContext.mockReturnValue({ hoistedNoteId: "hoisted" });- registerAutocompleteStub();- server.get = vi.fn(async () => []) as typeof server.get;- noteAutocomplete.init();- });-- describe("autocompleteSourceForCKEditor (default export)", () => {- it("maps server rows into CKEditor mention feed items", async () => {- server.get = vi.fn(async () => [- {- action: "search-notes",- noteTitle: "Foo",- notePathTitle: "Root / Foo",- notePath: "root/abc",- highlightedNotePathTitle: "<b>Foo</b>",- icon: "bx bx-note"- }- ]) as typeof server.get;-- const result = (await noteAutocomplete.autocompleteSourceForCKEditor("Foo")) as any[];- // autocompleteSourceForCKEditor forces allowCreatingNotes -> the creation rows are prepended.- const mapped = result.find((r) => r.notePath === "root/abc");- expect(mapped).toEqual({- action: "search-notes",- noteTitle: "Foo",- id: "@Root / Foo",- name: "Root / Foo",- link: "#root/abc",- notePath: "root/abc",- highlightedNotePathTitle: "<b>Foo</b>",- icon: "bx bx-note"- });- });-- it("omits the creation rows when the host cannot act on them", async () => {- server.get = vi.fn(async () => [- { noteTitle: "Foo", notePathTitle: "Root / Foo", notePath: "root/abc" }- ]) as typeof server.get;-- const result = (await noteAutocomplete.autocompleteSourceForCKEditor("Foo", false)) as any[];- expect(result.map((r) => r.action)).toEqual([ undefined ]);- });-- it("falls back to empty name when notePathTitle is missing", async () => {- server.get = vi.fn(async () => []) as typeof server.get;- const result = (await noteAutocomplete.autocompleteSourceForCKEditor("X")) as any[];- // only the synthetic creation rows remain; they have no notePathTitle.- const createRow = result.find((r) => r.action === "create-note");- expect(createRow).toBeDefined();- expect(createRow?.name).toBe("");- expect(createRow?.id).toBe("@undefined");- });- });-});-// ---------------------------------------------------------------------------// Exercise the internal autocompleteSource via the dataset.source registered// during initNoteAutocomplete (it is not exported, so we go through the public@@ -239,16 +180,6 @@ describe("autocompleteSource (via dataset)", () => {expect(rows[0].commandId).toBe("c");});- it("queries the server and returns plain results", async () => {- server.get = vi.fn(async () => [{ noteTitle: "Result", notePath: "root/x" }]) as typeof server.get;- const { dataset } = initAndGetSource();- const rows = await runSource(dataset, "hello");- expect(server.get).toHaveBeenCalledWith(- "autocomplete?query=hello&activeNoteId=activeNote&fastSearch=true"- );- expect(rows).toEqual([{ noteTitle: "Result", notePath: "root/x" }]);- });-it("does the slow-search placeholder branch when fastSearch is false", async () => {server.get = vi.fn(async () => [{ noteTitle: "R" }]) as typeof server.get;const cbRows: any[][] = [];@@ -279,70 +210,6 @@ describe("autocompleteSource (via dataset)", () => {expect(server.get).not.toHaveBeenCalled();});- it("keeps both creation rows above the results, so neither is scrolled or sliced away", async () => {- server.get = vi.fn(async () => [{ noteTitle: "Existing", notePath: "root/y" }]) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true, allowJumpToSearchNotes: true });- const rows = await runSource(dataset, "New");- expect(rows.map((r) => r.action)).toEqual([ "create-note", "create-child-note", undefined, "search-notes" ]);- // the inbox is resolved on selection, so the row carries no parent- expect(rows[0].parentNoteId).toBeUndefined();- expect(rows[1].parentNoteId).toBe("activeNote");- expect(rows[2].noteTitle).toBe("Existing");- });-- it.each([- { kind: "inbox", title: "Inbox" },- { kind: "workspaceInbox", title: "Work" },- { kind: "workspaceRoot", title: "Project" }- ])("names the $kind destination in the create-note row", async ({ kind, title }) => {- getInboxTarget.mockResolvedValueOnce({ kind, title });- server.get = vi.fn(async () => []) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true });- const rows = await runSource(dataset, "New");- expect(rows[0].highlightedNotePathTitle).toBe("note_autocomplete.create-note-into");- expect(translate).toHaveBeenCalledWith("note_autocomplete.create-note-into", { term: "New", parentTitle: title });- });-- it("says top level for a database with neither an inbox nor a journal", async () => {- getInboxTarget.mockResolvedValueOnce({ kind: "root", noteId: "root", title: "root" });- server.get = vi.fn(async () => []) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true });- const rows = await runSource(dataset, "New");- // The root note's title would be meaningless in the label, so it is not used.- expect(rows[0].highlightedNotePathTitle).toBe("note_autocomplete.create-note-into-root");- expect(translate).toHaveBeenCalledWith("note_autocomplete.create-note-into-root", { term: "New" });- });-- it("names the day note, which has no title of its own until it is created", async () => {- getInboxTarget.mockResolvedValueOnce({ kind: "dayNote" });- server.get = vi.fn(async () => []) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true });- const rows = await runSource(dataset, "New");- expect(rows[0].highlightedNotePathTitle).toBe("note_autocomplete.create-note-into-day-note");- expect(translate).toHaveBeenCalledWith("note_autocomplete.create-note-into-day-note", { term: "New" });- });-- it.each([- { when: "the lookup fails", arrange: () => getInboxTarget.mockRejectedValueOnce(new Error("nope")) },- { when: "the destination has no title", arrange: () => getInboxTarget.mockResolvedValueOnce({ kind: "inbox" }) }- ])("falls back to an unqualified label when $when", async ({ arrange }) => {- arrange();- server.get = vi.fn(async () => []) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true });- const rows = await runSource(dataset, "New");- expect(rows[0].action).toBe("create-note");- expect(rows[0].highlightedNotePathTitle).toBe("note_autocomplete.create-note");- });-- it("uses root as the child-note parent when there is no active note", async () => {- getActiveContextNoteId.mockReturnValue(null);- server.get = vi.fn(async () => []) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true });- const rows = await runSource(dataset, "New");- const childRow = rows.find((r) => r.action === "create-child-note");- expect(childRow?.parentNoteId).toBe("root");- });-it("appends a search-notes suggestion when allowJumpToSearchNotes", async () => {server.get = vi.fn(async () => [{ noteTitle: "A", notePath: "root/a" }]) as typeof server.get;const { dataset } = initAndGetSource({ allowJumpToSearchNotes: true });@@ -358,13 +225,10 @@ describe("autocompleteSource (via dataset)", () => {expect(rows[0].externalLink).toBe("https://example.com/x");});- it("does not add a create suggestion for an empty term", async () => {+ it("does not add a search-notes suggestion for an empty term", async () => {server.get = vi.fn(async () => [{ noteTitle: "A", notePath: "root/a" }]) as typeof server.get;- const { dataset } = initAndGetSource({ allowCreatingNotes: true, allowJumpToSearchNotes: true, allowExternalLinks: true });+ const { dataset } = initAndGetSource({ allowJumpToSearchNotes: true, allowExternalLinks: true });const rows = await runSource(dataset, " ");- // length === 0 so neither creation row nor search-notes nor external-link added- expect(rows.every((r) => r.action !== "create-note")).toBe(true);- expect(rows.every((r) => r.action !== "create-child-note")).toBe(true);expect(rows.every((r) => r.action !== "search-notes")).toBe(true);});diff --git a/apps/client/src/services/note_autocomplete_bak.ts b/apps/client/src/services/note_autocomplete_bak.tsindex 73ec7c0f90..c4c8a10b20 100644--- a/apps/client/src/services/note_autocomplete_bak.ts+++ b/apps/client/src/services/note_autocomplete_bak.ts@@ -1,14 +1,10 @@-import type { MentionFeedObjectItem } from "@triliumnext/ckeditor5";-import type { InboxTargetResponse } from "@triliumnext/commons";-import appContext from "../components/app_context.js";import commandRegistry from "./command_registry.js";import dateNoteService from "./date_notes.js";import froca from "./froca.js";import { t } from "./i18n.js";-import type { Options, Suggestion } from "./note_autocomplete.js";+import { getNoteSuggestions, type Options, type Suggestion } from "./note_autocomplete.js";import noteCreateService from "./note_create.js";-import server from "./server.js";import { escapeHtml } from "./utils.js";import { logError } from "./ws.js";@@ -85,70 +81,6 @@ function createSearchScheduler() {};}-async function getInboxTarget() {- try {- return await dateNoteService.getInboxTarget();- } catch (e) {- // The entry falls back to a label with no destination rather than failing the dropdown.- logError(`Unable to resolve the inbox target: ${e}`);- return null;- }-}--/** Labels the creation entry with the note the capture would land in. */-function buildCreateNoteTitle(term: string, target: InboxTargetResponse | null) {- if (!target) {- return t("note_autocomplete.create-note", { term: escapeHtml(term) });- }-- if (target.kind === "dayNote") {- return t("note_autocomplete.create-note-into-day-note", { term: escapeHtml(term) });- }-- // The root note's own title names nothing the user recognises in the tree.- if (target.kind === "root") {- return t("note_autocomplete.create-note-into-root", { term: escapeHtml(term) });- }-- if (!target.title) {- return t("note_autocomplete.create-note", { term: escapeHtml(term) });- }-- return t("note_autocomplete.create-note-into", { term: escapeHtml(term), parentTitle: escapeHtml(target.title) });-}--/**- * Feeds a CKEditor mention. Creation entries are offered only where the editor's host component- * implements `createNoteForReferenceLink`, which is what `MentionCustomization` calls to act on- * them.- */-async function autocompleteSourceForCKEditor(queryText: string, allowCreatingNotes = true) {- return await new Promise<MentionFeedObjectItem[]>((res, rej) => {- autocompleteSource(- queryText,- (rows) => {- res(- rows.map((row) => {- return {- action: row.action,- noteTitle: row.noteTitle,- id: `@${row.notePathTitle}`,- name: row.notePathTitle || "",- link: `#${row.notePath}`,- notePath: row.notePath,- highlightedNotePathTitle: row.highlightedNotePathTitle,- icon: row.icon- };- })- );- },- {- allowCreatingNotes- }- );- });-}-async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void, options: Options = {}) {// Check if we're in command modeif (options.isCommandPalette && term.startsWith(">")) {@@ -188,34 +120,12 @@ async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void]);}- const activeNoteId = appContext.tabManager.getActiveContextNoteId();const length = term.trim().length;- // Runs concurrently with the search, so naming the destination costs a request but no wait.- const pendingInboxTarget = length >= 1 && options.allowCreatingNotes ? getInboxTarget() : null;-- let results = await server.get<Suggestion[]>(`autocomplete?query=${encodeURIComponent(term)}&activeNoteId=${activeNoteId}&fastSearch=${fastSearch}`);+ let results = await getNoteSuggestions(term, { allowCreatingNotes: options.allowCreatingNotes, fastSearch });options.fastSearch = true;- // Both rows stay above the results: the CKEditor mention feed renders only the first- // `mention.dropdownLimit` items, and the jQuery dropdown scrolls past as many as 200.- if (pendingInboxTarget) {- results = [- {- action: "create-note",- noteTitle: term,- highlightedNotePathTitle: buildCreateNoteTitle(term, await pendingInboxTarget)- } as Suggestion,- {- action: "create-child-note",- noteTitle: term,- parentNoteId: activeNoteId || "root",- highlightedNotePathTitle: t("note_autocomplete.create-child-note", { term: escapeHtml(term) })- } as Suggestion- ].concat(results);- }-if (length >= 1 && options.allowJumpToSearchNotes) {results = results.concat([{@@ -602,7 +512,6 @@ export function triggerRecentNotes(inputElement: HTMLInputElement | null | undef}export default {- autocompleteSourceForCKEditor,initNoteAutocomplete,showRecentNotes,showAllCommands,