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
Text editor: block references (#11925)
Adorian Doranfc53f5b1c8d3
diff --cc apps/client/src/components/note_context.spec.tsindex 7c0ffa62ea,44d2e67e9a..1facdb4ee6--- a/apps/client/src/components/note_context.spec.ts+++ b/apps/client/src/components/note_context.spec.ts@@@ -1,27 -1,8 +1,28 @@@import { beforeEach, describe, expect, it } from "vitest";+ import type { ViewScope } from "../services/link.js";import { buildNote } from "../test/easy-froca.js";+import appContext from "./app_context.js";import NoteContext from "./note_context.js";+import type TabManager from "./tab_manager.js";++describe("NoteContext.isCommandTarget", () => {+ it("matches a command with its own ntxId, or one without an ntxId while it is the active context", () => {+ const tabManager = appContext.tabManager;+ appContext.tabManager = { activeNtxId: "tab" } as TabManager;+ try {+ const tab = new NoteContext("tab");+ const popup = new NoteContext("_popup-editor");++ expect(popup.isCommandTarget("_popup-editor")).toBe(true);+ expect(tab.isCommandTarget("_popup-editor")).toBe(false);+ expect(tab.isCommandTarget(undefined)).toBe(true);+ expect(popup.isCommandTarget(undefined)).toBe(false);+ } finally {+ appContext.tabManager = tabManager;+ }+ });+});describe("NoteContext read-only capability", () => {let noteContext: NoteContext;diff --cc apps/client/src/services/link.tsindex 0d481e9ea1,58abe84d85..1022eec600--- a/apps/client/src/services/link.ts+++ b/apps/client/src/services/link.ts@@@ -61,8 -62,24 +62,13 @@@ export interface ViewScope* built for the width of a note either spills out of them or eats the room the note is left.*/floatingToolbar?: boolean;- highlightsListPreviousVisible?: boolean;- highlightsListTemporarilyHidden?: boolean;- tocTemporarilyHidden?: boolean;- /*- * The reason for adding tocPreviousVisible is to record whether the previous state of the toc is hidden or displayed,- * and then let it be displayed/hidden at the initial time. If there is no such value,- * when the right panel needs to display highlighttext but not toc, every time the note content is changed,- * toc will appear and then close immediately, because getToc(html) function will consume time- */- tocPreviousVisible?: boolean;- tocCollapsedHeadings?: Set<string>;/** When set, scrolls to a bookmark anchor within the note after navigation. */bookmark?: string;+ /**+ * The blocks of a text note a reference points at, `id` or `startId:endId`, which the note+ * scrolls to and flashes once it renders. Consumed once, as `bookmark` is.+ */+ block?: string;/*** Search terms to highlight and jump to after navigating from search results; consumed once* by the destination type widget (mirrors `bookmark` semantics).