markloom 0.3.0 → 0.5.0
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 +29 -16
- package/ai.md +160 -0
- package/collab.md +68 -0
- package/dist/ai/index.cjs +4 -3
- package/dist/ai/index.d.cts +4 -2
- package/dist/ai/index.d.ts +4 -2
- package/dist/ai/index.js +5 -4
- package/dist/ai/theme.css +63 -63
- package/dist/{chunk-VVFIQLVR.cjs → chunk-4TMHVNL6.cjs} +71 -79
- package/dist/chunk-6DCI7AL3.js +208 -0
- package/dist/chunk-AC5E42NH.cjs +208 -0
- package/dist/chunk-GQ2HHRGI.cjs +16 -0
- package/dist/{chunk-GUPMZI6Q.js → chunk-JMOJU5EU.js} +7 -5
- package/dist/chunk-JS527FDV.cjs +294 -0
- package/dist/chunk-LA5SBCGQ.js +16 -0
- package/dist/{chunk-ITVAR2UM.js → chunk-LEYAQNJA.js} +5 -3
- package/dist/{chunk-J3QWW6CN.js → chunk-MFYF2A6U.js} +5 -13
- package/dist/chunk-RLTHVQNQ.js +294 -0
- package/dist/{chunk-7Q6AXLF2.cjs → chunk-SLRD6FMP.cjs} +30 -28
- package/dist/{chunk-UCNEQGMY.js → chunk-WUHTCCAE.js} +391 -332
- package/dist/{chunk-2X6AF7XH.cjs → chunk-YJAWPRJW.cjs} +722 -663
- package/dist/{chunk-HA6XHJUD.cjs → chunk-YXQDCW4Y.cjs} +22 -20
- package/dist/client-A0ZQJnyR.d.ts +137 -0
- package/dist/client-BNams4wv.d.cts +137 -0
- package/dist/collab/index.cjs +19 -0
- package/dist/collab/index.d.cts +3 -0
- package/dist/collab/index.d.ts +3 -0
- package/dist/collab/index.js +19 -0
- package/dist/comments-DlExS6f-.d.cts +43 -0
- package/dist/comments-PhnR7Gkn.d.ts +43 -0
- package/dist/{controller-Dm4uLD3I.d.ts → controller-BkY1VPzc.d.ts} +24 -8
- package/dist/{controller-cE9iEYp3.d.cts → controller-CVIZI--A.d.cts} +24 -8
- package/dist/index.cjs +21 -243
- package/dist/index.d.cts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +22 -244
- package/dist/react/index.cjs +12 -9
- package/dist/react/index.d.cts +7 -5
- package/dist/react/index.d.ts +7 -5
- package/dist/react/index.js +12 -9
- package/dist/rebase-batch-8rL_aXEE.d.ts +38 -0
- package/dist/rebase-batch-bYnBJpRO.d.cts +38 -0
- package/dist/step-BrvHIK7O.d.cts +65 -0
- package/dist/step-BrvHIK7O.d.ts +65 -0
- package/dist/view/index.cjs +11 -8
- package/dist/view/index.d.cts +7 -5
- package/dist/view/index.d.ts +7 -5
- package/dist/view/index.js +9 -6
- package/dist/view/theme.css +507 -507
- package/package.json +10 -3
- package/dist/comments-USjT1wYN.d.cts +0 -105
- package/dist/comments-USjT1wYN.d.ts +0 -105
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
redo,
|
|
9
9
|
stripCommentMarks,
|
|
10
10
|
undo
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LEYAQNJA.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
MarkloomAi,
|
|
14
14
|
createAiStream,
|
|
15
15
|
elementChildren,
|
|
16
16
|
pointToDom,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
rootEl,
|
|
19
19
|
startAiWrite,
|
|
20
20
|
writeSelection
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JMOJU5EU.js";
|
|
22
22
|
import {
|
|
23
23
|
applyAll,
|
|
24
24
|
arrowCell,
|
|
@@ -35,10 +35,7 @@ import {
|
|
|
35
35
|
htmlToBlocks,
|
|
36
36
|
insertCol,
|
|
37
37
|
insertRow,
|
|
38
|
-
isElement,
|
|
39
|
-
isInlineAtom,
|
|
40
38
|
isRichHtmlBlocks,
|
|
41
|
-
isText,
|
|
42
39
|
lastLeafEnd,
|
|
43
40
|
makeTable,
|
|
44
41
|
mdToDoc,
|
|
@@ -56,7 +53,15 @@ import {
|
|
|
56
53
|
setFreeze,
|
|
57
54
|
splitCell,
|
|
58
55
|
tableColWidths
|
|
59
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-MFYF2A6U.js";
|
|
57
|
+
import {
|
|
58
|
+
connectCollab
|
|
59
|
+
} from "./chunk-6DCI7AL3.js";
|
|
60
|
+
import {
|
|
61
|
+
isElement,
|
|
62
|
+
isInlineAtom,
|
|
63
|
+
isText
|
|
64
|
+
} from "./chunk-LA5SBCGQ.js";
|
|
60
65
|
|
|
61
66
|
// src/view/render.ts
|
|
62
67
|
import { h as h2 } from "preact";
|
|
@@ -208,7 +213,7 @@ var ICONS = {
|
|
|
208
213
|
["path", { d: "M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z" }]
|
|
209
214
|
]
|
|
210
215
|
};
|
|
211
|
-
function icon(name, size2 = 16, className = "
|
|
216
|
+
function icon(name, size2 = 16, className = "markloom-icon") {
|
|
212
217
|
const nodes = ICONS[name];
|
|
213
218
|
if (!nodes)
|
|
214
219
|
return null;
|
|
@@ -273,13 +278,13 @@ function paintInvisibles(text) {
|
|
|
273
278
|
const ch = text[i];
|
|
274
279
|
if (ch === " ") {
|
|
275
280
|
flush();
|
|
276
|
-
out.push(h2("span", { key: k++, class: "
|
|
281
|
+
out.push(h2("span", { key: k++, class: "markloom-inv-space" }, " "));
|
|
277
282
|
} else if (ch === "\xA0") {
|
|
278
283
|
flush();
|
|
279
|
-
out.push(h2("span", { key: k++, class: "
|
|
284
|
+
out.push(h2("span", { key: k++, class: "markloom-inv-nbsp" }, "\xA0"));
|
|
280
285
|
} else if (ch === " ") {
|
|
281
286
|
flush();
|
|
282
|
-
out.push(h2("span", { key: k++, class: "
|
|
287
|
+
out.push(h2("span", { key: k++, class: "markloom-inv-tab" }, " "));
|
|
283
288
|
} else {
|
|
284
289
|
buf += ch;
|
|
285
290
|
}
|
|
@@ -323,7 +328,7 @@ function renderImage(spec, key, atomSelect) {
|
|
|
323
328
|
"data-atom": "image",
|
|
324
329
|
"data-selected": selected ? "" : void 0,
|
|
325
330
|
"contentEditable": "false",
|
|
326
|
-
"class": "
|
|
331
|
+
"class": "markloom-figure",
|
|
327
332
|
"style": figAlign
|
|
328
333
|
}, [h2("img", { key: "img", ...innerImg }), h2("figcaption", { key: "cap", "data-caption": "" }, caption)]);
|
|
329
334
|
}
|
|
@@ -365,7 +370,7 @@ function markProps(mark, commentState) {
|
|
|
365
370
|
return {
|
|
366
371
|
"href": url,
|
|
367
372
|
"data-mark": "link",
|
|
368
|
-
"class": "
|
|
373
|
+
"class": "markloom-link",
|
|
369
374
|
"rel": "noopener noreferrer",
|
|
370
375
|
"title": url
|
|
371
376
|
};
|
|
@@ -377,9 +382,9 @@ function markProps(mark, commentState) {
|
|
|
377
382
|
if (mark.name === "comment") {
|
|
378
383
|
const id = String(mark.attrs?.id ?? "");
|
|
379
384
|
const cls = [
|
|
380
|
-
"
|
|
381
|
-
commentState?.resolved.has(id) ? "
|
|
382
|
-
commentState?.activeId === id ? "
|
|
385
|
+
"markloom-comment",
|
|
386
|
+
commentState?.resolved.has(id) ? "markloom-comment-resolved" : "",
|
|
387
|
+
commentState?.activeId === id ? "markloom-comment-active" : ""
|
|
383
388
|
].filter(Boolean).join(" ");
|
|
384
389
|
return { "data-mark": "comment", "data-comment-id": id, class: cls };
|
|
385
390
|
}
|
|
@@ -390,7 +395,7 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
390
395
|
const br = h2("br", { "key": key, "data-leaf": key, "data-atom": "hard_break" });
|
|
391
396
|
if (!opts.invisibleCharacters)
|
|
392
397
|
return br;
|
|
393
|
-
return [br, h2("span", { "key": `${key}-inv`, "class": "
|
|
398
|
+
return [br, h2("span", { "key": `${key}-inv`, "class": "markloom-inv-break", "aria-hidden": "true", "contentEditable": "false" }, "\u21B5")];
|
|
394
399
|
}
|
|
395
400
|
if (spec.type === "math") {
|
|
396
401
|
const latex = String(spec.attrs?.latex ?? "");
|
|
@@ -404,7 +409,7 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
404
409
|
"data-latex": latex,
|
|
405
410
|
"data-display": display ? "block" : "inline",
|
|
406
411
|
"contentEditable": "false",
|
|
407
|
-
"class": display ? "
|
|
412
|
+
"class": display ? "markloom-math markloom-math-block" : "markloom-math",
|
|
408
413
|
"title": "\u70B9\u51FB\u7F16\u8F91\u516C\u5F0F"
|
|
409
414
|
};
|
|
410
415
|
if (html)
|
|
@@ -421,8 +426,8 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
421
426
|
"data-mention-id": String(a.id ?? ""),
|
|
422
427
|
"data-kind": isDate ? "date" : void 0,
|
|
423
428
|
"contentEditable": "false",
|
|
424
|
-
"class": isDate ? "
|
|
425
|
-
}, isDate ? [icon("calendar", 12, "
|
|
429
|
+
"class": isDate ? "markloom-mention markloom-mention-date" : "markloom-mention"
|
|
430
|
+
}, isDate ? [icon("calendar", 12, "markloom-mention-ico"), label] : ["@", label]);
|
|
426
431
|
}
|
|
427
432
|
function renderEmbed(spec, key, atomSelect) {
|
|
428
433
|
const a = spec.attrs ?? {};
|
|
@@ -437,7 +442,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
437
442
|
"data-embed-kind": kind,
|
|
438
443
|
"data-selected": atomIsSelected(spec.id, atomSelect) ? "" : void 0,
|
|
439
444
|
"contentEditable": "false",
|
|
440
|
-
"class": "
|
|
445
|
+
"class": "markloom-embed"
|
|
441
446
|
};
|
|
442
447
|
if (kind === "youtube") {
|
|
443
448
|
const id = youtubeId(src);
|
|
@@ -449,7 +454,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
449
454
|
"allow": "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
450
455
|
"allowFullScreen": true,
|
|
451
456
|
"frameBorder": "0",
|
|
452
|
-
"class": "
|
|
457
|
+
"class": "markloom-embed-frame"
|
|
453
458
|
}));
|
|
454
459
|
}
|
|
455
460
|
if (kind === "twitch") {
|
|
@@ -462,7 +467,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
462
467
|
"title": title || "Twitch",
|
|
463
468
|
"allowFullScreen": true,
|
|
464
469
|
"frameBorder": "0",
|
|
465
|
-
"class": "
|
|
470
|
+
"class": "markloom-embed-frame"
|
|
466
471
|
}));
|
|
467
472
|
}
|
|
468
473
|
if (kind === "audio") {
|
|
@@ -471,17 +476,17 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
471
476
|
"src": src,
|
|
472
477
|
"controls": true,
|
|
473
478
|
"preload": "metadata",
|
|
474
|
-
"class": "
|
|
479
|
+
"class": "markloom-embed-audio"
|
|
475
480
|
}, title || name));
|
|
476
481
|
}
|
|
477
|
-
return h2("div", { ...base, class: "
|
|
482
|
+
return h2("div", { ...base, class: "markloom-embed markloom-embed-file" }, h2("a", {
|
|
478
483
|
"key": "l",
|
|
479
484
|
"href": src,
|
|
480
485
|
"download": name || void 0,
|
|
481
486
|
"target": "_blank",
|
|
482
487
|
"rel": "noopener noreferrer",
|
|
483
|
-
"class": "
|
|
484
|
-
}, [icon("paperclip", 14, "
|
|
488
|
+
"class": "markloom-embed-file-link"
|
|
489
|
+
}, [icon("paperclip", 14, "markloom-embed-file-ico"), " ", name || src]));
|
|
485
490
|
}
|
|
486
491
|
function youtubeId(url) {
|
|
487
492
|
try {
|
|
@@ -524,7 +529,7 @@ function aiBtn(act, label, cls, extra) {
|
|
|
524
529
|
return h2("button", {
|
|
525
530
|
key: extra?.key ?? act,
|
|
526
531
|
type: "button",
|
|
527
|
-
class: `
|
|
532
|
+
class: `markloom-ai-block-btn ${cls}`,
|
|
528
533
|
"data-ai-act": act,
|
|
529
534
|
contentEditable: "false",
|
|
530
535
|
title: extra?.title,
|
|
@@ -534,7 +539,7 @@ function aiBtn(act, label, cls, extra) {
|
|
|
534
539
|
}, label);
|
|
535
540
|
}
|
|
536
541
|
function aiKbd(label) {
|
|
537
|
-
return h2("kbd", { class: "
|
|
542
|
+
return h2("kbd", { class: "markloom-ai-kbd" }, label);
|
|
538
543
|
}
|
|
539
544
|
function renderAiBlock(spec, tag, props, opts) {
|
|
540
545
|
const status = typeof spec.attrs?.status === "string" ? spec.attrs.status : "compose";
|
|
@@ -542,41 +547,41 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
542
547
|
const mode = spec.attrs?.mode === "rewrite" ? "rewrite" : "continue";
|
|
543
548
|
const seed = typeof spec.attrs?.seed === "string" ? spec.attrs.seed : "";
|
|
544
549
|
const draftChars = typeof spec.attrs?.draftChars === "number" ? spec.attrs.draftChars : 0;
|
|
545
|
-
props.class = "
|
|
550
|
+
props.class = "markloom-ai-block";
|
|
546
551
|
props["data-ai-block"] = "";
|
|
547
552
|
props["data-status"] = status;
|
|
548
553
|
props["data-mode"] = mode;
|
|
549
554
|
const title = mode === "rewrite" ? "AI \u6539\u5199" : "AI \u5199\u4F5C";
|
|
550
|
-
const statusHint = status === "loading" ? [h2("span", { key: "sp", class: "
|
|
555
|
+
const statusHint = status === "loading" ? [h2("span", { key: "sp", class: "markloom-ai-spin", "aria-hidden": "true" }), "\u751F\u6210\u4E2D"] : status === "preview" ? "\u5F85\u786E\u8BA4" : status === "error" ? "\u5931\u8D25" : null;
|
|
551
556
|
const hd = h2("div", {
|
|
552
557
|
key: "hd",
|
|
553
|
-
class: "
|
|
558
|
+
class: "markloom-ai-block-hd",
|
|
554
559
|
contentEditable: "false"
|
|
555
560
|
}, [
|
|
556
|
-
h2("div", { key: "l", class: "
|
|
561
|
+
h2("div", { key: "l", class: "markloom-ai-block-brand" }, [
|
|
557
562
|
h2(
|
|
558
563
|
"span",
|
|
559
|
-
{ key: "ico", class: "
|
|
560
|
-
icon(mode === "rewrite" ? "pen-line" : "sparkles", 15, "
|
|
564
|
+
{ key: "ico", class: "markloom-ai-block-ico" },
|
|
565
|
+
icon(mode === "rewrite" ? "pen-line" : "sparkles", 15, "markloom-ai-block-svg")
|
|
561
566
|
),
|
|
562
|
-
h2("span", { key: "t", class: "
|
|
567
|
+
h2("span", { key: "t", class: "markloom-ai-block-title" }, title),
|
|
563
568
|
statusHint ? h2("span", {
|
|
564
569
|
key: "b",
|
|
565
|
-
class: `
|
|
570
|
+
class: `markloom-ai-block-badge markloom-ai-block-badge-${status}`
|
|
566
571
|
}, statusHint) : null
|
|
567
572
|
]),
|
|
568
|
-
status === "loading" ? aiBtn("stop", "\u505C\u6B62", "
|
|
573
|
+
status === "loading" ? aiBtn("stop", "\u505C\u6B62", "markloom-ai-block-btn-ghost", { title: "\u505C\u6B62\u751F\u6210", key: "stop" }) : aiBtn("discard", "\xD7", "markloom-ai-block-btn-icon", { title: "\u53D6\u6D88", key: "x" })
|
|
569
574
|
]);
|
|
570
575
|
const seedStrip = mode === "rewrite" && seed.trim() ? h2("div", {
|
|
571
576
|
key: "seed",
|
|
572
|
-
class: "
|
|
577
|
+
class: "markloom-ai-block-seed",
|
|
573
578
|
contentEditable: "false",
|
|
574
579
|
title: seed
|
|
575
580
|
}, [
|
|
576
|
-
h2("span", { key: "l", class: "
|
|
581
|
+
h2("span", { key: "l", class: "markloom-ai-block-seed-lab" }, "\u539F\u6587"),
|
|
577
582
|
h2(
|
|
578
583
|
"span",
|
|
579
|
-
{ key: "t", class: "
|
|
584
|
+
{ key: "t", class: "markloom-ai-block-seed-txt" },
|
|
580
585
|
seed.length > 120 ? `${seed.slice(0, 120)}\u2026` : seed
|
|
581
586
|
)
|
|
582
587
|
]) : null;
|
|
@@ -585,7 +590,7 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
585
590
|
if (!(vn && typeof vn === "object" && "props" in vn))
|
|
586
591
|
return vn;
|
|
587
592
|
const p = vn.props;
|
|
588
|
-
p.class = [p.class, "
|
|
593
|
+
p.class = [p.class, "markloom-ai-prompt"].filter(Boolean).join(" ");
|
|
589
594
|
if (i === 0 && !isText(c) && c.type === "paragraph" && leafText(c) === "") {
|
|
590
595
|
p["data-placeholder"] = mode === "rewrite" ? "\u63CF\u8FF0\u600E\u4E48\u6539\u2026\uFF08\u56DE\u8F66\u751F\u6210\uFF09" : "\u8F93\u5165\u6307\u4EE4\uFF0C\u56DE\u8F66\u751F\u6210\u2026";
|
|
591
596
|
}
|
|
@@ -598,50 +603,50 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
598
603
|
if (status === "error" && err) {
|
|
599
604
|
outKids.push(h2("div", {
|
|
600
605
|
key: "err",
|
|
601
|
-
class: "
|
|
606
|
+
class: "markloom-ai-block-err",
|
|
602
607
|
contentEditable: "false"
|
|
603
608
|
}, err));
|
|
604
609
|
}
|
|
605
610
|
let ft = null;
|
|
606
611
|
if (status === "compose") {
|
|
607
|
-
ft = h2("div", { key: "ft", class: "
|
|
608
|
-
h2("span", { key: "h", class: "
|
|
612
|
+
ft = h2("div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
613
|
+
h2("span", { key: "h", class: "markloom-ai-block-hint" }, [
|
|
609
614
|
aiKbd("Enter"),
|
|
610
615
|
" \u751F\u6210",
|
|
611
|
-
h2("span", { key: "dot", class: "
|
|
616
|
+
h2("span", { key: "dot", class: "markloom-ai-dot" }, "\xB7"),
|
|
612
617
|
aiKbd("\u21E7Enter"),
|
|
613
618
|
" \u6362\u884C"
|
|
614
619
|
]),
|
|
615
|
-
aiBtn("run", "\u751F\u6210", "
|
|
620
|
+
aiBtn("run", "\u751F\u6210", "markloom-ai-block-btn-primary", { title: "\u5F00\u59CB\u751F\u6210", key: "run" })
|
|
616
621
|
]);
|
|
617
622
|
} else if (status === "loading") {
|
|
618
|
-
ft = h2("div", { key: "ft", class: "
|
|
623
|
+
ft = h2("div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
619
624
|
h2(
|
|
620
625
|
"span",
|
|
621
|
-
{ key: "h", class: "
|
|
626
|
+
{ key: "h", class: "markloom-ai-block-hint markloom-ai-block-loading" },
|
|
622
627
|
draftChars ? `\u6B63\u6587\u5DF2\u5199\u5165 ${draftChars} \u5B57\u2026` : "\u6B63\u5728\u5199\u5165\u6B63\u6587\u2026"
|
|
623
628
|
),
|
|
624
|
-
aiBtn("stop", "\u505C\u6B62", "
|
|
629
|
+
aiBtn("stop", "\u505C\u6B62", "markloom-ai-block-btn-ghost", { title: "\u505C\u6B62\u751F\u6210", key: "stop2" })
|
|
625
630
|
]);
|
|
626
631
|
} else if (status === "preview") {
|
|
627
|
-
ft = h2("div", { key: "ft", class: "
|
|
632
|
+
ft = h2("div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
628
633
|
h2(
|
|
629
634
|
"span",
|
|
630
|
-
{ key: "h", class: "
|
|
635
|
+
{ key: "h", class: "markloom-ai-block-hint" },
|
|
631
636
|
draftChars ? `${draftChars} \u5B57\u5DF2\u5199\u5165 \xB7 \u786E\u8BA4\u63D0\u4EA4 / \u4E22\u5F03\u64A4\u56DE` : "\u4E0B\u65B9\u6DE1\u5316\u6587\u5B57\u5DF2\u5728\u6587\u6863\u4E2D"
|
|
632
637
|
),
|
|
633
|
-
h2("div", { key: "acts", class: "
|
|
634
|
-
aiBtn("retry", "\u91CD\u8BD5", "
|
|
635
|
-
aiBtn("discard", "\u64A4\u56DE", "
|
|
636
|
-
aiBtn("accept", "\u786E\u8BA4", "
|
|
638
|
+
h2("div", { key: "acts", class: "markloom-ai-block-acts" }, [
|
|
639
|
+
aiBtn("retry", "\u91CD\u8BD5", "markloom-ai-block-btn-ghost", { title: "\u64A4\u56DE\u5E76\u91CD\u65B0\u751F\u6210" }),
|
|
640
|
+
aiBtn("discard", "\u64A4\u56DE", "markloom-ai-block-btn-ghost", { title: "\u6574\u7B14\u64A4\u56DE(undo)" }),
|
|
641
|
+
aiBtn("accept", "\u786E\u8BA4", "markloom-ai-block-btn-primary", { title: "\u63D0\u4EA4\u4E8B\u52A1" })
|
|
637
642
|
])
|
|
638
643
|
]);
|
|
639
644
|
} else if (status === "error") {
|
|
640
|
-
ft = h2("div", { key: "ft", class: "
|
|
641
|
-
h2("span", { key: "h", class: "
|
|
642
|
-
h2("div", { key: "acts", class: "
|
|
643
|
-
aiBtn("retry", "\u91CD\u8BD5", "
|
|
644
|
-
aiBtn("discard", "\u4E22\u5F03", "
|
|
645
|
+
ft = h2("div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
646
|
+
h2("span", { key: "h", class: "markloom-ai-block-hint is-error" }, "\u751F\u6210\u5931\u8D25"),
|
|
647
|
+
h2("div", { key: "acts", class: "markloom-ai-block-acts" }, [
|
|
648
|
+
aiBtn("retry", "\u91CD\u8BD5", "markloom-ai-block-btn-primary", { title: "\u91CD\u65B0\u751F\u6210" }),
|
|
649
|
+
aiBtn("discard", "\u4E22\u5F03", "markloom-ai-block-btn-ghost")
|
|
645
650
|
])
|
|
646
651
|
]);
|
|
647
652
|
}
|
|
@@ -671,19 +676,19 @@ function renderNode(node, key, opts) {
|
|
|
671
676
|
if (spec.attrs?.align && spec.attrs.align !== "left")
|
|
672
677
|
props.style = `text-align:${spec.attrs.align}`;
|
|
673
678
|
if (spec.attrs?.aiDraft) {
|
|
674
|
-
props.class = [props.class, "
|
|
679
|
+
props.class = [props.class, "markloom-ai-draft"].filter(Boolean).join(" ");
|
|
675
680
|
props["data-ai-draft"] = "";
|
|
676
681
|
if (spec.attrs.aiStream)
|
|
677
682
|
props["data-ai-stream"] = "";
|
|
678
683
|
}
|
|
679
684
|
if (spec.type === "callout") {
|
|
680
|
-
props.class = "
|
|
685
|
+
props.class = "markloom-callout";
|
|
681
686
|
const variant = typeof spec.attrs?.variant === "string" ? spec.attrs.variant : "info";
|
|
682
687
|
props["data-variant"] = variant;
|
|
683
688
|
const chip = h2("button", {
|
|
684
689
|
"key": "v",
|
|
685
690
|
"type": "button",
|
|
686
|
-
"class": "
|
|
691
|
+
"class": "markloom-callout-chip",
|
|
687
692
|
"contentEditable": "false",
|
|
688
693
|
"data-callout-variant": "",
|
|
689
694
|
"tabIndex": -1
|
|
@@ -697,7 +702,7 @@ function renderNode(node, key, opts) {
|
|
|
697
702
|
const depth = Math.min(Math.max(Number(spec.attrs?.depth ?? 2), 1), 6);
|
|
698
703
|
tag = `h${depth}`;
|
|
699
704
|
const collapsed = !!spec.attrs?.collapsed;
|
|
700
|
-
props.class = "
|
|
705
|
+
props.class = "markloom-heading";
|
|
701
706
|
props["data-heading-depth"] = String(depth);
|
|
702
707
|
props["data-collapsed"] = collapsed ? "true" : "false";
|
|
703
708
|
if (opts.slug)
|
|
@@ -756,7 +761,7 @@ function renderTable(spec, key, ctx) {
|
|
|
756
761
|
"key": idx,
|
|
757
762
|
"data-block-id": cellNode.id ?? "",
|
|
758
763
|
"contentEditable": true,
|
|
759
|
-
"class": "
|
|
764
|
+
"class": "markloom-cell",
|
|
760
765
|
"scope": tag === "th" ? "col" : void 0,
|
|
761
766
|
"colSpan": m.colspan > 1 ? m.colspan : void 0,
|
|
762
767
|
"rowSpan": m.rowspan > 1 ? m.rowspan : void 0,
|
|
@@ -791,10 +796,10 @@ function renderTable(spec, key, ctx) {
|
|
|
791
796
|
"data-atom": spec.type,
|
|
792
797
|
"contentEditable": "false",
|
|
793
798
|
// 字符串 'false':Preact 对布尔 false 会删属性,正文选区就跨得进来了
|
|
794
|
-
"class": "
|
|
799
|
+
"class": "markloom-table",
|
|
795
800
|
"style": widths ? `width:${widths.reduce((a, b) => a + b, 0)}px` : "width:100%"
|
|
796
801
|
}, children);
|
|
797
|
-
return h2("div", { "key": `w${spec.id ?? key}`, "data-pass": "", "class": "
|
|
802
|
+
return h2("div", { "key": `w${spec.id ?? key}`, "data-pass": "", "class": "markloom-table-scroll" }, [table]);
|
|
798
803
|
}
|
|
799
804
|
function renderHr(spec, key, ctx) {
|
|
800
805
|
if (spec.attrs?.mdType === "thematicBreak")
|
|
@@ -854,8 +859,8 @@ function renderDoc(doc, opts = {}) {
|
|
|
854
859
|
}
|
|
855
860
|
return vnode;
|
|
856
861
|
});
|
|
857
|
-
const cls = opts.invisibleCharacters ? "
|
|
858
|
-
return h2("div", { "class": cls, "data-
|
|
862
|
+
const cls = opts.invisibleCharacters ? "markloom-doc markloom-invisible" : "markloom-doc";
|
|
863
|
+
return h2("div", { "class": cls, "data-markloom": true }, kids);
|
|
859
864
|
}
|
|
860
865
|
function renderToHtml(doc, opts = {}) {
|
|
861
866
|
return renderToString(renderDoc(doc, opts));
|
|
@@ -3227,7 +3232,7 @@ function askInput(opts) {
|
|
|
3227
3232
|
dismissActive(null);
|
|
3228
3233
|
return new Promise((resolve2) => {
|
|
3229
3234
|
const root = document.createElement("div");
|
|
3230
|
-
root.className = "
|
|
3235
|
+
root.className = "markloom-prompt-host";
|
|
3231
3236
|
document.body.appendChild(root);
|
|
3232
3237
|
let value = opts.defaultValue ?? "";
|
|
3233
3238
|
let error = null;
|
|
@@ -3258,7 +3263,7 @@ function askInput(opts) {
|
|
|
3258
3263
|
document.addEventListener("keydown", onKey, true);
|
|
3259
3264
|
const paint = () => {
|
|
3260
3265
|
const inputProps = {
|
|
3261
|
-
class: "
|
|
3266
|
+
class: "markloom-prompt-input" + (error ? " markloom-prompt-input-err" : ""),
|
|
3262
3267
|
value,
|
|
3263
3268
|
placeholder: opts.placeholder ?? "",
|
|
3264
3269
|
autofocus: true,
|
|
@@ -3282,27 +3287,27 @@ function askInput(opts) {
|
|
|
3282
3287
|
};
|
|
3283
3288
|
render(
|
|
3284
3289
|
h3("div", {
|
|
3285
|
-
class: "
|
|
3286
|
-
"data-
|
|
3290
|
+
class: "markloom-prompt-mask",
|
|
3291
|
+
"data-markloom-prompt": "",
|
|
3287
3292
|
onMouseDown: (e) => {
|
|
3288
3293
|
if (e.target === e.currentTarget)
|
|
3289
3294
|
finish(null);
|
|
3290
3295
|
}
|
|
3291
3296
|
}, h3("div", {
|
|
3292
|
-
class: "
|
|
3297
|
+
class: "markloom-prompt-card",
|
|
3293
3298
|
role: "dialog",
|
|
3294
3299
|
"aria-modal": "true",
|
|
3295
3300
|
"aria-label": opts.title,
|
|
3296
3301
|
onMouseDown: (e) => e.stopPropagation()
|
|
3297
3302
|
}, [
|
|
3298
|
-
h3("div", { class: "
|
|
3299
|
-
opts.description ? h3("div", { class: "
|
|
3303
|
+
h3("div", { class: "markloom-prompt-title", key: "t" }, opts.title),
|
|
3304
|
+
opts.description ? h3("div", { class: "markloom-prompt-desc", key: "d" }, opts.description) : null,
|
|
3300
3305
|
opts.multiline ? h3("textarea", { ...inputProps, key: "i", rows: 4 }) : h3("input", { ...inputProps, key: "i", type: "text" }),
|
|
3301
|
-
error ? h3("div", { class: "
|
|
3302
|
-
h3("div", { class: "
|
|
3306
|
+
error ? h3("div", { class: "markloom-prompt-err", key: "e" }, error) : null,
|
|
3307
|
+
h3("div", { class: "markloom-prompt-ft", key: "f" }, [
|
|
3303
3308
|
h3("button", {
|
|
3304
3309
|
type: "button",
|
|
3305
|
-
class: "
|
|
3310
|
+
class: "markloom-prompt-btn markloom-prompt-btn-ghost",
|
|
3306
3311
|
"data-act": "cancel",
|
|
3307
3312
|
onMouseDown: (e) => {
|
|
3308
3313
|
e.preventDefault();
|
|
@@ -3311,7 +3316,7 @@ function askInput(opts) {
|
|
|
3311
3316
|
}, opts.cancelLabel ?? "\u53D6\u6D88"),
|
|
3312
3317
|
h3("button", {
|
|
3313
3318
|
type: "button",
|
|
3314
|
-
class: "
|
|
3319
|
+
class: "markloom-prompt-btn markloom-prompt-btn-primary",
|
|
3315
3320
|
"data-act": "confirm",
|
|
3316
3321
|
onMouseDown: (e) => {
|
|
3317
3322
|
e.preventDefault();
|
|
@@ -3348,7 +3353,7 @@ function askLinkPopover(opts) {
|
|
|
3348
3353
|
dismissActive(null);
|
|
3349
3354
|
return new Promise((resolve2) => {
|
|
3350
3355
|
const root = document.createElement("div");
|
|
3351
|
-
root.className = "
|
|
3356
|
+
root.className = "markloom-link-pop-host";
|
|
3352
3357
|
document.body.appendChild(root);
|
|
3353
3358
|
let value = opts.defaultValue ?? "";
|
|
3354
3359
|
let placed = false;
|
|
@@ -3384,8 +3389,8 @@ function askLinkPopover(opts) {
|
|
|
3384
3389
|
const can = value.trim().length > 0;
|
|
3385
3390
|
render(
|
|
3386
3391
|
h3("div", {
|
|
3387
|
-
class: "
|
|
3388
|
-
"data-
|
|
3392
|
+
class: "markloom-link-pop",
|
|
3393
|
+
"data-markloom-link-pop": "",
|
|
3389
3394
|
role: "dialog",
|
|
3390
3395
|
"aria-label": "\u6DFB\u52A0\u94FE\u63A5",
|
|
3391
3396
|
onMouseDown: (e) => {
|
|
@@ -3397,7 +3402,7 @@ function askLinkPopover(opts) {
|
|
|
3397
3402
|
}, [
|
|
3398
3403
|
h3("input", {
|
|
3399
3404
|
key: "i",
|
|
3400
|
-
class: "
|
|
3405
|
+
class: "markloom-link-pop-input",
|
|
3401
3406
|
type: "text",
|
|
3402
3407
|
value,
|
|
3403
3408
|
placeholder: opts.placeholder ?? "\u7C98\u8D34\u6216\u8F93\u5165\u94FE\u63A5",
|
|
@@ -3415,7 +3420,7 @@ function askLinkPopover(opts) {
|
|
|
3415
3420
|
h3("button", {
|
|
3416
3421
|
key: "ok",
|
|
3417
3422
|
type: "button",
|
|
3418
|
-
class: "
|
|
3423
|
+
class: "markloom-link-pop-ok" + (can ? " is-ready" : ""),
|
|
3419
3424
|
"data-act": "confirm",
|
|
3420
3425
|
disabled: !can,
|
|
3421
3426
|
onMouseDown: (e) => {
|
|
@@ -3426,7 +3431,7 @@ function askLinkPopover(opts) {
|
|
|
3426
3431
|
]),
|
|
3427
3432
|
root
|
|
3428
3433
|
);
|
|
3429
|
-
const el = root.querySelector(".
|
|
3434
|
+
const el = root.querySelector(".markloom-link-pop");
|
|
3430
3435
|
if (el && !placed) {
|
|
3431
3436
|
placed = true;
|
|
3432
3437
|
const rect = readAnchor(opts.anchor);
|
|
@@ -3465,14 +3470,14 @@ var MentionMenu = class {
|
|
|
3465
3470
|
this.root = root;
|
|
3466
3471
|
this.host = host;
|
|
3467
3472
|
this.overlay = document.createElement("div");
|
|
3468
|
-
this.overlay.className = "
|
|
3473
|
+
this.overlay.className = "markloom-mention-overlay";
|
|
3469
3474
|
document.body.appendChild(this.overlay);
|
|
3470
|
-
root.addEventListener("
|
|
3475
|
+
root.addEventListener("markloom-redraw", this.reevaluate);
|
|
3471
3476
|
document.addEventListener("selectionchange", this.reevaluate);
|
|
3472
3477
|
root.addEventListener("keydown", this.onKeyDown, true);
|
|
3473
3478
|
}
|
|
3474
3479
|
destroy() {
|
|
3475
|
-
this.root.removeEventListener("
|
|
3480
|
+
this.root.removeEventListener("markloom-redraw", this.reevaluate);
|
|
3476
3481
|
document.removeEventListener("selectionchange", this.reevaluate);
|
|
3477
3482
|
this.root.removeEventListener("keydown", this.onKeyDown, true);
|
|
3478
3483
|
this.close();
|
|
@@ -3595,7 +3600,7 @@ var MentionMenu = class {
|
|
|
3595
3600
|
render2(
|
|
3596
3601
|
h4(
|
|
3597
3602
|
"div",
|
|
3598
|
-
{ class: "
|
|
3603
|
+
{ class: "markloom-mention-menu" },
|
|
3599
3604
|
this.list.map((c, i) => h4("button", {
|
|
3600
3605
|
"key": c.id,
|
|
3601
3606
|
"type": "button",
|
|
@@ -3604,11 +3609,11 @@ var MentionMenu = class {
|
|
|
3604
3609
|
e.preventDefault();
|
|
3605
3610
|
this.apply(c);
|
|
3606
3611
|
}
|
|
3607
|
-
}, c.kind === "date" ? [icon("calendar", 14, "
|
|
3612
|
+
}, c.kind === "date" ? [icon("calendar", 14, "markloom-mention-ico"), " ", c.label] : ["@", c.label]))
|
|
3608
3613
|
),
|
|
3609
3614
|
this.overlay
|
|
3610
3615
|
);
|
|
3611
|
-
const el = this.overlay.querySelector(".
|
|
3616
|
+
const el = this.overlay.querySelector(".markloom-mention-menu");
|
|
3612
3617
|
if (el)
|
|
3613
3618
|
void place(rectRef(rect), el, { placement: "bottom-start", gap: 6 });
|
|
3614
3619
|
}
|
|
@@ -3658,10 +3663,10 @@ var BLOCK_ITEMS = [
|
|
|
3658
3663
|
{ kind: "callout", label: "\u9AD8\u4EAE\u5757", ico: "callout", group: "box" }
|
|
3659
3664
|
];
|
|
3660
3665
|
var MARK_ITEMS = [
|
|
3661
|
-
{ name: "bold", label: "B", tip: `\u7C97\u4F53 (${mod} + B)`, md: "**\u6587\u672C** \u7A7A\u683C", cls: "
|
|
3662
|
-
{ name: "strike", label: "S", tip: `\u5220\u9664\u7EBF (${mod} + Shift + X)`, md: "~~\u6587\u672C~~ \u7A7A\u683C", cls: "
|
|
3663
|
-
{ name: "italic", label: "I", tip: `\u659C\u4F53 (${mod} + I)`, md: "*\u6587\u672C* \u7A7A\u683C", cls: "
|
|
3664
|
-
{ name: "underline", label: "U", tip: `\u4E0B\u5212\u7EBF (${mod} + U)`, md: "", cls: "
|
|
3666
|
+
{ name: "bold", label: "B", tip: `\u7C97\u4F53 (${mod} + B)`, md: "**\u6587\u672C** \u7A7A\u683C", cls: "markloom-bb-bold" },
|
|
3667
|
+
{ name: "strike", label: "S", tip: `\u5220\u9664\u7EBF (${mod} + Shift + X)`, md: "~~\u6587\u672C~~ \u7A7A\u683C", cls: "markloom-bb-strike" },
|
|
3668
|
+
{ name: "italic", label: "I", tip: `\u659C\u4F53 (${mod} + I)`, md: "*\u6587\u672C* \u7A7A\u683C", cls: "markloom-bb-italic" },
|
|
3669
|
+
{ name: "underline", label: "U", tip: `\u4E0B\u5212\u7EBF (${mod} + U)`, md: "", cls: "markloom-bb-under" }
|
|
3665
3670
|
];
|
|
3666
3671
|
var FONT_COLORS = [
|
|
3667
3672
|
{ value: null, title: "\u9ED8\u8BA4", swatch: "#1f2329" },
|
|
@@ -3692,14 +3697,14 @@ var BG_COLORS = [
|
|
|
3692
3697
|
{ value: "#7b67ee", title: "\u7D2B", swatch: "#7b67ee" }
|
|
3693
3698
|
];
|
|
3694
3699
|
function tipNode(title, md) {
|
|
3695
|
-
return h5("div", { class: "
|
|
3696
|
-
h5("div", { class: "
|
|
3697
|
-
md ? h5("div", { class: "
|
|
3700
|
+
return h5("div", { class: "markloom-bubble-tip", key: "tip" }, [
|
|
3701
|
+
h5("div", { class: "markloom-bubble-tip-t", key: "t" }, title),
|
|
3702
|
+
md ? h5("div", { class: "markloom-bubble-tip-md", key: "m" }, `Markdown: ${md}`) : null
|
|
3698
3703
|
]);
|
|
3699
3704
|
}
|
|
3700
3705
|
function blockIco(name, size2 = 18) {
|
|
3701
3706
|
if (name === "h1" || name === "h2" || name === "h3")
|
|
3702
|
-
return h5("span", { class: "
|
|
3707
|
+
return h5("span", { class: "markloom-bb-hico" }, [h5("span", {}, "H"), h5("sub", {}, name[1])]);
|
|
3703
3708
|
return icon(name, size2);
|
|
3704
3709
|
}
|
|
3705
3710
|
function currentBlockKind(doc, sel) {
|
|
@@ -3736,7 +3741,7 @@ var BubbleMenu = class {
|
|
|
3736
3741
|
this.root = root;
|
|
3737
3742
|
this.host = host;
|
|
3738
3743
|
this.overlay = document.createElement("div");
|
|
3739
|
-
this.overlay.className = "
|
|
3744
|
+
this.overlay.className = "markloom-bubble-overlay";
|
|
3740
3745
|
document.body.appendChild(this.overlay);
|
|
3741
3746
|
document.addEventListener("selectionchange", this.onSelChange);
|
|
3742
3747
|
document.addEventListener("pointerdown", this.onPointerDown, true);
|
|
@@ -3856,7 +3861,7 @@ var BubbleMenu = class {
|
|
|
3856
3861
|
].join("|");
|
|
3857
3862
|
}
|
|
3858
3863
|
moveBubble(rect) {
|
|
3859
|
-
const el = this.overlay.querySelector(".
|
|
3864
|
+
const el = this.overlay.querySelector(".markloom-bubble");
|
|
3860
3865
|
if (!el)
|
|
3861
3866
|
return;
|
|
3862
3867
|
this.lastRect = rect;
|
|
@@ -3968,7 +3973,7 @@ var BubbleMenu = class {
|
|
|
3968
3973
|
hoverWrap(id, trigger, panel) {
|
|
3969
3974
|
return h5("div", {
|
|
3970
3975
|
key: id,
|
|
3971
|
-
class: "
|
|
3976
|
+
class: "markloom-bb-dd-wrap" + (this.menu === id ? " is-open" : ""),
|
|
3972
3977
|
"data-menu-wrap": id,
|
|
3973
3978
|
onMouseEnter: () => this.scheduleOpenMenu(id),
|
|
3974
3979
|
onMouseLeave: () => this.scheduleCloseMenu()
|
|
@@ -3985,22 +3990,22 @@ var BubbleMenu = class {
|
|
|
3985
3990
|
const curBg = this.activeBg(sel);
|
|
3986
3991
|
const colorSwatch = curColor ?? "#1f2329";
|
|
3987
3992
|
const hasStyle = !!(curColor || curBg || active2.has("highlight"));
|
|
3988
|
-
const sep = (k) => h5("span", { key: k, class: "
|
|
3993
|
+
const sep = (k) => h5("span", { key: k, class: "markloom-bubble-sep" });
|
|
3989
3994
|
const blockBtn = h5("button", {
|
|
3990
3995
|
"key": "block",
|
|
3991
3996
|
"type": "button",
|
|
3992
|
-
"class": "
|
|
3997
|
+
"class": "markloom-bb-dd" + (this.menu === "block" ? " is-open" : ""),
|
|
3993
3998
|
"data-menu": "block",
|
|
3994
3999
|
"title": "\u6B63\u6587\u4E0E\u6807\u9898",
|
|
3995
4000
|
"onMouseDown": (e) => e.preventDefault()
|
|
3996
4001
|
}, [
|
|
3997
|
-
h5("span", { class: "
|
|
3998
|
-
icon("chevron-down", 12, "
|
|
4002
|
+
h5("span", { class: "markloom-bb-t", key: "t" }, "T"),
|
|
4003
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
3999
4004
|
tipNode("\u6B63\u6587\u4E0E\u6807\u9898")
|
|
4000
4005
|
]);
|
|
4001
4006
|
const blockMenu = h5("div", {
|
|
4002
4007
|
key: "block-menu",
|
|
4003
|
-
class: "
|
|
4008
|
+
class: "markloom-bb-menu" + (this.menu === "block" ? " is-open" : ""),
|
|
4004
4009
|
"data-panel": "block"
|
|
4005
4010
|
}, (() => {
|
|
4006
4011
|
const rows = [];
|
|
@@ -4008,22 +4013,22 @@ var BubbleMenu = class {
|
|
|
4008
4013
|
for (const it of BLOCK_ITEMS) {
|
|
4009
4014
|
const g = it.group ?? "fmt";
|
|
4010
4015
|
if (lastGroup && lastGroup !== g)
|
|
4011
|
-
rows.push(h5("div", { key: `sep-${g}`, class: "
|
|
4016
|
+
rows.push(h5("div", { key: `sep-${g}`, class: "markloom-bb-menu-sep" }));
|
|
4012
4017
|
lastGroup = g;
|
|
4013
4018
|
const on = curBlock === it.kind;
|
|
4014
4019
|
rows.push(h5("button", {
|
|
4015
4020
|
key: it.kind,
|
|
4016
4021
|
type: "button",
|
|
4017
|
-
class: "
|
|
4022
|
+
class: "markloom-bb-menu-item" + (on ? " is-on" : ""),
|
|
4018
4023
|
"data-block": it.kind,
|
|
4019
4024
|
onMouseDown: (e) => {
|
|
4020
4025
|
e.preventDefault();
|
|
4021
4026
|
this.applyBlock(it.kind);
|
|
4022
4027
|
}
|
|
4023
4028
|
}, [
|
|
4024
|
-
h5("span", { class: "
|
|
4025
|
-
h5("span", { class: "
|
|
4026
|
-
on ? h5("span", { class: "
|
|
4029
|
+
h5("span", { class: "markloom-bb-menu-ico", key: "i" }, blockIco(it.ico, 18)),
|
|
4030
|
+
h5("span", { class: "markloom-bb-menu-lab", key: "l" }, it.label),
|
|
4031
|
+
on ? h5("span", { class: "markloom-bb-menu-check", key: "c" }, icon("check", 16)) : h5("span", { key: "c" })
|
|
4027
4032
|
]));
|
|
4028
4033
|
}
|
|
4029
4034
|
return rows;
|
|
@@ -4031,18 +4036,18 @@ var BubbleMenu = class {
|
|
|
4031
4036
|
const alignBtn = h5("button", {
|
|
4032
4037
|
"key": "align",
|
|
4033
4038
|
"type": "button",
|
|
4034
|
-
"class": "
|
|
4039
|
+
"class": "markloom-bb-dd" + (this.menu === "align" ? " is-open" : ""),
|
|
4035
4040
|
"data-menu": "align",
|
|
4036
4041
|
"title": "\u5BF9\u9F50\u4E0E\u7F29\u8FDB",
|
|
4037
4042
|
"onMouseDown": (e) => e.preventDefault()
|
|
4038
4043
|
}, [
|
|
4039
4044
|
icon("text-align", 16),
|
|
4040
|
-
icon("chevron-down", 12, "
|
|
4045
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
4041
4046
|
tipNode("\u5BF9\u9F50\u4E0E\u7F29\u8FDB")
|
|
4042
4047
|
]);
|
|
4043
4048
|
const alignMenu = h5("div", {
|
|
4044
4049
|
key: "align-menu",
|
|
4045
|
-
class: "
|
|
4050
|
+
class: "markloom-bb-menu" + (this.menu === "align" ? " is-open" : ""),
|
|
4046
4051
|
"data-panel": "align"
|
|
4047
4052
|
}, [
|
|
4048
4053
|
...[
|
|
@@ -4052,7 +4057,7 @@ var BubbleMenu = class {
|
|
|
4052
4057
|
].map((a) => h5("button", {
|
|
4053
4058
|
key: a.value,
|
|
4054
4059
|
type: "button",
|
|
4055
|
-
class: "
|
|
4060
|
+
class: "markloom-bb-menu-item" + (curAlign === a.value ? " is-on" : ""),
|
|
4056
4061
|
"data-align": a.value,
|
|
4057
4062
|
onMouseDown: (e) => {
|
|
4058
4063
|
e.preventDefault();
|
|
@@ -4067,15 +4072,15 @@ var BubbleMenu = class {
|
|
|
4067
4072
|
this.paint(this.lastRect, this.lastSel, true);
|
|
4068
4073
|
}
|
|
4069
4074
|
}, [
|
|
4070
|
-
h5("span", { class: "
|
|
4071
|
-
h5("span", { class: "
|
|
4072
|
-
curAlign === a.value ? h5("span", { class: "
|
|
4075
|
+
h5("span", { class: "markloom-bb-menu-ico", key: "i" }, icon(a.ico, 18)),
|
|
4076
|
+
h5("span", { class: "markloom-bb-menu-lab", key: "l" }, a.title),
|
|
4077
|
+
curAlign === a.value ? h5("span", { class: "markloom-bb-menu-check", key: "c" }, icon("check", 16)) : h5("span", { key: "c" })
|
|
4073
4078
|
])),
|
|
4074
|
-
h5("div", { key: "sep-ind", class: "
|
|
4079
|
+
h5("div", { key: "sep-ind", class: "markloom-bb-menu-sep" }),
|
|
4075
4080
|
h5("button", {
|
|
4076
4081
|
key: "indent",
|
|
4077
4082
|
type: "button",
|
|
4078
|
-
class: "
|
|
4083
|
+
class: "markloom-bb-menu-item",
|
|
4079
4084
|
"data-indent": "in",
|
|
4080
4085
|
onMouseDown: (e) => {
|
|
4081
4086
|
e.preventDefault();
|
|
@@ -4088,13 +4093,13 @@ var BubbleMenu = class {
|
|
|
4088
4093
|
this.menu = null;
|
|
4089
4094
|
}
|
|
4090
4095
|
}, [
|
|
4091
|
-
h5("span", { class: "
|
|
4092
|
-
h5("span", { class: "
|
|
4096
|
+
h5("span", { class: "markloom-bb-menu-ico", key: "i" }, icon("indent-increase", 18)),
|
|
4097
|
+
h5("span", { class: "markloom-bb-menu-lab", key: "l" }, "\u589E\u52A0\u7F29\u8FDB")
|
|
4093
4098
|
]),
|
|
4094
4099
|
h5("button", {
|
|
4095
4100
|
key: "outdent",
|
|
4096
4101
|
type: "button",
|
|
4097
|
-
class: "
|
|
4102
|
+
class: "markloom-bb-menu-item",
|
|
4098
4103
|
"data-indent": "out",
|
|
4099
4104
|
onMouseDown: (e) => {
|
|
4100
4105
|
e.preventDefault();
|
|
@@ -4107,14 +4112,14 @@ var BubbleMenu = class {
|
|
|
4107
4112
|
this.menu = null;
|
|
4108
4113
|
}
|
|
4109
4114
|
}, [
|
|
4110
|
-
h5("span", { class: "
|
|
4111
|
-
h5("span", { class: "
|
|
4115
|
+
h5("span", { class: "markloom-bb-menu-ico", key: "i" }, icon("indent-decrease", 18)),
|
|
4116
|
+
h5("span", { class: "markloom-bb-menu-lab", key: "l" }, "\u51CF\u5C11\u7F29\u8FDB")
|
|
4112
4117
|
])
|
|
4113
4118
|
]);
|
|
4114
4119
|
const markBtns = MARK_ITEMS.map((it) => h5("button", {
|
|
4115
4120
|
"key": it.name,
|
|
4116
4121
|
"type": "button",
|
|
4117
|
-
"class": `
|
|
4122
|
+
"class": `markloom-bb-mark ${it.cls ?? ""}`,
|
|
4118
4123
|
"title": it.tip,
|
|
4119
4124
|
"data-active": active2.has(it.name) ? "" : void 0,
|
|
4120
4125
|
"data-mark": it.name,
|
|
@@ -4190,7 +4195,7 @@ var BubbleMenu = class {
|
|
|
4190
4195
|
const colorBtn = h5("button", {
|
|
4191
4196
|
"key": "color",
|
|
4192
4197
|
"type": "button",
|
|
4193
|
-
"class": "
|
|
4198
|
+
"class": "markloom-bb-color" + (this.menu === "color" ? " is-open" : "") + (curBg || active2.has("highlight") ? " has-hl" : ""),
|
|
4194
4199
|
"data-menu": "color",
|
|
4195
4200
|
"data-active": hasStyle ? "" : void 0,
|
|
4196
4201
|
"title": "\u6587\u5B57\u989C\u8272\u4E0E\u9AD8\u4EAE",
|
|
@@ -4198,27 +4203,27 @@ var BubbleMenu = class {
|
|
|
4198
4203
|
}, [
|
|
4199
4204
|
h5("span", {
|
|
4200
4205
|
key: "a",
|
|
4201
|
-
class: "
|
|
4206
|
+
class: "markloom-bb-a",
|
|
4202
4207
|
style: {
|
|
4203
4208
|
color: colorSwatch,
|
|
4204
4209
|
background: curBg ?? (active2.has("highlight") ? "#faf1d1" : "transparent")
|
|
4205
4210
|
}
|
|
4206
4211
|
}, "A"),
|
|
4207
|
-
icon("chevron-down", 12, "
|
|
4212
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
4208
4213
|
tipNode("\u6587\u5B57\u989C\u8272\u4E0E\u9AD8\u4EAE")
|
|
4209
4214
|
]);
|
|
4210
4215
|
const colorMenu = h5("div", {
|
|
4211
4216
|
key: "color-menu",
|
|
4212
|
-
class: "
|
|
4217
|
+
class: "markloom-bb-menu markloom-bb-menu-color" + (this.menu === "color" ? " is-open" : ""),
|
|
4213
4218
|
"data-panel": "color"
|
|
4214
4219
|
}, [
|
|
4215
|
-
h5("div", { class: "
|
|
4216
|
-
h5("div", { class: "
|
|
4220
|
+
h5("div", { class: "markloom-bb-color-sec", key: "ct" }, "\u5B57\u4F53\u989C\u8272"),
|
|
4221
|
+
h5("div", { class: "markloom-bb-swatches markloom-bb-font-row", key: "cs" }, FONT_COLORS.map((c) => {
|
|
4217
4222
|
const on = c.value === null ? !curColor : curColor === c.value;
|
|
4218
4223
|
return h5("button", {
|
|
4219
4224
|
key: c.title,
|
|
4220
4225
|
type: "button",
|
|
4221
|
-
class: "
|
|
4226
|
+
class: "markloom-bb-font-a" + (on ? " is-on" : ""),
|
|
4222
4227
|
title: c.title,
|
|
4223
4228
|
style: { color: c.swatch },
|
|
4224
4229
|
onMouseDown: (e) => {
|
|
@@ -4232,13 +4237,13 @@ var BubbleMenu = class {
|
|
|
4232
4237
|
}
|
|
4233
4238
|
}, "A");
|
|
4234
4239
|
})),
|
|
4235
|
-
h5("div", { class: "
|
|
4236
|
-
h5("div", { class: "
|
|
4240
|
+
h5("div", { class: "markloom-bb-color-sec", key: "ht" }, "\u80CC\u666F\u989C\u8272"),
|
|
4241
|
+
h5("div", { class: "markloom-bb-swatches markloom-bb-bg-row", key: "hs" }, BG_COLORS.map((c) => {
|
|
4237
4242
|
const on = c.value === null ? !curBg && !active2.has("highlight") : curBg === c.value;
|
|
4238
4243
|
return h5("button", {
|
|
4239
4244
|
key: c.title,
|
|
4240
4245
|
type: "button",
|
|
4241
|
-
class: "
|
|
4246
|
+
class: "markloom-bb-swatch" + (c.none ? " markloom-bb-swatch-none" : "") + (on ? " is-on" : ""),
|
|
4242
4247
|
"data-edge": c.edge ? "" : void 0,
|
|
4243
4248
|
title: c.title,
|
|
4244
4249
|
style: c.none ? void 0 : { background: c.swatch },
|
|
@@ -4264,7 +4269,7 @@ var BubbleMenu = class {
|
|
|
4264
4269
|
h5("button", {
|
|
4265
4270
|
key: "reset",
|
|
4266
4271
|
type: "button",
|
|
4267
|
-
class: "
|
|
4272
|
+
class: "markloom-bb-reset",
|
|
4268
4273
|
onMouseDown: (e) => {
|
|
4269
4274
|
e.preventDefault();
|
|
4270
4275
|
const cur = this.host.markSel();
|
|
@@ -4287,25 +4292,25 @@ var BubbleMenu = class {
|
|
|
4287
4292
|
const aiContinueBtn = this.host.openAi ? h5("button", {
|
|
4288
4293
|
"key": "ai-continue",
|
|
4289
4294
|
"type": "button",
|
|
4290
|
-
"class": "
|
|
4295
|
+
"class": "markloom-bb-ai",
|
|
4291
4296
|
"data-ai": "continue",
|
|
4292
4297
|
"title": "AI \u7EED\u5199",
|
|
4293
4298
|
"onMouseDown": (e) => {
|
|
4294
4299
|
e.preventDefault();
|
|
4295
4300
|
this.host.openAi?.("continue");
|
|
4296
4301
|
}
|
|
4297
|
-
}, [icon("sparkles", 16), h5("span", { class: "
|
|
4302
|
+
}, [icon("sparkles", 16), h5("span", { class: "markloom-bb-ai-lab", key: "l" }, "\u7EED\u5199"), tipNode("AI \u7EED\u5199")]) : null;
|
|
4298
4303
|
const aiRewriteBtn = this.host.openAi ? h5("button", {
|
|
4299
4304
|
"key": "ai-rewrite",
|
|
4300
4305
|
"type": "button",
|
|
4301
|
-
"class": "
|
|
4306
|
+
"class": "markloom-bb-ai",
|
|
4302
4307
|
"data-ai": "rewrite",
|
|
4303
4308
|
"title": "AI \u6539\u5199",
|
|
4304
4309
|
"onMouseDown": (e) => {
|
|
4305
4310
|
e.preventDefault();
|
|
4306
4311
|
this.host.openAi?.("rewrite");
|
|
4307
4312
|
}
|
|
4308
|
-
}, [icon("pen-line", 16), h5("span", { class: "
|
|
4313
|
+
}, [icon("pen-line", 16), h5("span", { class: "markloom-bb-ai-lab", key: "l" }, "\u6539\u5199"), tipNode("AI \u6539\u5199")]) : null;
|
|
4309
4314
|
const commentBtn = this.host.beginComment ? h5("button", {
|
|
4310
4315
|
"key": "comment",
|
|
4311
4316
|
"type": "button",
|
|
@@ -4318,9 +4323,9 @@ var BubbleMenu = class {
|
|
|
4318
4323
|
}, [icon("message-circle", 16), tipNode("\u8BC4\u8BBA")]) : null;
|
|
4319
4324
|
render3(
|
|
4320
4325
|
h5("div", {
|
|
4321
|
-
class: "
|
|
4326
|
+
class: "markloom-bubble" + (settled ? " is-in" : "")
|
|
4322
4327
|
}, [
|
|
4323
|
-
h5("div", { class: "
|
|
4328
|
+
h5("div", { class: "markloom-bb-row", key: "row" }, [
|
|
4324
4329
|
this.hoverWrap("block", blockBtn, blockMenu),
|
|
4325
4330
|
sep("s0"),
|
|
4326
4331
|
this.hoverWrap("align", alignBtn, alignMenu),
|
|
@@ -4336,7 +4341,7 @@ var BubbleMenu = class {
|
|
|
4336
4341
|
]),
|
|
4337
4342
|
this.overlay
|
|
4338
4343
|
);
|
|
4339
|
-
const el = this.overlay.querySelector(".
|
|
4344
|
+
const el = this.overlay.querySelector(".markloom-bubble");
|
|
4340
4345
|
if (el) {
|
|
4341
4346
|
if (settled)
|
|
4342
4347
|
el.classList.add("is-in");
|
|
@@ -4409,7 +4414,7 @@ var CodeControls = class {
|
|
|
4409
4414
|
return;
|
|
4410
4415
|
}
|
|
4411
4416
|
this.menu = document.createElement("div");
|
|
4412
|
-
this.menu.className = "
|
|
4417
|
+
this.menu.className = "markloom-code-lang-menu";
|
|
4413
4418
|
this.menu.style.cssText = "position:fixed;z-index:1000";
|
|
4414
4419
|
for (const opt of ["\u7EAF\u6587\u672C", ...this.host.langs()]) {
|
|
4415
4420
|
const item = document.createElement("button");
|
|
@@ -4481,7 +4486,7 @@ var DragHandle = class {
|
|
|
4481
4486
|
this.root = root;
|
|
4482
4487
|
this.host = host;
|
|
4483
4488
|
this.overlay = document.createElement("div");
|
|
4484
|
-
this.overlay.className = "
|
|
4489
|
+
this.overlay.className = "markloom-drag-overlay";
|
|
4485
4490
|
document.body.appendChild(this.overlay);
|
|
4486
4491
|
document.addEventListener("mousemove", this.onHover);
|
|
4487
4492
|
window.addEventListener("scroll", this.onLeave, true);
|
|
@@ -4689,7 +4694,7 @@ var DragHandle = class {
|
|
|
4689
4694
|
const gap = this.drag.gap;
|
|
4690
4695
|
const y = gap === 0 ? blocks[0]?.getBoundingClientRect().top ?? 0 : blocks[gap - 1]?.getBoundingClientRect().bottom ?? 0;
|
|
4691
4696
|
const box = docEl.getBoundingClientRect();
|
|
4692
|
-
return h6("div", { key: "drop", class: "
|
|
4697
|
+
return h6("div", { key: "drop", class: "markloom-drag-drop", style: `top:${y}px;left:${box.left}px;width:${box.width}px` });
|
|
4693
4698
|
}
|
|
4694
4699
|
gripSvg() {
|
|
4695
4700
|
return h6("svg", {
|
|
@@ -4727,7 +4732,7 @@ var DragHandle = class {
|
|
|
4727
4732
|
const typeRow = TYPE_ITEMS.map((it) => h6("button", {
|
|
4728
4733
|
key: it.kind,
|
|
4729
4734
|
type: "button",
|
|
4730
|
-
class: "
|
|
4735
|
+
class: "markloom-block-menu-btn" + (kind === it.kind ? " is-on" : ""),
|
|
4731
4736
|
title: it.title,
|
|
4732
4737
|
"data-block-kind": it.kind,
|
|
4733
4738
|
onMouseDown: (e) => {
|
|
@@ -4739,7 +4744,7 @@ var DragHandle = class {
|
|
|
4739
4744
|
const markRow = MARK_ITEMS2.map((it) => h6("button", {
|
|
4740
4745
|
key: it.name,
|
|
4741
4746
|
type: "button",
|
|
4742
|
-
class: "
|
|
4747
|
+
class: "markloom-block-menu-btn markloom-block-menu-mark",
|
|
4743
4748
|
title: it.title,
|
|
4744
4749
|
"data-mark": it.name,
|
|
4745
4750
|
onMouseDown: (e) => {
|
|
@@ -4751,7 +4756,7 @@ var DragHandle = class {
|
|
|
4751
4756
|
const colorRow = COLORS.map((c, i) => h6("button", {
|
|
4752
4757
|
key: `c${i}`,
|
|
4753
4758
|
type: "button",
|
|
4754
|
-
class: "
|
|
4759
|
+
class: "markloom-block-menu-swatch",
|
|
4755
4760
|
title: c.title,
|
|
4756
4761
|
style: `background:${c.swatch}`,
|
|
4757
4762
|
onMouseDown: (e) => {
|
|
@@ -4767,7 +4772,7 @@ var DragHandle = class {
|
|
|
4767
4772
|
].map((a) => h6("button", {
|
|
4768
4773
|
key: a.v,
|
|
4769
4774
|
type: "button",
|
|
4770
|
-
class: "
|
|
4775
|
+
class: "markloom-block-menu-btn",
|
|
4771
4776
|
title: a.title,
|
|
4772
4777
|
"data-align": a.v,
|
|
4773
4778
|
onMouseDown: (e) => {
|
|
@@ -4778,16 +4783,16 @@ var DragHandle = class {
|
|
|
4778
4783
|
}, icon(a.ico, 14)));
|
|
4779
4784
|
return h6("div", {
|
|
4780
4785
|
key: "menu",
|
|
4781
|
-
class: "
|
|
4786
|
+
class: "markloom-block-menu",
|
|
4782
4787
|
onMouseEnter: this.keepMenu,
|
|
4783
4788
|
onMouseLeave: this.scheduleCloseMenu
|
|
4784
4789
|
}, [
|
|
4785
|
-
h6("div", { key: "types", class: "
|
|
4786
|
-
h6("div", { key: "sep1", class: "
|
|
4787
|
-
h6("div", { key: "marks", class: "
|
|
4788
|
-
h6("div", { key: "colors", class: "
|
|
4789
|
-
h6("div", { key: "sep2", class: "
|
|
4790
|
-
h6("div", { key: "align", class: "
|
|
4790
|
+
h6("div", { key: "types", class: "markloom-block-menu-row" }, typeRow),
|
|
4791
|
+
h6("div", { key: "sep1", class: "markloom-block-menu-sep" }),
|
|
4792
|
+
h6("div", { key: "marks", class: "markloom-block-menu-row" }, markRow),
|
|
4793
|
+
h6("div", { key: "colors", class: "markloom-block-menu-row markloom-block-menu-colors" }, colorRow),
|
|
4794
|
+
h6("div", { key: "sep2", class: "markloom-block-menu-sep" }),
|
|
4795
|
+
h6("div", { key: "align", class: "markloom-block-menu-row" }, alignRow)
|
|
4791
4796
|
]);
|
|
4792
4797
|
}
|
|
4793
4798
|
paint() {
|
|
@@ -4802,7 +4807,7 @@ var DragHandle = class {
|
|
|
4802
4807
|
if (el) {
|
|
4803
4808
|
const r = el.getBoundingClientRect();
|
|
4804
4809
|
const depth = el.getAttribute("data-heading-depth");
|
|
4805
|
-
const isHeading = el.classList.contains("
|
|
4810
|
+
const isHeading = el.classList.contains("markloom-heading") && !!depth;
|
|
4806
4811
|
const collapsed = el.getAttribute("data-collapsed") === "true";
|
|
4807
4812
|
const BAR_H = 22;
|
|
4808
4813
|
const cs = getComputedStyle(el);
|
|
@@ -4814,7 +4819,7 @@ var DragHandle = class {
|
|
|
4814
4819
|
const barRight = r.left - 4;
|
|
4815
4820
|
children.push(h6("div", {
|
|
4816
4821
|
key: "hit",
|
|
4817
|
-
class: "
|
|
4822
|
+
class: "markloom-drag-hit",
|
|
4818
4823
|
style: `top:${r.top}px;left:${r.left - GUTTER}px;width:${GUTTER}px;height:${hitH}px`
|
|
4819
4824
|
}));
|
|
4820
4825
|
const dragDown = (e) => {
|
|
@@ -4827,7 +4832,7 @@ var DragHandle = class {
|
|
|
4827
4832
|
items.push(h6("button", {
|
|
4828
4833
|
key: "kind",
|
|
4829
4834
|
type: "button",
|
|
4830
|
-
class: "
|
|
4835
|
+
class: "markloom-block-kind" + (kindOn ? " is-on" : ""),
|
|
4831
4836
|
title: "\u62D6\u62FD\u79FB\u52A8 \xB7 \u60AC\u505C\u683C\u5F0F",
|
|
4832
4837
|
onMouseDown: dragDown,
|
|
4833
4838
|
onMouseEnter: this.keepMenu
|
|
@@ -4836,7 +4841,7 @@ var DragHandle = class {
|
|
|
4836
4841
|
items.push(h6("button", {
|
|
4837
4842
|
key: "add",
|
|
4838
4843
|
type: "button",
|
|
4839
|
-
class: "
|
|
4844
|
+
class: "markloom-add-handle",
|
|
4840
4845
|
title: "\u63D2\u5165\u5185\u5BB9",
|
|
4841
4846
|
onMouseDown: (e) => {
|
|
4842
4847
|
e.preventDefault();
|
|
@@ -4852,7 +4857,7 @@ var DragHandle = class {
|
|
|
4852
4857
|
items.push(h6("button", {
|
|
4853
4858
|
key: "handle",
|
|
4854
4859
|
type: "button",
|
|
4855
|
-
class: "
|
|
4860
|
+
class: "markloom-drag-handle",
|
|
4856
4861
|
title: "\u62D6\u62FD\u79FB\u52A8 \xB7 \u60AC\u505C\u683C\u5F0F",
|
|
4857
4862
|
onMouseDown: dragDown,
|
|
4858
4863
|
onMouseEnter: this.keepMenu
|
|
@@ -4861,7 +4866,7 @@ var DragHandle = class {
|
|
|
4861
4866
|
items.push(h6("button", {
|
|
4862
4867
|
key: "fold",
|
|
4863
4868
|
type: "button",
|
|
4864
|
-
class: "
|
|
4869
|
+
class: "markloom-heading-fold" + (collapsed ? " is-collapsed" : ""),
|
|
4865
4870
|
"data-heading-fold": "",
|
|
4866
4871
|
title: collapsed ? "\u5C55\u5F00" : "\u6298\u53E0",
|
|
4867
4872
|
"aria-expanded": collapsed ? "false" : "true",
|
|
@@ -4875,7 +4880,7 @@ var DragHandle = class {
|
|
|
4875
4880
|
}
|
|
4876
4881
|
children.push(h6("div", {
|
|
4877
4882
|
key: "bar",
|
|
4878
|
-
class: "
|
|
4883
|
+
class: "markloom-block-bar",
|
|
4879
4884
|
style: `top:${y}px;left:${barRight}px;transform:translateX(-100%)`,
|
|
4880
4885
|
onMouseEnter: this.keepMenu,
|
|
4881
4886
|
onMouseLeave: this.scheduleCloseMenu
|
|
@@ -4889,8 +4894,8 @@ var DragHandle = class {
|
|
|
4889
4894
|
}
|
|
4890
4895
|
render4(h6("div", null, children), this.overlay);
|
|
4891
4896
|
if (this.menuOpen) {
|
|
4892
|
-
const bar = this.overlay.querySelector(".
|
|
4893
|
-
const menu = this.overlay.querySelector(".
|
|
4897
|
+
const bar = this.overlay.querySelector(".markloom-block-bar");
|
|
4898
|
+
const menu = this.overlay.querySelector(".markloom-block-menu");
|
|
4894
4899
|
if (bar && menu)
|
|
4895
4900
|
void place(bar, menu, { placement: "bottom-end", gap: 4 });
|
|
4896
4901
|
}
|
|
@@ -4941,11 +4946,11 @@ var ICON_PATHS = {
|
|
|
4941
4946
|
};
|
|
4942
4947
|
function iconNode(name) {
|
|
4943
4948
|
if (name === "h1" || name === "h2" || name === "h3")
|
|
4944
|
-
return h7("span", { class: "
|
|
4949
|
+
return h7("span", { class: "markloom-slash-icon markloom-slash-htxt" }, [h7("span", {}, "H"), h7("sub", {}, name[1])]);
|
|
4945
4950
|
const paths = ICON_PATHS[name] ?? [];
|
|
4946
4951
|
return h7(
|
|
4947
4952
|
"svg",
|
|
4948
|
-
{ class: "
|
|
4953
|
+
{ class: "markloom-slash-icon", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.8", "stroke-linecap": "round", "stroke-linejoin": "round" },
|
|
4949
4954
|
paths.map((d, i) => h7("path", { key: i, d }))
|
|
4950
4955
|
);
|
|
4951
4956
|
}
|
|
@@ -4962,14 +4967,14 @@ var SlashMenu = class {
|
|
|
4962
4967
|
this.root = root;
|
|
4963
4968
|
this.host = host;
|
|
4964
4969
|
this.overlay = document.createElement("div");
|
|
4965
|
-
this.overlay.className = "
|
|
4970
|
+
this.overlay.className = "markloom-slash-overlay";
|
|
4966
4971
|
document.body.appendChild(this.overlay);
|
|
4967
|
-
root.addEventListener("
|
|
4972
|
+
root.addEventListener("markloom-redraw", this.reevaluate);
|
|
4968
4973
|
document.addEventListener("selectionchange", this.reevaluate);
|
|
4969
4974
|
root.addEventListener("keydown", this.onKeyDown, true);
|
|
4970
4975
|
}
|
|
4971
4976
|
destroy() {
|
|
4972
|
-
this.root.removeEventListener("
|
|
4977
|
+
this.root.removeEventListener("markloom-redraw", this.reevaluate);
|
|
4973
4978
|
document.removeEventListener("selectionchange", this.reevaluate);
|
|
4974
4979
|
this.root.removeEventListener("keydown", this.onKeyDown, true);
|
|
4975
4980
|
this.close();
|
|
@@ -5117,7 +5122,7 @@ var SlashMenu = class {
|
|
|
5117
5122
|
let prev = null;
|
|
5118
5123
|
list.forEach((it, i) => {
|
|
5119
5124
|
if (it.section !== prev) {
|
|
5120
|
-
rows.push(h7("div", { key: `h-${it.section}`, class: "
|
|
5125
|
+
rows.push(h7("div", { key: `h-${it.section}`, class: "markloom-slash-section" }, it.section));
|
|
5121
5126
|
prev = it.section;
|
|
5122
5127
|
}
|
|
5123
5128
|
rows.push(h7("button", {
|
|
@@ -5128,13 +5133,13 @@ var SlashMenu = class {
|
|
|
5128
5133
|
e.preventDefault();
|
|
5129
5134
|
this.apply(it);
|
|
5130
5135
|
}
|
|
5131
|
-
}, [iconNode(it.icon), h7("span", { class: "
|
|
5136
|
+
}, [iconNode(it.icon), h7("span", { class: "markloom-slash-label" }, it.label)]));
|
|
5132
5137
|
});
|
|
5133
5138
|
render5(
|
|
5134
|
-
h7("div", { class: "
|
|
5139
|
+
h7("div", { class: "markloom-slash" }, rows),
|
|
5135
5140
|
this.overlay
|
|
5136
5141
|
);
|
|
5137
|
-
const el = this.overlay.querySelector(".
|
|
5142
|
+
const el = this.overlay.querySelector(".markloom-slash");
|
|
5138
5143
|
if (el)
|
|
5139
5144
|
void place(rectRef(rect), el, { placement: "bottom-start", gap: 6 });
|
|
5140
5145
|
}
|
|
@@ -5327,12 +5332,12 @@ var linkMark = {
|
|
|
5327
5332
|
tag: "a",
|
|
5328
5333
|
props: (mark) => {
|
|
5329
5334
|
if (!mark.attrs?.url)
|
|
5330
|
-
return { "data-mark": "link", class: "
|
|
5335
|
+
return { "data-mark": "link", class: "markloom-link" };
|
|
5331
5336
|
const url = String(mark.attrs.url);
|
|
5332
5337
|
return {
|
|
5333
5338
|
href: url,
|
|
5334
5339
|
"data-mark": "link",
|
|
5335
|
-
class: "
|
|
5340
|
+
class: "markloom-link",
|
|
5336
5341
|
rel: "noopener noreferrer",
|
|
5337
5342
|
title: url
|
|
5338
5343
|
};
|
|
@@ -5363,7 +5368,7 @@ var textStyleMark = {
|
|
|
5363
5368
|
var markExtensions = [boldMark, italicMark, codeMark, strikeMark, underlineMark, highlightMark, superscriptMark, subscriptMark, linkMark, textStyleMark];
|
|
5364
5369
|
|
|
5365
5370
|
// src/view/kit.ts
|
|
5366
|
-
function
|
|
5371
|
+
function markloomKit() {
|
|
5367
5372
|
return [...markExtensions, ...blockExtensions, inputRules, textAlign, history, ...decorationExtensions];
|
|
5368
5373
|
}
|
|
5369
5374
|
|
|
@@ -5385,7 +5390,7 @@ var CommentPanel = class {
|
|
|
5385
5390
|
this.threads = initial.slice();
|
|
5386
5391
|
this.scrollRoot = findScrollParent(host.root) ?? document.body;
|
|
5387
5392
|
this.overlay = document.createElement("div");
|
|
5388
|
-
this.overlay.className = "
|
|
5393
|
+
this.overlay.className = "markloom-comment-overlay";
|
|
5389
5394
|
this.scrollRoot.appendChild(this.overlay);
|
|
5390
5395
|
host.root.addEventListener("click", this.onRootClick);
|
|
5391
5396
|
document.addEventListener("keydown", this.onKey);
|
|
@@ -5400,8 +5405,8 @@ var CommentPanel = class {
|
|
|
5400
5405
|
window.removeEventListener("resize", this.onReflow);
|
|
5401
5406
|
render6(null, this.overlay);
|
|
5402
5407
|
this.overlay.remove();
|
|
5403
|
-
this.scrollRoot.classList.remove("
|
|
5404
|
-
document.documentElement.classList.remove("
|
|
5408
|
+
this.scrollRoot.classList.remove("markloom-comment-rail-open");
|
|
5409
|
+
document.documentElement.classList.remove("markloom-comment-rail-open");
|
|
5405
5410
|
}
|
|
5406
5411
|
getThreads() {
|
|
5407
5412
|
return this.threads;
|
|
@@ -5515,7 +5520,7 @@ var CommentPanel = class {
|
|
|
5515
5520
|
reply() {
|
|
5516
5521
|
if (this.mode.kind !== "view")
|
|
5517
5522
|
return;
|
|
5518
|
-
const ta = this.overlay.querySelector(`[data-thread="${cssEscape(this.mode.id)}"] .
|
|
5523
|
+
const ta = this.overlay.querySelector(`[data-thread="${cssEscape(this.mode.id)}"] .markloom-comment-reply textarea`);
|
|
5519
5524
|
const body = (ta?.value ?? this.mode.reply).trim();
|
|
5520
5525
|
if (!body)
|
|
5521
5526
|
return;
|
|
@@ -5557,7 +5562,7 @@ var CommentPanel = class {
|
|
|
5557
5562
|
}
|
|
5558
5563
|
/** 卡片 top(相对 rail-body)。正文与栏共滚 → viewport 差即内容坐标。 */
|
|
5559
5564
|
cardTops(ids, composeTop) {
|
|
5560
|
-
const body = this.overlay.querySelector(".
|
|
5565
|
+
const body = this.overlay.querySelector(".markloom-comment-rail-body");
|
|
5561
5566
|
const bodyTop = body?.getBoundingClientRect().top ?? 0;
|
|
5562
5567
|
const raw = ids.map((id) => {
|
|
5563
5568
|
const el = this.host.root.querySelector(`[data-comment-id="${cssEscape(id)}"]`);
|
|
@@ -5577,11 +5582,11 @@ var CommentPanel = class {
|
|
|
5577
5582
|
return out;
|
|
5578
5583
|
}
|
|
5579
5584
|
reflowAfterPaint() {
|
|
5580
|
-
const rail = this.overlay.querySelector(".
|
|
5581
|
-
const body = this.overlay.querySelector(".
|
|
5585
|
+
const rail = this.overlay.querySelector(".markloom-comment-rail");
|
|
5586
|
+
const body = this.overlay.querySelector(".markloom-comment-rail-body");
|
|
5582
5587
|
if (!body)
|
|
5583
5588
|
return;
|
|
5584
|
-
const cards = [...body.querySelectorAll(".
|
|
5589
|
+
const cards = [...body.querySelectorAll(".markloom-comment-card")];
|
|
5585
5590
|
cards.sort((a, b) => (parseFloat(a.style.top) || 0) - (parseFloat(b.style.top) || 0));
|
|
5586
5591
|
let floor2 = 0;
|
|
5587
5592
|
let maxBottom = 0;
|
|
@@ -5596,7 +5601,7 @@ var CommentPanel = class {
|
|
|
5596
5601
|
body.style.minHeight = `${Math.max(maxBottom + RAIL_PAD, 0)}px`;
|
|
5597
5602
|
if (rail) {
|
|
5598
5603
|
const sp = this.scrollRoot;
|
|
5599
|
-
const hd = rail.querySelector(".
|
|
5604
|
+
const hd = rail.querySelector(".markloom-comment-rail-hd");
|
|
5600
5605
|
const hdH = hd?.offsetHeight ?? 52;
|
|
5601
5606
|
const need = Math.max(sp.scrollHeight, sp.clientHeight, maxBottom + hdH + RAIL_PAD);
|
|
5602
5607
|
rail.style.minHeight = `${need}px`;
|
|
@@ -5604,7 +5609,7 @@ var CommentPanel = class {
|
|
|
5604
5609
|
}
|
|
5605
5610
|
paint() {
|
|
5606
5611
|
const open = this.mode.kind !== "closed";
|
|
5607
|
-
this.scrollRoot.classList.toggle("
|
|
5612
|
+
this.scrollRoot.classList.toggle("markloom-comment-rail-open", open);
|
|
5608
5613
|
if (!open) {
|
|
5609
5614
|
render6(null, this.overlay);
|
|
5610
5615
|
return;
|
|
@@ -5621,20 +5626,20 @@ var CommentPanel = class {
|
|
|
5621
5626
|
const author = this.host.author();
|
|
5622
5627
|
render6(
|
|
5623
5628
|
h8("aside", {
|
|
5624
|
-
class: "
|
|
5629
|
+
class: "markloom-comment-rail",
|
|
5625
5630
|
"data-comment-rail": "",
|
|
5626
5631
|
"aria-label": "\u8BC4\u8BBA"
|
|
5627
5632
|
}, [
|
|
5628
|
-
h8("div", { class: "
|
|
5633
|
+
h8("div", { class: "markloom-comment-rail-hd", key: "hd" }, [
|
|
5629
5634
|
h8(
|
|
5630
5635
|
"div",
|
|
5631
|
-
{ class: "
|
|
5636
|
+
{ class: "markloom-comment-rail-title", key: "t" },
|
|
5632
5637
|
`\u8BC4\u8BBA (${openCount})`
|
|
5633
5638
|
),
|
|
5634
|
-
h8("div", { class: "
|
|
5639
|
+
h8("div", { class: "markloom-comment-rail-acts", key: "a" }, [
|
|
5635
5640
|
h8("button", {
|
|
5636
5641
|
type: "button",
|
|
5637
|
-
class: "
|
|
5642
|
+
class: "markloom-comment-icon" + (this.showResolved ? " markloom-comment-icon-on" : ""),
|
|
5638
5643
|
title: this.showResolved ? "\u53EA\u770B\u672A\u89E3\u51B3" : "\u663E\u793A\u5DF2\u89E3\u51B3",
|
|
5639
5644
|
"data-act": "filter",
|
|
5640
5645
|
onMouseDown: (e) => {
|
|
@@ -5645,7 +5650,7 @@ var CommentPanel = class {
|
|
|
5645
5650
|
}, this.showResolved ? "\u5168" : "\u5F00"),
|
|
5646
5651
|
h8("button", {
|
|
5647
5652
|
type: "button",
|
|
5648
|
-
class: "
|
|
5653
|
+
class: "markloom-comment-icon",
|
|
5649
5654
|
title: "\u6536\u8D77",
|
|
5650
5655
|
"data-act": "close",
|
|
5651
5656
|
onMouseDown: (e) => {
|
|
@@ -5655,21 +5660,21 @@ var CommentPanel = class {
|
|
|
5655
5660
|
}, "\xBB")
|
|
5656
5661
|
])
|
|
5657
5662
|
]),
|
|
5658
|
-
h8("div", { class: "
|
|
5663
|
+
h8("div", { class: "markloom-comment-rail-body", key: "body" }, [
|
|
5659
5664
|
composing && this.mode.kind === "compose" && h8("div", {
|
|
5660
|
-
class: "
|
|
5665
|
+
class: "markloom-comment-card markloom-comment-card-compose",
|
|
5661
5666
|
key: "compose",
|
|
5662
5667
|
"data-comment-ui": "compose",
|
|
5663
5668
|
style: { top: `${tops.get("__compose__") ?? 0}px` }
|
|
5664
5669
|
}, [
|
|
5665
|
-
h8("div", { class: "
|
|
5666
|
-
this.mode.quote ? h8("div", { class: "
|
|
5667
|
-
h8("div", { class: "
|
|
5670
|
+
h8("div", { class: "markloom-comment-accent", key: "ac" }),
|
|
5671
|
+
this.mode.quote ? h8("div", { class: "markloom-comment-quote", key: "q" }, this.mode.quote) : null,
|
|
5672
|
+
h8("div", { class: "markloom-comment-msg", key: "who" }, [
|
|
5668
5673
|
avatar(author),
|
|
5669
|
-
h8("span", { class: "
|
|
5674
|
+
h8("span", { class: "markloom-comment-author" }, author.name)
|
|
5670
5675
|
]),
|
|
5671
5676
|
h8("textarea", {
|
|
5672
|
-
class: "
|
|
5677
|
+
class: "markloom-comment-input",
|
|
5673
5678
|
placeholder: "\u6DFB\u52A0\u8BC4\u8BBA\u2026",
|
|
5674
5679
|
defaultValue: this.mode.body,
|
|
5675
5680
|
autofocus: true,
|
|
@@ -5681,10 +5686,10 @@ var CommentPanel = class {
|
|
|
5681
5686
|
}
|
|
5682
5687
|
}
|
|
5683
5688
|
}),
|
|
5684
|
-
h8("div", { class: "
|
|
5689
|
+
h8("div", { class: "markloom-comment-card-ft", key: "ft" }, [
|
|
5685
5690
|
h8("button", {
|
|
5686
5691
|
type: "button",
|
|
5687
|
-
class: "
|
|
5692
|
+
class: "markloom-comment-btn-ghost",
|
|
5688
5693
|
onMouseDown: (e) => {
|
|
5689
5694
|
e.preventDefault();
|
|
5690
5695
|
if (this.threads.length)
|
|
@@ -5695,7 +5700,7 @@ var CommentPanel = class {
|
|
|
5695
5700
|
}, "\u53D6\u6D88"),
|
|
5696
5701
|
h8("button", {
|
|
5697
5702
|
type: "button",
|
|
5698
|
-
class: "
|
|
5703
|
+
class: "markloom-comment-btn",
|
|
5699
5704
|
onMouseDown: (e) => {
|
|
5700
5705
|
e.preventDefault();
|
|
5701
5706
|
this.submitCompose();
|
|
@@ -5705,7 +5710,7 @@ var CommentPanel = class {
|
|
|
5705
5710
|
]),
|
|
5706
5711
|
...threads.map((t) => this.threadCard(t, t.id === viewId, ro, tops.get(t.id) ?? 0)),
|
|
5707
5712
|
!composing && !threads.length && h8("div", {
|
|
5708
|
-
class: "
|
|
5713
|
+
class: "markloom-comment-empty",
|
|
5709
5714
|
key: "empty",
|
|
5710
5715
|
style: { top: "24px" }
|
|
5711
5716
|
}, this.showResolved ? "\u6682\u65E0\u8BC4\u8BBA" : "\u6682\u65E0\u672A\u89E3\u51B3\u8BC4\u8BBA")
|
|
@@ -5726,7 +5731,7 @@ var CommentPanel = class {
|
|
|
5726
5731
|
const head = thread.messages[0];
|
|
5727
5732
|
const n = thread.messages.length;
|
|
5728
5733
|
return h8("div", {
|
|
5729
|
-
class: "
|
|
5734
|
+
class: "markloom-comment-card" + (thread.resolved ? " markloom-comment-card-resolved" : "") + (expanded ? " markloom-comment-card-active" : ""),
|
|
5730
5735
|
key: thread.id,
|
|
5731
5736
|
"data-comment-ui": expanded ? "view" : "item",
|
|
5732
5737
|
"data-thread": thread.id,
|
|
@@ -5738,13 +5743,13 @@ var CommentPanel = class {
|
|
|
5738
5743
|
this.openThread(thread.id);
|
|
5739
5744
|
}
|
|
5740
5745
|
}, [
|
|
5741
|
-
h8("div", { class: "
|
|
5742
|
-
h8("div", { class: "
|
|
5743
|
-
quote ? h8("div", { class: "
|
|
5744
|
-
h8("div", { class: "
|
|
5746
|
+
h8("div", { class: "markloom-comment-accent", key: "ac" }),
|
|
5747
|
+
h8("div", { class: "markloom-comment-card-hd", key: "hd" }, [
|
|
5748
|
+
quote ? h8("div", { class: "markloom-comment-quote", key: "q" }, quote) : h8("span", { key: "t" }, thread.resolved ? "\u5DF2\u89E3\u51B3" : "\u8BC4\u8BBA"),
|
|
5749
|
+
h8("div", { class: "markloom-comment-card-acts", key: "a" }, [
|
|
5745
5750
|
!ro && h8("button", {
|
|
5746
5751
|
type: "button",
|
|
5747
|
-
class: "
|
|
5752
|
+
class: "markloom-comment-icon",
|
|
5748
5753
|
title: thread.resolved ? "\u91CD\u65B0\u6253\u5F00" : "\u89E3\u51B3",
|
|
5749
5754
|
"data-act": "resolve",
|
|
5750
5755
|
onMouseDown: (e) => {
|
|
@@ -5755,7 +5760,7 @@ var CommentPanel = class {
|
|
|
5755
5760
|
}, thread.resolved ? "\u21BA" : "\u2713"),
|
|
5756
5761
|
!ro && h8("button", {
|
|
5757
5762
|
type: "button",
|
|
5758
|
-
class: "
|
|
5763
|
+
class: "markloom-comment-icon",
|
|
5759
5764
|
title: "\u5220\u9664",
|
|
5760
5765
|
"data-act": "delete",
|
|
5761
5766
|
onMouseDown: (e) => {
|
|
@@ -5767,18 +5772,18 @@ var CommentPanel = class {
|
|
|
5767
5772
|
])
|
|
5768
5773
|
]),
|
|
5769
5774
|
// 折叠:只露主评
|
|
5770
|
-
!expanded && head && h8("div", { class: "
|
|
5775
|
+
!expanded && head && h8("div", { class: "markloom-comment-preview", key: "pv" }, [
|
|
5771
5776
|
msgRow(head),
|
|
5772
|
-
n > 1 && h8("div", { class: "
|
|
5777
|
+
n > 1 && h8("div", { class: "markloom-comment-more", key: "more" }, `${n - 1} \u6761\u56DE\u590D`)
|
|
5773
5778
|
]),
|
|
5774
5779
|
expanded && h8(
|
|
5775
5780
|
"div",
|
|
5776
|
-
{ class: "
|
|
5781
|
+
{ class: "markloom-comment-msgs", key: "msgs" },
|
|
5777
5782
|
thread.messages.map((m) => msgRow(m))
|
|
5778
5783
|
),
|
|
5779
|
-
expanded && !ro && !thread.resolved && h8("div", { class: "
|
|
5784
|
+
expanded && !ro && !thread.resolved && h8("div", { class: "markloom-comment-reply", key: "rep" }, [
|
|
5780
5785
|
h8("textarea", {
|
|
5781
|
-
class: "
|
|
5786
|
+
class: "markloom-comment-input markloom-comment-input-sm",
|
|
5782
5787
|
placeholder: "\u56DE\u590D\u2026",
|
|
5783
5788
|
defaultValue: this.mode.kind === "view" && this.mode.id === thread.id ? this.mode.reply : "",
|
|
5784
5789
|
rows: 2,
|
|
@@ -5789,10 +5794,10 @@ var CommentPanel = class {
|
|
|
5789
5794
|
}
|
|
5790
5795
|
}
|
|
5791
5796
|
}),
|
|
5792
|
-
h8("div", { class: "
|
|
5797
|
+
h8("div", { class: "markloom-comment-card-ft" }, [
|
|
5793
5798
|
h8("button", {
|
|
5794
5799
|
type: "button",
|
|
5795
|
-
class: "
|
|
5800
|
+
class: "markloom-comment-btn",
|
|
5796
5801
|
"data-act": "reply",
|
|
5797
5802
|
onMouseDown: (e) => {
|
|
5798
5803
|
e.preventDefault();
|
|
@@ -5807,18 +5812,18 @@ var CommentPanel = class {
|
|
|
5807
5812
|
function avatar(author) {
|
|
5808
5813
|
const initial = (author.name || "?").slice(0, 1);
|
|
5809
5814
|
if (author.avatar)
|
|
5810
|
-
return h8("img", { class: "
|
|
5811
|
-
return h8("div", { class: "
|
|
5815
|
+
return h8("img", { class: "markloom-comment-avatar", src: author.avatar, alt: "" });
|
|
5816
|
+
return h8("div", { class: "markloom-comment-avatar markloom-comment-avatar-fallback" }, initial);
|
|
5812
5817
|
}
|
|
5813
5818
|
function msgRow(m) {
|
|
5814
|
-
return h8("div", { class: "
|
|
5819
|
+
return h8("div", { class: "markloom-comment-msg", key: m.id }, [
|
|
5815
5820
|
avatar(m.author),
|
|
5816
|
-
h8("div", { class: "
|
|
5817
|
-
h8("div", { class: "
|
|
5818
|
-
h8("span", { class: "
|
|
5819
|
-
h8("span", { class: "
|
|
5821
|
+
h8("div", { class: "markloom-comment-msg-body" }, [
|
|
5822
|
+
h8("div", { class: "markloom-comment-msg-meta" }, [
|
|
5823
|
+
h8("span", { class: "markloom-comment-author" }, m.author.name),
|
|
5824
|
+
h8("span", { class: "markloom-comment-time" }, fmtTime(m.createdAt))
|
|
5820
5825
|
]),
|
|
5821
|
-
h8("div", { class: "
|
|
5826
|
+
h8("div", { class: "markloom-comment-text" }, m.body)
|
|
5822
5827
|
])
|
|
5823
5828
|
]);
|
|
5824
5829
|
}
|
|
@@ -5867,9 +5872,9 @@ var TocPanel = class {
|
|
|
5867
5872
|
constructor(host) {
|
|
5868
5873
|
this.host = host;
|
|
5869
5874
|
this.rail = document.createElement("div");
|
|
5870
|
-
this.rail.className = "
|
|
5875
|
+
this.rail.className = "markloom-toc-host";
|
|
5871
5876
|
document.body.appendChild(this.rail);
|
|
5872
|
-
host.root.addEventListener("
|
|
5877
|
+
host.root.addEventListener("markloom-redraw", this.onRedraw);
|
|
5873
5878
|
this.scrollRoot = findScrollParent2(host.root) ?? window;
|
|
5874
5879
|
this.scrollRoot.addEventListener("scroll", this.onScroll, { passive: true, capture: true });
|
|
5875
5880
|
window.addEventListener("resize", this.onScroll);
|
|
@@ -5877,7 +5882,7 @@ var TocPanel = class {
|
|
|
5877
5882
|
this.refresh();
|
|
5878
5883
|
}
|
|
5879
5884
|
destroy() {
|
|
5880
|
-
this.host.root.removeEventListener("
|
|
5885
|
+
this.host.root.removeEventListener("markloom-redraw", this.onRedraw);
|
|
5881
5886
|
this.scrollRoot.removeEventListener("scroll", this.onScroll, { capture: true });
|
|
5882
5887
|
window.removeEventListener("resize", this.onScroll);
|
|
5883
5888
|
this.setPadOpen(false);
|
|
@@ -5892,9 +5897,9 @@ var TocPanel = class {
|
|
|
5892
5897
|
// 有滚动父 → 给滚动父加 padding(正文区);否则退回 html(lab 全页)
|
|
5893
5898
|
setPadOpen(open) {
|
|
5894
5899
|
const pad2 = this.scrollRoot instanceof HTMLElement ? this.scrollRoot : document.documentElement;
|
|
5895
|
-
pad2.classList.toggle("
|
|
5900
|
+
pad2.classList.toggle("markloom-toc-open", open);
|
|
5896
5901
|
if (pad2 !== document.documentElement)
|
|
5897
|
-
document.documentElement.classList.remove("
|
|
5902
|
+
document.documentElement.classList.remove("markloom-toc-open");
|
|
5898
5903
|
}
|
|
5899
5904
|
onRedraw = () => this.refresh();
|
|
5900
5905
|
refresh() {
|
|
@@ -5938,7 +5943,7 @@ var TocPanel = class {
|
|
|
5938
5943
|
if (byId)
|
|
5939
5944
|
return byId;
|
|
5940
5945
|
}
|
|
5941
|
-
const docEl = this.host.root.querySelector(".
|
|
5946
|
+
const docEl = this.host.root.querySelector(".markloom-doc") ?? this.host.root;
|
|
5942
5947
|
const kids = [...docEl.children].filter((c) => c instanceof HTMLElement && c.dataset.blockId !== void 0);
|
|
5943
5948
|
const idx = e.path[0];
|
|
5944
5949
|
return kids[idx] ?? null;
|
|
@@ -5964,14 +5969,14 @@ var TocPanel = class {
|
|
|
5964
5969
|
minLv = 1;
|
|
5965
5970
|
render7(
|
|
5966
5971
|
h9("aside", {
|
|
5967
|
-
class: "
|
|
5972
|
+
class: "markloom-toc-rail",
|
|
5968
5973
|
"data-toc-rail": "",
|
|
5969
5974
|
"aria-label": "\u76EE\u5F55"
|
|
5970
5975
|
}, [
|
|
5971
|
-
h9("div", { class: "
|
|
5976
|
+
h9("div", { class: "markloom-toc-hd", key: "hd" }, "\u76EE\u5F55"),
|
|
5972
5977
|
h9(
|
|
5973
5978
|
"nav",
|
|
5974
|
-
{ class: "
|
|
5979
|
+
{ class: "markloom-toc-nav", key: "nav" },
|
|
5975
5980
|
items.length ? items.map((e, i) => {
|
|
5976
5981
|
const key = e.id ?? pathKey(e.path);
|
|
5977
5982
|
const active2 = this.activeId === key;
|
|
@@ -5979,7 +5984,7 @@ var TocPanel = class {
|
|
|
5979
5984
|
return h9("button", {
|
|
5980
5985
|
key: `${key}-${i}`,
|
|
5981
5986
|
type: "button",
|
|
5982
|
-
class: "
|
|
5987
|
+
class: "markloom-toc-item" + (active2 ? " markloom-toc-item-active" : ""),
|
|
5983
5988
|
"data-level": String(e.level),
|
|
5984
5989
|
"data-active": active2 ? "" : void 0,
|
|
5985
5990
|
"data-toc-id": e.id ?? void 0,
|
|
@@ -5990,7 +5995,7 @@ var TocPanel = class {
|
|
|
5990
5995
|
this.jump(e);
|
|
5991
5996
|
}
|
|
5992
5997
|
}, e.text || "\u672A\u547D\u540D\u6807\u9898");
|
|
5993
|
-
}) : h9("div", { class: "
|
|
5998
|
+
}) : h9("div", { class: "markloom-toc-empty", key: "empty" }, "\u6DFB\u52A0\u6807\u9898\u540E\u663E\u793A\u76EE\u5F55")
|
|
5994
5999
|
)
|
|
5995
6000
|
]),
|
|
5996
6001
|
this.rail
|
|
@@ -6025,7 +6030,7 @@ var MentionPopovers = class {
|
|
|
6025
6030
|
constructor(host) {
|
|
6026
6031
|
this.host = host;
|
|
6027
6032
|
this.overlay = document.createElement("div");
|
|
6028
|
-
this.overlay.className = "
|
|
6033
|
+
this.overlay.className = "markloom-mention-pop-host";
|
|
6029
6034
|
document.body.appendChild(this.overlay);
|
|
6030
6035
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
6031
6036
|
document.addEventListener("keydown", this.onKey, true);
|
|
@@ -6105,33 +6110,33 @@ var MentionPopovers = class {
|
|
|
6105
6110
|
const initial = (p.name || "?").slice(0, 1);
|
|
6106
6111
|
render8(
|
|
6107
6112
|
h10("div", {
|
|
6108
|
-
class: "
|
|
6113
|
+
class: "markloom-profile-card",
|
|
6109
6114
|
style: { position: "fixed", width: "280px", zIndex: "100" },
|
|
6110
6115
|
"data-mention-pop": "person",
|
|
6111
6116
|
onMouseDown: (e) => e.stopPropagation()
|
|
6112
6117
|
}, [
|
|
6113
|
-
h10("div", { class: "
|
|
6114
|
-
p.avatar ? h10("img", { class: "
|
|
6115
|
-
h10("div", { class: "
|
|
6116
|
-
h10("div", { class: "
|
|
6117
|
-
p.title && h10("div", { class: "
|
|
6118
|
-
p.department && h10("div", { class: "
|
|
6118
|
+
h10("div", { class: "markloom-profile-head", key: "h" }, [
|
|
6119
|
+
p.avatar ? h10("img", { class: "markloom-profile-avatar", src: p.avatar, alt: "" }) : h10("div", { class: "markloom-profile-avatar markloom-profile-avatar-fallback" }, initial),
|
|
6120
|
+
h10("div", { class: "markloom-profile-id" }, [
|
|
6121
|
+
h10("div", { class: "markloom-profile-name" }, p.name),
|
|
6122
|
+
p.title && h10("div", { class: "markloom-profile-title" }, p.title),
|
|
6123
|
+
p.department && h10("div", { class: "markloom-profile-dept" }, p.department)
|
|
6119
6124
|
])
|
|
6120
6125
|
]),
|
|
6121
|
-
(p.email || p.status) && h10("div", { class: "
|
|
6122
|
-
p.status && h10("div", { class: "
|
|
6123
|
-
h10("span", { class: "
|
|
6124
|
-
h10("span", { class: "
|
|
6126
|
+
(p.email || p.status) && h10("div", { class: "markloom-profile-meta", key: "m" }, [
|
|
6127
|
+
p.status && h10("div", { class: "markloom-profile-row" }, [
|
|
6128
|
+
h10("span", { class: "markloom-profile-k" }, "\u72B6\u6001"),
|
|
6129
|
+
h10("span", { class: "markloom-profile-v" }, p.status)
|
|
6125
6130
|
]),
|
|
6126
|
-
p.email && h10("div", { class: "
|
|
6127
|
-
h10("span", { class: "
|
|
6128
|
-
h10("a", { class: "
|
|
6131
|
+
p.email && h10("div", { class: "markloom-profile-row" }, [
|
|
6132
|
+
h10("span", { class: "markloom-profile-k" }, "\u90AE\u7BB1"),
|
|
6133
|
+
h10("a", { class: "markloom-profile-v markloom-profile-link", href: `mailto:${p.email}` }, p.email)
|
|
6129
6134
|
])
|
|
6130
6135
|
])
|
|
6131
6136
|
]),
|
|
6132
6137
|
this.overlay
|
|
6133
6138
|
);
|
|
6134
|
-
this.placePop(mode.rect, ".
|
|
6139
|
+
this.placePop(mode.rect, ".markloom-profile-card");
|
|
6135
6140
|
}
|
|
6136
6141
|
paintDateTime(mode) {
|
|
6137
6142
|
const draft = mode.draft;
|
|
@@ -6157,11 +6162,11 @@ var MentionPopovers = class {
|
|
|
6157
6162
|
this.host.onDateChange?.(mode.path, toIso(draft));
|
|
6158
6163
|
this.close();
|
|
6159
6164
|
};
|
|
6160
|
-
const spin = (key, max2, label) => h10("label", { class: "
|
|
6161
|
-
h10("span", { class: "
|
|
6165
|
+
const spin = (key, max2, label) => h10("label", { class: "markloom-time-field", key }, [
|
|
6166
|
+
h10("span", { class: "markloom-time-field-lab" }, label),
|
|
6162
6167
|
h10("input", {
|
|
6163
6168
|
type: "number",
|
|
6164
|
-
class: "
|
|
6169
|
+
class: "markloom-time-input",
|
|
6165
6170
|
min: 0,
|
|
6166
6171
|
max: max2,
|
|
6167
6172
|
value: draft[key],
|
|
@@ -6177,15 +6182,15 @@ var MentionPopovers = class {
|
|
|
6177
6182
|
]);
|
|
6178
6183
|
render8(
|
|
6179
6184
|
h10("div", {
|
|
6180
|
-
class: "
|
|
6185
|
+
class: "markloom-date-picker markloom-datetime-picker",
|
|
6181
6186
|
style: { position: "fixed", width: "300px", zIndex: "100" },
|
|
6182
6187
|
"data-mention-pop": "date",
|
|
6183
6188
|
onMouseDown: (e) => e.stopPropagation()
|
|
6184
6189
|
}, [
|
|
6185
|
-
h10("div", { class: "
|
|
6190
|
+
h10("div", { class: "markloom-date-hd", key: "hd" }, [
|
|
6186
6191
|
h10("button", {
|
|
6187
6192
|
type: "button",
|
|
6188
|
-
class: "
|
|
6193
|
+
class: "markloom-date-nav",
|
|
6189
6194
|
"data-act": "prev",
|
|
6190
6195
|
onMouseDown: (e) => {
|
|
6191
6196
|
e.preventDefault();
|
|
@@ -6197,10 +6202,10 @@ var MentionPopovers = class {
|
|
|
6197
6202
|
setDraft({ viewY: ny, viewM: nm });
|
|
6198
6203
|
}
|
|
6199
6204
|
}, "\u2039"),
|
|
6200
|
-
h10("span", { class: "
|
|
6205
|
+
h10("span", { class: "markloom-date-label" }, monthLabel),
|
|
6201
6206
|
h10("button", {
|
|
6202
6207
|
type: "button",
|
|
6203
|
-
class: "
|
|
6208
|
+
class: "markloom-date-nav",
|
|
6204
6209
|
"data-act": "next",
|
|
6205
6210
|
onMouseDown: (e) => {
|
|
6206
6211
|
e.preventDefault();
|
|
@@ -6215,16 +6220,16 @@ var MentionPopovers = class {
|
|
|
6215
6220
|
]),
|
|
6216
6221
|
h10(
|
|
6217
6222
|
"div",
|
|
6218
|
-
{ class: "
|
|
6223
|
+
{ class: "markloom-date-week", key: "w" },
|
|
6219
6224
|
week.map((d) => h10("span", { key: d }, d))
|
|
6220
6225
|
),
|
|
6221
6226
|
h10(
|
|
6222
6227
|
"div",
|
|
6223
|
-
{ class: "
|
|
6224
|
-
cells.map((c, i) => c.day == null ? h10("span", { key: `e${i}`, class: "
|
|
6228
|
+
{ class: "markloom-date-grid", key: "g" },
|
|
6229
|
+
cells.map((c, i) => c.day == null ? h10("span", { key: `e${i}`, class: "markloom-date-cell markloom-date-empty" }) : h10("button", {
|
|
6225
6230
|
key: `d${c.day}`,
|
|
6226
6231
|
type: "button",
|
|
6227
|
-
class: "
|
|
6232
|
+
class: "markloom-date-cell" + (draft.y === viewY && draft.m === viewM && draft.d === c.day ? " markloom-date-selected" : "") + (isToday(viewY, viewM, c.day) ? " markloom-date-today" : ""),
|
|
6228
6233
|
"data-day": String(c.day),
|
|
6229
6234
|
onMouseDown: (e) => {
|
|
6230
6235
|
e.preventDefault();
|
|
@@ -6233,18 +6238,18 @@ var MentionPopovers = class {
|
|
|
6233
6238
|
}, String(c.day)))
|
|
6234
6239
|
),
|
|
6235
6240
|
// 时:分:秒 一体
|
|
6236
|
-
h10("div", { class: "
|
|
6241
|
+
h10("div", { class: "markloom-time-row", key: "time" }, [
|
|
6237
6242
|
spin("h", 23, "\u65F6"),
|
|
6238
|
-
h10("span", { class: "
|
|
6243
|
+
h10("span", { class: "markloom-time-colon", key: "c1" }, ":"),
|
|
6239
6244
|
spin("min", 59, "\u5206"),
|
|
6240
|
-
h10("span", { class: "
|
|
6245
|
+
h10("span", { class: "markloom-time-colon", key: "c2" }, ":"),
|
|
6241
6246
|
spin("s", 59, "\u79D2")
|
|
6242
6247
|
]),
|
|
6243
|
-
h10("div", { class: "
|
|
6244
|
-
h10("div", { class: "
|
|
6248
|
+
h10("div", { class: "markloom-date-preview", key: "pv" }, preview),
|
|
6249
|
+
h10("div", { class: "markloom-date-ft", key: "ft" }, [
|
|
6245
6250
|
h10("button", {
|
|
6246
6251
|
type: "button",
|
|
6247
|
-
class: "
|
|
6252
|
+
class: "markloom-date-today-btn",
|
|
6248
6253
|
"data-act": "now",
|
|
6249
6254
|
onMouseDown: (e) => {
|
|
6250
6255
|
e.preventDefault();
|
|
@@ -6263,7 +6268,7 @@ var MentionPopovers = class {
|
|
|
6263
6268
|
}, "\u73B0\u5728"),
|
|
6264
6269
|
h10("button", {
|
|
6265
6270
|
type: "button",
|
|
6266
|
-
class: "
|
|
6271
|
+
class: "markloom-date-ok",
|
|
6267
6272
|
"data-act": "ok",
|
|
6268
6273
|
onMouseDown: (e) => {
|
|
6269
6274
|
e.preventDefault();
|
|
@@ -6274,7 +6279,7 @@ var MentionPopovers = class {
|
|
|
6274
6279
|
]),
|
|
6275
6280
|
this.overlay
|
|
6276
6281
|
);
|
|
6277
|
-
this.placePop(mode.rect, ".
|
|
6282
|
+
this.placePop(mode.rect, ".markloom-date-picker");
|
|
6278
6283
|
}
|
|
6279
6284
|
};
|
|
6280
6285
|
function pad(n) {
|
|
@@ -6357,7 +6362,7 @@ var ImageControls = class {
|
|
|
6357
6362
|
this.root = root;
|
|
6358
6363
|
this.host = host;
|
|
6359
6364
|
this.overlay = document.createElement("div");
|
|
6360
|
-
this.overlay.className = "
|
|
6365
|
+
this.overlay.className = "markloom-image-overlay";
|
|
6361
6366
|
document.body.appendChild(this.overlay);
|
|
6362
6367
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
6363
6368
|
document.addEventListener("keydown", this.onKeyDown);
|
|
@@ -6407,7 +6412,7 @@ var ImageControls = class {
|
|
|
6407
6412
|
};
|
|
6408
6413
|
onDocDown = (e) => {
|
|
6409
6414
|
const el = e.target instanceof HTMLElement ? e.target : null;
|
|
6410
|
-
if (el?.closest(".
|
|
6415
|
+
if (el?.closest(".markloom-image-overlay") || el?.closest(".markloom-lightbox"))
|
|
6411
6416
|
return;
|
|
6412
6417
|
const atom = el?.closest('[data-atom="image"], [data-atom="embed"]');
|
|
6413
6418
|
if (atom && this.root.contains(atom)) {
|
|
@@ -6500,14 +6505,14 @@ var ImageControls = class {
|
|
|
6500
6505
|
const ex = this.exclusiveId ? this.atomEl(this.exclusiveId) : null;
|
|
6501
6506
|
if (ex) {
|
|
6502
6507
|
const r = ex.getBoundingClientRect();
|
|
6503
|
-
kids.push(h11("div", { key: "box", class: "
|
|
6508
|
+
kids.push(h11("div", { key: "box", class: "markloom-ic-box", style: `left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px` }));
|
|
6504
6509
|
if (ex.getAttribute("data-atom") === "image") {
|
|
6505
6510
|
for (const corner of ["nw", "ne", "sw", "se"]) {
|
|
6506
6511
|
const x = corner === "nw" || corner === "sw" ? r.left : r.right;
|
|
6507
6512
|
const y = corner === "nw" || corner === "ne" ? r.top : r.bottom;
|
|
6508
6513
|
kids.push(h11("div", {
|
|
6509
6514
|
key: corner,
|
|
6510
|
-
class: `
|
|
6515
|
+
class: `markloom-ic-handle markloom-ic-${corner}`,
|
|
6511
6516
|
style: `left:${x}px;top:${y}px`,
|
|
6512
6517
|
onPointerDown: (ev) => this.startResize(ev, corner)
|
|
6513
6518
|
}));
|
|
@@ -6524,15 +6529,15 @@ var ImageControls = class {
|
|
|
6524
6529
|
const r = atom.getBoundingClientRect();
|
|
6525
6530
|
kids.push(h11("div", {
|
|
6526
6531
|
key: `r-${id}`,
|
|
6527
|
-
class: "
|
|
6532
|
+
class: "markloom-ic-box",
|
|
6528
6533
|
style: `left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px`
|
|
6529
6534
|
}));
|
|
6530
6535
|
}
|
|
6531
6536
|
if (this.lightbox)
|
|
6532
|
-
kids.push(h11("div", { key: "lb", class: "
|
|
6537
|
+
kids.push(h11("div", { key: "lb", class: "markloom-lightbox", onPointerDown: () => this.clearSelected() }, [
|
|
6533
6538
|
h11("img", { key: "lbimg", src: this.lightbox })
|
|
6534
6539
|
]));
|
|
6535
|
-
render9(kids.length ? h11("div", { class: "
|
|
6540
|
+
render9(kids.length ? h11("div", { class: "markloom-ic" }, kids) : null, this.overlay);
|
|
6536
6541
|
}
|
|
6537
6542
|
toolbar(r) {
|
|
6538
6543
|
const cur = this.blockNode()?.node.attrs?.align ?? "left";
|
|
@@ -6556,11 +6561,11 @@ var ImageControls = class {
|
|
|
6556
6561
|
} else this.patchAttrs({ align: a.value });
|
|
6557
6562
|
}
|
|
6558
6563
|
}, icon(a.ico, 14)));
|
|
6559
|
-
const row = [h11("div", { key: "row", class: "
|
|
6564
|
+
const row = [h11("div", { key: "row", class: "markloom-ic-tb-row" }, btns)];
|
|
6560
6565
|
if (this.editingCaption)
|
|
6561
6566
|
row.push(h11("input", {
|
|
6562
6567
|
"key": "capin",
|
|
6563
|
-
"class": "
|
|
6568
|
+
"class": "markloom-ic-tb-caption",
|
|
6564
6569
|
"type": "text",
|
|
6565
6570
|
"value": cap,
|
|
6566
6571
|
"placeholder": "\u56FE\u6CE8\u2026",
|
|
@@ -6576,7 +6581,7 @@ var ImageControls = class {
|
|
|
6576
6581
|
}
|
|
6577
6582
|
}
|
|
6578
6583
|
}));
|
|
6579
|
-
return h11("div", { key: "tb", class: "
|
|
6584
|
+
return h11("div", { key: "tb", class: "markloom-ic-tb", style: `left:${r.left}px;top:${r.top - 40}px` }, row);
|
|
6580
6585
|
}
|
|
6581
6586
|
startResize(down, corner) {
|
|
6582
6587
|
down.preventDefault();
|
|
@@ -6662,7 +6667,7 @@ var TableControls = class {
|
|
|
6662
6667
|
this.root = root;
|
|
6663
6668
|
this.host = host;
|
|
6664
6669
|
this.overlay = document.createElement("div");
|
|
6665
|
-
this.overlay.className = "
|
|
6670
|
+
this.overlay.className = "markloom-table-overlay";
|
|
6666
6671
|
document.body.appendChild(this.overlay);
|
|
6667
6672
|
document.addEventListener("selectionchange", this.onSelChange);
|
|
6668
6673
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
@@ -6691,7 +6696,7 @@ var TableControls = class {
|
|
|
6691
6696
|
}
|
|
6692
6697
|
// 按 model 块 id 选中对应表格(供 atomSelectGuard:光标逼近表 → 先选中而非直删)。选中成功返 true。
|
|
6693
6698
|
selectByBlockId(id) {
|
|
6694
|
-
const el = this.root.querySelector(`.
|
|
6699
|
+
const el = this.root.querySelector(`.markloom-table[data-atom="table"][data-block-id="${id}"]`);
|
|
6695
6700
|
if (!el)
|
|
6696
6701
|
return false;
|
|
6697
6702
|
this.selectWhole(el);
|
|
@@ -6719,7 +6724,7 @@ var TableControls = class {
|
|
|
6719
6724
|
this.selectedBlock = null;
|
|
6720
6725
|
this.paint();
|
|
6721
6726
|
}
|
|
6722
|
-
// 几何:量出 cols+1 条列边界 / rows+1 条行边界的视口坐标。span 稳健——DOM 里 .
|
|
6727
|
+
// 几何:量出 cols+1 条列边界 / rows+1 条行边界的视口坐标。span 稳健——DOM 里 .markloom-cell 按
|
|
6723
6728
|
// buildGrid 锚点序 emit(命脉:1 child = 1 td),第 i 个 cell 对应 anchors[i] 的锚点足迹。
|
|
6724
6729
|
// 每格 rect 的 left/top 填其足迹起列/起行的边界,right/bottom 填终列+1/终行+1 的边界。
|
|
6725
6730
|
// 无 span 时退化成原来的均匀网格。cells 数 !== 锚点数 → null(DOM 未就绪)。
|
|
@@ -6732,7 +6737,7 @@ var TableControls = class {
|
|
|
6732
6737
|
return null;
|
|
6733
6738
|
const grid = buildGrid(table);
|
|
6734
6739
|
const { rows, cols } = grid;
|
|
6735
|
-
const cells = Array.from(tableEl.querySelectorAll(".
|
|
6740
|
+
const cells = Array.from(tableEl.querySelectorAll(".markloom-cell"));
|
|
6736
6741
|
if (cells.length !== grid.anchors.length || cols === 0)
|
|
6737
6742
|
return null;
|
|
6738
6743
|
const rect = tableEl.getBoundingClientRect();
|
|
@@ -6797,14 +6802,14 @@ var TableControls = class {
|
|
|
6797
6802
|
this.paint();
|
|
6798
6803
|
}
|
|
6799
6804
|
};
|
|
6800
|
-
// 当前 caret/选区落在哪个表格内(锚点 DOM 往上找 .
|
|
6805
|
+
// 当前 caret/选区落在哪个表格内(锚点 DOM 往上找 .markloom-table,且在本编辑器根内)。
|
|
6801
6806
|
focusedTable() {
|
|
6802
6807
|
const sel = document.getSelection();
|
|
6803
6808
|
const node = sel?.anchorNode;
|
|
6804
6809
|
if (!node)
|
|
6805
6810
|
return null;
|
|
6806
6811
|
const el = node instanceof HTMLElement ? node : node.parentElement;
|
|
6807
|
-
const table = el?.closest(".
|
|
6812
|
+
const table = el?.closest(".markloom-table");
|
|
6808
6813
|
return table && this.root.contains(table) ? table : null;
|
|
6809
6814
|
}
|
|
6810
6815
|
onReflow = () => {
|
|
@@ -6851,11 +6856,11 @@ var TableControls = class {
|
|
|
6851
6856
|
// 点在 active 表格某格内 + 拖动 → 画矩形选区(拖过 >1 格时抑制默认光标选择,松手出合并菜单)。
|
|
6852
6857
|
onDocDown = (e) => {
|
|
6853
6858
|
const el = e.target instanceof HTMLElement ? e.target : null;
|
|
6854
|
-
if (el?.closest(".
|
|
6859
|
+
if (el?.closest(".markloom-table-overlay"))
|
|
6855
6860
|
return;
|
|
6856
6861
|
if (this.selectedBlock)
|
|
6857
6862
|
this.clearSelected();
|
|
6858
|
-
const cellEl = el?.closest(".
|
|
6863
|
+
const cellEl = el?.closest(".markloom-cell");
|
|
6859
6864
|
const inActive = cellEl && this.active && this.active.contains(cellEl);
|
|
6860
6865
|
if (inActive) {
|
|
6861
6866
|
if (this.sel && this.sel.kind !== "rect") {
|
|
@@ -6929,7 +6934,7 @@ var TableControls = class {
|
|
|
6929
6934
|
const selected = tableEl === this.selectedBlock;
|
|
6930
6935
|
return h12("div", {
|
|
6931
6936
|
key: "grip",
|
|
6932
|
-
class: `
|
|
6937
|
+
class: `markloom-tc-grip${selected ? " is-selected" : ""}`,
|
|
6933
6938
|
style: `left:${r.left - 22}px;top:${r.top - 22}px`,
|
|
6934
6939
|
title: "\u9009\u4E2D/\u79FB\u52A8\u8868\u683C",
|
|
6935
6940
|
onPointerDown: (e) => {
|
|
@@ -6975,7 +6980,7 @@ var TableControls = class {
|
|
|
6975
6980
|
document.addEventListener("pointermove", move);
|
|
6976
6981
|
document.addEventListener("pointerup", up);
|
|
6977
6982
|
}
|
|
6978
|
-
// 鼠标 y → 顶层块间缝下标(0..n)。遍历 .
|
|
6983
|
+
// 鼠标 y → 顶层块间缝下标(0..n)。遍历 .markloom-doc 结构子(elementChildren 穿透布局层),y 落某块上半 → 该块前缝,下半 → 后缝。
|
|
6979
6984
|
gapAtY(y) {
|
|
6980
6985
|
const blocks = elementChildren(rootEl(this.root));
|
|
6981
6986
|
for (let i = 0; i < blocks.length; i++) {
|
|
@@ -6985,7 +6990,7 @@ var TableControls = class {
|
|
|
6985
6990
|
}
|
|
6986
6991
|
return blocks.length;
|
|
6987
6992
|
}
|
|
6988
|
-
// 块拖拽落点线:第 gap 条缝的 Y(缝上块底 / 首缝取首块顶 / 末缝取末块底),横向铺满 .
|
|
6993
|
+
// 块拖拽落点线:第 gap 条缝的 Y(缝上块底 / 首缝取首块顶 / 末缝取末块底),横向铺满 .markloom-doc 宽。复用 .markloom-tc-drop-row。
|
|
6989
6994
|
blockDropLine() {
|
|
6990
6995
|
if (!this.blockDrag)
|
|
6991
6996
|
return null;
|
|
@@ -6994,14 +6999,14 @@ var TableControls = class {
|
|
|
6994
6999
|
const gap = this.blockDrag.gap;
|
|
6995
7000
|
const y = gap === 0 ? blocks[0]?.getBoundingClientRect().top ?? 0 : blocks[gap - 1]?.getBoundingClientRect().bottom ?? 0;
|
|
6996
7001
|
const box = docEl.getBoundingClientRect();
|
|
6997
|
-
return h12("div", { key: "drop", class: "
|
|
7002
|
+
return h12("div", { key: "drop", class: "markloom-tc-drop markloom-tc-drop-row", style: `top:${y}px;left:${box.left}px;width:${box.width}px` });
|
|
6998
7003
|
}
|
|
6999
7004
|
// 选中态写到 cell 的 data-selected(纯视图,主题给强高亮)。span 稳健:每格取其锚点足迹,
|
|
7000
7005
|
// 与 sel(行/列/全选/矩形)相交则选中。矩形按归一化区间判交(足迹与 rect 有重叠即选)。
|
|
7001
7006
|
applySelClasses() {
|
|
7002
7007
|
if (!this.active)
|
|
7003
7008
|
return;
|
|
7004
|
-
const cells = Array.from(this.active.querySelectorAll(".
|
|
7009
|
+
const cells = Array.from(this.active.querySelectorAll(".markloom-cell"));
|
|
7005
7010
|
const table = this.tableModel(this.active);
|
|
7006
7011
|
if (!table)
|
|
7007
7012
|
return;
|
|
@@ -7034,8 +7039,8 @@ var TableControls = class {
|
|
|
7034
7039
|
return;
|
|
7035
7040
|
}
|
|
7036
7041
|
const r = this.selectedBlock.getBoundingClientRect();
|
|
7037
|
-
render10(h12("div", { class: "
|
|
7038
|
-
h12("div", { key: "box", class: "
|
|
7042
|
+
render10(h12("div", { class: "markloom-tc" }, [
|
|
7043
|
+
h12("div", { key: "box", class: "markloom-ic-box", style: `left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px` }),
|
|
7039
7044
|
this.grip(this.selectedBlock),
|
|
7040
7045
|
this.blockDropLine()
|
|
7041
7046
|
]), this.overlay);
|
|
@@ -7051,11 +7056,11 @@ var TableControls = class {
|
|
|
7051
7056
|
render10(null, this.overlay);
|
|
7052
7057
|
return;
|
|
7053
7058
|
}
|
|
7054
|
-
const wrap = this.active.closest(".
|
|
7059
|
+
const wrap = this.active.closest(".markloom-table-scroll");
|
|
7055
7060
|
const clip = wrap ? wrap.getBoundingClientRect() : null;
|
|
7056
7061
|
const pad2 = Math.max(BAR, DOT_OUT + 12);
|
|
7057
7062
|
const clipStyle = clip ? `position:fixed;inset:0;clip-path:inset(${Math.max(0, clip.top - pad2)}px ${Math.max(0, window.innerWidth - clip.right)}px ${Math.max(0, window.innerHeight - clip.bottom)}px ${Math.max(0, clip.left - pad2)}px)` : void 0;
|
|
7058
|
-
render10(h12("div", { class: "
|
|
7063
|
+
render10(h12("div", { class: "markloom-tc", style: clipStyle }, [
|
|
7059
7064
|
...this.colHandles(g),
|
|
7060
7065
|
...this.rowHandles(g),
|
|
7061
7066
|
...this.insertDots(g),
|
|
@@ -7075,7 +7080,7 @@ var TableControls = class {
|
|
|
7075
7080
|
const edge = c === 0 ? " is-first" : c === g.cols - 1 ? " is-last" : "";
|
|
7076
7081
|
out.push(h12("div", {
|
|
7077
7082
|
key: `ch${c}`,
|
|
7078
|
-
class: `
|
|
7083
|
+
class: `markloom-tc-handle markloom-tc-col${selected ? " is-selected" : ""}${edge}`,
|
|
7079
7084
|
style: `left:${left}px;top:${g.rect.top - BAR}px;width:${w}px;height:${BAR}px`,
|
|
7080
7085
|
onPointerDown: (e) => this.startHandle(e, "col", c)
|
|
7081
7086
|
}));
|
|
@@ -7091,14 +7096,14 @@ var TableControls = class {
|
|
|
7091
7096
|
const edge = r === 0 ? " is-first" : r === g.rows - 1 ? " is-last" : "";
|
|
7092
7097
|
out.push(h12("div", {
|
|
7093
7098
|
key: `rh${r}`,
|
|
7094
|
-
class: `
|
|
7099
|
+
class: `markloom-tc-handle markloom-tc-row${selected ? " is-selected" : ""}${edge}`,
|
|
7095
7100
|
style: `top:${top}px;left:${g.rect.left - BAR}px;height:${ht}px;width:${BAR}px`,
|
|
7096
7101
|
onPointerDown: (e) => this.startHandle(e, "row", r)
|
|
7097
7102
|
}));
|
|
7098
7103
|
}
|
|
7099
7104
|
out.push(h12("div", {
|
|
7100
7105
|
key: "all",
|
|
7101
|
-
class: `
|
|
7106
|
+
class: `markloom-tc-handle markloom-tc-all${this.sel?.kind === "all" ? " is-selected" : ""}`,
|
|
7102
7107
|
style: `top:${g.rect.top - BAR}px;left:${g.rect.left - BAR}px;width:${BAR}px;height:${BAR}px`,
|
|
7103
7108
|
onPointerDown: (e) => this.selectAll(e)
|
|
7104
7109
|
}));
|
|
@@ -7115,9 +7120,9 @@ var TableControls = class {
|
|
|
7115
7120
|
this.paint();
|
|
7116
7121
|
}
|
|
7117
7122
|
// 列/行边界插入点(抄 note AddColumnButton 的三层结构):
|
|
7118
|
-
// 容器 .
|
|
7119
|
-
// 视觉点 .
|
|
7120
|
-
// 引导线 .
|
|
7123
|
+
// 容器 .markloom-tc-ins —— 24px 常驻命中区(HIT),悬在表格外、圆心对准边界;承 click + :hover(group)。
|
|
7124
|
+
// 视觉点 .markloom-tc-dot —— 纯展示(pointer-events:none),静止 scale(.15)≈3.6px 灰点,容器 hover 时放大成蓝 ⊕。
|
|
7125
|
+
// 引导线 .markloom-tc-guide —— 从表边贯穿表身,容器 hover 时点亮。
|
|
7121
7126
|
// 命脉:hover 检测在 24px 容器上,不在缩小的圆点上——否则接触面只有 3.6px,几乎点不中(之前的 bug)。
|
|
7122
7127
|
insertDots(g) {
|
|
7123
7128
|
const out = [];
|
|
@@ -7126,31 +7131,31 @@ var TableControls = class {
|
|
|
7126
7131
|
for (let c = 0; c <= g.cols; c++) {
|
|
7127
7132
|
out.push(h12("div", {
|
|
7128
7133
|
key: `ci${c}`,
|
|
7129
|
-
class: "
|
|
7134
|
+
class: "markloom-tc-ins markloom-tc-ins-col",
|
|
7130
7135
|
style: `left:${g.colX[c] - HIT / 2}px;top:${insY}px;width:${HIT}px;height:${HIT}px`,
|
|
7131
7136
|
title: "\u63D2\u5165\u5217",
|
|
7132
7137
|
onPointerDown: (e) => this.insertAt(e, g.tableEl, "col", c)
|
|
7133
7138
|
}, [
|
|
7134
7139
|
h12("div", {
|
|
7135
|
-
class: "
|
|
7140
|
+
class: "markloom-tc-guide markloom-tc-guide-col",
|
|
7136
7141
|
style: `left:${g.colX[c]}px;top:${g.rect.top}px;height:${g.rect.height}px`
|
|
7137
7142
|
}),
|
|
7138
|
-
h12("div", { class: "
|
|
7143
|
+
h12("div", { class: "markloom-tc-dot markloom-tc-dot-col" })
|
|
7139
7144
|
]));
|
|
7140
7145
|
}
|
|
7141
7146
|
for (let r = 0; r <= g.rows; r++) {
|
|
7142
7147
|
out.push(h12("div", {
|
|
7143
7148
|
key: `ri${r}`,
|
|
7144
|
-
class: "
|
|
7149
|
+
class: "markloom-tc-ins markloom-tc-ins-row",
|
|
7145
7150
|
style: `top:${g.rowY[r] - HIT / 2}px;left:${insX}px;width:${HIT}px;height:${HIT}px`,
|
|
7146
7151
|
title: "\u63D2\u5165\u884C",
|
|
7147
7152
|
onPointerDown: (e) => this.insertAt(e, g.tableEl, "row", r)
|
|
7148
7153
|
}, [
|
|
7149
7154
|
h12("div", {
|
|
7150
|
-
class: "
|
|
7155
|
+
class: "markloom-tc-guide markloom-tc-guide-row",
|
|
7151
7156
|
style: `top:${g.rowY[r]}px;left:${g.rect.left}px;width:${g.rect.width}px`
|
|
7152
7157
|
}),
|
|
7153
|
-
h12("div", { class: "
|
|
7158
|
+
h12("div", { class: "markloom-tc-dot markloom-tc-dot-row" })
|
|
7154
7159
|
]));
|
|
7155
7160
|
}
|
|
7156
7161
|
return out;
|
|
@@ -7167,7 +7172,7 @@ var TableControls = class {
|
|
|
7167
7172
|
for (let c = 0; c < g.cols; c++) {
|
|
7168
7173
|
out.push(h12("div", {
|
|
7169
7174
|
key: `rz${c}`,
|
|
7170
|
-
class: "
|
|
7175
|
+
class: "markloom-tc-resize",
|
|
7171
7176
|
style: `left:${g.colX[c + 1] - 3}px;top:${g.rect.top}px;height:${g.rect.height}px`,
|
|
7172
7177
|
onPointerDown: (e) => this.startResize(e, g, c)
|
|
7173
7178
|
}));
|
|
@@ -7179,10 +7184,10 @@ var TableControls = class {
|
|
|
7179
7184
|
return null;
|
|
7180
7185
|
if (this.drag.kind === "col") {
|
|
7181
7186
|
const x = g.colX[Math.min(this.drag.to, g.cols)];
|
|
7182
|
-
return h12("div", { key: "di", class: "
|
|
7187
|
+
return h12("div", { key: "di", class: "markloom-tc-drop markloom-tc-drop-col", style: `left:${x}px;top:${g.rect.top - BAR}px;height:${g.rect.height + BAR}px` });
|
|
7183
7188
|
}
|
|
7184
7189
|
const y = g.rowY[Math.min(this.drag.to, g.rows)];
|
|
7185
|
-
return h12("div", { key: "di", class: "
|
|
7190
|
+
return h12("div", { key: "di", class: "markloom-tc-drop markloom-tc-drop-row", style: `top:${y}px;left:${g.rect.left - BAR}px;width:${g.rect.width + BAR}px` });
|
|
7186
7191
|
}
|
|
7187
7192
|
// 柄菜单:增删行列/清空/合并拆分/样式/冻结。锚到选中柄或矩形左上附近。
|
|
7188
7193
|
menuEl(g) {
|
|
@@ -7193,7 +7198,7 @@ var TableControls = class {
|
|
|
7193
7198
|
const x = m.kind === "col" ? g.colX[m.index] : m.kind === "rect" ? g.colX[rect ? rect.c1 : 0] : g.rect.left - BAR;
|
|
7194
7199
|
const y = m.kind === "col" ? g.rect.top - BAR : m.kind === "rect" ? g.rowY[rect ? rect.r2 + 1 : 0] : g.rowY[m.index];
|
|
7195
7200
|
const labels = this.menuLabels(m);
|
|
7196
|
-
return h12("div", { key: "menu", class: "
|
|
7201
|
+
return h12("div", { key: "menu", class: "markloom-tc-menu", style: `left:${x}px;top:${y}px` }, labels.map((label, i) => h12("button", {
|
|
7197
7202
|
key: i,
|
|
7198
7203
|
type: "button",
|
|
7199
7204
|
onPointerDown: (e) => this.clickMenu(e, g, m, i)
|
|
@@ -7397,12 +7402,15 @@ var Editor = class {
|
|
|
7397
7402
|
decorations;
|
|
7398
7403
|
/** AI 一等公民(opts.ai):斜杠 / 格式栏 / 卡片全内置 */
|
|
7399
7404
|
aiCtl = null;
|
|
7405
|
+
/** 协作会话;applyingRemote 期间本地 steps 不上行 */
|
|
7406
|
+
collabCtl = null;
|
|
7407
|
+
applyingRemote = false;
|
|
7400
7408
|
constructor(root, doc, opts = {}) {
|
|
7401
7409
|
this.root = root;
|
|
7402
7410
|
const dev = typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
7403
7411
|
this.history = init(ensureGaps(doc), dev ? (d) => firstViolation(invariants(basicSchema, d)) : void 0);
|
|
7404
7412
|
this.opts = opts;
|
|
7405
|
-
const exts = opts.extensions ??
|
|
7413
|
+
const exts = opts.extensions ?? markloomKit();
|
|
7406
7414
|
this.resolved = resolve(exts);
|
|
7407
7415
|
this.invisible = opts.invisibleCharacters ?? exts.some((e) => e.name === "invisibleCharacters");
|
|
7408
7416
|
root.contentEditable = opts.editable === false ? "false" : "true";
|
|
@@ -7452,7 +7460,7 @@ var Editor = class {
|
|
|
7452
7460
|
}
|
|
7453
7461
|
if (opts.ai) {
|
|
7454
7462
|
const cfg = typeof opts.ai === "object" ? opts.ai : {};
|
|
7455
|
-
this.aiCtl = new
|
|
7463
|
+
this.aiCtl = new MarkloomAi(() => this, {
|
|
7456
7464
|
stream: createAiStream(cfg),
|
|
7457
7465
|
onError: cfg.onError ?? ((msg) => {
|
|
7458
7466
|
if (typeof window !== "undefined")
|
|
@@ -7461,6 +7469,19 @@ var Editor = class {
|
|
|
7461
7469
|
onBusy: cfg.onBusy
|
|
7462
7470
|
});
|
|
7463
7471
|
}
|
|
7472
|
+
if (opts.collab) {
|
|
7473
|
+
this.collabCtl = connectCollab(
|
|
7474
|
+
{ ...opts.collab, seed: opts.collab.seed ?? doc },
|
|
7475
|
+
{
|
|
7476
|
+
onDoc: (d) => this.replaceDoc(d),
|
|
7477
|
+
onRemote: (steps) => this.applyRemote(steps),
|
|
7478
|
+
onError: (msg) => {
|
|
7479
|
+
if (typeof console !== "undefined")
|
|
7480
|
+
console.warn("[markloom collab]", msg);
|
|
7481
|
+
}
|
|
7482
|
+
}
|
|
7483
|
+
);
|
|
7484
|
+
}
|
|
7464
7485
|
const host = {
|
|
7465
7486
|
root,
|
|
7466
7487
|
doc: () => this.history.doc,
|
|
@@ -7526,6 +7547,8 @@ var Editor = class {
|
|
|
7526
7547
|
this.commentPanel?.destroy();
|
|
7527
7548
|
this.tocPanel?.destroy();
|
|
7528
7549
|
this.aiCtl?.destroy();
|
|
7550
|
+
this.collabCtl?.close();
|
|
7551
|
+
this.collabCtl = null;
|
|
7529
7552
|
this.aiCtl = null;
|
|
7530
7553
|
for (const d of this.decorations)
|
|
7531
7554
|
d.destroy();
|
|
@@ -7535,6 +7558,10 @@ var Editor = class {
|
|
|
7535
7558
|
get ai() {
|
|
7536
7559
|
return this.aiCtl;
|
|
7537
7560
|
}
|
|
7561
|
+
/** 协作客户端(opts.collab 启用时) */
|
|
7562
|
+
get collab() {
|
|
7563
|
+
return this.collabCtl;
|
|
7564
|
+
}
|
|
7538
7565
|
openAi(mode) {
|
|
7539
7566
|
this.aiCtl?.openAtFocus(mode);
|
|
7540
7567
|
}
|
|
@@ -7583,10 +7610,10 @@ var Editor = class {
|
|
|
7583
7610
|
commentState: this.commentPanel?.renderState(),
|
|
7584
7611
|
atomSelect: this.imageControls.selectCtx()
|
|
7585
7612
|
}), this.root);
|
|
7586
|
-
stripStrayNodes(this.root.querySelector(".
|
|
7613
|
+
stripStrayNodes(this.root.querySelector(".markloom-doc"));
|
|
7587
7614
|
if (restore)
|
|
7588
7615
|
writeSelection(this.root, this.history.doc, restore);
|
|
7589
|
-
this.root.dispatchEvent(new Event("
|
|
7616
|
+
this.root.dispatchEvent(new Event("markloom-redraw", { bubbles: true }));
|
|
7590
7617
|
this.syncPlaceholder();
|
|
7591
7618
|
}
|
|
7592
7619
|
// 空块提示(不进 model):空 paragraph → opts.placeholder(slash 引导);
|
|
@@ -7650,6 +7677,8 @@ var Editor = class {
|
|
|
7650
7677
|
this.history = commit(this.history, batch);
|
|
7651
7678
|
this.draw(selectionAfter);
|
|
7652
7679
|
this.opts.onChange?.(this.history.doc);
|
|
7680
|
+
if (!this.applyingRemote)
|
|
7681
|
+
this.collabCtl?.push(batch);
|
|
7653
7682
|
}
|
|
7654
7683
|
// AI 流式 / 事务内续写:并入 past 最后一条,一次 undo 回退整笔事务。
|
|
7655
7684
|
dispatchStream(steps, selectionAfter) {
|
|
@@ -7660,24 +7689,54 @@ var Editor = class {
|
|
|
7660
7689
|
this.history = amend(this.history, batch);
|
|
7661
7690
|
this.draw(selectionAfter);
|
|
7662
7691
|
this.opts.onChange?.(this.history.doc);
|
|
7692
|
+
if (!this.applyingRemote)
|
|
7693
|
+
this.collabCtl?.push(batch);
|
|
7694
|
+
}
|
|
7695
|
+
/** 远端协作 op:写入 model 但不上行 */
|
|
7696
|
+
applyRemote(steps, selectionAfter) {
|
|
7697
|
+
if (steps.length === 0)
|
|
7698
|
+
return;
|
|
7699
|
+
this.applyingRemote = true;
|
|
7700
|
+
try {
|
|
7701
|
+
const after = applyAll(this.history.doc, steps);
|
|
7702
|
+
const batch = steps.concat(gapSteps(after));
|
|
7703
|
+
this.history = commit(this.history, batch);
|
|
7704
|
+
this.draw(selectionAfter);
|
|
7705
|
+
this.opts.onChange?.(this.history.doc);
|
|
7706
|
+
} finally {
|
|
7707
|
+
this.applyingRemote = false;
|
|
7708
|
+
}
|
|
7709
|
+
}
|
|
7710
|
+
/** 权威快照替换(welcome/resync);清空本地 undo 栈 */
|
|
7711
|
+
replaceDoc(doc) {
|
|
7712
|
+
const dev = typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
7713
|
+
this.history = init(ensureGaps(doc), dev ? (d) => firstViolation(invariants(basicSchema, d)) : void 0);
|
|
7714
|
+
this.draw();
|
|
7715
|
+
this.opts.onChange?.(this.history.doc);
|
|
7663
7716
|
}
|
|
7664
7717
|
/** 回退一笔 history(AI 事务 discard = undo 整笔) */
|
|
7665
7718
|
undo() {
|
|
7719
|
+
const last = this.history.past[this.history.past.length - 1];
|
|
7666
7720
|
const next = undo(this.history);
|
|
7667
7721
|
if (next === this.history)
|
|
7668
7722
|
return false;
|
|
7669
7723
|
this.history = next;
|
|
7670
7724
|
this.draw();
|
|
7671
7725
|
this.opts.onChange?.(this.history.doc);
|
|
7726
|
+
if (!this.applyingRemote && last)
|
|
7727
|
+
this.collabCtl?.push(last.inverse);
|
|
7672
7728
|
return true;
|
|
7673
7729
|
}
|
|
7674
7730
|
redo() {
|
|
7731
|
+
const fut = this.history.future[0];
|
|
7675
7732
|
const next = redo(this.history);
|
|
7676
7733
|
if (next === this.history)
|
|
7677
7734
|
return false;
|
|
7678
7735
|
this.history = next;
|
|
7679
7736
|
this.draw();
|
|
7680
7737
|
this.opts.onChange?.(this.history.doc);
|
|
7738
|
+
if (!this.applyingRemote && fut)
|
|
7739
|
+
this.collabCtl?.push(fut.steps);
|
|
7681
7740
|
return true;
|
|
7682
7741
|
}
|
|
7683
7742
|
/** 续写:当前块后插空段并流式灌入 */
|
|
@@ -8391,7 +8450,7 @@ var Editor = class {
|
|
|
8391
8450
|
return null;
|
|
8392
8451
|
return sel;
|
|
8393
8452
|
}
|
|
8394
|
-
// 复制/剪切/粘贴:选区 ⟷ markdown。md 是
|
|
8453
|
+
// 复制/剪切/粘贴:选区 ⟷ markdown。md 是 markloom 的唯一真值,剪贴板也走 md,跨编辑器/外部可读。
|
|
8395
8454
|
onCopy = (e) => {
|
|
8396
8455
|
const sel = readSelection(this.root, this.history.doc);
|
|
8397
8456
|
if (!sel)
|
|
@@ -8747,8 +8806,8 @@ var Editor = class {
|
|
|
8747
8806
|
onFocusIn = (e) => {
|
|
8748
8807
|
if (!(e.target instanceof HTMLElement))
|
|
8749
8808
|
return;
|
|
8750
|
-
const cell = e.target.closest(".
|
|
8751
|
-
const table = cell?.closest(".
|
|
8809
|
+
const cell = e.target.closest(".markloom-cell");
|
|
8810
|
+
const table = cell?.closest(".markloom-table");
|
|
8752
8811
|
if (!cell || !table)
|
|
8753
8812
|
return;
|
|
8754
8813
|
const id = table.getAttribute("data-block-id");
|
|
@@ -8756,7 +8815,7 @@ var Editor = class {
|
|
|
8756
8815
|
if (!model || isText(model) || model.type !== "table")
|
|
8757
8816
|
return;
|
|
8758
8817
|
const grid = buildGrid(model);
|
|
8759
|
-
const cells = Array.from(table.querySelectorAll(".
|
|
8818
|
+
const cells = Array.from(table.querySelectorAll(".markloom-cell"));
|
|
8760
8819
|
if (cells.length !== grid.anchors.length)
|
|
8761
8820
|
return;
|
|
8762
8821
|
const idx = cells.indexOf(cell);
|
|
@@ -8772,10 +8831,10 @@ var Editor = class {
|
|
|
8772
8831
|
onFocusOut = (e) => {
|
|
8773
8832
|
if (!(e.target instanceof HTMLElement))
|
|
8774
8833
|
return;
|
|
8775
|
-
const table = e.target.closest(".
|
|
8834
|
+
const table = e.target.closest(".markloom-cell")?.closest(".markloom-table");
|
|
8776
8835
|
if (!table)
|
|
8777
8836
|
return;
|
|
8778
|
-
table.querySelectorAll(".
|
|
8837
|
+
table.querySelectorAll(".markloom-cell").forEach((el) => {
|
|
8779
8838
|
el.removeAttribute("data-highlight-row");
|
|
8780
8839
|
el.removeAttribute("data-highlight-col");
|
|
8781
8840
|
});
|
|
@@ -9020,7 +9079,7 @@ export {
|
|
|
9020
9079
|
linkMark,
|
|
9021
9080
|
textStyleMark,
|
|
9022
9081
|
markExtensions,
|
|
9023
|
-
|
|
9082
|
+
markloomKit,
|
|
9024
9083
|
CommentPanel,
|
|
9025
9084
|
TocPanel,
|
|
9026
9085
|
MentionPopovers,
|