quoin-editor 1.7.0 → 1.8.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/CHANGELOG.md +11 -0
- package/README.md +25 -10
- package/dist/ai-labels-BXX32H9a.d.cts +53 -0
- package/dist/ai-labels-BXX32H9a.d.ts +53 -0
- package/dist/ai.cjs +84 -86
- package/dist/ai.d.cts +4 -53
- package/dist/ai.d.ts +4 -53
- package/dist/ai.js +8 -10
- package/dist/ai.js.map +1 -1
- package/dist/catalogue.cjs +27 -26
- package/dist/catalogue.d.cts +10 -1
- package/dist/catalogue.d.ts +10 -1
- package/dist/catalogue.js +18 -17
- package/dist/catalogue.js.map +1 -1
- package/dist/{chunk-QR2NIDUK.cjs → chunk-4MCYQHFL.cjs} +2 -2
- package/dist/{chunk-YEFPH27F.cjs → chunk-53CNYRVQ.cjs} +92 -94
- package/dist/{chunk-FNJOPGMN.cjs → chunk-53FJFYBR.cjs} +115 -117
- package/dist/{chunk-OJ4O6HWC.js → chunk-5OZX2LV4.js} +10 -12
- package/dist/chunk-5OZX2LV4.js.map +1 -0
- package/dist/{chunk-OS2O6IKX.js → chunk-5RBMZGKV.js} +4 -4
- package/dist/{chunk-OS2O6IKX.js.map → chunk-5RBMZGKV.js.map} +1 -1
- package/dist/{chunk-4T4TJ2QS.cjs → chunk-7E43TURF.cjs} +7 -7
- package/dist/{chunk-I722LBD3.cjs → chunk-7X3T7VXV.cjs} +32 -34
- package/dist/{chunk-BJTOLCRR.js → chunk-7Y4B7NHO.js} +2 -2
- package/dist/chunk-7Y4B7NHO.js.map +1 -0
- package/dist/{chunk-MZXW2HXP.cjs → chunk-B3OBM6I4.cjs} +25 -27
- package/dist/{chunk-6T5YGCZ5.cjs → chunk-BA5WXBGE.cjs} +290 -293
- package/dist/{chunk-CSKKSXCE.js → chunk-CSPCDVCT.js} +3 -3
- package/dist/{chunk-CSKKSXCE.js.map → chunk-CSPCDVCT.js.map} +1 -1
- package/dist/{chunk-R7MYG522.js → chunk-D4L5FINK.js} +3 -3
- package/dist/{chunk-R7MYG522.js.map → chunk-D4L5FINK.js.map} +1 -1
- package/dist/{chunk-GHNQKJMD.js → chunk-DBOZFNWU.js} +3 -3
- package/dist/{chunk-GHNQKJMD.js.map → chunk-DBOZFNWU.js.map} +1 -1
- package/dist/{chunk-BM2GRZNM.cjs → chunk-DJU25PFC.cjs} +11 -11
- package/dist/chunk-DLQCTGC3.js +10 -0
- package/dist/chunk-DLQCTGC3.js.map +1 -0
- package/dist/{chunk-7GU25Z6L.js → chunk-DXUDBPG5.js} +9 -11
- package/dist/chunk-DXUDBPG5.js.map +1 -0
- package/dist/{chunk-KDK2ATMB.cjs → chunk-EZWJRBQT.cjs} +51 -53
- package/dist/{chunk-PWUFFHAQ.js → chunk-EZX37R5D.js} +8 -10
- package/dist/chunk-EZX37R5D.js.map +1 -0
- package/dist/{chunk-VZZPCYA3.cjs → chunk-FK7EBZPX.cjs} +226 -226
- package/dist/{chunk-BXSWZEA5.js → chunk-GPTJYWGS.js} +3 -3
- package/dist/{chunk-BXSWZEA5.js.map → chunk-GPTJYWGS.js.map} +1 -1
- package/dist/{chunk-H3C3MJW5.cjs → chunk-LM3DHROX.cjs} +2 -2
- package/dist/{chunk-AD3NY7NA.js → chunk-LSI4RMTY.js} +3 -3
- package/dist/{chunk-AD3NY7NA.js.map → chunk-LSI4RMTY.js.map} +1 -1
- package/dist/{chunk-LKZJ2TDU.cjs → chunk-MMS4D4MK.cjs} +10 -13
- package/dist/{chunk-PLUMKN4B.js → chunk-MRHDPXQ7.js} +8 -10
- package/dist/chunk-MRHDPXQ7.js.map +1 -0
- package/dist/{chunk-XFEDJEJF.js → chunk-MSWA5ZZM.js} +4 -4
- package/dist/{chunk-XFEDJEJF.js.map → chunk-MSWA5ZZM.js.map} +1 -1
- package/dist/{chunk-RQXJKJ5S.js → chunk-NCDMQCZR.js} +7 -10
- package/dist/chunk-NCDMQCZR.js.map +1 -0
- package/dist/{chunk-QJ34MOFV.cjs → chunk-P6HC7RUN.cjs} +120 -120
- package/dist/{chunk-UZS3TW75.js → chunk-PHQMHXNG.js} +9 -11
- package/dist/chunk-PHQMHXNG.js.map +1 -0
- package/dist/{chunk-WN7BZDNH.cjs → chunk-PURYVDC3.cjs} +13 -13
- package/dist/{chunk-JY5VUHKN.cjs → chunk-PVFSJXYQ.cjs} +28 -30
- package/dist/{chunk-QOIVLYMW.js → chunk-SP4F5F6V.js} +5 -5
- package/dist/{chunk-QOIVLYMW.js.map → chunk-SP4F5F6V.js.map} +1 -1
- package/dist/{chunk-BF7733XS.cjs → chunk-TQHFGSTT.cjs} +57 -59
- package/dist/{chunk-G25FMFEZ.js → chunk-UDBLZILE.js} +4 -4
- package/dist/{chunk-G25FMFEZ.js.map → chunk-UDBLZILE.js.map} +1 -1
- package/dist/{chunk-5JEQZIRI.js → chunk-VM567D6O.js} +8 -10
- package/dist/chunk-VM567D6O.js.map +1 -0
- package/dist/{chunk-MNA7MBCH.js → chunk-VWYPO6SX.js} +8 -10
- package/dist/chunk-VWYPO6SX.js.map +1 -0
- package/dist/{chunk-IJKGF6SC.js → chunk-WOGCD7JN.js} +8 -10
- package/dist/chunk-WOGCD7JN.js.map +1 -0
- package/dist/{chunk-AZF7B2AE.cjs → chunk-XKYNINUX.cjs} +11 -11
- package/dist/{chunk-HSLOPJVT.js → chunk-Y4EJ6UBV.js} +7 -10
- package/dist/chunk-Y4EJ6UBV.js.map +1 -0
- package/dist/{chunk-XZ4NC3Q7.cjs → chunk-YEDPBYO5.cjs} +4 -4
- package/dist/{chunk-STKGRXSA.cjs → chunk-YVPZDTVZ.cjs} +15 -17
- package/dist/chunk-ZWTIRGY5.cjs +10 -0
- package/dist/comments-labels-DWqsSz8G.d.cts +30 -0
- package/dist/comments-labels-DWqsSz8G.d.ts +30 -0
- package/dist/comments.cjs +63 -65
- package/dist/comments.d.cts +4 -30
- package/dist/comments.d.ts +4 -30
- package/dist/comments.js +9 -11
- package/dist/comments.js.map +1 -1
- package/dist/{diagram-extension-Da7hp-tv.d.ts → diagram-extension-22x_njXB.d.ts} +4 -12
- package/dist/{diagram-extension-D573COJv.d.cts → diagram-extension-C_FSkoj9.d.cts} +4 -12
- package/dist/diagram-labels-Bi_jEZ8_.d.cts +11 -0
- package/dist/diagram-labels-Bi_jEZ8_.d.ts +11 -0
- package/dist/diagram.cjs +10 -9
- package/dist/diagram.d.cts +3 -2
- package/dist/diagram.d.ts +3 -2
- package/dist/diagram.js +7 -6
- package/dist/diff-labels-DWwg7N0n.d.cts +27 -0
- package/dist/diff-labels-DWwg7N0n.d.ts +27 -0
- package/dist/diff.cjs +27 -29
- package/dist/diff.d.cts +4 -27
- package/dist/diff.d.ts +4 -27
- package/dist/diff.js +5 -7
- package/dist/diff.js.map +1 -1
- package/dist/docx.cjs +30 -30
- package/dist/docx.js +3 -3
- package/dist/embed-labels-BiVa9HYl.d.cts +23 -0
- package/dist/embed-labels-BiVa9HYl.d.ts +23 -0
- package/dist/embed.cjs +10 -9
- package/dist/embed.d.cts +4 -23
- package/dist/embed.d.ts +4 -23
- package/dist/embed.js +8 -7
- package/dist/emoji-extension-C832oGeT.d.ts +16 -0
- package/dist/emoji-extension-Dk5IQLZf.d.cts +16 -0
- package/dist/{emoji-extension-gRKnbW8G.d.ts → emoji-labels-YwOms7ZJ.d.cts} +2 -15
- package/dist/{emoji-extension-C3o_Y5uC.d.cts → emoji-labels-YwOms7ZJ.d.ts} +2 -15
- package/dist/emoji.cjs +10 -9
- package/dist/emoji.d.cts +4 -3
- package/dist/emoji.d.ts +4 -3
- package/dist/emoji.js +7 -6
- package/dist/engine.cjs +58 -58
- package/dist/engine.d.cts +8 -7
- package/dist/engine.d.ts +8 -7
- package/dist/engine.js +3 -3
- package/dist/find-extension-BfruAPLi.d.cts +15 -0
- package/dist/find-extension-DmK9_N81.d.ts +15 -0
- package/dist/{find-extension-B_Ctrs6T.d.ts → find-labels-C4vs8Qe9.d.cts} +2 -14
- package/dist/{find-extension-BGGsJMu4.d.cts → find-labels-C4vs8Qe9.d.ts} +2 -14
- package/dist/find.cjs +11 -10
- package/dist/find.d.cts +2 -1
- package/dist/find.d.ts +2 -1
- package/dist/find.js +7 -6
- package/dist/headless.cjs +74 -74
- package/dist/headless.d.cts +38 -8
- package/dist/headless.d.ts +38 -8
- package/dist/headless.js +4 -4
- package/dist/highlight.cjs +7 -6
- package/dist/highlight.js +6 -5
- package/dist/highlight.js.map +1 -1
- package/dist/{index-CsG7OQoq.d.cts → index-3fYvwqUZ.d.cts} +1 -1
- package/dist/{index-h1llgZM-.d.ts → index-CgxnzCO5.d.ts} +1 -1
- package/dist/index.cjs +87 -86
- package/dist/index.d.cts +18 -185
- package/dist/index.d.ts +18 -185
- package/dist/index.js +6 -5
- package/dist/labels-BhRJYo46.d.ts +176 -0
- package/dist/labels-CiCxj2jP.d.cts +176 -0
- package/dist/locale-ar.cjs +565 -0
- package/dist/locale-ar.d.cts +63 -0
- package/dist/locale-ar.d.ts +63 -0
- package/dist/locale-ar.js +551 -0
- package/dist/locale-ar.js.map +1 -0
- package/dist/locale-de.cjs +510 -0
- package/dist/locale-de.d.cts +63 -0
- package/dist/locale-de.d.ts +63 -0
- package/dist/locale-de.js +496 -0
- package/dist/locale-de.js.map +1 -0
- package/dist/locale-es.cjs +510 -0
- package/dist/locale-es.d.cts +63 -0
- package/dist/locale-es.d.ts +63 -0
- package/dist/locale-es.js +496 -0
- package/dist/locale-es.js.map +1 -0
- package/dist/locale-fr.cjs +510 -0
- package/dist/locale-fr.d.cts +63 -0
- package/dist/locale-fr.d.ts +63 -0
- package/dist/locale-fr.js +496 -0
- package/dist/locale-fr.js.map +1 -0
- package/dist/locale-ja.cjs +505 -0
- package/dist/locale-ja.d.cts +63 -0
- package/dist/locale-ja.d.ts +63 -0
- package/dist/locale-ja.js +491 -0
- package/dist/locale-ja.js.map +1 -0
- package/dist/locale-pt.cjs +511 -0
- package/dist/locale-pt.d.cts +63 -0
- package/dist/locale-pt.d.ts +63 -0
- package/dist/locale-pt.js +497 -0
- package/dist/locale-pt.js.map +1 -0
- package/dist/locale-zh.cjs +505 -0
- package/dist/locale-zh.d.cts +63 -0
- package/dist/locale-zh.d.ts +63 -0
- package/dist/locale-zh.js +491 -0
- package/dist/locale-zh.js.map +1 -0
- package/dist/math-labels-DOf5KFxp.d.cts +24 -0
- package/dist/math-labels-DOf5KFxp.d.ts +24 -0
- package/dist/math.cjs +11 -10
- package/dist/math.d.cts +4 -24
- package/dist/math.d.ts +4 -24
- package/dist/math.js +9 -8
- package/dist/mention-labels-DIQy8LRT.d.cts +15 -0
- package/dist/mention-labels-DIQy8LRT.d.ts +15 -0
- package/dist/mention.cjs +11 -10
- package/dist/mention.d.cts +4 -15
- package/dist/mention.d.ts +4 -15
- package/dist/mention.js +9 -8
- package/dist/{view-controller-p-2x3J7Y.d.ts → node-reveal-BnFcnHhz.d.ts} +14 -14
- package/dist/{view-controller-BfVSNZYZ.d.cts → node-reveal-DY6bimv3.d.cts} +14 -14
- package/dist/palette-BrX-hEd-.d.cts +4 -0
- package/dist/palette-BrX-hEd-.d.ts +4 -0
- package/dist/presence-labels-DXVJLifl.d.cts +15 -0
- package/dist/presence-labels-DXVJLifl.d.ts +15 -0
- package/dist/presence.cjs +40 -42
- package/dist/presence.d.cts +4 -15
- package/dist/presence.d.ts +4 -15
- package/dist/presence.js +9 -11
- package/dist/presence.js.map +1 -1
- package/dist/source-labels-CeQDXsYZ.d.cts +9 -0
- package/dist/source-labels-CeQDXsYZ.d.ts +9 -0
- package/dist/source.cjs +11 -14
- package/dist/source.d.cts +5 -10
- package/dist/source.d.ts +5 -10
- package/dist/source.js +7 -10
- package/dist/source.js.map +1 -1
- package/dist/{stats-extension-oD6D1cYy.d.ts → stats-extension-D5HySF0a.d.cts} +4 -16
- package/dist/{stats-extension-XqOTvRaq.d.cts → stats-extension-Dmw0Ujxe.d.ts} +4 -16
- package/dist/stats-labels-W8gep51s.d.cts +15 -0
- package/dist/stats-labels-W8gep51s.d.ts +15 -0
- package/dist/stats.cjs +11 -10
- package/dist/stats.d.cts +3 -2
- package/dist/stats.d.ts +3 -2
- package/dist/stats.js +8 -7
- package/dist/table-extension-7LkLNK6Q.d.cts +15 -0
- package/dist/table-extension-DEpV0DnP.d.ts +15 -0
- package/dist/{table-extension-v6VB59bF.d.ts → table-labels-Dc-MzU3j.d.cts} +2 -14
- package/dist/{table-extension-BP47hHoz.d.cts → table-labels-Dc-MzU3j.d.ts} +2 -14
- package/dist/table.cjs +26 -25
- package/dist/table.d.cts +2 -1
- package/dist/table.d.ts +2 -1
- package/dist/table.js +7 -6
- package/dist/{to-html-1oD-CDle.d.cts → to-html-C19PbIzh.d.cts} +1 -0
- package/dist/{to-html-CLRBCX0I.d.ts → to-html-CogwrQer.d.ts} +1 -0
- package/dist/{to-markdown-CFPMbbiX.d.cts → to-markdown-C2w7Dzg8.d.cts} +1 -0
- package/dist/{to-markdown-BVOzhgVM.d.ts → to-markdown-DC1EUye5.d.ts} +1 -0
- package/dist/toc-extension-Dvh37bWQ.d.cts +15 -0
- package/dist/toc-extension-SVckrFmb.d.ts +15 -0
- package/dist/toc-labels-B2apPfXG.d.cts +14 -0
- package/dist/toc-labels-B2apPfXG.d.ts +14 -0
- package/dist/toc.cjs +10 -9
- package/dist/toc.d.cts +3 -2
- package/dist/toc.d.ts +3 -2
- package/dist/toc.js +7 -6
- package/dist/{types-DXF9p4qV.d.cts → types-Bzhq5AXj.d.cts} +1 -0
- package/dist/{types-BjLcmV00.d.ts → types-DMuuDBVh.d.ts} +1 -0
- package/dist/view.cjs +4 -4
- package/dist/view.js +2 -2
- package/dist/yjs.cjs +121 -121
- package/dist/yjs.d.cts +2 -2
- package/dist/yjs.d.ts +2 -2
- package/dist/yjs.js +5 -5
- package/package.json +71 -1
- package/dist/chunk-5JEQZIRI.js.map +0 -1
- package/dist/chunk-7GU25Z6L.js.map +0 -1
- package/dist/chunk-BJTOLCRR.js.map +0 -1
- package/dist/chunk-HSLOPJVT.js.map +0 -1
- package/dist/chunk-IJKGF6SC.js.map +0 -1
- package/dist/chunk-MNA7MBCH.js.map +0 -1
- package/dist/chunk-OJ4O6HWC.js.map +0 -1
- package/dist/chunk-PLUMKN4B.js.map +0 -1
- package/dist/chunk-PWUFFHAQ.js.map +0 -1
- package/dist/chunk-RQXJKJ5S.js.map +0 -1
- package/dist/chunk-UZS3TW75.js.map +0 -1
- package/dist/toc-extension-CI6jNOYl.d.cts +0 -26
- package/dist/toc-extension-CTHWjNJC.d.ts +0 -26
- /package/dist/{chunk-WZA5S5EJ.cjs → chunk-I7X7B3WD.cjs} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkP6HC7RUN_cjs = require('./chunk-P6HC7RUN.cjs');
|
|
4
|
+
var chunkZWTIRGY5_cjs = require('./chunk-ZWTIRGY5.cjs');
|
|
4
5
|
var chunkA6PGQVTR_cjs = require('./chunk-A6PGQVTR.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
6
|
+
var chunkFK7EBZPX_cjs = require('./chunk-FK7EBZPX.cjs');
|
|
7
|
+
var chunkI7X7B3WD_cjs = require('./chunk-I7X7B3WD.cjs');
|
|
7
8
|
var React7 = require('react');
|
|
8
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
10
|
var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
@@ -700,7 +701,7 @@ function useLabels() {
|
|
|
700
701
|
}
|
|
701
702
|
|
|
702
703
|
// src/blocks/caption-markdown.ts
|
|
703
|
-
var captionText = (markdown) =>
|
|
704
|
+
var captionText = (markdown) => chunkI7X7B3WD_cjs.inlineText(chunkI7X7B3WD_cjs.parseInline(markdown), () => "");
|
|
704
705
|
function Token({ text: text2, color, className }) {
|
|
705
706
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: chunkA6PGQVTR_cjs.tokenColour(color) }, className, children: text2 });
|
|
706
707
|
}
|
|
@@ -721,17 +722,17 @@ function assetHref(resolveAssetUrl, storageKey) {
|
|
|
721
722
|
if (storageKey === "") return null;
|
|
722
723
|
try {
|
|
723
724
|
const src = resolveAssetUrl(storageKey);
|
|
724
|
-
return typeof src === "string" &&
|
|
725
|
+
return typeof src === "string" && chunkI7X7B3WD_cjs.sanitizeAssetUrl(src) || null;
|
|
725
726
|
} catch {
|
|
726
727
|
return null;
|
|
727
728
|
}
|
|
728
729
|
}
|
|
729
730
|
|
|
730
731
|
// src/blocks/image/image-source.ts
|
|
731
|
-
var hasPicture = (attrs) =>
|
|
732
|
+
var hasPicture = (attrs) => chunkI7X7B3WD_cjs.str(attrs.url) !== "" || chunkI7X7B3WD_cjs.str(attrs.storageKey) !== "";
|
|
732
733
|
function imageSource(attrs, resolveAssetUrl) {
|
|
733
|
-
const url =
|
|
734
|
-
return url === "" ? assetHref(resolveAssetUrl,
|
|
734
|
+
const url = chunkI7X7B3WD_cjs.str(attrs.url);
|
|
735
|
+
return url === "" ? assetHref(resolveAssetUrl, chunkI7X7B3WD_cjs.str(attrs.storageKey)) : chunkI7X7B3WD_cjs.sanitizeHref(url);
|
|
735
736
|
}
|
|
736
737
|
var HINT = "text-sm text-muted-foreground";
|
|
737
738
|
var TONE = {
|
|
@@ -743,34 +744,34 @@ var TONE = {
|
|
|
743
744
|
};
|
|
744
745
|
function MarkdownPreview({ data }) {
|
|
745
746
|
const labels = useLabels();
|
|
746
|
-
const markdown =
|
|
747
|
+
const markdown = chunkI7X7B3WD_cjs.str(data.markdown);
|
|
747
748
|
if (markdown.trim() === "") return /* @__PURE__ */ jsxRuntime.jsx("p", { className: HINT, children: labels.emptyMarkdown });
|
|
748
749
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap text-base leading-7", children: markdown });
|
|
749
750
|
}
|
|
750
751
|
function CodePreview({ data }) {
|
|
751
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "quoin-code quoin-code-scroll pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOverlay, { code:
|
|
752
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "quoin-code quoin-code-scroll pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOverlay, { code: chunkI7X7B3WD_cjs.str(data.code), language: chunkI7X7B3WD_cjs.str(data.language) }) });
|
|
752
753
|
}
|
|
753
754
|
function ImagePreview({ data }) {
|
|
754
755
|
const { resolveAssetUrl, labels } = useQuoin();
|
|
755
756
|
const src = imageSource(data, resolveAssetUrl);
|
|
756
757
|
if (src === null) return /* @__PURE__ */ jsxRuntime.jsx("p", { className: HINT, children: labels.emptyImage });
|
|
757
|
-
const caption = captionText(
|
|
758
|
+
const caption = captionText(chunkI7X7B3WD_cjs.str(data.caption));
|
|
758
759
|
return /* @__PURE__ */ jsxRuntime.jsxs("figure", { children: [
|
|
759
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src, alt:
|
|
760
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: chunkI7X7B3WD_cjs.str(data.alt) || labels.imageNoAlt, className: "max-w-full rounded-md" }),
|
|
760
761
|
caption && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: HINT, children: caption })
|
|
761
762
|
] });
|
|
762
763
|
}
|
|
763
764
|
function FilePreview({ data }) {
|
|
764
765
|
const labels = useLabels();
|
|
765
|
-
const name =
|
|
766
|
+
const name = chunkI7X7B3WD_cjs.str(data.filename);
|
|
766
767
|
if (name === "") return /* @__PURE__ */ jsxRuntime.jsx("p", { className: HINT, children: labels.emptyFile });
|
|
767
768
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: name });
|
|
768
769
|
}
|
|
769
770
|
function CalloutPreview({ data }) {
|
|
770
771
|
const labels = useLabels();
|
|
771
|
-
const body =
|
|
772
|
+
const body = chunkI7X7B3WD_cjs.str(data.body);
|
|
772
773
|
if (body.trim() === "") return /* @__PURE__ */ jsxRuntime.jsx("p", { className: HINT, children: labels.emptyCallout });
|
|
773
|
-
const tone =
|
|
774
|
+
const tone = chunkI7X7B3WD_cjs.str(data.tone) || "info";
|
|
774
775
|
const paint = TONE[tone] ?? "border-border bg-muted/50";
|
|
775
776
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-tone": tone, className: `rounded-md border-l-4 ${paint} p-3 text-sm`, children: body });
|
|
776
777
|
}
|
|
@@ -819,7 +820,7 @@ function selectNode(controller, blockId) {
|
|
|
819
820
|
const { editor } = controller;
|
|
820
821
|
const { selection } = editor.state;
|
|
821
822
|
if (selection?.kind === "node" && selection.block === blockId) return;
|
|
822
|
-
|
|
823
|
+
chunkP6HC7RUN_cjs.dispatchSelection(controller, chunkFK7EBZPX_cjs.nodeSelection(blockId));
|
|
823
824
|
}
|
|
824
825
|
function focusNode(controller, blockId) {
|
|
825
826
|
selectNode(controller, blockId);
|
|
@@ -849,8 +850,8 @@ var OPEN_EDITOR = "openEditor";
|
|
|
849
850
|
var ABOVE_CORE_KEYS = 200;
|
|
850
851
|
function turnedBlock(tr, { doc, selection }) {
|
|
851
852
|
if (selection?.kind !== "node" || tr.origin === "remote" || tr.origin === "reconcile") return void 0;
|
|
852
|
-
const before =
|
|
853
|
-
return before !== void 0 && before.type !==
|
|
853
|
+
const before = chunkI7X7B3WD_cjs.blockById(tr.before.doc, selection.block);
|
|
854
|
+
return before !== void 0 && before.type !== chunkI7X7B3WD_cjs.blockById(doc, selection.block)?.type ? selection.block : void 0;
|
|
854
855
|
}
|
|
855
856
|
function createVoidEditing() {
|
|
856
857
|
const starters = /* @__PURE__ */ new Map();
|
|
@@ -870,7 +871,7 @@ function createVoidEditing() {
|
|
|
870
871
|
start?.();
|
|
871
872
|
};
|
|
872
873
|
return {
|
|
873
|
-
extension:
|
|
874
|
+
extension: chunkFK7EBZPX_cjs.defineExtension({
|
|
874
875
|
name: "void-editing",
|
|
875
876
|
priority: ABOVE_CORE_KEYS,
|
|
876
877
|
keymap: { Enter: openEditor },
|
|
@@ -1147,32 +1148,32 @@ function settle(tr, before) {
|
|
|
1147
1148
|
const { schema } = tr.before;
|
|
1148
1149
|
const result = tr.selection;
|
|
1149
1150
|
if (result?.kind !== "blocks" || before?.kind === "blocks") return result;
|
|
1150
|
-
const ids =
|
|
1151
|
-
const head =
|
|
1152
|
-
if (head !== null && ids.includes(head) &&
|
|
1153
|
-
return
|
|
1151
|
+
const ids = chunkFK7EBZPX_cjs.selectedBlockIds(doc, result);
|
|
1152
|
+
const head = chunkFK7EBZPX_cjs.headBlockId(before);
|
|
1153
|
+
if (head !== null && ids.includes(head) && chunkFK7EBZPX_cjs.validateSelection(doc, schema, before) === before) return before;
|
|
1154
|
+
return chunkFK7EBZPX_cjs.endOf(doc, schema, ids[0]);
|
|
1154
1155
|
}
|
|
1155
1156
|
function runOnBlocks(controller, blockIds, command) {
|
|
1156
1157
|
const { state } = controller.editor;
|
|
1157
1158
|
const ids = blockIds.filter((id) => state.doc.index.has(id));
|
|
1158
1159
|
if (ids.length === 0) return false;
|
|
1159
1160
|
const before = state.selection;
|
|
1160
|
-
const exact =
|
|
1161
|
-
const ran = exact ? before :
|
|
1162
|
-
const { ok, tr } =
|
|
1163
|
-
const result = ok && tr !== null ? tr : new
|
|
1161
|
+
const exact = chunkI7X7B3WD_cjs.sameItems(chunkFK7EBZPX_cjs.selectedBlockIds(state.doc, before), ids);
|
|
1162
|
+
const ran = exact ? before : chunkFK7EBZPX_cjs.blockRangeSelection(ids[0], ids[ids.length - 1]);
|
|
1163
|
+
const { ok, tr } = chunkFK7EBZPX_cjs.runCommands(state, [chunkFK7EBZPX_cjs.setSelection(ran), command]);
|
|
1164
|
+
const result = ok && tr !== null ? tr : new chunkFK7EBZPX_cjs.Transaction(state).setSelection(ran);
|
|
1164
1165
|
const settled = exact ? result.selection : settle(result, before);
|
|
1165
|
-
if (!
|
|
1166
|
-
if (result.docChanged || !
|
|
1166
|
+
if (!chunkFK7EBZPX_cjs.sameSelection(settled, result.selection)) result.setSelection(settled);
|
|
1167
|
+
if (result.docChanged || !chunkFK7EBZPX_cjs.sameSelection(result.selection, before)) controller.dispatch(result);
|
|
1167
1168
|
return ok;
|
|
1168
1169
|
}
|
|
1169
1170
|
var noChange = () => true;
|
|
1170
1171
|
|
|
1171
1172
|
// src/gutter/block-menu-items.ts
|
|
1172
|
-
var rangeOf = (blockIds) =>
|
|
1173
|
+
var rangeOf = (blockIds) => chunkFK7EBZPX_cjs.blockRangeSelection(blockIds[0], blockIds[blockIds.length - 1]);
|
|
1173
1174
|
function selectedWith(state, blockId) {
|
|
1174
1175
|
const { doc, selection } = state;
|
|
1175
|
-
const selected =
|
|
1176
|
+
const selected = chunkFK7EBZPX_cjs.selectedBlockIds(doc, selection);
|
|
1176
1177
|
const ofBlocks = selection?.kind === "blocks" || selection?.kind === "text" && selected.length > 1;
|
|
1177
1178
|
return ofBlocks && selected.includes(blockId) ? selected : null;
|
|
1178
1179
|
}
|
|
@@ -1180,8 +1181,8 @@ function menuTargets(state, blockId) {
|
|
|
1180
1181
|
const selected = selectedWith(state, blockId);
|
|
1181
1182
|
if (selected !== null) return selected;
|
|
1182
1183
|
const { doc } = state;
|
|
1183
|
-
const index =
|
|
1184
|
-
return doc.blocks.slice(index,
|
|
1184
|
+
const index = chunkI7X7B3WD_cjs.requireBlockIndex(doc, blockId);
|
|
1185
|
+
return doc.blocks.slice(index, chunkFK7EBZPX_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
1185
1186
|
}
|
|
1186
1187
|
function styleTargets(state, blockId) {
|
|
1187
1188
|
return selectedWith(state, blockId) ?? [blockId];
|
|
@@ -1191,12 +1192,12 @@ function menuActions(core, extra = []) {
|
|
|
1191
1192
|
}
|
|
1192
1193
|
function markdownOf(editor, blockIds, resolveAssetUrl) {
|
|
1193
1194
|
const { doc } = editor.state;
|
|
1194
|
-
const range =
|
|
1195
|
+
const range = chunkFK7EBZPX_cjs.selectedBlockRange(doc, rangeOf(blockIds));
|
|
1195
1196
|
if (range === null) return "";
|
|
1196
|
-
const blocks = editor.codec.blocksFromDoc(
|
|
1197
|
-
return
|
|
1197
|
+
const blocks = editor.codec.blocksFromDoc(chunkI7X7B3WD_cjs.createDoc(doc.blocks.slice(range.start, range.end)));
|
|
1198
|
+
return chunkFK7EBZPX_cjs.toMarkdown(blocks, { schema: editor.schema, resolveAssetUrl, comments: false });
|
|
1198
1199
|
}
|
|
1199
|
-
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) &&
|
|
1200
|
+
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) && chunkFK7EBZPX_cjs.runCommands(state, [chunkFK7EBZPX_cjs.setSelection(rangeOf(blockIds)), command]).ok;
|
|
1200
1201
|
function coreBlockMenuActions(labels, options) {
|
|
1201
1202
|
const copy = (controller, blockIds, text2) => {
|
|
1202
1203
|
void copyText(text2).then((copied) => {
|
|
@@ -1210,7 +1211,7 @@ function coreBlockMenuActions(labels, options) {
|
|
|
1210
1211
|
label: labels.duplicate,
|
|
1211
1212
|
icon: CopyPlus,
|
|
1212
1213
|
shortcut: "Mod-d",
|
|
1213
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
1214
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.duplicateBlocks())
|
|
1214
1215
|
},
|
|
1215
1216
|
{
|
|
1216
1217
|
id: "copy",
|
|
@@ -1229,23 +1230,23 @@ function coreBlockMenuActions(labels, options) {
|
|
|
1229
1230
|
label: labels.moveUp,
|
|
1230
1231
|
icon: ArrowUp,
|
|
1231
1232
|
shortcut: "Mod-Shift-ArrowUp",
|
|
1232
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
1233
|
-
available: applies(
|
|
1233
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.moveBlocksUp),
|
|
1234
|
+
available: applies(chunkFK7EBZPX_cjs.moveBlocksUp)
|
|
1234
1235
|
},
|
|
1235
1236
|
{
|
|
1236
1237
|
id: "move-down",
|
|
1237
1238
|
label: labels.moveDown,
|
|
1238
1239
|
icon: ArrowDown,
|
|
1239
1240
|
shortcut: "Mod-Shift-ArrowDown",
|
|
1240
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
1241
|
-
available: applies(
|
|
1241
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.moveBlocksDown),
|
|
1242
|
+
available: applies(chunkFK7EBZPX_cjs.moveBlocksDown)
|
|
1242
1243
|
},
|
|
1243
1244
|
{
|
|
1244
1245
|
id: "delete",
|
|
1245
1246
|
label: labels.delete,
|
|
1246
1247
|
icon: Trash,
|
|
1247
1248
|
destructive: true,
|
|
1248
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
1249
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.deleteBlocks)
|
|
1249
1250
|
}
|
|
1250
1251
|
];
|
|
1251
1252
|
}
|
|
@@ -1291,7 +1292,7 @@ var sharedTone = (blocks) => {
|
|
|
1291
1292
|
function CalloutMenus({ kit, controller, blocks }) {
|
|
1292
1293
|
const labels = useLabels();
|
|
1293
1294
|
const blockIds = blocks.map((block) => block.id);
|
|
1294
|
-
const apply = (patch) => runOnBlocks(controller, blockIds,
|
|
1295
|
+
const apply = (patch) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.setAttrs(patch));
|
|
1295
1296
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1296
1297
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.Sub, { children: [
|
|
1297
1298
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.SubTrigger, { children: [
|
|
@@ -1311,7 +1312,7 @@ function CalloutMenus({ kit, controller, blocks }) {
|
|
|
1311
1312
|
}
|
|
1312
1313
|
function sharedColor(blocks, key) {
|
|
1313
1314
|
const coloured = blocks.filter((block) => block.type === "MARKDOWN");
|
|
1314
|
-
const colors = new Set(coloured.map((block) =>
|
|
1315
|
+
const colors = new Set(coloured.map((block) => chunkI7X7B3WD_cjs.paletteOrUndefined(block.attrs[key]) ?? "default"));
|
|
1315
1316
|
return colors.size === 1 ? [...colors][0] : "";
|
|
1316
1317
|
}
|
|
1317
1318
|
var swatches = {
|
|
@@ -1324,7 +1325,7 @@ function ColorGroups({ kit, value, onPick }) {
|
|
|
1324
1325
|
const backgroundTitle = React7.useId();
|
|
1325
1326
|
const group = (key, title, titleId) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1326
1327
|
/* @__PURE__ */ jsxRuntime.jsx(kit.Label, { id: titleId, children: title }),
|
|
1327
|
-
/* @__PURE__ */ jsxRuntime.jsx(kit.RadioGroup, { "aria-labelledby": titleId, value: value[key], onValueChange: (name) => onPick(key, name), children:
|
|
1328
|
+
/* @__PURE__ */ jsxRuntime.jsx(kit.RadioGroup, { "aria-labelledby": titleId, value: value[key], onValueChange: (name) => onPick(key, name), children: chunkI7X7B3WD_cjs.PALETTE.map((name) => /* @__PURE__ */ jsxRuntime.jsxs(kit.RadioItem, { value: name, indicator: /* @__PURE__ */ jsxRuntime.jsx(Check, { className: "size-4" }), children: [
|
|
1328
1329
|
swatches[key](name),
|
|
1329
1330
|
labels.colors[name]
|
|
1330
1331
|
] }, name)) })
|
|
@@ -1339,7 +1340,7 @@ function ColorMenu({ kit, controller, blocks }) {
|
|
|
1339
1340
|
const labels = useLabels();
|
|
1340
1341
|
const blockIds = blocks.map((block) => block.id);
|
|
1341
1342
|
const value = { color: sharedColor(blocks, "color"), background: sharedColor(blocks, "background") };
|
|
1342
|
-
const pick = (key, name) => runOnBlocks(controller, blockIds,
|
|
1343
|
+
const pick = (key, name) => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.setBlockColor({ [key]: name === "default" ? null : name }));
|
|
1343
1344
|
return /* @__PURE__ */ jsxRuntime.jsxs(kit.Sub, { children: [
|
|
1344
1345
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.SubTrigger, { children: [
|
|
1345
1346
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: Palette }),
|
|
@@ -1370,7 +1371,7 @@ function modifierText(modifier, isMac, { keyNames }) {
|
|
|
1370
1371
|
return Object.hasOwn(MODIFIERS, name) ? keyNames[MODIFIERS[name]] : capitalized(modifier);
|
|
1371
1372
|
}
|
|
1372
1373
|
function formatShortcut(shortcut, platform = {}) {
|
|
1373
|
-
const { isMac =
|
|
1374
|
+
const { isMac = chunkFK7EBZPX_cjs.detectMac(), labels = englishLabels } = platform;
|
|
1374
1375
|
const parts = shortcut.split(shortcut.includes("+") ? "+" : "-");
|
|
1375
1376
|
const key = parts.pop() ?? shortcut;
|
|
1376
1377
|
const written = [...parts.map((modifier) => modifierText(modifier, isMac, labels)), keyText(key, labels)];
|
|
@@ -1450,21 +1451,21 @@ function languageOptions(query, plainText) {
|
|
|
1450
1451
|
}
|
|
1451
1452
|
|
|
1452
1453
|
// src/blocks/insert-blocks.ts
|
|
1453
|
-
var isEmptyParagraph = (schema, block) =>
|
|
1454
|
+
var isEmptyParagraph = (schema, block) => chunkFK7EBZPX_cjs.isParagraph(block) && chunkFK7EBZPX_cjs.regionLength(block, chunkFK7EBZPX_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
1454
1455
|
function fresh(schema, { id, type, attrs, regions }, indent3) {
|
|
1455
|
-
const block =
|
|
1456
|
+
const block = chunkFK7EBZPX_cjs.createBlock(schema, type, attrs, indent3, id);
|
|
1456
1457
|
return regions === void 0 ? block : { ...block, regions };
|
|
1457
1458
|
}
|
|
1458
1459
|
function landOnLine(tr, schema, index, indent3) {
|
|
1459
1460
|
const next = tr.doc.blocks[index];
|
|
1460
1461
|
const reused = next !== void 0 && next.indent === indent3 && isEmptyParagraph(schema, next);
|
|
1461
|
-
const line = reused ? next :
|
|
1462
|
-
if (!reused) tr.step(
|
|
1463
|
-
tr.setSelection(
|
|
1462
|
+
const line = reused ? next : chunkFK7EBZPX_cjs.createBlock(schema, schema.defaultTextBlock, {}, indent3);
|
|
1463
|
+
if (!reused) tr.step(chunkFK7EBZPX_cjs.insertBlocksStep(index, [line]));
|
|
1464
|
+
tr.setSelection(chunkFK7EBZPX_cjs.startOf(tr.doc, schema, line.id));
|
|
1464
1465
|
}
|
|
1465
1466
|
function land(tr, schema, landing, first, after) {
|
|
1466
|
-
if (landing === "text") tr.setSelection(
|
|
1467
|
-
if (landing === "editor") tr.setSelection(
|
|
1467
|
+
if (landing === "text") tr.setSelection(chunkFK7EBZPX_cjs.startOf(tr.doc, schema, first.id));
|
|
1468
|
+
if (landing === "editor") tr.setSelection(chunkFK7EBZPX_cjs.nodeSelection(first.id)).setMeta(OPEN_EDITOR, first.id);
|
|
1468
1469
|
if (landing === "line") landOnLine(tr, schema, after, first.indent);
|
|
1469
1470
|
}
|
|
1470
1471
|
function anchorIndex(doc, id) {
|
|
@@ -1474,24 +1475,24 @@ function anchorIndex(doc, id) {
|
|
|
1474
1475
|
function insertBlocks(blocks, landing, anchorId) {
|
|
1475
1476
|
return (state, dispatch) => {
|
|
1476
1477
|
const { doc, schema } = state;
|
|
1477
|
-
const id = anchorId === void 0 ?
|
|
1478
|
+
const id = anchorId === void 0 ? chunkFK7EBZPX_cjs.headBlockId(state.selection) : anchorId;
|
|
1478
1479
|
const index = anchorIndex(doc, id);
|
|
1479
1480
|
if (index === void 0 || blocks.length === 0) return false;
|
|
1480
1481
|
const anchor = id === null ? void 0 : doc.blocks[index];
|
|
1481
1482
|
const created2 = blocks.map((block) => fresh(schema, block, anchor?.indent ?? 0));
|
|
1482
|
-
const tr = new
|
|
1483
|
+
const tr = new chunkFK7EBZPX_cjs.Transaction(state);
|
|
1483
1484
|
const empty = anchor !== void 0 && landing !== "stay" && isEmptyParagraph(schema, anchor);
|
|
1484
1485
|
if (empty && landing === "line") {
|
|
1485
|
-
tr.step(
|
|
1486
|
+
tr.step(chunkFK7EBZPX_cjs.insertBlocksStep(index, created2)).setSelection(chunkFK7EBZPX_cjs.startOf(tr.doc, schema, anchor.id));
|
|
1486
1487
|
} else if (empty) {
|
|
1487
1488
|
const [first, ...rest] = created2;
|
|
1488
1489
|
const filled = { ...first, id: anchor.id };
|
|
1489
|
-
tr.step(
|
|
1490
|
-
if (rest.length > 0) tr.step(
|
|
1490
|
+
tr.step(chunkFK7EBZPX_cjs.replaceBlockStep(filled));
|
|
1491
|
+
if (rest.length > 0) tr.step(chunkFK7EBZPX_cjs.insertBlocksStep(index + 1, rest));
|
|
1491
1492
|
land(tr, schema, landing, filled, index + created2.length);
|
|
1492
1493
|
} else {
|
|
1493
|
-
const at = anchor === void 0 ? 0 :
|
|
1494
|
-
tr.step(
|
|
1494
|
+
const at = anchor === void 0 ? 0 : chunkFK7EBZPX_cjs.descendantsEnd(doc, index);
|
|
1495
|
+
tr.step(chunkFK7EBZPX_cjs.insertBlocksStep(at, created2));
|
|
1495
1496
|
land(tr, schema, landing, created2[0], at + created2.length);
|
|
1496
1497
|
}
|
|
1497
1498
|
dispatch?.(tr);
|
|
@@ -1504,7 +1505,7 @@ function landingFor(flow, hasEditor) {
|
|
|
1504
1505
|
}
|
|
1505
1506
|
function insertBlockToWrite(block, hasEditor, anchorId) {
|
|
1506
1507
|
return (state, dispatch) => {
|
|
1507
|
-
const landing = landingFor(
|
|
1508
|
+
const landing = landingFor(chunkI7X7B3WD_cjs.specFor(state.schema, block.type).flow, hasEditor);
|
|
1508
1509
|
return insertBlocks([block], landing, anchorId)(state, dispatch);
|
|
1509
1510
|
};
|
|
1510
1511
|
}
|
|
@@ -1512,20 +1513,20 @@ function insertBlockToWrite(block, hasEditor, anchorId) {
|
|
|
1512
1513
|
// src/blocks/code/code-actions.ts
|
|
1513
1514
|
function writeCode(controller, blockId, code, group) {
|
|
1514
1515
|
const { editor } = controller;
|
|
1515
|
-
const block =
|
|
1516
|
+
const block = chunkI7X7B3WD_cjs.blockById(editor.state.doc, blockId);
|
|
1516
1517
|
if (block === void 0 || block.attrs.code === code) return;
|
|
1517
|
-
controller.dispatch(editor.createTransaction().step(
|
|
1518
|
+
controller.dispatch(editor.createTransaction().step(chunkFK7EBZPX_cjs.setAttrsStep(blockId, { code })).setMeta(chunkFK7EBZPX_cjs.HISTORY_GROUP, group));
|
|
1518
1519
|
}
|
|
1519
1520
|
function codeToParagraph(blockId) {
|
|
1520
1521
|
return (state, dispatch) => {
|
|
1521
|
-
const turn =
|
|
1522
|
-
const { ok, tr } =
|
|
1522
|
+
const turn = chunkFK7EBZPX_cjs.setBlockType("MARKDOWN", { kind: "paragraph" });
|
|
1523
|
+
const { ok, tr } = chunkFK7EBZPX_cjs.runCommands(state, [chunkFK7EBZPX_cjs.setSelection(chunkFK7EBZPX_cjs.nodeSelection(blockId)), turn]);
|
|
1523
1524
|
if (ok && tr !== null) dispatch?.(tr);
|
|
1524
1525
|
return ok;
|
|
1525
1526
|
};
|
|
1526
1527
|
}
|
|
1527
1528
|
function leaveCode(controller, blockId, direction, addsLine = false) {
|
|
1528
|
-
const moved =
|
|
1529
|
+
const moved = chunkP6HC7RUN_cjs.moveToNeighbour(controller, blockId, direction);
|
|
1529
1530
|
if (!moved && !(addsLine && controller.run(insertBlocks([{ type: "MARKDOWN" }], "text", blockId)))) return false;
|
|
1530
1531
|
controller.focus();
|
|
1531
1532
|
return true;
|
|
@@ -1603,8 +1604,8 @@ var MOD_KEYS = [
|
|
|
1603
1604
|
["Mod-a", ({ value, start, end }) => start === 0 && end === value.length ? { kind: "selectAll" } : null]
|
|
1604
1605
|
];
|
|
1605
1606
|
function codeKeyAction(event, field, isMac) {
|
|
1606
|
-
const name =
|
|
1607
|
-
const modKey = MOD_KEYS.find(([key]) =>
|
|
1607
|
+
const name = chunkFK7EBZPX_cjs.keyName(event, isMac);
|
|
1608
|
+
const modKey = MOD_KEYS.find(([key]) => chunkFK7EBZPX_cjs.normalizeKey(key, isMac) === name);
|
|
1608
1609
|
const handler = modKey?.[1] ?? (Object.hasOwn(KEYS, name) ? KEYS[name] : void 0);
|
|
1609
1610
|
return handler?.(field) ?? null;
|
|
1610
1611
|
}
|
|
@@ -1650,7 +1651,7 @@ function travel({ controller, blockId, area }, command) {
|
|
|
1650
1651
|
const before = area.value;
|
|
1651
1652
|
controller.run(command);
|
|
1652
1653
|
const { selection } = controller.editor.state;
|
|
1653
|
-
const edit2 =
|
|
1654
|
+
const edit2 = chunkP6HC7RUN_cjs.textDiff(before, area.value);
|
|
1654
1655
|
if (selection?.kind !== "node" || selection.block !== blockId) controller.focus();
|
|
1655
1656
|
else if (edit2 !== null) area.setSelectionRange(edit2.from + edit2.insert.length, edit2.from + edit2.insert.length);
|
|
1656
1657
|
return true;
|
|
@@ -1666,13 +1667,13 @@ function runCodeAction(action, context) {
|
|
|
1666
1667
|
case "paragraph":
|
|
1667
1668
|
return selectAndFocus(context, codeToParagraph(blockId));
|
|
1668
1669
|
case "undo":
|
|
1669
|
-
return travel(context,
|
|
1670
|
+
return travel(context, chunkFK7EBZPX_cjs.undo);
|
|
1670
1671
|
case "redo":
|
|
1671
|
-
return travel(context,
|
|
1672
|
+
return travel(context, chunkFK7EBZPX_cjs.redo);
|
|
1672
1673
|
case "selectAll":
|
|
1673
|
-
return selectAndFocus(context,
|
|
1674
|
+
return selectAndFocus(context, chunkFK7EBZPX_cjs.selectAll);
|
|
1674
1675
|
case "escape":
|
|
1675
|
-
return selectAndFocus(context,
|
|
1676
|
+
return selectAndFocus(context, chunkFK7EBZPX_cjs.setSelection(chunkFK7EBZPX_cjs.blockRangeSelection(blockId)));
|
|
1676
1677
|
case "controls":
|
|
1677
1678
|
context.focusControls();
|
|
1678
1679
|
return true;
|
|
@@ -1735,18 +1736,18 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1735
1736
|
useTypeIntoCode(controller, blockId, field, edit2);
|
|
1736
1737
|
const onKeyDown = (event) => {
|
|
1737
1738
|
const area = event.currentTarget;
|
|
1738
|
-
if (
|
|
1739
|
+
if (chunkP6HC7RUN_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1739
1740
|
const action = codeKeyAction(event, fieldOf(area), controller.isMac);
|
|
1740
1741
|
if (action !== null && runCodeAction(action, { controller, blockId, area, edit: edit2, focusControls })) event.preventDefault();
|
|
1741
1742
|
};
|
|
1742
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [
|
|
1743
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [chunkP6HC7RUN_cjs.NATIVE_INTERACTION]: "" }, dir: "ltr", className: "quoin-code-scroll", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-code-lines", children: [
|
|
1743
1744
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1744
1745
|
HighlightOverlay,
|
|
1745
1746
|
{
|
|
1746
1747
|
"aria-hidden": "true",
|
|
1747
1748
|
drawnRef: drawn,
|
|
1748
|
-
code:
|
|
1749
|
-
language:
|
|
1749
|
+
code: chunkI7X7B3WD_cjs.str(block.attrs.code),
|
|
1750
|
+
language: chunkI7X7B3WD_cjs.str(block.attrs.language)
|
|
1750
1751
|
}
|
|
1751
1752
|
),
|
|
1752
1753
|
/* @__PURE__ */ jsxRuntime.jsx("span", { ref: mark, "aria-hidden": "true", className: "quoin-code-caret" }),
|
|
@@ -1756,7 +1757,7 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1756
1757
|
ref: field,
|
|
1757
1758
|
"aria-label": labels.codeText,
|
|
1758
1759
|
"aria-keyshortcuts": "Alt+F10",
|
|
1759
|
-
value:
|
|
1760
|
+
value: chunkI7X7B3WD_cjs.str(block.attrs.code),
|
|
1760
1761
|
wrap: "off",
|
|
1761
1762
|
tabIndex: -1,
|
|
1762
1763
|
spellCheck: false,
|
|
@@ -1809,7 +1810,7 @@ var Button = React7__namespace.forwardRef(function Button2({ className, variant
|
|
|
1809
1810
|
var COPIED_FOR_MS = 1500;
|
|
1810
1811
|
function CopyCodeButton({ code, controller }) {
|
|
1811
1812
|
const labels = useLabels();
|
|
1812
|
-
const readOnly =
|
|
1813
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
1813
1814
|
const [copied, setCopied] = React7.useState(false);
|
|
1814
1815
|
React7.useEffect(() => {
|
|
1815
1816
|
if (!copied) return;
|
|
@@ -1892,7 +1893,7 @@ var preventDefault = (event) => event.preventDefault();
|
|
|
1892
1893
|
|
|
1893
1894
|
// src/blocks/text/set-block-attrs.ts
|
|
1894
1895
|
function setBlockAttrs(controller, blockId, patch) {
|
|
1895
|
-
if (!controller.readOnly) controller.run(
|
|
1896
|
+
if (!controller.readOnly) controller.run(chunkP6HC7RUN_cjs.onBlock(blockId, chunkFK7EBZPX_cjs.setAttrs(patch)));
|
|
1896
1897
|
}
|
|
1897
1898
|
var FIELD = `quoin-code-language quoin-code-control ${FOCUS_RING}`;
|
|
1898
1899
|
var CONTENT = `${MENU_CONTENT} flex max-h-64 w-48 flex-col overflow-y-hidden`;
|
|
@@ -1908,7 +1909,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1908
1909
|
const options = draft === null ? [] : languageOptions(draft === shown ? "" : draft, labels.plainText);
|
|
1909
1910
|
const open = options.length > 0;
|
|
1910
1911
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1911
|
-
|
|
1912
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
1912
1913
|
list.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
1913
1914
|
}, [active]);
|
|
1914
1915
|
const close = () => {
|
|
@@ -1934,7 +1935,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1934
1935
|
onDone();
|
|
1935
1936
|
};
|
|
1936
1937
|
const onKeyDown = (event) => {
|
|
1937
|
-
if (
|
|
1938
|
+
if (chunkP6HC7RUN_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1938
1939
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1939
1940
|
event.preventDefault();
|
|
1940
1941
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
@@ -2008,11 +2009,11 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
2008
2009
|
}
|
|
2009
2010
|
var CodeBlock = ({ block, controller }) => {
|
|
2010
2011
|
const labels = useLabels();
|
|
2011
|
-
const readOnly =
|
|
2012
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
2012
2013
|
const languageField = React7.useRef(null);
|
|
2013
2014
|
const codeField = React7.useRef(null);
|
|
2014
|
-
const code =
|
|
2015
|
-
const language2 =
|
|
2015
|
+
const code = chunkI7X7B3WD_cjs.str(block.attrs.code);
|
|
2016
|
+
const language2 = chunkI7X7B3WD_cjs.str(block.attrs.language);
|
|
2016
2017
|
const name = languageName(language2) ?? language2;
|
|
2017
2018
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "group", "aria-label": labels.blockNames.code, contentEditable: false, className: "quoin-code", children: [
|
|
2018
2019
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-code-header", children: [
|
|
@@ -2110,7 +2111,7 @@ function selectHandlers(controller, blockId, root, onSelect) {
|
|
|
2110
2111
|
return {
|
|
2111
2112
|
onKeyDown(event) {
|
|
2112
2113
|
const key = event.nativeEvent;
|
|
2113
|
-
if (
|
|
2114
|
+
if (chunkP6HC7RUN_cjs.isComposingKey(controller, key)) return;
|
|
2114
2115
|
if (event.key === "Escape") select();
|
|
2115
2116
|
else if (!(event.metaKey || event.ctrlKey) || event.target.matches("input:not([type=file])") || !controller.edit(() => controller.editor.handleKey(key)))
|
|
2116
2117
|
return;
|
|
@@ -2250,16 +2251,16 @@ var kindOf = (value) => KINDS.find(([, pattern]) => pattern.test(value))?.[0];
|
|
|
2250
2251
|
var fileIcon = (mime, filename) => kindOf(mime) ?? kindOf(/\.([^.]+)$/.exec(filename)?.[1].toLowerCase() ?? "") ?? FileIcon;
|
|
2251
2252
|
|
|
2252
2253
|
// src/blocks/file/file-source.ts
|
|
2253
|
-
var fileName = (attrs) =>
|
|
2254
|
+
var fileName = (attrs) => chunkI7X7B3WD_cjs.str(attrs.filename) || chunkI7X7B3WD_cjs.str(attrs.storageKey);
|
|
2254
2255
|
var hasFile = (attrs) => fileName(attrs) !== "";
|
|
2255
2256
|
function FileCard({ block, controller, readOnly }) {
|
|
2256
2257
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
2257
2258
|
const card = React7.useRef(null);
|
|
2258
2259
|
const { id, attrs } = block;
|
|
2259
2260
|
const name = fileName(attrs);
|
|
2260
|
-
const size =
|
|
2261
|
-
const href = assetHref(resolveAssetUrl,
|
|
2262
|
-
const Icon2 = fileIcon(
|
|
2261
|
+
const size = chunkI7X7B3WD_cjs.optionalNumber(attrs.size);
|
|
2262
|
+
const href = assetHref(resolveAssetUrl, chunkI7X7B3WD_cjs.str(attrs.storageKey));
|
|
2263
|
+
const Icon2 = fileIcon(chunkI7X7B3WD_cjs.str(attrs.mime), name);
|
|
2263
2264
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: card, className: "quoin-file-card", ...selectHandlers(controller, id, card), children: [
|
|
2264
2265
|
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { "aria-hidden": "true", className: "quoin-file-icon" }),
|
|
2265
2266
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "quoin-file-name", children: name }),
|
|
@@ -2268,7 +2269,7 @@ function FileCard({ block, controller, readOnly }) {
|
|
|
2268
2269
|
"a",
|
|
2269
2270
|
{
|
|
2270
2271
|
href,
|
|
2271
|
-
download:
|
|
2272
|
+
download: chunkI7X7B3WD_cjs.str(attrs.filename),
|
|
2272
2273
|
target: "_blank",
|
|
2273
2274
|
rel: "noopener",
|
|
2274
2275
|
"aria-label": labels.downloadFile(name),
|
|
@@ -2294,14 +2295,14 @@ function claimUpload(controller, blockId) {
|
|
|
2294
2295
|
}
|
|
2295
2296
|
var isNewestUpload = (controller, blockId, token) => newestUploads.get(controller)?.get(blockId) === token;
|
|
2296
2297
|
function assetOf(controller, blockId, type) {
|
|
2297
|
-
const block =
|
|
2298
|
+
const block = chunkI7X7B3WD_cjs.blockById(controller.editor.state.doc, blockId);
|
|
2298
2299
|
if (block?.type !== type || controller.readOnly) return null;
|
|
2299
|
-
return { url:
|
|
2300
|
+
return { url: chunkI7X7B3WD_cjs.str(block.attrs.url), storageKey: chunkI7X7B3WD_cjs.str(block.attrs.storageKey) };
|
|
2300
2301
|
}
|
|
2301
2302
|
var sameAsset = (a, b) => a !== null && b !== null && a.url === b.url && a.storageKey === b.storageKey;
|
|
2302
2303
|
function writeAttrs(controller, blockId, patch, recorded) {
|
|
2303
2304
|
const { editor } = controller;
|
|
2304
|
-
const tr = editor.createTransaction().step(
|
|
2305
|
+
const tr = editor.createTransaction().step(chunkFK7EBZPX_cjs.setAttrsStep(blockId, patch));
|
|
2305
2306
|
editor.dispatch(recorded ? tr : tr.setMeta("addToHistory", false));
|
|
2306
2307
|
}
|
|
2307
2308
|
async function uploadInto(controller, blockId, file, { type, category }, { upload, onLand }, land2) {
|
|
@@ -2332,7 +2333,7 @@ var uploadFile = (controller, blockId, file, host) => uploadInto(
|
|
|
2332
2333
|
var anyFile = () => true;
|
|
2333
2334
|
var FileBlock = ({ block, controller }) => {
|
|
2334
2335
|
const labels = useLabels();
|
|
2335
|
-
const readOnly =
|
|
2336
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
2336
2337
|
const root = React7.useRef(null);
|
|
2337
2338
|
const filled = hasFile(block.attrs);
|
|
2338
2339
|
useNodeKeys(controller, block.id, !readOnly, !filled, root);
|
|
@@ -2398,7 +2399,7 @@ function usePartAnchor(controller, blockId, selector) {
|
|
|
2398
2399
|
// src/blocks/void/node-toolbar-items.ts
|
|
2399
2400
|
var replaceItem = (title, run) => run ? [{ id: "replace", title, icon: Upload, run }] : [];
|
|
2400
2401
|
function deleteBlock(controller, blockId) {
|
|
2401
|
-
runOnBlocks(controller, [blockId],
|
|
2402
|
+
runOnBlocks(controller, [blockId], chunkFK7EBZPX_cjs.deleteBlocks);
|
|
2402
2403
|
controller.focus();
|
|
2403
2404
|
}
|
|
2404
2405
|
var deleteItem = (blockId, title) => ({
|
|
@@ -2413,8 +2414,8 @@ function markItem(mark, title, icon) {
|
|
|
2413
2414
|
id: mark,
|
|
2414
2415
|
title,
|
|
2415
2416
|
icon,
|
|
2416
|
-
isActive: (state) =>
|
|
2417
|
-
run: (controller) => void controller.run(
|
|
2417
|
+
isActive: (state) => chunkFK7EBZPX_cjs.isActive(state, mark),
|
|
2418
|
+
run: (controller) => void controller.run(chunkFK7EBZPX_cjs.toggleMark(mark))
|
|
2418
2419
|
};
|
|
2419
2420
|
}
|
|
2420
2421
|
var linkItem = (labels, openLink) => ({
|
|
@@ -2484,7 +2485,7 @@ function useRovingFocus() {
|
|
|
2484
2485
|
},
|
|
2485
2486
|
[syncTabStop]
|
|
2486
2487
|
);
|
|
2487
|
-
|
|
2488
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(syncTabStop);
|
|
2488
2489
|
const onFocus = (event) => {
|
|
2489
2490
|
if (!owns(event.target)) return;
|
|
2490
2491
|
current.current = event.target;
|
|
@@ -2503,7 +2504,7 @@ function useRovingFocus() {
|
|
|
2503
2504
|
// src/menus/floating/use-focus-key.ts
|
|
2504
2505
|
var isFocusKey = (event) => event.key === "F10" && event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
2505
2506
|
function useFocusKey(controller, focus) {
|
|
2506
|
-
|
|
2507
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
2507
2508
|
const intercept = (event) => {
|
|
2508
2509
|
if (!isFocusKey(event)) return false;
|
|
2509
2510
|
event.preventDefault();
|
|
@@ -2515,11 +2516,11 @@ function useFocusKey(controller, focus) {
|
|
|
2515
2516
|
}
|
|
2516
2517
|
function NodeToolbar(props) {
|
|
2517
2518
|
const { blockId, controller, label, anchor, items, next, buttonRefs, children, popover } = props;
|
|
2518
|
-
const state =
|
|
2519
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
2519
2520
|
const roving = useRovingFocus();
|
|
2520
2521
|
useFocusKey(controller, roving.focusCurrent);
|
|
2521
2522
|
const onKeyDown = (event) => {
|
|
2522
|
-
if (!roving.owns(event.target) ||
|
|
2523
|
+
if (!roving.owns(event.target) || chunkP6HC7RUN_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2523
2524
|
const tab = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2524
2525
|
const ahead = tab && !event.shiftKey && next !== void 0 ? blockPart(controller, blockId, next) : void 0;
|
|
2525
2526
|
if (ahead !== void 0) ahead.focus();
|
|
@@ -2596,12 +2597,12 @@ function useSelectionSettled(controller) {
|
|
|
2596
2597
|
|
|
2597
2598
|
// src/blocks/void/use-toolbar-block.ts
|
|
2598
2599
|
var selectedBlock = (type, filled) => ({ doc, selection }) => {
|
|
2599
|
-
const block = selection?.kind === "node" ?
|
|
2600
|
+
const block = selection?.kind === "node" ? chunkI7X7B3WD_cjs.blockById(doc, selection.block) : void 0;
|
|
2600
2601
|
return block?.type === type && filled(block.attrs) ? block.id : null;
|
|
2601
2602
|
};
|
|
2602
2603
|
function useToolbarBlock(controller, selected, keptFor = null) {
|
|
2603
|
-
const blockId =
|
|
2604
|
-
const readOnly =
|
|
2604
|
+
const blockId = chunkP6HC7RUN_cjs.useEditorState(controller, selected);
|
|
2605
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
2605
2606
|
const settled = useSelectionSettled(controller);
|
|
2606
2607
|
return blockId !== null && !readOnly && (settled || keptFor === blockId) ? blockId : null;
|
|
2607
2608
|
}
|
|
@@ -2680,7 +2681,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2680
2681
|
const value = percent ?? drawn;
|
|
2681
2682
|
const write = (widthPercent) => setBlockAttrs(controller, blockId, { widthPercent });
|
|
2682
2683
|
const onKeyDown = (event) => {
|
|
2683
|
-
if (
|
|
2684
|
+
if (chunkP6HC7RUN_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2684
2685
|
const next = keyedWidth(event.key, value);
|
|
2685
2686
|
if (event.key === "Escape") controller.focus();
|
|
2686
2687
|
else if (next === null) return;
|
|
@@ -2722,7 +2723,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2722
2723
|
"aria-valuetext": labels.widthValue(value),
|
|
2723
2724
|
"data-side": side,
|
|
2724
2725
|
className: "quoin-image-handle",
|
|
2725
|
-
...{ [
|
|
2726
|
+
...{ [chunkP6HC7RUN_cjs.NATIVE_INTERACTION]: "" },
|
|
2726
2727
|
...bubblePart(controller),
|
|
2727
2728
|
onKeyDown,
|
|
2728
2729
|
onPointerDown: onPointerDown(side),
|
|
@@ -2743,9 +2744,9 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2743
2744
|
const [failed, setFailed] = React7.useState(null);
|
|
2744
2745
|
const { id, attrs, regions } = block;
|
|
2745
2746
|
const src = imageSource(attrs, resolveAssetUrl);
|
|
2746
|
-
const alt =
|
|
2747
|
+
const alt = chunkI7X7B3WD_cjs.str(attrs.alt);
|
|
2747
2748
|
const name = alt || labels.imageNoAlt;
|
|
2748
|
-
const percent =
|
|
2749
|
+
const percent = chunkI7X7B3WD_cjs.optionalNumber(attrs.widthPercent);
|
|
2749
2750
|
const width = preview ?? percent;
|
|
2750
2751
|
const flagged = !readOnly && alt === "" && attrs.decorative !== true;
|
|
2751
2752
|
const select = () => focusNode(controller, id);
|
|
@@ -2759,8 +2760,8 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2759
2760
|
{
|
|
2760
2761
|
src,
|
|
2761
2762
|
alt: name,
|
|
2762
|
-
width:
|
|
2763
|
-
height:
|
|
2763
|
+
width: chunkI7X7B3WD_cjs.optionalNumber(attrs.width),
|
|
2764
|
+
height: chunkI7X7B3WD_cjs.optionalNumber(attrs.height),
|
|
2764
2765
|
draggable: false,
|
|
2765
2766
|
onError: () => setFailed(src),
|
|
2766
2767
|
onClick: select
|
|
@@ -2795,7 +2796,7 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2795
2796
|
)
|
|
2796
2797
|
] }),
|
|
2797
2798
|
(!readOnly || (regions.caption?.length ?? 0) > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2798
|
-
|
|
2799
|
+
chunkP6HC7RUN_cjs.EditableRegion,
|
|
2799
2800
|
{
|
|
2800
2801
|
block: id,
|
|
2801
2802
|
region: "caption",
|
|
@@ -2813,8 +2814,8 @@ var WHITESPACE = /\s/;
|
|
|
2813
2814
|
function linkAddress(typed2) {
|
|
2814
2815
|
const address = typed2.trim();
|
|
2815
2816
|
if (WHITESPACE.test(address)) return null;
|
|
2816
|
-
const completed = !
|
|
2817
|
-
const href =
|
|
2817
|
+
const completed = !chunkI7X7B3WD_cjs.SCHEME.test(address) && BARE_DOMAIN.test(address) ? `https://${address}` : address;
|
|
2818
|
+
const href = chunkI7X7B3WD_cjs.sanitizeHref(completed);
|
|
2818
2819
|
return href || null;
|
|
2819
2820
|
}
|
|
2820
2821
|
var Input = React7__namespace.forwardRef(function Input2({ className, type, ...props }, ref) {
|
|
@@ -2920,8 +2921,8 @@ function ImageUploadArea({ blockId, controller }) {
|
|
|
2920
2921
|
);
|
|
2921
2922
|
}
|
|
2922
2923
|
function captionEnd(controller, blockId) {
|
|
2923
|
-
const caption =
|
|
2924
|
-
return { block: blockId, region: "caption", offset:
|
|
2924
|
+
const caption = chunkI7X7B3WD_cjs.blockById(controller.editor.state.doc, blockId)?.regions.caption ?? [];
|
|
2925
|
+
return { block: blockId, region: "caption", offset: chunkI7X7B3WD_cjs.inlineLength(caption) };
|
|
2925
2926
|
}
|
|
2926
2927
|
var plainEnter = (event) => event.key === "Enter" && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2927
2928
|
var menuOpenOn = (host) => host?.getAttribute("aria-expanded") === "true";
|
|
@@ -2933,7 +2934,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2933
2934
|
// then follows.
|
|
2934
2935
|
enter() {
|
|
2935
2936
|
const { editor } = controller;
|
|
2936
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
2937
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkFK7EBZPX_cjs.textSelection(captionEnd(controller, blockId))));
|
|
2937
2938
|
controller.focus();
|
|
2938
2939
|
},
|
|
2939
2940
|
type(key) {
|
|
@@ -2958,7 +2959,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2958
2959
|
}
|
|
2959
2960
|
var ImageBlock = ({ block, controller }) => {
|
|
2960
2961
|
const labels = useLabels();
|
|
2961
|
-
const readOnly =
|
|
2962
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
2962
2963
|
const root = React7.useRef(null);
|
|
2963
2964
|
const picture = hasPicture(block.attrs);
|
|
2964
2965
|
useImageKeys(controller, block.id, picture, !readOnly, root);
|
|
@@ -2971,17 +2972,17 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2971
2972
|
"aria-label": labels.blockNames.image,
|
|
2972
2973
|
contentEditable: false,
|
|
2973
2974
|
className: "quoin-image",
|
|
2974
|
-
...picture ? { [
|
|
2975
|
+
...picture ? { [chunkP6HC7RUN_cjs.NODE_ENTRY]: "" } : void 0,
|
|
2975
2976
|
children: picture ? /* @__PURE__ */ jsxRuntime.jsx(ImageFigure, { block, controller, readOnly }) : empty
|
|
2976
2977
|
}
|
|
2977
2978
|
);
|
|
2978
2979
|
};
|
|
2979
2980
|
function useOutsidePress(element, ownerDocument, onPress) {
|
|
2980
2981
|
const latest = React7.useRef(onPress);
|
|
2981
|
-
|
|
2982
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
2982
2983
|
latest.current = onPress;
|
|
2983
2984
|
});
|
|
2984
|
-
|
|
2985
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
2985
2986
|
const doc = ownerDocument();
|
|
2986
2987
|
const inside = (target) => element.current?.contains(target) === true;
|
|
2987
2988
|
let touched = null;
|
|
@@ -2996,15 +2997,15 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
2996
2997
|
if (touched !== null && !inside(event.target)) latest.current(touched);
|
|
2997
2998
|
touched = null;
|
|
2998
2999
|
};
|
|
2999
|
-
return
|
|
3000
|
+
return chunkP6HC7RUN_cjs.listen(doc, { pointerdown: down, click }, true);
|
|
3000
3001
|
}, [element, ownerDocument]);
|
|
3001
3002
|
}
|
|
3002
3003
|
function storeAlt(controller, blockId, opened, patch) {
|
|
3003
3004
|
const { editor } = controller;
|
|
3004
|
-
const attrs =
|
|
3005
|
-
const changed =
|
|
3005
|
+
const attrs = chunkI7X7B3WD_cjs.blockById(editor.state.doc, blockId)?.attrs ?? {};
|
|
3006
|
+
const changed = chunkI7X7B3WD_cjs.str(attrs.alt) !== opened.alt || attrs.decorative === true !== opened.decorative;
|
|
3006
3007
|
if (controller.readOnly || controller.root === null || changed) return;
|
|
3007
|
-
|
|
3008
|
+
chunkP6HC7RUN_cjs.onBlock(blockId, chunkFK7EBZPX_cjs.setAttrs(patch))(editor.state, (tr) => editor.dispatch(tr));
|
|
3008
3009
|
}
|
|
3009
3010
|
function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative, onClose }) {
|
|
3010
3011
|
const labels = useLabels();
|
|
@@ -3046,7 +3047,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
3046
3047
|
close(true);
|
|
3047
3048
|
};
|
|
3048
3049
|
const onKeyDown = (event) => {
|
|
3049
|
-
if (event.key !== "Tab" ||
|
|
3050
|
+
if (event.key !== "Tab" || chunkP6HC7RUN_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
3050
3051
|
const controls = [...event.currentTarget.elements];
|
|
3051
3052
|
const next = controls[controls.indexOf(event.target) + (event.shiftKey ? -1 : 1)];
|
|
3052
3053
|
event.preventDefault();
|
|
@@ -3074,7 +3075,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
3074
3075
|
onCloseAutoFocus: preventDefault,
|
|
3075
3076
|
onEscapeKeyDown: (event) => {
|
|
3076
3077
|
event.preventDefault();
|
|
3077
|
-
if (!
|
|
3078
|
+
if (!chunkP6HC7RUN_cjs.isComposingKey(controller, event)) close(false);
|
|
3078
3079
|
},
|
|
3079
3080
|
...bubblePart(controller),
|
|
3080
3081
|
children: /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, className: "quoin-image-alt", onSubmit: save, onKeyDown, children: [
|
|
@@ -3128,7 +3129,7 @@ function imageToolbarItems(blockId, labels, actions) {
|
|
|
3128
3129
|
id: align,
|
|
3129
3130
|
title: labels[label],
|
|
3130
3131
|
icon,
|
|
3131
|
-
isActive: (state) => (
|
|
3132
|
+
isActive: (state) => (chunkI7X7B3WD_cjs.alignOrUndefined(chunkI7X7B3WD_cjs.blockById(state.doc, blockId)?.attrs.align) ?? "left") === align,
|
|
3132
3133
|
run: (controller) => setBlockAttrs(controller, blockId, { align })
|
|
3133
3134
|
})
|
|
3134
3135
|
);
|
|
@@ -3170,11 +3171,11 @@ function ImageToolbarOverlay({ controller }) {
|
|
|
3170
3171
|
}
|
|
3171
3172
|
function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
3172
3173
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
3173
|
-
const state =
|
|
3174
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
3174
3175
|
const picker = useReplacePicker(controller, blockId, uploadImage, "image/*");
|
|
3175
3176
|
const altButton = React7.useRef(null);
|
|
3176
3177
|
const anchor = usePartAnchor(controller, blockId, ".quoin-image-frame");
|
|
3177
|
-
const attrs =
|
|
3178
|
+
const attrs = chunkI7X7B3WD_cjs.blockById(state.doc, blockId)?.attrs ?? {};
|
|
3178
3179
|
const items = imageToolbarItems(blockId, labels, {
|
|
3179
3180
|
replace: picker.open,
|
|
3180
3181
|
editAlt: () => {
|
|
@@ -3200,7 +3201,7 @@ function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
|
3200
3201
|
controller,
|
|
3201
3202
|
anchor,
|
|
3202
3203
|
opener: altButton,
|
|
3203
|
-
alt:
|
|
3204
|
+
alt: chunkI7X7B3WD_cjs.str(attrs.alt),
|
|
3204
3205
|
decorative: attrs.decorative === true,
|
|
3205
3206
|
onClose: () => onEditAlt(null)
|
|
3206
3207
|
}
|
|
@@ -3402,13 +3403,13 @@ function CalloutToneMenu({ blockId, controller, tone }) {
|
|
|
3402
3403
|
}
|
|
3403
3404
|
var CalloutBlock = ({ block, controller }) => {
|
|
3404
3405
|
const labels = useLabels();
|
|
3405
|
-
const readOnly =
|
|
3406
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
3406
3407
|
const tone = calloutTone(block.attrs.tone);
|
|
3407
3408
|
const icon = calloutIcon(block.attrs, tone);
|
|
3408
3409
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("quoin-callout group/callout flex items-start gap-2", TONE[tone]), "data-tone": tone, children: [
|
|
3409
3410
|
readOnly ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "flex size-6 items-center justify-center text-base", children: icon }) : /* @__PURE__ */ jsxRuntime.jsx(CalloutIconMenu, { blockId: block.id, controller, icon }),
|
|
3410
3411
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3411
|
-
|
|
3412
|
+
chunkP6HC7RUN_cjs.EditableRegion,
|
|
3412
3413
|
{
|
|
3413
3414
|
block: block.id,
|
|
3414
3415
|
region: "body",
|
|
@@ -3476,23 +3477,23 @@ var HEADING_LEVELS = ["mt-6 text-3xl", "mt-5 text-2xl", "mt-4 text-xl", "mt-3 te
|
|
|
3476
3477
|
var headingStyles = (level) => `quoin-heading mb-1 font-semibold leading-tight in-[[data-quoin-block]:first-child]:mt-0 ${HEADING_LEVELS[level - 1]}`;
|
|
3477
3478
|
function Heading({ block }) {
|
|
3478
3479
|
const labels = useLabels();
|
|
3479
|
-
const level =
|
|
3480
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3480
|
+
const level = chunkI7X7B3WD_cjs.headingLevel(block.attrs.level);
|
|
3481
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.heading(level) }) });
|
|
3481
3482
|
}
|
|
3482
3483
|
function NumberedItem({ block, controller }) {
|
|
3483
3484
|
const labels = useLabels();
|
|
3484
|
-
const number =
|
|
3485
|
+
const number = chunkP6HC7RUN_cjs.useOrderedNumber(controller, block.id);
|
|
3485
3486
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "ordered", children: [
|
|
3486
3487
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "ordered", number, depth: block.indent }),
|
|
3487
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3488
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.numberedItem(number) })
|
|
3488
3489
|
] });
|
|
3489
3490
|
}
|
|
3490
3491
|
function TaskItem({ block, controller }) {
|
|
3491
3492
|
const labels = useLabels();
|
|
3492
|
-
const hostId =
|
|
3493
|
+
const hostId = chunkP6HC7RUN_cjs.useRegionDomId(block.id, REGION);
|
|
3493
3494
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-task", "data-checked": block.attrs.checked === true, children: [
|
|
3494
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3495
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3495
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.TaskCheckbox, { block, controller, label: labels.task, labelledBy: hostId }),
|
|
3496
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { id: hostId, block: block.id, region: REGION, label: labels.task })
|
|
3496
3497
|
] });
|
|
3497
3498
|
}
|
|
3498
3499
|
var MarkdownBlock = (props) => {
|
|
@@ -3504,16 +3505,16 @@ var MarkdownBlock = (props) => {
|
|
|
3504
3505
|
case "bullet":
|
|
3505
3506
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "bullet", children: [
|
|
3506
3507
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "bullet", depth: block.indent }),
|
|
3507
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3508
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.bulletItem })
|
|
3508
3509
|
] });
|
|
3509
3510
|
case "ordered":
|
|
3510
3511
|
return /* @__PURE__ */ jsxRuntime.jsx(NumberedItem, { ...props });
|
|
3511
3512
|
case "task":
|
|
3512
3513
|
return /* @__PURE__ */ jsxRuntime.jsx(TaskItem, { ...props });
|
|
3513
3514
|
case "quote":
|
|
3514
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3515
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.quote }) });
|
|
3515
3516
|
default:
|
|
3516
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3517
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.paragraph });
|
|
3517
3518
|
}
|
|
3518
3519
|
};
|
|
3519
3520
|
|
|
@@ -3521,19 +3522,19 @@ var MarkdownBlock = (props) => {
|
|
|
3521
3522
|
function nestedBlockIds({ doc }, blockId) {
|
|
3522
3523
|
const index = doc.index.get(blockId);
|
|
3523
3524
|
if (index === void 0) return [];
|
|
3524
|
-
return doc.blocks.slice(index + 1,
|
|
3525
|
+
return doc.blocks.slice(index + 1, chunkFK7EBZPX_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
3525
3526
|
}
|
|
3526
3527
|
function useNestedBlocks(controller, blockId) {
|
|
3527
|
-
return
|
|
3528
|
+
return chunkP6HC7RUN_cjs.useEditorState(controller, (state) => nestedBlockIds(state, blockId), chunkI7X7B3WD_cjs.sameItems);
|
|
3528
3529
|
}
|
|
3529
3530
|
var ToggleBlock = ({ block, controller }) => {
|
|
3530
3531
|
const labels = useLabels();
|
|
3531
|
-
const domId =
|
|
3532
|
+
const domId = chunkP6HC7RUN_cjs.useBlockDomId();
|
|
3532
3533
|
const nested = useNestedBlocks(controller, block.id);
|
|
3533
|
-
const open =
|
|
3534
|
+
const open = chunkP6HC7RUN_cjs.useToggleOpen(controller, block);
|
|
3534
3535
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-toggle", "data-open": open, children: [
|
|
3535
3536
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3536
|
-
|
|
3537
|
+
chunkP6HC7RUN_cjs.ToggleChevron,
|
|
3537
3538
|
{
|
|
3538
3539
|
block,
|
|
3539
3540
|
controller,
|
|
@@ -3541,7 +3542,7 @@ var ToggleBlock = ({ block, controller }) => {
|
|
|
3541
3542
|
controls: nested.length === 0 ? void 0 : nested.map(domId).join(" ")
|
|
3542
3543
|
}
|
|
3543
3544
|
),
|
|
3544
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3545
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkP6HC7RUN_cjs.EditableRegion, { block: block.id, region: "text", label: labels.toggle })
|
|
3545
3546
|
] });
|
|
3546
3547
|
};
|
|
3547
3548
|
|
|
@@ -3602,7 +3603,7 @@ function turnIntoTargets(labels) {
|
|
|
3602
3603
|
function TurnIntoItems({ kit, controller, blockIds }) {
|
|
3603
3604
|
const { blockTypes, labels } = useQuoin();
|
|
3604
3605
|
const targets = turnIntoTargets(labels).filter((target) => drawsType(blockTypes, target.type));
|
|
3605
|
-
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds,
|
|
3606
|
+
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds, chunkFK7EBZPX_cjs.setBlockType(target.type, target.attrs)), children: [
|
|
3606
3607
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: target.icon }),
|
|
3607
3608
|
target.label
|
|
3608
3609
|
] }, target.id));
|
|
@@ -3637,10 +3638,10 @@ function ActionItem({ kit, controller, action, blockIds }) {
|
|
|
3637
3638
|
);
|
|
3638
3639
|
}
|
|
3639
3640
|
function BlockMenuItems({ kit, controller, blocks, styled, title, actions }) {
|
|
3640
|
-
const state =
|
|
3641
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
3641
3642
|
const blockIds = blocks.map((block) => block.id);
|
|
3642
3643
|
const shown = actions.filter((action) => action.available?.(state, blockIds) ?? true);
|
|
3643
|
-
const anyText = styled.some((block) =>
|
|
3644
|
+
const anyText = styled.some((block) => chunkFK7EBZPX_cjs.isTextFlow(state.schema, block));
|
|
3644
3645
|
const anyMarkdown = styled.some((block) => block.type === "MARKDOWN");
|
|
3645
3646
|
const allCallouts = styled.length > 0 && styled.every((block) => block.type === "CALLOUT");
|
|
3646
3647
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3682,7 +3683,7 @@ var CONTEXT_KIT = {
|
|
|
3682
3683
|
SubTrigger: ContextMenuSubTrigger
|
|
3683
3684
|
};
|
|
3684
3685
|
var GUTTER_BLOCK = "data-quoin-gutter-block";
|
|
3685
|
-
var OWN_MENU = `[${
|
|
3686
|
+
var OWN_MENU = `[${chunkP6HC7RUN_cjs.NATIVE_INTERACTION}], input, textarea, select`;
|
|
3686
3687
|
function contextBlock(controller, target) {
|
|
3687
3688
|
const { state } = controller.editor;
|
|
3688
3689
|
const gutter = target.closest(`[${GUTTER_BLOCK}]`)?.getAttribute(GUTTER_BLOCK);
|
|
@@ -3691,8 +3692,8 @@ function contextBlock(controller, target) {
|
|
|
3691
3692
|
if (selection?.kind === "blocks") return selection.head;
|
|
3692
3693
|
if (target.closest(OWN_MENU) || controller.registry.locate(target) !== null) return null;
|
|
3693
3694
|
const id = controller.blockAt(target);
|
|
3694
|
-
const block = id === void 0 ? void 0 :
|
|
3695
|
-
return block === void 0 ||
|
|
3695
|
+
const block = id === void 0 ? void 0 : chunkI7X7B3WD_cjs.blockById(state.doc, id);
|
|
3696
|
+
return block === void 0 || chunkFK7EBZPX_cjs.isTextFlow(state.schema, block) ? null : block.id;
|
|
3696
3697
|
}
|
|
3697
3698
|
function useContextMenuOpener(controller, store, trigger) {
|
|
3698
3699
|
React7.useEffect(() => {
|
|
@@ -3711,7 +3712,7 @@ function useContextMenuOpener(controller, store, trigger) {
|
|
|
3711
3712
|
openBlockMenuAt(store, controller.editor.state, block, clientX, clientY);
|
|
3712
3713
|
hidden.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX, clientY }));
|
|
3713
3714
|
};
|
|
3714
|
-
return
|
|
3715
|
+
return chunkP6HC7RUN_cjs.listen(root, { mousedown: onMouseDown, contextmenu: onContextMenu });
|
|
3715
3716
|
}, [controller, store, trigger]);
|
|
3716
3717
|
}
|
|
3717
3718
|
|
|
@@ -3744,10 +3745,10 @@ var ExtensionBlockNames = React7.createContext({});
|
|
|
3744
3745
|
// src/gutter/use-menu-blocks.ts
|
|
3745
3746
|
function useLiveBlocks(controller, blockIds) {
|
|
3746
3747
|
const select = React7.useCallback(
|
|
3747
|
-
(state) => blockIds.flatMap((id) =>
|
|
3748
|
+
(state) => blockIds.flatMap((id) => chunkI7X7B3WD_cjs.blockById(state.doc, id) ?? []),
|
|
3748
3749
|
[blockIds]
|
|
3749
3750
|
);
|
|
3750
|
-
return
|
|
3751
|
+
return chunkP6HC7RUN_cjs.useEditorState(controller, select, chunkI7X7B3WD_cjs.sameItems);
|
|
3751
3752
|
}
|
|
3752
3753
|
function useMenuBlocks(controller, store, menu) {
|
|
3753
3754
|
const labels = useLabels();
|
|
@@ -3800,12 +3801,12 @@ function BlockContextMenu({ controller, store, actions }) {
|
|
|
3800
3801
|
// src/gutter/block-menu-keymap.ts
|
|
3801
3802
|
function blockMenuKeymap(store) {
|
|
3802
3803
|
const openForHead = (state, dispatch) => {
|
|
3803
|
-
const head =
|
|
3804
|
+
const head = chunkFK7EBZPX_cjs.headBlockId(state.selection);
|
|
3804
3805
|
if (head === null || !state.doc.index.has(head)) return false;
|
|
3805
3806
|
if (dispatch) openBlockMenu(store, state, head);
|
|
3806
3807
|
return true;
|
|
3807
3808
|
};
|
|
3808
|
-
return
|
|
3809
|
+
return chunkFK7EBZPX_cjs.defineExtension({ name: "block-menu", keymap: { "Mod-/": openForHead } });
|
|
3809
3810
|
}
|
|
3810
3811
|
var UNIQUE_OR_FOCUSABLE = ["id", "data-block-id", "contenteditable", "tabindex"];
|
|
3811
3812
|
function copyOf(shell) {
|
|
@@ -3874,7 +3875,7 @@ var DragOverlay = React7.forwardRef(function DragOverlay2(_props, ref) {
|
|
|
3874
3875
|
var DELETION_STEPS = /* @__PURE__ */ new Set(["removeBlocks", "setIndent"]);
|
|
3875
3876
|
function drawnPosition(doc, blockId) {
|
|
3876
3877
|
const index = doc.index.get(blockId) ?? 0;
|
|
3877
|
-
return [
|
|
3878
|
+
return [chunkP6HC7RUN_cjs.drawnBlockCount(doc, 0, index) + 1, chunkP6HC7RUN_cjs.drawnBlockCount(doc)];
|
|
3878
3879
|
}
|
|
3879
3880
|
function blockMovedMessage(doc, blockId, labels) {
|
|
3880
3881
|
return labels.blockMoved(...drawnPosition(doc, blockId));
|
|
@@ -3890,11 +3891,11 @@ function deletedCount(tr) {
|
|
|
3890
3891
|
return tr.steps.reduce((deleted, step, i) => {
|
|
3891
3892
|
const { index, count } = step.toJSON();
|
|
3892
3893
|
if (step.stepType !== "removeBlocks" || typeof index !== "number" || typeof count !== "number") return deleted;
|
|
3893
|
-
return deleted +
|
|
3894
|
+
return deleted + chunkP6HC7RUN_cjs.drawnBlockCount(tr.docs[i], index, index + count);
|
|
3894
3895
|
}, 0);
|
|
3895
3896
|
}
|
|
3896
3897
|
function insertedBlock(tr) {
|
|
3897
|
-
if (tr.getMeta(
|
|
3898
|
+
if (tr.getMeta(chunkFK7EBZPX_cjs.LINE_SPLIT) === true || tr.steps.some((step) => step.stepType === "removeBlocks")) return null;
|
|
3898
3899
|
const inserted = tr.steps.flatMap((step) => {
|
|
3899
3900
|
const { blocks } = step.toJSON();
|
|
3900
3901
|
return step.stepType === "insertBlocks" && Array.isArray(blocks) ? blocks : [];
|
|
@@ -3902,7 +3903,7 @@ function insertedBlock(tr) {
|
|
|
3902
3903
|
return inserted.find((block) => tr.doc.index.has(block.id))?.id ?? null;
|
|
3903
3904
|
}
|
|
3904
3905
|
function structureAnnouncement(tr, labels, undoKeys) {
|
|
3905
|
-
if (tr.origin !== "command" || tr.getMeta(
|
|
3906
|
+
if (tr.origin !== "command" || tr.getMeta(chunkFK7EBZPX_cjs.LINE_JOIN) === true) return null;
|
|
3906
3907
|
const moved = movedBlock(tr);
|
|
3907
3908
|
if (moved !== null) return blockMovedMessage(tr.doc, moved, labels);
|
|
3908
3909
|
const deleted = deletedCount(tr);
|
|
@@ -3932,7 +3933,7 @@ function inlineEdges(shell, box, rtl) {
|
|
|
3932
3933
|
function measure(controller, root, moved, rtl) {
|
|
3933
3934
|
const { doc } = controller.editor.state;
|
|
3934
3935
|
const origin = rootOrigin(root);
|
|
3935
|
-
return
|
|
3936
|
+
return chunkP6HC7RUN_cjs.visibleBlockIndexes(doc).flatMap((index) => {
|
|
3936
3937
|
const { id, indent: indent3 } = doc.blocks[index];
|
|
3937
3938
|
const shell = controller.blockElement(id);
|
|
3938
3939
|
if (shell === void 0) return [];
|
|
@@ -3947,7 +3948,7 @@ function measureDrag(controller, root, ids) {
|
|
|
3947
3948
|
const { doc } = controller.editor.state;
|
|
3948
3949
|
const direction = inlineDirection(root);
|
|
3949
3950
|
const rtl = direction === "rtl";
|
|
3950
|
-
const moved = new Set(
|
|
3951
|
+
const moved = new Set(chunkFK7EBZPX_cjs.movedBlockIds(doc, ids));
|
|
3951
3952
|
const blocks = measure(controller, root, moved, rtl);
|
|
3952
3953
|
const dragged = blocks.filter((block) => block.dragged);
|
|
3953
3954
|
if (dragged.length === 0) return null;
|
|
@@ -4007,7 +4008,7 @@ function draggedBlocks(controller, blockId) {
|
|
|
4007
4008
|
function followPress(press, root, view) {
|
|
4008
4009
|
const { controller, store, overlay, handle: handle2, pointerId } = press;
|
|
4009
4010
|
const doc = view.document;
|
|
4010
|
-
const scroll =
|
|
4011
|
+
const scroll = chunkP6HC7RUN_cjs.createAutoScroll(root, follow, SCROLL_EDGE);
|
|
4011
4012
|
let pointer = { x: press.x, y: press.y };
|
|
4012
4013
|
let active = null;
|
|
4013
4014
|
let unsubscribe = () => {
|
|
@@ -4060,7 +4061,7 @@ function followPress(press, root, view) {
|
|
|
4060
4061
|
finish();
|
|
4061
4062
|
if (dropped === null || dropped.target === null || controller.readOnly) return;
|
|
4062
4063
|
const { ids, layout, target } = dropped;
|
|
4063
|
-
if (!controller.run(
|
|
4064
|
+
if (!controller.run(chunkFK7EBZPX_cjs.moveBlocksTo(ids, layout.toIndex(target.index), target.indent))) return;
|
|
4064
4065
|
controller.focus();
|
|
4065
4066
|
press.onMoved(ids[0]);
|
|
4066
4067
|
}
|
|
@@ -4082,9 +4083,9 @@ function followPress(press, root, view) {
|
|
|
4082
4083
|
event.stopPropagation();
|
|
4083
4084
|
finish();
|
|
4084
4085
|
}
|
|
4085
|
-
const unlistenDocument =
|
|
4086
|
-
const unlistenBlur =
|
|
4087
|
-
const unlistenKeys =
|
|
4086
|
+
const unlistenDocument = chunkP6HC7RUN_cjs.listen(doc, { pointermove: onPointerMove, pointerup: onPointerUp, pointercancel: finish });
|
|
4087
|
+
const unlistenBlur = chunkP6HC7RUN_cjs.listen(view, { blur: finish });
|
|
4088
|
+
const unlistenKeys = chunkP6HC7RUN_cjs.listen(view, { keydown: onKeyDown }, true);
|
|
4088
4089
|
return finish;
|
|
4089
4090
|
}
|
|
4090
4091
|
function pressDragHandle(press) {
|
|
@@ -4136,12 +4137,12 @@ function useBlockDrag(controller, store, blockId, overlay) {
|
|
|
4136
4137
|
function addBlockBelow(controller, blockId) {
|
|
4137
4138
|
const { state } = controller.editor;
|
|
4138
4139
|
const { doc, schema } = state;
|
|
4139
|
-
const block =
|
|
4140
|
+
const block = chunkI7X7B3WD_cjs.blockById(doc, blockId);
|
|
4140
4141
|
if (block === void 0) return false;
|
|
4141
|
-
const empty =
|
|
4142
|
-
const fill = empty ?
|
|
4143
|
-
const slash =
|
|
4144
|
-
const { ok, tr } =
|
|
4142
|
+
const empty = chunkFK7EBZPX_cjs.isParagraph(block) && chunkFK7EBZPX_cjs.regionLength(block, chunkFK7EBZPX_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
4143
|
+
const fill = empty ? chunkFK7EBZPX_cjs.setSelection(chunkFK7EBZPX_cjs.startOf(doc, schema, blockId)) : chunkFK7EBZPX_cjs.insertBlockAfter("MARKDOWN", { kind: "paragraph" });
|
|
4144
|
+
const slash = chunkFK7EBZPX_cjs.insertText("/", { origin: "command" });
|
|
4145
|
+
const { ok, tr } = chunkFK7EBZPX_cjs.runCommands(state, [chunkFK7EBZPX_cjs.setSelection(chunkFK7EBZPX_cjs.blockRangeSelection(blockId)), fill, slash]);
|
|
4145
4146
|
if (ok && tr !== null) controller.dispatch(tr);
|
|
4146
4147
|
controller.focus();
|
|
4147
4148
|
return ok;
|
|
@@ -4219,7 +4220,7 @@ function place2(controller, root, gutter, block) {
|
|
|
4219
4220
|
gutter.style.visibility = "";
|
|
4220
4221
|
}
|
|
4221
4222
|
function useGutterPosition(controller, gutter, block) {
|
|
4222
|
-
|
|
4223
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
4223
4224
|
const element = gutter.current;
|
|
4224
4225
|
const root = controller.root;
|
|
4225
4226
|
const view = root?.ownerDocument.defaultView;
|
|
@@ -4243,7 +4244,7 @@ function useGutterPosition(controller, gutter, block) {
|
|
|
4243
4244
|
};
|
|
4244
4245
|
}, [controller, gutter, block]);
|
|
4245
4246
|
}
|
|
4246
|
-
var headOf = (state) =>
|
|
4247
|
+
var headOf = (state) => chunkFK7EBZPX_cjs.headBlockId(state.selection);
|
|
4247
4248
|
function blockAcross(controller, root, y) {
|
|
4248
4249
|
const box = root.getBoundingClientRect();
|
|
4249
4250
|
const probe = root.ownerDocument.elementFromPoint?.(box.left + box.width / 2, y);
|
|
@@ -4251,7 +4252,7 @@ function blockAcross(controller, root, y) {
|
|
|
4251
4252
|
}
|
|
4252
4253
|
function useGutterTarget(controller, store, gutter) {
|
|
4253
4254
|
const hovered = useCanvasUi(store, (state) => state.hoveredBlock);
|
|
4254
|
-
const head =
|
|
4255
|
+
const head = chunkP6HC7RUN_cjs.useEditorState(controller, headOf);
|
|
4255
4256
|
const [focusWithin, setFocusWithin] = React7.useState(false);
|
|
4256
4257
|
React7.useEffect(() => {
|
|
4257
4258
|
const root = controller.root;
|
|
@@ -4269,7 +4270,7 @@ function useGutterTarget(controller, store, gutter) {
|
|
|
4269
4270
|
const onFocusIn = () => setFocusWithin(true);
|
|
4270
4271
|
const onFocusOut = (event) => setFocusWithin(root.contains(event.relatedTarget));
|
|
4271
4272
|
setFocusWithin(root.contains(root.ownerDocument.activeElement));
|
|
4272
|
-
return
|
|
4273
|
+
return chunkP6HC7RUN_cjs.listen(root, { pointermove: onPointerMove, pointerleave: onPointerLeave, focusin: onFocusIn, focusout: onFocusOut });
|
|
4273
4274
|
}, [controller, store, gutter]);
|
|
4274
4275
|
const fallback = focusWithin ? head : null;
|
|
4275
4276
|
const target = hovered ?? fallback;
|
|
@@ -4347,11 +4348,7 @@ function Gutter({ controller, store, actions }) {
|
|
|
4347
4348
|
}
|
|
4348
4349
|
|
|
4349
4350
|
// src/i18n/resolve-labels.ts
|
|
4350
|
-
|
|
4351
|
-
if (overrides === void 0) return englishLabels;
|
|
4352
|
-
const given = Object.entries(overrides).filter(([, value]) => value !== void 0);
|
|
4353
|
-
return given.length === 0 ? englishLabels : { ...englishLabels, ...Object.fromEntries(given) };
|
|
4354
|
-
}
|
|
4351
|
+
var resolveLabels = (overrides) => chunkZWTIRGY5_cjs.mergeLabels(englishLabels, overrides);
|
|
4355
4352
|
|
|
4356
4353
|
// src/menus/floating/range-rect.ts
|
|
4357
4354
|
var TEXT_NODE = 3;
|
|
@@ -4366,7 +4363,7 @@ function pointInHost(host, { node, offset }) {
|
|
|
4366
4363
|
return host.contains(node) ? { node, offset: Math.min(offset, nodeLength(node)) } : null;
|
|
4367
4364
|
}
|
|
4368
4365
|
function textRect(host, { from, to }) {
|
|
4369
|
-
const map =
|
|
4366
|
+
const map = chunkP6HC7RUN_cjs.domMapOf(host);
|
|
4370
4367
|
const range = host.ownerDocument.createRange();
|
|
4371
4368
|
if (map === void 0 || typeof range.getBoundingClientRect !== "function") return null;
|
|
4372
4369
|
const start = pointInHost(host, map.toDom(from, 1));
|
|
@@ -4379,7 +4376,7 @@ function textRect(host, { from, to }) {
|
|
|
4379
4376
|
}
|
|
4380
4377
|
function rangeRect(controller, range) {
|
|
4381
4378
|
const host = controller.registry.get(range.block, range.region);
|
|
4382
|
-
if (host === void 0 || !host.isConnected || controller.composingKey ===
|
|
4379
|
+
if (host === void 0 || !host.isConnected || controller.composingKey === chunkP6HC7RUN_cjs.hostKey(range.block, range.region)) {
|
|
4383
4380
|
return null;
|
|
4384
4381
|
}
|
|
4385
4382
|
const rect = textRect(host, range);
|
|
@@ -4395,7 +4392,7 @@ function union(a, b) {
|
|
|
4395
4392
|
function selectionRect(controller) {
|
|
4396
4393
|
const { state } = controller.editor;
|
|
4397
4394
|
if (state.selection?.kind !== "text") return null;
|
|
4398
|
-
const ranges =
|
|
4395
|
+
const ranges = chunkFK7EBZPX_cjs.markRanges(state);
|
|
4399
4396
|
if (ranges.length === 0) return null;
|
|
4400
4397
|
const first = rangeRect(controller, ranges[0]);
|
|
4401
4398
|
if (ranges.length === 1) return first;
|
|
@@ -4406,7 +4403,7 @@ function selectionRect(controller) {
|
|
|
4406
4403
|
// src/menus/floating/use-selection-anchor.ts
|
|
4407
4404
|
var ROOM_ABOVE = 56;
|
|
4408
4405
|
function selectionHost(controller) {
|
|
4409
|
-
const [first] =
|
|
4406
|
+
const [first] = chunkFK7EBZPX_cjs.markRanges(controller.editor.state);
|
|
4410
4407
|
return (first && controller.registry.get(first.block, first.region)) ?? controller.root ?? void 0;
|
|
4411
4408
|
}
|
|
4412
4409
|
function useSelectionAnchor(controller, state) {
|
|
@@ -4420,7 +4417,7 @@ function useSelectionAnchor(controller, state) {
|
|
|
4420
4417
|
[controller, state]
|
|
4421
4418
|
);
|
|
4422
4419
|
const [side, setSide] = React7.useState("top");
|
|
4423
|
-
|
|
4420
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
4424
4421
|
const rect = selectionRect(controller);
|
|
4425
4422
|
if (rect) setSide(rect.top < ROOM_ABOVE ? "bottom" : "top");
|
|
4426
4423
|
}, [controller, state]);
|
|
@@ -4455,9 +4452,9 @@ var ICONS = { left: AlignLeft, center: AlignCenter, right: AlignRight, justify:
|
|
|
4455
4452
|
var ALIGNS2 = Object.keys(ICONS);
|
|
4456
4453
|
var LABEL_KEYS = { left: "alignLeft", center: "alignCenter", right: "alignRight", justify: "alignJustify" };
|
|
4457
4454
|
function sharedAlign(state) {
|
|
4458
|
-
const blocks =
|
|
4455
|
+
const blocks = chunkFK7EBZPX_cjs.selectedBlockIds(state.doc, state.selection).map((id) => chunkI7X7B3WD_cjs.blockById(state.doc, id)).filter((block) => block?.type === "MARKDOWN");
|
|
4459
4456
|
if (blocks.length === 0) return null;
|
|
4460
|
-
const aligns = new Set(blocks.map((block) =>
|
|
4457
|
+
const aligns = new Set(blocks.map((block) => chunkI7X7B3WD_cjs.alignOrUndefined(block?.attrs.align) ?? "left"));
|
|
4461
4458
|
return aligns.size === 1 ? [...aligns][0] : "";
|
|
4462
4459
|
}
|
|
4463
4460
|
function AlignDropdown({ controller, state }) {
|
|
@@ -4466,7 +4463,7 @@ function AlignDropdown({ controller, state }) {
|
|
|
4466
4463
|
if (value === null) return null;
|
|
4467
4464
|
const Icon2 = value === "" ? AlignLeft : ICONS[value];
|
|
4468
4465
|
const trigger = /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.align, children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, {}) });
|
|
4469
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(
|
|
4466
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(chunkFK7EBZPX_cjs.setTextAlign(align)), children: ALIGNS2.map((align) => /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuRadioItem, { value: align, indicator: /* @__PURE__ */ jsxRuntime.jsx(Check, { className: "size-4" }), children: [
|
|
4470
4467
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: ICONS[align] }),
|
|
4471
4468
|
labels[LABEL_KEYS[align]]
|
|
4472
4469
|
] }, align)) }) });
|
|
@@ -4474,8 +4471,8 @@ function AlignDropdown({ controller, state }) {
|
|
|
4474
4471
|
var MARKS = { color: "color", background: "highlight" };
|
|
4475
4472
|
function selectionColor(state, mark) {
|
|
4476
4473
|
const names = /* @__PURE__ */ new Set();
|
|
4477
|
-
for (const range of
|
|
4478
|
-
for (const node of
|
|
4474
|
+
for (const range of chunkFK7EBZPX_cjs.markRanges(state)) {
|
|
4475
|
+
for (const node of chunkFK7EBZPX_cjs.rangeContent(state, range)) {
|
|
4479
4476
|
const found = node.marks.find((candidate) => candidate.type === mark);
|
|
4480
4477
|
names.add(found === void 0 ? "default" : found.attrs?.color);
|
|
4481
4478
|
}
|
|
@@ -4484,7 +4481,7 @@ function selectionColor(state, mark) {
|
|
|
4484
4481
|
return names.size === 1 && typeof only === "string" ? only : "";
|
|
4485
4482
|
}
|
|
4486
4483
|
function colorCommand(key, name) {
|
|
4487
|
-
return name === "default" ?
|
|
4484
|
+
return name === "default" ? chunkFK7EBZPX_cjs.unsetMark(MARKS[key]) : chunkFK7EBZPX_cjs.setMark(MARKS[key], { color: name });
|
|
4488
4485
|
}
|
|
4489
4486
|
function ColorPopover({ controller, state }) {
|
|
4490
4487
|
const labels = useLabels();
|
|
@@ -4498,11 +4495,11 @@ function TurnIntoDropdown({ controller, state }) {
|
|
|
4498
4495
|
labels.turnInto,
|
|
4499
4496
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
|
|
4500
4497
|
] });
|
|
4501
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds:
|
|
4498
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds: chunkFK7EBZPX_cjs.selectedBlockIds(state.doc, state.selection) }) });
|
|
4502
4499
|
}
|
|
4503
4500
|
var DIVIDER = "mx-0.5 h-5 w-px shrink-0 bg-border";
|
|
4504
4501
|
function BubbleToolbar({ controller, labels, store, extraItems }) {
|
|
4505
|
-
const state =
|
|
4502
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
4506
4503
|
const { anchor, side } = useSelectionAnchor(controller, state);
|
|
4507
4504
|
const roving = useRovingFocus();
|
|
4508
4505
|
const items = React7.useMemo(() => bubbleItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -4564,10 +4561,10 @@ function useMediaQuery(query, unsupported) {
|
|
|
4564
4561
|
var useFinePointer = () => useMediaQuery("(pointer: fine)", true);
|
|
4565
4562
|
|
|
4566
4563
|
// src/menus/bubble/use-bubble-visibility.ts
|
|
4567
|
-
var hasTextRange = (state) => state.selection?.kind === "text" && !
|
|
4564
|
+
var hasTextRange = (state) => state.selection?.kind === "text" && !chunkFK7EBZPX_cjs.isCollapsed(state.selection) && chunkFK7EBZPX_cjs.markRanges(state).length > 0;
|
|
4568
4565
|
function useBubbleVisibility(controller) {
|
|
4569
|
-
const range =
|
|
4570
|
-
const readOnly =
|
|
4566
|
+
const range = chunkP6HC7RUN_cjs.useEditorState(controller, hasTextRange);
|
|
4567
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
4571
4568
|
const fine = useFinePointer();
|
|
4572
4569
|
const settled = useSelectionSettled(controller);
|
|
4573
4570
|
return range && !readOnly && fine && settled;
|
|
@@ -4584,16 +4581,16 @@ function BubbleOverlay({ controller }) {
|
|
|
4584
4581
|
return /* @__PURE__ */ jsxRuntime.jsx(BubbleToolbar, { controller, labels, store, extraItems });
|
|
4585
4582
|
}
|
|
4586
4583
|
function bubbleExtension() {
|
|
4587
|
-
return
|
|
4584
|
+
return chunkFK7EBZPX_cjs.defineExtension({ name: "bubble", ui: { overlays: [BubbleOverlay] } });
|
|
4588
4585
|
}
|
|
4589
4586
|
|
|
4590
4587
|
// src/menus/link/link-at-selection.ts
|
|
4591
4588
|
function linkAround(state, from, to = from) {
|
|
4592
4589
|
if (from.block !== to.block || from.region !== to.region) return null;
|
|
4593
|
-
const inline =
|
|
4594
|
-
const extent =
|
|
4590
|
+
const inline = chunkP6HC7RUN_cjs.regionInline(state, from.block, from.region) ?? [];
|
|
4591
|
+
const extent = chunkFK7EBZPX_cjs.markExtent(inline, from.offset, "link");
|
|
4595
4592
|
if (extent === null || to.offset > extent.to) return null;
|
|
4596
|
-
const attrs =
|
|
4593
|
+
const attrs = chunkI7X7B3WD_cjs.sliceInline(inline, extent.from, extent.to)[0]?.marks.find((mark) => mark.type === "link")?.attrs;
|
|
4597
4594
|
if (attrs?.href === void 0) return null;
|
|
4598
4595
|
const range = { block: from.block, region: from.region, ...extent };
|
|
4599
4596
|
return { href: attrs.href, title: attrs.title || void 0, range };
|
|
@@ -4601,7 +4598,7 @@ function linkAround(state, from, to = from) {
|
|
|
4601
4598
|
function linkAtSelection(state) {
|
|
4602
4599
|
const { selection } = state;
|
|
4603
4600
|
if (selection?.kind !== "text") return null;
|
|
4604
|
-
const { from, to } =
|
|
4601
|
+
const { from, to } = chunkFK7EBZPX_cjs.orderedRange(state.doc, selection.anchor, selection.head);
|
|
4605
4602
|
return linkAround(state, from, to);
|
|
4606
4603
|
}
|
|
4607
4604
|
|
|
@@ -4613,7 +4610,7 @@ function linkElementAt(controller, target) {
|
|
|
4613
4610
|
}
|
|
4614
4611
|
function linkAtElement(controller, state, element) {
|
|
4615
4612
|
const host = controller.registry.locate(element);
|
|
4616
|
-
const offset = host === null ? null :
|
|
4613
|
+
const offset = host === null ? null : chunkP6HC7RUN_cjs.domMapOf(host.element)?.fromDom(element, 0) ?? null;
|
|
4617
4614
|
if (host === null || offset === null) return null;
|
|
4618
4615
|
return linkAround(state, { block: host.block, region: host.region, offset });
|
|
4619
4616
|
}
|
|
@@ -4639,7 +4636,7 @@ function truncateMiddle(text2, max) {
|
|
|
4639
4636
|
// src/menus/link/unlink-range.ts
|
|
4640
4637
|
function unlinkRange({ block, region, from, to }) {
|
|
4641
4638
|
return (state, dispatch) => {
|
|
4642
|
-
const tr = new
|
|
4639
|
+
const tr = new chunkFK7EBZPX_cjs.Transaction(state).step(chunkFK7EBZPX_cjs.removeMarkStep(block, region, from, to, "link"));
|
|
4643
4640
|
if (!tr.docChanged) return false;
|
|
4644
4641
|
dispatch?.(tr);
|
|
4645
4642
|
return true;
|
|
@@ -4661,12 +4658,12 @@ function useRestedValue(value, delay) {
|
|
|
4661
4658
|
// src/menus/link/use-caret-in-link.ts
|
|
4662
4659
|
function caretLinkKey(state) {
|
|
4663
4660
|
const { selection } = state;
|
|
4664
|
-
if (selection?.kind !== "text" || !
|
|
4661
|
+
if (selection?.kind !== "text" || !chunkFK7EBZPX_cjs.isCollapsed(selection)) return null;
|
|
4665
4662
|
const link = linkAtSelection(state);
|
|
4666
4663
|
return link && [link.range.block, link.range.region, link.range.from, link.href].join("\0");
|
|
4667
4664
|
}
|
|
4668
4665
|
function useCaretInLink(controller, delay) {
|
|
4669
|
-
const key =
|
|
4666
|
+
const key = chunkP6HC7RUN_cjs.useEditorState(controller, caretLinkKey);
|
|
4670
4667
|
const settled = useSelectionSettled(controller);
|
|
4671
4668
|
return useRestedValue(settled ? key : null, delay) !== null;
|
|
4672
4669
|
}
|
|
@@ -4700,7 +4697,7 @@ var URL_LENGTH = 48;
|
|
|
4700
4697
|
var CARD = "flex w-auto items-center gap-0.5 py-1 ps-3 pe-1 shadow-md";
|
|
4701
4698
|
var ADDRESS = "me-1 whitespace-nowrap text-sm text-muted-foreground";
|
|
4702
4699
|
function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
4703
|
-
const state =
|
|
4700
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
4704
4701
|
const link = React7.useMemo(
|
|
4705
4702
|
() => element === null ? linkAtSelection(state) : linkAtElement(controller, state, element),
|
|
4706
4703
|
[controller, state, element]
|
|
@@ -4713,12 +4710,12 @@ function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
|
4713
4710
|
}, [controller, link]);
|
|
4714
4711
|
if (link === null) return null;
|
|
4715
4712
|
const { block, region, from, to } = link.range;
|
|
4716
|
-
const href =
|
|
4713
|
+
const href = chunkI7X7B3WD_cjs.sanitizeHref(link.href);
|
|
4717
4714
|
const address = truncateMiddle(link.href, URL_LENGTH);
|
|
4718
4715
|
const edit2 = () => {
|
|
4719
4716
|
if (element !== null) {
|
|
4720
|
-
const selection =
|
|
4721
|
-
|
|
4717
|
+
const selection = chunkFK7EBZPX_cjs.textSelection({ block, region, offset: from }, { block, region, offset: to });
|
|
4718
|
+
chunkP6HC7RUN_cjs.dispatchSelection(controller, selection);
|
|
4722
4719
|
}
|
|
4723
4720
|
store.set({ linkPopover: { open: true } });
|
|
4724
4721
|
};
|
|
@@ -4760,12 +4757,12 @@ function LinkHoverCard(props) {
|
|
|
4760
4757
|
|
|
4761
4758
|
// src/menus/link/apply-link.ts
|
|
4762
4759
|
function insertLinkedText(value, href, caret) {
|
|
4763
|
-
const safe =
|
|
4760
|
+
const safe = chunkI7X7B3WD_cjs.sanitizeHref(href);
|
|
4764
4761
|
return (state, dispatch) => {
|
|
4765
4762
|
if (!safe) return false;
|
|
4766
4763
|
const link = { type: "link", attrs: { href: safe } };
|
|
4767
|
-
const marks =
|
|
4768
|
-
const tr = new
|
|
4764
|
+
const marks = chunkI7X7B3WD_cjs.addMark(chunkFK7EBZPX_cjs.caretMarks(state.doc, state.schema, state.storedMarks, caret), link);
|
|
4765
|
+
const tr = new chunkFK7EBZPX_cjs.Transaction(state).step(chunkFK7EBZPX_cjs.replaceInlineStep(caret.block, caret.region, caret.offset, caret.offset, [chunkI7X7B3WD_cjs.text(value, marks)])).setSelection(chunkFK7EBZPX_cjs.textSelection({ ...caret, offset: caret.offset + value.length }));
|
|
4769
4766
|
dispatch?.(tr);
|
|
4770
4767
|
return true;
|
|
4771
4768
|
};
|
|
@@ -4774,10 +4771,10 @@ function applyLink(href, value) {
|
|
|
4774
4771
|
return (state, dispatch) => {
|
|
4775
4772
|
const { selection } = state;
|
|
4776
4773
|
const link = linkAtSelection(state);
|
|
4777
|
-
if (selection?.kind === "text" &&
|
|
4774
|
+
if (selection?.kind === "text" && chunkFK7EBZPX_cjs.isCollapsed(selection) && link === null) {
|
|
4778
4775
|
return insertLinkedText(value, href, selection.head)(state, dispatch);
|
|
4779
4776
|
}
|
|
4780
|
-
return
|
|
4777
|
+
return chunkFK7EBZPX_cjs.setLink(href, link?.title)(state, dispatch);
|
|
4781
4778
|
};
|
|
4782
4779
|
}
|
|
4783
4780
|
var CONTENT2 = "w-80 p-2 shadow-md";
|
|
@@ -4788,7 +4785,7 @@ function popoverAnchor(controller, link) {
|
|
|
4788
4785
|
if (selection?.kind !== "text") return null;
|
|
4789
4786
|
const { block, region, offset } = selection.head;
|
|
4790
4787
|
const caret = link?.range ?? { block, region, from: offset, to: offset };
|
|
4791
|
-
const collapsed =
|
|
4788
|
+
const collapsed = chunkFK7EBZPX_cjs.isCollapsed(selection);
|
|
4792
4789
|
return virtualAnchor(
|
|
4793
4790
|
() => collapsed ? rangeRect(controller, caret) : selectionRect(controller),
|
|
4794
4791
|
() => controller.registry.get(block, region)
|
|
@@ -4800,7 +4797,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4800
4797
|
const [invalid, setInvalid] = React7.useState(false);
|
|
4801
4798
|
const messageId = React7.useId();
|
|
4802
4799
|
const anchor = React7.useMemo(() => ({ current: popoverAnchor(controller, link) }), [controller, link]);
|
|
4803
|
-
const openHref = link &&
|
|
4800
|
+
const openHref = link && chunkI7X7B3WD_cjs.sanitizeHref(link.href);
|
|
4804
4801
|
const backToText = () => {
|
|
4805
4802
|
onClose();
|
|
4806
4803
|
controller.focus();
|
|
@@ -4817,7 +4814,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4817
4814
|
backToText();
|
|
4818
4815
|
};
|
|
4819
4816
|
const remove = () => {
|
|
4820
|
-
controller.run(
|
|
4817
|
+
controller.run(chunkFK7EBZPX_cjs.unsetLink);
|
|
4821
4818
|
backToText();
|
|
4822
4819
|
};
|
|
4823
4820
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4885,7 +4882,7 @@ function LinkOverlay({ controller }) {
|
|
|
4885
4882
|
const labels = useLabels();
|
|
4886
4883
|
const store = useCanvasUiStore();
|
|
4887
4884
|
const popoverOpen = useCanvasUi(store, isPopoverOpen);
|
|
4888
|
-
const readOnly =
|
|
4885
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
4889
4886
|
useLinkClicks(controller);
|
|
4890
4887
|
React7.useEffect(() => {
|
|
4891
4888
|
if (readOnly && store.get().linkPopover.open) store.set({ linkPopover: { open: false } });
|
|
@@ -4900,7 +4897,7 @@ function linkExtension(store) {
|
|
|
4900
4897
|
if (dispatch) store.set({ linkPopover: { open: true } });
|
|
4901
4898
|
return true;
|
|
4902
4899
|
};
|
|
4903
|
-
return
|
|
4900
|
+
return chunkFK7EBZPX_cjs.defineExtension({ name: "link", keymap: { "Mod-k": openPopover }, ui: { overlays: [LinkOverlay] } });
|
|
4904
4901
|
}
|
|
4905
4902
|
|
|
4906
4903
|
// src/menus/suggestion/find-trigger.ts
|
|
@@ -4908,7 +4905,7 @@ var DEFAULT_MAX_LENGTH = 40;
|
|
|
4908
4905
|
var NO_TRIGGER_TYPES = /* @__PURE__ */ new Set(["CODE", "TABLE"]);
|
|
4909
4906
|
var WHITESPACE2 = /\s/;
|
|
4910
4907
|
var ATOM = "\uFFFC";
|
|
4911
|
-
var hasCode = (inline) => inline.some((node) =>
|
|
4908
|
+
var hasCode = (inline) => inline.some((node) => chunkI7X7B3WD_cjs.hasMark(node.marks, "code"));
|
|
4912
4909
|
function triggerOffset(text2, start, config) {
|
|
4913
4910
|
const { char, allowSpaces = false, startOfLine = false } = config;
|
|
4914
4911
|
const earliest = Math.max(0, text2.length - (config.maxLength ?? DEFAULT_MAX_LENGTH) - 1);
|
|
@@ -4925,15 +4922,15 @@ function triggerOffset(text2, start, config) {
|
|
|
4925
4922
|
}
|
|
4926
4923
|
function findTrigger(state, config) {
|
|
4927
4924
|
const { doc, selection } = state;
|
|
4928
|
-
if (selection?.kind !== "text" || !
|
|
4925
|
+
if (selection?.kind !== "text" || !chunkFK7EBZPX_cjs.isCollapsed(selection)) return null;
|
|
4929
4926
|
const { block: blockId, region, offset: caret } = selection.head;
|
|
4930
|
-
const block =
|
|
4927
|
+
const block = chunkI7X7B3WD_cjs.blockById(doc, blockId);
|
|
4931
4928
|
if (block === void 0 || NO_TRIGGER_TYPES.has(block.type) || !Object.hasOwn(block.regions, region)) return null;
|
|
4932
4929
|
const inline = block.regions[region];
|
|
4933
4930
|
const start = Math.max(0, caret - (config.maxLength ?? DEFAULT_MAX_LENGTH) - 2);
|
|
4934
|
-
const from = triggerOffset(
|
|
4935
|
-
if (from === null || hasCode(
|
|
4936
|
-
const query =
|
|
4931
|
+
const from = triggerOffset(chunkI7X7B3WD_cjs.inlineText(chunkI7X7B3WD_cjs.sliceInline(inline, start, caret)), start, config);
|
|
4932
|
+
if (from === null || hasCode(chunkI7X7B3WD_cjs.sliceInline(inline, from, caret))) return null;
|
|
4933
|
+
const query = chunkI7X7B3WD_cjs.inlineText(chunkI7X7B3WD_cjs.sliceInline(inline, from + 1, caret));
|
|
4937
4934
|
return { block: blockId, region, from, to: caret, query };
|
|
4938
4935
|
}
|
|
4939
4936
|
|
|
@@ -4963,7 +4960,7 @@ function suggestionPlugin(key, config) {
|
|
|
4963
4960
|
init: (state) => ({ active: nearest(state, findTrigger(state, config)), dismissedAt: null }),
|
|
4964
4961
|
apply(tr, value, oldState, newState) {
|
|
4965
4962
|
const dismissing = tr.getMeta(DISMISS) === key.name;
|
|
4966
|
-
if (!dismissing && !tr.docChanged &&
|
|
4963
|
+
if (!dismissing && !tr.docChanged && chunkFK7EBZPX_cjs.sameSelection(oldState.selection, newState.selection)) return value;
|
|
4967
4964
|
const found = findTrigger(newState, config);
|
|
4968
4965
|
let dismissedAt = null;
|
|
4969
4966
|
if (dismissing) dismissedAt = found && rangeOf2(found);
|
|
@@ -4980,14 +4977,14 @@ function suggestionPlugin(key, config) {
|
|
|
4980
4977
|
}
|
|
4981
4978
|
function dismissSuggestion(key) {
|
|
4982
4979
|
return (state, dispatch) => {
|
|
4983
|
-
if (
|
|
4984
|
-
dispatch?.(new
|
|
4980
|
+
if (chunkFK7EBZPX_cjs.getPluginState(state, key).active === null) return false;
|
|
4981
|
+
dispatch?.(new chunkFK7EBZPX_cjs.Transaction(state).setMeta(DISMISS, key.name));
|
|
4985
4982
|
return true;
|
|
4986
4983
|
};
|
|
4987
4984
|
}
|
|
4988
4985
|
|
|
4989
4986
|
// src/menus/slash/slash-key.ts
|
|
4990
|
-
var slashKey =
|
|
4987
|
+
var slashKey = chunkFK7EBZPX_cjs.createPluginKey("slash");
|
|
4991
4988
|
|
|
4992
4989
|
// src/menus/slash/slash-items.ts
|
|
4993
4990
|
var DETAILS = {
|
|
@@ -5037,7 +5034,7 @@ function initialBlock({ schema }, definition, onError) {
|
|
|
5037
5034
|
const data = chunkA6PGQVTR_cjs.seedData(definition, onError());
|
|
5038
5035
|
if (data === null) return null;
|
|
5039
5036
|
if (data === void 0) return { type };
|
|
5040
|
-
return { type, ...
|
|
5037
|
+
return { type, ...chunkI7X7B3WD_cjs.specFor(schema, type).fromData(data, chunkI7X7B3WD_cjs.createBlockCodec(schema).context) };
|
|
5041
5038
|
}
|
|
5042
5039
|
var refuse = () => false;
|
|
5043
5040
|
function blockTypeSlashItems(definitions, onError = () => void 0) {
|
|
@@ -5065,10 +5062,10 @@ function useRangeAnchor(controller, range) {
|
|
|
5065
5062
|
const [side, setSide] = React7.useState("bottom");
|
|
5066
5063
|
const latest = React7.useRef(range);
|
|
5067
5064
|
const start = range === null ? null : `${range.block} ${range.region} ${range.from}`;
|
|
5068
|
-
|
|
5065
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5069
5066
|
latest.current = range;
|
|
5070
5067
|
});
|
|
5071
|
-
|
|
5068
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5072
5069
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
5073
5070
|
if (rect) setSide(sideFor(rect, window.innerHeight));
|
|
5074
5071
|
}, [controller, start]);
|
|
@@ -5094,11 +5091,11 @@ function openCombobox(host, listboxId) {
|
|
|
5094
5091
|
}
|
|
5095
5092
|
function useComboboxHost(controller, block, region, listboxId, activeOptionId) {
|
|
5096
5093
|
const host = React7.useRef(null);
|
|
5097
|
-
|
|
5094
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5098
5095
|
host.current = block === null || region === null ? null : controller.registry.get(block, region) ?? null;
|
|
5099
5096
|
return host.current === null ? void 0 : openCombobox(host.current, listboxId);
|
|
5100
5097
|
}, [controller, block, region, listboxId]);
|
|
5101
|
-
|
|
5098
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5102
5099
|
if (host.current !== null) restore(host.current, "aria-activedescendant", activeOptionId);
|
|
5103
5100
|
}, [block, region, activeOptionId]);
|
|
5104
5101
|
}
|
|
@@ -5144,10 +5141,10 @@ function handle(event, menu) {
|
|
|
5144
5141
|
}
|
|
5145
5142
|
function useSuggestionKeys(controller, open, menu) {
|
|
5146
5143
|
const latest = React7.useRef(menu);
|
|
5147
|
-
|
|
5144
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5148
5145
|
latest.current = menu;
|
|
5149
5146
|
});
|
|
5150
|
-
|
|
5147
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5151
5148
|
if (!open) return;
|
|
5152
5149
|
const intercept = (event) => {
|
|
5153
5150
|
const handled = handle(event, latest.current);
|
|
@@ -5168,10 +5165,10 @@ var isPromise = (value) => typeof value?.then === "function";
|
|
|
5168
5165
|
function useSuggestionResults(source, query, onError) {
|
|
5169
5166
|
const [answer, setAnswer] = React7.useState(FORGOTTEN);
|
|
5170
5167
|
const report = React7.useRef(onError);
|
|
5171
|
-
|
|
5168
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5172
5169
|
report.current = onError;
|
|
5173
5170
|
});
|
|
5174
|
-
|
|
5171
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5175
5172
|
if (query === null) {
|
|
5176
5173
|
setAnswer(FORGOTTEN);
|
|
5177
5174
|
return;
|
|
@@ -5215,9 +5212,9 @@ function useSuggestion({
|
|
|
5215
5212
|
emptyLabel
|
|
5216
5213
|
}) {
|
|
5217
5214
|
const { labels, onError } = useQuoin();
|
|
5218
|
-
const readOnly =
|
|
5219
|
-
const selectTrigger = React7.useCallback((state) =>
|
|
5220
|
-
const active =
|
|
5215
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
5216
|
+
const selectTrigger = React7.useCallback((state) => chunkFK7EBZPX_cjs.getPluginState(state, pluginKey).active, [pluginKey]);
|
|
5217
|
+
const active = chunkP6HC7RUN_cjs.useEditorState(controller, selectTrigger);
|
|
5221
5218
|
const trigger = readOnly ? null : active;
|
|
5222
5219
|
const results = useSuggestionResults(source, trigger?.query ?? null, onError);
|
|
5223
5220
|
const sections = React7.useMemo(() => groupItems(results.items, groupOf2), [results.items, groupOf2]);
|
|
@@ -5239,7 +5236,7 @@ function useSuggestion({
|
|
|
5239
5236
|
);
|
|
5240
5237
|
const select = React7.useCallback(
|
|
5241
5238
|
(index) => {
|
|
5242
|
-
const current =
|
|
5239
|
+
const current = chunkFK7EBZPX_cjs.getPluginState(controller.editor.state, pluginKey).active;
|
|
5243
5240
|
if (current !== null && index < ordered.length) onSelect(ordered[index], rangeOf2(current));
|
|
5244
5241
|
},
|
|
5245
5242
|
[controller, pluginKey, ordered, onSelect]
|
|
@@ -5287,7 +5284,7 @@ function SuggestionMenu(props) {
|
|
|
5287
5284
|
const { trigger, sections, activeIndex, listboxId } = suggestion;
|
|
5288
5285
|
const { anchor, side } = useRangeAnchor(controller, trigger);
|
|
5289
5286
|
const listbox = React7.useRef(null);
|
|
5290
|
-
|
|
5287
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
5291
5288
|
listbox.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
5292
5289
|
}, [activeIndex, sections]);
|
|
5293
5290
|
if (trigger === null) return null;
|
|
@@ -5346,14 +5343,14 @@ function SuggestionMenu(props) {
|
|
|
5346
5343
|
// src/menus/suggestion/replace-trigger.ts
|
|
5347
5344
|
function deleteTrigger({ block, region, from, to }) {
|
|
5348
5345
|
return (state, dispatch) => {
|
|
5349
|
-
const tr = new
|
|
5350
|
-
if (from >= to || !tr.maybeStep(
|
|
5351
|
-
dispatch?.(tr.setSelection(
|
|
5346
|
+
const tr = new chunkFK7EBZPX_cjs.Transaction(state);
|
|
5347
|
+
if (from >= to || !tr.maybeStep(chunkFK7EBZPX_cjs.replaceInlineStep(block, region, from, to, []))) return false;
|
|
5348
|
+
dispatch?.(tr.setSelection(chunkFK7EBZPX_cjs.textSelection({ block, region, offset: from })));
|
|
5352
5349
|
return true;
|
|
5353
5350
|
};
|
|
5354
5351
|
}
|
|
5355
5352
|
function triggerReplacement(state, range, command) {
|
|
5356
|
-
return
|
|
5353
|
+
return chunkFK7EBZPX_cjs.runCommands(state, command === void 0 ? [deleteTrigger(range)] : [deleteTrigger(range), command]);
|
|
5357
5354
|
}
|
|
5358
5355
|
function replaceTrigger(controller, range, command) {
|
|
5359
5356
|
const { ok, tr } = triggerReplacement(controller.editor.state, range, command);
|
|
@@ -5366,9 +5363,9 @@ var TEXT_STEPS = /* @__PURE__ */ new Set(["replaceInline", "addMark", "removeMar
|
|
|
5366
5363
|
var WHITESPACE3 = /\s/;
|
|
5367
5364
|
var changesBlocks = (tr) => tr !== null && tr.steps.some((step) => !TEXT_STEPS.has(step.stepType));
|
|
5368
5365
|
function withSpaceBefore(state, range) {
|
|
5369
|
-
const inline =
|
|
5366
|
+
const inline = chunkP6HC7RUN_cjs.regionInline(state, range.block, range.region);
|
|
5370
5367
|
if (inline === void 0 || range.from === 0) return null;
|
|
5371
|
-
const text2 =
|
|
5368
|
+
const text2 = chunkI7X7B3WD_cjs.inlineText(inline);
|
|
5372
5369
|
const after = text2.charAt(range.to);
|
|
5373
5370
|
const spaced = text2.charAt(range.from - 1) === " " && (after === "" || WHITESPACE3.test(after));
|
|
5374
5371
|
return spaced ? { ...range, from: range.from - 1 } : null;
|
|
@@ -5473,7 +5470,7 @@ function SlashOverlay({ controller }) {
|
|
|
5473
5470
|
return /* @__PURE__ */ jsxRuntime.jsx(SlashMenu, { controller, labels, items });
|
|
5474
5471
|
}
|
|
5475
5472
|
function slashExtension() {
|
|
5476
|
-
return
|
|
5473
|
+
return chunkFK7EBZPX_cjs.defineExtension({
|
|
5477
5474
|
name: "slash",
|
|
5478
5475
|
plugins: [suggestionPlugin(slashKey, { char: "/" })],
|
|
5479
5476
|
ui: { overlays: [SlashOverlay] }
|
|
@@ -5485,7 +5482,7 @@ function commandItem(id, title, icon, command) {
|
|
|
5485
5482
|
return { id, title, icon, run: (controller) => void controller.run(command) };
|
|
5486
5483
|
}
|
|
5487
5484
|
function addBlockAtCaret(controller) {
|
|
5488
|
-
const block =
|
|
5485
|
+
const block = chunkFK7EBZPX_cjs.headBlockId(controller.editor.state.selection);
|
|
5489
5486
|
if (block !== null) addBlockBelow(controller, block);
|
|
5490
5487
|
}
|
|
5491
5488
|
function mobileItems(labels, openLink) {
|
|
@@ -5497,10 +5494,10 @@ function mobileItems(labels, openLink) {
|
|
|
5497
5494
|
markItem("strike", labels.strike, Strikethrough),
|
|
5498
5495
|
markItem("code", labels.code, Code),
|
|
5499
5496
|
linkItem(labels, openLink),
|
|
5500
|
-
commandItem("indent", labels.indent, ListIndentIncrease,
|
|
5501
|
-
commandItem("outdent", labels.outdent, ListIndentDecrease,
|
|
5502
|
-
commandItem("undo", labels.undo, Undo2,
|
|
5503
|
-
commandItem("redo", labels.redo, Redo2,
|
|
5497
|
+
commandItem("indent", labels.indent, ListIndentIncrease, chunkFK7EBZPX_cjs.indent),
|
|
5498
|
+
commandItem("outdent", labels.outdent, ListIndentDecrease, chunkFK7EBZPX_cjs.outdent),
|
|
5499
|
+
commandItem("undo", labels.undo, Undo2, chunkFK7EBZPX_cjs.undo),
|
|
5500
|
+
commandItem("redo", labels.redo, Redo2, chunkFK7EBZPX_cjs.redo)
|
|
5504
5501
|
]
|
|
5505
5502
|
};
|
|
5506
5503
|
}
|
|
@@ -5554,7 +5551,7 @@ function placement(viewport) {
|
|
|
5554
5551
|
function EditingTools({ controller }) {
|
|
5555
5552
|
const labels = useLabels();
|
|
5556
5553
|
const store = useCanvasUiStore();
|
|
5557
|
-
const state =
|
|
5554
|
+
const state = chunkP6HC7RUN_cjs.useEditorState(controller, chunkP6HC7RUN_cjs.wholeState);
|
|
5558
5555
|
const viewport = useVisualViewport();
|
|
5559
5556
|
const roving = useRovingFocus();
|
|
5560
5557
|
const items = React7.useMemo(() => mobileItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -5811,7 +5808,7 @@ function shortcutsExtension(store) {
|
|
|
5811
5808
|
if (dispatch) store.set({ shortcutsOpen: true });
|
|
5812
5809
|
return true;
|
|
5813
5810
|
};
|
|
5814
|
-
return
|
|
5811
|
+
return chunkFK7EBZPX_cjs.defineExtension({
|
|
5815
5812
|
name: "shortcuts",
|
|
5816
5813
|
keymap: { [SHORTCUT]: open, "Mod-Shift-?": open },
|
|
5817
5814
|
ui: { overlays: [ShortcutsOverlay] }
|
|
@@ -5845,16 +5842,16 @@ function writeBlockData(controller, blockId, data) {
|
|
|
5845
5842
|
const index = doc.index.get(blockId);
|
|
5846
5843
|
if (index === void 0) return;
|
|
5847
5844
|
const block = doc.blocks[index];
|
|
5848
|
-
const { attrs, regions } =
|
|
5849
|
-
if (
|
|
5850
|
-
const tr = editor.createTransaction().step(
|
|
5851
|
-
editor.dispatch(tr.setMeta(
|
|
5845
|
+
const { attrs, regions } = chunkI7X7B3WD_cjs.specFor(schema, block.type).fromData(data, editor.codec.context);
|
|
5846
|
+
if (chunkI7X7B3WD_cjs.sameValue(attrs, block.attrs) && chunkI7X7B3WD_cjs.sameValue(regions, block.regions)) return;
|
|
5847
|
+
const tr = editor.createTransaction().step(chunkFK7EBZPX_cjs.replaceBlockStep({ ...block, attrs, regions }));
|
|
5848
|
+
editor.dispatch(tr.setMeta(chunkFK7EBZPX_cjs.HISTORY_GROUP, `block-data:${blockId}`));
|
|
5852
5849
|
}
|
|
5853
5850
|
function insertAfterBlock(controller, blockId, type, definitions, onError) {
|
|
5854
5851
|
const editor = internal(controller);
|
|
5855
5852
|
const data = chunkA6PGQVTR_cjs.seedData(chunkA6PGQVTR_cjs.blockByType(definitions, type), onError);
|
|
5856
5853
|
if (data === null) return false;
|
|
5857
|
-
const content = data &&
|
|
5854
|
+
const content = data && chunkI7X7B3WD_cjs.specFor(editor.state.schema, type).fromData(data, editor.codec.context);
|
|
5858
5855
|
controller.run(insertBlockToWrite({ type, ...content }, opensEditor(definitions, type), blockId));
|
|
5859
5856
|
return true;
|
|
5860
5857
|
}
|
|
@@ -5878,7 +5875,7 @@ function runHistoryKey(controller, event) {
|
|
|
5878
5875
|
}
|
|
5879
5876
|
function useBlockIndex(controller, blockId) {
|
|
5880
5877
|
const select = React7.useCallback((state) => state.doc.index.get(blockId) ?? -1, [blockId]);
|
|
5881
|
-
return
|
|
5878
|
+
return chunkP6HC7RUN_cjs.useEditorState(controller, select);
|
|
5882
5879
|
}
|
|
5883
5880
|
var FOCUSABLE = [
|
|
5884
5881
|
"input:not([disabled])",
|
|
@@ -5905,8 +5902,8 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5905
5902
|
const leaveUnlessInside = (event) => {
|
|
5906
5903
|
if (!inside.current.has(event)) stop();
|
|
5907
5904
|
};
|
|
5908
|
-
const unlistenCapture =
|
|
5909
|
-
const unlisten =
|
|
5905
|
+
const unlistenCapture = chunkP6HC7RUN_cjs.listen(doc, { pointerdown: leaveForCanvas }, true);
|
|
5906
|
+
const unlisten = chunkP6HC7RUN_cjs.listen(doc, { pointerdown: leaveUnlessInside, focusin: leaveUnlessInside });
|
|
5910
5907
|
return () => {
|
|
5911
5908
|
unlistenCapture();
|
|
5912
5909
|
unlisten();
|
|
@@ -5935,8 +5932,8 @@ function VoidEditor({ Editor, controller, ...props }) {
|
|
|
5935
5932
|
}
|
|
5936
5933
|
function VoidBlock({ block, controller, definition }) {
|
|
5937
5934
|
const { blockTypes, labels } = useQuoin();
|
|
5938
|
-
const { report } = React7.useContext(
|
|
5939
|
-
const readOnly =
|
|
5935
|
+
const { report } = React7.useContext(chunkP6HC7RUN_cjs.BlockErrorContext);
|
|
5936
|
+
const readOnly = chunkP6HC7RUN_cjs.useReadOnly(controller);
|
|
5940
5937
|
const { editor: Editor, alwaysEditing = false } = definition;
|
|
5941
5938
|
const name = blockTypeLabel(labels, block, blockTypes);
|
|
5942
5939
|
const blockId = block.id;
|
|
@@ -6000,7 +5997,7 @@ function VoidBlock({ block, controller, definition }) {
|
|
|
6000
5997
|
role: "group",
|
|
6001
5998
|
"aria-label": name,
|
|
6002
5999
|
tabIndex: editorShown ? -1 : void 0,
|
|
6003
|
-
...{ [
|
|
6000
|
+
...{ [chunkP6HC7RUN_cjs.NATIVE_INTERACTION]: editorShown ? "" : void 0 },
|
|
6004
6001
|
onKeyDown,
|
|
6005
6002
|
...focusHandlers,
|
|
6006
6003
|
onClick,
|
|
@@ -6096,12 +6093,12 @@ function collectUi(extensions, definitions, readOnly = false, onError) {
|
|
|
6096
6093
|
|
|
6097
6094
|
// src/canvas/insert-uploads.ts
|
|
6098
6095
|
function fileBlock(file, stored) {
|
|
6099
|
-
if (isImageFile(file)) return { id:
|
|
6096
|
+
if (isImageFile(file)) return { id: chunkI7X7B3WD_cjs.newId(), type: "IMAGE", attrs: { storageKey: stored.storageKey, alt: "" } };
|
|
6100
6097
|
return { type: "FILE", attrs: fileAttrs(file, stored) };
|
|
6101
6098
|
}
|
|
6102
6099
|
function anchorBlock(controller, at) {
|
|
6103
6100
|
const { doc, selection } = controller.editor.state;
|
|
6104
|
-
const candidates = [at?.block,
|
|
6101
|
+
const candidates = [at?.block, chunkFK7EBZPX_cjs.headBlockId(selection), doc.blocks[doc.blocks.length - 1]?.id];
|
|
6105
6102
|
return candidates.find((id) => typeof id === "string" && doc.index.has(id)) ?? null;
|
|
6106
6103
|
}
|
|
6107
6104
|
var writerOf = (controller) => ({
|
|
@@ -6110,7 +6107,7 @@ var writerOf = (controller) => ({
|
|
|
6110
6107
|
});
|
|
6111
6108
|
function movedOn(controller, before) {
|
|
6112
6109
|
const now = writerOf(controller);
|
|
6113
|
-
return now.focus !== before.focus || !
|
|
6110
|
+
return now.focus !== before.focus || !chunkFK7EBZPX_cjs.sameSelection(now.selection, before.selection);
|
|
6114
6111
|
}
|
|
6115
6112
|
async function insertUploads(controller, files, at, { upload, resolveAssetUrl, onError, unavailable, failed }) {
|
|
6116
6113
|
if (!upload) return onError(new Error(unavailable));
|
|
@@ -6138,15 +6135,15 @@ function holdsHead({ selection }, block) {
|
|
|
6138
6135
|
}
|
|
6139
6136
|
function markdownPlaceholder(state, block, labels) {
|
|
6140
6137
|
const { kind, level } = block.attrs;
|
|
6141
|
-
if (kind === "heading") return labels.placeholderHeading(
|
|
6138
|
+
if (kind === "heading") return labels.placeholderHeading(chunkI7X7B3WD_cjs.headingLevel(level));
|
|
6142
6139
|
if (LIST_KINDS.has(kind)) return labels.placeholderList;
|
|
6143
6140
|
if (kind === "quote") return labels.placeholderQuote;
|
|
6144
6141
|
if (kind !== "paragraph") return void 0;
|
|
6145
6142
|
return holdsHead(state, block) || state.doc.blocks.length === 1 ? labels.placeholderEmpty : void 0;
|
|
6146
6143
|
}
|
|
6147
6144
|
function placeholderFor(state, block, labels) {
|
|
6148
|
-
const region =
|
|
6149
|
-
if (region === null ||
|
|
6145
|
+
const region = chunkFK7EBZPX_cjs.primaryRegion(state.schema, block);
|
|
6146
|
+
if (region === null || chunkFK7EBZPX_cjs.regionLength(block, region) > 0) return void 0;
|
|
6150
6147
|
switch (block.type) {
|
|
6151
6148
|
case "MARKDOWN":
|
|
6152
6149
|
return markdownPlaceholder(state, block, labels);
|
|
@@ -6167,13 +6164,13 @@ function firstLine2(text2) {
|
|
|
6167
6164
|
}
|
|
6168
6165
|
var selectedBlockLabel = (labels, definitions, extensionNames) => (block, schema) => {
|
|
6169
6166
|
const { attrs } = block;
|
|
6170
|
-
if (block.type === "IMAGE") return hasPicture(attrs) ?
|
|
6167
|
+
if (block.type === "IMAGE") return hasPicture(attrs) ? chunkI7X7B3WD_cjs.str(attrs.alt) || labels.imageNoAlt : labels.emptyImage;
|
|
6171
6168
|
if (block.type === "CODE") {
|
|
6172
|
-
const language2 =
|
|
6169
|
+
const language2 = chunkI7X7B3WD_cjs.str(attrs.language);
|
|
6173
6170
|
return labels.codeBlockName(languageName(language2) ?? (language2 || labels.plainText));
|
|
6174
6171
|
}
|
|
6175
6172
|
if (block.type === "FILE" && hasFile(attrs)) return labels.fileBlockName(firstLine2(fileName(attrs)));
|
|
6176
|
-
return firstLine2(
|
|
6173
|
+
return firstLine2(chunkI7X7B3WD_cjs.blockPlainText(block, schema)) || blockTypeLabel(labels, block, definitions, extensionNames);
|
|
6177
6174
|
};
|
|
6178
6175
|
function revealLinkedBlock(controller, hash) {
|
|
6179
6176
|
const id = linkedBlockId(hash);
|
|
@@ -6181,7 +6178,7 @@ function revealLinkedBlock(controller, hash) {
|
|
|
6181
6178
|
if (id === null || shell === void 0) return false;
|
|
6182
6179
|
const { editor } = controller;
|
|
6183
6180
|
const { doc, schema } = editor.state;
|
|
6184
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
6181
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkFK7EBZPX_cjs.startOf(doc, schema, id)));
|
|
6185
6182
|
shell.scrollIntoView({ block: "center" });
|
|
6186
6183
|
return true;
|
|
6187
6184
|
}
|
|
@@ -6198,8 +6195,8 @@ function useBlockLinkTarget(controller, focusOnMount) {
|
|
|
6198
6195
|
}, [controller, focusOnMount]);
|
|
6199
6196
|
}
|
|
6200
6197
|
var WRITER_ORIGINS = /* @__PURE__ */ new Set(["command", "input", "paste"]);
|
|
6201
|
-
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(
|
|
6202
|
-
var isEmptyText = (schema, block) =>
|
|
6198
|
+
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(chunkFK7EBZPX_cjs.LINE_JOIN) !== true;
|
|
6199
|
+
var isEmptyText = (schema, block) => chunkFK7EBZPX_cjs.isTextFlow(schema, block) && chunkFK7EBZPX_cjs.regionLength(block, chunkFK7EBZPX_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
6203
6200
|
function filledLine({ origin, before }, schema) {
|
|
6204
6201
|
const { selection } = before;
|
|
6205
6202
|
if (origin !== "paste" || selection?.kind !== "text") return () => false;
|
|
@@ -6213,13 +6210,13 @@ function deletions(codec, tr) {
|
|
|
6213
6210
|
const { index, count } = step.toJSON();
|
|
6214
6211
|
if (typeof index !== "number" || typeof count !== "number") return [];
|
|
6215
6212
|
const { blocks } = tr.docs[i];
|
|
6216
|
-
const first = codec.blocksFromDoc(
|
|
6213
|
+
const first = codec.blocksFromDoc(chunkI7X7B3WD_cjs.createDoc(blocks.slice(0, index))).length;
|
|
6217
6214
|
return blocks.slice(index, index + count).flatMap((block, offset) => filled(block) ? [] : [{ block: codec.toQuoin(block), index: first + offset }]);
|
|
6218
6215
|
});
|
|
6219
6216
|
}
|
|
6220
6217
|
function useDeleteReporter(controller, onDelete) {
|
|
6221
6218
|
const latest = React7.useRef(onDelete);
|
|
6222
|
-
|
|
6219
|
+
chunkP6HC7RUN_cjs.useIsomorphicLayoutEffect(() => {
|
|
6223
6220
|
latest.current = onDelete;
|
|
6224
6221
|
});
|
|
6225
6222
|
React7.useEffect(() => {
|
|
@@ -6273,7 +6270,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
6273
6270
|
const [voidEditing] = React7.useState(createVoidEditing);
|
|
6274
6271
|
const [uiStore] = React7.useState(createCanvasUiStore);
|
|
6275
6272
|
const [allExtensions] = React7.useState(() => [
|
|
6276
|
-
...
|
|
6273
|
+
...chunkFK7EBZPX_cjs.coreExtensions(),
|
|
6277
6274
|
voidEditing.extension,
|
|
6278
6275
|
blockMenuKeymap(uiStore),
|
|
6279
6276
|
slashExtension(),
|
|
@@ -6291,7 +6288,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
6291
6288
|
);
|
|
6292
6289
|
useTypedInPlaceWarning(blockTypes, readOnly);
|
|
6293
6290
|
const [focusOnMount] = React7.useState(autoFocus);
|
|
6294
|
-
const controller =
|
|
6291
|
+
const controller = chunkP6HC7RUN_cjs.useQuoinEditor({
|
|
6295
6292
|
blocks,
|
|
6296
6293
|
onChange,
|
|
6297
6294
|
readOnly,
|
|
@@ -6335,7 +6332,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
6335
6332
|
[controller, resolveAssetUrl]
|
|
6336
6333
|
);
|
|
6337
6334
|
return /* @__PURE__ */ jsxRuntime.jsx(QuoinProvider, { value: { blockTypes, upload, resolveAssetUrl, onError, highlight, controller, labels }, children: /* @__PURE__ */ jsxRuntime.jsx(VoidEditingContext.Provider, { value: voidEditing, children: /* @__PURE__ */ jsxRuntime.jsx(SlashItemsProvider, { value: slashItems, children: /* @__PURE__ */ jsxRuntime.jsx(BubbleItemsProvider, { value: ui.bubbleItems, children: /* @__PURE__ */ jsxRuntime.jsx(CanvasUiProvider, { value: uiStore, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6338
|
-
|
|
6335
|
+
chunkP6HC7RUN_cjs.EditorView,
|
|
6339
6336
|
{
|
|
6340
6337
|
controller,
|
|
6341
6338
|
renderers: ui.renderers,
|
|
@@ -6529,7 +6526,7 @@ function useAutosave({
|
|
|
6529
6526
|
const seen = seenRef.current;
|
|
6530
6527
|
seenRef.current = deps;
|
|
6531
6528
|
if (seen === null) return;
|
|
6532
|
-
const unchanged =
|
|
6529
|
+
const unchanged = chunkI7X7B3WD_cjs.sameItems(seen, deps);
|
|
6533
6530
|
if (!unchanged) runner.markDirty();
|
|
6534
6531
|
}, deps);
|
|
6535
6532
|
React7__namespace.useEffect(() => {
|