dsh-mindmap 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/client.js +132 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ A DeepSeek Harness plugin that turns a plain Markdown file into a live mindmap.
|
|
|
18
18
|
- **Four tools** (`mindmap_create` / `mindmap_open` / `mindmap_get` / `mindmap_update`) — plain Markdown files in the session working directory; the root node title is the filename and stays in sync both ways (`renameRoot` renames the file, collisions are rejected).
|
|
19
19
|
- **Live panel with zero extra channels** — the panel consumes the session snapshot (`mindmap_*` tool results), so every AI edit re-renders immediately.
|
|
20
20
|
- **Reliable open, recoverable loading state** — AI create/open results always expand the panel (a structural-fingerprint selector drives snapshot recomputation even when the host reuses the nodes array reference); clicking a `.md` first reads it through the local read-only route, while AI fallback loading still recovers from case-only path mismatches, inline tool errors, and a ~30s watchdog timeout with one-click retry.
|
|
21
|
+
- **Graceful parse failure** — if a document's Markdown ever breaks the parser, the panel never crashes: the mindmap area shows an explicit parse-failed state with the error, the original file is left untouched, and you can switch back to the directory tab or let the AI fix the content and reopen. Normal documents never reach this path.
|
|
21
22
|
- **Floating right panel or native sidebar tab** — when `dsh-better-sidebar` is installed, the mindmap registers as a native single-instance tab (`dsh-mindmap:mindmap`) inside Better Sidebar, with a compact one-row toolbar (mindmap list, current mindmap, and export on the same line); the header 思维脑图 button opens or focuses that tab. When Better Sidebar is absent, the panel falls back to a standalone floating right panel toggled by the 思维脑图 button — drag-resizable (280px ~ 80% viewport), persisted, and pushing the chat left (layout-push) so the two never overlap. AI create/open/view intents always open or focus the panel/tab and switch to the target document, including when it is currently closed or the same document is opened again. The mode switch is fully reversible: if Better Sidebar is unloaded mid-session, the standalone panel and layout-push CSS are restored automatically.
|
|
22
23
|
- **Directory tree tab** — a persistent tree of the session working directory (served by plugin-owned read-only routes), lazy-loaded per directory; right-click to create a mindmap in the inbox or inside a directory; left-click a `.md` renders it through the read-only route first, then hands it to the AI for editing when the draft is empty. Labeled 目录 in standalone mode and 脑图列表 in sidebar mode.
|
|
23
24
|
- **Single-mindmap mode** — two tabs only: the tree/list tab and 脑图 (the current mindmap); opening another `.md` replaces the previous one.
|
package/README.zh-CN.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- **四个工具**(`mindmap_create` / `mindmap_open` / `mindmap_get` / `mindmap_update`)——会话工作目录里的普通 `.md` 文件;根节点标题 = 文件名,双向同步(`renameRoot` 触发文件重命名,撞名报错不覆盖)。
|
|
19
19
|
- **零通道实时面板**——面板直接消费会话快照里的 `mindmap_*` 工具结果,AI 每改一步面板即渲染一次。
|
|
20
20
|
- **打开必达 + 加载态可恢复**——AI create/open 结果落地,面板必展开(节点结构指纹驱动快照重算,不受宿主数组引用稳定性影响);点目录树 `.md` 会先走本地只读路由直接显示,AI fallback 加载态仍支持大小写路径自动匹配、工具错误提示、约 30 秒超时和一键重试。
|
|
21
|
+
- **解析失败显式成态**——文档 Markdown 万一让解析器崩掉,面板绝不整体炸:脑图区显示明确的解析失败态并带错误信息,原文件内容原样未动,可切回目录 tab 查看,或让 AI 修正后重新打开。正常文档永远走不到这里。
|
|
21
22
|
- **原生侧栏 Tab 或右侧悬浮面板**——安装了 `dsh-better-sidebar` 时,脑图注册为 Better Sidebar 内的原生单实例 Tab(`dsh-mindmap:mindmap`),工具栏只有一行(脑图列表、当前脑图、导出图片在同一行);头部「思维脑图」按钮打开或聚焦该 Tab。未安装时回退为独立的右侧悬浮面板——会话头部按钮开合,宽度可拖(280px ~ 80% 视口)并持久化,打开时**聊天区向左让位**(布局推挤,互不遮挡)。AI 创建、打开或查看脑图时自动展开或聚焦面板/Tab 并切换到目标文档,即使当前收起或重复打开同一文档也能接续跟随。模式切换完全可逆:Better Sidebar 运行中卸载后,独立面板与布局推挤 CSS 自动恢复。
|
|
22
23
|
- **常驻目录树 tab**——工作目录结构懒加载树(插件自建只读路由);空白处右键新建到脑图收件箱、目录右键新建到该目录;左键点 `.md` 先通过只读路由直接显示,再在草稿为空时交给 AI 对话编辑。独立面板模式标签为「目录」,侧栏模式标签为「脑图列表」。
|
|
23
24
|
- **单脑图模式**——面板只有树/列表和「脑图」两个 tab,打开新脑图替换旧的那颗。
|
package/client.js
CHANGED
|
@@ -284,6 +284,14 @@ window.__ModuleLoader__.load({
|
|
|
284
284
|
const MAX_TABLE_COLUMNS = 100;
|
|
285
285
|
const MAX_TABLE_ROWS = 1000;
|
|
286
286
|
const MAX_TABLE_CELLS = 10000;
|
|
287
|
+
// 引用块递归深度上限:一行内海量 > 逐层剥前缀递归(实测 2000 层即栈溢出),
|
|
288
|
+
// 超限后剩余引用标记按普通段落文本处理——病理内容不炸面板,树始终可解析。
|
|
289
|
+
const MAX_QUOTE_DEPTH = 32;
|
|
290
|
+
// 链接 URL 允许一层括号嵌套(维基式 (bar)):配平的 () 属于 URL,未配平则整体不命中。
|
|
291
|
+
// 四处共用(render INLINE_PATTERN / 此处 hasInlineFormat / export 剥离 / render 切片契约),
|
|
292
|
+
// 任一处亲缘度被改歪,drift guard 测试即断言失败。JS 正则字面量不支持插值,
|
|
293
|
+
// 故抽成字符串片段,各处用 new RegExp 拼接——source 经脚本验证与原字面量逐字符一致。
|
|
294
|
+
const LINK_URL = "(?:[^()]|\\([^()]*\\))*";
|
|
287
295
|
|
|
288
296
|
/** 缩进宽度:tab 按 4 空格折算。 */
|
|
289
297
|
function indentWidth(raw) {
|
|
@@ -299,7 +307,14 @@ window.__ModuleLoader__.load({
|
|
|
299
307
|
* 否则是 text 块。
|
|
300
308
|
*/
|
|
301
309
|
function hasInlineFormat(text) {
|
|
302
|
-
|
|
310
|
+
// 链接 URL 的嵌套括号亲缘度见 LINK_URL(与 render.js / export.js 四处同源)。
|
|
311
|
+
return new RegExp(
|
|
312
|
+
"(\\*\\*[^*]+\\*\\*)" +
|
|
313
|
+
"|(\\*[^*\\s][^*]*\\*)" +
|
|
314
|
+
"|(~~[^~]+~~)" +
|
|
315
|
+
"|(`[^`]+`)" +
|
|
316
|
+
"|(!?\\[[^\\]]*\\]\\(" + LINK_URL + "\\))"
|
|
317
|
+
).test(String(text ?? ""));
|
|
303
318
|
}
|
|
304
319
|
|
|
305
320
|
/** 表格分隔行:由 | - : 空白组成且至少含一个 -。 */
|
|
@@ -332,7 +347,8 @@ window.__ModuleLoader__.load({
|
|
|
332
347
|
// data.rows 不含分隔行(解析时剔除);复制时补回,粘回 Markdown 仍是合法表格。
|
|
333
348
|
const escapeCell = (cell) => String(cell ?? "").replace(/\\/g, "\\\\").replace(/\|/g, "\\|");
|
|
334
349
|
const lines = data.rows.map((row) => `| ${row.map(escapeCell).join(" | ")} |`);
|
|
335
|
-
|
|
350
|
+
// 只要有表头就补分隔行(含表头-only 表格)——粘回 Markdown 仍是合法表格。
|
|
351
|
+
if (data.rows.length >= 1) lines.splice(1, 0, `| ${data.rows[0].map(() => "---").join(" | ")} |`);
|
|
336
352
|
return lines.join("\n");
|
|
337
353
|
}
|
|
338
354
|
return data.raw || node.topic || "";
|
|
@@ -469,7 +485,8 @@ window.__ModuleLoader__.load({
|
|
|
469
485
|
* 块级解析循环(标题/列表/代码/引用/表格/段落)。引用块内容递归走本函数,
|
|
470
486
|
* echoRoot=false 时不参与根标题回声。节点挂入 container(顶层 = root.children)。
|
|
471
487
|
*/
|
|
472
|
-
function parseBlockLines(container, lineList, echoRoot) {
|
|
488
|
+
function parseBlockLines(container, lineList, echoRoot, depth) {
|
|
489
|
+
const quoteDepth = depth || 0;
|
|
473
490
|
const headingStack = [];
|
|
474
491
|
let listStack = [];
|
|
475
492
|
const parentRec = () => (headingStack.length ? headingStack[headingStack.length - 1] : null);
|
|
@@ -633,6 +650,11 @@ window.__ModuleLoader__.load({
|
|
|
633
650
|
// 递归走同一套块规则;首个 text/md 段提升为自身内容(001 §3.1),
|
|
634
651
|
// 其余内容成为子节点。
|
|
635
652
|
if (/^\s*>/.test(line)) {
|
|
653
|
+
// 深度上限见 MAX_QUOTE_DEPTH:超限后剩余 > 前缀按字面文本处理,不再递归。
|
|
654
|
+
if (quoteDepth >= MAX_QUOTE_DEPTH) {
|
|
655
|
+
paraBuffer.push(line.trim());
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
636
658
|
flushParagraph();
|
|
637
659
|
listStack = [];
|
|
638
660
|
const inner = [];
|
|
@@ -640,7 +662,7 @@ window.__ModuleLoader__.load({
|
|
|
640
662
|
for (; j < lineList.length && /^\s*>/.test(lineList[j]); j++) inner.push(lineList[j].replace(/^\s*>\s?/, ""));
|
|
641
663
|
i = j - 1;
|
|
642
664
|
const innerNodes = [];
|
|
643
|
-
parseBlockLines(innerNodes, inner, false);
|
|
665
|
+
parseBlockLines(innerNodes, inner, false, quoteDepth + 1);
|
|
644
666
|
let topic = "";
|
|
645
667
|
const promoteIdx = innerNodes.findIndex((n) => n.kind === "text" || n.kind === "md");
|
|
646
668
|
if (promoteIdx >= 0) {
|
|
@@ -683,6 +705,26 @@ window.__ModuleLoader__.load({
|
|
|
683
705
|
dedupe(root);
|
|
684
706
|
return root;
|
|
685
707
|
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* 038 解析兜底:把 parseMarkdownToTree 包成「永不抛」的结果对。
|
|
711
|
+
* 病理内容或畸形入参(宿主给了非字符串)都不该炸掉整个面板;
|
|
712
|
+
* 出错时留痕(console.warn,供排查)+ 回传 error 让 UI 显示显式失败态——
|
|
713
|
+
* 旧版直接返回 null,渲染层随即静默走目录分支,tab 与内容自相矛盾且无迹可查。
|
|
714
|
+
* 调用方据 `error` 判定,不做静默降级。返回 { tree, error } 结果对。
|
|
715
|
+
*/
|
|
716
|
+
function parseTreeResult(content, rootTitle) {
|
|
717
|
+
if (content === null || content === undefined) return { tree: null, error: null };
|
|
718
|
+
try {
|
|
719
|
+
return { tree: parseMarkdownToTree(content, rootTitle), error: null };
|
|
720
|
+
} catch (error) {
|
|
721
|
+
// 沙箱/宿主环境可能没有 console,防御后再留痕。
|
|
722
|
+
if (typeof console !== "undefined" && console && typeof console.warn === "function") {
|
|
723
|
+
console.warn("[dsh-mindmap] markdown 解析失败:", error);
|
|
724
|
+
}
|
|
725
|
+
return { tree: null, error: String((error && error.message) || error) };
|
|
726
|
+
}
|
|
727
|
+
}
|
|
686
728
|
//#endregion
|
|
687
729
|
|
|
688
730
|
//#region 018 生长动画:树 id 收集 + 渐显计划(纯函数,经 internals 供测试)
|
|
@@ -1268,9 +1310,10 @@ window.__ModuleLoader__.load({
|
|
|
1268
1310
|
|
|
1269
1311
|
/** 019 行内格式剥离:导出为纯文本(URL 原样保留——完整不缩减,003 §7)。 */
|
|
1270
1312
|
function stripInlineForExport(text) {
|
|
1313
|
+
// 链接 URL 的嵌套括号亲缘度见 markdown.js 的 LINK_URL(四处同源)。
|
|
1271
1314
|
return String(text ?? "")
|
|
1272
|
-
.replace(
|
|
1273
|
-
.replace(
|
|
1315
|
+
.replace(new RegExp("!\\[([^\\]]*)\\]\\((" + LINK_URL + ")\\)", "g"), "$2")
|
|
1316
|
+
.replace(new RegExp("\\[([^\\]]*)\\]\\((" + LINK_URL + ")\\)", "g"), (m, label, url) => (label ? `${label}(${url})` : url))
|
|
1274
1317
|
.replace(/`([^`]+)`/g, "$1")
|
|
1275
1318
|
.replace(/\*\*([^*]+)\*\*/g, "$1")
|
|
1276
1319
|
.replace(/~~([^~]+)~~/g, "$1")
|
|
@@ -1896,7 +1939,16 @@ window.__ModuleLoader__.load({
|
|
|
1896
1939
|
// 先命中先生效,裸链接放最后,避免吞掉已被 [文字](url) 消费的 URL。
|
|
1897
1940
|
// 裸链接字符类排除 CJK 标点与全角符号(,。、;()……),
|
|
1898
1941
|
// 否则中文句读被吞进 URL;ASCII 括号放行,由配平裁剪兜底。
|
|
1899
|
-
|
|
1942
|
+
// 链接 URL 的嵌套括号亲缘度见 markdown.js 的 LINK_URL(四处同源)。
|
|
1943
|
+
const INLINE_PATTERN = new RegExp(
|
|
1944
|
+
"(!?\\[[^\\]]*\\]\\(" + LINK_URL + "\\))" +
|
|
1945
|
+
"|(`[^`]+`)" +
|
|
1946
|
+
"|(\\*\\*[^*]+\\*\\*)" +
|
|
1947
|
+
"|(~~[^~]+~~)" +
|
|
1948
|
+
"|(\\*[^*\\s][^*]*\\*)" +
|
|
1949
|
+
"|(https?:\\/\\/[^\\s\\u3000-\\u303f\\uff00-\\uffef]+)",
|
|
1950
|
+
"g"
|
|
1951
|
+
);
|
|
1900
1952
|
|
|
1901
1953
|
/** 大一统链接点击:在机器浏览器打开(新标签页),不触发画布聚焦缩放。 */
|
|
1902
1954
|
function openLink(event, url) {
|
|
@@ -1915,6 +1967,23 @@ window.__ModuleLoader__.load({
|
|
|
1915
1967
|
event.preventDefault();
|
|
1916
1968
|
}
|
|
1917
1969
|
|
|
1970
|
+
/**
|
|
1971
|
+
* 038 行内链接 token 拆解:`[文字](url)` / `` → { bang, label, url }。
|
|
1972
|
+
* token 形态由 INLINE_PATTERN 第 1 组保证(label 不含 `]`、以 `)` 收尾),这里做
|
|
1973
|
+
* 纯切片而不重复解析:旧版用**第二个正则**重解析 token,两处正则一旦不同步
|
|
1974
|
+
* (实测:只改一处)parsed 为 null,`parsed[3]` 直接 TypeError 炸整个渲染。
|
|
1975
|
+
* 契约失配时返回 null,调用方原样退化为纯文本——不抛异常、不丢字符。
|
|
1976
|
+
*/
|
|
1977
|
+
function parseInlineLinkToken(token) {
|
|
1978
|
+
if (typeof token !== "string" || token.length < 4) return null;
|
|
1979
|
+
const bang = token[0] === "!";
|
|
1980
|
+
const open = token.indexOf("](");
|
|
1981
|
+
// open 必须正好是标签的收尾方括号:更早/未命中说明 label 里混了 `]`,
|
|
1982
|
+
// 形态与 INLINE_PATTERN 的 `[^\]]*` 契约不符。
|
|
1983
|
+
if (open < 0 || open !== token.indexOf("]") || !token.endsWith(")")) return null;
|
|
1984
|
+
return { bang, label: token.slice(bang ? 2 : 1, open), url: token.slice(open + 2, -1) };
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1918
1987
|
/**
|
|
1919
1988
|
* 零依赖行内渲染器:任何块(文本/Markdown/列表/表格单元格)的内容都走这里。
|
|
1920
1989
|
* 链接完整呈现、永不缩减(缩减=阉割信息,003 §7);无预览、无加载态。
|
|
@@ -1934,24 +2003,27 @@ window.__ModuleLoader__.load({
|
|
|
1934
2003
|
if (m[1]) {
|
|
1935
2004
|
// [文字](url) 或 。图片块暂缓(003 §9):图语法退化为
|
|
1936
2005
|
// 指向原图的链接,同时把 alt 与原图地址都完整呈现(不缩减)。
|
|
1937
|
-
|
|
2006
|
+
// URL 的括号嵌套由 INLINE_PATTERN 负责识别,这里只做切片(契约见
|
|
2007
|
+
// parseInlineLinkToken)。
|
|
2008
|
+
const parsed = parseInlineLinkToken(token);
|
|
1938
2009
|
// scheme 白名单:只放行 http/https/mailto。javascript:/data:
|
|
1939
2010
|
// 等不进 href,整串原样退化为纯文本(不缩减,也不可执行)。
|
|
1940
|
-
|
|
2011
|
+
// parsed 为 null(token 形态意外)同样退化为纯文本,不炸渲染。
|
|
2012
|
+
if (!parsed || !/^\s*(https?:|mailto:)/i.test(parsed.url)) {
|
|
1941
2013
|
out.push(token);
|
|
1942
2014
|
} else {
|
|
1943
2015
|
// 普通链接标签取文字(无文字显地址);图语法带 alt 时两者都完整呈现。
|
|
1944
|
-
const label = parsed
|
|
1945
|
-
? (parsed
|
|
1946
|
-
: (parsed
|
|
2016
|
+
const label = parsed.bang
|
|
2017
|
+
? (parsed.label ? `${parsed.label} (${parsed.url})` : parsed.url)
|
|
2018
|
+
: (parsed.label || parsed.url);
|
|
1947
2019
|
out.push((0, react_jsx_runtime.jsx)("a", {
|
|
1948
2020
|
key,
|
|
1949
|
-
href: parsed
|
|
2021
|
+
href: parsed.url,
|
|
1950
2022
|
target: "_blank",
|
|
1951
2023
|
rel: "noopener noreferrer",
|
|
1952
2024
|
style: S.inlineLink,
|
|
1953
|
-
title: parsed
|
|
1954
|
-
onClick: (e) => openLink(e, parsed
|
|
2025
|
+
title: parsed.url,
|
|
2026
|
+
onClick: (e) => openLink(e, parsed.url),
|
|
1955
2027
|
children: label,
|
|
1956
2028
|
}, key));
|
|
1957
2029
|
}
|
|
@@ -2225,6 +2297,24 @@ window.__ModuleLoader__.load({
|
|
|
2225
2297
|
] });
|
|
2226
2298
|
}
|
|
2227
2299
|
|
|
2300
|
+
//#region 038 脑图区主体模式:目录 / 加载中 / 解析失败 / 画布(纯函数,经 internals 供测试)
|
|
2301
|
+
/**
|
|
2302
|
+
* 解析失败必须显式成态:旧版把解析异常吞成 null,渲染层随即走目录分支——
|
|
2303
|
+
* tab 停在脑图上、内容区却是目录列表,用户看不到任何提示(038 评审发现)。
|
|
2304
|
+
* 抽成纯函数让四个分支都能单测,组件只按返回值分派。
|
|
2305
|
+
*/
|
|
2306
|
+
// 四态枚举:workspacerender.js 的分派与测试断言都引用这份常量,
|
|
2307
|
+
// 避免裸串散落、拼写失配静默走错分支。
|
|
2308
|
+
const BODY_MODE = Object.freeze({ tree: "tree", loading: "loading", error: "error", canvas: "canvas" });
|
|
2309
|
+
function mindmapBodyMode(active, treeTab, doc, tree, parseError) {
|
|
2310
|
+
if (active === treeTab) return BODY_MODE.tree;
|
|
2311
|
+
if (doc && doc.op === "local") return BODY_MODE.loading;
|
|
2312
|
+
if (parseError) return BODY_MODE.error;
|
|
2313
|
+
if (!tree) return BODY_MODE.tree;
|
|
2314
|
+
return BODY_MODE.canvas;
|
|
2315
|
+
}
|
|
2316
|
+
//#endregion
|
|
2317
|
+
|
|
2228
2318
|
//#region 016 脑图画布:居中呈现 + 缩放控制(右上角)
|
|
2229
2319
|
// 缩放契约:范围 [0.25, 3],每级 ×1.2;适配计算四周留 48px 余量
|
|
2230
2320
|
//(16px 视觉内距 + 经典滚动条占位,避免「适配→滚动条出现→视口变
|
|
@@ -3483,10 +3573,14 @@ window.__ModuleLoader__.load({
|
|
|
3483
3573
|
: (lastPath && lastPath !== hiddenPath ? lastPath : null);
|
|
3484
3574
|
const active = view === "mindmap" && shown ? shown : TREE_TAB;
|
|
3485
3575
|
const doc = active !== TREE_TAB && merged.byPath[active] ? merged.byPath[active] : null;
|
|
3486
|
-
const
|
|
3487
|
-
() => (doc
|
|
3576
|
+
const parsed = react.useMemo(
|
|
3577
|
+
() => parseTreeResult(doc && doc.content, doc && doc.rootTitle),
|
|
3488
3578
|
[doc && doc.content, doc && doc.rootTitle],
|
|
3489
3579
|
);
|
|
3580
|
+
const tree = parsed.tree;
|
|
3581
|
+
// 038 解析失败不再静默:error 非空时脑图区显示显式失败态(见 mindmapBodyMode),
|
|
3582
|
+
// 而不是渲染层悄悄退回目录、tab 与内容自相矛盾(旧版吞异常返 null)。
|
|
3583
|
+
const parseError = parsed.error;
|
|
3490
3584
|
|
|
3491
3585
|
// 018 生长动画调度:新树与上一版(同 path)的稳定 id 集做 diff,只对新增/
|
|
3492
3586
|
// 变化节点出渐显计划(planGrowthReveal 广度优先错峰、总时长 ≤ 2s);播完定时清空,
|
|
@@ -4102,6 +4196,17 @@ window.__ModuleLoader__.load({
|
|
|
4102
4196
|
|
|
4103
4197
|
// 027 目录/列表标签文案:sidebar 模式叫「脑图列表」,standalone 模式叫「目录」。
|
|
4104
4198
|
const treeTabLabel = variant === "sidebar" ? "脑图列表" : "目录";
|
|
4199
|
+
// 038 脑图区主体模式(目录 / 加载中 / 解析失败 / 画布):判定抽成纯函数,两个 variant
|
|
4200
|
+
// 共用同一份分派,不再各写一遍三元链;解析失败有独立分支,不再静默走目录。
|
|
4201
|
+
// 四态常量见 render.js 的 BODY_MODE(mindmapBodyMode 返回值与其同源)。
|
|
4202
|
+
const bodyMode = mindmapBodyMode(active, TREE_TAB, doc, tree, parseError);
|
|
4203
|
+
const parseErrorView = bodyMode === BODY_MODE.error
|
|
4204
|
+
? (0, react_jsx_runtime.jsxs)("div", { style: S.loadingWrap, children: [
|
|
4205
|
+
(0, react_jsx_runtime.jsx)("span", { style: S.loadingFailMark, children: "⚠" }),
|
|
4206
|
+
(0, react_jsx_runtime.jsx)("p", { style: S.loadingErrorText, children: `脑图解析失败:${parseError}` }),
|
|
4207
|
+
(0, react_jsx_runtime.jsx)("p", { style: S.loadingText, children: "原文件内容未改动;可切回目录查看,或让 AI 修正后重新打开。" }),
|
|
4208
|
+
] })
|
|
4209
|
+
: null;
|
|
4105
4210
|
|
|
4106
4211
|
if (variant === "sidebar") {
|
|
4107
4212
|
// 027 sidebar 模式:单行紧凑工具栏。BS 外层已有 Tab 头部与关闭按钮,
|
|
@@ -4158,13 +4263,13 @@ window.__ModuleLoader__.load({
|
|
|
4158
4263
|
] }),
|
|
4159
4264
|
// 016:脑图视图走 MindmapCanvas(自带滚动 + 居中 + 右上角缩放控制条),
|
|
4160
4265
|
// 不再套 S.body(避免嵌套滚动容器与双重 padding);目录/加载/空态保持原样。
|
|
4161
|
-
|
|
4162
|
-
? (0, react_jsx_runtime.jsx)(
|
|
4266
|
+
bodyMode === BODY_MODE.canvas
|
|
4267
|
+
? (0, react_jsx_runtime.jsx)(MindmapCanvas, { node: tree, theme, fitKey: doc && doc.path, reveal, inputActions })
|
|
4268
|
+
: (0, react_jsx_runtime.jsx)("div", { style: S.body, children: bodyMode === BODY_MODE.tree
|
|
4163
4269
|
? renderTree()
|
|
4164
|
-
:
|
|
4270
|
+
: bodyMode === BODY_MODE.loading
|
|
4165
4271
|
? renderLoading()
|
|
4166
|
-
:
|
|
4167
|
-
: (0, react_jsx_runtime.jsx)(MindmapCanvas, { node: tree, theme, fitKey: doc && doc.path, reveal, inputActions }),
|
|
4272
|
+
: parseErrorView }),
|
|
4168
4273
|
tabMenu ? (0, react_jsx_runtime.jsxs)("div", {
|
|
4169
4274
|
style: { ...S.treeMenu, left: tabMenu.x, top: tabMenu.y },
|
|
4170
4275
|
onContextMenu: (e) => e.preventDefault(),
|
|
@@ -5024,6 +5129,8 @@ window.__ModuleLoader__.load({
|
|
|
5024
5129
|
exports.inject = inject;
|
|
5025
5130
|
exports.internals = Object.freeze({
|
|
5026
5131
|
parseMarkdownToTree,
|
|
5132
|
+
// 038 解析兜底:永不抛的结果对 { tree, error }(供测试验证失败态分支)。
|
|
5133
|
+
parseTreeResult,
|
|
5027
5134
|
reduceDocuments,
|
|
5028
5135
|
mergeDocuments,
|
|
5029
5136
|
autoOpenTarget,
|
|
@@ -5076,6 +5183,9 @@ window.__ModuleLoader__.load({
|
|
|
5076
5183
|
nodePathTo,
|
|
5077
5184
|
nodePathLabel,
|
|
5078
5185
|
renderInline,
|
|
5186
|
+
// 038 行内链接 token 拆解 + 脑图区主体模式判定(纯函数,供测试)。
|
|
5187
|
+
parseInlineLinkToken,
|
|
5188
|
+
mindmapBodyMode,
|
|
5079
5189
|
// 链接点击:供测试验证开窗成功才拦默认行为(宿主拦截时退回原生导航)。
|
|
5080
5190
|
openLink,
|
|
5081
5191
|
stripInlineForExport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mindmap",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Mindmap plugin for DeepSeek Harness: a plain markdown file in the working directory IS the mindmap; the chat edits it step by step and the right-side panel follows live.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|