quoin-editor 1.0.0 → 1.0.2
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 +58 -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-ND5XJVK2.cjs → chunk-4SLJNZSM.cjs} +27 -23
- package/dist/chunk-4SLJNZSM.cjs.map +1 -0
- package/dist/{chunk-LCQSG4M6.js → chunk-4XFXB37X.js} +22 -18
- package/dist/chunk-4XFXB37X.js.map +1 -0
- package/dist/{chunk-AEJXZBVR.cjs → chunk-5MAYUGTE.cjs} +110 -103
- package/dist/chunk-5MAYUGTE.cjs.map +1 -0
- package/dist/{chunk-JDPTZUBW.js → chunk-623AOJM2.js} +4 -4
- package/dist/chunk-6NULZPVC.js +374 -0
- package/dist/chunk-6NULZPVC.js.map +1 -0
- package/dist/{chunk-2QCRZ7OL.cjs → chunk-6V6GGBDK.cjs} +12 -11
- package/dist/{chunk-2QCRZ7OL.cjs.map → chunk-6V6GGBDK.cjs.map} +1 -1
- package/dist/{chunk-WXMYDXPN.cjs → chunk-73653CJ4.cjs} +4 -3
- package/dist/chunk-73653CJ4.cjs.map +1 -0
- package/dist/{chunk-47MLKSI2.js → chunk-ADSJ42DO.js} +6 -6
- package/dist/{chunk-PWUEPDA3.cjs → chunk-AUOEM3SF.cjs} +44 -44
- package/dist/{chunk-PWUEPDA3.cjs.map → chunk-AUOEM3SF.cjs.map} +1 -1
- package/dist/{chunk-WQHV3MRE.cjs → chunk-BQANU5BH.cjs} +12 -12
- package/dist/{chunk-WQHV3MRE.cjs.map → chunk-BQANU5BH.cjs.map} +1 -1
- package/dist/{chunk-KXOBZGQO.js → chunk-C23RQVRK.js} +21 -14
- package/dist/chunk-C23RQVRK.js.map +1 -0
- package/dist/{chunk-2VDK27IF.cjs → chunk-CW3AFJBR.cjs} +312 -342
- package/dist/chunk-CW3AFJBR.cjs.map +1 -0
- package/dist/{chunk-MQ2XQ4MX.js → chunk-DUE3HCZD.js} +6 -6
- package/dist/chunk-DUE3HCZD.js.map +1 -0
- package/dist/{chunk-OMOBMXD5.cjs → chunk-EH5KXQXY.cjs} +7 -2
- package/dist/chunk-EH5KXQXY.cjs.map +1 -0
- package/dist/{chunk-ZS2WA357.js → chunk-EPARJI4V.js} +147 -129
- package/dist/chunk-EPARJI4V.js.map +1 -0
- package/dist/{chunk-HZSSEYJS.cjs → chunk-FDRUAL3Z.cjs} +30 -30
- package/dist/{chunk-HZSSEYJS.cjs.map → chunk-FDRUAL3Z.cjs.map} +1 -1
- package/dist/{chunk-T7SW6OWV.js → chunk-IQBMAE3F.js} +5 -5
- package/dist/{chunk-RUDWMKYX.js → chunk-JHQUHFLX.js} +8 -8
- package/dist/{chunk-HELJTLNC.cjs → chunk-KUYZMSMF.cjs} +12 -12
- package/dist/chunk-KUYZMSMF.cjs.map +1 -0
- package/dist/chunk-LE5XMIFJ.cjs +14 -0
- package/dist/chunk-LE5XMIFJ.cjs.map +1 -0
- package/dist/{chunk-EL2OEJQC.cjs → chunk-LLTEGXWZ.cjs} +56 -56
- package/dist/{chunk-EL2OEJQC.cjs.map → chunk-LLTEGXWZ.cjs.map} +1 -1
- package/dist/chunk-MQUCCSWG.js +14 -0
- package/dist/chunk-MQUCCSWG.js.map +1 -0
- package/dist/{chunk-NNDYYEW5.js → chunk-N4FGA3H4.js} +5 -5
- package/dist/{chunk-ZHOSSWUM.js → chunk-NEZJ7ZP5.js} +4 -3
- package/dist/chunk-NEZJ7ZP5.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-HJIQT3S5.js → chunk-OBMBSU2S.js} +100 -84
- package/dist/chunk-OBMBSU2S.js.map +1 -0
- package/dist/{chunk-KAVU6T6J.js → chunk-OSHZQR3W.js} +5 -5
- package/dist/{chunk-GTTPVJSD.cjs → chunk-P6KYXFZC.cjs} +265 -247
- package/dist/chunk-P6KYXFZC.cjs.map +1 -0
- package/dist/{chunk-CDELOHDY.cjs → chunk-R2BLBV43.cjs} +23 -23
- package/dist/{chunk-CDELOHDY.cjs.map → chunk-R2BLBV43.cjs.map} +1 -1
- package/dist/{chunk-NOKWNK2O.js → chunk-RJRX34BZ.js} +3 -2
- package/dist/{chunk-ZGZEJCRV.js → chunk-T43RZTUT.js} +166 -196
- package/dist/chunk-T43RZTUT.js.map +1 -0
- package/dist/chunk-TLGX43P6.cjs +374 -0
- package/dist/chunk-TLGX43P6.cjs.map +1 -0
- package/dist/{chunk-POBM7MGR.js → chunk-U3LOLYAU.js} +2 -2
- package/dist/{chunk-RDG4VI6E.cjs → chunk-UEKXVCKC.cjs} +103 -93
- package/dist/chunk-UEKXVCKC.cjs.map +1 -0
- package/dist/{chunk-PMWCQSQX.js → chunk-VCLL5C7J.js} +5 -5
- package/dist/{chunk-SG37UBDO.js → chunk-VRS6WCEK.js} +20 -10
- package/dist/chunk-VRS6WCEK.js.map +1 -0
- package/dist/{chunk-ZC24WB7Y.cjs → chunk-WEYDDIBQ.cjs} +14 -14
- package/dist/{chunk-ZC24WB7Y.cjs.map → chunk-WEYDDIBQ.cjs.map} +1 -1
- package/dist/{chunk-5DNCCN6X.cjs → chunk-X4HDKFW5.cjs} +27 -27
- package/dist/{chunk-5DNCCN6X.cjs.map → chunk-X4HDKFW5.cjs.map} +1 -1
- package/dist/{chunk-SLVDAHHK.cjs → chunk-X4P4TQXH.cjs} +5 -5
- package/dist/{chunk-SLVDAHHK.cjs.map → chunk-X4P4TQXH.cjs.map} +1 -1
- package/dist/{chunk-GLLXHMH2.cjs → chunk-XA3UEJIW.cjs} +3 -3
- package/dist/{chunk-GLLXHMH2.cjs.map → chunk-XA3UEJIW.cjs.map} +1 -1
- package/dist/{chunk-K574XHMM.js → chunk-YBMUEEM5.js} +2 -2
- package/dist/{chunk-PZ4GT5JO.cjs → chunk-ZKVOS57Q.cjs} +316 -300
- package/dist/chunk-ZKVOS57Q.cjs.map +1 -0
- 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 +44 -40
- package/dist/diff.cjs.map +1 -1
- package/dist/diff.js +17 -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 +98 -104
- 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 +66 -72
- 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 +302 -412
- 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 +211 -321
- 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-LCQSG4M6.js.map +0 -1
- package/dist/chunk-MQ2XQ4MX.js.map +0 -1
- package/dist/chunk-ND5XJVK2.cjs.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-RDG4VI6E.cjs.map +0 -1
- package/dist/chunk-SG37UBDO.js.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-JDPTZUBW.js.map → chunk-623AOJM2.js.map} +0 -0
- /package/dist/{chunk-47MLKSI2.js.map → chunk-ADSJ42DO.js.map} +0 -0
- /package/dist/{chunk-T7SW6OWV.js.map → chunk-IQBMAE3F.js.map} +0 -0
- /package/dist/{chunk-RUDWMKYX.js.map → chunk-JHQUHFLX.js.map} +0 -0
- /package/dist/{chunk-NNDYYEW5.js.map → chunk-N4FGA3H4.js.map} +0 -0
- /package/dist/{chunk-KAVU6T6J.js.map → chunk-OSHZQR3W.js.map} +0 -0
- /package/dist/{chunk-NOKWNK2O.js.map → chunk-RJRX34BZ.js.map} +0 -0
- /package/dist/{chunk-POBM7MGR.js.map → chunk-U3LOLYAU.js.map} +0 -0
- /package/dist/{chunk-PMWCQSQX.js.map → chunk-VCLL5C7J.js.map} +0 -0
- /package/dist/{chunk-K574XHMM.js.map → chunk-YBMUEEM5.js.map} +0 -0
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkZKVOS57Qcjs = require('./chunk-ZKVOS57Q.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -61,7 +61,8 @@ var _chunkPZ4GT5JOcjs = require('./chunk-PZ4GT5JO.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
var _chunk4SLJNZSMcjs = require('./chunk-4SLJNZSM.cjs');
|
|
65
66
|
|
|
66
67
|
// src/view/react/use-editor-state.ts
|
|
67
68
|
var _react = require('react');
|
|
@@ -93,7 +94,7 @@ function isCrossSelection(selection) {
|
|
|
93
94
|
}
|
|
94
95
|
function selectionDecorations(state, mode) {
|
|
95
96
|
if (mode !== "decorations" || !isCrossSelection(state.selection)) return [];
|
|
96
|
-
return
|
|
97
|
+
return _chunkZKVOS57Qcjs.markRanges.call(void 0, state).map(({ block, region, from, to }) => ({
|
|
97
98
|
kind: "inline",
|
|
98
99
|
block,
|
|
99
100
|
region,
|
|
@@ -104,9 +105,9 @@ function selectionDecorations(state, mode) {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
// src/view/dom/attributes.ts
|
|
107
|
-
var sortedEntries = (attrs) =>
|
|
108
|
+
var sortedEntries = (attrs) => _chunk4SLJNZSMcjs.dataAttributes.call(void 0, attrs, "");
|
|
108
109
|
function setAttributes(element, attrs, prefix = "") {
|
|
109
|
-
for (const [name, value] of
|
|
110
|
+
for (const [name, value] of _chunk4SLJNZSMcjs.writtenAttrs.call(void 0, _chunk4SLJNZSMcjs.dataAttributes.call(void 0, attrs, prefix))) element.setAttribute(name, value);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
// src/view/dom/segments.ts
|
|
@@ -121,7 +122,7 @@ function decorationRanges(decorations, length) {
|
|
|
121
122
|
return ranges;
|
|
122
123
|
}
|
|
123
124
|
function toSegments(inline, decorations) {
|
|
124
|
-
const length =
|
|
125
|
+
const length = _chunk4SLJNZSMcjs.inlineLength.call(void 0, inline);
|
|
125
126
|
const ranges = decorationRanges(decorations, length);
|
|
126
127
|
const widgets = decorations.filter((decoration) => decoration.kind === "widget").map((decoration) => ({ decoration, at: Math.min(Math.max(decoration.offset, 0), length) })).sort((a, b) => a.at - b.at || (_nullishCoalesce(a.decoration.side, () => ( 1))) - (_nullishCoalesce(b.decoration.side, () => ( 1))));
|
|
127
128
|
const edges = [...ranges.flatMap((range) => [range.from, range.to]), ...widgets.map((widget) => widget.at)];
|
|
@@ -137,7 +138,7 @@ function toSegments(inline, decorations) {
|
|
|
137
138
|
};
|
|
138
139
|
let start = 0;
|
|
139
140
|
for (const node of inline) {
|
|
140
|
-
const end = start +
|
|
141
|
+
const end = start + _chunk4SLJNZSMcjs.nodeLength.call(void 0, node);
|
|
141
142
|
if (node.kind === "atom") {
|
|
142
143
|
placeWidgets(start);
|
|
143
144
|
segments.push({ kind: "atom", node, decorations: covering(start, end), from: start });
|
|
@@ -187,7 +188,7 @@ function create(doc, tag, attributes) {
|
|
|
187
188
|
return element;
|
|
188
189
|
}
|
|
189
190
|
function linkElement({ href = "", title } = {}, doc) {
|
|
190
|
-
const safe =
|
|
191
|
+
const safe = _chunk4SLJNZSMcjs.sanitizeHref.call(void 0, href);
|
|
191
192
|
if (safe === null) return create(doc, "span", [["data-quoin-link", ""]]);
|
|
192
193
|
const anchor = create(doc, "a", [["href", safe], ["data-quoin-link", ""]]);
|
|
193
194
|
if (title) anchor.title = title;
|
|
@@ -195,8 +196,8 @@ function linkElement({ href = "", title } = {}, doc) {
|
|
|
195
196
|
}
|
|
196
197
|
function markElement2(mark2, doc) {
|
|
197
198
|
if (mark2.type === "link") return linkElement(mark2.attrs, doc);
|
|
198
|
-
const { tag, attrs } =
|
|
199
|
-
return create(doc, tag,
|
|
199
|
+
const { tag, attrs } = _chunk4SLJNZSMcjs.markElement.call(void 0, mark2);
|
|
200
|
+
return create(doc, tag, _chunk4SLJNZSMcjs.writtenAttrs.call(void 0, attrs));
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
// src/view/dom/wrappers.ts
|
|
@@ -393,8 +394,8 @@ function reconcileChildren(parent, specs) {
|
|
|
393
394
|
// src/view/dom/text-diff.ts
|
|
394
395
|
function textDiff(before, after, caretHint) {
|
|
395
396
|
if (before === after) return null;
|
|
396
|
-
const prefix =
|
|
397
|
-
const suffix =
|
|
397
|
+
const prefix = _chunkZKVOS57Qcjs.commonPrefix.call(void 0, before, after);
|
|
398
|
+
const suffix = _chunkZKVOS57Qcjs.commonSuffix.call(void 0, before, after);
|
|
398
399
|
const shared = Math.min(suffix, Math.min(before.length, after.length) - prefix);
|
|
399
400
|
const removed = before.length - prefix - shared;
|
|
400
401
|
const inserted = after.length - prefix - shared;
|
|
@@ -499,12 +500,12 @@ function specsFor(segment, options, doc) {
|
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
502
|
function needsFiller(inline) {
|
|
502
|
-
const content =
|
|
503
|
+
const content = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
503
504
|
return content === "" || content.endsWith("\n");
|
|
504
505
|
}
|
|
505
506
|
function renderInline(host, inline, decorations, options = {}) {
|
|
506
507
|
const doc = host.ownerDocument;
|
|
507
|
-
const length =
|
|
508
|
+
const length = _chunk4SLJNZSMcjs.inlineLength.call(void 0, inline);
|
|
508
509
|
const specs = toSegments(inline, decorations).flatMap((segment) => specsFor(segment, options, doc));
|
|
509
510
|
if (needsFiller(inline)) specs.push(fillerSpec(doc, length));
|
|
510
511
|
reconcileChildren(host, specs);
|
|
@@ -582,10 +583,10 @@ function readSelection(registry, domSelection, blockAt2 = () => void 0) {
|
|
|
582
583
|
if (!domSelection || !anchorNode || !focusNode) return null;
|
|
583
584
|
const anchor = domToPos(registry, anchorNode, domSelection.anchorOffset);
|
|
584
585
|
const head = domToPos(registry, focusNode, domSelection.focusOffset);
|
|
585
|
-
if (anchor && head) return
|
|
586
|
+
if (anchor && head) return _chunkZKVOS57Qcjs.textSelection.call(void 0, anchor, head);
|
|
586
587
|
if (anchor || head || registry.locate(anchorNode) || registry.locate(focusNode)) return null;
|
|
587
588
|
const block = blockAt2(anchorNode);
|
|
588
|
-
return block !== void 0 && block === blockAt2(focusNode) ?
|
|
589
|
+
return block !== void 0 && block === blockAt2(focusNode) ? _chunkZKVOS57Qcjs.nodeSelection.call(void 0, block) : null;
|
|
589
590
|
}
|
|
590
591
|
function selectBlock(domSelection, element) {
|
|
591
592
|
if (!element) return false;
|
|
@@ -602,7 +603,7 @@ function writeSelection(registry, selection, domSelection, blockElement) {
|
|
|
602
603
|
if (selection.kind !== "text") return false;
|
|
603
604
|
const { anchor, head } = selection;
|
|
604
605
|
if (anchor.block !== head.block || anchor.region !== head.region) return false;
|
|
605
|
-
if (
|
|
606
|
+
if (_chunkZKVOS57Qcjs.sameSelection.call(void 0, readSelection(registry, domSelection), selection)) return true;
|
|
606
607
|
const base = posToDom(registry, anchor, anchor.offset < head.offset ? 1 : -1);
|
|
607
608
|
const extent = posToDom(registry, head, head.offset < anchor.offset ? 1 : -1);
|
|
608
609
|
if (!base || !extent) return false;
|
|
@@ -610,6 +611,15 @@ function writeSelection(registry, selection, domSelection, blockElement) {
|
|
|
610
611
|
return true;
|
|
611
612
|
}
|
|
612
613
|
|
|
614
|
+
// src/view/dom/listen.ts
|
|
615
|
+
function listen(target, handlers, options) {
|
|
616
|
+
const entries = Object.entries(handlers);
|
|
617
|
+
for (const [type, handler] of entries) target.addEventListener(type, handler, options);
|
|
618
|
+
return () => {
|
|
619
|
+
for (const [type, handler] of entries) target.removeEventListener(type, handler, options);
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
|
|
613
623
|
// src/view/navigation/node-entry.ts
|
|
614
624
|
var NODE_ENTRY = "data-quoin-node-entry";
|
|
615
625
|
var entersAsNode = (controller, block) => _optionalChain([controller, 'access', _25 => _25.blockElement, 'call', _26 => _26(block), 'optionalAccess', _27 => _27.querySelector, 'call', _28 => _28(`[${NODE_ENTRY}]`)]) != null;
|
|
@@ -655,8 +665,8 @@ var known = /* @__PURE__ */ new WeakMap();
|
|
|
655
665
|
function hidersOf(doc) {
|
|
656
666
|
let hiders = known.get(doc);
|
|
657
667
|
if (hiders === void 0) {
|
|
658
|
-
const first = doc.blocks.findIndex(
|
|
659
|
-
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null :
|
|
668
|
+
const first = doc.blocks.findIndex(_chunkZKVOS57Qcjs.isClosedToggle);
|
|
669
|
+
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null : _chunkZKVOS57Qcjs.hidingToggle.call(void 0, doc, index + 1));
|
|
660
670
|
known.set(doc, hiders);
|
|
661
671
|
}
|
|
662
672
|
return hiders;
|
|
@@ -665,7 +675,7 @@ var hidingToggleAt = (doc, index) => _nullishCoalesce(hidersOf(doc)[index], () =
|
|
|
665
675
|
function isHiddenAt(doc, index, choices) {
|
|
666
676
|
if (choices.size === 0) return hidingToggleAt(doc, index) !== null;
|
|
667
677
|
const closed = (block) => block.type === "TOGGLE" && !shownOpen(block, choices);
|
|
668
|
-
return
|
|
678
|
+
return _chunkZKVOS57Qcjs.hidingToggle.call(void 0, doc, index + 1, closed) !== null;
|
|
669
679
|
}
|
|
670
680
|
var visibleBlockIndexes = (doc) => hidersOf(doc).flatMap((hider, index) => hider === null ? [index] : []);
|
|
671
681
|
function drawnBlockCount(doc, start = 0, end = doc.blocks.length) {
|
|
@@ -690,13 +700,13 @@ function neighbourBlock(doc, from, direction, accept = anyBlock) {
|
|
|
690
700
|
}
|
|
691
701
|
function entryEdge(controller, block, direction) {
|
|
692
702
|
const { doc, schema } = controller.editor.state;
|
|
693
|
-
const edge = direction < 0 ?
|
|
703
|
+
const edge = direction < 0 ? _chunkZKVOS57Qcjs.endOf.call(void 0, doc, schema, block) : _chunkZKVOS57Qcjs.startOf.call(void 0, doc, schema, block);
|
|
694
704
|
if (edge.kind !== "text") return edge;
|
|
695
705
|
const drawn = controller.registry.get(edge.head.block, edge.head.region) !== void 0;
|
|
696
|
-
return drawn && !entersAsNode(controller, block) ? edge :
|
|
706
|
+
return drawn && !entersAsNode(controller, block) ? edge : _chunkZKVOS57Qcjs.nodeSelection.call(void 0, block);
|
|
697
707
|
}
|
|
698
|
-
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ?
|
|
699
|
-
var holdsTextHead = (controller) => (block) =>
|
|
708
|
+
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ? _chunkZKVOS57Qcjs.nodeSelection.call(void 0, block) : null;
|
|
709
|
+
var holdsTextHead = (controller) => (block) => _chunkZKVOS57Qcjs.isTextFlow.call(void 0, controller.editor.state.schema, block) && entryEdge(controller, block.id, 1).kind === "text";
|
|
700
710
|
function neighbourHead(controller, from, direction) {
|
|
701
711
|
const target = neighbourBlock(controller.editor.state.doc, from, direction, holdsTextHead(controller));
|
|
702
712
|
const edge = target && entryEdge(controller, target.id, direction);
|
|
@@ -829,11 +839,13 @@ function createCrossBlockPointer(controller) {
|
|
|
829
839
|
const doc = root.ownerDocument;
|
|
830
840
|
const view = doc.defaultView;
|
|
831
841
|
let press = null;
|
|
842
|
+
let unfollow = () => {
|
|
843
|
+
};
|
|
832
844
|
let last = { x: 0, y: 0 };
|
|
833
845
|
let preventMouseDown = false;
|
|
834
846
|
const scroll = createAutoScroll(root, () => follow(last.x, last.y));
|
|
835
847
|
function select(selection) {
|
|
836
|
-
if (
|
|
848
|
+
if (_chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, controller.editor.state.selection)) return;
|
|
837
849
|
dispatchSelection(controller, selection);
|
|
838
850
|
}
|
|
839
851
|
function startDragging() {
|
|
@@ -849,24 +861,21 @@ function createCrossBlockPointer(controller) {
|
|
|
849
861
|
if (current.anchor === null) return;
|
|
850
862
|
startDragging();
|
|
851
863
|
}
|
|
852
|
-
select(
|
|
864
|
+
select(_chunkZKVOS57Qcjs.textSelection.call(void 0, current.anchor, caretPosAt(controller, target, x, y)));
|
|
853
865
|
}
|
|
854
866
|
function followBlocks(current, x, y) {
|
|
855
867
|
if (!controller.dragging && Math.hypot(x - current.x, y - current.y) < DRAG_DISTANCE) return;
|
|
856
868
|
const block = blockAt(controller, x, y);
|
|
857
869
|
if (block === null) return;
|
|
858
870
|
startDragging();
|
|
859
|
-
select(
|
|
871
|
+
select(_chunkZKVOS57Qcjs.blockRangeSelection.call(void 0, current.start, block));
|
|
860
872
|
}
|
|
861
873
|
function follow(x, y) {
|
|
862
874
|
if (_optionalChain([press, 'optionalAccess', _40 => _40.kind]) === "text") followText(press, x, y);
|
|
863
875
|
else if (_optionalChain([press, 'optionalAccess', _41 => _41.kind]) === "blocks") followBlocks(press, x, y);
|
|
864
876
|
}
|
|
865
877
|
function release() {
|
|
866
|
-
|
|
867
|
-
doc.removeEventListener("pointerup", end);
|
|
868
|
-
doc.removeEventListener("pointercancel", end);
|
|
869
|
-
view.removeEventListener("blur", end);
|
|
878
|
+
unfollow();
|
|
870
879
|
scroll.stop();
|
|
871
880
|
press = null;
|
|
872
881
|
const dragged = controller.dragging;
|
|
@@ -907,26 +916,26 @@ function createCrossBlockPointer(controller) {
|
|
|
907
916
|
press = { kind: "blocks", start: block, x: event.clientX, y: event.clientY };
|
|
908
917
|
if (!event.shiftKey && entryEdge(controller, block, 1).kind === "node") {
|
|
909
918
|
controller.nodeReveal.pressed(block);
|
|
910
|
-
select(
|
|
919
|
+
select(_chunkZKVOS57Qcjs.nodeSelection.call(void 0, block));
|
|
911
920
|
}
|
|
912
921
|
} else {
|
|
913
922
|
return;
|
|
914
923
|
}
|
|
915
|
-
doc
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
924
|
+
const unfollowDocument = listen(doc, { pointermove: onPointerMove, pointerup: end, pointercancel: end });
|
|
925
|
+
const unfollowView = listen(view, { blur: end });
|
|
926
|
+
unfollow = () => {
|
|
927
|
+
unfollowDocument();
|
|
928
|
+
unfollowView();
|
|
929
|
+
};
|
|
919
930
|
}
|
|
920
931
|
function onMouseDown(event) {
|
|
921
932
|
if (preventMouseDown) event.preventDefault();
|
|
922
933
|
preventMouseDown = false;
|
|
923
934
|
}
|
|
924
|
-
root
|
|
925
|
-
root.addEventListener("mousedown", onMouseDown);
|
|
935
|
+
const unlisten = listen(root, { pointerdown: onPointerDown, mousedown: onMouseDown });
|
|
926
936
|
return () => {
|
|
927
937
|
release();
|
|
928
|
-
|
|
929
|
-
root.removeEventListener("mousedown", onMouseDown);
|
|
938
|
+
unlisten();
|
|
930
939
|
};
|
|
931
940
|
}
|
|
932
941
|
};
|
|
@@ -935,7 +944,7 @@ function createCrossBlockPointer(controller) {
|
|
|
935
944
|
// src/view/selection/paint-selection.ts
|
|
936
945
|
var NAME = "quoin-selection";
|
|
937
946
|
function coveredRanges(controller) {
|
|
938
|
-
return
|
|
947
|
+
return _chunkZKVOS57Qcjs.markRanges.call(void 0, controller.editor.state).flatMap(({ block, region, from, to }) => {
|
|
939
948
|
const host = controller.registry.get(block, region);
|
|
940
949
|
const map = host && domMapOf(host);
|
|
941
950
|
if (!host || !map) return [];
|
|
@@ -1006,7 +1015,7 @@ function heldBySink(selection) {
|
|
|
1006
1015
|
}
|
|
1007
1016
|
var NO_TEXT = "\xA0";
|
|
1008
1017
|
function selectionText(state) {
|
|
1009
|
-
const text =
|
|
1018
|
+
const text = _chunkZKVOS57Qcjs.markRanges.call(void 0, state).map((range) => _chunk4SLJNZSMcjs.inlinePlainText.call(void 0, _chunkZKVOS57Qcjs.rangeContent.call(void 0, state, range), state.schema)).join("\n");
|
|
1010
1019
|
return text === "" ? NO_TEXT : text;
|
|
1011
1020
|
}
|
|
1012
1021
|
var focusInPlace = (sink) => inPlace(sink, () => sink.focus({ preventScroll: true }));
|
|
@@ -1029,7 +1038,7 @@ function focusSink(controller) {
|
|
|
1029
1038
|
_optionalChain([sink, 'access', _46 => _46.ownerDocument, 'access', _47 => _47.getSelection, 'call', _48 => _48(), 'optionalAccess', _49 => _49.selectAllChildren, 'call', _50 => _50(sink)]);
|
|
1030
1039
|
}
|
|
1031
1040
|
function selectedBlockName({ doc, schema, selection }, blockLabel) {
|
|
1032
|
-
const block = _optionalChain([selection, 'optionalAccess', _51 => _51.kind]) === "node" ?
|
|
1041
|
+
const block = _optionalChain([selection, 'optionalAccess', _51 => _51.kind]) === "node" ? _chunk4SLJNZSMcjs.blockById.call(void 0, doc, selection.block) : void 0;
|
|
1033
1042
|
return block === void 0 ? null : _nullishCoalesce(_optionalChain([blockLabel, 'optionalCall', _52 => _52(block, schema)]), () => ( ""));
|
|
1034
1043
|
}
|
|
1035
1044
|
function clearSink(controller) {
|
|
@@ -1098,19 +1107,27 @@ var nodeOf = (selection) => _optionalChain([selection, 'optionalAccess', _67 =>
|
|
|
1098
1107
|
function createNodeReveal(element) {
|
|
1099
1108
|
let shown = null;
|
|
1100
1109
|
let pressed = null;
|
|
1110
|
+
let owed = null;
|
|
1101
1111
|
return {
|
|
1102
1112
|
pressed(block) {
|
|
1103
1113
|
pressed = block;
|
|
1104
1114
|
},
|
|
1105
1115
|
follow(selection) {
|
|
1106
|
-
|
|
1116
|
+
const block = nodeOf(selection);
|
|
1117
|
+
if (block !== shown) shown = null;
|
|
1118
|
+
if (block !== owed) owed = null;
|
|
1107
1119
|
},
|
|
1108
1120
|
settle(selection) {
|
|
1109
|
-
|
|
1121
|
+
const block = nodeOf(selection);
|
|
1122
|
+
if (block !== shown) owed = block;
|
|
1123
|
+
shown = block;
|
|
1110
1124
|
},
|
|
1111
|
-
show(selection) {
|
|
1125
|
+
show(selection, local) {
|
|
1112
1126
|
const block = nodeOf(selection);
|
|
1113
|
-
if (block !== null && block !==
|
|
1127
|
+
if (block !== null && block !== pressed && (block !== shown || local && block === owed)) {
|
|
1128
|
+
_optionalChain([element, 'call', _68 => _68(block), 'optionalAccess', _69 => _69.scrollIntoView, 'call', _70 => _70({ block: "nearest" })]);
|
|
1129
|
+
}
|
|
1130
|
+
if (local) owed = null;
|
|
1114
1131
|
shown = block;
|
|
1115
1132
|
pressed = null;
|
|
1116
1133
|
}
|
|
@@ -1158,7 +1175,7 @@ function createElementSlot(changed) {
|
|
|
1158
1175
|
|
|
1159
1176
|
// src/view/controller/selection-element.ts
|
|
1160
1177
|
function elementFor({ doc }, selection, rendered) {
|
|
1161
|
-
const id =
|
|
1178
|
+
const id = _chunkZKVOS57Qcjs.headBlockId.call(void 0, selection);
|
|
1162
1179
|
const index = id === null ? void 0 : doc.index.get(id);
|
|
1163
1180
|
if (id === null || index === void 0) return void 0;
|
|
1164
1181
|
const hiding = hidingToggleAt(doc, index);
|
|
@@ -1171,7 +1188,7 @@ function selectionElement(state, rendered) {
|
|
|
1171
1188
|
if (doc.blocks.length === 0) return _nullishCoalesce(_optionalChain([rendered, 'access', _75 => _75.empty, 'optionalCall', _76 => _76()]), () => ( void 0));
|
|
1172
1189
|
const sink = heldBySink(selection) ? _optionalChain([rendered, 'access', _77 => _77.sink, 'optionalCall', _78 => _78()]) : null;
|
|
1173
1190
|
if (sink) return sink;
|
|
1174
|
-
return _nullishCoalesce(elementFor(state, selection, rendered), () => ( elementFor(state,
|
|
1191
|
+
return _nullishCoalesce(elementFor(state, selection, rendered), () => ( elementFor(state, _chunkZKVOS57Qcjs.startOf.call(void 0, doc, schema, doc.blocks[0].id), rendered)));
|
|
1175
1192
|
}
|
|
1176
1193
|
|
|
1177
1194
|
// src/view/controller/tab-stop.ts
|
|
@@ -1238,9 +1255,9 @@ function ownsFocus(controller, doc) {
|
|
|
1238
1255
|
function focusTarget(state, target) {
|
|
1239
1256
|
const { doc, schema, selection } = state;
|
|
1240
1257
|
if (doc.blocks.length === 0) return null;
|
|
1241
|
-
if (target === "end") return
|
|
1242
|
-
if (target === "start" || target === void 0 && selection === null) return
|
|
1243
|
-
return target === void 0 ? selection :
|
|
1258
|
+
if (target === "end") return _chunkZKVOS57Qcjs.endOf.call(void 0, doc, schema, doc.blocks[doc.blocks.length - 1].id);
|
|
1259
|
+
if (target === "start" || target === void 0 && selection === null) return _chunkZKVOS57Qcjs.startOf.call(void 0, doc, schema, doc.blocks[0].id);
|
|
1260
|
+
return target === void 0 ? selection : _chunkZKVOS57Qcjs.textSelection.call(void 0, target);
|
|
1244
1261
|
}
|
|
1245
1262
|
|
|
1246
1263
|
// src/view/controller/host-decorations.ts
|
|
@@ -1256,7 +1273,7 @@ function decorationsByHost(decorations) {
|
|
|
1256
1273
|
return byHost;
|
|
1257
1274
|
}
|
|
1258
1275
|
function sameDecoration(a, b) {
|
|
1259
|
-
if (a.kind !== b.kind || a.block !== b.block || !
|
|
1276
|
+
if (a.kind !== b.kind || a.block !== b.block || !_chunk4SLJNZSMcjs.sameAttrs.call(void 0, a.attrs, b.attrs)) return false;
|
|
1260
1277
|
if (a.kind === "inline" && b.kind === "inline") {
|
|
1261
1278
|
return a.region === b.region && a.from === b.from && a.to === b.to;
|
|
1262
1279
|
}
|
|
@@ -1267,7 +1284,7 @@ function sameDecoration(a, b) {
|
|
|
1267
1284
|
return true;
|
|
1268
1285
|
}
|
|
1269
1286
|
function sameDecorations(a, b) {
|
|
1270
|
-
return a === b ||
|
|
1287
|
+
return a === b || _chunk4SLJNZSMcjs.sameItems.call(void 0, a, b, sameDecoration);
|
|
1271
1288
|
}
|
|
1272
1289
|
var byMode = { highlight: /* @__PURE__ */ new WeakMap(), decorations: /* @__PURE__ */ new WeakMap() };
|
|
1273
1290
|
function hostDecorations(editor, block, region, mode = "highlight") {
|
|
@@ -1283,7 +1300,7 @@ function hostDecorations(editor, block, region, mode = "highlight") {
|
|
|
1283
1300
|
|
|
1284
1301
|
// src/view/controller/region-inline.ts
|
|
1285
1302
|
function regionInline(state, block, region) {
|
|
1286
|
-
const regions = _optionalChain([
|
|
1303
|
+
const regions = _optionalChain([_chunk4SLJNZSMcjs.blockById.call(void 0, state.doc, block), 'optionalAccess', _86 => _86.regions]);
|
|
1287
1304
|
return regions && Object.hasOwn(regions, region) ? regions[region] : void 0;
|
|
1288
1305
|
}
|
|
1289
1306
|
|
|
@@ -1333,7 +1350,7 @@ function createOutsideChanges(editorHasFocus, movedFrom) {
|
|
|
1333
1350
|
}
|
|
1334
1351
|
const from = _nullishCoalesce(moved, () => ( (outside && !settled ? movedFrom(tr.before.selection) : null)));
|
|
1335
1352
|
settled ||= outside;
|
|
1336
|
-
moved = from &&
|
|
1353
|
+
moved = from && _chunkZKVOS57Qcjs.mapSelection.call(void 0, from, (pos, assoc) => tr.mapPos(pos, assoc), tr.before.doc);
|
|
1337
1354
|
},
|
|
1338
1355
|
takeFocused() {
|
|
1339
1356
|
const value = focused;
|
|
@@ -1426,7 +1443,7 @@ function handleCopy(controller, event, cut) {
|
|
|
1426
1443
|
clipboardData.setData("text/plain", copied.text);
|
|
1427
1444
|
clipboardData.setData("text/html", wrapSliceHTML(copied.html, copied.json));
|
|
1428
1445
|
clipboardData.setData(QUOIN_SLICE_TYPE, copied.json);
|
|
1429
|
-
if (cut) controller.run(
|
|
1446
|
+
if (cut) controller.run(_chunkZKVOS57Qcjs.deleteSelection);
|
|
1430
1447
|
}
|
|
1431
1448
|
function handlePaste(controller, event) {
|
|
1432
1449
|
if (!event.clipboardData) return;
|
|
@@ -1458,7 +1475,7 @@ function handleDrop(controller, event) {
|
|
|
1458
1475
|
return;
|
|
1459
1476
|
}
|
|
1460
1477
|
const pos = dropPos(controller, event.clientX, event.clientY);
|
|
1461
|
-
if (pos)
|
|
1478
|
+
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(_chunkZKVOS57Qcjs.textSelection.call(void 0, pos)).setOrigin("drop"));
|
|
1462
1479
|
pasteTransfer(controller, dataTransfer);
|
|
1463
1480
|
}
|
|
1464
1481
|
function handleDragOver(event) {
|
|
@@ -1586,29 +1603,29 @@ function createSinkComposition(controller) {
|
|
|
1586
1603
|
var LINE_BREAK = "\n";
|
|
1587
1604
|
var transposeChars = (state, dispatch) => {
|
|
1588
1605
|
const { selection } = state;
|
|
1589
|
-
if (_optionalChain([selection, 'optionalAccess', _110 => _110.kind]) !== "text" || !
|
|
1606
|
+
if (_optionalChain([selection, 'optionalAccess', _110 => _110.kind]) !== "text" || !_chunkZKVOS57Qcjs.isCollapsed.call(void 0, selection)) return false;
|
|
1590
1607
|
const { head } = selection;
|
|
1591
|
-
const inline = _optionalChain([
|
|
1608
|
+
const inline = _optionalChain([_chunk4SLJNZSMcjs.blockById.call(void 0, state.doc, head.block), 'optionalAccess', _111 => _111.regions, 'access', _112 => _112[head.region]]);
|
|
1592
1609
|
if (inline === void 0) return false;
|
|
1593
|
-
const value =
|
|
1610
|
+
const value = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1594
1611
|
const atLineEnd = head.offset === value.length || value[head.offset] === LINE_BREAK;
|
|
1595
|
-
const end = atLineEnd ? head.offset :
|
|
1596
|
-
const middle =
|
|
1597
|
-
const start =
|
|
1612
|
+
const end = atLineEnd ? head.offset : _chunkZKVOS57Qcjs.nextGraphemeOffset.call(void 0, value, head.offset);
|
|
1613
|
+
const middle = _chunkZKVOS57Qcjs.prevGraphemeOffset.call(void 0, value, end);
|
|
1614
|
+
const start = _chunkZKVOS57Qcjs.prevGraphemeOffset.call(void 0, value, middle);
|
|
1598
1615
|
if (start === middle || value.slice(start, end).includes(LINE_BREAK)) return false;
|
|
1599
|
-
const swapped = [...
|
|
1600
|
-
const tr = new (0,
|
|
1601
|
-
tr.step(
|
|
1602
|
-
_optionalChain([dispatch, 'optionalCall', _113 => _113(tr.setSelection(
|
|
1616
|
+
const swapped = [..._chunk4SLJNZSMcjs.sliceInline.call(void 0, inline, middle, end), ..._chunk4SLJNZSMcjs.sliceInline.call(void 0, inline, start, middle)];
|
|
1617
|
+
const tr = new (0, _chunkZKVOS57Qcjs.Transaction)(state).setOrigin("input");
|
|
1618
|
+
tr.step(_chunkZKVOS57Qcjs.replaceInlineStep.call(void 0, head.block, head.region, start, end, swapped));
|
|
1619
|
+
_optionalChain([dispatch, 'optionalCall', _113 => _113(tr.setSelection(_chunkZKVOS57Qcjs.textSelection.call(void 0, { ...head, offset: end })))]);
|
|
1603
1620
|
return true;
|
|
1604
1621
|
};
|
|
1605
1622
|
|
|
1606
1623
|
// src/view/input/replace-range.ts
|
|
1607
1624
|
function replaceRange(editor, range, text, withRules) {
|
|
1608
1625
|
const dispatch = (tr) => editor.dispatch(tr);
|
|
1609
|
-
dispatch(editor.createTransaction().setSelection(
|
|
1610
|
-
if (text === "") return
|
|
1611
|
-
return withRules ? editor.insertText(text) :
|
|
1626
|
+
dispatch(editor.createTransaction().setSelection(_chunkZKVOS57Qcjs.textSelection.call(void 0, range.from, range.to)).setOrigin("input"));
|
|
1627
|
+
if (text === "") return _chunkZKVOS57Qcjs.deleteSelection.call(void 0, editor.state, (tr) => dispatch(tr.setOrigin("input")));
|
|
1628
|
+
return withRules ? editor.insertText(text) : _chunkZKVOS57Qcjs.insertText.call(void 0, text, { origin: "input" })(editor.state, dispatch);
|
|
1612
1629
|
}
|
|
1613
1630
|
|
|
1614
1631
|
// src/view/input/target-range.ts
|
|
@@ -1619,13 +1636,13 @@ function targetRangeToModel(controller, event) {
|
|
|
1619
1636
|
const to = domToPos(controller.registry, range.endContainer, range.endOffset);
|
|
1620
1637
|
return from && to && { from, to };
|
|
1621
1638
|
}
|
|
1622
|
-
var isEmpty = ({ from, to }) =>
|
|
1639
|
+
var isEmpty = ({ from, to }) => _chunkZKVOS57Qcjs.sameSelection.call(void 0, _chunkZKVOS57Qcjs.textSelection.call(void 0, from), _chunkZKVOS57Qcjs.textSelection.call(void 0, to));
|
|
1623
1640
|
function targetBeyondSelection(controller, event) {
|
|
1624
1641
|
const range = targetRangeToModel(controller, event);
|
|
1625
1642
|
if (range === null || isEmpty(range)) return null;
|
|
1626
1643
|
const { doc, selection } = controller.editor.state;
|
|
1627
|
-
const selected =
|
|
1628
|
-
const same = selected !== null &&
|
|
1644
|
+
const selected = _chunkZKVOS57Qcjs.selectionRange.call(void 0, doc, selection);
|
|
1645
|
+
const same = selected !== null && _chunkZKVOS57Qcjs.sameSelection.call(void 0, _chunkZKVOS57Qcjs.textSelection.call(void 0, selected.from, selected.to), _chunkZKVOS57Qcjs.textSelection.call(void 0, range.from, range.to));
|
|
1629
1646
|
return same ? null : range;
|
|
1630
1647
|
}
|
|
1631
1648
|
|
|
@@ -1647,34 +1664,34 @@ function insertTypedText(controller, event) {
|
|
|
1647
1664
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1648
1665
|
}
|
|
1649
1666
|
function deleteContentBackward(controller, event) {
|
|
1650
|
-
if (!controller.run(
|
|
1667
|
+
if (!controller.run(_chunkZKVOS57Qcjs.undoInputRule)) targetOr((0, _chunkZKVOS57Qcjs.deleteBackward))(controller, event);
|
|
1651
1668
|
}
|
|
1652
1669
|
function insertReplacementText(controller, event) {
|
|
1653
1670
|
const text = _optionalChain([event, 'access', _117 => _117.dataTransfer, 'optionalAccess', _118 => _118.getData, 'call', _119 => _119("text/plain")]) || event.data;
|
|
1654
1671
|
if (!text) return;
|
|
1655
1672
|
const range = targetRangeToModel(controller, event);
|
|
1656
|
-
if (range === null) controller.run(
|
|
1673
|
+
if (range === null) controller.run(_chunkZKVOS57Qcjs.insertText.call(void 0, text, { origin: "input" }));
|
|
1657
1674
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1658
1675
|
}
|
|
1659
1676
|
var actions = {
|
|
1660
1677
|
insertText: insertTypedText,
|
|
1661
1678
|
insertReplacementText,
|
|
1662
1679
|
insertParagraph: (controller) => void controller.edit(() => controller.editor.handleKey(ENTER)),
|
|
1663
|
-
insertLineBreak: run(
|
|
1680
|
+
insertLineBreak: run(_chunkZKVOS57Qcjs.insertHardBreak),
|
|
1664
1681
|
deleteContentBackward,
|
|
1665
|
-
deleteContentForward: targetOr(
|
|
1666
|
-
deleteWordBackward: targetOr(
|
|
1667
|
-
deleteWordForward: targetOr(
|
|
1668
|
-
deleteSoftLineBackward: targetOr(
|
|
1669
|
-
deleteHardLineBackward: targetOr(
|
|
1670
|
-
deleteSoftLineForward: targetOr(
|
|
1671
|
-
deleteHardLineForward: targetOr(
|
|
1672
|
-
formatBold: run(
|
|
1673
|
-
formatItalic: run(
|
|
1674
|
-
formatUnderline: run(
|
|
1675
|
-
formatStrikeThrough: run(
|
|
1676
|
-
historyUndo: run(
|
|
1677
|
-
historyRedo: run(
|
|
1682
|
+
deleteContentForward: targetOr(_chunkZKVOS57Qcjs.deleteForward),
|
|
1683
|
+
deleteWordBackward: targetOr(_chunkZKVOS57Qcjs.deleteWordBackward),
|
|
1684
|
+
deleteWordForward: targetOr(_chunkZKVOS57Qcjs.deleteWordForward),
|
|
1685
|
+
deleteSoftLineBackward: targetOr(_chunkZKVOS57Qcjs.deleteToLineStart),
|
|
1686
|
+
deleteHardLineBackward: targetOr(_chunkZKVOS57Qcjs.deleteToLineStart),
|
|
1687
|
+
deleteSoftLineForward: targetOr(_chunkZKVOS57Qcjs.deleteToLineEnd),
|
|
1688
|
+
deleteHardLineForward: targetOr(_chunkZKVOS57Qcjs.deleteToLineEnd),
|
|
1689
|
+
formatBold: run(_chunkZKVOS57Qcjs.toggleMark.call(void 0, "bold")),
|
|
1690
|
+
formatItalic: run(_chunkZKVOS57Qcjs.toggleMark.call(void 0, "italic")),
|
|
1691
|
+
formatUnderline: run(_chunkZKVOS57Qcjs.toggleMark.call(void 0, "underline")),
|
|
1692
|
+
formatStrikeThrough: run(_chunkZKVOS57Qcjs.toggleMark.call(void 0, "strike")),
|
|
1693
|
+
historyUndo: run(_chunkZKVOS57Qcjs.undo),
|
|
1694
|
+
historyRedo: run(_chunkZKVOS57Qcjs.redo),
|
|
1678
1695
|
insertTranspose: run(transposeChars),
|
|
1679
1696
|
insertFromPaste: leaveToHandlers,
|
|
1680
1697
|
insertFromDrop: leaveToHandlers,
|
|
@@ -1775,7 +1792,7 @@ function snapshotComposition(controller, block, region) {
|
|
|
1775
1792
|
const element = controller.registry.get(block, region);
|
|
1776
1793
|
const inline = regionInline(editor.state, block, region);
|
|
1777
1794
|
if (element === void 0 || inline === void 0) return null;
|
|
1778
|
-
const text =
|
|
1795
|
+
const text = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1779
1796
|
const end = composedEnd(controller, block, region);
|
|
1780
1797
|
const since = [];
|
|
1781
1798
|
const release = editor.subscribe((_, tr) => void (tr && since.push(tr)));
|
|
@@ -1811,7 +1828,7 @@ function targetAt(controller, node) {
|
|
|
1811
1828
|
}
|
|
1812
1829
|
function elementOf(controller, target) {
|
|
1813
1830
|
if (target === EMPTY_HOST) return _nullishCoalesce(controller.emptyHost, () => ( void 0));
|
|
1814
|
-
return target
|
|
1831
|
+
return target ? controller.registry.get(target.block, target.region) : void 0;
|
|
1815
1832
|
}
|
|
1816
1833
|
function createCompositionHandlers(controller) {
|
|
1817
1834
|
let active = false;
|
|
@@ -1887,7 +1904,7 @@ function reconcileHost(controller, block, region, caretHint) {
|
|
|
1887
1904
|
const element = controller.registry.get(block, region);
|
|
1888
1905
|
const inline = regionInline(controller.editor.state, block, region);
|
|
1889
1906
|
if (element === void 0 || inline === void 0) return false;
|
|
1890
|
-
const before =
|
|
1907
|
+
const before = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1891
1908
|
const after = readDomText(element);
|
|
1892
1909
|
const edit = before === after ? null : textDiff(before, after, _nullishCoalesce(caretHint, () => ( domCaretOffset(element))));
|
|
1893
1910
|
if (edit === null) return false;
|
|
@@ -1952,33 +1969,33 @@ function createDomInputFallback(controller) {
|
|
|
1952
1969
|
|
|
1953
1970
|
// src/view/navigation/cross-moves.ts
|
|
1954
1971
|
function moveHead(controller, { anchor }, head) {
|
|
1955
|
-
dispatchSelection(controller,
|
|
1972
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.textSelection.call(void 0, anchor, head));
|
|
1956
1973
|
return true;
|
|
1957
1974
|
}
|
|
1958
1975
|
function blockOf(controller, { block }) {
|
|
1959
1976
|
const { doc } = controller.editor.state;
|
|
1960
|
-
return doc.blocks[
|
|
1977
|
+
return doc.blocks[_chunk4SLJNZSMcjs.requireBlockIndex.call(void 0, doc, block)];
|
|
1961
1978
|
}
|
|
1962
1979
|
function collapseCross(controller, selection, direction) {
|
|
1963
|
-
const { from, to } =
|
|
1964
|
-
dispatchSelection(controller,
|
|
1980
|
+
const { from, to } = _chunkZKVOS57Qcjs.selectionRange.call(void 0, controller.editor.state.doc, selection);
|
|
1981
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.textSelection.call(void 0, direction < 0 ? from : to));
|
|
1965
1982
|
return true;
|
|
1966
1983
|
}
|
|
1967
1984
|
function crossHeadVertically(controller, selection, direction) {
|
|
1968
1985
|
const { head } = selection;
|
|
1969
1986
|
const edge = neighbourHead(controller, head.block, direction);
|
|
1970
1987
|
if (edge !== null) {
|
|
1971
|
-
const end2 =
|
|
1988
|
+
const end2 = _chunkZKVOS57Qcjs.regionLength.call(void 0, blockOf(controller, edge), edge.region);
|
|
1972
1989
|
return moveHead(controller, selection, { ...edge, offset: Math.min(head.offset, end2) });
|
|
1973
1990
|
}
|
|
1974
|
-
const end =
|
|
1991
|
+
const end = _chunkZKVOS57Qcjs.regionLength.call(void 0, blockOf(controller, head), head.region);
|
|
1975
1992
|
return moveHead(controller, selection, { ...head, offset: direction < 0 ? 0 : end });
|
|
1976
1993
|
}
|
|
1977
1994
|
function crossHeadHorizontally(controller, selection, direction) {
|
|
1978
1995
|
const { head } = selection;
|
|
1979
|
-
const text =
|
|
1996
|
+
const text = _chunk4SLJNZSMcjs.inlineText.call(void 0, _nullishCoalesce(blockOf(controller, head).regions[head.region], () => ( [])));
|
|
1980
1997
|
if (direction < 0 ? head.offset > 0 : head.offset < text.length) {
|
|
1981
|
-
const offset = direction < 0 ?
|
|
1998
|
+
const offset = direction < 0 ? _chunkZKVOS57Qcjs.prevGraphemeOffset.call(void 0, text, head.offset) : _chunkZKVOS57Qcjs.nextGraphemeOffset.call(void 0, text, head.offset);
|
|
1982
1999
|
return moveHead(controller, selection, { ...head, offset });
|
|
1983
2000
|
}
|
|
1984
2001
|
const edge = neighbourHead(controller, head.block, direction);
|
|
@@ -1997,9 +2014,9 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
1997
2014
|
const move = extend ? crossHeadHorizontally : collapseCross;
|
|
1998
2015
|
return move(controller, selection, direction);
|
|
1999
2016
|
}
|
|
2000
|
-
if (!extend && !
|
|
2017
|
+
if (!extend && !_chunkZKVOS57Qcjs.isCollapsed.call(void 0, selection)) return false;
|
|
2001
2018
|
const { head } = selection;
|
|
2002
|
-
const length =
|
|
2019
|
+
const length = _chunkZKVOS57Qcjs.regionLength.call(void 0, doc.blocks[_chunk4SLJNZSMcjs.requireBlockIndex.call(void 0, doc, head.block)], head.region);
|
|
2003
2020
|
if (direction < 0 ? head.offset > 0 : head.offset < length) return false;
|
|
2004
2021
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2005
2022
|
if (own2 !== null) {
|
|
@@ -2009,7 +2026,7 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
2009
2026
|
if (!extend) return moveToNeighbour(controller, head.block, direction);
|
|
2010
2027
|
const edge = neighbourHead(controller, head.block, direction);
|
|
2011
2028
|
if (edge === null) return false;
|
|
2012
|
-
dispatchSelection(controller,
|
|
2029
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.textSelection.call(void 0, selection.anchor, edge));
|
|
2013
2030
|
return true;
|
|
2014
2031
|
}
|
|
2015
2032
|
|
|
@@ -2107,12 +2124,12 @@ function caretAtGoal(controller, host, at, y) {
|
|
|
2107
2124
|
}
|
|
2108
2125
|
function landAtGoal(controller, block, direction) {
|
|
2109
2126
|
const { schema } = controller.editor.state;
|
|
2110
|
-
const region =
|
|
2127
|
+
const region = _chunkZKVOS57Qcjs.isTextFlow.call(void 0, schema, block) ? _chunkZKVOS57Qcjs.primaryRegion.call(void 0, schema, block) : null;
|
|
2111
2128
|
const host = region === null ? void 0 : controller.registry.get(block.id, region);
|
|
2112
2129
|
if (!host || region === null || controller.goalX === null) return null;
|
|
2113
2130
|
const line = lineInView(host, direction < 0);
|
|
2114
2131
|
const pos = line && caretAtGoal(controller, host, { block: block.id, region }, line.top + line.height / 2);
|
|
2115
|
-
return pos ?
|
|
2132
|
+
return pos ? _chunkZKVOS57Qcjs.textSelection.call(void 0, pos) : null;
|
|
2116
2133
|
}
|
|
2117
2134
|
function moveInHost(controller, host, head, caret, direction) {
|
|
2118
2135
|
const { goalX } = controller;
|
|
@@ -2130,7 +2147,7 @@ function landing(controller, { head }, direction, extend) {
|
|
|
2130
2147
|
controller.goalX ??= _nullishCoalesce(_optionalChain([caret, 'optionalAccess', _147 => _147.left]), () => ( null));
|
|
2131
2148
|
if (!(direction < 0 ? isOnFirstLine(host, point) : isOnLastLine(host, point))) {
|
|
2132
2149
|
const pos = moveInHost(controller, host, head, caret, direction);
|
|
2133
|
-
return pos &&
|
|
2150
|
+
return pos && _chunkZKVOS57Qcjs.textSelection.call(void 0, pos);
|
|
2134
2151
|
}
|
|
2135
2152
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2136
2153
|
if (own2 !== null) return own2;
|
|
@@ -2144,14 +2161,14 @@ function moveText(controller, selection, direction, extend) {
|
|
|
2144
2161
|
controller.nativeVerticalMove = true;
|
|
2145
2162
|
return false;
|
|
2146
2163
|
}
|
|
2147
|
-
const moved = extend && next.kind === "text" ?
|
|
2164
|
+
const moved = extend && next.kind === "text" ? _chunkZKVOS57Qcjs.textSelection.call(void 0, selection.anchor, next.head) : next;
|
|
2148
2165
|
dispatchSelection(controller, moved);
|
|
2149
2166
|
return true;
|
|
2150
2167
|
}
|
|
2151
2168
|
function extendBlocks(controller, { anchor, head }, direction) {
|
|
2152
2169
|
const next = neighbourBlock(controller.editor.state.doc, head, direction);
|
|
2153
2170
|
if (next === null) return false;
|
|
2154
|
-
dispatchSelection(controller,
|
|
2171
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.blockRangeSelection.call(void 0, anchor, next.id));
|
|
2155
2172
|
return true;
|
|
2156
2173
|
}
|
|
2157
2174
|
function moveVertically(controller, direction, extend) {
|
|
@@ -2167,8 +2184,8 @@ function moveVertically(controller, direction, extend) {
|
|
|
2167
2184
|
// src/view/input/flip-block.ts
|
|
2168
2185
|
var isTask = ({ type, attrs }) => type === "MARKDOWN" && attrs.kind === "task";
|
|
2169
2186
|
function flipCommand(block) {
|
|
2170
|
-
if (isTask(block)) return
|
|
2171
|
-
return block.type === "TOGGLE" ?
|
|
2187
|
+
if (isTask(block)) return _chunkZKVOS57Qcjs.toggleTask;
|
|
2188
|
+
return block.type === "TOGGLE" ? _chunkZKVOS57Qcjs.setAttrs.call(void 0, { open: block.attrs.open !== true }) : null;
|
|
2172
2189
|
}
|
|
2173
2190
|
var toggleState = (open) => open ? "expanded" : "collapsed";
|
|
2174
2191
|
function stateName(block) {
|
|
@@ -2177,7 +2194,7 @@ function stateName(block) {
|
|
|
2177
2194
|
}
|
|
2178
2195
|
function blockHoldingCaret({ doc, selection }) {
|
|
2179
2196
|
if (_optionalChain([selection, 'optionalAccess', _151 => _151.kind]) !== "text" || selection.anchor.block !== selection.head.block) return null;
|
|
2180
|
-
return _nullishCoalesce(
|
|
2197
|
+
return _nullishCoalesce(_chunk4SLJNZSMcjs.blockById.call(void 0, doc, selection.head.block), () => ( null));
|
|
2181
2198
|
}
|
|
2182
2199
|
function flipForReader(controller, block) {
|
|
2183
2200
|
if (_optionalChain([block, 'optionalAccess', _152 => _152.type]) !== "TOGGLE") return false;
|
|
@@ -2192,7 +2209,7 @@ function flipSelectedBlock(controller) {
|
|
|
2192
2209
|
if (controller.readOnly) return flipForReader(controller, block);
|
|
2193
2210
|
const command = block && flipCommand(block);
|
|
2194
2211
|
if (!block || !command || !controller.run(command)) return false;
|
|
2195
|
-
const after =
|
|
2212
|
+
const after = _chunk4SLJNZSMcjs.blockById.call(void 0, editor.state.doc, block.id);
|
|
2196
2213
|
if (after) controller.announce(stateName(after));
|
|
2197
2214
|
return true;
|
|
2198
2215
|
}
|
|
@@ -2286,11 +2303,13 @@ function attachInput(controller, root) {
|
|
|
2286
2303
|
else composition.end(event);
|
|
2287
2304
|
};
|
|
2288
2305
|
const detachClipboard = attachClipboard(controller, root, catchUp);
|
|
2289
|
-
root
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2306
|
+
const unlisten = listen(root, {
|
|
2307
|
+
keydown: onKeyDown,
|
|
2308
|
+
beforeinput: onBeforeInput,
|
|
2309
|
+
input: onInput,
|
|
2310
|
+
compositionstart: onCompositionStart,
|
|
2311
|
+
compositionend: onCompositionEnd
|
|
2312
|
+
});
|
|
2294
2313
|
function observe(host) {
|
|
2295
2314
|
if (!observed.has(host)) observed.set(host, fallback.observe(host));
|
|
2296
2315
|
}
|
|
@@ -2306,11 +2325,7 @@ function attachInput(controller, root) {
|
|
|
2306
2325
|
composition.release();
|
|
2307
2326
|
sinkComposition.release();
|
|
2308
2327
|
detachClipboard();
|
|
2309
|
-
|
|
2310
|
-
root.removeEventListener("beforeinput", onBeforeInput);
|
|
2311
|
-
root.removeEventListener("input", onInput);
|
|
2312
|
-
root.removeEventListener("compositionstart", onCompositionStart);
|
|
2313
|
-
root.removeEventListener("compositionend", onCompositionEnd);
|
|
2328
|
+
unlisten();
|
|
2314
2329
|
for (const stop of observed.values()) stop();
|
|
2315
2330
|
observed.clear();
|
|
2316
2331
|
}
|
|
@@ -2332,13 +2347,11 @@ function watchFocusReturn(root, handlers) {
|
|
|
2332
2347
|
const onFocusOut = (event) => {
|
|
2333
2348
|
if (!root.contains(event.relatedTarget)) pressed = false;
|
|
2334
2349
|
};
|
|
2335
|
-
root
|
|
2336
|
-
root
|
|
2337
|
-
root.addEventListener("focusout", onFocusOut);
|
|
2350
|
+
const unlistenPress = listen(root, { pointerdown: onPointerDown }, true);
|
|
2351
|
+
const unlistenFocus = listen(root, { focusin: onFocusIn, focusout: onFocusOut });
|
|
2338
2352
|
return () => {
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
root.removeEventListener("focusout", onFocusOut);
|
|
2353
|
+
unlistenPress();
|
|
2354
|
+
unlistenFocus();
|
|
2342
2355
|
};
|
|
2343
2356
|
}
|
|
2344
2357
|
|
|
@@ -2407,9 +2420,9 @@ function bindRoot(controller, root, cross, committed) {
|
|
|
2407
2420
|
function movedSelection(controller, doc, model) {
|
|
2408
2421
|
if (controller.composingKey !== null || controller.dragging || !doc || !ownsFocus(controller, doc)) return null;
|
|
2409
2422
|
const selection = readSelection(controller.registry, doc.getSelection(), (node) => controller.blockAt(node));
|
|
2410
|
-
return selection === null ||
|
|
2423
|
+
return selection === null || _chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, model) ? null : selection;
|
|
2411
2424
|
}
|
|
2412
|
-
function writeModelSelection(controller, doc, moved) {
|
|
2425
|
+
function writeModelSelection(controller, doc, moved, local) {
|
|
2413
2426
|
const domSelection = _optionalChain([doc, 'optionalAccess', _168 => _168.getSelection, 'call', _169 => _169()]);
|
|
2414
2427
|
if (focusingSink(controller) || controller.composingKey !== null || !doc || !domSelection || !ownsFocus(controller, doc)) {
|
|
2415
2428
|
return;
|
|
@@ -2419,7 +2432,7 @@ function writeModelSelection(controller, doc, moved) {
|
|
|
2419
2432
|
if (heldBySink(selection) && controller.sink !== null) focusSink(controller);
|
|
2420
2433
|
else if (_optionalChain([selection, 'optionalAccess', _170 => _170.kind]) === "blocks") domSelection.removeAllRanges();
|
|
2421
2434
|
else writeSelection(controller.registry, selection, domSelection, (id) => controller.blockElement(id));
|
|
2422
|
-
controller.nodeReveal.show(selection);
|
|
2435
|
+
controller.nodeReveal.show(selection, local);
|
|
2423
2436
|
if (!samePoints(before, selectionPoints(domSelection))) moved();
|
|
2424
2437
|
}
|
|
2425
2438
|
|
|
@@ -2428,102 +2441,105 @@ var runNow = (fn) => fn();
|
|
|
2428
2441
|
var ViewController = (_class = class {
|
|
2429
2442
|
|
|
2430
2443
|
__init() {this.registry = createHostRegistry((element) => {
|
|
2431
|
-
_optionalChain([this, 'access', _179 => _179
|
|
2432
|
-
this
|
|
2444
|
+
_optionalChain([this, 'access', _179 => _179.#binding, 'optionalAccess', _180 => _180.input, 'access', _181 => _181.observe, 'call', _182 => _182(element)]);
|
|
2445
|
+
this.#drawn.syncTabStop();
|
|
2433
2446
|
return () => {
|
|
2434
|
-
_optionalChain([this, 'access', _183 => _183
|
|
2435
|
-
this
|
|
2447
|
+
_optionalChain([this, 'access', _183 => _183.#binding, 'optionalAccess', _184 => _184.input, 'access', _185 => _185.unobserve, 'call', _186 => _186(element)]);
|
|
2448
|
+
this.#drawn.syncTabStop();
|
|
2436
2449
|
};
|
|
2437
2450
|
})}
|
|
2438
2451
|
__init2() {this.keyInterceptors = /* @__PURE__ */ new Set()}
|
|
2439
2452
|
__init3() {this.nodeReveal = createNodeReveal((id) => this.blockElement(id))}
|
|
2440
|
-
__init4() {this.announcer = createAnnouncer(() => this
|
|
2453
|
+
__init4() {this.announcer = createAnnouncer(() => this.#said)}
|
|
2441
2454
|
|
|
2442
2455
|
|
|
2443
2456
|
__init5() {this.goalX = null}
|
|
2444
2457
|
__init6() {this.nativeVerticalMove = false}
|
|
2445
2458
|
__init7() {this.dragging = false}
|
|
2446
2459
|
__init8() {this.composingKey = null}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
() => hasFocus(this, this
|
|
2453
|
-
(model) => movedSelection(this, this
|
|
2454
|
-
)
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2460
|
+
#flush;
|
|
2461
|
+
#hosts;
|
|
2462
|
+
#drawn = createDrawnElements(this.registry, () => this.editor.state);
|
|
2463
|
+
#cross = createCrossMode(this);
|
|
2464
|
+
#outside = createOutsideChanges(
|
|
2465
|
+
() => hasFocus(this, this.#ownerDocument()),
|
|
2466
|
+
(model) => movedSelection(this, this.#ownerDocument(), model)
|
|
2467
|
+
);
|
|
2468
|
+
#binding = null;
|
|
2469
|
+
#quiet = false;
|
|
2470
|
+
#loud = false;
|
|
2471
|
+
#said;
|
|
2472
|
+
#detachRoot = null;
|
|
2473
|
+
#readOnlyState;
|
|
2474
|
+
constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);
|
|
2461
2475
|
this.editor = options.editor;
|
|
2462
2476
|
options.editor.subscribe((state, tr) => {
|
|
2463
|
-
if (_optionalChain([tr, 'optionalAccess', _187 => _187.origin]) !== "remote") this
|
|
2477
|
+
if (_optionalChain([tr, 'optionalAccess', _187 => _187.origin]) !== "remote") this.#said = state;
|
|
2464
2478
|
});
|
|
2465
|
-
this
|
|
2479
|
+
this.#flush = _nullishCoalesce(options.flush, () => ( runNow));
|
|
2466
2480
|
this.onFiles = options.onFiles;
|
|
2467
|
-
this.isMac = _nullishCoalesce(options.isMac, () => (
|
|
2481
|
+
this.isMac = _nullishCoalesce(options.isMac, () => ( _chunkZKVOS57Qcjs.detectMac.call(void 0, )));
|
|
2468
2482
|
const decorationsOf = (block, region) => this.decorationsFor(block, region);
|
|
2469
|
-
|
|
2470
|
-
this
|
|
2483
|
+
const drain = (element) => _optionalChain([this, 'access', _188 => _188.#binding, 'optionalAccess', _189 => _189.input, 'access', _190 => _190.drain, 'call', _191 => _191(element)]);
|
|
2484
|
+
this.#hosts = createHostRenderer(options.editor, options.render, decorationsOf, drain);
|
|
2485
|
+
this.#readOnlyState = createReadOnly(this.registry, _nullishCoalesce(options.readOnly, () => ( false)));
|
|
2471
2486
|
}
|
|
2472
2487
|
get root() {
|
|
2473
|
-
return _nullishCoalesce(_optionalChain([this, 'access', _192 => _192
|
|
2488
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _192 => _192.#binding, 'optionalAccess', _193 => _193.root]), () => ( null));
|
|
2474
2489
|
}
|
|
2475
2490
|
get readOnly() {
|
|
2476
|
-
return this
|
|
2491
|
+
return this.#readOnlyState.current();
|
|
2477
2492
|
}
|
|
2478
2493
|
get sink() {
|
|
2479
|
-
return this
|
|
2494
|
+
return this.#drawn.sink;
|
|
2480
2495
|
}
|
|
2481
2496
|
get emptyHost() {
|
|
2482
|
-
return this
|
|
2497
|
+
return this.#drawn.emptyHost;
|
|
2483
2498
|
}
|
|
2484
2499
|
attach(root) {
|
|
2485
|
-
_optionalChain([this, 'access', _194 => _194
|
|
2486
|
-
const binding = bindRoot(this, root, this
|
|
2487
|
-
this
|
|
2488
|
-
this
|
|
2500
|
+
_optionalChain([this, 'access', _194 => _194.#detachRoot, 'optionalCall', _195 => _195()]);
|
|
2501
|
+
const binding = bindRoot(this, root, this.#cross, (_, tr) => {
|
|
2502
|
+
this.#quiet ||= _optionalChain([tr, 'optionalAccess', _196 => _196.origin]) === "remote" && tr.docChanged;
|
|
2503
|
+
this.#loud ||= _optionalChain([tr, 'optionalAccess', _197 => _197.origin]) !== "remote";
|
|
2504
|
+
this.#outside.committed(tr);
|
|
2489
2505
|
this.nodeReveal.follow(this.editor.state.selection);
|
|
2490
|
-
this
|
|
2491
|
-
this
|
|
2506
|
+
this.#drawn.syncTabStop();
|
|
2507
|
+
this.#cross.syncLater();
|
|
2492
2508
|
});
|
|
2493
2509
|
const unmount = this.editor.mount();
|
|
2494
2510
|
const detach = () => {
|
|
2495
2511
|
unmount();
|
|
2496
2512
|
binding.detach();
|
|
2497
|
-
if (this
|
|
2498
|
-
this
|
|
2499
|
-
this
|
|
2513
|
+
if (this.#detachRoot !== detach) return;
|
|
2514
|
+
this.#detachRoot = null;
|
|
2515
|
+
this.#binding = null;
|
|
2500
2516
|
};
|
|
2501
|
-
this
|
|
2502
|
-
this
|
|
2503
|
-
this
|
|
2517
|
+
this.#binding = binding;
|
|
2518
|
+
this.#detachRoot = detach;
|
|
2519
|
+
this.#drawn.syncTabStop();
|
|
2504
2520
|
return detach;
|
|
2505
2521
|
}
|
|
2506
2522
|
registerBlockElement(id, element) {
|
|
2507
|
-
return this
|
|
2523
|
+
return this.#drawn.registerBlock(id, element);
|
|
2508
2524
|
}
|
|
2509
2525
|
blockElement(id) {
|
|
2510
|
-
return this
|
|
2526
|
+
return this.#drawn.block(id);
|
|
2511
2527
|
}
|
|
2512
2528
|
blockAt(node) {
|
|
2513
|
-
return this
|
|
2529
|
+
return this.#drawn.blockAt(node);
|
|
2514
2530
|
}
|
|
2515
2531
|
registerSink(element) {
|
|
2516
|
-
return this
|
|
2532
|
+
return this.#drawn.registerSink(element);
|
|
2517
2533
|
}
|
|
2518
2534
|
// An empty document draws one host that stands for a paragraph not created yet, so it belongs to no block.
|
|
2519
2535
|
registerEmptyHost(element) {
|
|
2520
|
-
return this
|
|
2536
|
+
return this.#drawn.registerEmptyHost(element);
|
|
2521
2537
|
}
|
|
2522
2538
|
isEditorElement(element) {
|
|
2523
|
-
return this
|
|
2539
|
+
return this.#drawn.isEditorElement(element);
|
|
2524
2540
|
}
|
|
2525
2541
|
decorationsFor(block, region) {
|
|
2526
|
-
return hostDecorations(this.editor, block, region, this
|
|
2542
|
+
return hostDecorations(this.editor, block, region, this.#cross.mode);
|
|
2527
2543
|
}
|
|
2528
2544
|
dispatch(tr) {
|
|
2529
2545
|
this.edit(() => {
|
|
@@ -2536,34 +2552,35 @@ var ViewController = (_class = class {
|
|
|
2536
2552
|
// open a popover that takes it.
|
|
2537
2553
|
edit(change) {
|
|
2538
2554
|
const before = this.editor.state;
|
|
2539
|
-
const doc = this
|
|
2555
|
+
const doc = this.#ownerDocument();
|
|
2540
2556
|
const focused = hasFocus(this, doc);
|
|
2541
2557
|
let handled = false;
|
|
2542
|
-
this
|
|
2543
|
-
() => this
|
|
2558
|
+
this.#flush(
|
|
2559
|
+
() => this.#outside.inside(() => {
|
|
2544
2560
|
handled = change();
|
|
2545
2561
|
})
|
|
2546
2562
|
);
|
|
2547
2563
|
if (this.editor.state === before) return handled;
|
|
2548
2564
|
if (this.editor.state.doc !== before.doc) this.goalX = null;
|
|
2549
2565
|
this.refreshHosts();
|
|
2550
|
-
this
|
|
2551
|
-
if (focused && doc !== null && ownsFocus(this, doc)) this
|
|
2552
|
-
this.syncSelectionToDom();
|
|
2566
|
+
this.#cross.sync();
|
|
2567
|
+
if (focused && doc !== null && ownsFocus(this, doc)) this.#keepFocus();
|
|
2568
|
+
this.syncSelectionToDom(true);
|
|
2553
2569
|
return handled;
|
|
2554
2570
|
}
|
|
2555
2571
|
// A change made outside edit() reaches the hosts when React draws them, so the selection is written back once that
|
|
2556
|
-
// has happened, and focus follows a host the change replaced. A
|
|
2572
|
+
// has happened, and focus follows a host the change replaced. A render of collaborators' changes alone, or of one
|
|
2573
|
+
// that changed the document, scrolls nothing doing so; a caret move of theirs leaves the rest to scroll as it would.
|
|
2557
2574
|
afterRender() {
|
|
2558
|
-
const
|
|
2559
|
-
this
|
|
2560
|
-
const doc = this
|
|
2561
|
-
const moved = this
|
|
2562
|
-
if (!this
|
|
2563
|
-
if (moved) this
|
|
2564
|
-
this
|
|
2575
|
+
const quiet = this.#quiet || !this.#loud;
|
|
2576
|
+
this.#quiet = this.#loud = false;
|
|
2577
|
+
const doc = this.#ownerDocument();
|
|
2578
|
+
const moved = this.#outside.takeMoved();
|
|
2579
|
+
if (!this.#outside.takeFocused() || !doc || !ownsFocus(this, doc)) return;
|
|
2580
|
+
if (moved) this.#selectFromDom(moved);
|
|
2581
|
+
this.#cross.sync();
|
|
2565
2582
|
const follow = () => {
|
|
2566
|
-
this
|
|
2583
|
+
this.#keepFocus(quiet);
|
|
2567
2584
|
this.syncSelectionToDom();
|
|
2568
2585
|
};
|
|
2569
2586
|
if (!quiet) return follow();
|
|
@@ -2572,7 +2589,7 @@ var ViewController = (_class = class {
|
|
|
2572
2589
|
}
|
|
2573
2590
|
refreshHosts() {
|
|
2574
2591
|
for (const host of this.registry.all()) {
|
|
2575
|
-
if (!this
|
|
2592
|
+
if (!this.#isComposing(host)) this.#hosts.renderIfChanged(host);
|
|
2576
2593
|
}
|
|
2577
2594
|
}
|
|
2578
2595
|
run(command) {
|
|
@@ -2587,63 +2604,63 @@ var ViewController = (_class = class {
|
|
|
2587
2604
|
renderHost(block, region) {
|
|
2588
2605
|
const element = this.registry.get(block, region);
|
|
2589
2606
|
const host = element && { block, region, element };
|
|
2590
|
-
if (!host || this
|
|
2591
|
-
const inSelection = element.contains(_nullishCoalesce(_optionalChain([this, 'access',
|
|
2607
|
+
if (!host || this.#isComposing(host) || !this.#hosts.render(host)) return;
|
|
2608
|
+
const inSelection = element.contains(_nullishCoalesce(_optionalChain([this, 'access', _198 => _198.domSelection, 'call', _199 => _199(), 'optionalAccess', _200 => _200.focusNode]), () => ( null)));
|
|
2592
2609
|
if (inSelection && hasFocus(this, element.ownerDocument)) this.syncSelectionToDom();
|
|
2593
2610
|
}
|
|
2594
2611
|
domSelection() {
|
|
2595
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2612
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _201 => _201.#ownerDocument, 'call', _202 => _202(), 'optionalAccess', _203 => _203.getSelection, 'call', _204 => _204()]), () => ( null));
|
|
2596
2613
|
}
|
|
2597
|
-
syncSelectionToDom() {
|
|
2598
|
-
writeModelSelection(this, this
|
|
2614
|
+
syncSelectionToDom(local) {
|
|
2615
|
+
writeModelSelection(this, this.#ownerDocument(), () => _optionalChain([this, 'access', _205 => _205.#binding, 'optionalAccess', _206 => _206.selectionSync, 'access', _207 => _207.suppressNext, 'call', _208 => _208()]), local);
|
|
2599
2616
|
}
|
|
2600
2617
|
// A pointer drag across hosts sets the model selection itself, while the browser keeps extending its own. Leaving
|
|
2601
2618
|
// cross mode re-renders the hosts that drew it as decorations, which can remove the node holding the caret, so the
|
|
2602
2619
|
// selection is written back.
|
|
2603
2620
|
readSelectionFromDom() {
|
|
2604
|
-
const selection = movedSelection(this, this
|
|
2621
|
+
const selection = movedSelection(this, this.#ownerDocument(), this.editor.state.selection);
|
|
2605
2622
|
if (selection === null) return;
|
|
2606
|
-
const wasCross = this
|
|
2623
|
+
const wasCross = this.#cross.active;
|
|
2607
2624
|
if (!this.nativeVerticalMove) this.goalX = null;
|
|
2608
|
-
this
|
|
2609
|
-
this
|
|
2610
|
-
if (!wasCross && !this
|
|
2611
|
-
this
|
|
2625
|
+
this.#flush(() => this.#selectFromDom(selection));
|
|
2626
|
+
this.#cross.sync();
|
|
2627
|
+
if (!wasCross && !this.#cross.active) return;
|
|
2628
|
+
this.#keepFocus();
|
|
2612
2629
|
this.syncSelectionToDom();
|
|
2613
2630
|
}
|
|
2614
2631
|
focus(target) {
|
|
2615
2632
|
const { editor } = this;
|
|
2616
2633
|
const selection = focusTarget(editor.state, target);
|
|
2617
|
-
if (selection !== null && !
|
|
2618
|
-
this
|
|
2634
|
+
if (selection !== null && !_chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, editor.state.selection)) dispatchSelection(this, selection);
|
|
2635
|
+
this.#takeFocus();
|
|
2619
2636
|
this.syncSelectionToDom();
|
|
2620
2637
|
}
|
|
2621
2638
|
setReadOnly(readOnly) {
|
|
2622
|
-
this
|
|
2639
|
+
this.#readOnlyState.set(readOnly);
|
|
2623
2640
|
}
|
|
2624
2641
|
subscribeReadOnly(listener) {
|
|
2625
|
-
return this
|
|
2642
|
+
return this.#readOnlyState.subscribe(listener);
|
|
2626
2643
|
}
|
|
2627
2644
|
destroy() {
|
|
2628
|
-
_optionalChain([this, 'access',
|
|
2645
|
+
_optionalChain([this, 'access', _209 => _209.#detachRoot, 'optionalCall', _210 => _210()]);
|
|
2629
2646
|
}
|
|
2630
|
-
selectFromDom(selection) {
|
|
2647
|
+
#selectFromDom(selection) {
|
|
2631
2648
|
const { editor } = this;
|
|
2632
|
-
this
|
|
2649
|
+
this.#outside.inside(() => editor.dispatch(editor.createTransaction().setSelection(selection).setOrigin("input")));
|
|
2633
2650
|
}
|
|
2634
|
-
isComposing(host) {
|
|
2651
|
+
#isComposing(host) {
|
|
2635
2652
|
return this.composingKey !== null && hostKey(host.block, host.region) === this.composingKey;
|
|
2636
2653
|
}
|
|
2637
|
-
ownerDocument() {
|
|
2638
|
-
return _nullishCoalesce(_optionalChain([(_nullishCoalesce(_optionalChain([this, 'access',
|
|
2654
|
+
#ownerDocument() {
|
|
2655
|
+
return _nullishCoalesce(_optionalChain([(_nullishCoalesce(_optionalChain([this, 'access', _211 => _211.#binding, 'optionalAccess', _212 => _212.root]), () => ( _optionalChain([this, 'access', _213 => _213.registry, 'access', _214 => _214.all, 'call', _215 => _215(), 'access', _216 => _216.next, 'call', _217 => _217(), 'access', _218 => _218.value, 'optionalAccess', _219 => _219.element])))), 'optionalAccess', _220 => _220.ownerDocument]), () => ( null));
|
|
2639
2656
|
}
|
|
2640
2657
|
// React replaces a host whose block changes kind, which drops focus, and Firefox does not move focus into another
|
|
2641
2658
|
// host when a script selects inside it.
|
|
2642
|
-
keepFocus(preventScroll) {
|
|
2643
|
-
if (this.composingKey === null) this
|
|
2659
|
+
#keepFocus(preventScroll) {
|
|
2660
|
+
if (this.composingKey === null) this.#takeFocus(preventScroll);
|
|
2644
2661
|
}
|
|
2645
|
-
takeFocus(preventScroll) {
|
|
2646
|
-
const element = this
|
|
2662
|
+
#takeFocus(preventScroll) {
|
|
2663
|
+
const element = this.#drawn.focusElement();
|
|
2647
2664
|
if (!element || element.ownerDocument.activeElement === element) return;
|
|
2648
2665
|
if (element === this.sink) focusSink(this);
|
|
2649
2666
|
else element.focus({ preventScroll });
|
|
@@ -2672,18 +2689,18 @@ function useQuoinEditor(options) {
|
|
|
2672
2689
|
const { blocks, readOnly = false } = options;
|
|
2673
2690
|
const callbacks = _react.useRef.call(void 0, options);
|
|
2674
2691
|
const [controller] = _react.useState.call(void 0, () => {
|
|
2675
|
-
const editor =
|
|
2692
|
+
const editor = _chunkZKVOS57Qcjs.createEditor.call(void 0, {
|
|
2676
2693
|
blocks,
|
|
2677
2694
|
extensions: options.extensions,
|
|
2678
2695
|
onChange: (next) => callbacks.current.onChange(next),
|
|
2679
|
-
onTransaction: (tr, state) => _optionalChain([callbacks, 'access',
|
|
2696
|
+
onTransaction: (tr, state) => _optionalChain([callbacks, 'access', _221 => _221.current, 'access', _222 => _222.onTransaction, 'optionalCall', _223 => _223(tr, state)])
|
|
2680
2697
|
});
|
|
2681
2698
|
return new ViewController({
|
|
2682
2699
|
editor,
|
|
2683
2700
|
flush: _reactdom.flushSync,
|
|
2684
2701
|
render: options.render,
|
|
2685
2702
|
readOnly,
|
|
2686
|
-
onFiles: (files, at) => _optionalChain([callbacks, 'access',
|
|
2703
|
+
onFiles: (files, at) => _optionalChain([callbacks, 'access', _224 => _224.current, 'access', _225 => _225.onFiles, 'optionalCall', _226 => _226(files, at)])
|
|
2687
2704
|
});
|
|
2688
2705
|
});
|
|
2689
2706
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -2722,7 +2739,7 @@ function SelectionSink({ label = "Selected content", blockLabel }) {
|
|
|
2722
2739
|
);
|
|
2723
2740
|
useIsomorphicLayoutEffect(() => {
|
|
2724
2741
|
const sink = ref.current;
|
|
2725
|
-
return sink
|
|
2742
|
+
return sink ? controller.registerSink(sink) : void 0;
|
|
2726
2743
|
}, [controller]);
|
|
2727
2744
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2728
2745
|
"div",
|
|
@@ -2750,11 +2767,11 @@ function SelectionSink({ label = "Selected content", blockLabel }) {
|
|
|
2750
2767
|
|
|
2751
2768
|
// src/view/react/block-placeholder.ts
|
|
2752
2769
|
|
|
2753
|
-
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${
|
|
2770
|
+
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${_chunk4SLJNZSMcjs.headingLevel.call(void 0, attrs.level)}` : void 0;
|
|
2754
2771
|
var BlockPlaceholderContext = _react.createContext.call(void 0, headingPlaceholder);
|
|
2755
2772
|
function regionPlaceholder(state, blockId, region, placeholderOf) {
|
|
2756
|
-
const block =
|
|
2757
|
-
return block !== void 0 &&
|
|
2773
|
+
const block = _chunk4SLJNZSMcjs.blockById.call(void 0, state.doc, blockId);
|
|
2774
|
+
return block !== void 0 && _chunkZKVOS57Qcjs.primaryRegion.call(void 0, state.schema, block) === region ? placeholderOf(state, block) : void 0;
|
|
2758
2775
|
}
|
|
2759
2776
|
|
|
2760
2777
|
// src/view/react/EditableRegion.tsx
|
|
@@ -2768,7 +2785,7 @@ function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
|
2768
2785
|
const select = _react.useCallback.call(void 0,
|
|
2769
2786
|
(state) => {
|
|
2770
2787
|
const inline2 = regionInline(state, block, region);
|
|
2771
|
-
const empty = inline2 === void 0 ||
|
|
2788
|
+
const empty = inline2 === void 0 || _chunk4SLJNZSMcjs.inlineLength.call(void 0, inline2) === 0;
|
|
2772
2789
|
return {
|
|
2773
2790
|
inline: inline2,
|
|
2774
2791
|
decorations: controller.decorationsFor(block, region),
|
|
@@ -2780,7 +2797,7 @@ function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
|
2780
2797
|
const { inline, decorations, placeholder: shown } = useEditorState(controller, select, samePainted);
|
|
2781
2798
|
useIsomorphicLayoutEffect(() => {
|
|
2782
2799
|
const host = ref.current;
|
|
2783
|
-
return host
|
|
2800
|
+
return host ? controller.registry.register(block, region, host) : void 0;
|
|
2784
2801
|
}, [controller, block, region]);
|
|
2785
2802
|
useIsomorphicLayoutEffect(() => {
|
|
2786
2803
|
controller.renderHost(block, region);
|
|
@@ -2819,9 +2836,9 @@ var CalloutBlock = ({ block }) => {
|
|
|
2819
2836
|
// src/view/react/block-command.ts
|
|
2820
2837
|
function onBlock(id, command) {
|
|
2821
2838
|
return (state, dispatch) => {
|
|
2822
|
-
const { ok, tr } =
|
|
2839
|
+
const { ok, tr } = _chunkZKVOS57Qcjs.runCommands.call(void 0, state, [_chunkZKVOS57Qcjs.setSelection.call(void 0, _chunkZKVOS57Qcjs.blockRangeSelection.call(void 0, id)), command]);
|
|
2823
2840
|
if (!ok || tr === null) return false;
|
|
2824
|
-
_optionalChain([dispatch, 'optionalCall',
|
|
2841
|
+
_optionalChain([dispatch, 'optionalCall', _227 => _227(tr.setSelection(state.selection))]);
|
|
2825
2842
|
return true;
|
|
2826
2843
|
};
|
|
2827
2844
|
}
|
|
@@ -2831,7 +2848,7 @@ var keepFocus = (event) => event.preventDefault();
|
|
|
2831
2848
|
|
|
2832
2849
|
// src/view/react/TaskCheckbox.tsx
|
|
2833
2850
|
|
|
2834
|
-
function TaskCheckbox({ block, controller, label
|
|
2851
|
+
function TaskCheckbox({ block, controller, label, labelledBy }) {
|
|
2835
2852
|
const checked = block.attrs.checked === true;
|
|
2836
2853
|
const flip2 = flipCommand(block);
|
|
2837
2854
|
const readOnly = useReadOnly(controller);
|
|
@@ -2842,7 +2859,7 @@ function TaskCheckbox({ block, controller, label = "Task", labelledBy }) {
|
|
|
2842
2859
|
role: "checkbox",
|
|
2843
2860
|
"aria-checked": checked,
|
|
2844
2861
|
"aria-readonly": readOnly ? "true" : void 0,
|
|
2845
|
-
"aria-label": label,
|
|
2862
|
+
"aria-label": _chunk4SLJNZSMcjs.firstNamed.call(void 0, label, "Task"),
|
|
2846
2863
|
"aria-labelledby": labelledBy,
|
|
2847
2864
|
className: "quoin-task-box",
|
|
2848
2865
|
contentEditable: false,
|
|
@@ -2873,7 +2890,7 @@ function numberDoc(doc) {
|
|
|
2873
2890
|
numbers[index] = run2.next++;
|
|
2874
2891
|
return;
|
|
2875
2892
|
}
|
|
2876
|
-
const start =
|
|
2893
|
+
const start = _chunk4SLJNZSMcjs.orderedStart.call(void 0, block.attrs.start);
|
|
2877
2894
|
numbers[index] = start;
|
|
2878
2895
|
runs.push({ indent: block.indent, next: start + 1 });
|
|
2879
2896
|
});
|
|
@@ -2914,7 +2931,7 @@ var MarkdownBlock = (props) => {
|
|
|
2914
2931
|
const { block } = props;
|
|
2915
2932
|
switch (block.attrs.kind) {
|
|
2916
2933
|
case "heading": {
|
|
2917
|
-
const level =
|
|
2934
|
+
const level = _chunk4SLJNZSMcjs.headingLevel.call(void 0, block.attrs.level);
|
|
2918
2935
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { role: "heading", "aria-level": level, className: "quoin-heading", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextRegion, { block, label: `Heading ${level}` }) });
|
|
2919
2936
|
}
|
|
2920
2937
|
case "bullet":
|
|
@@ -3025,7 +3042,7 @@ function covers(state, id, index) {
|
|
|
3025
3042
|
if (selection === null) return false;
|
|
3026
3043
|
if (selection.kind === "node") return selection.block === id;
|
|
3027
3044
|
if (selection.kind === "blocks") return within(state, index, [selection.anchor, selection.head]);
|
|
3028
|
-
if (!isCrossSelection(selection) ||
|
|
3045
|
+
if (!isCrossSelection(selection) || _chunkZKVOS57Qcjs.isTextFlow.call(void 0, schema, doc.blocks[index])) return false;
|
|
3029
3046
|
return within(state, index, [selection.anchor.block, selection.head.block]);
|
|
3030
3047
|
}
|
|
3031
3048
|
function blockStatus(state, id, choices = NO_CHOICES) {
|
|
@@ -3051,7 +3068,7 @@ var BlockShell = _react.memo.call(void 0, function BlockShell2({ block, renderer
|
|
|
3051
3068
|
const hidden = status === "hidden";
|
|
3052
3069
|
useIsomorphicLayoutEffect(() => {
|
|
3053
3070
|
const element = ref.current;
|
|
3054
|
-
return hidden || element
|
|
3071
|
+
return hidden || !element ? void 0 : controller.registerBlockElement(block.id, element);
|
|
3055
3072
|
}, [controller, block.id, hidden]);
|
|
3056
3073
|
if (hidden) return null;
|
|
3057
3074
|
const Renderer = rendererFor(renderers, block.type);
|
|
@@ -3065,11 +3082,11 @@ var BlockShell = _react.memo.call(void 0, function BlockShell2({ block, renderer
|
|
|
3065
3082
|
"data-quoin-block": "",
|
|
3066
3083
|
"data-block-id": block.id,
|
|
3067
3084
|
"data-type": block.type,
|
|
3068
|
-
"data-kind":
|
|
3085
|
+
"data-kind": _chunk4SLJNZSMcjs.optionalString.call(void 0, kind),
|
|
3069
3086
|
"data-indent": block.indent,
|
|
3070
|
-
"data-color":
|
|
3071
|
-
"data-bg":
|
|
3072
|
-
"data-align":
|
|
3087
|
+
"data-color": _chunk4SLJNZSMcjs.paletteOrUndefined.call(void 0, color),
|
|
3088
|
+
"data-bg": _chunk4SLJNZSMcjs.paletteOrUndefined.call(void 0, background),
|
|
3089
|
+
"data-align": _chunk4SLJNZSMcjs.alignOrUndefined.call(void 0, align),
|
|
3073
3090
|
style: { "--quoin-indent": block.indent },
|
|
3074
3091
|
tabIndex: -1,
|
|
3075
3092
|
"data-selected": status === "selected" ? "true" : void 0,
|
|
@@ -3109,7 +3126,7 @@ function EmptyDocumentHost({ placeholder, label = "Paragraph" }) {
|
|
|
3109
3126
|
"data-placeholder": readOnly ? void 0 : placeholder,
|
|
3110
3127
|
"aria-placeholder": readOnly ? void 0 : placeholder,
|
|
3111
3128
|
spellCheck: true,
|
|
3112
|
-
onClick: () => _optionalChain([ref, 'access',
|
|
3129
|
+
onClick: () => _optionalChain([ref, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.focus, 'call', _230 => _230()])
|
|
3113
3130
|
}
|
|
3114
3131
|
);
|
|
3115
3132
|
}
|
|
@@ -3181,7 +3198,7 @@ function useBlockElements(blocks, renderers) {
|
|
|
3181
3198
|
const [made] = _react.useState.call(void 0, () => /* @__PURE__ */ new WeakMap());
|
|
3182
3199
|
return blocks.map((block) => {
|
|
3183
3200
|
const known2 = made.get(block);
|
|
3184
|
-
if (_optionalChain([known2, 'optionalAccess',
|
|
3201
|
+
if (_optionalChain([known2, 'optionalAccess', _231 => _231.renderers]) === renderers) return known2.element;
|
|
3185
3202
|
const element = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockShell, { block, renderers }, block.id);
|
|
3186
3203
|
made.set(block, { renderers, element });
|
|
3187
3204
|
return element;
|
|
@@ -3214,7 +3231,7 @@ function EditorView({
|
|
|
3214
3231
|
const blockIdScope = _react.useId.call(void 0, );
|
|
3215
3232
|
const blocks = useEditorState(controller, (state) => state.doc.blocks);
|
|
3216
3233
|
const shells = useBlockElements(blocks, renderers);
|
|
3217
|
-
useIsomorphicLayoutEffect(() => root.current
|
|
3234
|
+
useIsomorphicLayoutEffect(() => root.current ? controller.attach(root.current) : void 0, [controller]);
|
|
3218
3235
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuoinEditorContext.Provider, { value: controller, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3219
3236
|
"div",
|
|
3220
3237
|
{
|
|
@@ -3224,7 +3241,7 @@ function EditorView({
|
|
|
3224
3241
|
role: "group",
|
|
3225
3242
|
"aria-label": label,
|
|
3226
3243
|
"aria-describedby": hintId,
|
|
3227
|
-
|
|
3244
|
+
onFocusCapture: (event) => focusOwners.set(event.target, controller),
|
|
3228
3245
|
children: [
|
|
3229
3246
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockDomIdScope.Provider, { value: blockIdScope, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UnsupportedBlockLabel.Provider, { value: unsupportedBlockLabel, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockPlaceholderContext.Provider, { value: blockPlaceholder, children: blocks.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmptyDocumentHost, { placeholder, label: paragraphLabel }) : shells }) }) }),
|
|
3230
3247
|
children,
|
|
@@ -3282,5 +3299,6 @@ function EditorView({
|
|
|
3282
3299
|
|
|
3283
3300
|
|
|
3284
3301
|
|
|
3285
|
-
|
|
3286
|
-
|
|
3302
|
+
|
|
3303
|
+
exports.dispatchSelection = dispatchSelection; exports.wholeState = wholeState; exports.useEditorState = useEditorState; exports.useReadOnly = useReadOnly; exports.isCrossSelection = isCrossSelection; exports.NODE_ENTRY = NODE_ENTRY; exports.visibleBlockIndexes = visibleBlockIndexes; exports.drawnBlockCount = drawnBlockCount; exports.neighbourBlock = neighbourBlock; exports.moveToNeighbour = moveToNeighbour; exports.textDiff = textDiff; exports.domMapOf = domMapOf; exports.renderInline = renderInline; exports.domToPos = domToPos; exports.posToDom = posToDom; exports.caretFromPoint = caretFromPoint; exports.caretClientRect = caretClientRect; exports.lineEdgeRect = lineEdgeRect; exports.isOnFirstLine = isOnFirstLine; exports.isOnLastLine = isOnLastLine; exports.isComposingKey = isComposingKey; exports.NATIVE_INTERACTION = NATIVE_INTERACTION; exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; exports.onBlock = onBlock; exports.listen = listen; exports.createAutoScroll = createAutoScroll; exports.hostKey = hostKey; exports.regionInline = regionInline; exports.handleCopy = handleCopy; exports.ViewController = ViewController; exports.useViewController = useViewController; exports.useQuoinEditor = useQuoinEditor; exports.useBlockDomId = useBlockDomId; exports.useRegionDomId = useRegionDomId; exports.focusOwners = focusOwners; exports.SelectionSink = SelectionSink; exports.EditableRegion = EditableRegion; exports.TaskCheckbox = TaskCheckbox; exports.useOrderedNumber = useOrderedNumber; exports.useToggleOpen = useToggleOpen; exports.ToggleChevron = ToggleChevron; exports.defaultRenderers = defaultRenderers; exports.VoidBlockFallback = VoidBlockFallback; exports.BlockShell = BlockShell; exports.EditorView = EditorView;
|
|
3304
|
+
//# sourceMappingURL=chunk-P6KYXFZC.cjs.map
|