quoin-editor 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/ai.cjs +135 -94
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.js +62 -21
- package/dist/ai.js.map +1 -1
- package/dist/catalogue.cjs +25 -25
- package/dist/catalogue.d.cts +6 -6
- package/dist/catalogue.d.ts +6 -6
- package/dist/catalogue.js +17 -17
- package/dist/{chunk-MQ2XQ4MX.js → chunk-26Q4LSIU.js} +6 -6
- package/dist/chunk-26Q4LSIU.js.map +1 -0
- package/dist/{chunk-AEJXZBVR.cjs → chunk-56C7GCKO.cjs} +110 -103
- package/dist/chunk-56C7GCKO.cjs.map +1 -0
- package/dist/{chunk-GTTPVJSD.cjs → chunk-5M4QG3ZC.cjs} +262 -245
- package/dist/chunk-5M4QG3ZC.cjs.map +1 -0
- package/dist/{chunk-2VDK27IF.cjs → chunk-5R3ISX4A.cjs} +312 -335
- package/dist/chunk-5R3ISX4A.cjs.map +1 -0
- package/dist/{chunk-LCQSG4M6.js → chunk-62WKUAQY.js} +18 -18
- package/dist/{chunk-LCQSG4M6.js.map → chunk-62WKUAQY.js.map} +1 -1
- package/dist/{chunk-NOKWNK2O.js → chunk-6LMS5J3Y.js} +3 -2
- package/dist/{chunk-HELJTLNC.cjs → chunk-6PKVJZQV.cjs} +12 -12
- package/dist/chunk-6PKVJZQV.cjs.map +1 -0
- package/dist/chunk-6YSGUAVW.js +376 -0
- package/dist/chunk-6YSGUAVW.js.map +1 -0
- package/dist/{chunk-CDELOHDY.cjs → chunk-75C6PX2L.cjs} +23 -23
- package/dist/{chunk-CDELOHDY.cjs.map → chunk-75C6PX2L.cjs.map} +1 -1
- package/dist/{chunk-T7SW6OWV.js → chunk-A4IJSJKL.js} +5 -5
- package/dist/{chunk-ND5XJVK2.cjs → chunk-BTBHHBVR.cjs} +19 -19
- package/dist/{chunk-ND5XJVK2.cjs.map → chunk-BTBHHBVR.cjs.map} +1 -1
- package/dist/{chunk-WXMYDXPN.cjs → chunk-CLTHD5GO.cjs} +4 -3
- package/dist/chunk-CLTHD5GO.cjs.map +1 -0
- package/dist/{chunk-OMOBMXD5.cjs → chunk-EH5KXQXY.cjs} +7 -2
- package/dist/chunk-EH5KXQXY.cjs.map +1 -0
- package/dist/{chunk-WQHV3MRE.cjs → chunk-ESMAW4NK.cjs} +12 -12
- package/dist/{chunk-WQHV3MRE.cjs.map → chunk-ESMAW4NK.cjs.map} +1 -1
- package/dist/{chunk-SLVDAHHK.cjs → chunk-EYFCOV3T.cjs} +5 -5
- package/dist/{chunk-SLVDAHHK.cjs.map → chunk-EYFCOV3T.cjs.map} +1 -1
- package/dist/{chunk-5DNCCN6X.cjs → chunk-F5V3IEEE.cjs} +27 -27
- package/dist/{chunk-5DNCCN6X.cjs.map → chunk-F5V3IEEE.cjs.map} +1 -1
- package/dist/{chunk-PMWCQSQX.js → chunk-GPIDU3GN.js} +5 -5
- package/dist/{chunk-PZ4GT5JO.cjs → chunk-HOIDJEVI.cjs} +316 -300
- package/dist/chunk-HOIDJEVI.cjs.map +1 -0
- package/dist/{chunk-RDG4VI6E.cjs → chunk-JJ3RASQS.cjs} +90 -90
- package/dist/{chunk-RDG4VI6E.cjs.map → chunk-JJ3RASQS.cjs.map} +1 -1
- package/dist/{chunk-ZGZEJCRV.js → chunk-LE3F7WIP.js} +23 -46
- package/dist/chunk-LE3F7WIP.js.map +1 -0
- package/dist/chunk-LE5XMIFJ.cjs +14 -0
- package/dist/chunk-LE5XMIFJ.cjs.map +1 -0
- package/dist/{chunk-POBM7MGR.js → chunk-LMAEPFTX.js} +2 -2
- package/dist/{chunk-ZHOSSWUM.js → chunk-LV6EYPJO.js} +4 -3
- package/dist/chunk-LV6EYPJO.js.map +1 -0
- package/dist/chunk-MLRAVUFG.cjs +376 -0
- package/dist/chunk-MLRAVUFG.cjs.map +1 -0
- package/dist/chunk-MQUCCSWG.js +14 -0
- package/dist/chunk-MQUCCSWG.js.map +1 -0
- package/dist/{chunk-XEBWC7ZL.js → chunk-O4Z2WMFF.js} +7 -2
- package/dist/chunk-O4Z2WMFF.js.map +1 -0
- package/dist/{chunk-K574XHMM.js → chunk-OCCKQHCY.js} +2 -2
- package/dist/{chunk-SG37UBDO.js → chunk-PGSS4IOS.js} +7 -7
- package/dist/{chunk-RUDWMKYX.js → chunk-PIWRSX7U.js} +8 -8
- package/dist/{chunk-PWUEPDA3.cjs → chunk-PX6LZMH4.cjs} +44 -44
- package/dist/{chunk-PWUEPDA3.cjs.map → chunk-PX6LZMH4.cjs.map} +1 -1
- package/dist/{chunk-JDPTZUBW.js → chunk-QXG3HWDS.js} +4 -4
- package/dist/{chunk-NNDYYEW5.js → chunk-RQW3P3GH.js} +5 -5
- package/dist/{chunk-ZS2WA357.js → chunk-SSIRYUCK.js} +144 -127
- package/dist/chunk-SSIRYUCK.js.map +1 -0
- package/dist/{chunk-47MLKSI2.js → chunk-UBNG5YCG.js} +6 -6
- package/dist/{chunk-KXOBZGQO.js → chunk-UCXLRRWY.js} +21 -14
- package/dist/chunk-UCXLRRWY.js.map +1 -0
- package/dist/{chunk-EL2OEJQC.cjs → chunk-UDAVVEFC.cjs} +56 -56
- package/dist/{chunk-EL2OEJQC.cjs.map → chunk-UDAVVEFC.cjs.map} +1 -1
- package/dist/{chunk-HJIQT3S5.js → chunk-UPSLDTLT.js} +100 -84
- package/dist/chunk-UPSLDTLT.js.map +1 -0
- package/dist/{chunk-GLLXHMH2.cjs → chunk-UWNZG2SD.cjs} +3 -3
- package/dist/{chunk-GLLXHMH2.cjs.map → chunk-UWNZG2SD.cjs.map} +1 -1
- package/dist/{chunk-HZSSEYJS.cjs → chunk-V3KLMSRO.cjs} +30 -30
- package/dist/{chunk-HZSSEYJS.cjs.map → chunk-V3KLMSRO.cjs.map} +1 -1
- package/dist/{chunk-ZC24WB7Y.cjs → chunk-VACTAZWS.cjs} +14 -14
- package/dist/{chunk-ZC24WB7Y.cjs.map → chunk-VACTAZWS.cjs.map} +1 -1
- package/dist/{chunk-KAVU6T6J.js → chunk-WMN6566P.js} +5 -5
- package/dist/{chunk-2QCRZ7OL.cjs → chunk-XX5FTPJR.cjs} +12 -11
- package/dist/{chunk-2QCRZ7OL.cjs.map → chunk-XX5FTPJR.cjs.map} +1 -1
- package/dist/comments.cjs +113 -98
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.d.cts +6 -1
- package/dist/comments.d.ts +6 -1
- package/dist/comments.js +32 -17
- package/dist/comments.js.map +1 -1
- package/dist/diff.cjs +43 -40
- package/dist/diff.cjs.map +1 -1
- package/dist/diff.js +16 -13
- package/dist/diff.js.map +1 -1
- package/dist/docx.cjs +60 -40
- package/dist/docx.cjs.map +1 -1
- package/dist/docx.d.cts +6 -0
- package/dist/docx.d.ts +6 -0
- package/dist/docx.js +32 -12
- package/dist/docx.js.map +1 -1
- package/dist/embed.cjs +9 -9
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.js +8 -8
- package/dist/{emoji-extension-DpQ43HjE.d.ts → emoji-extension-CmPlRssm.d.ts} +1 -1
- package/dist/{emoji-extension-C12gDPm6.d.cts → emoji-extension-zJ6F7hW8.d.cts} +1 -1
- package/dist/emoji.cjs +8 -8
- package/dist/emoji.d.cts +3 -3
- package/dist/emoji.d.ts +3 -3
- package/dist/emoji.js +7 -7
- package/dist/engine.cjs +4 -4
- package/dist/engine.d.cts +2 -2
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +3 -3
- package/dist/{find-extension-_sbZEt3R.d.cts → find-extension-BcRyE9K4.d.cts} +1 -1
- package/dist/{find-extension-DKqLLSuP.d.ts → find-extension-CmFehyul.d.ts} +1 -1
- package/dist/find.cjs +8 -8
- package/dist/find.d.cts +2 -2
- package/dist/find.d.ts +2 -2
- package/dist/find.js +7 -7
- package/dist/headless.cjs +5 -5
- package/dist/headless.d.cts +4 -4
- package/dist/headless.d.ts +4 -4
- package/dist/headless.js +4 -4
- package/dist/{index-CgD72kHB.d.cts → index-CFPmCee4.d.cts} +5 -2
- package/dist/{index-DNYbTK3w.d.ts → index-DiCGV60d.d.ts} +5 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/math.cjs +10 -10
- package/dist/math.d.cts +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +9 -9
- package/dist/mention.cjs +10 -10
- package/dist/mention.d.cts +1 -1
- package/dist/mention.d.ts +1 -1
- package/dist/mention.js +9 -9
- package/dist/presence.cjs +96 -99
- package/dist/presence.cjs.map +1 -1
- package/dist/presence.d.cts +2 -2
- package/dist/presence.d.ts +2 -2
- package/dist/presence.js +64 -67
- package/dist/presence.js.map +1 -1
- package/dist/{stats-extension-Bly88uio.d.ts → stats-extension-DisOEbbI.d.ts} +1 -1
- package/dist/{stats-extension-CJPijvUb.d.cts → stats-extension-Dt1lgP3m.d.cts} +1 -1
- package/dist/stats.cjs +9 -9
- package/dist/stats.d.cts +3 -3
- package/dist/stats.d.ts +3 -3
- package/dist/stats.js +8 -8
- package/dist/styles.css +1 -1
- package/dist/{table-extension-Dzf4k6hI.d.ts → table-extension-BTMJnT7J.d.ts} +1 -1
- package/dist/{table-extension-BTLxFy2S.d.cts → table-extension-DxZz3jqp.d.cts} +1 -1
- package/dist/table.cjs +8 -8
- package/dist/table.d.cts +2 -2
- package/dist/table.d.ts +2 -2
- package/dist/table.js +7 -7
- package/dist/{toc-extension-DWm5alVj.d.ts → toc-extension-CR9U-l6j.d.ts} +1 -1
- package/dist/{toc-extension-B3-s6h2x.d.cts → toc-extension-DGHywOBv.d.cts} +1 -1
- package/dist/toc.cjs +8 -8
- package/dist/toc.d.cts +2 -2
- package/dist/toc.d.ts +2 -2
- package/dist/toc.js +7 -7
- package/dist/{types-a1CRBlEh.d.ts → types-C6_QkXzy.d.ts} +1 -9
- package/dist/{types-Cz7XJLaK.d.cts → types-CJ7Gq3GX.d.cts} +1 -9
- package/dist/{view-controller-DSHw0ltQ.d.cts → view-controller-BD1KwYfE.d.cts} +6 -19
- package/dist/{view-controller-UbpzblGl.d.ts → view-controller-y4cb60ue.d.ts} +6 -19
- package/dist/view.cjs +6 -6
- package/dist/view.js +3 -3
- package/dist/yjs.cjs +234 -396
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.d.cts +3 -3
- package/dist/yjs.d.ts +3 -3
- package/dist/yjs.js +126 -288
- package/dist/yjs.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2VDK27IF.cjs.map +0 -1
- package/dist/chunk-AEJXZBVR.cjs.map +0 -1
- package/dist/chunk-E75EHRPA.cjs +0 -175
- package/dist/chunk-E75EHRPA.cjs.map +0 -1
- package/dist/chunk-GTTPVJSD.cjs.map +0 -1
- package/dist/chunk-HELJTLNC.cjs.map +0 -1
- package/dist/chunk-HJIQT3S5.js.map +0 -1
- package/dist/chunk-JEIFJHEI.js +0 -14
- package/dist/chunk-JEIFJHEI.js.map +0 -1
- package/dist/chunk-KXOBZGQO.js.map +0 -1
- package/dist/chunk-MQ2XQ4MX.js.map +0 -1
- package/dist/chunk-OMOBMXD5.cjs.map +0 -1
- package/dist/chunk-PZ4GT5JO.cjs.map +0 -1
- package/dist/chunk-QAW5NH6S.cjs +0 -14
- package/dist/chunk-QAW5NH6S.cjs.map +0 -1
- package/dist/chunk-TC4DARU2.js +0 -175
- package/dist/chunk-TC4DARU2.js.map +0 -1
- package/dist/chunk-WXMYDXPN.cjs.map +0 -1
- package/dist/chunk-XEBWC7ZL.js.map +0 -1
- package/dist/chunk-ZGZEJCRV.js.map +0 -1
- package/dist/chunk-ZHOSSWUM.js.map +0 -1
- package/dist/chunk-ZS2WA357.js.map +0 -1
- /package/dist/{chunk-NOKWNK2O.js.map → chunk-6LMS5J3Y.js.map} +0 -0
- /package/dist/{chunk-T7SW6OWV.js.map → chunk-A4IJSJKL.js.map} +0 -0
- /package/dist/{chunk-PMWCQSQX.js.map → chunk-GPIDU3GN.js.map} +0 -0
- /package/dist/{chunk-POBM7MGR.js.map → chunk-LMAEPFTX.js.map} +0 -0
- /package/dist/{chunk-K574XHMM.js.map → chunk-OCCKQHCY.js.map} +0 -0
- /package/dist/{chunk-SG37UBDO.js.map → chunk-PGSS4IOS.js.map} +0 -0
- /package/dist/{chunk-RUDWMKYX.js.map → chunk-PIWRSX7U.js.map} +0 -0
- /package/dist/{chunk-JDPTZUBW.js.map → chunk-QXG3HWDS.js.map} +0 -0
- /package/dist/{chunk-NNDYYEW5.js.map → chunk-RQW3P3GH.js.map} +0 -0
- /package/dist/{chunk-47MLKSI2.js.map → chunk-UBNG5YCG.js.map} +0 -0
- /package/dist/{chunk-KAVU6T6J.js.map → chunk-WMN6566P.js.map} +0 -0
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var _chunkGTTPVJSDcjs = require('./chunk-GTTPVJSD.cjs');
|
|
29
28
|
|
|
29
|
+
var _chunk5M4QG3ZCcjs = require('./chunk-5M4QG3ZC.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var _chunkOMOBMXD5cjs = require('./chunk-OMOBMXD5.cjs');
|
|
36
35
|
|
|
37
36
|
|
|
37
|
+
var _chunkEH5KXQXYcjs = require('./chunk-EH5KXQXY.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -98,12 +98,12 @@ var _chunkOMOBMXD5cjs = require('./chunk-OMOBMXD5.cjs');
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
var _chunkPZ4GT5JOcjs = require('./chunk-PZ4GT5JO.cjs');
|
|
102
101
|
|
|
103
102
|
|
|
104
|
-
var
|
|
103
|
+
var _chunkHOIDJEVIcjs = require('./chunk-HOIDJEVI.cjs');
|
|
105
104
|
|
|
106
105
|
|
|
106
|
+
var _chunkXX5FTPJRcjs = require('./chunk-XX5FTPJR.cjs');
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
|
|
@@ -127,7 +127,9 @@ var _chunk2QCRZ7OLcjs = require('./chunk-2QCRZ7OL.cjs');
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
var _chunkBTBHHBVRcjs = require('./chunk-BTBHHBVR.cjs');
|
|
131
133
|
|
|
132
134
|
// src/canvas/BlockCanvas.tsx
|
|
133
135
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react);
|
|
@@ -387,17 +389,17 @@ function useLabels() {
|
|
|
387
389
|
}
|
|
388
390
|
|
|
389
391
|
// src/blocks/caption-markdown.ts
|
|
390
|
-
var captionText = (markdown) =>
|
|
392
|
+
var captionText = (markdown) => _chunkBTBHHBVRcjs.inlineText.call(void 0, _chunkBTBHHBVRcjs.parseInline.call(void 0, markdown), () => "");
|
|
391
393
|
|
|
392
394
|
// src/blocks/code/HighlightOverlay.tsx
|
|
393
395
|
|
|
394
396
|
|
|
395
397
|
function Token({ text: text2, color, className }) {
|
|
396
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color }, className, children: text2 });
|
|
398
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: _chunkEH5KXQXYcjs.tokenColour.call(void 0, color) }, className, children: text2 });
|
|
397
399
|
}
|
|
398
400
|
function HighlightOverlay({ code, language: language2, drawnRef, ...props }) {
|
|
399
401
|
const { highlight } = useQuoin();
|
|
400
|
-
const lines = _react.useMemo.call(void 0, () =>
|
|
402
|
+
const lines = _react.useMemo.call(void 0, () => _chunkEH5KXQXYcjs.highlightedLines.call(void 0, highlight, code, language2), [highlight, code, language2]);
|
|
401
403
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "pre", { ...props, ref: drawnRef, className: "quoin-code-text", children: [
|
|
402
404
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "code", { children: lines === null ? code : lines.map((line, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
403
405
|
index > 0 && "\n",
|
|
@@ -412,17 +414,17 @@ function assetHref(resolveAssetUrl, storageKey) {
|
|
|
412
414
|
if (storageKey === "") return null;
|
|
413
415
|
try {
|
|
414
416
|
const src = resolveAssetUrl(storageKey);
|
|
415
|
-
return typeof src === "string" &&
|
|
417
|
+
return typeof src === "string" && _chunkBTBHHBVRcjs.sanitizeAssetUrl.call(void 0, src) || null;
|
|
416
418
|
} catch (e2) {
|
|
417
419
|
return null;
|
|
418
420
|
}
|
|
419
421
|
}
|
|
420
422
|
|
|
421
423
|
// src/blocks/image/image-source.ts
|
|
422
|
-
var hasPicture = (attrs) =>
|
|
424
|
+
var hasPicture = (attrs) => _chunkBTBHHBVRcjs.str.call(void 0, attrs.url) !== "" || _chunkBTBHHBVRcjs.str.call(void 0, attrs.storageKey) !== "";
|
|
423
425
|
function imageSource(attrs, resolveAssetUrl) {
|
|
424
|
-
const url =
|
|
425
|
-
return url === "" ? assetHref(resolveAssetUrl,
|
|
426
|
+
const url = _chunkBTBHHBVRcjs.str.call(void 0, attrs.url);
|
|
427
|
+
return url === "" ? assetHref(resolveAssetUrl, _chunkBTBHHBVRcjs.str.call(void 0, attrs.storageKey)) : _chunkBTBHHBVRcjs.sanitizeHref.call(void 0, url);
|
|
426
428
|
}
|
|
427
429
|
|
|
428
430
|
// src/blocks/previews.tsx
|
|
@@ -437,69 +439,69 @@ var TONE = {
|
|
|
437
439
|
};
|
|
438
440
|
function MarkdownPreview({ data }) {
|
|
439
441
|
const labels = useLabels();
|
|
440
|
-
const markdown =
|
|
442
|
+
const markdown = _chunkBTBHHBVRcjs.str.call(void 0, data.markdown);
|
|
441
443
|
if (markdown.trim() === "") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: HINT, children: labels.emptyMarkdown });
|
|
442
444
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "whitespace-pre-wrap text-base leading-7", children: markdown });
|
|
443
445
|
}
|
|
444
446
|
function CodePreview({ data }) {
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { dir: "ltr", className: "quoin-code quoin-code-scroll pt-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HighlightOverlay, { code:
|
|
447
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { dir: "ltr", className: "quoin-code quoin-code-scroll pt-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HighlightOverlay, { code: _chunkBTBHHBVRcjs.str.call(void 0, data.code), language: _chunkBTBHHBVRcjs.str.call(void 0, data.language) }) });
|
|
446
448
|
}
|
|
447
449
|
function ImagePreview({ data }) {
|
|
448
450
|
const { resolveAssetUrl, labels } = useQuoin();
|
|
449
451
|
const src = imageSource(data, resolveAssetUrl);
|
|
450
452
|
if (src === null) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: HINT, children: labels.emptyImage });
|
|
451
|
-
const caption = captionText(
|
|
453
|
+
const caption = captionText(_chunkBTBHHBVRcjs.str.call(void 0, data.caption));
|
|
452
454
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "figure", { children: [
|
|
453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src, alt:
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src, alt: _chunkBTBHHBVRcjs.str.call(void 0, data.alt) || labels.imageNoAlt, className: "max-w-full rounded-md" }),
|
|
454
456
|
caption && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "figcaption", { className: HINT, children: caption })
|
|
455
457
|
] });
|
|
456
458
|
}
|
|
457
459
|
function FilePreview({ data }) {
|
|
458
460
|
const labels = useLabels();
|
|
459
|
-
const name =
|
|
461
|
+
const name = _chunkBTBHHBVRcjs.str.call(void 0, data.filename);
|
|
460
462
|
if (name === "") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: HINT, children: labels.emptyFile });
|
|
461
463
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: name });
|
|
462
464
|
}
|
|
463
465
|
function CalloutPreview({ data }) {
|
|
464
466
|
const labels = useLabels();
|
|
465
|
-
const body =
|
|
467
|
+
const body = _chunkBTBHHBVRcjs.str.call(void 0, data.body);
|
|
466
468
|
if (body.trim() === "") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: HINT, children: labels.emptyCallout });
|
|
467
|
-
const tone =
|
|
469
|
+
const tone = _chunkBTBHHBVRcjs.str.call(void 0, data.tone) || "info";
|
|
468
470
|
const paint = _nullishCoalesce(TONE[tone], () => ( "border-border bg-muted/50"));
|
|
469
471
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-tone": tone, className: `rounded-md border-l-4 ${paint} p-3 text-sm`, children: body });
|
|
470
472
|
}
|
|
471
473
|
|
|
472
474
|
// src/blocks/core.ts
|
|
473
475
|
var coreBlocks = [
|
|
474
|
-
|
|
476
|
+
_chunkEH5KXQXYcjs.defineBlock.call(void 0, {
|
|
475
477
|
type: "MARKDOWN",
|
|
476
478
|
label: "Markdown",
|
|
477
479
|
icon: _lucidereact.FileText,
|
|
478
480
|
preview: MarkdownPreview,
|
|
479
481
|
initialData: () => ({ markdown: "" })
|
|
480
482
|
}),
|
|
481
|
-
|
|
483
|
+
_chunkEH5KXQXYcjs.defineBlock.call(void 0, {
|
|
482
484
|
type: "CALLOUT",
|
|
483
485
|
label: "Callout",
|
|
484
486
|
icon: _lucidereact.MessageSquare,
|
|
485
487
|
preview: CalloutPreview,
|
|
486
488
|
initialData: () => ({ tone: "info", body: "" })
|
|
487
489
|
}),
|
|
488
|
-
|
|
490
|
+
_chunkEH5KXQXYcjs.defineBlock.call(void 0, {
|
|
489
491
|
type: "CODE",
|
|
490
492
|
label: "Code",
|
|
491
493
|
icon: _lucidereact.Code,
|
|
492
494
|
preview: CodePreview,
|
|
493
495
|
initialData: () => ({ language: "", code: "" })
|
|
494
496
|
}),
|
|
495
|
-
|
|
497
|
+
_chunkEH5KXQXYcjs.defineBlock.call(void 0, {
|
|
496
498
|
type: "IMAGE",
|
|
497
499
|
label: "Image",
|
|
498
500
|
icon: _lucidereact.Image,
|
|
499
501
|
preview: ImagePreview,
|
|
500
502
|
initialData: () => ({ storageKey: "", alt: "" })
|
|
501
503
|
}),
|
|
502
|
-
|
|
504
|
+
_chunkEH5KXQXYcjs.defineBlock.call(void 0, {
|
|
503
505
|
type: "FILE",
|
|
504
506
|
label: "File",
|
|
505
507
|
icon: _lucidereact.Paperclip,
|
|
@@ -516,7 +518,7 @@ function selectNode(controller, blockId) {
|
|
|
516
518
|
const { editor } = controller;
|
|
517
519
|
const { selection } = editor.state;
|
|
518
520
|
if (_optionalChain([selection, 'optionalAccess', _2 => _2.kind]) === "node" && selection.block === blockId) return;
|
|
519
|
-
|
|
521
|
+
_chunk5M4QG3ZCcjs.dispatchSelection.call(void 0, controller, _chunkHOIDJEVIcjs.nodeSelection.call(void 0, blockId));
|
|
520
522
|
}
|
|
521
523
|
function focusNode(controller, blockId) {
|
|
522
524
|
selectNode(controller, blockId);
|
|
@@ -546,8 +548,8 @@ var OPEN_EDITOR = "openEditor";
|
|
|
546
548
|
var ABOVE_CORE_KEYS = 200;
|
|
547
549
|
function turnedBlock(tr, { doc, selection }) {
|
|
548
550
|
if (_optionalChain([selection, 'optionalAccess', _3 => _3.kind]) !== "node" || tr.origin === "remote" || tr.origin === "reconcile") return void 0;
|
|
549
|
-
const before =
|
|
550
|
-
return before !== void 0 && before.type !== _optionalChain([
|
|
551
|
+
const before = _chunkBTBHHBVRcjs.blockById.call(void 0, tr.before.doc, selection.block);
|
|
552
|
+
return before !== void 0 && before.type !== _optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, doc, selection.block), 'optionalAccess', _4 => _4.type]) ? selection.block : void 0;
|
|
551
553
|
}
|
|
552
554
|
function createVoidEditing() {
|
|
553
555
|
const starters = /* @__PURE__ */ new Map();
|
|
@@ -567,7 +569,7 @@ function createVoidEditing() {
|
|
|
567
569
|
_optionalChain([start, 'optionalCall', _6 => _6()]);
|
|
568
570
|
};
|
|
569
571
|
return {
|
|
570
|
-
extension:
|
|
572
|
+
extension: _chunkHOIDJEVIcjs.defineExtension.call(void 0, {
|
|
571
573
|
name: "void-editing",
|
|
572
574
|
priority: ABOVE_CORE_KEYS,
|
|
573
575
|
keymap: { Enter: openEditor },
|
|
@@ -864,32 +866,32 @@ function settle(tr, before) {
|
|
|
864
866
|
const { schema } = tr.before;
|
|
865
867
|
const result = tr.selection;
|
|
866
868
|
if (_optionalChain([result, 'optionalAccess', _21 => _21.kind]) !== "blocks" || _optionalChain([before, 'optionalAccess', _22 => _22.kind]) === "blocks") return result;
|
|
867
|
-
const ids =
|
|
868
|
-
const head =
|
|
869
|
-
if (head !== null && ids.includes(head) &&
|
|
870
|
-
return
|
|
869
|
+
const ids = _chunkHOIDJEVIcjs.selectedBlockIds.call(void 0, doc, result);
|
|
870
|
+
const head = _chunkHOIDJEVIcjs.headBlockId.call(void 0, before);
|
|
871
|
+
if (head !== null && ids.includes(head) && _chunkHOIDJEVIcjs.validateSelection.call(void 0, doc, schema, before) === before) return before;
|
|
872
|
+
return _chunkHOIDJEVIcjs.endOf.call(void 0, doc, schema, ids[0]);
|
|
871
873
|
}
|
|
872
874
|
function runOnBlocks(controller, blockIds, command) {
|
|
873
875
|
const { state } = controller.editor;
|
|
874
876
|
const ids = blockIds.filter((id) => state.doc.index.has(id));
|
|
875
877
|
if (ids.length === 0) return false;
|
|
876
878
|
const before = state.selection;
|
|
877
|
-
const exact =
|
|
878
|
-
const ran = exact ? before :
|
|
879
|
-
const { ok, tr } =
|
|
880
|
-
const result = ok && tr !== null ? tr : new (0,
|
|
879
|
+
const exact = _chunkBTBHHBVRcjs.sameItems.call(void 0, _chunkHOIDJEVIcjs.selectedBlockIds.call(void 0, state.doc, before), ids);
|
|
880
|
+
const ran = exact ? before : _chunkHOIDJEVIcjs.blockRangeSelection.call(void 0, ids[0], ids[ids.length - 1]);
|
|
881
|
+
const { ok, tr } = _chunkHOIDJEVIcjs.runCommands.call(void 0, state, [_chunkHOIDJEVIcjs.setSelection.call(void 0, ran), command]);
|
|
882
|
+
const result = ok && tr !== null ? tr : new (0, _chunkHOIDJEVIcjs.Transaction)(state).setSelection(ran);
|
|
881
883
|
const settled = exact ? result.selection : settle(result, before);
|
|
882
|
-
if (!
|
|
883
|
-
if (result.docChanged || !
|
|
884
|
+
if (!_chunkHOIDJEVIcjs.sameSelection.call(void 0, settled, result.selection)) result.setSelection(settled);
|
|
885
|
+
if (result.docChanged || !_chunkHOIDJEVIcjs.sameSelection.call(void 0, result.selection, before)) controller.dispatch(result);
|
|
884
886
|
return ok;
|
|
885
887
|
}
|
|
886
888
|
var noChange = () => true;
|
|
887
889
|
|
|
888
890
|
// src/gutter/block-menu-items.ts
|
|
889
|
-
var rangeOf = (blockIds) =>
|
|
891
|
+
var rangeOf = (blockIds) => _chunkHOIDJEVIcjs.blockRangeSelection.call(void 0, blockIds[0], blockIds[blockIds.length - 1]);
|
|
890
892
|
function selectedWith(state, blockId) {
|
|
891
893
|
const { doc, selection } = state;
|
|
892
|
-
const selected =
|
|
894
|
+
const selected = _chunkHOIDJEVIcjs.selectedBlockIds.call(void 0, doc, selection);
|
|
893
895
|
const ofBlocks = _optionalChain([selection, 'optionalAccess', _23 => _23.kind]) === "blocks" || _optionalChain([selection, 'optionalAccess', _24 => _24.kind]) === "text" && selected.length > 1;
|
|
894
896
|
return ofBlocks && selected.includes(blockId) ? selected : null;
|
|
895
897
|
}
|
|
@@ -897,8 +899,8 @@ function menuTargets(state, blockId) {
|
|
|
897
899
|
const selected = selectedWith(state, blockId);
|
|
898
900
|
if (selected !== null) return selected;
|
|
899
901
|
const { doc } = state;
|
|
900
|
-
const index =
|
|
901
|
-
return doc.blocks.slice(index,
|
|
902
|
+
const index = _chunkBTBHHBVRcjs.requireBlockIndex.call(void 0, doc, blockId);
|
|
903
|
+
return doc.blocks.slice(index, _chunkHOIDJEVIcjs.descendantsEnd.call(void 0, doc, index)).map((block) => block.id);
|
|
902
904
|
}
|
|
903
905
|
function styleTargets(state, blockId) {
|
|
904
906
|
return _nullishCoalesce(selectedWith(state, blockId), () => ( [blockId]));
|
|
@@ -908,12 +910,12 @@ function menuActions(core, extra = []) {
|
|
|
908
910
|
}
|
|
909
911
|
function markdownOf(editor, blockIds, resolveAssetUrl) {
|
|
910
912
|
const { doc } = editor.state;
|
|
911
|
-
const range =
|
|
913
|
+
const range = _chunkHOIDJEVIcjs.selectedBlockRange.call(void 0, doc, rangeOf(blockIds));
|
|
912
914
|
if (range === null) return "";
|
|
913
|
-
const blocks = editor.codec.blocksFromDoc(
|
|
914
|
-
return
|
|
915
|
+
const blocks = editor.codec.blocksFromDoc(_chunkBTBHHBVRcjs.createDoc.call(void 0, doc.blocks.slice(range.start, range.end)));
|
|
916
|
+
return _chunkHOIDJEVIcjs.toMarkdown.call(void 0, blocks, { schema: editor.schema, resolveAssetUrl, comments: false });
|
|
915
917
|
}
|
|
916
|
-
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) &&
|
|
918
|
+
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) && _chunkHOIDJEVIcjs.runCommands.call(void 0, state, [_chunkHOIDJEVIcjs.setSelection.call(void 0, rangeOf(blockIds)), command]).ok;
|
|
917
919
|
function coreBlockMenuActions(labels, options) {
|
|
918
920
|
const copy = (controller, blockIds, text2) => {
|
|
919
921
|
void copyText(text2).then((copied) => {
|
|
@@ -927,7 +929,7 @@ function coreBlockMenuActions(labels, options) {
|
|
|
927
929
|
label: labels.duplicate,
|
|
928
930
|
icon: _lucidereact.CopyPlus,
|
|
929
931
|
shortcut: "Mod-d",
|
|
930
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
932
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.duplicateBlocks.call(void 0, ))
|
|
931
933
|
},
|
|
932
934
|
{
|
|
933
935
|
id: "copy",
|
|
@@ -946,23 +948,23 @@ function coreBlockMenuActions(labels, options) {
|
|
|
946
948
|
label: labels.moveUp,
|
|
947
949
|
icon: _lucidereact.ArrowUp,
|
|
948
950
|
shortcut: "Mod-Shift-ArrowUp",
|
|
949
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
950
|
-
available: applies(
|
|
951
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.moveBlocksUp),
|
|
952
|
+
available: applies(_chunkHOIDJEVIcjs.moveBlocksUp)
|
|
951
953
|
},
|
|
952
954
|
{
|
|
953
955
|
id: "move-down",
|
|
954
956
|
label: labels.moveDown,
|
|
955
957
|
icon: _lucidereact.ArrowDown,
|
|
956
958
|
shortcut: "Mod-Shift-ArrowDown",
|
|
957
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
958
|
-
available: applies(
|
|
959
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.moveBlocksDown),
|
|
960
|
+
available: applies(_chunkHOIDJEVIcjs.moveBlocksDown)
|
|
959
961
|
},
|
|
960
962
|
{
|
|
961
963
|
id: "delete",
|
|
962
964
|
label: labels.delete,
|
|
963
965
|
icon: _lucidereact.Trash,
|
|
964
966
|
destructive: true,
|
|
965
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
967
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.deleteBlocks)
|
|
966
968
|
}
|
|
967
969
|
];
|
|
968
970
|
}
|
|
@@ -1020,7 +1022,7 @@ var sharedTone = (blocks) => {
|
|
|
1020
1022
|
function CalloutMenus({ kit, controller, blocks }) {
|
|
1021
1023
|
const labels = useLabels();
|
|
1022
1024
|
const blockIds = blocks.map((block) => block.id);
|
|
1023
|
-
const apply = (patch) => runOnBlocks(controller, blockIds,
|
|
1025
|
+
const apply = (patch) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.setAttrs.call(void 0, patch));
|
|
1024
1026
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1025
1027
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.Sub, { children: [
|
|
1026
1028
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.SubTrigger, { children: [
|
|
@@ -1045,7 +1047,7 @@ function CalloutMenus({ kit, controller, blocks }) {
|
|
|
1045
1047
|
|
|
1046
1048
|
function sharedColor(blocks, key) {
|
|
1047
1049
|
const coloured = blocks.filter((block) => block.type === "MARKDOWN");
|
|
1048
|
-
const colors = new Set(coloured.map((block) => _nullishCoalesce(
|
|
1050
|
+
const colors = new Set(coloured.map((block) => _nullishCoalesce(_chunkBTBHHBVRcjs.paletteOrUndefined.call(void 0, block.attrs[key]), () => ( "default"))));
|
|
1049
1051
|
return colors.size === 1 ? [...colors][0] : "";
|
|
1050
1052
|
}
|
|
1051
1053
|
var swatches = {
|
|
@@ -1058,7 +1060,7 @@ function ColorGroups({ kit, value, onPick }) {
|
|
|
1058
1060
|
const backgroundTitle = _react.useId.call(void 0, );
|
|
1059
1061
|
const group = (key, title, titleId) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1060
1062
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, kit.Label, { id: titleId, children: title }),
|
|
1061
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, kit.RadioGroup, { "aria-labelledby": titleId, value: value[key], onValueChange: (name) => onPick(key, name), children:
|
|
1063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, kit.RadioGroup, { "aria-labelledby": titleId, value: value[key], onValueChange: (name) => onPick(key, name), children: _chunkBTBHHBVRcjs.PALETTE.map((name) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.RadioItem, { value: name, indicator: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon, { className: "size-4" }), children: [
|
|
1062
1064
|
swatches[key](name),
|
|
1063
1065
|
labels.colors[name]
|
|
1064
1066
|
] }, name)) })
|
|
@@ -1073,7 +1075,7 @@ function ColorMenu({ kit, controller, blocks }) {
|
|
|
1073
1075
|
const labels = useLabels();
|
|
1074
1076
|
const blockIds = blocks.map((block) => block.id);
|
|
1075
1077
|
const value = { color: sharedColor(blocks, "color"), background: sharedColor(blocks, "background") };
|
|
1076
|
-
const pick = (key, name) => runOnBlocks(controller, blockIds,
|
|
1078
|
+
const pick = (key, name) => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.setBlockColor.call(void 0, { [key]: name === "default" ? null : name }));
|
|
1077
1079
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.Sub, { children: [
|
|
1078
1080
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.SubTrigger, { children: [
|
|
1079
1081
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuIcon, { icon: _lucidereact.Palette }),
|
|
@@ -1104,7 +1106,7 @@ function modifierText(modifier, isMac, { keyNames }) {
|
|
|
1104
1106
|
return Object.hasOwn(MODIFIERS, name) ? keyNames[MODIFIERS[name]] : capitalized(modifier);
|
|
1105
1107
|
}
|
|
1106
1108
|
function formatShortcut(shortcut, platform = {}) {
|
|
1107
|
-
const { isMac =
|
|
1109
|
+
const { isMac = _chunkHOIDJEVIcjs.detectMac.call(void 0, ), labels = englishLabels } = platform;
|
|
1108
1110
|
const parts = shortcut.split(shortcut.includes("+") ? "+" : "-");
|
|
1109
1111
|
const key = _nullishCoalesce(parts.pop(), () => ( shortcut));
|
|
1110
1112
|
const written = [...parts.map((modifier) => modifierText(modifier, isMac, labels)), keyText(key, labels)];
|
|
@@ -1193,21 +1195,21 @@ function languageOptions(query, plainText) {
|
|
|
1193
1195
|
|
|
1194
1196
|
|
|
1195
1197
|
// src/blocks/insert-blocks.ts
|
|
1196
|
-
var isEmptyParagraph = (schema, block) =>
|
|
1198
|
+
var isEmptyParagraph = (schema, block) => _chunkHOIDJEVIcjs.isParagraph.call(void 0, block) && _chunkHOIDJEVIcjs.regionLength.call(void 0, block, _nullishCoalesce(_chunkHOIDJEVIcjs.primaryRegion.call(void 0, schema, block), () => ( ""))) === 0;
|
|
1197
1199
|
function fresh(schema, { id, type, attrs, regions }, indent3) {
|
|
1198
|
-
const block =
|
|
1200
|
+
const block = _chunkHOIDJEVIcjs.createBlock.call(void 0, schema, type, attrs, indent3, id);
|
|
1199
1201
|
return regions === void 0 ? block : { ...block, regions };
|
|
1200
1202
|
}
|
|
1201
1203
|
function landOnLine(tr, schema, index, indent3) {
|
|
1202
1204
|
const next = tr.doc.blocks[index];
|
|
1203
1205
|
const reused = next !== void 0 && next.indent === indent3 && isEmptyParagraph(schema, next);
|
|
1204
|
-
const line = reused ? next :
|
|
1205
|
-
if (!reused) tr.step(
|
|
1206
|
-
tr.setSelection(
|
|
1206
|
+
const line = reused ? next : _chunkHOIDJEVIcjs.createBlock.call(void 0, schema, schema.defaultTextBlock, {}, indent3);
|
|
1207
|
+
if (!reused) tr.step(_chunkHOIDJEVIcjs.insertBlocksStep.call(void 0, index, [line]));
|
|
1208
|
+
tr.setSelection(_chunkHOIDJEVIcjs.startOf.call(void 0, tr.doc, schema, line.id));
|
|
1207
1209
|
}
|
|
1208
1210
|
function land(tr, schema, landing, first, after) {
|
|
1209
|
-
if (landing === "text") tr.setSelection(
|
|
1210
|
-
if (landing === "editor") tr.setSelection(
|
|
1211
|
+
if (landing === "text") tr.setSelection(_chunkHOIDJEVIcjs.startOf.call(void 0, tr.doc, schema, first.id));
|
|
1212
|
+
if (landing === "editor") tr.setSelection(_chunkHOIDJEVIcjs.nodeSelection.call(void 0, first.id)).setMeta(OPEN_EDITOR, first.id);
|
|
1211
1213
|
if (landing === "line") landOnLine(tr, schema, after, first.indent);
|
|
1212
1214
|
}
|
|
1213
1215
|
function anchorIndex(doc, id) {
|
|
@@ -1217,24 +1219,24 @@ function anchorIndex(doc, id) {
|
|
|
1217
1219
|
function insertBlocks(blocks, landing, anchorId) {
|
|
1218
1220
|
return (state, dispatch) => {
|
|
1219
1221
|
const { doc, schema } = state;
|
|
1220
|
-
const id = anchorId === void 0 ?
|
|
1222
|
+
const id = anchorId === void 0 ? _chunkHOIDJEVIcjs.headBlockId.call(void 0, state.selection) : anchorId;
|
|
1221
1223
|
const index = anchorIndex(doc, id);
|
|
1222
1224
|
if (index === void 0 || blocks.length === 0) return false;
|
|
1223
1225
|
const anchor = id === null ? void 0 : doc.blocks[index];
|
|
1224
1226
|
const created2 = blocks.map((block) => fresh(schema, block, _nullishCoalesce(_optionalChain([anchor, 'optionalAccess', _33 => _33.indent]), () => ( 0))));
|
|
1225
|
-
const tr = new (0,
|
|
1227
|
+
const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state);
|
|
1226
1228
|
const empty = anchor !== void 0 && landing !== "stay" && isEmptyParagraph(schema, anchor);
|
|
1227
1229
|
if (empty && landing === "line") {
|
|
1228
|
-
tr.step(
|
|
1230
|
+
tr.step(_chunkHOIDJEVIcjs.insertBlocksStep.call(void 0, index, created2)).setSelection(_chunkHOIDJEVIcjs.startOf.call(void 0, tr.doc, schema, anchor.id));
|
|
1229
1231
|
} else if (empty) {
|
|
1230
1232
|
const [first, ...rest] = created2;
|
|
1231
1233
|
const filled = { ...first, id: anchor.id };
|
|
1232
|
-
tr.step(
|
|
1233
|
-
if (rest.length > 0) tr.step(
|
|
1234
|
+
tr.step(_chunkHOIDJEVIcjs.replaceBlockStep.call(void 0, filled));
|
|
1235
|
+
if (rest.length > 0) tr.step(_chunkHOIDJEVIcjs.insertBlocksStep.call(void 0, index + 1, rest));
|
|
1234
1236
|
land(tr, schema, landing, filled, index + created2.length);
|
|
1235
1237
|
} else {
|
|
1236
|
-
const at = anchor === void 0 ? 0 :
|
|
1237
|
-
tr.step(
|
|
1238
|
+
const at = anchor === void 0 ? 0 : _chunkHOIDJEVIcjs.descendantsEnd.call(void 0, doc, index);
|
|
1239
|
+
tr.step(_chunkHOIDJEVIcjs.insertBlocksStep.call(void 0, at, created2));
|
|
1238
1240
|
land(tr, schema, landing, created2[0], at + created2.length);
|
|
1239
1241
|
}
|
|
1240
1242
|
_optionalChain([dispatch, 'optionalCall', _34 => _34(tr)]);
|
|
@@ -1247,7 +1249,7 @@ function landingFor(flow, hasEditor) {
|
|
|
1247
1249
|
}
|
|
1248
1250
|
function insertBlockToWrite(block, hasEditor, anchorId) {
|
|
1249
1251
|
return (state, dispatch) => {
|
|
1250
|
-
const landing = landingFor(
|
|
1252
|
+
const landing = landingFor(_chunkBTBHHBVRcjs.specFor.call(void 0, state.schema, block.type).flow, hasEditor);
|
|
1251
1253
|
return insertBlocks([block], landing, anchorId)(state, dispatch);
|
|
1252
1254
|
};
|
|
1253
1255
|
}
|
|
@@ -1255,20 +1257,20 @@ function insertBlockToWrite(block, hasEditor, anchorId) {
|
|
|
1255
1257
|
// src/blocks/code/code-actions.ts
|
|
1256
1258
|
function writeCode(controller, blockId, code, group) {
|
|
1257
1259
|
const { editor } = controller;
|
|
1258
|
-
const block =
|
|
1260
|
+
const block = _chunkBTBHHBVRcjs.blockById.call(void 0, editor.state.doc, blockId);
|
|
1259
1261
|
if (block === void 0 || block.attrs.code === code) return;
|
|
1260
|
-
controller.dispatch(editor.createTransaction().step(
|
|
1262
|
+
controller.dispatch(editor.createTransaction().step(_chunkHOIDJEVIcjs.setAttrsStep.call(void 0, blockId, { code })).setMeta(_chunkHOIDJEVIcjs.HISTORY_GROUP, group));
|
|
1261
1263
|
}
|
|
1262
1264
|
function codeToParagraph(blockId) {
|
|
1263
1265
|
return (state, dispatch) => {
|
|
1264
|
-
const turn =
|
|
1265
|
-
const { ok, tr } =
|
|
1266
|
+
const turn = _chunkHOIDJEVIcjs.setBlockType.call(void 0, "MARKDOWN", { kind: "paragraph" });
|
|
1267
|
+
const { ok, tr } = _chunkHOIDJEVIcjs.runCommands.call(void 0, state, [_chunkHOIDJEVIcjs.setSelection.call(void 0, _chunkHOIDJEVIcjs.nodeSelection.call(void 0, blockId)), turn]);
|
|
1266
1268
|
if (ok && tr !== null) _optionalChain([dispatch, 'optionalCall', _35 => _35(tr)]);
|
|
1267
1269
|
return ok;
|
|
1268
1270
|
};
|
|
1269
1271
|
}
|
|
1270
1272
|
function leaveCode(controller, blockId, direction, addsLine = false) {
|
|
1271
|
-
const moved =
|
|
1273
|
+
const moved = _chunk5M4QG3ZCcjs.moveToNeighbour.call(void 0, controller, blockId, direction);
|
|
1272
1274
|
if (!moved && !(addsLine && controller.run(insertBlocks([{ type: "MARKDOWN" }], "text", blockId)))) return false;
|
|
1273
1275
|
controller.focus();
|
|
1274
1276
|
return true;
|
|
@@ -1346,8 +1348,8 @@ var MOD_KEYS = [
|
|
|
1346
1348
|
["Mod-a", ({ value, start, end }) => start === 0 && end === value.length ? { kind: "selectAll" } : null]
|
|
1347
1349
|
];
|
|
1348
1350
|
function codeKeyAction(event, field, isMac) {
|
|
1349
|
-
const name =
|
|
1350
|
-
const modKey = MOD_KEYS.find(([key]) =>
|
|
1351
|
+
const name = _chunkHOIDJEVIcjs.keyName.call(void 0, event, isMac);
|
|
1352
|
+
const modKey = MOD_KEYS.find(([key]) => _chunkHOIDJEVIcjs.normalizeKey.call(void 0, key, isMac) === name);
|
|
1351
1353
|
const handler = _nullishCoalesce(_optionalChain([modKey, 'optionalAccess', _39 => _39[1]]), () => ( (Object.hasOwn(KEYS, name) ? KEYS[name] : void 0)));
|
|
1352
1354
|
return _nullishCoalesce(_optionalChain([handler, 'optionalCall', _40 => _40(field)]), () => ( null));
|
|
1353
1355
|
}
|
|
@@ -1393,7 +1395,7 @@ function travel({ controller, blockId, area }, command) {
|
|
|
1393
1395
|
const before = area.value;
|
|
1394
1396
|
controller.run(command);
|
|
1395
1397
|
const { selection } = controller.editor.state;
|
|
1396
|
-
const edit2 =
|
|
1398
|
+
const edit2 = _chunk5M4QG3ZCcjs.textDiff.call(void 0, before, area.value);
|
|
1397
1399
|
if (_optionalChain([selection, 'optionalAccess', _44 => _44.kind]) !== "node" || selection.block !== blockId) controller.focus();
|
|
1398
1400
|
else if (edit2 !== null) area.setSelectionRange(edit2.from + edit2.insert.length, edit2.from + edit2.insert.length);
|
|
1399
1401
|
return true;
|
|
@@ -1409,13 +1411,13 @@ function runCodeAction(action, context) {
|
|
|
1409
1411
|
case "paragraph":
|
|
1410
1412
|
return selectAndFocus(context, codeToParagraph(blockId));
|
|
1411
1413
|
case "undo":
|
|
1412
|
-
return travel(context,
|
|
1414
|
+
return travel(context, _chunkHOIDJEVIcjs.undo);
|
|
1413
1415
|
case "redo":
|
|
1414
|
-
return travel(context,
|
|
1416
|
+
return travel(context, _chunkHOIDJEVIcjs.redo);
|
|
1415
1417
|
case "selectAll":
|
|
1416
|
-
return selectAndFocus(context,
|
|
1418
|
+
return selectAndFocus(context, _chunkHOIDJEVIcjs.selectAll);
|
|
1417
1419
|
case "escape":
|
|
1418
|
-
return selectAndFocus(context,
|
|
1420
|
+
return selectAndFocus(context, _chunkHOIDJEVIcjs.setSelection.call(void 0, _chunkHOIDJEVIcjs.blockRangeSelection.call(void 0, blockId)));
|
|
1419
1421
|
case "controls":
|
|
1420
1422
|
context.focusControls();
|
|
1421
1423
|
return true;
|
|
@@ -1484,18 +1486,18 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1484
1486
|
useTypeIntoCode(controller, blockId, field, edit2);
|
|
1485
1487
|
const onKeyDown = (event) => {
|
|
1486
1488
|
const area = event.currentTarget;
|
|
1487
|
-
if (
|
|
1489
|
+
if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
|
|
1488
1490
|
const action = codeKeyAction(event, fieldOf(area), controller.isMac);
|
|
1489
1491
|
if (action !== null && runCodeAction(action, { controller, blockId, area, edit: edit2, focusControls })) event.preventDefault();
|
|
1490
1492
|
};
|
|
1491
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...{ [
|
|
1493
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...{ [_chunk5M4QG3ZCcjs.NATIVE_INTERACTION]: "" }, dir: "ltr", className: "quoin-code-scroll", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-code-lines", children: [
|
|
1492
1494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1493
1495
|
HighlightOverlay,
|
|
1494
1496
|
{
|
|
1495
1497
|
"aria-hidden": "true",
|
|
1496
1498
|
drawnRef: drawn,
|
|
1497
|
-
code:
|
|
1498
|
-
language:
|
|
1499
|
+
code: _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.code),
|
|
1500
|
+
language: _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.language)
|
|
1499
1501
|
}
|
|
1500
1502
|
),
|
|
1501
1503
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: mark, "aria-hidden": "true", className: "quoin-code-caret" }),
|
|
@@ -1505,7 +1507,7 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1505
1507
|
ref: field,
|
|
1506
1508
|
"aria-label": labels.codeText,
|
|
1507
1509
|
"aria-keyshortcuts": "Alt+F10",
|
|
1508
|
-
value:
|
|
1510
|
+
value: _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.code),
|
|
1509
1511
|
wrap: "off",
|
|
1510
1512
|
tabIndex: -1,
|
|
1511
1513
|
spellCheck: false,
|
|
@@ -1570,7 +1572,7 @@ var Button = React3.forwardRef(function Button2({ className, variant = "default"
|
|
|
1570
1572
|
var COPIED_FOR_MS = 1500;
|
|
1571
1573
|
function CopyCodeButton({ code, controller }) {
|
|
1572
1574
|
const labels = useLabels();
|
|
1573
|
-
const readOnly =
|
|
1575
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
1574
1576
|
const [copied, setCopied] = _react.useState.call(void 0, false);
|
|
1575
1577
|
_react.useEffect.call(void 0, () => {
|
|
1576
1578
|
if (!copied) return;
|
|
@@ -1664,7 +1666,7 @@ var preventDefault = (event) => event.preventDefault();
|
|
|
1664
1666
|
|
|
1665
1667
|
// src/blocks/text/set-block-attrs.ts
|
|
1666
1668
|
function setBlockAttrs(controller, blockId, patch) {
|
|
1667
|
-
if (!controller.readOnly) controller.run(
|
|
1669
|
+
if (!controller.readOnly) controller.run(_chunk5M4QG3ZCcjs.onBlock.call(void 0, blockId, _chunkHOIDJEVIcjs.setAttrs.call(void 0, patch)));
|
|
1668
1670
|
}
|
|
1669
1671
|
|
|
1670
1672
|
// src/blocks/code/LanguageCombobox.tsx
|
|
@@ -1683,7 +1685,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1683
1685
|
const options = draft === null ? [] : languageOptions(draft === shown ? "" : draft, labels.plainText);
|
|
1684
1686
|
const open = options.length > 0;
|
|
1685
1687
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1686
|
-
|
|
1688
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
1687
1689
|
_optionalChain([list, 'access', _48 => _48.current, 'optionalAccess', _49 => _49.querySelector, 'call', _50 => _50('[aria-selected="true"]'), 'optionalAccess', _51 => _51.scrollIntoView, 'call', _52 => _52({ block: "nearest" })]);
|
|
1688
1690
|
}, [active]);
|
|
1689
1691
|
const close = () => {
|
|
@@ -1709,7 +1711,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1709
1711
|
onDone();
|
|
1710
1712
|
};
|
|
1711
1713
|
const onKeyDown = (event) => {
|
|
1712
|
-
if (
|
|
1714
|
+
if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
|
|
1713
1715
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1714
1716
|
event.preventDefault();
|
|
1715
1717
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
@@ -1786,11 +1788,11 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1786
1788
|
|
|
1787
1789
|
var CodeBlock = ({ block, controller }) => {
|
|
1788
1790
|
const labels = useLabels();
|
|
1789
|
-
const readOnly =
|
|
1791
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
1790
1792
|
const languageField = _react.useRef.call(void 0, null);
|
|
1791
1793
|
const codeField = _react.useRef.call(void 0, null);
|
|
1792
|
-
const code =
|
|
1793
|
-
const language2 =
|
|
1794
|
+
const code = _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.code);
|
|
1795
|
+
const language2 = _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.language);
|
|
1794
1796
|
const name = _nullishCoalesce(languageName(language2), () => ( language2));
|
|
1795
1797
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { role: "group", "aria-label": labels.blockNames.code, contentEditable: false, className: "quoin-code", children: [
|
|
1796
1798
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-code-header", children: [
|
|
@@ -1899,7 +1901,7 @@ function selectHandlers(controller, blockId, root, onSelect) {
|
|
|
1899
1901
|
return {
|
|
1900
1902
|
onKeyDown(event) {
|
|
1901
1903
|
const key = event.nativeEvent;
|
|
1902
|
-
if (
|
|
1904
|
+
if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, key)) return;
|
|
1903
1905
|
if (event.key === "Escape") select();
|
|
1904
1906
|
else if (!(event.metaKey || event.ctrlKey) || event.target.matches("input:not([type=file])") || !controller.edit(() => controller.editor.handleKey(key)))
|
|
1905
1907
|
return;
|
|
@@ -2053,7 +2055,7 @@ var kindOf = (value) => _optionalChain([KINDS, 'access', _87 => _87.find, 'call'
|
|
|
2053
2055
|
var fileIcon = (mime, filename) => _nullishCoalesce(_nullishCoalesce(kindOf(mime), () => ( kindOf(_nullishCoalesce(_optionalChain([/\.([^.]+)$/, 'access', _90 => _90.exec, 'call', _91 => _91(filename), 'optionalAccess', _92 => _92[1], 'access', _93 => _93.toLowerCase, 'call', _94 => _94()]), () => ( ""))))), () => ( _lucidereact.FileIcon));
|
|
2054
2056
|
|
|
2055
2057
|
// src/blocks/file/file-source.ts
|
|
2056
|
-
var fileName = (attrs) =>
|
|
2058
|
+
var fileName = (attrs) => _chunkBTBHHBVRcjs.str.call(void 0, attrs.filename) || _chunkBTBHHBVRcjs.str.call(void 0, attrs.storageKey);
|
|
2057
2059
|
var hasFile = (attrs) => fileName(attrs) !== "";
|
|
2058
2060
|
|
|
2059
2061
|
// src/blocks/file/FileCard.tsx
|
|
@@ -2063,9 +2065,9 @@ function FileCard({ block, controller, readOnly }) {
|
|
|
2063
2065
|
const card = _react.useRef.call(void 0, null);
|
|
2064
2066
|
const { id, attrs } = block;
|
|
2065
2067
|
const name = fileName(attrs);
|
|
2066
|
-
const size =
|
|
2067
|
-
const href = assetHref(resolveAssetUrl,
|
|
2068
|
-
const Icon = fileIcon(
|
|
2068
|
+
const size = _chunkBTBHHBVRcjs.optionalNumber.call(void 0, attrs.size);
|
|
2069
|
+
const href = assetHref(resolveAssetUrl, _chunkBTBHHBVRcjs.str.call(void 0, attrs.storageKey));
|
|
2070
|
+
const Icon = fileIcon(_chunkBTBHHBVRcjs.str.call(void 0, attrs.mime), name);
|
|
2069
2071
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: card, className: "quoin-file-card", ...selectHandlers(controller, id, card), children: [
|
|
2070
2072
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { "aria-hidden": "true", className: "quoin-file-icon" }),
|
|
2071
2073
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "quoin-file-name", children: name }),
|
|
@@ -2074,7 +2076,7 @@ function FileCard({ block, controller, readOnly }) {
|
|
|
2074
2076
|
"a",
|
|
2075
2077
|
{
|
|
2076
2078
|
href,
|
|
2077
|
-
download:
|
|
2079
|
+
download: _chunkBTBHHBVRcjs.str.call(void 0, attrs.filename),
|
|
2078
2080
|
target: "_blank",
|
|
2079
2081
|
rel: "noopener",
|
|
2080
2082
|
"aria-label": labels.downloadFile(name),
|
|
@@ -2100,14 +2102,14 @@ function claimUpload(controller, blockId) {
|
|
|
2100
2102
|
}
|
|
2101
2103
|
var isNewestUpload = (controller, blockId, token) => _optionalChain([newestUploads, 'access', _95 => _95.get, 'call', _96 => _96(controller), 'optionalAccess', _97 => _97.get, 'call', _98 => _98(blockId)]) === token;
|
|
2102
2104
|
function assetOf(controller, blockId, type) {
|
|
2103
|
-
const block =
|
|
2105
|
+
const block = _chunkBTBHHBVRcjs.blockById.call(void 0, controller.editor.state.doc, blockId);
|
|
2104
2106
|
if (_optionalChain([block, 'optionalAccess', _99 => _99.type]) !== type || controller.readOnly) return null;
|
|
2105
|
-
return { url:
|
|
2107
|
+
return { url: _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.url), storageKey: _chunkBTBHHBVRcjs.str.call(void 0, block.attrs.storageKey) };
|
|
2106
2108
|
}
|
|
2107
2109
|
var sameAsset = (a, b) => a !== null && b !== null && a.url === b.url && a.storageKey === b.storageKey;
|
|
2108
2110
|
function writeAttrs(controller, blockId, patch, recorded) {
|
|
2109
2111
|
const { editor } = controller;
|
|
2110
|
-
const tr = editor.createTransaction().step(
|
|
2112
|
+
const tr = editor.createTransaction().step(_chunkHOIDJEVIcjs.setAttrsStep.call(void 0, blockId, patch));
|
|
2111
2113
|
editor.dispatch(recorded ? tr : tr.setMeta("addToHistory", false));
|
|
2112
2114
|
}
|
|
2113
2115
|
async function uploadInto(controller, blockId, file, { type, category }, { upload, onLand }, land2) {
|
|
@@ -2141,7 +2143,7 @@ var uploadFile = (controller, blockId, file, host) => uploadInto(
|
|
|
2141
2143
|
var anyFile = () => true;
|
|
2142
2144
|
var FileBlock = ({ block, controller }) => {
|
|
2143
2145
|
const labels = useLabels();
|
|
2144
|
-
const readOnly =
|
|
2146
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
2145
2147
|
const root = _react.useRef.call(void 0, null);
|
|
2146
2148
|
const filled = hasFile(block.attrs);
|
|
2147
2149
|
useNodeKeys(controller, block.id, !readOnly, !filled, root);
|
|
@@ -2219,7 +2221,7 @@ var deleteItem = (blockId, title) => ({
|
|
|
2219
2221
|
title,
|
|
2220
2222
|
icon: _lucidereact.Trash,
|
|
2221
2223
|
run: (controller) => {
|
|
2222
|
-
runOnBlocks(controller, [blockId],
|
|
2224
|
+
runOnBlocks(controller, [blockId], _chunkHOIDJEVIcjs.deleteBlocks);
|
|
2223
2225
|
controller.focus();
|
|
2224
2226
|
}
|
|
2225
2227
|
});
|
|
@@ -2233,8 +2235,8 @@ function markItem(mark, title, icon) {
|
|
|
2233
2235
|
id: mark,
|
|
2234
2236
|
title,
|
|
2235
2237
|
icon,
|
|
2236
|
-
isActive: (state) =>
|
|
2237
|
-
run: (controller) => void controller.run(
|
|
2238
|
+
isActive: (state) => _chunkHOIDJEVIcjs.isActive.call(void 0, state, mark),
|
|
2239
|
+
run: (controller) => void controller.run(_chunkHOIDJEVIcjs.toggleMark.call(void 0, mark))
|
|
2238
2240
|
};
|
|
2239
2241
|
}
|
|
2240
2242
|
var linkItem = (labels, openLink) => ({
|
|
@@ -2307,7 +2309,7 @@ function useRovingFocus() {
|
|
|
2307
2309
|
},
|
|
2308
2310
|
[syncTabStop]
|
|
2309
2311
|
);
|
|
2310
|
-
|
|
2312
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, syncTabStop);
|
|
2311
2313
|
const onFocus = (event) => {
|
|
2312
2314
|
if (!owns(event.target)) return;
|
|
2313
2315
|
current.current = event.target;
|
|
@@ -2326,7 +2328,7 @@ function useRovingFocus() {
|
|
|
2326
2328
|
// src/menus/floating/use-focus-key.ts
|
|
2327
2329
|
var isFocusKey = (event) => event.key === "F10" && event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
2328
2330
|
function useFocusKey(controller, focus) {
|
|
2329
|
-
|
|
2331
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
2330
2332
|
const intercept = (event) => {
|
|
2331
2333
|
if (!isFocusKey(event)) return false;
|
|
2332
2334
|
event.preventDefault();
|
|
@@ -2341,11 +2343,11 @@ function useFocusKey(controller, focus) {
|
|
|
2341
2343
|
|
|
2342
2344
|
function NodeToolbar(props) {
|
|
2343
2345
|
const { blockId, controller, label, anchor, items, next, buttonRefs, children, popover } = props;
|
|
2344
|
-
const state =
|
|
2346
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
2345
2347
|
const roving = useRovingFocus();
|
|
2346
2348
|
useFocusKey(controller, roving.focusCurrent);
|
|
2347
2349
|
const onKeyDown = (event) => {
|
|
2348
|
-
if (!roving.owns(event.target) ||
|
|
2350
|
+
if (!roving.owns(event.target) || _chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
|
|
2349
2351
|
const tab = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2350
2352
|
const ahead = tab && !event.shiftKey && next !== void 0 ? blockPart(controller, blockId, next) : void 0;
|
|
2351
2353
|
if (ahead !== void 0) ahead.focus();
|
|
@@ -2425,12 +2427,12 @@ function useSelectionSettled(controller) {
|
|
|
2425
2427
|
|
|
2426
2428
|
// src/blocks/void/use-toolbar-block.ts
|
|
2427
2429
|
var selectedBlock = (type, filled) => ({ doc, selection }) => {
|
|
2428
|
-
const block = _optionalChain([selection, 'optionalAccess', _129 => _129.kind]) === "node" ?
|
|
2430
|
+
const block = _optionalChain([selection, 'optionalAccess', _129 => _129.kind]) === "node" ? _chunkBTBHHBVRcjs.blockById.call(void 0, doc, selection.block) : void 0;
|
|
2429
2431
|
return _optionalChain([block, 'optionalAccess', _130 => _130.type]) === type && filled(block.attrs) ? block.id : null;
|
|
2430
2432
|
};
|
|
2431
2433
|
function useToolbarBlock(controller, selected, keptFor = null) {
|
|
2432
|
-
const blockId =
|
|
2433
|
-
const readOnly =
|
|
2434
|
+
const blockId = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, selected);
|
|
2435
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
2434
2436
|
const settled = useSelectionSettled(controller);
|
|
2435
2437
|
return blockId !== null && !readOnly && (settled || keptFor === blockId) ? blockId : null;
|
|
2436
2438
|
}
|
|
@@ -2516,7 +2518,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2516
2518
|
const value = _nullishCoalesce(percent, () => ( drawn));
|
|
2517
2519
|
const write = (widthPercent) => setBlockAttrs(controller, blockId, { widthPercent });
|
|
2518
2520
|
const onKeyDown = (event) => {
|
|
2519
|
-
if (
|
|
2521
|
+
if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
|
|
2520
2522
|
const next = keyedWidth(event.key, value);
|
|
2521
2523
|
if (event.key === "Escape") controller.focus();
|
|
2522
2524
|
else if (next === null) return;
|
|
@@ -2558,7 +2560,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2558
2560
|
"aria-valuetext": labels.widthValue(value),
|
|
2559
2561
|
"data-side": side,
|
|
2560
2562
|
className: "quoin-image-handle",
|
|
2561
|
-
...{ [
|
|
2563
|
+
...{ [_chunk5M4QG3ZCcjs.NATIVE_INTERACTION]: "" },
|
|
2562
2564
|
...bubblePart(controller),
|
|
2563
2565
|
onKeyDown,
|
|
2564
2566
|
onPointerDown: onPointerDown(side),
|
|
@@ -2582,9 +2584,9 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2582
2584
|
const [failed, setFailed] = _react.useState.call(void 0, null);
|
|
2583
2585
|
const { id, attrs, regions } = block;
|
|
2584
2586
|
const src = imageSource(attrs, resolveAssetUrl);
|
|
2585
|
-
const alt =
|
|
2587
|
+
const alt = _chunkBTBHHBVRcjs.str.call(void 0, attrs.alt);
|
|
2586
2588
|
const name = alt || labels.imageNoAlt;
|
|
2587
|
-
const percent =
|
|
2589
|
+
const percent = _chunkBTBHHBVRcjs.optionalNumber.call(void 0, attrs.widthPercent);
|
|
2588
2590
|
const width = _nullishCoalesce(preview, () => ( percent));
|
|
2589
2591
|
const select = () => focusNode(controller, id);
|
|
2590
2592
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -2594,8 +2596,8 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2594
2596
|
{
|
|
2595
2597
|
src,
|
|
2596
2598
|
alt: name,
|
|
2597
|
-
width:
|
|
2598
|
-
height:
|
|
2599
|
+
width: _chunkBTBHHBVRcjs.optionalNumber.call(void 0, attrs.width),
|
|
2600
|
+
height: _chunkBTBHHBVRcjs.optionalNumber.call(void 0, attrs.height),
|
|
2599
2601
|
draggable: false,
|
|
2600
2602
|
onError: () => setFailed(src),
|
|
2601
2603
|
onClick: select
|
|
@@ -2617,7 +2619,7 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2617
2619
|
)
|
|
2618
2620
|
] }),
|
|
2619
2621
|
(!readOnly || (_nullishCoalesce(_optionalChain([regions, 'access', _140 => _140.caption, 'optionalAccess', _141 => _141.length]), () => ( 0))) > 0) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2620
|
-
|
|
2622
|
+
_chunk5M4QG3ZCcjs.EditableRegion,
|
|
2621
2623
|
{
|
|
2622
2624
|
block: id,
|
|
2623
2625
|
region: "caption",
|
|
@@ -2643,8 +2645,8 @@ var WHITESPACE = /\s/;
|
|
|
2643
2645
|
function linkAddress(typed2) {
|
|
2644
2646
|
const address = typed2.trim();
|
|
2645
2647
|
if (WHITESPACE.test(address)) return null;
|
|
2646
|
-
const completed = !
|
|
2647
|
-
const href =
|
|
2648
|
+
const completed = !_chunkBTBHHBVRcjs.SCHEME.test(address) && BARE_DOMAIN.test(address) ? `https://${address}` : address;
|
|
2649
|
+
const href = _chunkBTBHHBVRcjs.sanitizeHref.call(void 0, completed);
|
|
2648
2650
|
return href || null;
|
|
2649
2651
|
}
|
|
2650
2652
|
|
|
@@ -2764,8 +2766,8 @@ function ImageUploadArea({ blockId, controller }) {
|
|
|
2764
2766
|
// src/blocks/image/use-image-keys.ts
|
|
2765
2767
|
|
|
2766
2768
|
function captionEnd(controller, blockId) {
|
|
2767
|
-
const caption = _nullishCoalesce(_optionalChain([
|
|
2768
|
-
return { block: blockId, region: "caption", offset:
|
|
2769
|
+
const caption = _nullishCoalesce(_optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, controller.editor.state.doc, blockId), 'optionalAccess', _142 => _142.regions, 'access', _143 => _143.caption]), () => ( []));
|
|
2770
|
+
return { block: blockId, region: "caption", offset: _chunkBTBHHBVRcjs.inlineLength.call(void 0, caption) };
|
|
2769
2771
|
}
|
|
2770
2772
|
var plainEnter = (event) => event.key === "Enter" && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2771
2773
|
var menuOpenOn = (host) => _optionalChain([host, 'optionalAccess', _144 => _144.getAttribute, 'call', _145 => _145("aria-expanded")]) === "true";
|
|
@@ -2777,7 +2779,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2777
2779
|
// then follows.
|
|
2778
2780
|
enter() {
|
|
2779
2781
|
const { editor } = controller;
|
|
2780
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
2782
|
+
editor.dispatch(editor.createTransaction().setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, captionEnd(controller, blockId))));
|
|
2781
2783
|
controller.focus();
|
|
2782
2784
|
},
|
|
2783
2785
|
type(key) {
|
|
@@ -2805,7 +2807,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2805
2807
|
|
|
2806
2808
|
var ImageBlock = ({ block, controller }) => {
|
|
2807
2809
|
const labels = useLabels();
|
|
2808
|
-
const readOnly =
|
|
2810
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
2809
2811
|
const root = _react.useRef.call(void 0, null);
|
|
2810
2812
|
const picture = hasPicture(block.attrs);
|
|
2811
2813
|
useImageKeys(controller, block.id, picture, !readOnly, root);
|
|
@@ -2818,7 +2820,7 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2818
2820
|
"aria-label": labels.blockNames.image,
|
|
2819
2821
|
contentEditable: false,
|
|
2820
2822
|
className: "quoin-image",
|
|
2821
|
-
...picture ? { [
|
|
2823
|
+
...picture ? { [_chunk5M4QG3ZCcjs.NODE_ENTRY]: "" } : void 0,
|
|
2822
2824
|
children: picture ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ImageFigure, { block, controller, readOnly }) : empty
|
|
2823
2825
|
}
|
|
2824
2826
|
);
|
|
@@ -2834,10 +2836,10 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2834
2836
|
|
|
2835
2837
|
function useOutsidePress(element, ownerDocument, onPress) {
|
|
2836
2838
|
const latest = _react.useRef.call(void 0, onPress);
|
|
2837
|
-
|
|
2839
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
2838
2840
|
latest.current = onPress;
|
|
2839
2841
|
});
|
|
2840
|
-
|
|
2842
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
2841
2843
|
const doc = ownerDocument();
|
|
2842
2844
|
const inside = (target) => _optionalChain([element, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.contains, 'call', _149 => _149(target)]) === true;
|
|
2843
2845
|
let touched = null;
|
|
@@ -2852,12 +2854,7 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
2852
2854
|
if (touched !== null && !inside(event.target)) latest.current(touched);
|
|
2853
2855
|
touched = null;
|
|
2854
2856
|
};
|
|
2855
|
-
|
|
2856
|
-
doc.addEventListener("click", click, true);
|
|
2857
|
-
return () => {
|
|
2858
|
-
doc.removeEventListener("pointerdown", down, true);
|
|
2859
|
-
doc.removeEventListener("click", click, true);
|
|
2860
|
-
};
|
|
2857
|
+
return _chunk5M4QG3ZCcjs.listen.call(void 0, doc, { pointerdown: down, click }, true);
|
|
2861
2858
|
}, [element, ownerDocument]);
|
|
2862
2859
|
}
|
|
2863
2860
|
|
|
@@ -2865,9 +2862,9 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
2865
2862
|
|
|
2866
2863
|
function storeAlt(controller, blockId, opened, alt) {
|
|
2867
2864
|
const { editor } = controller;
|
|
2868
|
-
const current = _optionalChain([
|
|
2869
|
-
if (controller.readOnly || controller.root === null ||
|
|
2870
|
-
|
|
2865
|
+
const current = _optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, editor.state.doc, blockId), 'optionalAccess', _150 => _150.attrs, 'access', _151 => _151.alt]);
|
|
2866
|
+
if (controller.readOnly || controller.root === null || _chunkBTBHHBVRcjs.str.call(void 0, current) !== opened) return;
|
|
2867
|
+
_chunk5M4QG3ZCcjs.onBlock.call(void 0, blockId, _chunkHOIDJEVIcjs.setAttrs.call(void 0, { alt }))(editor.state, (tr) => editor.dispatch(tr));
|
|
2871
2868
|
}
|
|
2872
2869
|
function AltTextPopover({ blockId, controller, anchor, opener, alt, onClose }) {
|
|
2873
2870
|
const labels = useLabels();
|
|
@@ -2907,7 +2904,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, onClose }) {
|
|
|
2907
2904
|
close(true);
|
|
2908
2905
|
};
|
|
2909
2906
|
const onKeyDown = (event) => {
|
|
2910
|
-
if (event.key !== "Tab" ||
|
|
2907
|
+
if (event.key !== "Tab" || _chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
|
|
2911
2908
|
const [field, save2] = event.currentTarget.elements;
|
|
2912
2909
|
const fromField = event.target === field;
|
|
2913
2910
|
event.preventDefault();
|
|
@@ -2935,7 +2932,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, onClose }) {
|
|
|
2935
2932
|
onCloseAutoFocus: preventDefault,
|
|
2936
2933
|
onEscapeKeyDown: (event) => {
|
|
2937
2934
|
event.preventDefault();
|
|
2938
|
-
if (!
|
|
2935
|
+
if (!_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event)) close(false);
|
|
2939
2936
|
},
|
|
2940
2937
|
...bubblePart(controller),
|
|
2941
2938
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { noValidate: true, className: "quoin-image-alt", onSubmit: save, onKeyDown, children: [
|
|
@@ -2973,7 +2970,7 @@ function imageToolbarItems(blockId, labels, actions) {
|
|
|
2973
2970
|
id: align,
|
|
2974
2971
|
title: labels[label],
|
|
2975
2972
|
icon,
|
|
2976
|
-
isActive: (state) => (_nullishCoalesce(
|
|
2973
|
+
isActive: (state) => (_nullishCoalesce(_chunkBTBHHBVRcjs.alignOrUndefined.call(void 0, _optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, blockId), 'optionalAccess', _157 => _157.attrs, 'access', _158 => _158.align])), () => ( "left"))) === align,
|
|
2977
2974
|
run: (controller) => setBlockAttrs(controller, blockId, { align })
|
|
2978
2975
|
})
|
|
2979
2976
|
);
|
|
@@ -3017,11 +3014,11 @@ function ImageToolbarOverlay({ controller }) {
|
|
|
3017
3014
|
}
|
|
3018
3015
|
function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
3019
3016
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
3020
|
-
const state =
|
|
3017
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
3021
3018
|
const picker = useReplacePicker(controller, blockId, uploadImage, "image/*");
|
|
3022
3019
|
const altButton = _react.useRef.call(void 0, null);
|
|
3023
3020
|
const anchor = usePartAnchor(controller, blockId, ".quoin-image-frame");
|
|
3024
|
-
const attrs = _nullishCoalesce(_optionalChain([
|
|
3021
|
+
const attrs = _nullishCoalesce(_optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, blockId), 'optionalAccess', _159 => _159.attrs]), () => ( {}));
|
|
3025
3022
|
const items = imageToolbarItems(blockId, labels, {
|
|
3026
3023
|
replace: picker.open,
|
|
3027
3024
|
editAlt: () => {
|
|
@@ -3047,7 +3044,7 @@ function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
|
3047
3044
|
controller,
|
|
3048
3045
|
anchor,
|
|
3049
3046
|
opener: altButton,
|
|
3050
|
-
alt:
|
|
3047
|
+
alt: _chunkBTBHHBVRcjs.str.call(void 0, attrs.alt),
|
|
3051
3048
|
onClose: () => onEditAlt(null)
|
|
3052
3049
|
}
|
|
3053
3050
|
),
|
|
@@ -3263,13 +3260,13 @@ function CalloutToneMenu({ blockId, controller, tone }) {
|
|
|
3263
3260
|
|
|
3264
3261
|
var CalloutBlock = ({ block, controller }) => {
|
|
3265
3262
|
const labels = useLabels();
|
|
3266
|
-
const readOnly =
|
|
3263
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
3267
3264
|
const tone = calloutTone(block.attrs.tone);
|
|
3268
3265
|
const icon = calloutIcon(block.attrs, tone);
|
|
3269
3266
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("quoin-callout group/callout flex items-start gap-2", TONE[tone]), "data-tone": tone, children: [
|
|
3270
3267
|
readOnly ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "aria-hidden": "true", className: "flex size-6 items-center justify-center text-base", children: icon }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CalloutIconMenu, { blockId: block.id, controller, icon }),
|
|
3271
3268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3272
|
-
|
|
3269
|
+
_chunk5M4QG3ZCcjs.EditableRegion,
|
|
3273
3270
|
{
|
|
3274
3271
|
block: block.id,
|
|
3275
3272
|
region: "body",
|
|
@@ -3343,7 +3340,7 @@ function ListMarker(props) {
|
|
|
3343
3340
|
|
|
3344
3341
|
function TaskCheckbox2({ block, controller, labelledBy }) {
|
|
3345
3342
|
const labels = useLabels();
|
|
3346
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3343
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.TaskCheckbox, { block, controller, label: labels.task, labelledBy });
|
|
3347
3344
|
}
|
|
3348
3345
|
|
|
3349
3346
|
// src/blocks/text/MarkdownBlock.tsx
|
|
@@ -3353,23 +3350,23 @@ var HEADING_LEVELS = ["mt-6 text-3xl", "mt-5 text-2xl", "mt-4 text-xl", "mt-3 te
|
|
|
3353
3350
|
var headingStyles = (level) => `quoin-heading mb-1 font-semibold leading-tight in-[[data-quoin-block]:first-child]:mt-0 ${HEADING_LEVELS[level - 1]}`;
|
|
3354
3351
|
function Heading({ block }) {
|
|
3355
3352
|
const labels = useLabels();
|
|
3356
|
-
const level =
|
|
3357
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3353
|
+
const level = _chunkBTBHHBVRcjs.headingLevel.call(void 0, block.attrs.level);
|
|
3354
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: REGION, label: labels.heading(level) }) });
|
|
3358
3355
|
}
|
|
3359
3356
|
function NumberedItem({ block, controller }) {
|
|
3360
3357
|
const labels = useLabels();
|
|
3361
|
-
const number =
|
|
3358
|
+
const number = _chunk5M4QG3ZCcjs.useOrderedNumber.call(void 0, controller, block.id);
|
|
3362
3359
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-list-item", "data-list": "ordered", children: [
|
|
3363
3360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListMarker, { list: "ordered", number, depth: block.indent }),
|
|
3364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: REGION, label: labels.numberedItem(number) })
|
|
3365
3362
|
] });
|
|
3366
3363
|
}
|
|
3367
3364
|
function TaskItem({ block, controller }) {
|
|
3368
3365
|
const labels = useLabels();
|
|
3369
|
-
const hostId =
|
|
3366
|
+
const hostId = _chunk5M4QG3ZCcjs.useRegionDomId.call(void 0, block.id, REGION);
|
|
3370
3367
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-task", "data-checked": block.attrs.checked === true, children: [
|
|
3371
3368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TaskCheckbox2, { block, controller, labelledBy: hostId }),
|
|
3372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { id: hostId, block: block.id, region: REGION, label: labels.task })
|
|
3373
3370
|
] });
|
|
3374
3371
|
}
|
|
3375
3372
|
var MarkdownBlock = (props) => {
|
|
@@ -3381,16 +3378,16 @@ var MarkdownBlock = (props) => {
|
|
|
3381
3378
|
case "bullet":
|
|
3382
3379
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-list-item", "data-list": "bullet", children: [
|
|
3383
3380
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListMarker, { list: "bullet", depth: block.indent }),
|
|
3384
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: REGION, label: labels.bulletItem })
|
|
3385
3382
|
] });
|
|
3386
3383
|
case "ordered":
|
|
3387
3384
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NumberedItem, { ...props });
|
|
3388
3385
|
case "task":
|
|
3389
3386
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TaskItem, { ...props });
|
|
3390
3387
|
case "quote":
|
|
3391
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "quoin-quote", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3388
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "quoin-quote", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: REGION, label: labels.quote }) });
|
|
3392
3389
|
default:
|
|
3393
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3390
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: REGION, label: labels.paragraph });
|
|
3394
3391
|
}
|
|
3395
3392
|
};
|
|
3396
3393
|
|
|
@@ -3398,22 +3395,22 @@ var MarkdownBlock = (props) => {
|
|
|
3398
3395
|
function nestedBlockIds({ doc }, blockId) {
|
|
3399
3396
|
const index = doc.index.get(blockId);
|
|
3400
3397
|
if (index === void 0) return [];
|
|
3401
|
-
return doc.blocks.slice(index + 1,
|
|
3398
|
+
return doc.blocks.slice(index + 1, _chunkHOIDJEVIcjs.descendantsEnd.call(void 0, doc, index)).map((block) => block.id);
|
|
3402
3399
|
}
|
|
3403
3400
|
function useNestedBlocks(controller, blockId) {
|
|
3404
|
-
return
|
|
3401
|
+
return _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, (state) => nestedBlockIds(state, blockId), _chunkBTBHHBVRcjs.sameItems);
|
|
3405
3402
|
}
|
|
3406
3403
|
|
|
3407
3404
|
// src/blocks/text/ToggleBlock.tsx
|
|
3408
3405
|
|
|
3409
3406
|
var ToggleBlock = ({ block, controller }) => {
|
|
3410
3407
|
const labels = useLabels();
|
|
3411
|
-
const domId =
|
|
3408
|
+
const domId = _chunk5M4QG3ZCcjs.useBlockDomId.call(void 0, );
|
|
3412
3409
|
const nested = useNestedBlocks(controller, block.id);
|
|
3413
|
-
const open =
|
|
3410
|
+
const open = _chunk5M4QG3ZCcjs.useToggleOpen.call(void 0, controller, block);
|
|
3414
3411
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-toggle", "data-open": open, children: [
|
|
3415
3412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3416
|
-
|
|
3413
|
+
_chunk5M4QG3ZCcjs.ToggleChevron,
|
|
3417
3414
|
{
|
|
3418
3415
|
block,
|
|
3419
3416
|
controller,
|
|
@@ -3421,7 +3418,7 @@ var ToggleBlock = ({ block, controller }) => {
|
|
|
3421
3418
|
controls: nested.length === 0 ? void 0 : nested.map(domId).join(" ")
|
|
3422
3419
|
}
|
|
3423
3420
|
),
|
|
3424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: block.id, region: "text", label: labels.toggle })
|
|
3425
3422
|
] });
|
|
3426
3423
|
};
|
|
3427
3424
|
|
|
@@ -3437,7 +3434,7 @@ var textRenderers = {
|
|
|
3437
3434
|
var QUOIN_DEFINITIONS = new Map(coreBlocks.map((core) => [core.type, core]));
|
|
3438
3435
|
var TYPED_IN_PLACE = ["MARKDOWN", "CALLOUT", "TOGGLE"];
|
|
3439
3436
|
function hostDefines(definitions, type) {
|
|
3440
|
-
const definition =
|
|
3437
|
+
const definition = _chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, type);
|
|
3441
3438
|
const core = QUOIN_DEFINITIONS.get(type);
|
|
3442
3439
|
if (definition === void 0) return false;
|
|
3443
3440
|
return core === void 0 || definition.preview !== core.preview || definition.editor !== core.editor;
|
|
@@ -3448,10 +3445,10 @@ function drawnAsText(definitions, type, readOnly) {
|
|
|
3448
3445
|
}
|
|
3449
3446
|
var definedTypedInPlace = (definitions) => TYPED_IN_PLACE.filter((type) => hostDefines(definitions, type));
|
|
3450
3447
|
function drawnInPlace(definitions, type) {
|
|
3451
|
-
return Object.hasOwn(inPlaceRenderers, type) &&
|
|
3448
|
+
return Object.hasOwn(inPlaceRenderers, type) && _chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, type) !== void 0 && !hostDefines(definitions, type);
|
|
3452
3449
|
}
|
|
3453
|
-
var drawsType = (definitions, type) => !Object.hasOwn(inPlaceRenderers, type) ||
|
|
3454
|
-
var opensEditor = (definitions, type) => drawnInPlace(definitions, type) || !drawnAsText(definitions, type, false) && _optionalChain([
|
|
3450
|
+
var drawsType = (definitions, type) => !Object.hasOwn(inPlaceRenderers, type) || _chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, type) !== void 0;
|
|
3451
|
+
var opensEditor = (definitions, type) => drawnInPlace(definitions, type) || !drawnAsText(definitions, type, false) && _optionalChain([_chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, type), 'optionalAccess', _162 => _162.editor]) !== void 0;
|
|
3455
3452
|
|
|
3456
3453
|
// src/gutter/turn-into-targets.ts
|
|
3457
3454
|
|
|
@@ -3498,7 +3495,7 @@ function turnIntoTargets(labels) {
|
|
|
3498
3495
|
function TurnIntoItems({ kit, controller, blockIds }) {
|
|
3499
3496
|
const { blockTypes, labels } = useQuoin();
|
|
3500
3497
|
const targets = turnIntoTargets(labels).filter((target) => drawsType(blockTypes, target.type));
|
|
3501
|
-
return targets.map((target) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.Item, { onSelect: () => runOnBlocks(controller, blockIds,
|
|
3498
|
+
return targets.map((target) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, kit.Item, { onSelect: () => runOnBlocks(controller, blockIds, _chunkHOIDJEVIcjs.setBlockType.call(void 0, target.type, target.attrs)), children: [
|
|
3502
3499
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuIcon, { icon: target.icon }),
|
|
3503
3500
|
target.label
|
|
3504
3501
|
] }, target.id));
|
|
@@ -3536,10 +3533,10 @@ function ActionItem({ kit, controller, action, blockIds }) {
|
|
|
3536
3533
|
);
|
|
3537
3534
|
}
|
|
3538
3535
|
function BlockMenuItems({ kit, controller, blocks, styled, title, actions }) {
|
|
3539
|
-
const state =
|
|
3536
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
3540
3537
|
const blockIds = blocks.map((block) => block.id);
|
|
3541
3538
|
const shown = actions.filter((action) => _nullishCoalesce(_optionalChain([action, 'access', _164 => _164.available, 'optionalCall', _165 => _165(state, blockIds)]), () => ( true)));
|
|
3542
|
-
const anyText = styled.some((block) =>
|
|
3539
|
+
const anyText = styled.some((block) => _chunkHOIDJEVIcjs.isTextFlow.call(void 0, state.schema, block));
|
|
3543
3540
|
const anyMarkdown = styled.some((block) => block.type === "MARKDOWN");
|
|
3544
3541
|
const allCallouts = styled.length > 0 && styled.every((block) => block.type === "CALLOUT");
|
|
3545
3542
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -3584,7 +3581,7 @@ var CONTEXT_KIT = {
|
|
|
3584
3581
|
// src/gutter/use-context-menu-opener.ts
|
|
3585
3582
|
|
|
3586
3583
|
var GUTTER_BLOCK = "data-quoin-gutter-block";
|
|
3587
|
-
var OWN_MENU = `[${
|
|
3584
|
+
var OWN_MENU = `[${_chunk5M4QG3ZCcjs.NATIVE_INTERACTION}], input, textarea, select`;
|
|
3588
3585
|
function contextBlock(controller, target) {
|
|
3589
3586
|
const { state } = controller.editor;
|
|
3590
3587
|
const gutter = _optionalChain([target, 'access', _166 => _166.closest, 'call', _167 => _167(`[${GUTTER_BLOCK}]`), 'optionalAccess', _168 => _168.getAttribute, 'call', _169 => _169(GUTTER_BLOCK)]);
|
|
@@ -3593,8 +3590,8 @@ function contextBlock(controller, target) {
|
|
|
3593
3590
|
if (_optionalChain([selection, 'optionalAccess', _170 => _170.kind]) === "blocks") return selection.head;
|
|
3594
3591
|
if (target.closest(OWN_MENU) || controller.registry.locate(target) !== null) return null;
|
|
3595
3592
|
const id = controller.blockAt(target);
|
|
3596
|
-
const block = id === void 0 ? void 0 :
|
|
3597
|
-
return block === void 0 ||
|
|
3593
|
+
const block = id === void 0 ? void 0 : _chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, id);
|
|
3594
|
+
return block === void 0 || _chunkHOIDJEVIcjs.isTextFlow.call(void 0, state.schema, block) ? null : block.id;
|
|
3598
3595
|
}
|
|
3599
3596
|
function useContextMenuOpener(controller, store, trigger) {
|
|
3600
3597
|
_react.useEffect.call(void 0, () => {
|
|
@@ -3613,12 +3610,7 @@ function useContextMenuOpener(controller, store, trigger) {
|
|
|
3613
3610
|
openBlockMenuAt(store, controller.editor.state, block, clientX, clientY);
|
|
3614
3611
|
hidden.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX, clientY }));
|
|
3615
3612
|
};
|
|
3616
|
-
|
|
3617
|
-
root.addEventListener("contextmenu", onContextMenu);
|
|
3618
|
-
return () => {
|
|
3619
|
-
root.removeEventListener("mousedown", onMouseDown);
|
|
3620
|
-
root.removeEventListener("contextmenu", onContextMenu);
|
|
3621
|
-
};
|
|
3613
|
+
return _chunk5M4QG3ZCcjs.listen.call(void 0, root, { mousedown: onMouseDown, contextmenu: onContextMenu });
|
|
3622
3614
|
}, [controller, store, trigger]);
|
|
3623
3615
|
}
|
|
3624
3616
|
|
|
@@ -3647,7 +3639,7 @@ function blockTypeLabel(labels, block, definitions, extensionNames = {}) {
|
|
|
3647
3639
|
if (block.type === "MARKDOWN" && kind === "heading") return labels.heading(typeof level === "number" ? level : 1);
|
|
3648
3640
|
const name = block.type === "MARKDOWN" ? nameIn(KIND_NAMES, kind) : nameIn(TYPE_NAMES, block.type);
|
|
3649
3641
|
if (name !== void 0) return labels.blockNames[name];
|
|
3650
|
-
return _nullishCoalesce(_nullishCoalesce(nameIn(extensionNames, block.type), () => ( _optionalChain([
|
|
3642
|
+
return _nullishCoalesce(_nullishCoalesce(nameIn(extensionNames, block.type), () => ( _optionalChain([_chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, block.type), 'optionalAccess', _171 => _171.label]))), () => ( labels.unsupportedBlock));
|
|
3651
3643
|
}
|
|
3652
3644
|
|
|
3653
3645
|
// src/gutter/extension-block-names.ts
|
|
@@ -3657,10 +3649,10 @@ var ExtensionBlockNames = _react.createContext.call(void 0, {});
|
|
|
3657
3649
|
// src/gutter/use-menu-blocks.ts
|
|
3658
3650
|
function useLiveBlocks(controller, blockIds) {
|
|
3659
3651
|
const select = _react.useCallback.call(void 0,
|
|
3660
|
-
(state) => blockIds.flatMap((id) => _nullishCoalesce(
|
|
3652
|
+
(state) => blockIds.flatMap((id) => _nullishCoalesce(_chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, id), () => ( []))),
|
|
3661
3653
|
[blockIds]
|
|
3662
3654
|
);
|
|
3663
|
-
return
|
|
3655
|
+
return _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, select, _chunkBTBHHBVRcjs.sameItems);
|
|
3664
3656
|
}
|
|
3665
3657
|
function useMenuBlocks(controller, store, menu) {
|
|
3666
3658
|
const labels = useLabels();
|
|
@@ -3716,12 +3708,12 @@ function BlockContextMenu({ controller, store, actions }) {
|
|
|
3716
3708
|
// src/gutter/block-menu-keymap.ts
|
|
3717
3709
|
function blockMenuKeymap(store) {
|
|
3718
3710
|
const openForHead = (state, dispatch) => {
|
|
3719
|
-
const head =
|
|
3711
|
+
const head = _chunkHOIDJEVIcjs.headBlockId.call(void 0, state.selection);
|
|
3720
3712
|
if (head === null || !state.doc.index.has(head)) return false;
|
|
3721
3713
|
if (dispatch) openBlockMenu(store, state, head);
|
|
3722
3714
|
return true;
|
|
3723
3715
|
};
|
|
3724
|
-
return
|
|
3716
|
+
return _chunkHOIDJEVIcjs.defineExtension.call(void 0, { name: "block-menu", keymap: { "Mod-/": openForHead } });
|
|
3725
3717
|
}
|
|
3726
3718
|
|
|
3727
3719
|
// src/gutter/Gutter.tsx
|
|
@@ -3801,7 +3793,7 @@ var DragOverlay = _react.forwardRef.call(void 0, function DragOverlay2(_props, r
|
|
|
3801
3793
|
var DELETION_STEPS = /* @__PURE__ */ new Set(["removeBlocks", "setIndent"]);
|
|
3802
3794
|
function drawnPosition(doc, blockId) {
|
|
3803
3795
|
const index = _nullishCoalesce(doc.index.get(blockId), () => ( 0));
|
|
3804
|
-
return [
|
|
3796
|
+
return [_chunk5M4QG3ZCcjs.drawnBlockCount.call(void 0, doc, 0, index) + 1, _chunk5M4QG3ZCcjs.drawnBlockCount.call(void 0, doc)];
|
|
3805
3797
|
}
|
|
3806
3798
|
function blockMovedMessage(doc, blockId, labels) {
|
|
3807
3799
|
return labels.blockMoved(...drawnPosition(doc, blockId));
|
|
@@ -3817,11 +3809,11 @@ function deletedCount(tr) {
|
|
|
3817
3809
|
return tr.steps.reduce((deleted, step, i) => {
|
|
3818
3810
|
const { index, count } = step.toJSON();
|
|
3819
3811
|
if (step.stepType !== "removeBlocks" || typeof index !== "number" || typeof count !== "number") return deleted;
|
|
3820
|
-
return deleted +
|
|
3812
|
+
return deleted + _chunk5M4QG3ZCcjs.drawnBlockCount.call(void 0, tr.docs[i], index, index + count);
|
|
3821
3813
|
}, 0);
|
|
3822
3814
|
}
|
|
3823
3815
|
function insertedBlock(tr) {
|
|
3824
|
-
if (tr.getMeta(
|
|
3816
|
+
if (tr.getMeta(_chunkHOIDJEVIcjs.LINE_SPLIT) === true || tr.steps.some((step) => step.stepType === "removeBlocks")) return null;
|
|
3825
3817
|
const inserted = tr.steps.flatMap((step) => {
|
|
3826
3818
|
const { blocks } = step.toJSON();
|
|
3827
3819
|
return step.stepType === "insertBlocks" && Array.isArray(blocks) ? blocks : [];
|
|
@@ -3829,7 +3821,7 @@ function insertedBlock(tr) {
|
|
|
3829
3821
|
return _nullishCoalesce(_optionalChain([inserted, 'access', _181 => _181.find, 'call', _182 => _182((block) => tr.doc.index.has(block.id)), 'optionalAccess', _183 => _183.id]), () => ( null));
|
|
3830
3822
|
}
|
|
3831
3823
|
function structureAnnouncement(tr, labels, undoKeys) {
|
|
3832
|
-
if (tr.origin !== "command" || tr.getMeta(
|
|
3824
|
+
if (tr.origin !== "command" || tr.getMeta(_chunkHOIDJEVIcjs.LINE_JOIN) === true) return null;
|
|
3833
3825
|
const moved = movedBlock(tr);
|
|
3834
3826
|
if (moved !== null) return blockMovedMessage(tr.doc, moved, labels);
|
|
3835
3827
|
const deleted = deletedCount(tr);
|
|
@@ -3859,7 +3851,7 @@ function inlineEdges(shell, box, rtl) {
|
|
|
3859
3851
|
function measure(controller, root, moved, rtl) {
|
|
3860
3852
|
const { doc } = controller.editor.state;
|
|
3861
3853
|
const origin = rootOrigin(root);
|
|
3862
|
-
return
|
|
3854
|
+
return _chunk5M4QG3ZCcjs.visibleBlockIndexes.call(void 0, doc).flatMap((index) => {
|
|
3863
3855
|
const { id, indent: indent3 } = doc.blocks[index];
|
|
3864
3856
|
const shell = controller.blockElement(id);
|
|
3865
3857
|
if (shell === void 0) return [];
|
|
@@ -3874,7 +3866,7 @@ function measureDrag(controller, root, ids) {
|
|
|
3874
3866
|
const { doc } = controller.editor.state;
|
|
3875
3867
|
const direction = inlineDirection(root);
|
|
3876
3868
|
const rtl = direction === "rtl";
|
|
3877
|
-
const moved = new Set(
|
|
3869
|
+
const moved = new Set(_chunkHOIDJEVIcjs.movedBlockIds.call(void 0, doc, ids));
|
|
3878
3870
|
const blocks = measure(controller, root, moved, rtl);
|
|
3879
3871
|
const dragged = blocks.filter((block) => block.dragged);
|
|
3880
3872
|
if (dragged.length === 0) return null;
|
|
@@ -3934,7 +3926,7 @@ function draggedBlocks(controller, blockId) {
|
|
|
3934
3926
|
function followPress(press, root, view) {
|
|
3935
3927
|
const { controller, store, overlay, handle: handle2, pointerId } = press;
|
|
3936
3928
|
const doc = view.document;
|
|
3937
|
-
const scroll =
|
|
3929
|
+
const scroll = _chunk5M4QG3ZCcjs.createAutoScroll.call(void 0, root, follow, SCROLL_EDGE);
|
|
3938
3930
|
let pointer = { x: press.x, y: press.y };
|
|
3939
3931
|
let active = null;
|
|
3940
3932
|
let unsubscribe = () => {
|
|
@@ -3971,11 +3963,9 @@ function followPress(press, root, view) {
|
|
|
3971
3963
|
function finish() {
|
|
3972
3964
|
if (done) return;
|
|
3973
3965
|
done = true;
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
view.removeEventListener("blur", finish);
|
|
3978
|
-
view.removeEventListener("keydown", onKeyDown, true);
|
|
3966
|
+
unlistenDocument();
|
|
3967
|
+
unlistenBlur();
|
|
3968
|
+
unlistenKeys();
|
|
3979
3969
|
scroll.stop();
|
|
3980
3970
|
unsubscribe();
|
|
3981
3971
|
if (active === null) return;
|
|
@@ -3989,7 +3979,7 @@ function followPress(press, root, view) {
|
|
|
3989
3979
|
finish();
|
|
3990
3980
|
if (dropped === null || dropped.target === null || controller.readOnly) return;
|
|
3991
3981
|
const { ids, layout, target } = dropped;
|
|
3992
|
-
if (!controller.run(
|
|
3982
|
+
if (!controller.run(_chunkHOIDJEVIcjs.moveBlocksTo.call(void 0, ids, layout.toIndex(target.index), target.indent))) return;
|
|
3993
3983
|
controller.focus();
|
|
3994
3984
|
press.onMoved(ids[0]);
|
|
3995
3985
|
}
|
|
@@ -4011,11 +4001,9 @@ function followPress(press, root, view) {
|
|
|
4011
4001
|
event.stopPropagation();
|
|
4012
4002
|
finish();
|
|
4013
4003
|
}
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
view.addEventListener("blur", finish);
|
|
4018
|
-
view.addEventListener("keydown", onKeyDown, true);
|
|
4004
|
+
const unlistenDocument = _chunk5M4QG3ZCcjs.listen.call(void 0, doc, { pointermove: onPointerMove, pointerup: onPointerUp, pointercancel: finish });
|
|
4005
|
+
const unlistenBlur = _chunk5M4QG3ZCcjs.listen.call(void 0, view, { blur: finish });
|
|
4006
|
+
const unlistenKeys = _chunk5M4QG3ZCcjs.listen.call(void 0, view, { keydown: onKeyDown }, true);
|
|
4019
4007
|
return finish;
|
|
4020
4008
|
}
|
|
4021
4009
|
function pressDragHandle(press) {
|
|
@@ -4067,12 +4055,12 @@ function useBlockDrag(controller, store, blockId, overlay) {
|
|
|
4067
4055
|
function addBlockBelow(controller, blockId) {
|
|
4068
4056
|
const { state } = controller.editor;
|
|
4069
4057
|
const { doc, schema } = state;
|
|
4070
|
-
const block =
|
|
4058
|
+
const block = _chunkBTBHHBVRcjs.blockById.call(void 0, doc, blockId);
|
|
4071
4059
|
if (block === void 0) return false;
|
|
4072
|
-
const empty =
|
|
4073
|
-
const fill = empty ?
|
|
4074
|
-
const slash =
|
|
4075
|
-
const { ok, tr } =
|
|
4060
|
+
const empty = _chunkHOIDJEVIcjs.isParagraph.call(void 0, block) && _chunkHOIDJEVIcjs.regionLength.call(void 0, block, _nullishCoalesce(_chunkHOIDJEVIcjs.primaryRegion.call(void 0, schema, block), () => ( ""))) === 0;
|
|
4061
|
+
const fill = empty ? _chunkHOIDJEVIcjs.setSelection.call(void 0, _chunkHOIDJEVIcjs.startOf.call(void 0, doc, schema, blockId)) : _chunkHOIDJEVIcjs.insertBlockAfter.call(void 0, "MARKDOWN", { kind: "paragraph" });
|
|
4062
|
+
const slash = _chunkHOIDJEVIcjs.insertText.call(void 0, "/", { origin: "command" });
|
|
4063
|
+
const { ok, tr } = _chunkHOIDJEVIcjs.runCommands.call(void 0, state, [_chunkHOIDJEVIcjs.setSelection.call(void 0, _chunkHOIDJEVIcjs.blockRangeSelection.call(void 0, blockId)), fill, slash]);
|
|
4076
4064
|
if (ok && tr !== null) controller.dispatch(tr);
|
|
4077
4065
|
controller.focus();
|
|
4078
4066
|
return ok;
|
|
@@ -4153,7 +4141,7 @@ function place2(controller, root, gutter, block) {
|
|
|
4153
4141
|
gutter.style.visibility = "";
|
|
4154
4142
|
}
|
|
4155
4143
|
function useGutterPosition(controller, gutter, block) {
|
|
4156
|
-
|
|
4144
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
4157
4145
|
const element = gutter.current;
|
|
4158
4146
|
const root = controller.root;
|
|
4159
4147
|
const view = _optionalChain([root, 'optionalAccess', _193 => _193.ownerDocument, 'access', _194 => _194.defaultView]);
|
|
@@ -4180,7 +4168,7 @@ function useGutterPosition(controller, gutter, block) {
|
|
|
4180
4168
|
|
|
4181
4169
|
// src/gutter/use-gutter-target.ts
|
|
4182
4170
|
|
|
4183
|
-
var headOf = (state) =>
|
|
4171
|
+
var headOf = (state) => _chunkHOIDJEVIcjs.headBlockId.call(void 0, state.selection);
|
|
4184
4172
|
function blockAcross(controller, root, y) {
|
|
4185
4173
|
const box = root.getBoundingClientRect();
|
|
4186
4174
|
const probe = _optionalChain([root, 'access', _195 => _195.ownerDocument, 'access', _196 => _196.elementFromPoint, 'optionalCall', _197 => _197(box.left + box.width / 2, y)]);
|
|
@@ -4188,7 +4176,7 @@ function blockAcross(controller, root, y) {
|
|
|
4188
4176
|
}
|
|
4189
4177
|
function useGutterTarget(controller, store, gutter) {
|
|
4190
4178
|
const hovered = useCanvasUi(store, (state) => state.hoveredBlock);
|
|
4191
|
-
const head =
|
|
4179
|
+
const head = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, headOf);
|
|
4192
4180
|
const [focusWithin, setFocusWithin] = _react.useState.call(void 0, false);
|
|
4193
4181
|
_react.useEffect.call(void 0, () => {
|
|
4194
4182
|
const root = controller.root;
|
|
@@ -4206,16 +4194,7 @@ function useGutterTarget(controller, store, gutter) {
|
|
|
4206
4194
|
const onFocusIn = () => setFocusWithin(true);
|
|
4207
4195
|
const onFocusOut = (event) => setFocusWithin(root.contains(event.relatedTarget));
|
|
4208
4196
|
setFocusWithin(root.contains(root.ownerDocument.activeElement));
|
|
4209
|
-
|
|
4210
|
-
root.addEventListener("pointerleave", onPointerLeave);
|
|
4211
|
-
root.addEventListener("focusin", onFocusIn);
|
|
4212
|
-
root.addEventListener("focusout", onFocusOut);
|
|
4213
|
-
return () => {
|
|
4214
|
-
root.removeEventListener("pointermove", onPointerMove);
|
|
4215
|
-
root.removeEventListener("pointerleave", onPointerLeave);
|
|
4216
|
-
root.removeEventListener("focusin", onFocusIn);
|
|
4217
|
-
root.removeEventListener("focusout", onFocusOut);
|
|
4218
|
-
};
|
|
4197
|
+
return _chunk5M4QG3ZCcjs.listen.call(void 0, root, { pointermove: onPointerMove, pointerleave: onPointerLeave, focusin: onFocusIn, focusout: onFocusOut });
|
|
4219
4198
|
}, [controller, store, gutter]);
|
|
4220
4199
|
const fallback = focusWithin ? head : null;
|
|
4221
4200
|
const target = _nullishCoalesce(hovered, () => ( fallback));
|
|
@@ -4324,7 +4303,7 @@ function pointInHost(host, { node, offset }) {
|
|
|
4324
4303
|
return host.contains(node) ? { node, offset: Math.min(offset, nodeLength(node)) } : null;
|
|
4325
4304
|
}
|
|
4326
4305
|
function textRect(host, { from, to }) {
|
|
4327
|
-
const map =
|
|
4306
|
+
const map = _chunk5M4QG3ZCcjs.domMapOf.call(void 0, host);
|
|
4328
4307
|
const range = host.ownerDocument.createRange();
|
|
4329
4308
|
if (map === void 0 || typeof range.getBoundingClientRect !== "function") return null;
|
|
4330
4309
|
const start = pointInHost(host, map.toDom(from, 1));
|
|
@@ -4337,7 +4316,7 @@ function textRect(host, { from, to }) {
|
|
|
4337
4316
|
}
|
|
4338
4317
|
function rangeRect(controller, range) {
|
|
4339
4318
|
const host = controller.registry.get(range.block, range.region);
|
|
4340
|
-
if (host === void 0 || !host.isConnected || controller.composingKey ===
|
|
4319
|
+
if (host === void 0 || !host.isConnected || controller.composingKey === _chunk5M4QG3ZCcjs.hostKey.call(void 0, range.block, range.region)) {
|
|
4341
4320
|
return null;
|
|
4342
4321
|
}
|
|
4343
4322
|
const rect = textRect(host, range);
|
|
@@ -4353,7 +4332,7 @@ function union(a, b) {
|
|
|
4353
4332
|
function selectionRect(controller) {
|
|
4354
4333
|
const { state } = controller.editor;
|
|
4355
4334
|
if (_optionalChain([state, 'access', _205 => _205.selection, 'optionalAccess', _206 => _206.kind]) !== "text") return null;
|
|
4356
|
-
const ranges =
|
|
4335
|
+
const ranges = _chunkHOIDJEVIcjs.markRanges.call(void 0, state);
|
|
4357
4336
|
if (ranges.length === 0) return null;
|
|
4358
4337
|
const first = rangeRect(controller, ranges[0]);
|
|
4359
4338
|
if (ranges.length === 1) return first;
|
|
@@ -4364,7 +4343,7 @@ function selectionRect(controller) {
|
|
|
4364
4343
|
// src/menus/floating/use-selection-anchor.ts
|
|
4365
4344
|
var ROOM_ABOVE = 56;
|
|
4366
4345
|
function selectionHost(controller) {
|
|
4367
|
-
const [first] =
|
|
4346
|
+
const [first] = _chunkHOIDJEVIcjs.markRanges.call(void 0, controller.editor.state);
|
|
4368
4347
|
return _nullishCoalesce(_nullishCoalesce((first && controller.registry.get(first.block, first.region)), () => ( controller.root)), () => ( void 0));
|
|
4369
4348
|
}
|
|
4370
4349
|
function useSelectionAnchor(controller, state) {
|
|
@@ -4378,7 +4357,7 @@ function useSelectionAnchor(controller, state) {
|
|
|
4378
4357
|
[controller, state]
|
|
4379
4358
|
);
|
|
4380
4359
|
const [side, setSide] = _react.useState.call(void 0, "top");
|
|
4381
|
-
|
|
4360
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
4382
4361
|
const rect = selectionRect(controller);
|
|
4383
4362
|
if (rect) setSide(rect.top < ROOM_ABOVE ? "bottom" : "top");
|
|
4384
4363
|
}, [controller, state]);
|
|
@@ -4423,9 +4402,9 @@ var ICONS = { left: _lucidereact.AlignLeft, center: _lucidereact.AlignCenter, ri
|
|
|
4423
4402
|
var ALIGNS2 = Object.keys(ICONS);
|
|
4424
4403
|
var LABEL_KEYS = { left: "alignLeft", center: "alignCenter", right: "alignRight", justify: "alignJustify" };
|
|
4425
4404
|
function sharedAlign(state) {
|
|
4426
|
-
const blocks =
|
|
4405
|
+
const blocks = _chunkHOIDJEVIcjs.selectedBlockIds.call(void 0, state.doc, state.selection).map((id) => _chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, id)).filter((block) => _optionalChain([block, 'optionalAccess', _207 => _207.type]) === "MARKDOWN");
|
|
4427
4406
|
if (blocks.length === 0) return null;
|
|
4428
|
-
const aligns = new Set(blocks.map((block) => _nullishCoalesce(
|
|
4407
|
+
const aligns = new Set(blocks.map((block) => _nullishCoalesce(_chunkBTBHHBVRcjs.alignOrUndefined.call(void 0, _optionalChain([block, 'optionalAccess', _208 => _208.attrs, 'access', _209 => _209.align])), () => ( "left"))));
|
|
4429
4408
|
return aligns.size === 1 ? [...aligns][0] : "";
|
|
4430
4409
|
}
|
|
4431
4410
|
function AlignDropdown({ controller, state }) {
|
|
@@ -4434,7 +4413,7 @@ function AlignDropdown({ controller, state }) {
|
|
|
4434
4413
|
if (value === null) return null;
|
|
4435
4414
|
const Icon = value === "" ? _lucidereact.AlignLeft : ICONS[value];
|
|
4436
4415
|
const trigger = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.align, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, {}) });
|
|
4437
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(
|
|
4416
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(_chunkHOIDJEVIcjs.setTextAlign.call(void 0, align)), children: ALIGNS2.map((align) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DropdownMenuRadioItem, { value: align, indicator: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon, { className: "size-4" }), children: [
|
|
4438
4417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuIcon, { icon: ICONS[align] }),
|
|
4439
4418
|
labels[LABEL_KEYS[align]]
|
|
4440
4419
|
] }, align)) }) });
|
|
@@ -4446,8 +4425,8 @@ function AlignDropdown({ controller, state }) {
|
|
|
4446
4425
|
var MARKS = { color: "color", background: "highlight" };
|
|
4447
4426
|
function selectionColor(state, mark) {
|
|
4448
4427
|
const names = /* @__PURE__ */ new Set();
|
|
4449
|
-
for (const range of
|
|
4450
|
-
for (const node of
|
|
4428
|
+
for (const range of _chunkHOIDJEVIcjs.markRanges.call(void 0, state)) {
|
|
4429
|
+
for (const node of _chunkHOIDJEVIcjs.rangeContent.call(void 0, state, range)) {
|
|
4451
4430
|
const found = node.marks.find((candidate) => candidate.type === mark);
|
|
4452
4431
|
names.add(found === void 0 ? "default" : _optionalChain([found, 'access', _210 => _210.attrs, 'optionalAccess', _211 => _211.color]));
|
|
4453
4432
|
}
|
|
@@ -4456,7 +4435,7 @@ function selectionColor(state, mark) {
|
|
|
4456
4435
|
return names.size === 1 && typeof only === "string" ? only : "";
|
|
4457
4436
|
}
|
|
4458
4437
|
function colorCommand(key, name) {
|
|
4459
|
-
return name === "default" ?
|
|
4438
|
+
return name === "default" ? _chunkHOIDJEVIcjs.unsetMark.call(void 0, MARKS[key]) : _chunkHOIDJEVIcjs.setMark.call(void 0, MARKS[key], { color: name });
|
|
4460
4439
|
}
|
|
4461
4440
|
function ColorPopover({ controller, state }) {
|
|
4462
4441
|
const labels = useLabels();
|
|
@@ -4474,14 +4453,14 @@ function TurnIntoDropdown({ controller, state }) {
|
|
|
4474
4453
|
labels.turnInto,
|
|
4475
4454
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, {})
|
|
4476
4455
|
] });
|
|
4477
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds:
|
|
4456
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds: _chunkHOIDJEVIcjs.selectedBlockIds.call(void 0, state.doc, state.selection) }) });
|
|
4478
4457
|
}
|
|
4479
4458
|
|
|
4480
4459
|
// src/menus/bubble/BubbleToolbar.tsx
|
|
4481
4460
|
|
|
4482
4461
|
var DIVIDER = "mx-0.5 h-5 w-px shrink-0 bg-border";
|
|
4483
4462
|
function BubbleToolbar({ controller, labels, store, extraItems }) {
|
|
4484
|
-
const state =
|
|
4463
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
4485
4464
|
const { anchor, side } = useSelectionAnchor(controller, state);
|
|
4486
4465
|
const roving = useRovingFocus();
|
|
4487
4466
|
const items = _react.useMemo.call(void 0, () => bubbleItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -4546,10 +4525,10 @@ function useMediaQuery(query, unsupported) {
|
|
|
4546
4525
|
var useFinePointer = () => useMediaQuery("(pointer: fine)", true);
|
|
4547
4526
|
|
|
4548
4527
|
// src/menus/bubble/use-bubble-visibility.ts
|
|
4549
|
-
var hasTextRange = (state) => _optionalChain([state, 'access', _218 => _218.selection, 'optionalAccess', _219 => _219.kind]) === "text" && !
|
|
4528
|
+
var hasTextRange = (state) => _optionalChain([state, 'access', _218 => _218.selection, 'optionalAccess', _219 => _219.kind]) === "text" && !_chunkHOIDJEVIcjs.isCollapsed.call(void 0, state.selection) && _chunkHOIDJEVIcjs.markRanges.call(void 0, state).length > 0;
|
|
4550
4529
|
function useBubbleVisibility(controller) {
|
|
4551
|
-
const range =
|
|
4552
|
-
const readOnly =
|
|
4530
|
+
const range = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, hasTextRange);
|
|
4531
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
4553
4532
|
const fine = useFinePointer();
|
|
4554
4533
|
const settled = useSelectionSettled(controller);
|
|
4555
4534
|
return range && !readOnly && fine && settled;
|
|
@@ -4569,7 +4548,7 @@ function BubbleOverlay({ controller }) {
|
|
|
4569
4548
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BubbleToolbar, { controller, labels, store, extraItems });
|
|
4570
4549
|
}
|
|
4571
4550
|
function bubbleExtension() {
|
|
4572
|
-
return
|
|
4551
|
+
return _chunkHOIDJEVIcjs.defineExtension.call(void 0, { name: "bubble", ui: { overlays: [BubbleOverlay] } });
|
|
4573
4552
|
}
|
|
4574
4553
|
|
|
4575
4554
|
// src/menus/link/link-extension.tsx
|
|
@@ -4582,10 +4561,10 @@ function bubbleExtension() {
|
|
|
4582
4561
|
// src/menus/link/link-at-selection.ts
|
|
4583
4562
|
function linkAround(state, from, to = from) {
|
|
4584
4563
|
if (from.block !== to.block || from.region !== to.region) return null;
|
|
4585
|
-
const inline = _nullishCoalesce(
|
|
4586
|
-
const extent =
|
|
4564
|
+
const inline = _nullishCoalesce(_chunk5M4QG3ZCcjs.regionInline.call(void 0, state, from.block, from.region), () => ( []));
|
|
4565
|
+
const extent = _chunkHOIDJEVIcjs.markExtent.call(void 0, inline, from.offset, "link");
|
|
4587
4566
|
if (extent === null || to.offset > extent.to) return null;
|
|
4588
|
-
const attrs = _optionalChain([
|
|
4567
|
+
const attrs = _optionalChain([_chunkBTBHHBVRcjs.sliceInline.call(void 0, inline, extent.from, extent.to), 'access', _220 => _220[0], 'optionalAccess', _221 => _221.marks, 'access', _222 => _222.find, 'call', _223 => _223((mark) => mark.type === "link"), 'optionalAccess', _224 => _224.attrs]);
|
|
4589
4568
|
if (_optionalChain([attrs, 'optionalAccess', _225 => _225.href]) === void 0) return null;
|
|
4590
4569
|
const range = { block: from.block, region: from.region, ...extent };
|
|
4591
4570
|
return { href: attrs.href, title: attrs.title || void 0, range };
|
|
@@ -4593,7 +4572,7 @@ function linkAround(state, from, to = from) {
|
|
|
4593
4572
|
function linkAtSelection(state) {
|
|
4594
4573
|
const { selection } = state;
|
|
4595
4574
|
if (_optionalChain([selection, 'optionalAccess', _226 => _226.kind]) !== "text") return null;
|
|
4596
|
-
const { from, to } =
|
|
4575
|
+
const { from, to } = _chunkHOIDJEVIcjs.orderedRange.call(void 0, state.doc, selection.anchor, selection.head);
|
|
4597
4576
|
return linkAround(state, from, to);
|
|
4598
4577
|
}
|
|
4599
4578
|
|
|
@@ -4605,7 +4584,7 @@ function linkElementAt(controller, target) {
|
|
|
4605
4584
|
}
|
|
4606
4585
|
function linkAtElement(controller, state, element) {
|
|
4607
4586
|
const host = controller.registry.locate(element);
|
|
4608
|
-
const offset = host === null ? null : _nullishCoalesce(_optionalChain([
|
|
4587
|
+
const offset = host === null ? null : _nullishCoalesce(_optionalChain([_chunk5M4QG3ZCcjs.domMapOf.call(void 0, host.element), 'optionalAccess', _227 => _227.fromDom, 'call', _228 => _228(element, 0)]), () => ( null));
|
|
4609
4588
|
if (host === null || offset === null) return null;
|
|
4610
4589
|
return linkAround(state, { block: host.block, region: host.region, offset });
|
|
4611
4590
|
}
|
|
@@ -4631,7 +4610,7 @@ function truncateMiddle(text2, max) {
|
|
|
4631
4610
|
// src/menus/link/unlink-range.ts
|
|
4632
4611
|
function unlinkRange({ block, region, from, to }) {
|
|
4633
4612
|
return (state, dispatch) => {
|
|
4634
|
-
const tr = new (0,
|
|
4613
|
+
const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state).step(_chunkHOIDJEVIcjs.removeMarkStep.call(void 0, block, region, from, to, "link"));
|
|
4635
4614
|
if (!tr.docChanged) return false;
|
|
4636
4615
|
_optionalChain([dispatch, 'optionalCall', _233 => _233(tr)]);
|
|
4637
4616
|
return true;
|
|
@@ -4656,12 +4635,12 @@ function useRestedValue(value, delay) {
|
|
|
4656
4635
|
// src/menus/link/use-caret-in-link.ts
|
|
4657
4636
|
function caretLinkKey(state) {
|
|
4658
4637
|
const { selection } = state;
|
|
4659
|
-
if (_optionalChain([selection, 'optionalAccess', _234 => _234.kind]) !== "text" || !
|
|
4638
|
+
if (_optionalChain([selection, 'optionalAccess', _234 => _234.kind]) !== "text" || !_chunkHOIDJEVIcjs.isCollapsed.call(void 0, selection)) return null;
|
|
4660
4639
|
const link = linkAtSelection(state);
|
|
4661
4640
|
return link && [link.range.block, link.range.region, link.range.from, link.href].join("\0");
|
|
4662
4641
|
}
|
|
4663
4642
|
function useCaretInLink(controller, delay) {
|
|
4664
|
-
const key =
|
|
4643
|
+
const key = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, caretLinkKey);
|
|
4665
4644
|
const settled = useSelectionSettled(controller);
|
|
4666
4645
|
return useRestedValue(settled ? key : null, delay) !== null;
|
|
4667
4646
|
}
|
|
@@ -4701,7 +4680,7 @@ var URL_LENGTH = 48;
|
|
|
4701
4680
|
var CARD = "flex w-auto items-center gap-0.5 py-1 ps-3 pe-1 shadow-md";
|
|
4702
4681
|
var ADDRESS = "me-1 whitespace-nowrap text-sm text-muted-foreground";
|
|
4703
4682
|
function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
4704
|
-
const state =
|
|
4683
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
4705
4684
|
const link = _react.useMemo.call(void 0,
|
|
4706
4685
|
() => element === null ? linkAtSelection(state) : linkAtElement(controller, state, element),
|
|
4707
4686
|
[controller, state, element]
|
|
@@ -4714,12 +4693,12 @@ function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
|
4714
4693
|
}, [controller, link]);
|
|
4715
4694
|
if (link === null) return null;
|
|
4716
4695
|
const { block, region, from, to } = link.range;
|
|
4717
|
-
const href =
|
|
4696
|
+
const href = _chunkBTBHHBVRcjs.sanitizeHref.call(void 0, link.href);
|
|
4718
4697
|
const address = truncateMiddle(link.href, URL_LENGTH);
|
|
4719
4698
|
const edit2 = () => {
|
|
4720
4699
|
if (element !== null) {
|
|
4721
|
-
const selection =
|
|
4722
|
-
|
|
4700
|
+
const selection = _chunkHOIDJEVIcjs.textSelection.call(void 0, { block, region, offset: from }, { block, region, offset: to });
|
|
4701
|
+
_chunk5M4QG3ZCcjs.dispatchSelection.call(void 0, controller, selection);
|
|
4723
4702
|
}
|
|
4724
4703
|
store.set({ linkPopover: { open: true } });
|
|
4725
4704
|
};
|
|
@@ -4765,12 +4744,12 @@ function LinkHoverCard(props) {
|
|
|
4765
4744
|
|
|
4766
4745
|
// src/menus/link/apply-link.ts
|
|
4767
4746
|
function insertLinkedText(value, href, caret) {
|
|
4768
|
-
const safe =
|
|
4747
|
+
const safe = _chunkBTBHHBVRcjs.sanitizeHref.call(void 0, href);
|
|
4769
4748
|
return (state, dispatch) => {
|
|
4770
4749
|
if (!safe) return false;
|
|
4771
4750
|
const link = { type: "link", attrs: { href: safe } };
|
|
4772
|
-
const marks =
|
|
4773
|
-
const tr = new (0,
|
|
4751
|
+
const marks = _chunkBTBHHBVRcjs.addMark.call(void 0, _chunkHOIDJEVIcjs.caretMarks.call(void 0, state.doc, state.schema, state.storedMarks, caret), link);
|
|
4752
|
+
const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state).step(_chunkHOIDJEVIcjs.replaceInlineStep.call(void 0, caret.block, caret.region, caret.offset, caret.offset, [_chunkBTBHHBVRcjs.text.call(void 0, value, marks)])).setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, { ...caret, offset: caret.offset + value.length }));
|
|
4774
4753
|
_optionalChain([dispatch, 'optionalCall', _238 => _238(tr)]);
|
|
4775
4754
|
return true;
|
|
4776
4755
|
};
|
|
@@ -4779,10 +4758,10 @@ function applyLink(href, value) {
|
|
|
4779
4758
|
return (state, dispatch) => {
|
|
4780
4759
|
const { selection } = state;
|
|
4781
4760
|
const link = linkAtSelection(state);
|
|
4782
|
-
if (_optionalChain([selection, 'optionalAccess', _239 => _239.kind]) === "text" &&
|
|
4761
|
+
if (_optionalChain([selection, 'optionalAccess', _239 => _239.kind]) === "text" && _chunkHOIDJEVIcjs.isCollapsed.call(void 0, selection) && link === null) {
|
|
4783
4762
|
return insertLinkedText(value, href, selection.head)(state, dispatch);
|
|
4784
4763
|
}
|
|
4785
|
-
return
|
|
4764
|
+
return _chunkHOIDJEVIcjs.setLink.call(void 0, href, _optionalChain([link, 'optionalAccess', _240 => _240.title]))(state, dispatch);
|
|
4786
4765
|
};
|
|
4787
4766
|
}
|
|
4788
4767
|
|
|
@@ -4796,7 +4775,7 @@ function popoverAnchor(controller, link) {
|
|
|
4796
4775
|
if (_optionalChain([selection, 'optionalAccess', _241 => _241.kind]) !== "text") return null;
|
|
4797
4776
|
const { block, region, offset } = selection.head;
|
|
4798
4777
|
const caret = _nullishCoalesce(_optionalChain([link, 'optionalAccess', _242 => _242.range]), () => ( { block, region, from: offset, to: offset }));
|
|
4799
|
-
const collapsed =
|
|
4778
|
+
const collapsed = _chunkHOIDJEVIcjs.isCollapsed.call(void 0, selection);
|
|
4800
4779
|
return virtualAnchor(
|
|
4801
4780
|
() => collapsed ? rangeRect(controller, caret) : selectionRect(controller),
|
|
4802
4781
|
() => controller.registry.get(block, region)
|
|
@@ -4808,7 +4787,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4808
4787
|
const [invalid, setInvalid] = _react.useState.call(void 0, false);
|
|
4809
4788
|
const messageId = _react.useId.call(void 0, );
|
|
4810
4789
|
const anchor = _react.useMemo.call(void 0, () => ({ current: popoverAnchor(controller, link) }), [controller, link]);
|
|
4811
|
-
const openHref = link &&
|
|
4790
|
+
const openHref = link && _chunkBTBHHBVRcjs.sanitizeHref.call(void 0, link.href);
|
|
4812
4791
|
const backToText = () => {
|
|
4813
4792
|
onClose();
|
|
4814
4793
|
controller.focus();
|
|
@@ -4825,7 +4804,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4825
4804
|
backToText();
|
|
4826
4805
|
};
|
|
4827
4806
|
const remove = () => {
|
|
4828
|
-
controller.run(
|
|
4807
|
+
controller.run(_chunkHOIDJEVIcjs.unsetLink);
|
|
4829
4808
|
backToText();
|
|
4830
4809
|
};
|
|
4831
4810
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -4899,7 +4878,7 @@ function LinkOverlay({ controller }) {
|
|
|
4899
4878
|
const labels = useLabels();
|
|
4900
4879
|
const store = useCanvasUiStore();
|
|
4901
4880
|
const popoverOpen = useCanvasUi(store, isPopoverOpen);
|
|
4902
|
-
const readOnly =
|
|
4881
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
4903
4882
|
useLinkClicks(controller);
|
|
4904
4883
|
_react.useEffect.call(void 0, () => {
|
|
4905
4884
|
if (readOnly && store.get().linkPopover.open) store.set({ linkPopover: { open: false } });
|
|
@@ -4914,7 +4893,7 @@ function linkExtension(store) {
|
|
|
4914
4893
|
if (dispatch) store.set({ linkPopover: { open: true } });
|
|
4915
4894
|
return true;
|
|
4916
4895
|
};
|
|
4917
|
-
return
|
|
4896
|
+
return _chunkHOIDJEVIcjs.defineExtension.call(void 0, { name: "link", keymap: { "Mod-k": openPopover }, ui: { overlays: [LinkOverlay] } });
|
|
4918
4897
|
}
|
|
4919
4898
|
|
|
4920
4899
|
// src/menus/slash/slash-extension.tsx
|
|
@@ -4925,7 +4904,7 @@ var DEFAULT_MAX_LENGTH = 40;
|
|
|
4925
4904
|
var NO_TRIGGER_TYPES = /* @__PURE__ */ new Set(["CODE", "TABLE"]);
|
|
4926
4905
|
var WHITESPACE2 = /\s/;
|
|
4927
4906
|
var ATOM = "\uFFFC";
|
|
4928
|
-
var hasCode = (inline) => inline.some((node) =>
|
|
4907
|
+
var hasCode = (inline) => inline.some((node) => _chunkBTBHHBVRcjs.hasMark.call(void 0, node.marks, "code"));
|
|
4929
4908
|
function triggerOffset(text2, start, config) {
|
|
4930
4909
|
const { char, allowSpaces = false, startOfLine = false } = config;
|
|
4931
4910
|
const earliest = Math.max(0, text2.length - (_nullishCoalesce(config.maxLength, () => ( DEFAULT_MAX_LENGTH))) - 1);
|
|
@@ -4942,15 +4921,15 @@ function triggerOffset(text2, start, config) {
|
|
|
4942
4921
|
}
|
|
4943
4922
|
function findTrigger(state, config) {
|
|
4944
4923
|
const { doc, selection } = state;
|
|
4945
|
-
if (_optionalChain([selection, 'optionalAccess', _246 => _246.kind]) !== "text" || !
|
|
4924
|
+
if (_optionalChain([selection, 'optionalAccess', _246 => _246.kind]) !== "text" || !_chunkHOIDJEVIcjs.isCollapsed.call(void 0, selection)) return null;
|
|
4946
4925
|
const { block: blockId, region, offset: caret } = selection.head;
|
|
4947
|
-
const block =
|
|
4926
|
+
const block = _chunkBTBHHBVRcjs.blockById.call(void 0, doc, blockId);
|
|
4948
4927
|
if (block === void 0 || NO_TRIGGER_TYPES.has(block.type) || !Object.hasOwn(block.regions, region)) return null;
|
|
4949
4928
|
const inline = block.regions[region];
|
|
4950
4929
|
const start = Math.max(0, caret - (_nullishCoalesce(config.maxLength, () => ( DEFAULT_MAX_LENGTH))) - 2);
|
|
4951
|
-
const from = triggerOffset(
|
|
4952
|
-
if (from === null || hasCode(
|
|
4953
|
-
const query =
|
|
4930
|
+
const from = triggerOffset(_chunkBTBHHBVRcjs.inlineText.call(void 0, _chunkBTBHHBVRcjs.sliceInline.call(void 0, inline, start, caret)), start, config);
|
|
4931
|
+
if (from === null || hasCode(_chunkBTBHHBVRcjs.sliceInline.call(void 0, inline, from, caret))) return null;
|
|
4932
|
+
const query = _chunkBTBHHBVRcjs.inlineText.call(void 0, _chunkBTBHHBVRcjs.sliceInline.call(void 0, inline, from + 1, caret));
|
|
4954
4933
|
return { block: blockId, region, from, to: caret, query };
|
|
4955
4934
|
}
|
|
4956
4935
|
|
|
@@ -4980,7 +4959,7 @@ function suggestionPlugin(key, config) {
|
|
|
4980
4959
|
init: (state) => ({ active: nearest(state, findTrigger(state, config)), dismissedAt: null }),
|
|
4981
4960
|
apply(tr, value, oldState, newState) {
|
|
4982
4961
|
const dismissing = tr.getMeta(DISMISS) === key.name;
|
|
4983
|
-
if (!dismissing && !tr.docChanged &&
|
|
4962
|
+
if (!dismissing && !tr.docChanged && _chunkHOIDJEVIcjs.sameSelection.call(void 0, oldState.selection, newState.selection)) return value;
|
|
4984
4963
|
const found = findTrigger(newState, config);
|
|
4985
4964
|
let dismissedAt = null;
|
|
4986
4965
|
if (dismissing) dismissedAt = found && rangeOf2(found);
|
|
@@ -4997,14 +4976,14 @@ function suggestionPlugin(key, config) {
|
|
|
4997
4976
|
}
|
|
4998
4977
|
function dismissSuggestion(key) {
|
|
4999
4978
|
return (state, dispatch) => {
|
|
5000
|
-
if (
|
|
5001
|
-
_optionalChain([dispatch, 'optionalCall', _249 => _249(new (0,
|
|
4979
|
+
if (_chunkHOIDJEVIcjs.getPluginState.call(void 0, state, key).active === null) return false;
|
|
4980
|
+
_optionalChain([dispatch, 'optionalCall', _249 => _249(new (0, _chunkHOIDJEVIcjs.Transaction)(state).setMeta(DISMISS, key.name))]);
|
|
5002
4981
|
return true;
|
|
5003
4982
|
};
|
|
5004
4983
|
}
|
|
5005
4984
|
|
|
5006
4985
|
// src/menus/slash/slash-key.ts
|
|
5007
|
-
var slashKey =
|
|
4986
|
+
var slashKey = _chunkHOIDJEVIcjs.createPluginKey.call(void 0, "slash");
|
|
5008
4987
|
|
|
5009
4988
|
// src/menus/slash/slash-items.ts
|
|
5010
4989
|
|
|
@@ -5053,10 +5032,10 @@ function builtInSlashItems(labels, definitions) {
|
|
|
5053
5032
|
function initialBlock({ schema }, { type, initialData }) {
|
|
5054
5033
|
const data = _optionalChain([initialData, 'optionalCall', _250 => _250()]);
|
|
5055
5034
|
if (data === void 0) return { type };
|
|
5056
|
-
return { type, ...
|
|
5035
|
+
return { type, ..._chunkBTBHHBVRcjs.specFor.call(void 0, schema, type).fromData(data, _chunkBTBHHBVRcjs.createBlockCodec.call(void 0, schema).context) };
|
|
5057
5036
|
}
|
|
5058
5037
|
function blockTypeSlashItems(definitions) {
|
|
5059
|
-
return
|
|
5038
|
+
return _chunkEH5KXQXYcjs.paletteBlocks.call(void 0, definitions).filter((definition) => !BUILT_IN_TYPES.has(definition.type)).map((definition) => ({
|
|
5060
5039
|
id: `block:${definition.type}`,
|
|
5061
5040
|
title: definition.label,
|
|
5062
5041
|
group: "custom",
|
|
@@ -5086,10 +5065,10 @@ function useRangeAnchor(controller, range) {
|
|
|
5086
5065
|
const [side, setSide] = _react.useState.call(void 0, "bottom");
|
|
5087
5066
|
const latest = _react.useRef.call(void 0, range);
|
|
5088
5067
|
const start = range === null ? null : `${range.block} ${range.region} ${range.from}`;
|
|
5089
|
-
|
|
5068
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5090
5069
|
latest.current = range;
|
|
5091
5070
|
});
|
|
5092
|
-
|
|
5071
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5093
5072
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
5094
5073
|
if (rect) setSide(sideFor(rect, window.innerHeight));
|
|
5095
5074
|
}, [controller, start]);
|
|
@@ -5121,11 +5100,11 @@ function openCombobox(host, listboxId) {
|
|
|
5121
5100
|
}
|
|
5122
5101
|
function useComboboxHost(controller, block, region, listboxId, activeOptionId) {
|
|
5123
5102
|
const host = _react.useRef.call(void 0, null);
|
|
5124
|
-
|
|
5103
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5125
5104
|
host.current = block === null || region === null ? null : _nullishCoalesce(controller.registry.get(block, region), () => ( null));
|
|
5126
5105
|
return host.current === null ? void 0 : openCombobox(host.current, listboxId);
|
|
5127
5106
|
}, [controller, block, region, listboxId]);
|
|
5128
|
-
|
|
5107
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5129
5108
|
if (host.current !== null) restore(host.current, "aria-activedescendant", activeOptionId);
|
|
5130
5109
|
}, [block, region, activeOptionId]);
|
|
5131
5110
|
}
|
|
@@ -5174,10 +5153,10 @@ function handle(event, menu) {
|
|
|
5174
5153
|
}
|
|
5175
5154
|
function useSuggestionKeys(controller, open, menu) {
|
|
5176
5155
|
const latest = _react.useRef.call(void 0, menu);
|
|
5177
|
-
|
|
5156
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5178
5157
|
latest.current = menu;
|
|
5179
5158
|
});
|
|
5180
|
-
|
|
5159
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5181
5160
|
if (!open) return;
|
|
5182
5161
|
const intercept = (event) => {
|
|
5183
5162
|
const handled = handle(event, latest.current);
|
|
@@ -5201,10 +5180,10 @@ var isPromise = (value) => typeof _optionalChain([value, 'optionalAccess', _252
|
|
|
5201
5180
|
function useSuggestionResults(source, query, onError) {
|
|
5202
5181
|
const [answer, setAnswer] = _react.useState.call(void 0, FORGOTTEN);
|
|
5203
5182
|
const report = _react.useRef.call(void 0, onError);
|
|
5204
|
-
|
|
5183
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5205
5184
|
report.current = onError;
|
|
5206
5185
|
});
|
|
5207
|
-
|
|
5186
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5208
5187
|
if (query === null) {
|
|
5209
5188
|
setAnswer(FORGOTTEN);
|
|
5210
5189
|
return;
|
|
@@ -5248,9 +5227,9 @@ function useSuggestion({
|
|
|
5248
5227
|
emptyLabel
|
|
5249
5228
|
}) {
|
|
5250
5229
|
const { labels, onError } = useQuoin();
|
|
5251
|
-
const readOnly =
|
|
5252
|
-
const selectTrigger = _react.useCallback.call(void 0, (state) =>
|
|
5253
|
-
const active =
|
|
5230
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
5231
|
+
const selectTrigger = _react.useCallback.call(void 0, (state) => _chunkHOIDJEVIcjs.getPluginState.call(void 0, state, pluginKey).active, [pluginKey]);
|
|
5232
|
+
const active = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, selectTrigger);
|
|
5254
5233
|
const trigger = readOnly ? null : active;
|
|
5255
5234
|
const results = useSuggestionResults(source, _nullishCoalesce(_optionalChain([trigger, 'optionalAccess', _253 => _253.query]), () => ( null)), onError);
|
|
5256
5235
|
const sections = _react.useMemo.call(void 0, () => groupItems(results.items, groupOf2), [results.items, groupOf2]);
|
|
@@ -5272,7 +5251,7 @@ function useSuggestion({
|
|
|
5272
5251
|
);
|
|
5273
5252
|
const select = _react.useCallback.call(void 0,
|
|
5274
5253
|
(index) => {
|
|
5275
|
-
const current =
|
|
5254
|
+
const current = _chunkHOIDJEVIcjs.getPluginState.call(void 0, controller.editor.state, pluginKey).active;
|
|
5276
5255
|
if (current !== null && index < ordered.length) onSelect(ordered[index], rangeOf2(current));
|
|
5277
5256
|
},
|
|
5278
5257
|
[controller, pluginKey, ordered, onSelect]
|
|
@@ -5323,7 +5302,7 @@ function SuggestionMenu(props) {
|
|
|
5323
5302
|
const { trigger, sections, activeIndex, listboxId } = suggestion;
|
|
5324
5303
|
const { anchor, side } = useRangeAnchor(controller, trigger);
|
|
5325
5304
|
const listbox = _react.useRef.call(void 0, null);
|
|
5326
|
-
|
|
5305
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
5327
5306
|
_optionalChain([listbox, 'access', _259 => _259.current, 'optionalAccess', _260 => _260.querySelector, 'call', _261 => _261('[aria-selected="true"]'), 'optionalAccess', _262 => _262.scrollIntoView, 'call', _263 => _263({ block: "nearest" })]);
|
|
5328
5307
|
}, [activeIndex, sections]);
|
|
5329
5308
|
if (trigger === null) return null;
|
|
@@ -5382,14 +5361,14 @@ function SuggestionMenu(props) {
|
|
|
5382
5361
|
// src/menus/suggestion/replace-trigger.ts
|
|
5383
5362
|
function deleteTrigger({ block, region, from, to }) {
|
|
5384
5363
|
return (state, dispatch) => {
|
|
5385
|
-
const tr = new (0,
|
|
5386
|
-
if (from >= to || !tr.maybeStep(
|
|
5387
|
-
_optionalChain([dispatch, 'optionalCall', _270 => _270(tr.setSelection(
|
|
5364
|
+
const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state);
|
|
5365
|
+
if (from >= to || !tr.maybeStep(_chunkHOIDJEVIcjs.replaceInlineStep.call(void 0, block, region, from, to, []))) return false;
|
|
5366
|
+
_optionalChain([dispatch, 'optionalCall', _270 => _270(tr.setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, { block, region, offset: from })))]);
|
|
5388
5367
|
return true;
|
|
5389
5368
|
};
|
|
5390
5369
|
}
|
|
5391
5370
|
function triggerReplacement(state, range, command) {
|
|
5392
|
-
return
|
|
5371
|
+
return _chunkHOIDJEVIcjs.runCommands.call(void 0, state, command === void 0 ? [deleteTrigger(range)] : [deleteTrigger(range), command]);
|
|
5393
5372
|
}
|
|
5394
5373
|
function replaceTrigger(controller, range, command) {
|
|
5395
5374
|
const { ok, tr } = triggerReplacement(controller.editor.state, range, command);
|
|
@@ -5402,9 +5381,9 @@ var TEXT_STEPS = /* @__PURE__ */ new Set(["replaceInline", "addMark", "removeMar
|
|
|
5402
5381
|
var WHITESPACE3 = /\s/;
|
|
5403
5382
|
var changesBlocks = (tr) => tr !== null && tr.steps.some((step) => !TEXT_STEPS.has(step.stepType));
|
|
5404
5383
|
function withSpaceBefore(state, range) {
|
|
5405
|
-
const inline =
|
|
5384
|
+
const inline = _chunk5M4QG3ZCcjs.regionInline.call(void 0, state, range.block, range.region);
|
|
5406
5385
|
if (inline === void 0 || range.from === 0) return null;
|
|
5407
|
-
const text2 =
|
|
5386
|
+
const text2 = _chunkBTBHHBVRcjs.inlineText.call(void 0, inline);
|
|
5408
5387
|
const after = text2.charAt(range.to);
|
|
5409
5388
|
const spaced = text2.charAt(range.from - 1) === " " && (after === "" || WHITESPACE3.test(after));
|
|
5410
5389
|
return spaced ? { ...range, from: range.from - 1 } : null;
|
|
@@ -5515,7 +5494,7 @@ function SlashOverlay({ controller }) {
|
|
|
5515
5494
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlashMenu, { controller, labels, items });
|
|
5516
5495
|
}
|
|
5517
5496
|
function slashExtension() {
|
|
5518
|
-
return
|
|
5497
|
+
return _chunkHOIDJEVIcjs.defineExtension.call(void 0, {
|
|
5519
5498
|
name: "slash",
|
|
5520
5499
|
plugins: [suggestionPlugin(slashKey, { char: "/" })],
|
|
5521
5500
|
ui: { overlays: [SlashOverlay] }
|
|
@@ -5542,7 +5521,7 @@ function commandItem(id, title, icon, command) {
|
|
|
5542
5521
|
return { id, title, icon, run: (controller) => void controller.run(command) };
|
|
5543
5522
|
}
|
|
5544
5523
|
function addBlockAtCaret(controller) {
|
|
5545
|
-
const block =
|
|
5524
|
+
const block = _chunkHOIDJEVIcjs.headBlockId.call(void 0, controller.editor.state.selection);
|
|
5546
5525
|
if (block !== null) addBlockBelow(controller, block);
|
|
5547
5526
|
}
|
|
5548
5527
|
function mobileItems(labels, openLink) {
|
|
@@ -5554,10 +5533,10 @@ function mobileItems(labels, openLink) {
|
|
|
5554
5533
|
markItem("strike", labels.strike, _lucidereact.Strikethrough),
|
|
5555
5534
|
markItem("code", labels.code, _lucidereact.Code),
|
|
5556
5535
|
linkItem(labels, openLink),
|
|
5557
|
-
commandItem("indent", labels.indent, _lucidereact.ListIndentIncrease,
|
|
5558
|
-
commandItem("outdent", labels.outdent, _lucidereact.ListIndentDecrease,
|
|
5559
|
-
commandItem("undo", labels.undo, _lucidereact.Undo2,
|
|
5560
|
-
commandItem("redo", labels.redo, _lucidereact.Redo2,
|
|
5536
|
+
commandItem("indent", labels.indent, _lucidereact.ListIndentIncrease, _chunkHOIDJEVIcjs.indent),
|
|
5537
|
+
commandItem("outdent", labels.outdent, _lucidereact.ListIndentDecrease, _chunkHOIDJEVIcjs.outdent),
|
|
5538
|
+
commandItem("undo", labels.undo, _lucidereact.Undo2, _chunkHOIDJEVIcjs.undo),
|
|
5539
|
+
commandItem("redo", labels.redo, _lucidereact.Redo2, _chunkHOIDJEVIcjs.redo)
|
|
5561
5540
|
]
|
|
5562
5541
|
};
|
|
5563
5542
|
}
|
|
@@ -5620,7 +5599,7 @@ function placement(viewport) {
|
|
|
5620
5599
|
function EditingTools({ controller }) {
|
|
5621
5600
|
const labels = useLabels();
|
|
5622
5601
|
const store = useCanvasUiStore();
|
|
5623
|
-
const state =
|
|
5602
|
+
const state = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, _chunk5M4QG3ZCcjs.wholeState);
|
|
5624
5603
|
const viewport = useVisualViewport();
|
|
5625
5604
|
const roving = useRovingFocus();
|
|
5626
5605
|
const items = _react.useMemo.call(void 0, () => mobileItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -5895,7 +5874,7 @@ function shortcutsExtension(store) {
|
|
|
5895
5874
|
if (dispatch) store.set({ shortcutsOpen: true });
|
|
5896
5875
|
return true;
|
|
5897
5876
|
};
|
|
5898
|
-
return
|
|
5877
|
+
return _chunkHOIDJEVIcjs.defineExtension.call(void 0, {
|
|
5899
5878
|
name: "shortcuts",
|
|
5900
5879
|
keymap: { [SHORTCUT]: open, "Mod-Shift-?": open },
|
|
5901
5880
|
ui: { overlays: [ShortcutsOverlay] }
|
|
@@ -5936,15 +5915,15 @@ function writeBlockData(controller, blockId, data) {
|
|
|
5936
5915
|
const index = doc.index.get(blockId);
|
|
5937
5916
|
if (index === void 0) return;
|
|
5938
5917
|
const block = doc.blocks[index];
|
|
5939
|
-
const { attrs, regions } =
|
|
5940
|
-
if (
|
|
5941
|
-
const tr = editor.createTransaction().step(
|
|
5942
|
-
editor.dispatch(tr.setMeta(
|
|
5918
|
+
const { attrs, regions } = _chunkBTBHHBVRcjs.specFor.call(void 0, schema, block.type).fromData(data, editor.codec.context);
|
|
5919
|
+
if (_chunkXX5FTPJRcjs.sameValue.call(void 0, attrs, block.attrs) && _chunkXX5FTPJRcjs.sameValue.call(void 0, regions, block.regions)) return;
|
|
5920
|
+
const tr = editor.createTransaction().step(_chunkHOIDJEVIcjs.replaceBlockStep.call(void 0, { ...block, attrs, regions }));
|
|
5921
|
+
editor.dispatch(tr.setMeta(_chunkHOIDJEVIcjs.HISTORY_GROUP, `block-data:${blockId}`));
|
|
5943
5922
|
}
|
|
5944
5923
|
function insertAfterBlock(controller, blockId, type, definitions) {
|
|
5945
5924
|
const editor = internal(controller);
|
|
5946
|
-
const data = _optionalChain([
|
|
5947
|
-
const content = data &&
|
|
5925
|
+
const data = _optionalChain([_chunkEH5KXQXYcjs.blockByType.call(void 0, definitions, type), 'optionalAccess', _278 => _278.initialData, 'optionalCall', _279 => _279()]);
|
|
5926
|
+
const content = data && _chunkBTBHHBVRcjs.specFor.call(void 0, editor.state.schema, type).fromData(data, editor.codec.context);
|
|
5948
5927
|
controller.run(insertBlockToWrite({ type, ...content }, opensEditor(definitions, type), blockId));
|
|
5949
5928
|
}
|
|
5950
5929
|
|
|
@@ -5975,13 +5954,11 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5975
5954
|
const leaveUnlessInside = (event) => {
|
|
5976
5955
|
if (!inside.current.has(event)) stop();
|
|
5977
5956
|
};
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
doc.addEventListener("focusin", leaveUnlessInside);
|
|
5957
|
+
const unlistenCapture = _chunk5M4QG3ZCcjs.listen.call(void 0, doc, { pointerdown: leaveForCanvas }, true);
|
|
5958
|
+
const unlisten = _chunk5M4QG3ZCcjs.listen.call(void 0, doc, { pointerdown: leaveUnlessInside, focusin: leaveUnlessInside });
|
|
5981
5959
|
return () => {
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
doc.removeEventListener("focusin", leaveUnlessInside);
|
|
5960
|
+
unlistenCapture();
|
|
5961
|
+
unlisten();
|
|
5985
5962
|
};
|
|
5986
5963
|
}, [root, editing, stop]);
|
|
5987
5964
|
return _react.useMemo.call(void 0, () => {
|
|
@@ -5995,7 +5972,7 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5995
5972
|
function useMissingPreviewWarning(readOnly, { type, preview }) {
|
|
5996
5973
|
_react.useEffect.call(void 0, () => {
|
|
5997
5974
|
if (!readOnly || preview !== void 0) return;
|
|
5998
|
-
|
|
5975
|
+
_chunkEH5KXQXYcjs.devWarn.call(void 0,
|
|
5999
5976
|
`the block type "${type}" has no \`preview\`, so a read-only canvas can draw only its label. Give its definition a \`preview\` to render the block itself.`
|
|
6000
5977
|
);
|
|
6001
5978
|
}, [readOnly, type, preview]);
|
|
@@ -6006,7 +5983,7 @@ function VoidPreview({ definition: { preview: Preview }, name, ...props }) {
|
|
|
6006
5983
|
}
|
|
6007
5984
|
function VoidBlock({ block, controller, definition }) {
|
|
6008
5985
|
const { blockTypes, labels } = useQuoin();
|
|
6009
|
-
const readOnly =
|
|
5986
|
+
const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
|
|
6010
5987
|
const { editor: Editor, alwaysEditing = false } = definition;
|
|
6011
5988
|
const name = blockTypeLabel(labels, block, blockTypes);
|
|
6012
5989
|
const blockId = block.id;
|
|
@@ -6054,7 +6031,7 @@ function VoidBlock({ block, controller, definition }) {
|
|
|
6054
6031
|
role: "group",
|
|
6055
6032
|
"aria-label": name,
|
|
6056
6033
|
tabIndex: editorShown ? -1 : void 0,
|
|
6057
|
-
...{ [
|
|
6034
|
+
...{ [_chunk5M4QG3ZCcjs.NATIVE_INTERACTION]: editorShown ? "" : void 0 },
|
|
6058
6035
|
onKeyDown,
|
|
6059
6036
|
...focusHandlers,
|
|
6060
6037
|
onClick,
|
|
@@ -6129,12 +6106,12 @@ function collectUi(extensions, definitions, readOnly = false) {
|
|
|
6129
6106
|
|
|
6130
6107
|
// src/canvas/insert-uploads.ts
|
|
6131
6108
|
function fileBlock(file, stored) {
|
|
6132
|
-
if (isImageFile(file)) return { id:
|
|
6109
|
+
if (isImageFile(file)) return { id: _chunkBTBHHBVRcjs.newId.call(void 0, ), type: "IMAGE", attrs: { storageKey: stored.storageKey, alt: "" } };
|
|
6133
6110
|
return { type: "FILE", attrs: fileAttrs(file, stored) };
|
|
6134
6111
|
}
|
|
6135
6112
|
function anchorBlock(controller, at) {
|
|
6136
6113
|
const { doc, selection } = controller.editor.state;
|
|
6137
|
-
const candidates = [_optionalChain([at, 'optionalAccess', _289 => _289.block]),
|
|
6114
|
+
const candidates = [_optionalChain([at, 'optionalAccess', _289 => _289.block]), _chunkHOIDJEVIcjs.headBlockId.call(void 0, selection), _optionalChain([doc, 'access', _290 => _290.blocks, 'access', _291 => _291[doc.blocks.length - 1], 'optionalAccess', _292 => _292.id])];
|
|
6138
6115
|
return _nullishCoalesce(candidates.find((id) => typeof id === "string" && doc.index.has(id)), () => ( null));
|
|
6139
6116
|
}
|
|
6140
6117
|
var writerOf = (controller) => ({
|
|
@@ -6143,7 +6120,7 @@ var writerOf = (controller) => ({
|
|
|
6143
6120
|
});
|
|
6144
6121
|
function movedOn(controller, before) {
|
|
6145
6122
|
const now = writerOf(controller);
|
|
6146
|
-
return now.focus !== before.focus || !
|
|
6123
|
+
return now.focus !== before.focus || !_chunkHOIDJEVIcjs.sameSelection.call(void 0, now.selection, before.selection);
|
|
6147
6124
|
}
|
|
6148
6125
|
async function insertUploads(controller, files, at, { upload, resolveAssetUrl, onError, unavailable, failed }) {
|
|
6149
6126
|
if (!upload) return onError(new Error(unavailable));
|
|
@@ -6171,15 +6148,15 @@ function holdsHead({ selection }, block) {
|
|
|
6171
6148
|
}
|
|
6172
6149
|
function markdownPlaceholder(state, block, labels) {
|
|
6173
6150
|
const { kind, level } = block.attrs;
|
|
6174
|
-
if (kind === "heading") return labels.placeholderHeading(
|
|
6151
|
+
if (kind === "heading") return labels.placeholderHeading(_chunkBTBHHBVRcjs.headingLevel.call(void 0, level));
|
|
6175
6152
|
if (LIST_KINDS.has(kind)) return labels.placeholderList;
|
|
6176
6153
|
if (kind === "quote") return labels.placeholderQuote;
|
|
6177
6154
|
if (kind !== "paragraph") return void 0;
|
|
6178
6155
|
return holdsHead(state, block) || state.doc.blocks.length === 1 ? labels.placeholderEmpty : void 0;
|
|
6179
6156
|
}
|
|
6180
6157
|
function placeholderFor(state, block, labels) {
|
|
6181
|
-
const region =
|
|
6182
|
-
if (region === null ||
|
|
6158
|
+
const region = _chunkHOIDJEVIcjs.primaryRegion.call(void 0, state.schema, block);
|
|
6159
|
+
if (region === null || _chunkHOIDJEVIcjs.regionLength.call(void 0, block, region) > 0) return void 0;
|
|
6183
6160
|
switch (block.type) {
|
|
6184
6161
|
case "MARKDOWN":
|
|
6185
6162
|
return markdownPlaceholder(state, block, labels);
|
|
@@ -6200,13 +6177,13 @@ function firstLine2(text2) {
|
|
|
6200
6177
|
}
|
|
6201
6178
|
var selectedBlockLabel = (labels, definitions, extensionNames) => (block, schema) => {
|
|
6202
6179
|
const { attrs } = block;
|
|
6203
|
-
if (block.type === "IMAGE") return hasPicture(attrs) ?
|
|
6180
|
+
if (block.type === "IMAGE") return hasPicture(attrs) ? _chunkBTBHHBVRcjs.str.call(void 0, attrs.alt) || labels.imageNoAlt : labels.emptyImage;
|
|
6204
6181
|
if (block.type === "CODE") {
|
|
6205
|
-
const language2 =
|
|
6182
|
+
const language2 = _chunkBTBHHBVRcjs.str.call(void 0, attrs.language);
|
|
6206
6183
|
return labels.codeBlockName(_nullishCoalesce(languageName(language2), () => ( (language2 || labels.plainText))));
|
|
6207
6184
|
}
|
|
6208
6185
|
if (block.type === "FILE" && hasFile(attrs)) return labels.fileBlockName(firstLine2(fileName(attrs)));
|
|
6209
|
-
return firstLine2(
|
|
6186
|
+
return firstLine2(_chunkBTBHHBVRcjs.blockPlainText.call(void 0, block, schema)) || blockTypeLabel(labels, block, definitions, extensionNames);
|
|
6210
6187
|
};
|
|
6211
6188
|
|
|
6212
6189
|
// src/canvas/use-block-link-target.ts
|
|
@@ -6217,7 +6194,7 @@ function revealLinkedBlock(controller, hash) {
|
|
|
6217
6194
|
if (id === null || shell === void 0) return false;
|
|
6218
6195
|
const { editor } = controller;
|
|
6219
6196
|
const { doc, schema } = editor.state;
|
|
6220
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
6197
|
+
editor.dispatch(editor.createTransaction().setSelection(_chunkHOIDJEVIcjs.startOf.call(void 0, doc, schema, id)));
|
|
6221
6198
|
shell.scrollIntoView({ block: "center" });
|
|
6222
6199
|
return true;
|
|
6223
6200
|
}
|
|
@@ -6237,8 +6214,8 @@ function useBlockLinkTarget(controller, focusOnMount) {
|
|
|
6237
6214
|
// src/canvas/use-delete-reporter.ts
|
|
6238
6215
|
|
|
6239
6216
|
var WRITER_ORIGINS = /* @__PURE__ */ new Set(["command", "input", "paste"]);
|
|
6240
|
-
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(
|
|
6241
|
-
var isEmptyText = (schema, block) =>
|
|
6217
|
+
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(_chunkHOIDJEVIcjs.LINE_JOIN) !== true;
|
|
6218
|
+
var isEmptyText = (schema, block) => _chunkHOIDJEVIcjs.isTextFlow.call(void 0, schema, block) && _chunkHOIDJEVIcjs.regionLength.call(void 0, block, _nullishCoalesce(_chunkHOIDJEVIcjs.primaryRegion.call(void 0, schema, block), () => ( ""))) === 0;
|
|
6242
6219
|
function filledLine({ origin, before }, schema) {
|
|
6243
6220
|
const { selection } = before;
|
|
6244
6221
|
if (origin !== "paste" || _optionalChain([selection, 'optionalAccess', _303 => _303.kind]) !== "text") return () => false;
|
|
@@ -6252,13 +6229,13 @@ function deletions(codec, tr) {
|
|
|
6252
6229
|
const { index, count } = step.toJSON();
|
|
6253
6230
|
if (typeof index !== "number" || typeof count !== "number") return [];
|
|
6254
6231
|
const { blocks } = tr.docs[i];
|
|
6255
|
-
const first = codec.blocksFromDoc(
|
|
6232
|
+
const first = codec.blocksFromDoc(_chunkBTBHHBVRcjs.createDoc.call(void 0, blocks.slice(0, index))).length;
|
|
6256
6233
|
return blocks.slice(index, index + count).flatMap((block, offset) => filled(block) ? [] : [{ block: codec.toQuoin(block), index: first + offset }]);
|
|
6257
6234
|
});
|
|
6258
6235
|
}
|
|
6259
6236
|
function useDeleteReporter(controller, onDelete) {
|
|
6260
6237
|
const latest = _react.useRef.call(void 0, onDelete);
|
|
6261
|
-
|
|
6238
|
+
_chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
|
|
6262
6239
|
latest.current = onDelete;
|
|
6263
6240
|
});
|
|
6264
6241
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6289,7 +6266,7 @@ function useTypedInPlaceWarning(definitions, readOnly) {
|
|
|
6289
6266
|
_react.useEffect.call(void 0, () => {
|
|
6290
6267
|
if (readOnly) return;
|
|
6291
6268
|
for (const type of definedTypedInPlace(definitions)) {
|
|
6292
|
-
|
|
6269
|
+
_chunkEH5KXQXYcjs.devWarn.call(void 0,
|
|
6293
6270
|
`the block type "${type}" has a definition of its own, which only a read-only canvas draws. An editable canvas keeps drawing ${type} blocks itself, since they are typed into in place.`
|
|
6294
6271
|
);
|
|
6295
6272
|
}
|
|
@@ -6321,7 +6298,7 @@ var BlockCanvas = _react.forwardRef.call(void 0, function BlockCanvas2({
|
|
|
6321
6298
|
const [voidEditing] = _react.useState.call(void 0, createVoidEditing);
|
|
6322
6299
|
const [uiStore] = _react.useState.call(void 0, createCanvasUiStore);
|
|
6323
6300
|
const [allExtensions] = _react.useState.call(void 0, () => [
|
|
6324
|
-
...
|
|
6301
|
+
..._chunkHOIDJEVIcjs.coreExtensions.call(void 0, ),
|
|
6325
6302
|
voidEditing.extension,
|
|
6326
6303
|
blockMenuKeymap(uiStore),
|
|
6327
6304
|
slashExtension(),
|
|
@@ -6334,7 +6311,7 @@ var BlockCanvas = _react.forwardRef.call(void 0, function BlockCanvas2({
|
|
|
6334
6311
|
const ui = _react.useMemo.call(void 0, () => collectUi(allExtensions, blockTypes, readOnly), [allExtensions, blockTypes, readOnly]);
|
|
6335
6312
|
useTypedInPlaceWarning(blockTypes, readOnly);
|
|
6336
6313
|
const [focusOnMount] = _react.useState.call(void 0, autoFocus);
|
|
6337
|
-
const controller =
|
|
6314
|
+
const controller = _chunk5M4QG3ZCcjs.useQuoinEditor.call(void 0, {
|
|
6338
6315
|
blocks,
|
|
6339
6316
|
onChange,
|
|
6340
6317
|
readOnly,
|
|
@@ -6378,7 +6355,7 @@ var BlockCanvas = _react.forwardRef.call(void 0, function BlockCanvas2({
|
|
|
6378
6355
|
[controller, resolveAssetUrl]
|
|
6379
6356
|
);
|
|
6380
6357
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuoinProvider, { value: { blockTypes, upload, resolveAssetUrl, onError, highlight, controller, labels }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, VoidEditingContext.Provider, { value: voidEditing, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlashItemsProvider, { value: slashItems, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BubbleItemsProvider, { value: ui.bubbleItems, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CanvasUiProvider, { value: uiStore, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6381
|
-
|
|
6358
|
+
_chunk5M4QG3ZCcjs.EditorView,
|
|
6382
6359
|
{
|
|
6383
6360
|
controller,
|
|
6384
6361
|
renderers: ui.renderers,
|
|
@@ -6577,7 +6554,7 @@ function useAutosave({
|
|
|
6577
6554
|
const seen = seenRef.current;
|
|
6578
6555
|
seenRef.current = deps;
|
|
6579
6556
|
if (seen === null) return;
|
|
6580
|
-
const unchanged =
|
|
6557
|
+
const unchanged = _chunkBTBHHBVRcjs.sameItems.call(void 0, seen, deps);
|
|
6581
6558
|
if (!unchanged) runner.markDirty();
|
|
6582
6559
|
}, deps);
|
|
6583
6560
|
React10.useEffect(() => {
|
|
@@ -6663,4 +6640,4 @@ function useAutosave({
|
|
|
6663
6640
|
|
|
6664
6641
|
|
|
6665
6642
|
exports.englishLabels = englishLabels; exports.QuoinProvider = QuoinProvider; exports.useQuoin = useQuoin; exports.useLabels = useLabels; exports.coreBlocks = coreBlocks; exports.selectNode = selectNode; exports.focusNode = focusNode; exports.returnFocusToText = returnFocusToText; exports.cn = cn; exports.FOCUS_RING = FOCUS_RING; exports.FLOATING_TOOLBAR = FLOATING_TOOLBAR; exports.MENU_ITEM = MENU_ITEM; exports.runOnBlocks = runOnBlocks; exports.noChange = noChange; exports.styleTargets = styleTargets; exports.MenuIcon = MenuIcon; exports.formatShortcut = formatShortcut; exports.insertBlocks = insertBlocks; exports.insertBlockToWrite = insertBlockToWrite; exports.interceptKeys = interceptKeys; exports.Button = Button; exports.keepFocus = keepFocus; exports.Popover = Popover; exports.PopoverAnchor = PopoverAnchor; exports.PopoverContent = PopoverContent; exports.preventDefault = preventDefault; exports.FilePickerButton = FilePickerButton; exports.selectHandlers = selectHandlers; exports.useNodeKeys = useNodeKeys; exports.bubblePart = bubblePart; exports.virtualAnchor = virtualAnchor; exports.usePartAnchor = usePartAnchor; exports.useRovingFocus = useRovingFocus; exports.useFocusKey = useFocusKey; exports.linkAddress = linkAddress; exports.Input = Input; exports.useOutsidePress = useOutsidePress; exports.DropdownMenu = DropdownMenu; exports.DropdownMenuTrigger = DropdownMenuTrigger; exports.DropdownMenuContent = DropdownMenuContent; exports.DropdownMenuItem = DropdownMenuItem; exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem; exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup; exports.DropdownMenuRadioItem = DropdownMenuRadioItem; exports.DropdownMenuSeparator = DropdownMenuSeparator; exports.inlineDirection = inlineDirection; exports.resolveLabels = resolveLabels; exports.rangeRect = rangeRect; exports.suggestionPlugin = suggestionPlugin; exports.dismissSuggestion = dismissSuggestion; exports.useRangeAnchor = useRangeAnchor; exports.toError = toError; exports.SuggestionMenu = SuggestionMenu; exports.replaceTrigger = replaceTrigger; exports.blockFragment = blockFragment; exports.linkedBlockId = linkedBlockId; exports.BlockCanvas = BlockCanvas; exports.UploadField = UploadField; exports.useAutosave = useAutosave;
|
|
6666
|
-
//# sourceMappingURL=chunk-
|
|
6643
|
+
//# sourceMappingURL=chunk-5R3ISX4A.cjs.map
|