markloom 0.3.0 → 0.4.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/dist/ai/index.cjs +2 -2
- package/dist/ai/index.d.cts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +3 -3
- package/dist/ai/theme.css +63 -63
- package/dist/{chunk-7Q6AXLF2.cjs → chunk-LNSKDJMF.cjs} +3 -3
- package/dist/{chunk-GUPMZI6Q.js → chunk-QXJHFQLJ.js} +3 -3
- package/dist/{chunk-UCNEQGMY.js → chunk-VMUJM52A.js} +327 -327
- package/dist/{chunk-2X6AF7XH.cjs → chunk-VSTOMEU2.cjs} +363 -363
- package/dist/{controller-Dm4uLD3I.d.ts → controller-B_wG2Wh-.d.ts} +7 -7
- package/dist/{controller-cE9iEYp3.d.cts → controller-Cd1Dprrk.d.cts} +7 -7
- package/dist/react/index.cjs +7 -7
- package/dist/react/index.d.cts +4 -4
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +7 -7
- package/dist/view/index.cjs +6 -6
- package/dist/view/index.d.cts +4 -4
- package/dist/view/index.d.ts +4 -4
- package/dist/view/index.js +4 -4
- package/dist/view/theme.css +507 -507
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ var _chunkHA6XHJUDcjs = require('./chunk-HA6XHJUD.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkLNSKDJMFcjs = require('./chunk-LNSKDJMF.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -208,7 +208,7 @@ var ICONS = {
|
|
|
208
208
|
["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
209
|
]
|
|
210
210
|
};
|
|
211
|
-
function icon(name, size2 = 16, className = "
|
|
211
|
+
function icon(name, size2 = 16, className = "markloom-icon") {
|
|
212
212
|
const nodes = ICONS[name];
|
|
213
213
|
if (!nodes)
|
|
214
214
|
return null;
|
|
@@ -273,13 +273,13 @@ function paintInvisibles(text) {
|
|
|
273
273
|
const ch = text[i];
|
|
274
274
|
if (ch === " ") {
|
|
275
275
|
flush();
|
|
276
|
-
out.push(_preact.h.call(void 0, "span", { key: k++, class: "
|
|
276
|
+
out.push(_preact.h.call(void 0, "span", { key: k++, class: "markloom-inv-space" }, " "));
|
|
277
277
|
} else if (ch === "\xA0") {
|
|
278
278
|
flush();
|
|
279
|
-
out.push(_preact.h.call(void 0, "span", { key: k++, class: "
|
|
279
|
+
out.push(_preact.h.call(void 0, "span", { key: k++, class: "markloom-inv-nbsp" }, "\xA0"));
|
|
280
280
|
} else if (ch === " ") {
|
|
281
281
|
flush();
|
|
282
|
-
out.push(_preact.h.call(void 0, "span", { key: k++, class: "
|
|
282
|
+
out.push(_preact.h.call(void 0, "span", { key: k++, class: "markloom-inv-tab" }, " "));
|
|
283
283
|
} else {
|
|
284
284
|
buf += ch;
|
|
285
285
|
}
|
|
@@ -323,7 +323,7 @@ function renderImage(spec, key, atomSelect) {
|
|
|
323
323
|
"data-atom": "image",
|
|
324
324
|
"data-selected": selected ? "" : void 0,
|
|
325
325
|
"contentEditable": "false",
|
|
326
|
-
"class": "
|
|
326
|
+
"class": "markloom-figure",
|
|
327
327
|
"style": figAlign
|
|
328
328
|
}, [_preact.h.call(void 0, "img", { key: "img", ...innerImg }), _preact.h.call(void 0, "figcaption", { key: "cap", "data-caption": "" }, caption)]);
|
|
329
329
|
}
|
|
@@ -365,7 +365,7 @@ function markProps(mark, commentState) {
|
|
|
365
365
|
return {
|
|
366
366
|
"href": url,
|
|
367
367
|
"data-mark": "link",
|
|
368
|
-
"class": "
|
|
368
|
+
"class": "markloom-link",
|
|
369
369
|
"rel": "noopener noreferrer",
|
|
370
370
|
"title": url
|
|
371
371
|
};
|
|
@@ -377,9 +377,9 @@ function markProps(mark, commentState) {
|
|
|
377
377
|
if (mark.name === "comment") {
|
|
378
378
|
const id = String(_nullishCoalesce(_optionalChain([mark, 'access', _6 => _6.attrs, 'optionalAccess', _7 => _7.id]), () => ( "")));
|
|
379
379
|
const cls = [
|
|
380
|
-
"
|
|
381
|
-
_optionalChain([commentState, 'optionalAccess', _8 => _8.resolved, 'access', _9 => _9.has, 'call', _10 => _10(id)]) ? "
|
|
382
|
-
_optionalChain([commentState, 'optionalAccess', _11 => _11.activeId]) === id ? "
|
|
380
|
+
"markloom-comment",
|
|
381
|
+
_optionalChain([commentState, 'optionalAccess', _8 => _8.resolved, 'access', _9 => _9.has, 'call', _10 => _10(id)]) ? "markloom-comment-resolved" : "",
|
|
382
|
+
_optionalChain([commentState, 'optionalAccess', _11 => _11.activeId]) === id ? "markloom-comment-active" : ""
|
|
383
383
|
].filter(Boolean).join(" ");
|
|
384
384
|
return { "data-mark": "comment", "data-comment-id": id, class: cls };
|
|
385
385
|
}
|
|
@@ -390,7 +390,7 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
390
390
|
const br = _preact.h.call(void 0, "br", { "key": key, "data-leaf": key, "data-atom": "hard_break" });
|
|
391
391
|
if (!opts.invisibleCharacters)
|
|
392
392
|
return br;
|
|
393
|
-
return [br, _preact.h.call(void 0, "span", { "key": `${key}-inv`, "class": "
|
|
393
|
+
return [br, _preact.h.call(void 0, "span", { "key": `${key}-inv`, "class": "markloom-inv-break", "aria-hidden": "true", "contentEditable": "false" }, "\u21B5")];
|
|
394
394
|
}
|
|
395
395
|
if (spec.type === "math") {
|
|
396
396
|
const latex = String(_nullishCoalesce(_optionalChain([spec, 'access', _12 => _12.attrs, 'optionalAccess', _13 => _13.latex]), () => ( "")));
|
|
@@ -404,7 +404,7 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
404
404
|
"data-latex": latex,
|
|
405
405
|
"data-display": display ? "block" : "inline",
|
|
406
406
|
"contentEditable": "false",
|
|
407
|
-
"class": display ? "
|
|
407
|
+
"class": display ? "markloom-math markloom-math-block" : "markloom-math",
|
|
408
408
|
"title": "\u70B9\u51FB\u7F16\u8F91\u516C\u5F0F"
|
|
409
409
|
};
|
|
410
410
|
if (html)
|
|
@@ -421,8 +421,8 @@ function renderInlineAtom(spec, key, opts) {
|
|
|
421
421
|
"data-mention-id": String(_nullishCoalesce(a.id, () => ( ""))),
|
|
422
422
|
"data-kind": isDate ? "date" : void 0,
|
|
423
423
|
"contentEditable": "false",
|
|
424
|
-
"class": isDate ? "
|
|
425
|
-
}, isDate ? [icon("calendar", 12, "
|
|
424
|
+
"class": isDate ? "markloom-mention markloom-mention-date" : "markloom-mention"
|
|
425
|
+
}, isDate ? [icon("calendar", 12, "markloom-mention-ico"), label] : ["@", label]);
|
|
426
426
|
}
|
|
427
427
|
function renderEmbed(spec, key, atomSelect) {
|
|
428
428
|
const a = _nullishCoalesce(spec.attrs, () => ( {}));
|
|
@@ -437,7 +437,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
437
437
|
"data-embed-kind": kind,
|
|
438
438
|
"data-selected": atomIsSelected(spec.id, atomSelect) ? "" : void 0,
|
|
439
439
|
"contentEditable": "false",
|
|
440
|
-
"class": "
|
|
440
|
+
"class": "markloom-embed"
|
|
441
441
|
};
|
|
442
442
|
if (kind === "youtube") {
|
|
443
443
|
const id = youtubeId(src);
|
|
@@ -449,7 +449,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
449
449
|
"allow": "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
450
450
|
"allowFullScreen": true,
|
|
451
451
|
"frameBorder": "0",
|
|
452
|
-
"class": "
|
|
452
|
+
"class": "markloom-embed-frame"
|
|
453
453
|
}));
|
|
454
454
|
}
|
|
455
455
|
if (kind === "twitch") {
|
|
@@ -462,7 +462,7 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
462
462
|
"title": title || "Twitch",
|
|
463
463
|
"allowFullScreen": true,
|
|
464
464
|
"frameBorder": "0",
|
|
465
|
-
"class": "
|
|
465
|
+
"class": "markloom-embed-frame"
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
468
|
if (kind === "audio") {
|
|
@@ -471,17 +471,17 @@ function renderEmbed(spec, key, atomSelect) {
|
|
|
471
471
|
"src": src,
|
|
472
472
|
"controls": true,
|
|
473
473
|
"preload": "metadata",
|
|
474
|
-
"class": "
|
|
474
|
+
"class": "markloom-embed-audio"
|
|
475
475
|
}, title || name));
|
|
476
476
|
}
|
|
477
|
-
return _preact.h.call(void 0, "div", { ...base, class: "
|
|
477
|
+
return _preact.h.call(void 0, "div", { ...base, class: "markloom-embed markloom-embed-file" }, _preact.h.call(void 0, "a", {
|
|
478
478
|
"key": "l",
|
|
479
479
|
"href": src,
|
|
480
480
|
"download": name || void 0,
|
|
481
481
|
"target": "_blank",
|
|
482
482
|
"rel": "noopener noreferrer",
|
|
483
|
-
"class": "
|
|
484
|
-
}, [icon("paperclip", 14, "
|
|
483
|
+
"class": "markloom-embed-file-link"
|
|
484
|
+
}, [icon("paperclip", 14, "markloom-embed-file-ico"), " ", name || src]));
|
|
485
485
|
}
|
|
486
486
|
function youtubeId(url) {
|
|
487
487
|
try {
|
|
@@ -524,7 +524,7 @@ function aiBtn(act, label, cls, extra) {
|
|
|
524
524
|
return _preact.h.call(void 0, "button", {
|
|
525
525
|
key: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _18 => _18.key]), () => ( act)),
|
|
526
526
|
type: "button",
|
|
527
|
-
class: `
|
|
527
|
+
class: `markloom-ai-block-btn ${cls}`,
|
|
528
528
|
"data-ai-act": act,
|
|
529
529
|
contentEditable: "false",
|
|
530
530
|
title: _optionalChain([extra, 'optionalAccess', _19 => _19.title]),
|
|
@@ -534,7 +534,7 @@ function aiBtn(act, label, cls, extra) {
|
|
|
534
534
|
}, label);
|
|
535
535
|
}
|
|
536
536
|
function aiKbd(label) {
|
|
537
|
-
return _preact.h.call(void 0, "kbd", { class: "
|
|
537
|
+
return _preact.h.call(void 0, "kbd", { class: "markloom-ai-kbd" }, label);
|
|
538
538
|
}
|
|
539
539
|
function renderAiBlock(spec, tag, props, opts) {
|
|
540
540
|
const status = typeof _optionalChain([spec, 'access', _20 => _20.attrs, 'optionalAccess', _21 => _21.status]) === "string" ? spec.attrs.status : "compose";
|
|
@@ -542,41 +542,41 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
542
542
|
const mode = _optionalChain([spec, 'access', _24 => _24.attrs, 'optionalAccess', _25 => _25.mode]) === "rewrite" ? "rewrite" : "continue";
|
|
543
543
|
const seed = typeof _optionalChain([spec, 'access', _26 => _26.attrs, 'optionalAccess', _27 => _27.seed]) === "string" ? spec.attrs.seed : "";
|
|
544
544
|
const draftChars = typeof _optionalChain([spec, 'access', _28 => _28.attrs, 'optionalAccess', _29 => _29.draftChars]) === "number" ? spec.attrs.draftChars : 0;
|
|
545
|
-
props.class = "
|
|
545
|
+
props.class = "markloom-ai-block";
|
|
546
546
|
props["data-ai-block"] = "";
|
|
547
547
|
props["data-status"] = status;
|
|
548
548
|
props["data-mode"] = mode;
|
|
549
549
|
const title = mode === "rewrite" ? "AI \u6539\u5199" : "AI \u5199\u4F5C";
|
|
550
|
-
const statusHint = status === "loading" ? [_preact.h.call(void 0, "span", { key: "sp", class: "
|
|
550
|
+
const statusHint = status === "loading" ? [_preact.h.call(void 0, "span", { key: "sp", class: "markloom-ai-spin", "aria-hidden": "true" }), "\u751F\u6210\u4E2D"] : status === "preview" ? "\u5F85\u786E\u8BA4" : status === "error" ? "\u5931\u8D25" : null;
|
|
551
551
|
const hd = _preact.h.call(void 0, "div", {
|
|
552
552
|
key: "hd",
|
|
553
|
-
class: "
|
|
553
|
+
class: "markloom-ai-block-hd",
|
|
554
554
|
contentEditable: "false"
|
|
555
555
|
}, [
|
|
556
|
-
_preact.h.call(void 0, "div", { key: "l", class: "
|
|
556
|
+
_preact.h.call(void 0, "div", { key: "l", class: "markloom-ai-block-brand" }, [
|
|
557
557
|
_preact.h.call(void 0,
|
|
558
558
|
"span",
|
|
559
|
-
{ key: "ico", class: "
|
|
560
|
-
icon(mode === "rewrite" ? "pen-line" : "sparkles", 15, "
|
|
559
|
+
{ key: "ico", class: "markloom-ai-block-ico" },
|
|
560
|
+
icon(mode === "rewrite" ? "pen-line" : "sparkles", 15, "markloom-ai-block-svg")
|
|
561
561
|
),
|
|
562
|
-
_preact.h.call(void 0, "span", { key: "t", class: "
|
|
562
|
+
_preact.h.call(void 0, "span", { key: "t", class: "markloom-ai-block-title" }, title),
|
|
563
563
|
statusHint ? _preact.h.call(void 0, "span", {
|
|
564
564
|
key: "b",
|
|
565
|
-
class: `
|
|
565
|
+
class: `markloom-ai-block-badge markloom-ai-block-badge-${status}`
|
|
566
566
|
}, statusHint) : null
|
|
567
567
|
]),
|
|
568
|
-
status === "loading" ? aiBtn("stop", "\u505C\u6B62", "
|
|
568
|
+
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
569
|
]);
|
|
570
570
|
const seedStrip = mode === "rewrite" && seed.trim() ? _preact.h.call(void 0, "div", {
|
|
571
571
|
key: "seed",
|
|
572
|
-
class: "
|
|
572
|
+
class: "markloom-ai-block-seed",
|
|
573
573
|
contentEditable: "false",
|
|
574
574
|
title: seed
|
|
575
575
|
}, [
|
|
576
|
-
_preact.h.call(void 0, "span", { key: "l", class: "
|
|
576
|
+
_preact.h.call(void 0, "span", { key: "l", class: "markloom-ai-block-seed-lab" }, "\u539F\u6587"),
|
|
577
577
|
_preact.h.call(void 0,
|
|
578
578
|
"span",
|
|
579
|
-
{ key: "t", class: "
|
|
579
|
+
{ key: "t", class: "markloom-ai-block-seed-txt" },
|
|
580
580
|
seed.length > 120 ? `${seed.slice(0, 120)}\u2026` : seed
|
|
581
581
|
)
|
|
582
582
|
]) : null;
|
|
@@ -585,7 +585,7 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
585
585
|
if (!(vn && typeof vn === "object" && "props" in vn))
|
|
586
586
|
return vn;
|
|
587
587
|
const p = vn.props;
|
|
588
|
-
p.class = [p.class, "
|
|
588
|
+
p.class = [p.class, "markloom-ai-prompt"].filter(Boolean).join(" ");
|
|
589
589
|
if (i === 0 && !_chunkVVFIQLVRcjs.isText.call(void 0, c) && c.type === "paragraph" && leafText(c) === "") {
|
|
590
590
|
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
591
|
}
|
|
@@ -598,50 +598,50 @@ function renderAiBlock(spec, tag, props, opts) {
|
|
|
598
598
|
if (status === "error" && err) {
|
|
599
599
|
outKids.push(_preact.h.call(void 0, "div", {
|
|
600
600
|
key: "err",
|
|
601
|
-
class: "
|
|
601
|
+
class: "markloom-ai-block-err",
|
|
602
602
|
contentEditable: "false"
|
|
603
603
|
}, err));
|
|
604
604
|
}
|
|
605
605
|
let ft = null;
|
|
606
606
|
if (status === "compose") {
|
|
607
|
-
ft = _preact.h.call(void 0, "div", { key: "ft", class: "
|
|
608
|
-
_preact.h.call(void 0, "span", { key: "h", class: "
|
|
607
|
+
ft = _preact.h.call(void 0, "div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
608
|
+
_preact.h.call(void 0, "span", { key: "h", class: "markloom-ai-block-hint" }, [
|
|
609
609
|
aiKbd("Enter"),
|
|
610
610
|
" \u751F\u6210",
|
|
611
|
-
_preact.h.call(void 0, "span", { key: "dot", class: "
|
|
611
|
+
_preact.h.call(void 0, "span", { key: "dot", class: "markloom-ai-dot" }, "\xB7"),
|
|
612
612
|
aiKbd("\u21E7Enter"),
|
|
613
613
|
" \u6362\u884C"
|
|
614
614
|
]),
|
|
615
|
-
aiBtn("run", "\u751F\u6210", "
|
|
615
|
+
aiBtn("run", "\u751F\u6210", "markloom-ai-block-btn-primary", { title: "\u5F00\u59CB\u751F\u6210", key: "run" })
|
|
616
616
|
]);
|
|
617
617
|
} else if (status === "loading") {
|
|
618
|
-
ft = _preact.h.call(void 0, "div", { key: "ft", class: "
|
|
618
|
+
ft = _preact.h.call(void 0, "div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
619
619
|
_preact.h.call(void 0,
|
|
620
620
|
"span",
|
|
621
|
-
{ key: "h", class: "
|
|
621
|
+
{ key: "h", class: "markloom-ai-block-hint markloom-ai-block-loading" },
|
|
622
622
|
draftChars ? `\u6B63\u6587\u5DF2\u5199\u5165 ${draftChars} \u5B57\u2026` : "\u6B63\u5728\u5199\u5165\u6B63\u6587\u2026"
|
|
623
623
|
),
|
|
624
|
-
aiBtn("stop", "\u505C\u6B62", "
|
|
624
|
+
aiBtn("stop", "\u505C\u6B62", "markloom-ai-block-btn-ghost", { title: "\u505C\u6B62\u751F\u6210", key: "stop2" })
|
|
625
625
|
]);
|
|
626
626
|
} else if (status === "preview") {
|
|
627
|
-
ft = _preact.h.call(void 0, "div", { key: "ft", class: "
|
|
627
|
+
ft = _preact.h.call(void 0, "div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
628
628
|
_preact.h.call(void 0,
|
|
629
629
|
"span",
|
|
630
|
-
{ key: "h", class: "
|
|
630
|
+
{ key: "h", class: "markloom-ai-block-hint" },
|
|
631
631
|
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
632
|
),
|
|
633
|
-
_preact.h.call(void 0, "div", { key: "acts", class: "
|
|
634
|
-
aiBtn("retry", "\u91CD\u8BD5", "
|
|
635
|
-
aiBtn("discard", "\u64A4\u56DE", "
|
|
636
|
-
aiBtn("accept", "\u786E\u8BA4", "
|
|
633
|
+
_preact.h.call(void 0, "div", { key: "acts", class: "markloom-ai-block-acts" }, [
|
|
634
|
+
aiBtn("retry", "\u91CD\u8BD5", "markloom-ai-block-btn-ghost", { title: "\u64A4\u56DE\u5E76\u91CD\u65B0\u751F\u6210" }),
|
|
635
|
+
aiBtn("discard", "\u64A4\u56DE", "markloom-ai-block-btn-ghost", { title: "\u6574\u7B14\u64A4\u56DE(undo)" }),
|
|
636
|
+
aiBtn("accept", "\u786E\u8BA4", "markloom-ai-block-btn-primary", { title: "\u63D0\u4EA4\u4E8B\u52A1" })
|
|
637
637
|
])
|
|
638
638
|
]);
|
|
639
639
|
} else if (status === "error") {
|
|
640
|
-
ft = _preact.h.call(void 0, "div", { key: "ft", class: "
|
|
641
|
-
_preact.h.call(void 0, "span", { key: "h", class: "
|
|
642
|
-
_preact.h.call(void 0, "div", { key: "acts", class: "
|
|
643
|
-
aiBtn("retry", "\u91CD\u8BD5", "
|
|
644
|
-
aiBtn("discard", "\u4E22\u5F03", "
|
|
640
|
+
ft = _preact.h.call(void 0, "div", { key: "ft", class: "markloom-ai-block-ft", contentEditable: "false" }, [
|
|
641
|
+
_preact.h.call(void 0, "span", { key: "h", class: "markloom-ai-block-hint is-error" }, "\u751F\u6210\u5931\u8D25"),
|
|
642
|
+
_preact.h.call(void 0, "div", { key: "acts", class: "markloom-ai-block-acts" }, [
|
|
643
|
+
aiBtn("retry", "\u91CD\u8BD5", "markloom-ai-block-btn-primary", { title: "\u91CD\u65B0\u751F\u6210" }),
|
|
644
|
+
aiBtn("discard", "\u4E22\u5F03", "markloom-ai-block-btn-ghost")
|
|
645
645
|
])
|
|
646
646
|
]);
|
|
647
647
|
}
|
|
@@ -671,19 +671,19 @@ function renderNode(node, key, opts) {
|
|
|
671
671
|
if (_optionalChain([spec, 'access', _30 => _30.attrs, 'optionalAccess', _31 => _31.align]) && spec.attrs.align !== "left")
|
|
672
672
|
props.style = `text-align:${spec.attrs.align}`;
|
|
673
673
|
if (_optionalChain([spec, 'access', _32 => _32.attrs, 'optionalAccess', _33 => _33.aiDraft])) {
|
|
674
|
-
props.class = [props.class, "
|
|
674
|
+
props.class = [props.class, "markloom-ai-draft"].filter(Boolean).join(" ");
|
|
675
675
|
props["data-ai-draft"] = "";
|
|
676
676
|
if (spec.attrs.aiStream)
|
|
677
677
|
props["data-ai-stream"] = "";
|
|
678
678
|
}
|
|
679
679
|
if (spec.type === "callout") {
|
|
680
|
-
props.class = "
|
|
680
|
+
props.class = "markloom-callout";
|
|
681
681
|
const variant = typeof _optionalChain([spec, 'access', _34 => _34.attrs, 'optionalAccess', _35 => _35.variant]) === "string" ? spec.attrs.variant : "info";
|
|
682
682
|
props["data-variant"] = variant;
|
|
683
683
|
const chip = _preact.h.call(void 0, "button", {
|
|
684
684
|
"key": "v",
|
|
685
685
|
"type": "button",
|
|
686
|
-
"class": "
|
|
686
|
+
"class": "markloom-callout-chip",
|
|
687
687
|
"contentEditable": "false",
|
|
688
688
|
"data-callout-variant": "",
|
|
689
689
|
"tabIndex": -1
|
|
@@ -697,7 +697,7 @@ function renderNode(node, key, opts) {
|
|
|
697
697
|
const depth = Math.min(Math.max(Number(_nullishCoalesce(_optionalChain([spec, 'access', _36 => _36.attrs, 'optionalAccess', _37 => _37.depth]), () => ( 2))), 1), 6);
|
|
698
698
|
tag = `h${depth}`;
|
|
699
699
|
const collapsed = !!_optionalChain([spec, 'access', _38 => _38.attrs, 'optionalAccess', _39 => _39.collapsed]);
|
|
700
|
-
props.class = "
|
|
700
|
+
props.class = "markloom-heading";
|
|
701
701
|
props["data-heading-depth"] = String(depth);
|
|
702
702
|
props["data-collapsed"] = collapsed ? "true" : "false";
|
|
703
703
|
if (opts.slug)
|
|
@@ -756,7 +756,7 @@ function renderTable(spec, key, ctx) {
|
|
|
756
756
|
"key": idx,
|
|
757
757
|
"data-block-id": _nullishCoalesce(cellNode.id, () => ( "")),
|
|
758
758
|
"contentEditable": true,
|
|
759
|
-
"class": "
|
|
759
|
+
"class": "markloom-cell",
|
|
760
760
|
"scope": tag === "th" ? "col" : void 0,
|
|
761
761
|
"colSpan": m.colspan > 1 ? m.colspan : void 0,
|
|
762
762
|
"rowSpan": m.rowspan > 1 ? m.rowspan : void 0,
|
|
@@ -791,10 +791,10 @@ function renderTable(spec, key, ctx) {
|
|
|
791
791
|
"data-atom": spec.type,
|
|
792
792
|
"contentEditable": "false",
|
|
793
793
|
// 字符串 'false':Preact 对布尔 false 会删属性,正文选区就跨得进来了
|
|
794
|
-
"class": "
|
|
794
|
+
"class": "markloom-table",
|
|
795
795
|
"style": widths ? `width:${widths.reduce((a, b) => a + b, 0)}px` : "width:100%"
|
|
796
796
|
}, children);
|
|
797
|
-
return _preact.h.call(void 0, "div", { "key": `w${_nullishCoalesce(spec.id, () => ( key))}`, "data-pass": "", "class": "
|
|
797
|
+
return _preact.h.call(void 0, "div", { "key": `w${_nullishCoalesce(spec.id, () => ( key))}`, "data-pass": "", "class": "markloom-table-scroll" }, [table]);
|
|
798
798
|
}
|
|
799
799
|
function renderHr(spec, key, ctx) {
|
|
800
800
|
if (_optionalChain([spec, 'access', _57 => _57.attrs, 'optionalAccess', _58 => _58.mdType]) === "thematicBreak")
|
|
@@ -854,8 +854,8 @@ function renderDoc(doc, opts = {}) {
|
|
|
854
854
|
}
|
|
855
855
|
return vnode;
|
|
856
856
|
});
|
|
857
|
-
const cls = opts.invisibleCharacters ? "
|
|
858
|
-
return _preact.h.call(void 0, "div", { "class": cls, "data-
|
|
857
|
+
const cls = opts.invisibleCharacters ? "markloom-doc markloom-invisible" : "markloom-doc";
|
|
858
|
+
return _preact.h.call(void 0, "div", { "class": cls, "data-markloom": true }, kids);
|
|
859
859
|
}
|
|
860
860
|
function renderToHtml(doc, opts = {}) {
|
|
861
861
|
return _preactrendertostring.renderToString.call(void 0, renderDoc(doc, opts));
|
|
@@ -3227,7 +3227,7 @@ function askInput(opts) {
|
|
|
3227
3227
|
dismissActive(null);
|
|
3228
3228
|
return new Promise((resolve2) => {
|
|
3229
3229
|
const root = document.createElement("div");
|
|
3230
|
-
root.className = "
|
|
3230
|
+
root.className = "markloom-prompt-host";
|
|
3231
3231
|
document.body.appendChild(root);
|
|
3232
3232
|
let value = _nullishCoalesce(opts.defaultValue, () => ( ""));
|
|
3233
3233
|
let error = null;
|
|
@@ -3258,7 +3258,7 @@ function askInput(opts) {
|
|
|
3258
3258
|
document.addEventListener("keydown", onKey, true);
|
|
3259
3259
|
const paint = () => {
|
|
3260
3260
|
const inputProps = {
|
|
3261
|
-
class: "
|
|
3261
|
+
class: "markloom-prompt-input" + (error ? " markloom-prompt-input-err" : ""),
|
|
3262
3262
|
value,
|
|
3263
3263
|
placeholder: _nullishCoalesce(opts.placeholder, () => ( "")),
|
|
3264
3264
|
autofocus: true,
|
|
@@ -3282,27 +3282,27 @@ function askInput(opts) {
|
|
|
3282
3282
|
};
|
|
3283
3283
|
_preact.render.call(void 0,
|
|
3284
3284
|
_preact.h.call(void 0, "div", {
|
|
3285
|
-
class: "
|
|
3286
|
-
"data-
|
|
3285
|
+
class: "markloom-prompt-mask",
|
|
3286
|
+
"data-markloom-prompt": "",
|
|
3287
3287
|
onMouseDown: (e) => {
|
|
3288
3288
|
if (e.target === e.currentTarget)
|
|
3289
3289
|
finish(null);
|
|
3290
3290
|
}
|
|
3291
3291
|
}, _preact.h.call(void 0, "div", {
|
|
3292
|
-
class: "
|
|
3292
|
+
class: "markloom-prompt-card",
|
|
3293
3293
|
role: "dialog",
|
|
3294
3294
|
"aria-modal": "true",
|
|
3295
3295
|
"aria-label": opts.title,
|
|
3296
3296
|
onMouseDown: (e) => e.stopPropagation()
|
|
3297
3297
|
}, [
|
|
3298
|
-
_preact.h.call(void 0, "div", { class: "
|
|
3299
|
-
opts.description ? _preact.h.call(void 0, "div", { class: "
|
|
3298
|
+
_preact.h.call(void 0, "div", { class: "markloom-prompt-title", key: "t" }, opts.title),
|
|
3299
|
+
opts.description ? _preact.h.call(void 0, "div", { class: "markloom-prompt-desc", key: "d" }, opts.description) : null,
|
|
3300
3300
|
opts.multiline ? _preact.h.call(void 0, "textarea", { ...inputProps, key: "i", rows: 4 }) : _preact.h.call(void 0, "input", { ...inputProps, key: "i", type: "text" }),
|
|
3301
|
-
error ? _preact.h.call(void 0, "div", { class: "
|
|
3302
|
-
_preact.h.call(void 0, "div", { class: "
|
|
3301
|
+
error ? _preact.h.call(void 0, "div", { class: "markloom-prompt-err", key: "e" }, error) : null,
|
|
3302
|
+
_preact.h.call(void 0, "div", { class: "markloom-prompt-ft", key: "f" }, [
|
|
3303
3303
|
_preact.h.call(void 0, "button", {
|
|
3304
3304
|
type: "button",
|
|
3305
|
-
class: "
|
|
3305
|
+
class: "markloom-prompt-btn markloom-prompt-btn-ghost",
|
|
3306
3306
|
"data-act": "cancel",
|
|
3307
3307
|
onMouseDown: (e) => {
|
|
3308
3308
|
e.preventDefault();
|
|
@@ -3311,7 +3311,7 @@ function askInput(opts) {
|
|
|
3311
3311
|
}, _nullishCoalesce(opts.cancelLabel, () => ( "\u53D6\u6D88"))),
|
|
3312
3312
|
_preact.h.call(void 0, "button", {
|
|
3313
3313
|
type: "button",
|
|
3314
|
-
class: "
|
|
3314
|
+
class: "markloom-prompt-btn markloom-prompt-btn-primary",
|
|
3315
3315
|
"data-act": "confirm",
|
|
3316
3316
|
onMouseDown: (e) => {
|
|
3317
3317
|
e.preventDefault();
|
|
@@ -3348,7 +3348,7 @@ function askLinkPopover(opts) {
|
|
|
3348
3348
|
dismissActive(null);
|
|
3349
3349
|
return new Promise((resolve2) => {
|
|
3350
3350
|
const root = document.createElement("div");
|
|
3351
|
-
root.className = "
|
|
3351
|
+
root.className = "markloom-link-pop-host";
|
|
3352
3352
|
document.body.appendChild(root);
|
|
3353
3353
|
let value = _nullishCoalesce(opts.defaultValue, () => ( ""));
|
|
3354
3354
|
let placed = false;
|
|
@@ -3384,8 +3384,8 @@ function askLinkPopover(opts) {
|
|
|
3384
3384
|
const can = value.trim().length > 0;
|
|
3385
3385
|
_preact.render.call(void 0,
|
|
3386
3386
|
_preact.h.call(void 0, "div", {
|
|
3387
|
-
class: "
|
|
3388
|
-
"data-
|
|
3387
|
+
class: "markloom-link-pop",
|
|
3388
|
+
"data-markloom-link-pop": "",
|
|
3389
3389
|
role: "dialog",
|
|
3390
3390
|
"aria-label": "\u6DFB\u52A0\u94FE\u63A5",
|
|
3391
3391
|
onMouseDown: (e) => {
|
|
@@ -3397,7 +3397,7 @@ function askLinkPopover(opts) {
|
|
|
3397
3397
|
}, [
|
|
3398
3398
|
_preact.h.call(void 0, "input", {
|
|
3399
3399
|
key: "i",
|
|
3400
|
-
class: "
|
|
3400
|
+
class: "markloom-link-pop-input",
|
|
3401
3401
|
type: "text",
|
|
3402
3402
|
value,
|
|
3403
3403
|
placeholder: _nullishCoalesce(opts.placeholder, () => ( "\u7C98\u8D34\u6216\u8F93\u5165\u94FE\u63A5")),
|
|
@@ -3415,7 +3415,7 @@ function askLinkPopover(opts) {
|
|
|
3415
3415
|
_preact.h.call(void 0, "button", {
|
|
3416
3416
|
key: "ok",
|
|
3417
3417
|
type: "button",
|
|
3418
|
-
class: "
|
|
3418
|
+
class: "markloom-link-pop-ok" + (can ? " is-ready" : ""),
|
|
3419
3419
|
"data-act": "confirm",
|
|
3420
3420
|
disabled: !can,
|
|
3421
3421
|
onMouseDown: (e) => {
|
|
@@ -3426,7 +3426,7 @@ function askLinkPopover(opts) {
|
|
|
3426
3426
|
]),
|
|
3427
3427
|
root
|
|
3428
3428
|
);
|
|
3429
|
-
const el = root.querySelector(".
|
|
3429
|
+
const el = root.querySelector(".markloom-link-pop");
|
|
3430
3430
|
if (el && !placed) {
|
|
3431
3431
|
placed = true;
|
|
3432
3432
|
const rect = readAnchor(opts.anchor);
|
|
@@ -3465,14 +3465,14 @@ var MentionMenu = (_class = class {
|
|
|
3465
3465
|
this.root = root;
|
|
3466
3466
|
this.host = host;
|
|
3467
3467
|
this.overlay = document.createElement("div");
|
|
3468
|
-
this.overlay.className = "
|
|
3468
|
+
this.overlay.className = "markloom-mention-overlay";
|
|
3469
3469
|
document.body.appendChild(this.overlay);
|
|
3470
|
-
root.addEventListener("
|
|
3470
|
+
root.addEventListener("markloom-redraw", this.reevaluate);
|
|
3471
3471
|
document.addEventListener("selectionchange", this.reevaluate);
|
|
3472
3472
|
root.addEventListener("keydown", this.onKeyDown, true);
|
|
3473
3473
|
}
|
|
3474
3474
|
destroy() {
|
|
3475
|
-
this.root.removeEventListener("
|
|
3475
|
+
this.root.removeEventListener("markloom-redraw", this.reevaluate);
|
|
3476
3476
|
document.removeEventListener("selectionchange", this.reevaluate);
|
|
3477
3477
|
this.root.removeEventListener("keydown", this.onKeyDown, true);
|
|
3478
3478
|
this.close();
|
|
@@ -3595,7 +3595,7 @@ var MentionMenu = (_class = class {
|
|
|
3595
3595
|
_preact.render.call(void 0,
|
|
3596
3596
|
_preact.h.call(void 0,
|
|
3597
3597
|
"div",
|
|
3598
|
-
{ class: "
|
|
3598
|
+
{ class: "markloom-mention-menu" },
|
|
3599
3599
|
this.list.map((c, i) => _preact.h.call(void 0, "button", {
|
|
3600
3600
|
"key": c.id,
|
|
3601
3601
|
"type": "button",
|
|
@@ -3604,11 +3604,11 @@ var MentionMenu = (_class = class {
|
|
|
3604
3604
|
e.preventDefault();
|
|
3605
3605
|
this.apply(c);
|
|
3606
3606
|
}
|
|
3607
|
-
}, c.kind === "date" ? [icon("calendar", 14, "
|
|
3607
|
+
}, c.kind === "date" ? [icon("calendar", 14, "markloom-mention-ico"), " ", c.label] : ["@", c.label]))
|
|
3608
3608
|
),
|
|
3609
3609
|
this.overlay
|
|
3610
3610
|
);
|
|
3611
|
-
const el = this.overlay.querySelector(".
|
|
3611
|
+
const el = this.overlay.querySelector(".markloom-mention-menu");
|
|
3612
3612
|
if (el)
|
|
3613
3613
|
void place(rectRef(rect), el, { placement: "bottom-start", gap: 6 });
|
|
3614
3614
|
}
|
|
@@ -3658,10 +3658,10 @@ var BLOCK_ITEMS = [
|
|
|
3658
3658
|
{ kind: "callout", label: "\u9AD8\u4EAE\u5757", ico: "callout", group: "box" }
|
|
3659
3659
|
];
|
|
3660
3660
|
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: "
|
|
3661
|
+
{ name: "bold", label: "B", tip: `\u7C97\u4F53 (${mod} + B)`, md: "**\u6587\u672C** \u7A7A\u683C", cls: "markloom-bb-bold" },
|
|
3662
|
+
{ name: "strike", label: "S", tip: `\u5220\u9664\u7EBF (${mod} + Shift + X)`, md: "~~\u6587\u672C~~ \u7A7A\u683C", cls: "markloom-bb-strike" },
|
|
3663
|
+
{ name: "italic", label: "I", tip: `\u659C\u4F53 (${mod} + I)`, md: "*\u6587\u672C* \u7A7A\u683C", cls: "markloom-bb-italic" },
|
|
3664
|
+
{ name: "underline", label: "U", tip: `\u4E0B\u5212\u7EBF (${mod} + U)`, md: "", cls: "markloom-bb-under" }
|
|
3665
3665
|
];
|
|
3666
3666
|
var FONT_COLORS = [
|
|
3667
3667
|
{ value: null, title: "\u9ED8\u8BA4", swatch: "#1f2329" },
|
|
@@ -3692,14 +3692,14 @@ var BG_COLORS = [
|
|
|
3692
3692
|
{ value: "#7b67ee", title: "\u7D2B", swatch: "#7b67ee" }
|
|
3693
3693
|
];
|
|
3694
3694
|
function tipNode(title, md) {
|
|
3695
|
-
return _preact.h.call(void 0, "div", { class: "
|
|
3696
|
-
_preact.h.call(void 0, "div", { class: "
|
|
3697
|
-
md ? _preact.h.call(void 0, "div", { class: "
|
|
3695
|
+
return _preact.h.call(void 0, "div", { class: "markloom-bubble-tip", key: "tip" }, [
|
|
3696
|
+
_preact.h.call(void 0, "div", { class: "markloom-bubble-tip-t", key: "t" }, title),
|
|
3697
|
+
md ? _preact.h.call(void 0, "div", { class: "markloom-bubble-tip-md", key: "m" }, `Markdown: ${md}`) : null
|
|
3698
3698
|
]);
|
|
3699
3699
|
}
|
|
3700
3700
|
function blockIco(name, size2 = 18) {
|
|
3701
3701
|
if (name === "h1" || name === "h2" || name === "h3")
|
|
3702
|
-
return _preact.h.call(void 0, "span", { class: "
|
|
3702
|
+
return _preact.h.call(void 0, "span", { class: "markloom-bb-hico" }, [_preact.h.call(void 0, "span", {}, "H"), _preact.h.call(void 0, "sub", {}, name[1])]);
|
|
3703
3703
|
return icon(name, size2);
|
|
3704
3704
|
}
|
|
3705
3705
|
function currentBlockKind(doc, sel) {
|
|
@@ -3736,7 +3736,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
3736
3736
|
this.root = root;
|
|
3737
3737
|
this.host = host;
|
|
3738
3738
|
this.overlay = document.createElement("div");
|
|
3739
|
-
this.overlay.className = "
|
|
3739
|
+
this.overlay.className = "markloom-bubble-overlay";
|
|
3740
3740
|
document.body.appendChild(this.overlay);
|
|
3741
3741
|
document.addEventListener("selectionchange", this.onSelChange);
|
|
3742
3742
|
document.addEventListener("pointerdown", this.onPointerDown, true);
|
|
@@ -3856,7 +3856,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
3856
3856
|
].join("|");
|
|
3857
3857
|
}
|
|
3858
3858
|
moveBubble(rect) {
|
|
3859
|
-
const el = this.overlay.querySelector(".
|
|
3859
|
+
const el = this.overlay.querySelector(".markloom-bubble");
|
|
3860
3860
|
if (!el)
|
|
3861
3861
|
return;
|
|
3862
3862
|
this.lastRect = rect;
|
|
@@ -3968,7 +3968,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
3968
3968
|
hoverWrap(id, trigger, panel) {
|
|
3969
3969
|
return _preact.h.call(void 0, "div", {
|
|
3970
3970
|
key: id,
|
|
3971
|
-
class: "
|
|
3971
|
+
class: "markloom-bb-dd-wrap" + (this.menu === id ? " is-open" : ""),
|
|
3972
3972
|
"data-menu-wrap": id,
|
|
3973
3973
|
onMouseEnter: () => this.scheduleOpenMenu(id),
|
|
3974
3974
|
onMouseLeave: () => this.scheduleCloseMenu()
|
|
@@ -3985,22 +3985,22 @@ var BubbleMenu = (_class2 = class {
|
|
|
3985
3985
|
const curBg = this.activeBg(sel);
|
|
3986
3986
|
const colorSwatch = _nullishCoalesce(curColor, () => ( "#1f2329"));
|
|
3987
3987
|
const hasStyle = !!(curColor || curBg || active2.has("highlight"));
|
|
3988
|
-
const sep = (k) => _preact.h.call(void 0, "span", { key: k, class: "
|
|
3988
|
+
const sep = (k) => _preact.h.call(void 0, "span", { key: k, class: "markloom-bubble-sep" });
|
|
3989
3989
|
const blockBtn = _preact.h.call(void 0, "button", {
|
|
3990
3990
|
"key": "block",
|
|
3991
3991
|
"type": "button",
|
|
3992
|
-
"class": "
|
|
3992
|
+
"class": "markloom-bb-dd" + (this.menu === "block" ? " is-open" : ""),
|
|
3993
3993
|
"data-menu": "block",
|
|
3994
3994
|
"title": "\u6B63\u6587\u4E0E\u6807\u9898",
|
|
3995
3995
|
"onMouseDown": (e) => e.preventDefault()
|
|
3996
3996
|
}, [
|
|
3997
|
-
_preact.h.call(void 0, "span", { class: "
|
|
3998
|
-
icon("chevron-down", 12, "
|
|
3997
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-t", key: "t" }, "T"),
|
|
3998
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
3999
3999
|
tipNode("\u6B63\u6587\u4E0E\u6807\u9898")
|
|
4000
4000
|
]);
|
|
4001
4001
|
const blockMenu = _preact.h.call(void 0, "div", {
|
|
4002
4002
|
key: "block-menu",
|
|
4003
|
-
class: "
|
|
4003
|
+
class: "markloom-bb-menu" + (this.menu === "block" ? " is-open" : ""),
|
|
4004
4004
|
"data-panel": "block"
|
|
4005
4005
|
}, (() => {
|
|
4006
4006
|
const rows = [];
|
|
@@ -4008,22 +4008,22 @@ var BubbleMenu = (_class2 = class {
|
|
|
4008
4008
|
for (const it of BLOCK_ITEMS) {
|
|
4009
4009
|
const g = _nullishCoalesce(it.group, () => ( "fmt"));
|
|
4010
4010
|
if (lastGroup && lastGroup !== g)
|
|
4011
|
-
rows.push(_preact.h.call(void 0, "div", { key: `sep-${g}`, class: "
|
|
4011
|
+
rows.push(_preact.h.call(void 0, "div", { key: `sep-${g}`, class: "markloom-bb-menu-sep" }));
|
|
4012
4012
|
lastGroup = g;
|
|
4013
4013
|
const on = curBlock === it.kind;
|
|
4014
4014
|
rows.push(_preact.h.call(void 0, "button", {
|
|
4015
4015
|
key: it.kind,
|
|
4016
4016
|
type: "button",
|
|
4017
|
-
class: "
|
|
4017
|
+
class: "markloom-bb-menu-item" + (on ? " is-on" : ""),
|
|
4018
4018
|
"data-block": it.kind,
|
|
4019
4019
|
onMouseDown: (e) => {
|
|
4020
4020
|
e.preventDefault();
|
|
4021
4021
|
this.applyBlock(it.kind);
|
|
4022
4022
|
}
|
|
4023
4023
|
}, [
|
|
4024
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4025
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4026
|
-
on ? _preact.h.call(void 0, "span", { class: "
|
|
4024
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-ico", key: "i" }, blockIco(it.ico, 18)),
|
|
4025
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-lab", key: "l" }, it.label),
|
|
4026
|
+
on ? _preact.h.call(void 0, "span", { class: "markloom-bb-menu-check", key: "c" }, icon("check", 16)) : _preact.h.call(void 0, "span", { key: "c" })
|
|
4027
4027
|
]));
|
|
4028
4028
|
}
|
|
4029
4029
|
return rows;
|
|
@@ -4031,18 +4031,18 @@ var BubbleMenu = (_class2 = class {
|
|
|
4031
4031
|
const alignBtn = _preact.h.call(void 0, "button", {
|
|
4032
4032
|
"key": "align",
|
|
4033
4033
|
"type": "button",
|
|
4034
|
-
"class": "
|
|
4034
|
+
"class": "markloom-bb-dd" + (this.menu === "align" ? " is-open" : ""),
|
|
4035
4035
|
"data-menu": "align",
|
|
4036
4036
|
"title": "\u5BF9\u9F50\u4E0E\u7F29\u8FDB",
|
|
4037
4037
|
"onMouseDown": (e) => e.preventDefault()
|
|
4038
4038
|
}, [
|
|
4039
4039
|
icon("text-align", 16),
|
|
4040
|
-
icon("chevron-down", 12, "
|
|
4040
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
4041
4041
|
tipNode("\u5BF9\u9F50\u4E0E\u7F29\u8FDB")
|
|
4042
4042
|
]);
|
|
4043
4043
|
const alignMenu = _preact.h.call(void 0, "div", {
|
|
4044
4044
|
key: "align-menu",
|
|
4045
|
-
class: "
|
|
4045
|
+
class: "markloom-bb-menu" + (this.menu === "align" ? " is-open" : ""),
|
|
4046
4046
|
"data-panel": "align"
|
|
4047
4047
|
}, [
|
|
4048
4048
|
...[
|
|
@@ -4052,7 +4052,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
4052
4052
|
].map((a) => _preact.h.call(void 0, "button", {
|
|
4053
4053
|
key: a.value,
|
|
4054
4054
|
type: "button",
|
|
4055
|
-
class: "
|
|
4055
|
+
class: "markloom-bb-menu-item" + (curAlign === a.value ? " is-on" : ""),
|
|
4056
4056
|
"data-align": a.value,
|
|
4057
4057
|
onMouseDown: (e) => {
|
|
4058
4058
|
e.preventDefault();
|
|
@@ -4067,15 +4067,15 @@ var BubbleMenu = (_class2 = class {
|
|
|
4067
4067
|
this.paint(this.lastRect, this.lastSel, true);
|
|
4068
4068
|
}
|
|
4069
4069
|
}, [
|
|
4070
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4071
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4072
|
-
curAlign === a.value ? _preact.h.call(void 0, "span", { class: "
|
|
4070
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-ico", key: "i" }, icon(a.ico, 18)),
|
|
4071
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-lab", key: "l" }, a.title),
|
|
4072
|
+
curAlign === a.value ? _preact.h.call(void 0, "span", { class: "markloom-bb-menu-check", key: "c" }, icon("check", 16)) : _preact.h.call(void 0, "span", { key: "c" })
|
|
4073
4073
|
])),
|
|
4074
|
-
_preact.h.call(void 0, "div", { key: "sep-ind", class: "
|
|
4074
|
+
_preact.h.call(void 0, "div", { key: "sep-ind", class: "markloom-bb-menu-sep" }),
|
|
4075
4075
|
_preact.h.call(void 0, "button", {
|
|
4076
4076
|
key: "indent",
|
|
4077
4077
|
type: "button",
|
|
4078
|
-
class: "
|
|
4078
|
+
class: "markloom-bb-menu-item",
|
|
4079
4079
|
"data-indent": "in",
|
|
4080
4080
|
onMouseDown: (e) => {
|
|
4081
4081
|
e.preventDefault();
|
|
@@ -4088,13 +4088,13 @@ var BubbleMenu = (_class2 = class {
|
|
|
4088
4088
|
this.menu = null;
|
|
4089
4089
|
}
|
|
4090
4090
|
}, [
|
|
4091
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4092
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4091
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-ico", key: "i" }, icon("indent-increase", 18)),
|
|
4092
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-lab", key: "l" }, "\u589E\u52A0\u7F29\u8FDB")
|
|
4093
4093
|
]),
|
|
4094
4094
|
_preact.h.call(void 0, "button", {
|
|
4095
4095
|
key: "outdent",
|
|
4096
4096
|
type: "button",
|
|
4097
|
-
class: "
|
|
4097
|
+
class: "markloom-bb-menu-item",
|
|
4098
4098
|
"data-indent": "out",
|
|
4099
4099
|
onMouseDown: (e) => {
|
|
4100
4100
|
e.preventDefault();
|
|
@@ -4107,14 +4107,14 @@ var BubbleMenu = (_class2 = class {
|
|
|
4107
4107
|
this.menu = null;
|
|
4108
4108
|
}
|
|
4109
4109
|
}, [
|
|
4110
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4111
|
-
_preact.h.call(void 0, "span", { class: "
|
|
4110
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-ico", key: "i" }, icon("indent-decrease", 18)),
|
|
4111
|
+
_preact.h.call(void 0, "span", { class: "markloom-bb-menu-lab", key: "l" }, "\u51CF\u5C11\u7F29\u8FDB")
|
|
4112
4112
|
])
|
|
4113
4113
|
]);
|
|
4114
4114
|
const markBtns = MARK_ITEMS.map((it) => _preact.h.call(void 0, "button", {
|
|
4115
4115
|
"key": it.name,
|
|
4116
4116
|
"type": "button",
|
|
4117
|
-
"class": `
|
|
4117
|
+
"class": `markloom-bb-mark ${_nullishCoalesce(it.cls, () => ( ""))}`,
|
|
4118
4118
|
"title": it.tip,
|
|
4119
4119
|
"data-active": active2.has(it.name) ? "" : void 0,
|
|
4120
4120
|
"data-mark": it.name,
|
|
@@ -4190,7 +4190,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
4190
4190
|
const colorBtn = _preact.h.call(void 0, "button", {
|
|
4191
4191
|
"key": "color",
|
|
4192
4192
|
"type": "button",
|
|
4193
|
-
"class": "
|
|
4193
|
+
"class": "markloom-bb-color" + (this.menu === "color" ? " is-open" : "") + (curBg || active2.has("highlight") ? " has-hl" : ""),
|
|
4194
4194
|
"data-menu": "color",
|
|
4195
4195
|
"data-active": hasStyle ? "" : void 0,
|
|
4196
4196
|
"title": "\u6587\u5B57\u989C\u8272\u4E0E\u9AD8\u4EAE",
|
|
@@ -4198,27 +4198,27 @@ var BubbleMenu = (_class2 = class {
|
|
|
4198
4198
|
}, [
|
|
4199
4199
|
_preact.h.call(void 0, "span", {
|
|
4200
4200
|
key: "a",
|
|
4201
|
-
class: "
|
|
4201
|
+
class: "markloom-bb-a",
|
|
4202
4202
|
style: {
|
|
4203
4203
|
color: colorSwatch,
|
|
4204
4204
|
background: _nullishCoalesce(curBg, () => ( (active2.has("highlight") ? "#faf1d1" : "transparent")))
|
|
4205
4205
|
}
|
|
4206
4206
|
}, "A"),
|
|
4207
|
-
icon("chevron-down", 12, "
|
|
4207
|
+
icon("chevron-down", 12, "markloom-bb-chev"),
|
|
4208
4208
|
tipNode("\u6587\u5B57\u989C\u8272\u4E0E\u9AD8\u4EAE")
|
|
4209
4209
|
]);
|
|
4210
4210
|
const colorMenu = _preact.h.call(void 0, "div", {
|
|
4211
4211
|
key: "color-menu",
|
|
4212
|
-
class: "
|
|
4212
|
+
class: "markloom-bb-menu markloom-bb-menu-color" + (this.menu === "color" ? " is-open" : ""),
|
|
4213
4213
|
"data-panel": "color"
|
|
4214
4214
|
}, [
|
|
4215
|
-
_preact.h.call(void 0, "div", { class: "
|
|
4216
|
-
_preact.h.call(void 0, "div", { class: "
|
|
4215
|
+
_preact.h.call(void 0, "div", { class: "markloom-bb-color-sec", key: "ct" }, "\u5B57\u4F53\u989C\u8272"),
|
|
4216
|
+
_preact.h.call(void 0, "div", { class: "markloom-bb-swatches markloom-bb-font-row", key: "cs" }, FONT_COLORS.map((c) => {
|
|
4217
4217
|
const on = c.value === null ? !curColor : curColor === c.value;
|
|
4218
4218
|
return _preact.h.call(void 0, "button", {
|
|
4219
4219
|
key: c.title,
|
|
4220
4220
|
type: "button",
|
|
4221
|
-
class: "
|
|
4221
|
+
class: "markloom-bb-font-a" + (on ? " is-on" : ""),
|
|
4222
4222
|
title: c.title,
|
|
4223
4223
|
style: { color: c.swatch },
|
|
4224
4224
|
onMouseDown: (e) => {
|
|
@@ -4232,13 +4232,13 @@ var BubbleMenu = (_class2 = class {
|
|
|
4232
4232
|
}
|
|
4233
4233
|
}, "A");
|
|
4234
4234
|
})),
|
|
4235
|
-
_preact.h.call(void 0, "div", { class: "
|
|
4236
|
-
_preact.h.call(void 0, "div", { class: "
|
|
4235
|
+
_preact.h.call(void 0, "div", { class: "markloom-bb-color-sec", key: "ht" }, "\u80CC\u666F\u989C\u8272"),
|
|
4236
|
+
_preact.h.call(void 0, "div", { class: "markloom-bb-swatches markloom-bb-bg-row", key: "hs" }, BG_COLORS.map((c) => {
|
|
4237
4237
|
const on = c.value === null ? !curBg && !active2.has("highlight") : curBg === c.value;
|
|
4238
4238
|
return _preact.h.call(void 0, "button", {
|
|
4239
4239
|
key: c.title,
|
|
4240
4240
|
type: "button",
|
|
4241
|
-
class: "
|
|
4241
|
+
class: "markloom-bb-swatch" + (c.none ? " markloom-bb-swatch-none" : "") + (on ? " is-on" : ""),
|
|
4242
4242
|
"data-edge": c.edge ? "" : void 0,
|
|
4243
4243
|
title: c.title,
|
|
4244
4244
|
style: c.none ? void 0 : { background: c.swatch },
|
|
@@ -4264,7 +4264,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
4264
4264
|
_preact.h.call(void 0, "button", {
|
|
4265
4265
|
key: "reset",
|
|
4266
4266
|
type: "button",
|
|
4267
|
-
class: "
|
|
4267
|
+
class: "markloom-bb-reset",
|
|
4268
4268
|
onMouseDown: (e) => {
|
|
4269
4269
|
e.preventDefault();
|
|
4270
4270
|
const cur = this.host.markSel();
|
|
@@ -4287,25 +4287,25 @@ var BubbleMenu = (_class2 = class {
|
|
|
4287
4287
|
const aiContinueBtn = this.host.openAi ? _preact.h.call(void 0, "button", {
|
|
4288
4288
|
"key": "ai-continue",
|
|
4289
4289
|
"type": "button",
|
|
4290
|
-
"class": "
|
|
4290
|
+
"class": "markloom-bb-ai",
|
|
4291
4291
|
"data-ai": "continue",
|
|
4292
4292
|
"title": "AI \u7EED\u5199",
|
|
4293
4293
|
"onMouseDown": (e) => {
|
|
4294
4294
|
e.preventDefault();
|
|
4295
4295
|
_optionalChain([this, 'access', _131 => _131.host, 'access', _132 => _132.openAi, 'optionalCall', _133 => _133("continue")]);
|
|
4296
4296
|
}
|
|
4297
|
-
}, [icon("sparkles", 16), _preact.h.call(void 0, "span", { class: "
|
|
4297
|
+
}, [icon("sparkles", 16), _preact.h.call(void 0, "span", { class: "markloom-bb-ai-lab", key: "l" }, "\u7EED\u5199"), tipNode("AI \u7EED\u5199")]) : null;
|
|
4298
4298
|
const aiRewriteBtn = this.host.openAi ? _preact.h.call(void 0, "button", {
|
|
4299
4299
|
"key": "ai-rewrite",
|
|
4300
4300
|
"type": "button",
|
|
4301
|
-
"class": "
|
|
4301
|
+
"class": "markloom-bb-ai",
|
|
4302
4302
|
"data-ai": "rewrite",
|
|
4303
4303
|
"title": "AI \u6539\u5199",
|
|
4304
4304
|
"onMouseDown": (e) => {
|
|
4305
4305
|
e.preventDefault();
|
|
4306
4306
|
_optionalChain([this, 'access', _134 => _134.host, 'access', _135 => _135.openAi, 'optionalCall', _136 => _136("rewrite")]);
|
|
4307
4307
|
}
|
|
4308
|
-
}, [icon("pen-line", 16), _preact.h.call(void 0, "span", { class: "
|
|
4308
|
+
}, [icon("pen-line", 16), _preact.h.call(void 0, "span", { class: "markloom-bb-ai-lab", key: "l" }, "\u6539\u5199"), tipNode("AI \u6539\u5199")]) : null;
|
|
4309
4309
|
const commentBtn = this.host.beginComment ? _preact.h.call(void 0, "button", {
|
|
4310
4310
|
"key": "comment",
|
|
4311
4311
|
"type": "button",
|
|
@@ -4318,9 +4318,9 @@ var BubbleMenu = (_class2 = class {
|
|
|
4318
4318
|
}, [icon("message-circle", 16), tipNode("\u8BC4\u8BBA")]) : null;
|
|
4319
4319
|
_preact.render.call(void 0,
|
|
4320
4320
|
_preact.h.call(void 0, "div", {
|
|
4321
|
-
class: "
|
|
4321
|
+
class: "markloom-bubble" + (settled ? " is-in" : "")
|
|
4322
4322
|
}, [
|
|
4323
|
-
_preact.h.call(void 0, "div", { class: "
|
|
4323
|
+
_preact.h.call(void 0, "div", { class: "markloom-bb-row", key: "row" }, [
|
|
4324
4324
|
this.hoverWrap("block", blockBtn, blockMenu),
|
|
4325
4325
|
sep("s0"),
|
|
4326
4326
|
this.hoverWrap("align", alignBtn, alignMenu),
|
|
@@ -4336,7 +4336,7 @@ var BubbleMenu = (_class2 = class {
|
|
|
4336
4336
|
]),
|
|
4337
4337
|
this.overlay
|
|
4338
4338
|
);
|
|
4339
|
-
const el = this.overlay.querySelector(".
|
|
4339
|
+
const el = this.overlay.querySelector(".markloom-bubble");
|
|
4340
4340
|
if (el) {
|
|
4341
4341
|
if (settled)
|
|
4342
4342
|
el.classList.add("is-in");
|
|
@@ -4409,7 +4409,7 @@ var CodeControls = (_class3 = class {
|
|
|
4409
4409
|
return;
|
|
4410
4410
|
}
|
|
4411
4411
|
this.menu = document.createElement("div");
|
|
4412
|
-
this.menu.className = "
|
|
4412
|
+
this.menu.className = "markloom-code-lang-menu";
|
|
4413
4413
|
this.menu.style.cssText = "position:fixed;z-index:1000";
|
|
4414
4414
|
for (const opt of ["\u7EAF\u6587\u672C", ...this.host.langs()]) {
|
|
4415
4415
|
const item = document.createElement("button");
|
|
@@ -4481,7 +4481,7 @@ var DragHandle = (_class4 = class {
|
|
|
4481
4481
|
this.root = root;
|
|
4482
4482
|
this.host = host;
|
|
4483
4483
|
this.overlay = document.createElement("div");
|
|
4484
|
-
this.overlay.className = "
|
|
4484
|
+
this.overlay.className = "markloom-drag-overlay";
|
|
4485
4485
|
document.body.appendChild(this.overlay);
|
|
4486
4486
|
document.addEventListener("mousemove", this.onHover);
|
|
4487
4487
|
window.addEventListener("scroll", this.onLeave, true);
|
|
@@ -4495,7 +4495,7 @@ var DragHandle = (_class4 = class {
|
|
|
4495
4495
|
this.overlay.remove();
|
|
4496
4496
|
}
|
|
4497
4497
|
blocks() {
|
|
4498
|
-
return
|
|
4498
|
+
return _chunkLNSKDJMFcjs.elementChildren.call(void 0, _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root));
|
|
4499
4499
|
}
|
|
4500
4500
|
clearLeave() {
|
|
4501
4501
|
if (this.leaveTimer != null) {
|
|
@@ -4684,12 +4684,12 @@ var DragHandle = (_class4 = class {
|
|
|
4684
4684
|
dropLine() {
|
|
4685
4685
|
if (!this.drag)
|
|
4686
4686
|
return null;
|
|
4687
|
-
const docEl =
|
|
4687
|
+
const docEl = _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root);
|
|
4688
4688
|
const blocks = this.blocks();
|
|
4689
4689
|
const gap = this.drag.gap;
|
|
4690
4690
|
const y = gap === 0 ? _nullishCoalesce(_optionalChain([blocks, 'access', _164 => _164[0], 'optionalAccess', _165 => _165.getBoundingClientRect, 'call', _166 => _166(), 'access', _167 => _167.top]), () => ( 0)) : _nullishCoalesce(_optionalChain([blocks, 'access', _168 => _168[gap - 1], 'optionalAccess', _169 => _169.getBoundingClientRect, 'call', _170 => _170(), 'access', _171 => _171.bottom]), () => ( 0));
|
|
4691
4691
|
const box = docEl.getBoundingClientRect();
|
|
4692
|
-
return _preact.h.call(void 0, "div", { key: "drop", class: "
|
|
4692
|
+
return _preact.h.call(void 0, "div", { key: "drop", class: "markloom-drag-drop", style: `top:${y}px;left:${box.left}px;width:${box.width}px` });
|
|
4693
4693
|
}
|
|
4694
4694
|
gripSvg() {
|
|
4695
4695
|
return _preact.h.call(void 0, "svg", {
|
|
@@ -4727,7 +4727,7 @@ var DragHandle = (_class4 = class {
|
|
|
4727
4727
|
const typeRow = TYPE_ITEMS.map((it) => _preact.h.call(void 0, "button", {
|
|
4728
4728
|
key: it.kind,
|
|
4729
4729
|
type: "button",
|
|
4730
|
-
class: "
|
|
4730
|
+
class: "markloom-block-menu-btn" + (kind === it.kind ? " is-on" : ""),
|
|
4731
4731
|
title: it.title,
|
|
4732
4732
|
"data-block-kind": it.kind,
|
|
4733
4733
|
onMouseDown: (e) => {
|
|
@@ -4739,7 +4739,7 @@ var DragHandle = (_class4 = class {
|
|
|
4739
4739
|
const markRow = MARK_ITEMS2.map((it) => _preact.h.call(void 0, "button", {
|
|
4740
4740
|
key: it.name,
|
|
4741
4741
|
type: "button",
|
|
4742
|
-
class: "
|
|
4742
|
+
class: "markloom-block-menu-btn markloom-block-menu-mark",
|
|
4743
4743
|
title: it.title,
|
|
4744
4744
|
"data-mark": it.name,
|
|
4745
4745
|
onMouseDown: (e) => {
|
|
@@ -4751,7 +4751,7 @@ var DragHandle = (_class4 = class {
|
|
|
4751
4751
|
const colorRow = COLORS.map((c, i) => _preact.h.call(void 0, "button", {
|
|
4752
4752
|
key: `c${i}`,
|
|
4753
4753
|
type: "button",
|
|
4754
|
-
class: "
|
|
4754
|
+
class: "markloom-block-menu-swatch",
|
|
4755
4755
|
title: c.title,
|
|
4756
4756
|
style: `background:${c.swatch}`,
|
|
4757
4757
|
onMouseDown: (e) => {
|
|
@@ -4767,7 +4767,7 @@ var DragHandle = (_class4 = class {
|
|
|
4767
4767
|
].map((a) => _preact.h.call(void 0, "button", {
|
|
4768
4768
|
key: a.v,
|
|
4769
4769
|
type: "button",
|
|
4770
|
-
class: "
|
|
4770
|
+
class: "markloom-block-menu-btn",
|
|
4771
4771
|
title: a.title,
|
|
4772
4772
|
"data-align": a.v,
|
|
4773
4773
|
onMouseDown: (e) => {
|
|
@@ -4778,16 +4778,16 @@ var DragHandle = (_class4 = class {
|
|
|
4778
4778
|
}, icon(a.ico, 14)));
|
|
4779
4779
|
return _preact.h.call(void 0, "div", {
|
|
4780
4780
|
key: "menu",
|
|
4781
|
-
class: "
|
|
4781
|
+
class: "markloom-block-menu",
|
|
4782
4782
|
onMouseEnter: this.keepMenu,
|
|
4783
4783
|
onMouseLeave: this.scheduleCloseMenu
|
|
4784
4784
|
}, [
|
|
4785
|
-
_preact.h.call(void 0, "div", { key: "types", class: "
|
|
4786
|
-
_preact.h.call(void 0, "div", { key: "sep1", class: "
|
|
4787
|
-
_preact.h.call(void 0, "div", { key: "marks", class: "
|
|
4788
|
-
_preact.h.call(void 0, "div", { key: "colors", class: "
|
|
4789
|
-
_preact.h.call(void 0, "div", { key: "sep2", class: "
|
|
4790
|
-
_preact.h.call(void 0, "div", { key: "align", class: "
|
|
4785
|
+
_preact.h.call(void 0, "div", { key: "types", class: "markloom-block-menu-row" }, typeRow),
|
|
4786
|
+
_preact.h.call(void 0, "div", { key: "sep1", class: "markloom-block-menu-sep" }),
|
|
4787
|
+
_preact.h.call(void 0, "div", { key: "marks", class: "markloom-block-menu-row" }, markRow),
|
|
4788
|
+
_preact.h.call(void 0, "div", { key: "colors", class: "markloom-block-menu-row markloom-block-menu-colors" }, colorRow),
|
|
4789
|
+
_preact.h.call(void 0, "div", { key: "sep2", class: "markloom-block-menu-sep" }),
|
|
4790
|
+
_preact.h.call(void 0, "div", { key: "align", class: "markloom-block-menu-row" }, alignRow)
|
|
4791
4791
|
]);
|
|
4792
4792
|
}
|
|
4793
4793
|
paint() {
|
|
@@ -4802,7 +4802,7 @@ var DragHandle = (_class4 = class {
|
|
|
4802
4802
|
if (el) {
|
|
4803
4803
|
const r = el.getBoundingClientRect();
|
|
4804
4804
|
const depth = el.getAttribute("data-heading-depth");
|
|
4805
|
-
const isHeading = el.classList.contains("
|
|
4805
|
+
const isHeading = el.classList.contains("markloom-heading") && !!depth;
|
|
4806
4806
|
const collapsed = el.getAttribute("data-collapsed") === "true";
|
|
4807
4807
|
const BAR_H = 22;
|
|
4808
4808
|
const cs = getComputedStyle(el);
|
|
@@ -4814,7 +4814,7 @@ var DragHandle = (_class4 = class {
|
|
|
4814
4814
|
const barRight = r.left - 4;
|
|
4815
4815
|
children.push(_preact.h.call(void 0, "div", {
|
|
4816
4816
|
key: "hit",
|
|
4817
|
-
class: "
|
|
4817
|
+
class: "markloom-drag-hit",
|
|
4818
4818
|
style: `top:${r.top}px;left:${r.left - GUTTER}px;width:${GUTTER}px;height:${hitH}px`
|
|
4819
4819
|
}));
|
|
4820
4820
|
const dragDown = (e) => {
|
|
@@ -4827,7 +4827,7 @@ var DragHandle = (_class4 = class {
|
|
|
4827
4827
|
items.push(_preact.h.call(void 0, "button", {
|
|
4828
4828
|
key: "kind",
|
|
4829
4829
|
type: "button",
|
|
4830
|
-
class: "
|
|
4830
|
+
class: "markloom-block-kind" + (kindOn ? " is-on" : ""),
|
|
4831
4831
|
title: "\u62D6\u62FD\u79FB\u52A8 \xB7 \u60AC\u505C\u683C\u5F0F",
|
|
4832
4832
|
onMouseDown: dragDown,
|
|
4833
4833
|
onMouseEnter: this.keepMenu
|
|
@@ -4836,7 +4836,7 @@ var DragHandle = (_class4 = class {
|
|
|
4836
4836
|
items.push(_preact.h.call(void 0, "button", {
|
|
4837
4837
|
key: "add",
|
|
4838
4838
|
type: "button",
|
|
4839
|
-
class: "
|
|
4839
|
+
class: "markloom-add-handle",
|
|
4840
4840
|
title: "\u63D2\u5165\u5185\u5BB9",
|
|
4841
4841
|
onMouseDown: (e) => {
|
|
4842
4842
|
e.preventDefault();
|
|
@@ -4852,7 +4852,7 @@ var DragHandle = (_class4 = class {
|
|
|
4852
4852
|
items.push(_preact.h.call(void 0, "button", {
|
|
4853
4853
|
key: "handle",
|
|
4854
4854
|
type: "button",
|
|
4855
|
-
class: "
|
|
4855
|
+
class: "markloom-drag-handle",
|
|
4856
4856
|
title: "\u62D6\u62FD\u79FB\u52A8 \xB7 \u60AC\u505C\u683C\u5F0F",
|
|
4857
4857
|
onMouseDown: dragDown,
|
|
4858
4858
|
onMouseEnter: this.keepMenu
|
|
@@ -4861,7 +4861,7 @@ var DragHandle = (_class4 = class {
|
|
|
4861
4861
|
items.push(_preact.h.call(void 0, "button", {
|
|
4862
4862
|
key: "fold",
|
|
4863
4863
|
type: "button",
|
|
4864
|
-
class: "
|
|
4864
|
+
class: "markloom-heading-fold" + (collapsed ? " is-collapsed" : ""),
|
|
4865
4865
|
"data-heading-fold": "",
|
|
4866
4866
|
title: collapsed ? "\u5C55\u5F00" : "\u6298\u53E0",
|
|
4867
4867
|
"aria-expanded": collapsed ? "false" : "true",
|
|
@@ -4875,7 +4875,7 @@ var DragHandle = (_class4 = class {
|
|
|
4875
4875
|
}
|
|
4876
4876
|
children.push(_preact.h.call(void 0, "div", {
|
|
4877
4877
|
key: "bar",
|
|
4878
|
-
class: "
|
|
4878
|
+
class: "markloom-block-bar",
|
|
4879
4879
|
style: `top:${y}px;left:${barRight}px;transform:translateX(-100%)`,
|
|
4880
4880
|
onMouseEnter: this.keepMenu,
|
|
4881
4881
|
onMouseLeave: this.scheduleCloseMenu
|
|
@@ -4889,8 +4889,8 @@ var DragHandle = (_class4 = class {
|
|
|
4889
4889
|
}
|
|
4890
4890
|
_preact.render.call(void 0, _preact.h.call(void 0, "div", null, children), this.overlay);
|
|
4891
4891
|
if (this.menuOpen) {
|
|
4892
|
-
const bar = this.overlay.querySelector(".
|
|
4893
|
-
const menu = this.overlay.querySelector(".
|
|
4892
|
+
const bar = this.overlay.querySelector(".markloom-block-bar");
|
|
4893
|
+
const menu = this.overlay.querySelector(".markloom-block-menu");
|
|
4894
4894
|
if (bar && menu)
|
|
4895
4895
|
void place(bar, menu, { placement: "bottom-end", gap: 4 });
|
|
4896
4896
|
}
|
|
@@ -4941,11 +4941,11 @@ var ICON_PATHS = {
|
|
|
4941
4941
|
};
|
|
4942
4942
|
function iconNode(name) {
|
|
4943
4943
|
if (name === "h1" || name === "h2" || name === "h3")
|
|
4944
|
-
return _preact.h.call(void 0, "span", { class: "
|
|
4944
|
+
return _preact.h.call(void 0, "span", { class: "markloom-slash-icon markloom-slash-htxt" }, [_preact.h.call(void 0, "span", {}, "H"), _preact.h.call(void 0, "sub", {}, name[1])]);
|
|
4945
4945
|
const paths = _nullishCoalesce(ICON_PATHS[name], () => ( []));
|
|
4946
4946
|
return _preact.h.call(void 0,
|
|
4947
4947
|
"svg",
|
|
4948
|
-
{ class: "
|
|
4948
|
+
{ 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
4949
|
paths.map((d, i) => _preact.h.call(void 0, "path", { key: i, d }))
|
|
4950
4950
|
);
|
|
4951
4951
|
}
|
|
@@ -4962,14 +4962,14 @@ var SlashMenu = (_class5 = class {
|
|
|
4962
4962
|
this.root = root;
|
|
4963
4963
|
this.host = host;
|
|
4964
4964
|
this.overlay = document.createElement("div");
|
|
4965
|
-
this.overlay.className = "
|
|
4965
|
+
this.overlay.className = "markloom-slash-overlay";
|
|
4966
4966
|
document.body.appendChild(this.overlay);
|
|
4967
|
-
root.addEventListener("
|
|
4967
|
+
root.addEventListener("markloom-redraw", this.reevaluate);
|
|
4968
4968
|
document.addEventListener("selectionchange", this.reevaluate);
|
|
4969
4969
|
root.addEventListener("keydown", this.onKeyDown, true);
|
|
4970
4970
|
}
|
|
4971
4971
|
destroy() {
|
|
4972
|
-
this.root.removeEventListener("
|
|
4972
|
+
this.root.removeEventListener("markloom-redraw", this.reevaluate);
|
|
4973
4973
|
document.removeEventListener("selectionchange", this.reevaluate);
|
|
4974
4974
|
this.root.removeEventListener("keydown", this.onKeyDown, true);
|
|
4975
4975
|
this.close();
|
|
@@ -5117,7 +5117,7 @@ var SlashMenu = (_class5 = class {
|
|
|
5117
5117
|
let prev = null;
|
|
5118
5118
|
list.forEach((it, i) => {
|
|
5119
5119
|
if (it.section !== prev) {
|
|
5120
|
-
rows.push(_preact.h.call(void 0, "div", { key: `h-${it.section}`, class: "
|
|
5120
|
+
rows.push(_preact.h.call(void 0, "div", { key: `h-${it.section}`, class: "markloom-slash-section" }, it.section));
|
|
5121
5121
|
prev = it.section;
|
|
5122
5122
|
}
|
|
5123
5123
|
rows.push(_preact.h.call(void 0, "button", {
|
|
@@ -5128,13 +5128,13 @@ var SlashMenu = (_class5 = class {
|
|
|
5128
5128
|
e.preventDefault();
|
|
5129
5129
|
this.apply(it);
|
|
5130
5130
|
}
|
|
5131
|
-
}, [iconNode(it.icon), _preact.h.call(void 0, "span", { class: "
|
|
5131
|
+
}, [iconNode(it.icon), _preact.h.call(void 0, "span", { class: "markloom-slash-label" }, it.label)]));
|
|
5132
5132
|
});
|
|
5133
5133
|
_preact.render.call(void 0,
|
|
5134
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5134
|
+
_preact.h.call(void 0, "div", { class: "markloom-slash" }, rows),
|
|
5135
5135
|
this.overlay
|
|
5136
5136
|
);
|
|
5137
|
-
const el = this.overlay.querySelector(".
|
|
5137
|
+
const el = this.overlay.querySelector(".markloom-slash");
|
|
5138
5138
|
if (el)
|
|
5139
5139
|
void place(rectRef(rect), el, { placement: "bottom-start", gap: 6 });
|
|
5140
5140
|
}
|
|
@@ -5327,12 +5327,12 @@ var linkMark = {
|
|
|
5327
5327
|
tag: "a",
|
|
5328
5328
|
props: (mark) => {
|
|
5329
5329
|
if (!_optionalChain([mark, 'access', _191 => _191.attrs, 'optionalAccess', _192 => _192.url]))
|
|
5330
|
-
return { "data-mark": "link", class: "
|
|
5330
|
+
return { "data-mark": "link", class: "markloom-link" };
|
|
5331
5331
|
const url = String(mark.attrs.url);
|
|
5332
5332
|
return {
|
|
5333
5333
|
href: url,
|
|
5334
5334
|
"data-mark": "link",
|
|
5335
|
-
class: "
|
|
5335
|
+
class: "markloom-link",
|
|
5336
5336
|
rel: "noopener noreferrer",
|
|
5337
5337
|
title: url
|
|
5338
5338
|
};
|
|
@@ -5363,7 +5363,7 @@ var textStyleMark = {
|
|
|
5363
5363
|
var markExtensions = [boldMark, italicMark, codeMark, strikeMark, underlineMark, highlightMark, superscriptMark, subscriptMark, linkMark, textStyleMark];
|
|
5364
5364
|
|
|
5365
5365
|
// src/view/kit.ts
|
|
5366
|
-
function
|
|
5366
|
+
function markloomKit() {
|
|
5367
5367
|
return [...markExtensions, ...blockExtensions, inputRules, textAlign, history, ...decorationExtensions];
|
|
5368
5368
|
}
|
|
5369
5369
|
|
|
@@ -5385,7 +5385,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5385
5385
|
this.threads = initial.slice();
|
|
5386
5386
|
this.scrollRoot = _nullishCoalesce(findScrollParent(host.root), () => ( document.body));
|
|
5387
5387
|
this.overlay = document.createElement("div");
|
|
5388
|
-
this.overlay.className = "
|
|
5388
|
+
this.overlay.className = "markloom-comment-overlay";
|
|
5389
5389
|
this.scrollRoot.appendChild(this.overlay);
|
|
5390
5390
|
host.root.addEventListener("click", this.onRootClick);
|
|
5391
5391
|
document.addEventListener("keydown", this.onKey);
|
|
@@ -5400,8 +5400,8 @@ var CommentPanel = (_class6 = class {
|
|
|
5400
5400
|
window.removeEventListener("resize", this.onReflow);
|
|
5401
5401
|
_preact.render.call(void 0, null, this.overlay);
|
|
5402
5402
|
this.overlay.remove();
|
|
5403
|
-
this.scrollRoot.classList.remove("
|
|
5404
|
-
document.documentElement.classList.remove("
|
|
5403
|
+
this.scrollRoot.classList.remove("markloom-comment-rail-open");
|
|
5404
|
+
document.documentElement.classList.remove("markloom-comment-rail-open");
|
|
5405
5405
|
}
|
|
5406
5406
|
getThreads() {
|
|
5407
5407
|
return this.threads;
|
|
@@ -5515,7 +5515,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5515
5515
|
reply() {
|
|
5516
5516
|
if (this.mode.kind !== "view")
|
|
5517
5517
|
return;
|
|
5518
|
-
const ta = this.overlay.querySelector(`[data-thread="${cssEscape(this.mode.id)}"] .
|
|
5518
|
+
const ta = this.overlay.querySelector(`[data-thread="${cssEscape(this.mode.id)}"] .markloom-comment-reply textarea`);
|
|
5519
5519
|
const body = (_nullishCoalesce(_optionalChain([ta, 'optionalAccess', _203 => _203.value]), () => ( this.mode.reply))).trim();
|
|
5520
5520
|
if (!body)
|
|
5521
5521
|
return;
|
|
@@ -5557,7 +5557,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5557
5557
|
}
|
|
5558
5558
|
/** 卡片 top(相对 rail-body)。正文与栏共滚 → viewport 差即内容坐标。 */
|
|
5559
5559
|
cardTops(ids, composeTop) {
|
|
5560
|
-
const body = this.overlay.querySelector(".
|
|
5560
|
+
const body = this.overlay.querySelector(".markloom-comment-rail-body");
|
|
5561
5561
|
const bodyTop = _nullishCoalesce(_optionalChain([body, 'optionalAccess', _204 => _204.getBoundingClientRect, 'call', _205 => _205(), 'access', _206 => _206.top]), () => ( 0));
|
|
5562
5562
|
const raw = ids.map((id) => {
|
|
5563
5563
|
const el = this.host.root.querySelector(`[data-comment-id="${cssEscape(id)}"]`);
|
|
@@ -5577,11 +5577,11 @@ var CommentPanel = (_class6 = class {
|
|
|
5577
5577
|
return out;
|
|
5578
5578
|
}
|
|
5579
5579
|
reflowAfterPaint() {
|
|
5580
|
-
const rail = this.overlay.querySelector(".
|
|
5581
|
-
const body = this.overlay.querySelector(".
|
|
5580
|
+
const rail = this.overlay.querySelector(".markloom-comment-rail");
|
|
5581
|
+
const body = this.overlay.querySelector(".markloom-comment-rail-body");
|
|
5582
5582
|
if (!body)
|
|
5583
5583
|
return;
|
|
5584
|
-
const cards = [...body.querySelectorAll(".
|
|
5584
|
+
const cards = [...body.querySelectorAll(".markloom-comment-card")];
|
|
5585
5585
|
cards.sort((a, b) => (parseFloat(a.style.top) || 0) - (parseFloat(b.style.top) || 0));
|
|
5586
5586
|
let floor2 = 0;
|
|
5587
5587
|
let maxBottom = 0;
|
|
@@ -5596,7 +5596,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5596
5596
|
body.style.minHeight = `${Math.max(maxBottom + RAIL_PAD, 0)}px`;
|
|
5597
5597
|
if (rail) {
|
|
5598
5598
|
const sp = this.scrollRoot;
|
|
5599
|
-
const hd = rail.querySelector(".
|
|
5599
|
+
const hd = rail.querySelector(".markloom-comment-rail-hd");
|
|
5600
5600
|
const hdH = _nullishCoalesce(_optionalChain([hd, 'optionalAccess', _207 => _207.offsetHeight]), () => ( 52));
|
|
5601
5601
|
const need = Math.max(sp.scrollHeight, sp.clientHeight, maxBottom + hdH + RAIL_PAD);
|
|
5602
5602
|
rail.style.minHeight = `${need}px`;
|
|
@@ -5604,7 +5604,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5604
5604
|
}
|
|
5605
5605
|
paint() {
|
|
5606
5606
|
const open = this.mode.kind !== "closed";
|
|
5607
|
-
this.scrollRoot.classList.toggle("
|
|
5607
|
+
this.scrollRoot.classList.toggle("markloom-comment-rail-open", open);
|
|
5608
5608
|
if (!open) {
|
|
5609
5609
|
_preact.render.call(void 0, null, this.overlay);
|
|
5610
5610
|
return;
|
|
@@ -5621,20 +5621,20 @@ var CommentPanel = (_class6 = class {
|
|
|
5621
5621
|
const author = this.host.author();
|
|
5622
5622
|
_preact.render.call(void 0,
|
|
5623
5623
|
_preact.h.call(void 0, "aside", {
|
|
5624
|
-
class: "
|
|
5624
|
+
class: "markloom-comment-rail",
|
|
5625
5625
|
"data-comment-rail": "",
|
|
5626
5626
|
"aria-label": "\u8BC4\u8BBA"
|
|
5627
5627
|
}, [
|
|
5628
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5628
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-rail-hd", key: "hd" }, [
|
|
5629
5629
|
_preact.h.call(void 0,
|
|
5630
5630
|
"div",
|
|
5631
|
-
{ class: "
|
|
5631
|
+
{ class: "markloom-comment-rail-title", key: "t" },
|
|
5632
5632
|
`\u8BC4\u8BBA (${openCount})`
|
|
5633
5633
|
),
|
|
5634
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5634
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-rail-acts", key: "a" }, [
|
|
5635
5635
|
_preact.h.call(void 0, "button", {
|
|
5636
5636
|
type: "button",
|
|
5637
|
-
class: "
|
|
5637
|
+
class: "markloom-comment-icon" + (this.showResolved ? " markloom-comment-icon-on" : ""),
|
|
5638
5638
|
title: this.showResolved ? "\u53EA\u770B\u672A\u89E3\u51B3" : "\u663E\u793A\u5DF2\u89E3\u51B3",
|
|
5639
5639
|
"data-act": "filter",
|
|
5640
5640
|
onMouseDown: (e) => {
|
|
@@ -5645,7 +5645,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5645
5645
|
}, this.showResolved ? "\u5168" : "\u5F00"),
|
|
5646
5646
|
_preact.h.call(void 0, "button", {
|
|
5647
5647
|
type: "button",
|
|
5648
|
-
class: "
|
|
5648
|
+
class: "markloom-comment-icon",
|
|
5649
5649
|
title: "\u6536\u8D77",
|
|
5650
5650
|
"data-act": "close",
|
|
5651
5651
|
onMouseDown: (e) => {
|
|
@@ -5655,21 +5655,21 @@ var CommentPanel = (_class6 = class {
|
|
|
5655
5655
|
}, "\xBB")
|
|
5656
5656
|
])
|
|
5657
5657
|
]),
|
|
5658
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5658
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-rail-body", key: "body" }, [
|
|
5659
5659
|
composing && this.mode.kind === "compose" && _preact.h.call(void 0, "div", {
|
|
5660
|
-
class: "
|
|
5660
|
+
class: "markloom-comment-card markloom-comment-card-compose",
|
|
5661
5661
|
key: "compose",
|
|
5662
5662
|
"data-comment-ui": "compose",
|
|
5663
5663
|
style: { top: `${_nullishCoalesce(tops.get("__compose__"), () => ( 0))}px` }
|
|
5664
5664
|
}, [
|
|
5665
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5666
|
-
this.mode.quote ? _preact.h.call(void 0, "div", { class: "
|
|
5667
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5665
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-accent", key: "ac" }),
|
|
5666
|
+
this.mode.quote ? _preact.h.call(void 0, "div", { class: "markloom-comment-quote", key: "q" }, this.mode.quote) : null,
|
|
5667
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-msg", key: "who" }, [
|
|
5668
5668
|
avatar(author),
|
|
5669
|
-
_preact.h.call(void 0, "span", { class: "
|
|
5669
|
+
_preact.h.call(void 0, "span", { class: "markloom-comment-author" }, author.name)
|
|
5670
5670
|
]),
|
|
5671
5671
|
_preact.h.call(void 0, "textarea", {
|
|
5672
|
-
class: "
|
|
5672
|
+
class: "markloom-comment-input",
|
|
5673
5673
|
placeholder: "\u6DFB\u52A0\u8BC4\u8BBA\u2026",
|
|
5674
5674
|
defaultValue: this.mode.body,
|
|
5675
5675
|
autofocus: true,
|
|
@@ -5681,10 +5681,10 @@ var CommentPanel = (_class6 = class {
|
|
|
5681
5681
|
}
|
|
5682
5682
|
}
|
|
5683
5683
|
}),
|
|
5684
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5684
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-card-ft", key: "ft" }, [
|
|
5685
5685
|
_preact.h.call(void 0, "button", {
|
|
5686
5686
|
type: "button",
|
|
5687
|
-
class: "
|
|
5687
|
+
class: "markloom-comment-btn-ghost",
|
|
5688
5688
|
onMouseDown: (e) => {
|
|
5689
5689
|
e.preventDefault();
|
|
5690
5690
|
if (this.threads.length)
|
|
@@ -5695,7 +5695,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5695
5695
|
}, "\u53D6\u6D88"),
|
|
5696
5696
|
_preact.h.call(void 0, "button", {
|
|
5697
5697
|
type: "button",
|
|
5698
|
-
class: "
|
|
5698
|
+
class: "markloom-comment-btn",
|
|
5699
5699
|
onMouseDown: (e) => {
|
|
5700
5700
|
e.preventDefault();
|
|
5701
5701
|
this.submitCompose();
|
|
@@ -5705,7 +5705,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5705
5705
|
]),
|
|
5706
5706
|
...threads.map((t) => this.threadCard(t, t.id === viewId, ro, _nullishCoalesce(tops.get(t.id), () => ( 0)))),
|
|
5707
5707
|
!composing && !threads.length && _preact.h.call(void 0, "div", {
|
|
5708
|
-
class: "
|
|
5708
|
+
class: "markloom-comment-empty",
|
|
5709
5709
|
key: "empty",
|
|
5710
5710
|
style: { top: "24px" }
|
|
5711
5711
|
}, this.showResolved ? "\u6682\u65E0\u8BC4\u8BBA" : "\u6682\u65E0\u672A\u89E3\u51B3\u8BC4\u8BBA")
|
|
@@ -5726,7 +5726,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5726
5726
|
const head = thread.messages[0];
|
|
5727
5727
|
const n = thread.messages.length;
|
|
5728
5728
|
return _preact.h.call(void 0, "div", {
|
|
5729
|
-
class: "
|
|
5729
|
+
class: "markloom-comment-card" + (thread.resolved ? " markloom-comment-card-resolved" : "") + (expanded ? " markloom-comment-card-active" : ""),
|
|
5730
5730
|
key: thread.id,
|
|
5731
5731
|
"data-comment-ui": expanded ? "view" : "item",
|
|
5732
5732
|
"data-thread": thread.id,
|
|
@@ -5738,13 +5738,13 @@ var CommentPanel = (_class6 = class {
|
|
|
5738
5738
|
this.openThread(thread.id);
|
|
5739
5739
|
}
|
|
5740
5740
|
}, [
|
|
5741
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5742
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5743
|
-
quote ? _preact.h.call(void 0, "div", { class: "
|
|
5744
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5741
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-accent", key: "ac" }),
|
|
5742
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-card-hd", key: "hd" }, [
|
|
5743
|
+
quote ? _preact.h.call(void 0, "div", { class: "markloom-comment-quote", key: "q" }, quote) : _preact.h.call(void 0, "span", { key: "t" }, thread.resolved ? "\u5DF2\u89E3\u51B3" : "\u8BC4\u8BBA"),
|
|
5744
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-card-acts", key: "a" }, [
|
|
5745
5745
|
!ro && _preact.h.call(void 0, "button", {
|
|
5746
5746
|
type: "button",
|
|
5747
|
-
class: "
|
|
5747
|
+
class: "markloom-comment-icon",
|
|
5748
5748
|
title: thread.resolved ? "\u91CD\u65B0\u6253\u5F00" : "\u89E3\u51B3",
|
|
5749
5749
|
"data-act": "resolve",
|
|
5750
5750
|
onMouseDown: (e) => {
|
|
@@ -5755,7 +5755,7 @@ var CommentPanel = (_class6 = class {
|
|
|
5755
5755
|
}, thread.resolved ? "\u21BA" : "\u2713"),
|
|
5756
5756
|
!ro && _preact.h.call(void 0, "button", {
|
|
5757
5757
|
type: "button",
|
|
5758
|
-
class: "
|
|
5758
|
+
class: "markloom-comment-icon",
|
|
5759
5759
|
title: "\u5220\u9664",
|
|
5760
5760
|
"data-act": "delete",
|
|
5761
5761
|
onMouseDown: (e) => {
|
|
@@ -5767,18 +5767,18 @@ var CommentPanel = (_class6 = class {
|
|
|
5767
5767
|
])
|
|
5768
5768
|
]),
|
|
5769
5769
|
// 折叠:只露主评
|
|
5770
|
-
!expanded && head && _preact.h.call(void 0, "div", { class: "
|
|
5770
|
+
!expanded && head && _preact.h.call(void 0, "div", { class: "markloom-comment-preview", key: "pv" }, [
|
|
5771
5771
|
msgRow(head),
|
|
5772
|
-
n > 1 && _preact.h.call(void 0, "div", { class: "
|
|
5772
|
+
n > 1 && _preact.h.call(void 0, "div", { class: "markloom-comment-more", key: "more" }, `${n - 1} \u6761\u56DE\u590D`)
|
|
5773
5773
|
]),
|
|
5774
5774
|
expanded && _preact.h.call(void 0,
|
|
5775
5775
|
"div",
|
|
5776
|
-
{ class: "
|
|
5776
|
+
{ class: "markloom-comment-msgs", key: "msgs" },
|
|
5777
5777
|
thread.messages.map((m) => msgRow(m))
|
|
5778
5778
|
),
|
|
5779
|
-
expanded && !ro && !thread.resolved && _preact.h.call(void 0, "div", { class: "
|
|
5779
|
+
expanded && !ro && !thread.resolved && _preact.h.call(void 0, "div", { class: "markloom-comment-reply", key: "rep" }, [
|
|
5780
5780
|
_preact.h.call(void 0, "textarea", {
|
|
5781
|
-
class: "
|
|
5781
|
+
class: "markloom-comment-input markloom-comment-input-sm",
|
|
5782
5782
|
placeholder: "\u56DE\u590D\u2026",
|
|
5783
5783
|
defaultValue: this.mode.kind === "view" && this.mode.id === thread.id ? this.mode.reply : "",
|
|
5784
5784
|
rows: 2,
|
|
@@ -5789,10 +5789,10 @@ var CommentPanel = (_class6 = class {
|
|
|
5789
5789
|
}
|
|
5790
5790
|
}
|
|
5791
5791
|
}),
|
|
5792
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5792
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-card-ft" }, [
|
|
5793
5793
|
_preact.h.call(void 0, "button", {
|
|
5794
5794
|
type: "button",
|
|
5795
|
-
class: "
|
|
5795
|
+
class: "markloom-comment-btn",
|
|
5796
5796
|
"data-act": "reply",
|
|
5797
5797
|
onMouseDown: (e) => {
|
|
5798
5798
|
e.preventDefault();
|
|
@@ -5807,18 +5807,18 @@ var CommentPanel = (_class6 = class {
|
|
|
5807
5807
|
function avatar(author) {
|
|
5808
5808
|
const initial = (author.name || "?").slice(0, 1);
|
|
5809
5809
|
if (author.avatar)
|
|
5810
|
-
return _preact.h.call(void 0, "img", { class: "
|
|
5811
|
-
return _preact.h.call(void 0, "div", { class: "
|
|
5810
|
+
return _preact.h.call(void 0, "img", { class: "markloom-comment-avatar", src: author.avatar, alt: "" });
|
|
5811
|
+
return _preact.h.call(void 0, "div", { class: "markloom-comment-avatar markloom-comment-avatar-fallback" }, initial);
|
|
5812
5812
|
}
|
|
5813
5813
|
function msgRow(m) {
|
|
5814
|
-
return _preact.h.call(void 0, "div", { class: "
|
|
5814
|
+
return _preact.h.call(void 0, "div", { class: "markloom-comment-msg", key: m.id }, [
|
|
5815
5815
|
avatar(m.author),
|
|
5816
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5817
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5818
|
-
_preact.h.call(void 0, "span", { class: "
|
|
5819
|
-
_preact.h.call(void 0, "span", { class: "
|
|
5816
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-msg-body" }, [
|
|
5817
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-msg-meta" }, [
|
|
5818
|
+
_preact.h.call(void 0, "span", { class: "markloom-comment-author" }, m.author.name),
|
|
5819
|
+
_preact.h.call(void 0, "span", { class: "markloom-comment-time" }, fmtTime(m.createdAt))
|
|
5820
5820
|
]),
|
|
5821
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5821
|
+
_preact.h.call(void 0, "div", { class: "markloom-comment-text" }, m.body)
|
|
5822
5822
|
])
|
|
5823
5823
|
]);
|
|
5824
5824
|
}
|
|
@@ -5867,9 +5867,9 @@ var TocPanel = (_class7 = class {
|
|
|
5867
5867
|
constructor(host) {;_class7.prototype.__init48.call(this);_class7.prototype.__init49.call(this);_class7.prototype.__init50.call(this);_class7.prototype.__init51.call(this);_class7.prototype.__init52.call(this);_class7.prototype.__init53.call(this);
|
|
5868
5868
|
this.host = host;
|
|
5869
5869
|
this.rail = document.createElement("div");
|
|
5870
|
-
this.rail.className = "
|
|
5870
|
+
this.rail.className = "markloom-toc-host";
|
|
5871
5871
|
document.body.appendChild(this.rail);
|
|
5872
|
-
host.root.addEventListener("
|
|
5872
|
+
host.root.addEventListener("markloom-redraw", this.onRedraw);
|
|
5873
5873
|
this.scrollRoot = _nullishCoalesce(findScrollParent2(host.root), () => ( window));
|
|
5874
5874
|
this.scrollRoot.addEventListener("scroll", this.onScroll, { passive: true, capture: true });
|
|
5875
5875
|
window.addEventListener("resize", this.onScroll);
|
|
@@ -5877,7 +5877,7 @@ var TocPanel = (_class7 = class {
|
|
|
5877
5877
|
this.refresh();
|
|
5878
5878
|
}
|
|
5879
5879
|
destroy() {
|
|
5880
|
-
this.host.root.removeEventListener("
|
|
5880
|
+
this.host.root.removeEventListener("markloom-redraw", this.onRedraw);
|
|
5881
5881
|
this.scrollRoot.removeEventListener("scroll", this.onScroll, { capture: true });
|
|
5882
5882
|
window.removeEventListener("resize", this.onScroll);
|
|
5883
5883
|
this.setPadOpen(false);
|
|
@@ -5892,9 +5892,9 @@ var TocPanel = (_class7 = class {
|
|
|
5892
5892
|
// 有滚动父 → 给滚动父加 padding(正文区);否则退回 html(lab 全页)
|
|
5893
5893
|
setPadOpen(open) {
|
|
5894
5894
|
const pad2 = this.scrollRoot instanceof HTMLElement ? this.scrollRoot : document.documentElement;
|
|
5895
|
-
pad2.classList.toggle("
|
|
5895
|
+
pad2.classList.toggle("markloom-toc-open", open);
|
|
5896
5896
|
if (pad2 !== document.documentElement)
|
|
5897
|
-
document.documentElement.classList.remove("
|
|
5897
|
+
document.documentElement.classList.remove("markloom-toc-open");
|
|
5898
5898
|
}
|
|
5899
5899
|
__init52() {this.onRedraw = () => this.refresh()}
|
|
5900
5900
|
refresh() {
|
|
@@ -5938,7 +5938,7 @@ var TocPanel = (_class7 = class {
|
|
|
5938
5938
|
if (byId)
|
|
5939
5939
|
return byId;
|
|
5940
5940
|
}
|
|
5941
|
-
const docEl = _nullishCoalesce(this.host.root.querySelector(".
|
|
5941
|
+
const docEl = _nullishCoalesce(this.host.root.querySelector(".markloom-doc"), () => ( this.host.root));
|
|
5942
5942
|
const kids = [...docEl.children].filter((c) => c instanceof HTMLElement && c.dataset.blockId !== void 0);
|
|
5943
5943
|
const idx = e.path[0];
|
|
5944
5944
|
return _nullishCoalesce(kids[idx], () => ( null));
|
|
@@ -5964,14 +5964,14 @@ var TocPanel = (_class7 = class {
|
|
|
5964
5964
|
minLv = 1;
|
|
5965
5965
|
_preact.render.call(void 0,
|
|
5966
5966
|
_preact.h.call(void 0, "aside", {
|
|
5967
|
-
class: "
|
|
5967
|
+
class: "markloom-toc-rail",
|
|
5968
5968
|
"data-toc-rail": "",
|
|
5969
5969
|
"aria-label": "\u76EE\u5F55"
|
|
5970
5970
|
}, [
|
|
5971
|
-
_preact.h.call(void 0, "div", { class: "
|
|
5971
|
+
_preact.h.call(void 0, "div", { class: "markloom-toc-hd", key: "hd" }, "\u76EE\u5F55"),
|
|
5972
5972
|
_preact.h.call(void 0,
|
|
5973
5973
|
"nav",
|
|
5974
|
-
{ class: "
|
|
5974
|
+
{ class: "markloom-toc-nav", key: "nav" },
|
|
5975
5975
|
items.length ? items.map((e, i) => {
|
|
5976
5976
|
const key = _nullishCoalesce(e.id, () => ( pathKey(e.path)));
|
|
5977
5977
|
const active2 = this.activeId === key;
|
|
@@ -5979,7 +5979,7 @@ var TocPanel = (_class7 = class {
|
|
|
5979
5979
|
return _preact.h.call(void 0, "button", {
|
|
5980
5980
|
key: `${key}-${i}`,
|
|
5981
5981
|
type: "button",
|
|
5982
|
-
class: "
|
|
5982
|
+
class: "markloom-toc-item" + (active2 ? " markloom-toc-item-active" : ""),
|
|
5983
5983
|
"data-level": String(e.level),
|
|
5984
5984
|
"data-active": active2 ? "" : void 0,
|
|
5985
5985
|
"data-toc-id": _nullishCoalesce(e.id, () => ( void 0)),
|
|
@@ -5990,7 +5990,7 @@ var TocPanel = (_class7 = class {
|
|
|
5990
5990
|
this.jump(e);
|
|
5991
5991
|
}
|
|
5992
5992
|
}, e.text || "\u672A\u547D\u540D\u6807\u9898");
|
|
5993
|
-
}) : _preact.h.call(void 0, "div", { class: "
|
|
5993
|
+
}) : _preact.h.call(void 0, "div", { class: "markloom-toc-empty", key: "empty" }, "\u6DFB\u52A0\u6807\u9898\u540E\u663E\u793A\u76EE\u5F55")
|
|
5994
5994
|
)
|
|
5995
5995
|
]),
|
|
5996
5996
|
this.rail
|
|
@@ -6025,7 +6025,7 @@ var MentionPopovers = (_class8 = class {
|
|
|
6025
6025
|
constructor(host) {;_class8.prototype.__init54.call(this);_class8.prototype.__init55.call(this);_class8.prototype.__init56.call(this);_class8.prototype.__init57.call(this);
|
|
6026
6026
|
this.host = host;
|
|
6027
6027
|
this.overlay = document.createElement("div");
|
|
6028
|
-
this.overlay.className = "
|
|
6028
|
+
this.overlay.className = "markloom-mention-pop-host";
|
|
6029
6029
|
document.body.appendChild(this.overlay);
|
|
6030
6030
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
6031
6031
|
document.addEventListener("keydown", this.onKey, true);
|
|
@@ -6105,33 +6105,33 @@ var MentionPopovers = (_class8 = class {
|
|
|
6105
6105
|
const initial = (p.name || "?").slice(0, 1);
|
|
6106
6106
|
_preact.render.call(void 0,
|
|
6107
6107
|
_preact.h.call(void 0, "div", {
|
|
6108
|
-
class: "
|
|
6108
|
+
class: "markloom-profile-card",
|
|
6109
6109
|
style: { position: "fixed", width: "280px", zIndex: "100" },
|
|
6110
6110
|
"data-mention-pop": "person",
|
|
6111
6111
|
onMouseDown: (e) => e.stopPropagation()
|
|
6112
6112
|
}, [
|
|
6113
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6114
|
-
p.avatar ? _preact.h.call(void 0, "img", { class: "
|
|
6115
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6116
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6117
|
-
p.title && _preact.h.call(void 0, "div", { class: "
|
|
6118
|
-
p.department && _preact.h.call(void 0, "div", { class: "
|
|
6113
|
+
_preact.h.call(void 0, "div", { class: "markloom-profile-head", key: "h" }, [
|
|
6114
|
+
p.avatar ? _preact.h.call(void 0, "img", { class: "markloom-profile-avatar", src: p.avatar, alt: "" }) : _preact.h.call(void 0, "div", { class: "markloom-profile-avatar markloom-profile-avatar-fallback" }, initial),
|
|
6115
|
+
_preact.h.call(void 0, "div", { class: "markloom-profile-id" }, [
|
|
6116
|
+
_preact.h.call(void 0, "div", { class: "markloom-profile-name" }, p.name),
|
|
6117
|
+
p.title && _preact.h.call(void 0, "div", { class: "markloom-profile-title" }, p.title),
|
|
6118
|
+
p.department && _preact.h.call(void 0, "div", { class: "markloom-profile-dept" }, p.department)
|
|
6119
6119
|
])
|
|
6120
6120
|
]),
|
|
6121
|
-
(p.email || p.status) && _preact.h.call(void 0, "div", { class: "
|
|
6122
|
-
p.status && _preact.h.call(void 0, "div", { class: "
|
|
6123
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6124
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6121
|
+
(p.email || p.status) && _preact.h.call(void 0, "div", { class: "markloom-profile-meta", key: "m" }, [
|
|
6122
|
+
p.status && _preact.h.call(void 0, "div", { class: "markloom-profile-row" }, [
|
|
6123
|
+
_preact.h.call(void 0, "span", { class: "markloom-profile-k" }, "\u72B6\u6001"),
|
|
6124
|
+
_preact.h.call(void 0, "span", { class: "markloom-profile-v" }, p.status)
|
|
6125
6125
|
]),
|
|
6126
|
-
p.email && _preact.h.call(void 0, "div", { class: "
|
|
6127
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6128
|
-
_preact.h.call(void 0, "a", { class: "
|
|
6126
|
+
p.email && _preact.h.call(void 0, "div", { class: "markloom-profile-row" }, [
|
|
6127
|
+
_preact.h.call(void 0, "span", { class: "markloom-profile-k" }, "\u90AE\u7BB1"),
|
|
6128
|
+
_preact.h.call(void 0, "a", { class: "markloom-profile-v markloom-profile-link", href: `mailto:${p.email}` }, p.email)
|
|
6129
6129
|
])
|
|
6130
6130
|
])
|
|
6131
6131
|
]),
|
|
6132
6132
|
this.overlay
|
|
6133
6133
|
);
|
|
6134
|
-
this.placePop(mode.rect, ".
|
|
6134
|
+
this.placePop(mode.rect, ".markloom-profile-card");
|
|
6135
6135
|
}
|
|
6136
6136
|
paintDateTime(mode) {
|
|
6137
6137
|
const draft = mode.draft;
|
|
@@ -6157,11 +6157,11 @@ var MentionPopovers = (_class8 = class {
|
|
|
6157
6157
|
_optionalChain([this, 'access', _217 => _217.host, 'access', _218 => _218.onDateChange, 'optionalCall', _219 => _219(mode.path, toIso(draft))]);
|
|
6158
6158
|
this.close();
|
|
6159
6159
|
};
|
|
6160
|
-
const spin = (key, max2, label) => _preact.h.call(void 0, "label", { class: "
|
|
6161
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6160
|
+
const spin = (key, max2, label) => _preact.h.call(void 0, "label", { class: "markloom-time-field", key }, [
|
|
6161
|
+
_preact.h.call(void 0, "span", { class: "markloom-time-field-lab" }, label),
|
|
6162
6162
|
_preact.h.call(void 0, "input", {
|
|
6163
6163
|
type: "number",
|
|
6164
|
-
class: "
|
|
6164
|
+
class: "markloom-time-input",
|
|
6165
6165
|
min: 0,
|
|
6166
6166
|
max: max2,
|
|
6167
6167
|
value: draft[key],
|
|
@@ -6177,15 +6177,15 @@ var MentionPopovers = (_class8 = class {
|
|
|
6177
6177
|
]);
|
|
6178
6178
|
_preact.render.call(void 0,
|
|
6179
6179
|
_preact.h.call(void 0, "div", {
|
|
6180
|
-
class: "
|
|
6180
|
+
class: "markloom-date-picker markloom-datetime-picker",
|
|
6181
6181
|
style: { position: "fixed", width: "300px", zIndex: "100" },
|
|
6182
6182
|
"data-mention-pop": "date",
|
|
6183
6183
|
onMouseDown: (e) => e.stopPropagation()
|
|
6184
6184
|
}, [
|
|
6185
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6185
|
+
_preact.h.call(void 0, "div", { class: "markloom-date-hd", key: "hd" }, [
|
|
6186
6186
|
_preact.h.call(void 0, "button", {
|
|
6187
6187
|
type: "button",
|
|
6188
|
-
class: "
|
|
6188
|
+
class: "markloom-date-nav",
|
|
6189
6189
|
"data-act": "prev",
|
|
6190
6190
|
onMouseDown: (e) => {
|
|
6191
6191
|
e.preventDefault();
|
|
@@ -6197,10 +6197,10 @@ var MentionPopovers = (_class8 = class {
|
|
|
6197
6197
|
setDraft({ viewY: ny, viewM: nm });
|
|
6198
6198
|
}
|
|
6199
6199
|
}, "\u2039"),
|
|
6200
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6200
|
+
_preact.h.call(void 0, "span", { class: "markloom-date-label" }, monthLabel),
|
|
6201
6201
|
_preact.h.call(void 0, "button", {
|
|
6202
6202
|
type: "button",
|
|
6203
|
-
class: "
|
|
6203
|
+
class: "markloom-date-nav",
|
|
6204
6204
|
"data-act": "next",
|
|
6205
6205
|
onMouseDown: (e) => {
|
|
6206
6206
|
e.preventDefault();
|
|
@@ -6215,16 +6215,16 @@ var MentionPopovers = (_class8 = class {
|
|
|
6215
6215
|
]),
|
|
6216
6216
|
_preact.h.call(void 0,
|
|
6217
6217
|
"div",
|
|
6218
|
-
{ class: "
|
|
6218
|
+
{ class: "markloom-date-week", key: "w" },
|
|
6219
6219
|
week.map((d) => _preact.h.call(void 0, "span", { key: d }, d))
|
|
6220
6220
|
),
|
|
6221
6221
|
_preact.h.call(void 0,
|
|
6222
6222
|
"div",
|
|
6223
|
-
{ class: "
|
|
6224
|
-
cells.map((c, i) => c.day == null ? _preact.h.call(void 0, "span", { key: `e${i}`, class: "
|
|
6223
|
+
{ class: "markloom-date-grid", key: "g" },
|
|
6224
|
+
cells.map((c, i) => c.day == null ? _preact.h.call(void 0, "span", { key: `e${i}`, class: "markloom-date-cell markloom-date-empty" }) : _preact.h.call(void 0, "button", {
|
|
6225
6225
|
key: `d${c.day}`,
|
|
6226
6226
|
type: "button",
|
|
6227
|
-
class: "
|
|
6227
|
+
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
6228
|
"data-day": String(c.day),
|
|
6229
6229
|
onMouseDown: (e) => {
|
|
6230
6230
|
e.preventDefault();
|
|
@@ -6233,18 +6233,18 @@ var MentionPopovers = (_class8 = class {
|
|
|
6233
6233
|
}, String(c.day)))
|
|
6234
6234
|
),
|
|
6235
6235
|
// 时:分:秒 一体
|
|
6236
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6236
|
+
_preact.h.call(void 0, "div", { class: "markloom-time-row", key: "time" }, [
|
|
6237
6237
|
spin("h", 23, "\u65F6"),
|
|
6238
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6238
|
+
_preact.h.call(void 0, "span", { class: "markloom-time-colon", key: "c1" }, ":"),
|
|
6239
6239
|
spin("min", 59, "\u5206"),
|
|
6240
|
-
_preact.h.call(void 0, "span", { class: "
|
|
6240
|
+
_preact.h.call(void 0, "span", { class: "markloom-time-colon", key: "c2" }, ":"),
|
|
6241
6241
|
spin("s", 59, "\u79D2")
|
|
6242
6242
|
]),
|
|
6243
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6244
|
-
_preact.h.call(void 0, "div", { class: "
|
|
6243
|
+
_preact.h.call(void 0, "div", { class: "markloom-date-preview", key: "pv" }, preview),
|
|
6244
|
+
_preact.h.call(void 0, "div", { class: "markloom-date-ft", key: "ft" }, [
|
|
6245
6245
|
_preact.h.call(void 0, "button", {
|
|
6246
6246
|
type: "button",
|
|
6247
|
-
class: "
|
|
6247
|
+
class: "markloom-date-today-btn",
|
|
6248
6248
|
"data-act": "now",
|
|
6249
6249
|
onMouseDown: (e) => {
|
|
6250
6250
|
e.preventDefault();
|
|
@@ -6263,7 +6263,7 @@ var MentionPopovers = (_class8 = class {
|
|
|
6263
6263
|
}, "\u73B0\u5728"),
|
|
6264
6264
|
_preact.h.call(void 0, "button", {
|
|
6265
6265
|
type: "button",
|
|
6266
|
-
class: "
|
|
6266
|
+
class: "markloom-date-ok",
|
|
6267
6267
|
"data-act": "ok",
|
|
6268
6268
|
onMouseDown: (e) => {
|
|
6269
6269
|
e.preventDefault();
|
|
@@ -6274,7 +6274,7 @@ var MentionPopovers = (_class8 = class {
|
|
|
6274
6274
|
]),
|
|
6275
6275
|
this.overlay
|
|
6276
6276
|
);
|
|
6277
|
-
this.placePop(mode.rect, ".
|
|
6277
|
+
this.placePop(mode.rect, ".markloom-date-picker");
|
|
6278
6278
|
}
|
|
6279
6279
|
}, _class8);
|
|
6280
6280
|
function pad(n) {
|
|
@@ -6357,7 +6357,7 @@ var ImageControls = (_class9 = class {
|
|
|
6357
6357
|
this.root = root;
|
|
6358
6358
|
this.host = host;
|
|
6359
6359
|
this.overlay = document.createElement("div");
|
|
6360
|
-
this.overlay.className = "
|
|
6360
|
+
this.overlay.className = "markloom-image-overlay";
|
|
6361
6361
|
document.body.appendChild(this.overlay);
|
|
6362
6362
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
6363
6363
|
document.addEventListener("keydown", this.onKeyDown);
|
|
@@ -6407,7 +6407,7 @@ var ImageControls = (_class9 = class {
|
|
|
6407
6407
|
}}
|
|
6408
6408
|
__init64() {this.onDocDown = (e) => {
|
|
6409
6409
|
const el = e.target instanceof HTMLElement ? e.target : null;
|
|
6410
|
-
if (_optionalChain([el, 'optionalAccess', _228 => _228.closest, 'call', _229 => _229(".
|
|
6410
|
+
if (_optionalChain([el, 'optionalAccess', _228 => _228.closest, 'call', _229 => _229(".markloom-image-overlay")]) || _optionalChain([el, 'optionalAccess', _230 => _230.closest, 'call', _231 => _231(".markloom-lightbox")]))
|
|
6411
6411
|
return;
|
|
6412
6412
|
const atom = _optionalChain([el, 'optionalAccess', _232 => _232.closest, 'call', _233 => _233('[data-atom="image"], [data-atom="embed"]')]);
|
|
6413
6413
|
if (atom && this.root.contains(atom)) {
|
|
@@ -6500,14 +6500,14 @@ var ImageControls = (_class9 = class {
|
|
|
6500
6500
|
const ex = this.exclusiveId ? this.atomEl(this.exclusiveId) : null;
|
|
6501
6501
|
if (ex) {
|
|
6502
6502
|
const r = ex.getBoundingClientRect();
|
|
6503
|
-
kids.push(_preact.h.call(void 0, "div", { key: "box", class: "
|
|
6503
|
+
kids.push(_preact.h.call(void 0, "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
6504
|
if (ex.getAttribute("data-atom") === "image") {
|
|
6505
6505
|
for (const corner of ["nw", "ne", "sw", "se"]) {
|
|
6506
6506
|
const x = corner === "nw" || corner === "sw" ? r.left : r.right;
|
|
6507
6507
|
const y = corner === "nw" || corner === "ne" ? r.top : r.bottom;
|
|
6508
6508
|
kids.push(_preact.h.call(void 0, "div", {
|
|
6509
6509
|
key: corner,
|
|
6510
|
-
class: `
|
|
6510
|
+
class: `markloom-ic-handle markloom-ic-${corner}`,
|
|
6511
6511
|
style: `left:${x}px;top:${y}px`,
|
|
6512
6512
|
onPointerDown: (ev) => this.startResize(ev, corner)
|
|
6513
6513
|
}));
|
|
@@ -6524,15 +6524,15 @@ var ImageControls = (_class9 = class {
|
|
|
6524
6524
|
const r = atom.getBoundingClientRect();
|
|
6525
6525
|
kids.push(_preact.h.call(void 0, "div", {
|
|
6526
6526
|
key: `r-${id}`,
|
|
6527
|
-
class: "
|
|
6527
|
+
class: "markloom-ic-box",
|
|
6528
6528
|
style: `left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px`
|
|
6529
6529
|
}));
|
|
6530
6530
|
}
|
|
6531
6531
|
if (this.lightbox)
|
|
6532
|
-
kids.push(_preact.h.call(void 0, "div", { key: "lb", class: "
|
|
6532
|
+
kids.push(_preact.h.call(void 0, "div", { key: "lb", class: "markloom-lightbox", onPointerDown: () => this.clearSelected() }, [
|
|
6533
6533
|
_preact.h.call(void 0, "img", { key: "lbimg", src: this.lightbox })
|
|
6534
6534
|
]));
|
|
6535
|
-
_preact.render.call(void 0, kids.length ? _preact.h.call(void 0, "div", { class: "
|
|
6535
|
+
_preact.render.call(void 0, kids.length ? _preact.h.call(void 0, "div", { class: "markloom-ic" }, kids) : null, this.overlay);
|
|
6536
6536
|
}
|
|
6537
6537
|
toolbar(r) {
|
|
6538
6538
|
const cur = _nullishCoalesce(_optionalChain([this, 'access', _236 => _236.blockNode, 'call', _237 => _237(), 'optionalAccess', _238 => _238.node, 'access', _239 => _239.attrs, 'optionalAccess', _240 => _240.align]), () => ( "left"));
|
|
@@ -6556,11 +6556,11 @@ var ImageControls = (_class9 = class {
|
|
|
6556
6556
|
} else this.patchAttrs({ align: a.value });
|
|
6557
6557
|
}
|
|
6558
6558
|
}, icon(a.ico, 14)));
|
|
6559
|
-
const row = [_preact.h.call(void 0, "div", { key: "row", class: "
|
|
6559
|
+
const row = [_preact.h.call(void 0, "div", { key: "row", class: "markloom-ic-tb-row" }, btns)];
|
|
6560
6560
|
if (this.editingCaption)
|
|
6561
6561
|
row.push(_preact.h.call(void 0, "input", {
|
|
6562
6562
|
"key": "capin",
|
|
6563
|
-
"class": "
|
|
6563
|
+
"class": "markloom-ic-tb-caption",
|
|
6564
6564
|
"type": "text",
|
|
6565
6565
|
"value": cap,
|
|
6566
6566
|
"placeholder": "\u56FE\u6CE8\u2026",
|
|
@@ -6576,7 +6576,7 @@ var ImageControls = (_class9 = class {
|
|
|
6576
6576
|
}
|
|
6577
6577
|
}
|
|
6578
6578
|
}));
|
|
6579
|
-
return _preact.h.call(void 0, "div", { key: "tb", class: "
|
|
6579
|
+
return _preact.h.call(void 0, "div", { key: "tb", class: "markloom-ic-tb", style: `left:${r.left}px;top:${r.top - 40}px` }, row);
|
|
6580
6580
|
}
|
|
6581
6581
|
startResize(down, corner) {
|
|
6582
6582
|
down.preventDefault();
|
|
@@ -6662,7 +6662,7 @@ var TableControls = (_class10 = class {
|
|
|
6662
6662
|
this.root = root;
|
|
6663
6663
|
this.host = host;
|
|
6664
6664
|
this.overlay = document.createElement("div");
|
|
6665
|
-
this.overlay.className = "
|
|
6665
|
+
this.overlay.className = "markloom-table-overlay";
|
|
6666
6666
|
document.body.appendChild(this.overlay);
|
|
6667
6667
|
document.addEventListener("selectionchange", this.onSelChange);
|
|
6668
6668
|
document.addEventListener("pointerdown", this.onDocDown, true);
|
|
@@ -6691,7 +6691,7 @@ var TableControls = (_class10 = class {
|
|
|
6691
6691
|
}
|
|
6692
6692
|
// 按 model 块 id 选中对应表格(供 atomSelectGuard:光标逼近表 → 先选中而非直删)。选中成功返 true。
|
|
6693
6693
|
selectByBlockId(id) {
|
|
6694
|
-
const el = this.root.querySelector(`.
|
|
6694
|
+
const el = this.root.querySelector(`.markloom-table[data-atom="table"][data-block-id="${id}"]`);
|
|
6695
6695
|
if (!el)
|
|
6696
6696
|
return false;
|
|
6697
6697
|
this.selectWhole(el);
|
|
@@ -6719,7 +6719,7 @@ var TableControls = (_class10 = class {
|
|
|
6719
6719
|
this.selectedBlock = null;
|
|
6720
6720
|
this.paint();
|
|
6721
6721
|
}
|
|
6722
|
-
// 几何:量出 cols+1 条列边界 / rows+1 条行边界的视口坐标。span 稳健——DOM 里 .
|
|
6722
|
+
// 几何:量出 cols+1 条列边界 / rows+1 条行边界的视口坐标。span 稳健——DOM 里 .markloom-cell 按
|
|
6723
6723
|
// buildGrid 锚点序 emit(命脉:1 child = 1 td),第 i 个 cell 对应 anchors[i] 的锚点足迹。
|
|
6724
6724
|
// 每格 rect 的 left/top 填其足迹起列/起行的边界,right/bottom 填终列+1/终行+1 的边界。
|
|
6725
6725
|
// 无 span 时退化成原来的均匀网格。cells 数 !== 锚点数 → null(DOM 未就绪)。
|
|
@@ -6732,7 +6732,7 @@ var TableControls = (_class10 = class {
|
|
|
6732
6732
|
return null;
|
|
6733
6733
|
const grid = _chunkVVFIQLVRcjs.buildGrid.call(void 0, table);
|
|
6734
6734
|
const { rows, cols } = grid;
|
|
6735
|
-
const cells = Array.from(tableEl.querySelectorAll(".
|
|
6735
|
+
const cells = Array.from(tableEl.querySelectorAll(".markloom-cell"));
|
|
6736
6736
|
if (cells.length !== grid.anchors.length || cols === 0)
|
|
6737
6737
|
return null;
|
|
6738
6738
|
const rect = tableEl.getBoundingClientRect();
|
|
@@ -6797,14 +6797,14 @@ var TableControls = (_class10 = class {
|
|
|
6797
6797
|
this.paint();
|
|
6798
6798
|
}
|
|
6799
6799
|
}}
|
|
6800
|
-
// 当前 caret/选区落在哪个表格内(锚点 DOM 往上找 .
|
|
6800
|
+
// 当前 caret/选区落在哪个表格内(锚点 DOM 往上找 .markloom-table,且在本编辑器根内)。
|
|
6801
6801
|
focusedTable() {
|
|
6802
6802
|
const sel = document.getSelection();
|
|
6803
6803
|
const node = _optionalChain([sel, 'optionalAccess', _262 => _262.anchorNode]);
|
|
6804
6804
|
if (!node)
|
|
6805
6805
|
return null;
|
|
6806
6806
|
const el = node instanceof HTMLElement ? node : node.parentElement;
|
|
6807
|
-
const table = _optionalChain([el, 'optionalAccess', _263 => _263.closest, 'call', _264 => _264(".
|
|
6807
|
+
const table = _optionalChain([el, 'optionalAccess', _263 => _263.closest, 'call', _264 => _264(".markloom-table")]);
|
|
6808
6808
|
return table && this.root.contains(table) ? table : null;
|
|
6809
6809
|
}
|
|
6810
6810
|
__init76() {this.onReflow = () => {
|
|
@@ -6851,11 +6851,11 @@ var TableControls = (_class10 = class {
|
|
|
6851
6851
|
// 点在 active 表格某格内 + 拖动 → 画矩形选区(拖过 >1 格时抑制默认光标选择,松手出合并菜单)。
|
|
6852
6852
|
__init78() {this.onDocDown = (e) => {
|
|
6853
6853
|
const el = e.target instanceof HTMLElement ? e.target : null;
|
|
6854
|
-
if (_optionalChain([el, 'optionalAccess', _265 => _265.closest, 'call', _266 => _266(".
|
|
6854
|
+
if (_optionalChain([el, 'optionalAccess', _265 => _265.closest, 'call', _266 => _266(".markloom-table-overlay")]))
|
|
6855
6855
|
return;
|
|
6856
6856
|
if (this.selectedBlock)
|
|
6857
6857
|
this.clearSelected();
|
|
6858
|
-
const cellEl = _optionalChain([el, 'optionalAccess', _267 => _267.closest, 'call', _268 => _268(".
|
|
6858
|
+
const cellEl = _optionalChain([el, 'optionalAccess', _267 => _267.closest, 'call', _268 => _268(".markloom-cell")]);
|
|
6859
6859
|
const inActive = cellEl && this.active && this.active.contains(cellEl);
|
|
6860
6860
|
if (inActive) {
|
|
6861
6861
|
if (this.sel && this.sel.kind !== "rect") {
|
|
@@ -6929,7 +6929,7 @@ var TableControls = (_class10 = class {
|
|
|
6929
6929
|
const selected = tableEl === this.selectedBlock;
|
|
6930
6930
|
return _preact.h.call(void 0, "div", {
|
|
6931
6931
|
key: "grip",
|
|
6932
|
-
class: `
|
|
6932
|
+
class: `markloom-tc-grip${selected ? " is-selected" : ""}`,
|
|
6933
6933
|
style: `left:${r.left - 22}px;top:${r.top - 22}px`,
|
|
6934
6934
|
title: "\u9009\u4E2D/\u79FB\u52A8\u8868\u683C",
|
|
6935
6935
|
onPointerDown: (e) => {
|
|
@@ -6975,9 +6975,9 @@ var TableControls = (_class10 = class {
|
|
|
6975
6975
|
document.addEventListener("pointermove", move);
|
|
6976
6976
|
document.addEventListener("pointerup", up);
|
|
6977
6977
|
}
|
|
6978
|
-
// 鼠标 y → 顶层块间缝下标(0..n)。遍历 .
|
|
6978
|
+
// 鼠标 y → 顶层块间缝下标(0..n)。遍历 .markloom-doc 结构子(elementChildren 穿透布局层),y 落某块上半 → 该块前缝,下半 → 后缝。
|
|
6979
6979
|
gapAtY(y) {
|
|
6980
|
-
const blocks =
|
|
6980
|
+
const blocks = _chunkLNSKDJMFcjs.elementChildren.call(void 0, _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root));
|
|
6981
6981
|
for (let i = 0; i < blocks.length; i++) {
|
|
6982
6982
|
const r = blocks[i].getBoundingClientRect();
|
|
6983
6983
|
if (y < (r.top + r.bottom) / 2)
|
|
@@ -6985,23 +6985,23 @@ var TableControls = (_class10 = class {
|
|
|
6985
6985
|
}
|
|
6986
6986
|
return blocks.length;
|
|
6987
6987
|
}
|
|
6988
|
-
// 块拖拽落点线:第 gap 条缝的 Y(缝上块底 / 首缝取首块顶 / 末缝取末块底),横向铺满 .
|
|
6988
|
+
// 块拖拽落点线:第 gap 条缝的 Y(缝上块底 / 首缝取首块顶 / 末缝取末块底),横向铺满 .markloom-doc 宽。复用 .markloom-tc-drop-row。
|
|
6989
6989
|
blockDropLine() {
|
|
6990
6990
|
if (!this.blockDrag)
|
|
6991
6991
|
return null;
|
|
6992
|
-
const docEl =
|
|
6993
|
-
const blocks =
|
|
6992
|
+
const docEl = _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root);
|
|
6993
|
+
const blocks = _chunkLNSKDJMFcjs.elementChildren.call(void 0, docEl);
|
|
6994
6994
|
const gap = this.blockDrag.gap;
|
|
6995
6995
|
const y = gap === 0 ? _nullishCoalesce(_optionalChain([blocks, 'access', _276 => _276[0], 'optionalAccess', _277 => _277.getBoundingClientRect, 'call', _278 => _278(), 'access', _279 => _279.top]), () => ( 0)) : _nullishCoalesce(_optionalChain([blocks, 'access', _280 => _280[gap - 1], 'optionalAccess', _281 => _281.getBoundingClientRect, 'call', _282 => _282(), 'access', _283 => _283.bottom]), () => ( 0));
|
|
6996
6996
|
const box = docEl.getBoundingClientRect();
|
|
6997
|
-
return _preact.h.call(void 0, "div", { key: "drop", class: "
|
|
6997
|
+
return _preact.h.call(void 0, "div", { key: "drop", class: "markloom-tc-drop markloom-tc-drop-row", style: `top:${y}px;left:${box.left}px;width:${box.width}px` });
|
|
6998
6998
|
}
|
|
6999
6999
|
// 选中态写到 cell 的 data-selected(纯视图,主题给强高亮)。span 稳健:每格取其锚点足迹,
|
|
7000
7000
|
// 与 sel(行/列/全选/矩形)相交则选中。矩形按归一化区间判交(足迹与 rect 有重叠即选)。
|
|
7001
7001
|
applySelClasses() {
|
|
7002
7002
|
if (!this.active)
|
|
7003
7003
|
return;
|
|
7004
|
-
const cells = Array.from(this.active.querySelectorAll(".
|
|
7004
|
+
const cells = Array.from(this.active.querySelectorAll(".markloom-cell"));
|
|
7005
7005
|
const table = this.tableModel(this.active);
|
|
7006
7006
|
if (!table)
|
|
7007
7007
|
return;
|
|
@@ -7034,8 +7034,8 @@ var TableControls = (_class10 = class {
|
|
|
7034
7034
|
return;
|
|
7035
7035
|
}
|
|
7036
7036
|
const r = this.selectedBlock.getBoundingClientRect();
|
|
7037
|
-
_preact.render.call(void 0, _preact.h.call(void 0, "div", { class: "
|
|
7038
|
-
_preact.h.call(void 0, "div", { key: "box", class: "
|
|
7037
|
+
_preact.render.call(void 0, _preact.h.call(void 0, "div", { class: "markloom-tc" }, [
|
|
7038
|
+
_preact.h.call(void 0, "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
7039
|
this.grip(this.selectedBlock),
|
|
7040
7040
|
this.blockDropLine()
|
|
7041
7041
|
]), this.overlay);
|
|
@@ -7051,11 +7051,11 @@ var TableControls = (_class10 = class {
|
|
|
7051
7051
|
_preact.render.call(void 0, null, this.overlay);
|
|
7052
7052
|
return;
|
|
7053
7053
|
}
|
|
7054
|
-
const wrap = this.active.closest(".
|
|
7054
|
+
const wrap = this.active.closest(".markloom-table-scroll");
|
|
7055
7055
|
const clip = wrap ? wrap.getBoundingClientRect() : null;
|
|
7056
7056
|
const pad2 = Math.max(BAR, DOT_OUT + 12);
|
|
7057
7057
|
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
|
-
_preact.render.call(void 0, _preact.h.call(void 0, "div", { class: "
|
|
7058
|
+
_preact.render.call(void 0, _preact.h.call(void 0, "div", { class: "markloom-tc", style: clipStyle }, [
|
|
7059
7059
|
...this.colHandles(g),
|
|
7060
7060
|
...this.rowHandles(g),
|
|
7061
7061
|
...this.insertDots(g),
|
|
@@ -7075,7 +7075,7 @@ var TableControls = (_class10 = class {
|
|
|
7075
7075
|
const edge = c === 0 ? " is-first" : c === g.cols - 1 ? " is-last" : "";
|
|
7076
7076
|
out.push(_preact.h.call(void 0, "div", {
|
|
7077
7077
|
key: `ch${c}`,
|
|
7078
|
-
class: `
|
|
7078
|
+
class: `markloom-tc-handle markloom-tc-col${selected ? " is-selected" : ""}${edge}`,
|
|
7079
7079
|
style: `left:${left}px;top:${g.rect.top - BAR}px;width:${w}px;height:${BAR}px`,
|
|
7080
7080
|
onPointerDown: (e) => this.startHandle(e, "col", c)
|
|
7081
7081
|
}));
|
|
@@ -7091,14 +7091,14 @@ var TableControls = (_class10 = class {
|
|
|
7091
7091
|
const edge = r === 0 ? " is-first" : r === g.rows - 1 ? " is-last" : "";
|
|
7092
7092
|
out.push(_preact.h.call(void 0, "div", {
|
|
7093
7093
|
key: `rh${r}`,
|
|
7094
|
-
class: `
|
|
7094
|
+
class: `markloom-tc-handle markloom-tc-row${selected ? " is-selected" : ""}${edge}`,
|
|
7095
7095
|
style: `top:${top}px;left:${g.rect.left - BAR}px;height:${ht}px;width:${BAR}px`,
|
|
7096
7096
|
onPointerDown: (e) => this.startHandle(e, "row", r)
|
|
7097
7097
|
}));
|
|
7098
7098
|
}
|
|
7099
7099
|
out.push(_preact.h.call(void 0, "div", {
|
|
7100
7100
|
key: "all",
|
|
7101
|
-
class: `
|
|
7101
|
+
class: `markloom-tc-handle markloom-tc-all${_optionalChain([this, 'access', _296 => _296.sel, 'optionalAccess', _297 => _297.kind]) === "all" ? " is-selected" : ""}`,
|
|
7102
7102
|
style: `top:${g.rect.top - BAR}px;left:${g.rect.left - BAR}px;width:${BAR}px;height:${BAR}px`,
|
|
7103
7103
|
onPointerDown: (e) => this.selectAll(e)
|
|
7104
7104
|
}));
|
|
@@ -7115,9 +7115,9 @@ var TableControls = (_class10 = class {
|
|
|
7115
7115
|
this.paint();
|
|
7116
7116
|
}
|
|
7117
7117
|
// 列/行边界插入点(抄 note AddColumnButton 的三层结构):
|
|
7118
|
-
// 容器 .
|
|
7119
|
-
// 视觉点 .
|
|
7120
|
-
// 引导线 .
|
|
7118
|
+
// 容器 .markloom-tc-ins —— 24px 常驻命中区(HIT),悬在表格外、圆心对准边界;承 click + :hover(group)。
|
|
7119
|
+
// 视觉点 .markloom-tc-dot —— 纯展示(pointer-events:none),静止 scale(.15)≈3.6px 灰点,容器 hover 时放大成蓝 ⊕。
|
|
7120
|
+
// 引导线 .markloom-tc-guide —— 从表边贯穿表身,容器 hover 时点亮。
|
|
7121
7121
|
// 命脉:hover 检测在 24px 容器上,不在缩小的圆点上——否则接触面只有 3.6px,几乎点不中(之前的 bug)。
|
|
7122
7122
|
insertDots(g) {
|
|
7123
7123
|
const out = [];
|
|
@@ -7126,31 +7126,31 @@ var TableControls = (_class10 = class {
|
|
|
7126
7126
|
for (let c = 0; c <= g.cols; c++) {
|
|
7127
7127
|
out.push(_preact.h.call(void 0, "div", {
|
|
7128
7128
|
key: `ci${c}`,
|
|
7129
|
-
class: "
|
|
7129
|
+
class: "markloom-tc-ins markloom-tc-ins-col",
|
|
7130
7130
|
style: `left:${g.colX[c] - HIT / 2}px;top:${insY}px;width:${HIT}px;height:${HIT}px`,
|
|
7131
7131
|
title: "\u63D2\u5165\u5217",
|
|
7132
7132
|
onPointerDown: (e) => this.insertAt(e, g.tableEl, "col", c)
|
|
7133
7133
|
}, [
|
|
7134
7134
|
_preact.h.call(void 0, "div", {
|
|
7135
|
-
class: "
|
|
7135
|
+
class: "markloom-tc-guide markloom-tc-guide-col",
|
|
7136
7136
|
style: `left:${g.colX[c]}px;top:${g.rect.top}px;height:${g.rect.height}px`
|
|
7137
7137
|
}),
|
|
7138
|
-
_preact.h.call(void 0, "div", { class: "
|
|
7138
|
+
_preact.h.call(void 0, "div", { class: "markloom-tc-dot markloom-tc-dot-col" })
|
|
7139
7139
|
]));
|
|
7140
7140
|
}
|
|
7141
7141
|
for (let r = 0; r <= g.rows; r++) {
|
|
7142
7142
|
out.push(_preact.h.call(void 0, "div", {
|
|
7143
7143
|
key: `ri${r}`,
|
|
7144
|
-
class: "
|
|
7144
|
+
class: "markloom-tc-ins markloom-tc-ins-row",
|
|
7145
7145
|
style: `top:${g.rowY[r] - HIT / 2}px;left:${insX}px;width:${HIT}px;height:${HIT}px`,
|
|
7146
7146
|
title: "\u63D2\u5165\u884C",
|
|
7147
7147
|
onPointerDown: (e) => this.insertAt(e, g.tableEl, "row", r)
|
|
7148
7148
|
}, [
|
|
7149
7149
|
_preact.h.call(void 0, "div", {
|
|
7150
|
-
class: "
|
|
7150
|
+
class: "markloom-tc-guide markloom-tc-guide-row",
|
|
7151
7151
|
style: `top:${g.rowY[r]}px;left:${g.rect.left}px;width:${g.rect.width}px`
|
|
7152
7152
|
}),
|
|
7153
|
-
_preact.h.call(void 0, "div", { class: "
|
|
7153
|
+
_preact.h.call(void 0, "div", { class: "markloom-tc-dot markloom-tc-dot-row" })
|
|
7154
7154
|
]));
|
|
7155
7155
|
}
|
|
7156
7156
|
return out;
|
|
@@ -7167,7 +7167,7 @@ var TableControls = (_class10 = class {
|
|
|
7167
7167
|
for (let c = 0; c < g.cols; c++) {
|
|
7168
7168
|
out.push(_preact.h.call(void 0, "div", {
|
|
7169
7169
|
key: `rz${c}`,
|
|
7170
|
-
class: "
|
|
7170
|
+
class: "markloom-tc-resize",
|
|
7171
7171
|
style: `left:${g.colX[c + 1] - 3}px;top:${g.rect.top}px;height:${g.rect.height}px`,
|
|
7172
7172
|
onPointerDown: (e) => this.startResize(e, g, c)
|
|
7173
7173
|
}));
|
|
@@ -7179,10 +7179,10 @@ var TableControls = (_class10 = class {
|
|
|
7179
7179
|
return null;
|
|
7180
7180
|
if (this.drag.kind === "col") {
|
|
7181
7181
|
const x = g.colX[Math.min(this.drag.to, g.cols)];
|
|
7182
|
-
return _preact.h.call(void 0, "div", { key: "di", class: "
|
|
7182
|
+
return _preact.h.call(void 0, "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
7183
|
}
|
|
7184
7184
|
const y = g.rowY[Math.min(this.drag.to, g.rows)];
|
|
7185
|
-
return _preact.h.call(void 0, "div", { key: "di", class: "
|
|
7185
|
+
return _preact.h.call(void 0, "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
7186
|
}
|
|
7187
7187
|
// 柄菜单:增删行列/清空/合并拆分/样式/冻结。锚到选中柄或矩形左上附近。
|
|
7188
7188
|
menuEl(g) {
|
|
@@ -7193,7 +7193,7 @@ var TableControls = (_class10 = class {
|
|
|
7193
7193
|
const x = m.kind === "col" ? g.colX[m.index] : m.kind === "rect" ? g.colX[rect ? rect.c1 : 0] : g.rect.left - BAR;
|
|
7194
7194
|
const y = m.kind === "col" ? g.rect.top - BAR : m.kind === "rect" ? g.rowY[rect ? rect.r2 + 1 : 0] : g.rowY[m.index];
|
|
7195
7195
|
const labels = this.menuLabels(m);
|
|
7196
|
-
return _preact.h.call(void 0, "div", { key: "menu", class: "
|
|
7196
|
+
return _preact.h.call(void 0, "div", { key: "menu", class: "markloom-tc-menu", style: `left:${x}px;top:${y}px` }, labels.map((label, i) => _preact.h.call(void 0, "button", {
|
|
7197
7197
|
key: i,
|
|
7198
7198
|
type: "button",
|
|
7199
7199
|
onPointerDown: (e) => this.clickMenu(e, g, m, i)
|
|
@@ -7402,7 +7402,7 @@ var Editor = (_class11 = class {
|
|
|
7402
7402
|
const dev = typeof process !== "undefined" && _optionalChain([process, 'access', _371 => _371.env, 'optionalAccess', _372 => _372.NODE_ENV]) !== "production";
|
|
7403
7403
|
this.history = _chunkHA6XHJUDcjs.init.call(void 0, ensureGaps(doc), dev ? (d) => _chunkHA6XHJUDcjs.firstViolation.call(void 0, _chunkHA6XHJUDcjs.invariants.call(void 0, _chunkVVFIQLVRcjs.basicSchema, d)) : void 0);
|
|
7404
7404
|
this.opts = opts;
|
|
7405
|
-
const exts = _nullishCoalesce(opts.extensions, () => (
|
|
7405
|
+
const exts = _nullishCoalesce(opts.extensions, () => ( markloomKit()));
|
|
7406
7406
|
this.resolved = resolve(exts);
|
|
7407
7407
|
this.invisible = _nullishCoalesce(opts.invisibleCharacters, () => ( exts.some((e) => e.name === "invisibleCharacters")));
|
|
7408
7408
|
root.contentEditable = opts.editable === false ? "false" : "true";
|
|
@@ -7422,9 +7422,9 @@ var Editor = (_class11 = class {
|
|
|
7422
7422
|
this.imageControls = new ImageControls(root, {
|
|
7423
7423
|
doc: () => this.history.doc,
|
|
7424
7424
|
dispatch: (steps) => this.dispatch(steps),
|
|
7425
|
-
sel: () =>
|
|
7425
|
+
sel: () => _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc),
|
|
7426
7426
|
// atomSelect 变 → 重投影 data-selected(与 commentState 同构传 render)
|
|
7427
|
-
onAtomSelectChange: () => this.draw(_nullishCoalesce(
|
|
7427
|
+
onAtomSelectChange: () => this.draw(_nullishCoalesce(_chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc), () => ( void 0)))
|
|
7428
7428
|
});
|
|
7429
7429
|
this.mentionPops = new MentionPopovers({
|
|
7430
7430
|
root,
|
|
@@ -7440,7 +7440,7 @@ var Editor = (_class11 = class {
|
|
|
7440
7440
|
markSel: () => this.markSel(),
|
|
7441
7441
|
author: _nullishCoalesce(_optionalChain([opts, 'access', _376 => _376.comments, 'optionalAccess', _377 => _377.author]), () => ( (() => ({ id: "me", name: "\u6211" })))),
|
|
7442
7442
|
newId: newId3,
|
|
7443
|
-
redraw: () => this.draw(_nullishCoalesce(
|
|
7443
|
+
redraw: () => this.draw(_nullishCoalesce(_chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc), () => ( void 0))),
|
|
7444
7444
|
onChange: _optionalChain([opts, 'access', _378 => _378.comments, 'optionalAccess', _379 => _379.onChange]),
|
|
7445
7445
|
readonly: () => this.readonly
|
|
7446
7446
|
}, _nullishCoalesce(_optionalChain([opts, 'access', _380 => _380.comments, 'optionalAccess', _381 => _381.threads]), () => ( [])));
|
|
@@ -7452,8 +7452,8 @@ var Editor = (_class11 = class {
|
|
|
7452
7452
|
}
|
|
7453
7453
|
if (opts.ai) {
|
|
7454
7454
|
const cfg = typeof opts.ai === "object" ? opts.ai : {};
|
|
7455
|
-
this.aiCtl = new (0,
|
|
7456
|
-
stream:
|
|
7455
|
+
this.aiCtl = new (0, _chunkLNSKDJMFcjs.MarkloomAi)(() => this, {
|
|
7456
|
+
stream: _chunkLNSKDJMFcjs.createAiStream.call(void 0, cfg),
|
|
7457
7457
|
onError: _nullishCoalesce(cfg.onError, () => ( ((msg) => {
|
|
7458
7458
|
if (typeof window !== "undefined")
|
|
7459
7459
|
window.alert(msg);
|
|
@@ -7465,7 +7465,7 @@ var Editor = (_class11 = class {
|
|
|
7465
7465
|
root,
|
|
7466
7466
|
doc: () => this.history.doc,
|
|
7467
7467
|
dispatch: (steps, sel) => this.dispatch(steps, sel),
|
|
7468
|
-
sel: () =>
|
|
7468
|
+
sel: () => _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc),
|
|
7469
7469
|
markSel: () => this.markSel(),
|
|
7470
7470
|
insertImage: (idx) => this.slashInsertImage(idx),
|
|
7471
7471
|
insertMath: (idx) => this.slashInsertMath(idx),
|
|
@@ -7552,7 +7552,7 @@ var Editor = (_class11 = class {
|
|
|
7552
7552
|
// 运行时切显隐符(tiptap show/hide/toggleInvisibleCharacters 对位)。纯重绘,model 不动。
|
|
7553
7553
|
setInvisibleCharacters(visible) {
|
|
7554
7554
|
this.invisible = visible;
|
|
7555
|
-
this.draw(_nullishCoalesce(
|
|
7555
|
+
this.draw(_nullishCoalesce(_chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc), () => ( void 0)));
|
|
7556
7556
|
}
|
|
7557
7557
|
get invisibleCharacters() {
|
|
7558
7558
|
return this.invisible;
|
|
@@ -7583,10 +7583,10 @@ var Editor = (_class11 = class {
|
|
|
7583
7583
|
commentState: _optionalChain([this, 'access', _414 => _414.commentPanel, 'optionalAccess', _415 => _415.renderState, 'call', _416 => _416()]),
|
|
7584
7584
|
atomSelect: this.imageControls.selectCtx()
|
|
7585
7585
|
}), this.root);
|
|
7586
|
-
stripStrayNodes(this.root.querySelector(".
|
|
7586
|
+
stripStrayNodes(this.root.querySelector(".markloom-doc"));
|
|
7587
7587
|
if (restore)
|
|
7588
|
-
|
|
7589
|
-
this.root.dispatchEvent(new Event("
|
|
7588
|
+
_chunkLNSKDJMFcjs.writeSelection.call(void 0, this.root, this.history.doc, restore);
|
|
7589
|
+
this.root.dispatchEvent(new Event("markloom-redraw", { bubbles: true }));
|
|
7590
7590
|
this.syncPlaceholder();
|
|
7591
7591
|
}
|
|
7592
7592
|
// 空块提示(不进 model):空 paragraph → opts.placeholder(slash 引导);
|
|
@@ -7594,7 +7594,7 @@ var Editor = (_class11 = class {
|
|
|
7594
7594
|
__init86() {this.syncPlaceholder = () => {
|
|
7595
7595
|
if (this.composing || this.readonly)
|
|
7596
7596
|
return;
|
|
7597
|
-
const docEl =
|
|
7597
|
+
const docEl = _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root);
|
|
7598
7598
|
for (const el2 of docEl.querySelectorAll("[data-placeholder]"))
|
|
7599
7599
|
el2.removeAttribute("data-placeholder");
|
|
7600
7600
|
const kids = this.history.doc.children;
|
|
@@ -7618,7 +7618,7 @@ var Editor = (_class11 = class {
|
|
|
7618
7618
|
}
|
|
7619
7619
|
}
|
|
7620
7620
|
if (idx == null) {
|
|
7621
|
-
const sel =
|
|
7621
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
7622
7622
|
if (sel) {
|
|
7623
7623
|
const a = sel.anchor.path;
|
|
7624
7624
|
const h13 = sel.head.path;
|
|
@@ -7638,7 +7638,7 @@ var Editor = (_class11 = class {
|
|
|
7638
7638
|
}
|
|
7639
7639
|
if (idx == null || text == null)
|
|
7640
7640
|
return;
|
|
7641
|
-
const el =
|
|
7641
|
+
const el = _chunkLNSKDJMFcjs.elementChildren.call(void 0, docEl)[idx];
|
|
7642
7642
|
if (el)
|
|
7643
7643
|
el.setAttribute("data-placeholder", text);
|
|
7644
7644
|
}}
|
|
@@ -7682,17 +7682,17 @@ var Editor = (_class11 = class {
|
|
|
7682
7682
|
}
|
|
7683
7683
|
/** 续写:当前块后插空段并流式灌入 */
|
|
7684
7684
|
aiContinue(blockId) {
|
|
7685
|
-
return
|
|
7685
|
+
return _chunkLNSKDJMFcjs.startAiWrite.call(void 0, this, "continue", blockId);
|
|
7686
7686
|
}
|
|
7687
7687
|
/** 改写:清空当前块再流式回填 */
|
|
7688
7688
|
aiRewrite(blockId) {
|
|
7689
|
-
return
|
|
7689
|
+
return _chunkLNSKDJMFcjs.startAiWrite.call(void 0, this, "rewrite", blockId);
|
|
7690
7690
|
}
|
|
7691
7691
|
// 组字开始:快照「这一刻的叶文本」作为 3-way merge 的 base。
|
|
7692
7692
|
// IME 改动 = diff(base, DOM落定文本);AI 并发改动 = diff(base, model现态)。两者都相对 base。
|
|
7693
7693
|
__init87() {this.onCompositionStart = () => {
|
|
7694
7694
|
this.composing = true;
|
|
7695
|
-
const sel =
|
|
7695
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
7696
7696
|
if (!sel) {
|
|
7697
7697
|
this.composeBase = null;
|
|
7698
7698
|
return;
|
|
@@ -7865,7 +7865,7 @@ var Editor = (_class11 = class {
|
|
|
7865
7865
|
}
|
|
7866
7866
|
if (this.atomBlockGuard(intent, _nullishCoalesce(e.data, () => ( "")), e))
|
|
7867
7867
|
return;
|
|
7868
|
-
const sel =
|
|
7868
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
7869
7869
|
if (!sel) {
|
|
7870
7870
|
e.preventDefault();
|
|
7871
7871
|
return;
|
|
@@ -7999,7 +7999,7 @@ var Editor = (_class11 = class {
|
|
|
7999
7999
|
const caret3 = range.getBoundingClientRect();
|
|
8000
8000
|
if (caret3.width === 0 && caret3.height === 0)
|
|
8001
8001
|
return false;
|
|
8002
|
-
const blockEl =
|
|
8002
|
+
const blockEl = _chunkLNSKDJMFcjs.elementChildren.call(void 0, _chunkLNSKDJMFcjs.rootEl.call(void 0, this.root))[topIdx];
|
|
8003
8003
|
if (!blockEl)
|
|
8004
8004
|
return false;
|
|
8005
8005
|
const box = blockEl.getBoundingClientRect();
|
|
@@ -8127,7 +8127,7 @@ var Editor = (_class11 = class {
|
|
|
8127
8127
|
// intentOf 不认的删变体(word/line 删)在代码块边界的守卫:跨块涉码 / 塌缩在 code 对应边 → preventDefault(挡浏览器并块)。
|
|
8128
8128
|
// 非边界(代码块中段)不接管,放行——与 codeBlockGuard 的「只收边界、放行叶内」一致,不过度拦。
|
|
8129
8129
|
codeBoundaryDelete(dir, e) {
|
|
8130
|
-
const sel =
|
|
8130
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8131
8131
|
if (!sel)
|
|
8132
8132
|
return;
|
|
8133
8133
|
if (this.straddlesAtom(sel)) {
|
|
@@ -8150,7 +8150,7 @@ var Editor = (_class11 = class {
|
|
|
8150
8150
|
// 到 cell/文档真边界 mapInput 才返 null)——「删空本行/本段后再删能退上去」的语义由此路径提供。
|
|
8151
8151
|
// 一律 preventDefault(否则浏览器原生删破 DOM≡doc,后续 readSelection 读脏 DOM 返 null → 打字被吞)。
|
|
8152
8152
|
wordLineDelete(dir, inputType, e) {
|
|
8153
|
-
const sel =
|
|
8153
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8154
8154
|
if (!sel) {
|
|
8155
8155
|
e.preventDefault();
|
|
8156
8156
|
return;
|
|
@@ -8180,13 +8180,13 @@ var Editor = (_class11 = class {
|
|
|
8180
8180
|
this.composing = false;
|
|
8181
8181
|
const base = this.composeBase;
|
|
8182
8182
|
this.composeBase = null;
|
|
8183
|
-
const sel =
|
|
8183
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8184
8184
|
if (!sel || !base) {
|
|
8185
8185
|
this.draw();
|
|
8186
8186
|
return;
|
|
8187
8187
|
}
|
|
8188
8188
|
const leafPath = base.leafPath;
|
|
8189
|
-
const dom =
|
|
8189
|
+
const dom = _chunkLNSKDJMFcjs.pointToDom.call(void 0, this.root, this.history.doc, { path: leafPath.concat(0) });
|
|
8190
8190
|
const domText = (_optionalChain([dom, 'optionalAccess', _460 => _460.node]) && isDomText(dom.node) ? _nullishCoalesce(dom.node.textContent, () => ( "")) : "").replaceAll("\u200B", "");
|
|
8191
8191
|
const edit = diffSpan(base.text, domText);
|
|
8192
8192
|
if (!edit) {
|
|
@@ -8242,7 +8242,7 @@ var Editor = (_class11 = class {
|
|
|
8242
8242
|
}
|
|
8243
8243
|
selCtrl.clearSelected();
|
|
8244
8244
|
const target = exitBack ? [nbrIdx, ..._chunkVVFIQLVRcjs.lastLeafEnd.call(void 0, nbr)] : [nbrIdx, ..._chunkVVFIQLVRcjs.firstLeafPath.call(void 0, nbr), 0];
|
|
8245
|
-
|
|
8245
|
+
_chunkLNSKDJMFcjs.writeSelection.call(void 0, this.root, doc, { anchor: { path: target }, head: { path: target } });
|
|
8246
8246
|
return;
|
|
8247
8247
|
}
|
|
8248
8248
|
selCtrl.clearSelected();
|
|
@@ -8250,7 +8250,7 @@ var Editor = (_class11 = class {
|
|
|
8250
8250
|
}
|
|
8251
8251
|
}
|
|
8252
8252
|
if ((exitBack || exitFwd) && !mod2 && !e.shiftKey && !selCtrl) {
|
|
8253
|
-
const sel =
|
|
8253
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8254
8254
|
if (sel) {
|
|
8255
8255
|
const dir = exitBack ? "back" : "fwd";
|
|
8256
8256
|
const hit = _nullishCoalesce(this.atomAtEdge(sel, dir), () => ( (e.key === "ArrowUp" || e.key === "ArrowDown" ? this.atomAtEdgeVertical(sel, dir) : null)));
|
|
@@ -8270,7 +8270,7 @@ var Editor = (_class11 = class {
|
|
|
8270
8270
|
return;
|
|
8271
8271
|
}
|
|
8272
8272
|
if (e.key === "Tab" && !e.shiftKey && !mod2) {
|
|
8273
|
-
const sel =
|
|
8273
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8274
8274
|
if (sel && this.isCodeBlock(sel.head.path.slice(0, -2))) {
|
|
8275
8275
|
const result = mapInput(this.history.doc, "insertText", " ", sel, newId3);
|
|
8276
8276
|
if (result) {
|
|
@@ -8288,7 +8288,7 @@ var Editor = (_class11 = class {
|
|
|
8288
8288
|
}
|
|
8289
8289
|
}
|
|
8290
8290
|
if (e.key === "Tab" && e.shiftKey && !mod2) {
|
|
8291
|
-
const sel =
|
|
8291
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8292
8292
|
const blockPath = _optionalChain([sel, 'optionalAccess', _461 => _461.head, 'access', _462 => _462.path, 'access', _463 => _463.slice, 'call', _464 => _464(0, -2)]);
|
|
8293
8293
|
if (sel && blockPath && this.isCodeBlock(blockPath)) {
|
|
8294
8294
|
e.preventDefault();
|
|
@@ -8341,7 +8341,7 @@ var Editor = (_class11 = class {
|
|
|
8341
8341
|
}
|
|
8342
8342
|
const cmd = mod2 ? this.resolved.keymap[chord(e)] : void 0;
|
|
8343
8343
|
if (cmd) {
|
|
8344
|
-
const r = cmd({ doc: this.history.doc, sel:
|
|
8344
|
+
const r = cmd({ doc: this.history.doc, sel: _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc), markSel: this.markSel(), promptLink: this.opts.promptLink });
|
|
8345
8345
|
if (!r)
|
|
8346
8346
|
return;
|
|
8347
8347
|
e.preventDefault();
|
|
@@ -8365,7 +8365,7 @@ var Editor = (_class11 = class {
|
|
|
8365
8365
|
return;
|
|
8366
8366
|
}
|
|
8367
8367
|
if (mod2 && !e.shiftKey && (e.key === "a" || e.key === "A")) {
|
|
8368
|
-
const sel =
|
|
8368
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8369
8369
|
if (!sel)
|
|
8370
8370
|
return;
|
|
8371
8371
|
const blockPath = sel.head.path.slice(0, -2);
|
|
@@ -8373,7 +8373,7 @@ var Editor = (_class11 = class {
|
|
|
8373
8373
|
return;
|
|
8374
8374
|
e.preventDefault();
|
|
8375
8375
|
const len = leafText2(this.history.doc, [...blockPath, 0]).length;
|
|
8376
|
-
|
|
8376
|
+
_chunkLNSKDJMFcjs.writeSelection.call(void 0,
|
|
8377
8377
|
this.root,
|
|
8378
8378
|
this.history.doc,
|
|
8379
8379
|
{ anchor: { path: [...blockPath, 0, 0] }, head: { path: [...blockPath, 0, len] } }
|
|
@@ -8384,16 +8384,16 @@ var Editor = (_class11 = class {
|
|
|
8384
8384
|
// 代码块 model 是单纯文本叶,docToMd 只读首叶裸 text——加 mark 轻则渲幽灵 strong/save 后消失,
|
|
8385
8385
|
// 重则 toggleMark 把单叶按区间切成多叶,leaves(n)[0] 只取首叶 → 存盘丢码。marks 在代码块无语义,直接挡。
|
|
8386
8386
|
markSel() {
|
|
8387
|
-
const sel =
|
|
8387
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8388
8388
|
if (!sel)
|
|
8389
8389
|
return null;
|
|
8390
8390
|
if (this.isCodeBlock(sel.anchor.path.slice(0, -2)) || this.isCodeBlock(sel.head.path.slice(0, -2)))
|
|
8391
8391
|
return null;
|
|
8392
8392
|
return sel;
|
|
8393
8393
|
}
|
|
8394
|
-
// 复制/剪切/粘贴:选区 ⟷ markdown。md 是
|
|
8394
|
+
// 复制/剪切/粘贴:选区 ⟷ markdown。md 是 markloom 的唯一真值,剪贴板也走 md,跨编辑器/外部可读。
|
|
8395
8395
|
__init93() {this.onCopy = (e) => {
|
|
8396
|
-
const sel =
|
|
8396
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8397
8397
|
if (!sel)
|
|
8398
8398
|
return;
|
|
8399
8399
|
const md = serializeSelection(this.history.doc, sel);
|
|
@@ -8408,7 +8408,7 @@ var Editor = (_class11 = class {
|
|
|
8408
8408
|
return;
|
|
8409
8409
|
}
|
|
8410
8410
|
e.preventDefault();
|
|
8411
|
-
const sel =
|
|
8411
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8412
8412
|
if (!sel)
|
|
8413
8413
|
return;
|
|
8414
8414
|
const md = serializeSelection(this.history.doc, sel);
|
|
@@ -8422,7 +8422,7 @@ var Editor = (_class11 = class {
|
|
|
8422
8422
|
__init95() {this.onPaste = (e) => {
|
|
8423
8423
|
if (this.readonly || this.composing)
|
|
8424
8424
|
return;
|
|
8425
|
-
const sel =
|
|
8425
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8426
8426
|
if (!sel)
|
|
8427
8427
|
return;
|
|
8428
8428
|
const inCode = this.isCodeBlock(sel.head.path.slice(0, -2));
|
|
@@ -8683,7 +8683,7 @@ var Editor = (_class11 = class {
|
|
|
8683
8683
|
// 找到 head 路径上的 table 祖先 → 当前 (r,c) → nextCell → 把光标写到目标格首段首叶。
|
|
8684
8684
|
// caret 落在哪个表格的哪一格。沿 head 找第一个 type==='table' 祖先块 → {tablePath, table, r, c}。
|
|
8685
8685
|
tableCaret() {
|
|
8686
|
-
const sel =
|
|
8686
|
+
const sel = _chunkLNSKDJMFcjs.readSelection.call(void 0, this.root, this.history.doc);
|
|
8687
8687
|
if (!sel)
|
|
8688
8688
|
return null;
|
|
8689
8689
|
const head = sel.head.path;
|
|
@@ -8747,8 +8747,8 @@ var Editor = (_class11 = class {
|
|
|
8747
8747
|
__init100() {this.onFocusIn = (e) => {
|
|
8748
8748
|
if (!(e.target instanceof HTMLElement))
|
|
8749
8749
|
return;
|
|
8750
|
-
const cell = e.target.closest(".
|
|
8751
|
-
const table = _optionalChain([cell, 'optionalAccess', _500 => _500.closest, 'call', _501 => _501(".
|
|
8750
|
+
const cell = e.target.closest(".markloom-cell");
|
|
8751
|
+
const table = _optionalChain([cell, 'optionalAccess', _500 => _500.closest, 'call', _501 => _501(".markloom-table")]);
|
|
8752
8752
|
if (!cell || !table)
|
|
8753
8753
|
return;
|
|
8754
8754
|
const id = table.getAttribute("data-block-id");
|
|
@@ -8756,7 +8756,7 @@ var Editor = (_class11 = class {
|
|
|
8756
8756
|
if (!model || _chunkVVFIQLVRcjs.isText.call(void 0, model) || model.type !== "table")
|
|
8757
8757
|
return;
|
|
8758
8758
|
const grid = _chunkVVFIQLVRcjs.buildGrid.call(void 0, model);
|
|
8759
|
-
const cells = Array.from(table.querySelectorAll(".
|
|
8759
|
+
const cells = Array.from(table.querySelectorAll(".markloom-cell"));
|
|
8760
8760
|
if (cells.length !== grid.anchors.length)
|
|
8761
8761
|
return;
|
|
8762
8762
|
const idx = cells.indexOf(cell);
|
|
@@ -8772,10 +8772,10 @@ var Editor = (_class11 = class {
|
|
|
8772
8772
|
__init101() {this.onFocusOut = (e) => {
|
|
8773
8773
|
if (!(e.target instanceof HTMLElement))
|
|
8774
8774
|
return;
|
|
8775
|
-
const table = _optionalChain([e, 'access', _502 => _502.target, 'access', _503 => _503.closest, 'call', _504 => _504(".
|
|
8775
|
+
const table = _optionalChain([e, 'access', _502 => _502.target, 'access', _503 => _503.closest, 'call', _504 => _504(".markloom-cell"), 'optionalAccess', _505 => _505.closest, 'call', _506 => _506(".markloom-table")]);
|
|
8776
8776
|
if (!table)
|
|
8777
8777
|
return;
|
|
8778
|
-
table.querySelectorAll(".
|
|
8778
|
+
table.querySelectorAll(".markloom-cell").forEach((el) => {
|
|
8779
8779
|
el.removeAttribute("data-highlight-row");
|
|
8780
8780
|
el.removeAttribute("data-highlight-col");
|
|
8781
8781
|
});
|
|
@@ -8829,7 +8829,7 @@ function pathOfTaskItem(doc, root, li) {
|
|
|
8829
8829
|
const list = _chunkVVFIQLVRcjs.nodeAt.call(void 0, doc, listPath);
|
|
8830
8830
|
if (!list || _chunkVVFIQLVRcjs.isText.call(void 0, list) || list.type !== "list")
|
|
8831
8831
|
return null;
|
|
8832
|
-
const items =
|
|
8832
|
+
const items = _chunkLNSKDJMFcjs.elementChildren.call(void 0, listEl);
|
|
8833
8833
|
const idx = items.indexOf(li);
|
|
8834
8834
|
if (idx < 0 || idx >= list.children.length)
|
|
8835
8835
|
return null;
|
|
@@ -9027,4 +9027,4 @@ function diffSpan(a, b) {
|
|
|
9027
9027
|
|
|
9028
9028
|
|
|
9029
9029
|
|
|
9030
|
-
exports.atomIsSelected = atomIsSelected; exports.defaultBlockTag = defaultBlockTag; exports.defaultMarkTag = defaultMarkTag; exports.renderImage = renderImage; exports.safeCssValue = safeCssValue; exports.textStyleCss = textStyleCss; exports.renderEmbed = renderEmbed; exports.youtubeId = youtubeId; exports.twitchChannel = twitchChannel; exports.renderCode = renderCode; exports.renderTable = renderTable; exports.renderHr = renderHr; exports.defaultBlockRenderers = defaultBlockRenderers; exports.renderDoc = renderDoc; exports.renderToHtml = renderToHtml; exports.caret = caret; exports.leafText = leafText2; exports.wordBoundaryBack = wordBoundaryBack; exports.wordBoundaryFwd = wordBoundaryFwd; exports.lineBoundaryBack = lineBoundaryBack; exports.lineBoundaryFwd = lineBoundaryFwd; exports.isAtom = isAtom; exports.isOpaque = isOpaque; exports.mapInput = mapInput; exports.wrapList = wrapList; exports.CALLOUT_VARIANTS = CALLOUT_VARIANTS; exports.calloutVariantFromQuery = calloutVariantFromQuery; exports.blockTransform = blockTransform; exports.setCalloutVariant = setCalloutVariant; exports.cycleCalloutVariant = cycleCalloutVariant; exports.setAlign = setAlign2; exports.marksAtCaret = marksAtCaret; exports.toggleMarkList = toggleMarkList; exports.toggleMark = toggleMark; exports.mergeTextStyleAttrs = mergeTextStyleAttrs; exports.setTextStyle = setTextStyle; exports.serializeSelection = serializeSelection; exports.mapPaste = mapPaste; exports.mapPasteBlocks = mapPasteBlocks; exports.indentItem = indentItem; exports.outdentItem = outdentItem; exports.resolve = resolve; exports.textAlign = textAlign; exports.tableBlock = tableBlock; exports.codeBlock = codeBlock; exports.imageBlock = imageBlock; exports.embedBlock = embedBlock; exports.hrBlock = hrBlock; exports.blockExtensions = blockExtensions; exports.askInput = askInput; exports.normalizeLinkUrl = normalizeLinkUrl; exports.askLinkPopover = askLinkPopover; exports.closeAskInput = closeAskInput; exports.MentionMenu = MentionMenu; exports.codeControls = codeControls; exports.bubbleMenu = bubbleMenu; exports.slashMenu = slashMenu; exports.mentionMenu = mentionMenu; exports.dragHandle = dragHandle; exports.decorationExtensions = decorationExtensions; exports.history = history; exports.inputRules = inputRules; exports.boldMark = boldMark; exports.italicMark = italicMark; exports.codeMark = codeMark; exports.strikeMark = strikeMark; exports.underlineMark = underlineMark; exports.highlightMark = highlightMark; exports.superscriptMark = superscriptMark; exports.subscriptMark = subscriptMark; exports.linkMark = linkMark; exports.textStyleMark = textStyleMark; exports.markExtensions = markExtensions; exports.
|
|
9030
|
+
exports.atomIsSelected = atomIsSelected; exports.defaultBlockTag = defaultBlockTag; exports.defaultMarkTag = defaultMarkTag; exports.renderImage = renderImage; exports.safeCssValue = safeCssValue; exports.textStyleCss = textStyleCss; exports.renderEmbed = renderEmbed; exports.youtubeId = youtubeId; exports.twitchChannel = twitchChannel; exports.renderCode = renderCode; exports.renderTable = renderTable; exports.renderHr = renderHr; exports.defaultBlockRenderers = defaultBlockRenderers; exports.renderDoc = renderDoc; exports.renderToHtml = renderToHtml; exports.caret = caret; exports.leafText = leafText2; exports.wordBoundaryBack = wordBoundaryBack; exports.wordBoundaryFwd = wordBoundaryFwd; exports.lineBoundaryBack = lineBoundaryBack; exports.lineBoundaryFwd = lineBoundaryFwd; exports.isAtom = isAtom; exports.isOpaque = isOpaque; exports.mapInput = mapInput; exports.wrapList = wrapList; exports.CALLOUT_VARIANTS = CALLOUT_VARIANTS; exports.calloutVariantFromQuery = calloutVariantFromQuery; exports.blockTransform = blockTransform; exports.setCalloutVariant = setCalloutVariant; exports.cycleCalloutVariant = cycleCalloutVariant; exports.setAlign = setAlign2; exports.marksAtCaret = marksAtCaret; exports.toggleMarkList = toggleMarkList; exports.toggleMark = toggleMark; exports.mergeTextStyleAttrs = mergeTextStyleAttrs; exports.setTextStyle = setTextStyle; exports.serializeSelection = serializeSelection; exports.mapPaste = mapPaste; exports.mapPasteBlocks = mapPasteBlocks; exports.indentItem = indentItem; exports.outdentItem = outdentItem; exports.resolve = resolve; exports.textAlign = textAlign; exports.tableBlock = tableBlock; exports.codeBlock = codeBlock; exports.imageBlock = imageBlock; exports.embedBlock = embedBlock; exports.hrBlock = hrBlock; exports.blockExtensions = blockExtensions; exports.askInput = askInput; exports.normalizeLinkUrl = normalizeLinkUrl; exports.askLinkPopover = askLinkPopover; exports.closeAskInput = closeAskInput; exports.MentionMenu = MentionMenu; exports.codeControls = codeControls; exports.bubbleMenu = bubbleMenu; exports.slashMenu = slashMenu; exports.mentionMenu = mentionMenu; exports.dragHandle = dragHandle; exports.decorationExtensions = decorationExtensions; exports.history = history; exports.inputRules = inputRules; exports.boldMark = boldMark; exports.italicMark = italicMark; exports.codeMark = codeMark; exports.strikeMark = strikeMark; exports.underlineMark = underlineMark; exports.highlightMark = highlightMark; exports.superscriptMark = superscriptMark; exports.subscriptMark = subscriptMark; exports.linkMark = linkMark; exports.textStyleMark = textStyleMark; exports.markExtensions = markExtensions; exports.markloomKit = markloomKit; exports.CommentPanel = CommentPanel; exports.TocPanel = TocPanel; exports.MentionPopovers = MentionPopovers; exports.Editor = Editor; exports.chord = chord; exports.diffSpan = diffSpan;
|