Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: Enable tag hints in mind map nodes https://github.com/siyuan-note/siyuan/issues/20978

Danielb1590a17fcee
diff --git a/app/src/protyle/render/listMindmap/editor.test.ts b/app/src/protyle/render/listMindmap/editor.test.ts
index 0409ad07d8..767e3a44b2 100644
--- a/app/src/protyle/render/listMindmap/editor.test.ts
+++ b/app/src/protyle/render/listMindmap/editor.test.ts
@@ -109,13 +109,20 @@ const browserCases = async (sourceCode: string, css: string, cleanupSource: stri
isMobile: () => false,
hintRef: (): unknown[] => [],
hintSlash: (): unknown[] => [],
+ hintTag: (): unknown[] => [],
registerBuiltinSlashHint: (callback: unknown) => callback,
mountProtyleLiteFragment: (target: HTMLElement, options: {
initialBlockHTML: string;
onChange: () => void;
afterSetContent: (owner: unknown, element: HTMLElement) => void;
runtimeCapabilities: {getTransactionOwner: typeof transactionOwner};
+ protyleOptions: {hint: {extend: Array<{key: string; hint: unknown}>}};
}) => {
+ const hints = options.protyleOptions.hint.extend;
+ check.equal(hints.find(item => item.key === "#")?.hint, dependencies.hintTag,
+ "mindmap nodes use the built-in tag creation and search hint");
+ check.ok(hints.findIndex(item => item.key === "#") < hints.findIndex(item => item.key === "/"),
+ "tag searches containing a slash retain tag hint precedence");
transactionOwner = options.runtimeCapabilities.getTransactionOwner;
target.style.width = "";
wysiwyg.innerHTML = options.initialBlockHTML;
diff --git a/app/src/protyle/render/listMindmap/editor.ts b/app/src/protyle/render/listMindmap/editor.ts
index 8568e910c4..862e820e35 100644
--- a/app/src/protyle/render/listMindmap/editor.ts
+++ b/app/src/protyle/render/listMindmap/editor.ts
@@ -4,7 +4,7 @@ import {setCustomBlockRootReady} from "../../../plugin/customBlockRender";
import {escapeHtml} from "../../../util/escape";
import {isMobile} from "../../../util/functions";
import {getDefaultKeymapBindings, getKeymapBindings, visitKeymapItems} from "../../../util/keymapBindings";
-import {hintRef, hintSlash} from "../../hint/extend";
+import {hintRef, hintSlash, hintTag} from "../../hint/extend";
import {registerBuiltinSlashHint} from "../../hint/builtinSlash";
import {mountProtyleLiteFragment} from "../../lite/fragmentEditor";
import {bindLiteCodeActions} from "../../lite/codeActions";
@@ -181,7 +181,7 @@ export const openListMindmapEditor = (options: ListMindmapEditorOptions) => {
hintSlash(key, protyle, hintSource).filter(item => !["list", "orderedList", "check"].includes(item.id)));
const hint: IProtyleOptions["hint"] = {
extend: [{key: "((", hint: hintRef}, {key: "【【", hint: hintRef}, {key: "((", hint: hintRef},
- {key: "[[", hint: hintRef}, {key: "/", hint: slash}, {key: "、", hint: slash}],
+ {key: "[[", hint: hintRef}, {key: "#", hint: hintTag}, {key: "/", hint: slash}, {key: "、", hint: slash}],
};
const originalMinWidth = host.style.minWidth;
const embedSourceIDs = new Set<string>();