quoin-editor 1.0.1 → 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 +12 -0
- package/dist/ai.cjs +78 -78
- package/dist/ai.js +6 -6
- package/dist/catalogue.cjs +24 -24
- package/dist/catalogue.js +16 -16
- package/dist/{chunk-BTBHHBVR.cjs → chunk-4SLJNZSM.cjs} +11 -7
- package/dist/chunk-4SLJNZSM.cjs.map +1 -0
- package/dist/{chunk-62WKUAQY.js → chunk-4XFXB37X.js} +7 -3
- package/dist/chunk-4XFXB37X.js.map +1 -0
- package/dist/{chunk-56C7GCKO.cjs → chunk-5MAYUGTE.cjs} +97 -97
- package/dist/{chunk-56C7GCKO.cjs.map → chunk-5MAYUGTE.cjs.map} +1 -1
- package/dist/{chunk-QXG3HWDS.js → chunk-623AOJM2.js} +4 -4
- package/dist/{chunk-6YSGUAVW.js → chunk-6NULZPVC.js} +6 -8
- package/dist/chunk-6NULZPVC.js.map +1 -0
- package/dist/{chunk-XX5FTPJR.cjs → chunk-6V6GGBDK.cjs} +10 -10
- package/dist/{chunk-XX5FTPJR.cjs.map → chunk-6V6GGBDK.cjs.map} +1 -1
- package/dist/{chunk-CLTHD5GO.cjs → chunk-73653CJ4.cjs} +3 -3
- package/dist/{chunk-CLTHD5GO.cjs.map → chunk-73653CJ4.cjs.map} +1 -1
- package/dist/{chunk-UBNG5YCG.js → chunk-ADSJ42DO.js} +6 -6
- package/dist/{chunk-PX6LZMH4.cjs → chunk-AUOEM3SF.cjs} +44 -44
- package/dist/{chunk-PX6LZMH4.cjs.map → chunk-AUOEM3SF.cjs.map} +1 -1
- package/dist/{chunk-ESMAW4NK.cjs → chunk-BQANU5BH.cjs} +12 -12
- package/dist/{chunk-ESMAW4NK.cjs.map → chunk-BQANU5BH.cjs.map} +1 -1
- package/dist/{chunk-UCXLRRWY.js → chunk-C23RQVRK.js} +5 -5
- package/dist/{chunk-5R3ISX4A.cjs → chunk-CW3AFJBR.cjs} +288 -295
- package/dist/chunk-CW3AFJBR.cjs.map +1 -0
- package/dist/{chunk-26Q4LSIU.js → chunk-DUE3HCZD.js} +2 -2
- package/dist/{chunk-SSIRYUCK.js → chunk-EPARJI4V.js} +6 -5
- package/dist/chunk-EPARJI4V.js.map +1 -0
- package/dist/{chunk-V3KLMSRO.cjs → chunk-FDRUAL3Z.cjs} +30 -30
- package/dist/{chunk-V3KLMSRO.cjs.map → chunk-FDRUAL3Z.cjs.map} +1 -1
- package/dist/{chunk-A4IJSJKL.js → chunk-IQBMAE3F.js} +5 -5
- package/dist/{chunk-PIWRSX7U.js → chunk-JHQUHFLX.js} +7 -7
- package/dist/{chunk-6PKVJZQV.cjs → chunk-KUYZMSMF.cjs} +8 -8
- package/dist/{chunk-6PKVJZQV.cjs.map → chunk-KUYZMSMF.cjs.map} +1 -1
- package/dist/{chunk-UDAVVEFC.cjs → chunk-LLTEGXWZ.cjs} +54 -54
- package/dist/{chunk-UDAVVEFC.cjs.map → chunk-LLTEGXWZ.cjs.map} +1 -1
- package/dist/{chunk-RQW3P3GH.js → chunk-N4FGA3H4.js} +5 -5
- package/dist/{chunk-LV6EYPJO.js → chunk-NEZJ7ZP5.js} +2 -2
- package/dist/{chunk-UPSLDTLT.js → chunk-OBMBSU2S.js} +3 -3
- package/dist/{chunk-WMN6566P.js → chunk-OSHZQR3W.js} +5 -5
- package/dist/{chunk-5M4QG3ZC.cjs → chunk-P6KYXFZC.cjs} +116 -115
- package/dist/chunk-P6KYXFZC.cjs.map +1 -0
- package/dist/{chunk-75C6PX2L.cjs → chunk-R2BLBV43.cjs} +23 -23
- package/dist/{chunk-75C6PX2L.cjs.map → chunk-R2BLBV43.cjs.map} +1 -1
- package/dist/{chunk-6LMS5J3Y.js → chunk-RJRX34BZ.js} +2 -2
- package/dist/{chunk-LE3F7WIP.js → chunk-T43RZTUT.js} +148 -155
- package/dist/chunk-T43RZTUT.js.map +1 -0
- package/dist/{chunk-MLRAVUFG.cjs → chunk-TLGX43P6.cjs} +17 -19
- package/dist/chunk-TLGX43P6.cjs.map +1 -0
- package/dist/{chunk-LMAEPFTX.js → chunk-U3LOLYAU.js} +2 -2
- package/dist/{chunk-JJ3RASQS.cjs → chunk-UEKXVCKC.cjs} +101 -91
- package/dist/chunk-UEKXVCKC.cjs.map +1 -0
- package/dist/{chunk-GPIDU3GN.js → chunk-VCLL5C7J.js} +5 -5
- package/dist/{chunk-PGSS4IOS.js → chunk-VRS6WCEK.js} +19 -9
- package/dist/chunk-VRS6WCEK.js.map +1 -0
- package/dist/{chunk-VACTAZWS.cjs → chunk-WEYDDIBQ.cjs} +14 -14
- package/dist/{chunk-VACTAZWS.cjs.map → chunk-WEYDDIBQ.cjs.map} +1 -1
- package/dist/{chunk-F5V3IEEE.cjs → chunk-X4HDKFW5.cjs} +27 -27
- package/dist/{chunk-F5V3IEEE.cjs.map → chunk-X4HDKFW5.cjs.map} +1 -1
- package/dist/{chunk-EYFCOV3T.cjs → chunk-X4P4TQXH.cjs} +5 -5
- package/dist/{chunk-EYFCOV3T.cjs.map → chunk-X4P4TQXH.cjs.map} +1 -1
- package/dist/{chunk-UWNZG2SD.cjs → chunk-XA3UEJIW.cjs} +3 -3
- package/dist/{chunk-UWNZG2SD.cjs.map → chunk-XA3UEJIW.cjs.map} +1 -1
- package/dist/{chunk-OCCKQHCY.js → chunk-YBMUEEM5.js} +2 -2
- package/dist/{chunk-HOIDJEVI.cjs → chunk-ZKVOS57Q.cjs} +217 -217
- package/dist/{chunk-HOIDJEVI.cjs.map → chunk-ZKVOS57Q.cjs.map} +1 -1
- package/dist/comments.cjs +58 -58
- package/dist/comments.js +7 -7
- package/dist/diff.cjs +28 -27
- package/dist/diff.cjs.map +1 -1
- package/dist/diff.js +5 -4
- package/dist/diff.js.map +1 -1
- package/dist/docx.cjs +30 -30
- package/dist/docx.js +3 -3
- package/dist/embed.cjs +8 -8
- package/dist/embed.js +7 -7
- package/dist/emoji.cjs +7 -7
- package/dist/emoji.js +6 -6
- package/dist/engine.cjs +4 -4
- package/dist/engine.js +3 -3
- package/dist/find.cjs +7 -7
- package/dist/find.js +6 -6
- package/dist/headless.cjs +5 -5
- package/dist/headless.js +4 -4
- package/dist/index.cjs +6 -6
- package/dist/index.js +5 -5
- package/dist/math.cjs +9 -9
- package/dist/math.js +8 -8
- package/dist/mention.cjs +9 -9
- package/dist/mention.js +8 -8
- package/dist/presence.cjs +39 -42
- package/dist/presence.cjs.map +1 -1
- package/dist/presence.js +9 -12
- package/dist/presence.js.map +1 -1
- package/dist/stats.cjs +8 -8
- package/dist/stats.js +7 -7
- package/dist/table.cjs +7 -7
- package/dist/table.js +6 -6
- package/dist/toc.cjs +7 -7
- package/dist/toc.js +6 -6
- package/dist/view.cjs +4 -4
- package/dist/view.js +2 -2
- package/dist/yjs.cjs +223 -171
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.js +104 -52
- package/dist/yjs.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5M4QG3ZC.cjs.map +0 -1
- package/dist/chunk-5R3ISX4A.cjs.map +0 -1
- package/dist/chunk-62WKUAQY.js.map +0 -1
- package/dist/chunk-6YSGUAVW.js.map +0 -1
- package/dist/chunk-BTBHHBVR.cjs.map +0 -1
- package/dist/chunk-JJ3RASQS.cjs.map +0 -1
- package/dist/chunk-LE3F7WIP.js.map +0 -1
- package/dist/chunk-MLRAVUFG.cjs.map +0 -1
- package/dist/chunk-PGSS4IOS.js.map +0 -1
- package/dist/chunk-SSIRYUCK.js.map +0 -1
- /package/dist/{chunk-QXG3HWDS.js.map → chunk-623AOJM2.js.map} +0 -0
- /package/dist/{chunk-UBNG5YCG.js.map → chunk-ADSJ42DO.js.map} +0 -0
- /package/dist/{chunk-UCXLRRWY.js.map → chunk-C23RQVRK.js.map} +0 -0
- /package/dist/{chunk-26Q4LSIU.js.map → chunk-DUE3HCZD.js.map} +0 -0
- /package/dist/{chunk-A4IJSJKL.js.map → chunk-IQBMAE3F.js.map} +0 -0
- /package/dist/{chunk-PIWRSX7U.js.map → chunk-JHQUHFLX.js.map} +0 -0
- /package/dist/{chunk-RQW3P3GH.js.map → chunk-N4FGA3H4.js.map} +0 -0
- /package/dist/{chunk-LV6EYPJO.js.map → chunk-NEZJ7ZP5.js.map} +0 -0
- /package/dist/{chunk-UPSLDTLT.js.map → chunk-OBMBSU2S.js.map} +0 -0
- /package/dist/{chunk-WMN6566P.js.map → chunk-OSHZQR3W.js.map} +0 -0
- /package/dist/{chunk-6LMS5J3Y.js.map → chunk-RJRX34BZ.js.map} +0 -0
- /package/dist/{chunk-LMAEPFTX.js.map → chunk-U3LOLYAU.js.map} +0 -0
- /package/dist/{chunk-GPIDU3GN.js.map → chunk-VCLL5C7J.js.map} +0 -0
- /package/dist/{chunk-OCCKQHCY.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 _chunkHOIDJEVIcjs = require('./chunk-HOIDJEVI.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;
|
|
@@ -664,8 +665,8 @@ var known = /* @__PURE__ */ new WeakMap();
|
|
|
664
665
|
function hidersOf(doc) {
|
|
665
666
|
let hiders = known.get(doc);
|
|
666
667
|
if (hiders === void 0) {
|
|
667
|
-
const first = doc.blocks.findIndex(
|
|
668
|
-
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));
|
|
669
670
|
known.set(doc, hiders);
|
|
670
671
|
}
|
|
671
672
|
return hiders;
|
|
@@ -674,7 +675,7 @@ var hidingToggleAt = (doc, index) => _nullishCoalesce(hidersOf(doc)[index], () =
|
|
|
674
675
|
function isHiddenAt(doc, index, choices) {
|
|
675
676
|
if (choices.size === 0) return hidingToggleAt(doc, index) !== null;
|
|
676
677
|
const closed = (block) => block.type === "TOGGLE" && !shownOpen(block, choices);
|
|
677
|
-
return
|
|
678
|
+
return _chunkZKVOS57Qcjs.hidingToggle.call(void 0, doc, index + 1, closed) !== null;
|
|
678
679
|
}
|
|
679
680
|
var visibleBlockIndexes = (doc) => hidersOf(doc).flatMap((hider, index) => hider === null ? [index] : []);
|
|
680
681
|
function drawnBlockCount(doc, start = 0, end = doc.blocks.length) {
|
|
@@ -699,13 +700,13 @@ function neighbourBlock(doc, from, direction, accept = anyBlock) {
|
|
|
699
700
|
}
|
|
700
701
|
function entryEdge(controller, block, direction) {
|
|
701
702
|
const { doc, schema } = controller.editor.state;
|
|
702
|
-
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);
|
|
703
704
|
if (edge.kind !== "text") return edge;
|
|
704
705
|
const drawn = controller.registry.get(edge.head.block, edge.head.region) !== void 0;
|
|
705
|
-
return drawn && !entersAsNode(controller, block) ? edge :
|
|
706
|
+
return drawn && !entersAsNode(controller, block) ? edge : _chunkZKVOS57Qcjs.nodeSelection.call(void 0, block);
|
|
706
707
|
}
|
|
707
|
-
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ?
|
|
708
|
-
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";
|
|
709
710
|
function neighbourHead(controller, from, direction) {
|
|
710
711
|
const target = neighbourBlock(controller.editor.state.doc, from, direction, holdsTextHead(controller));
|
|
711
712
|
const edge = target && entryEdge(controller, target.id, direction);
|
|
@@ -844,7 +845,7 @@ function createCrossBlockPointer(controller) {
|
|
|
844
845
|
let preventMouseDown = false;
|
|
845
846
|
const scroll = createAutoScroll(root, () => follow(last.x, last.y));
|
|
846
847
|
function select(selection) {
|
|
847
|
-
if (
|
|
848
|
+
if (_chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, controller.editor.state.selection)) return;
|
|
848
849
|
dispatchSelection(controller, selection);
|
|
849
850
|
}
|
|
850
851
|
function startDragging() {
|
|
@@ -860,14 +861,14 @@ function createCrossBlockPointer(controller) {
|
|
|
860
861
|
if (current.anchor === null) return;
|
|
861
862
|
startDragging();
|
|
862
863
|
}
|
|
863
|
-
select(
|
|
864
|
+
select(_chunkZKVOS57Qcjs.textSelection.call(void 0, current.anchor, caretPosAt(controller, target, x, y)));
|
|
864
865
|
}
|
|
865
866
|
function followBlocks(current, x, y) {
|
|
866
867
|
if (!controller.dragging && Math.hypot(x - current.x, y - current.y) < DRAG_DISTANCE) return;
|
|
867
868
|
const block = blockAt(controller, x, y);
|
|
868
869
|
if (block === null) return;
|
|
869
870
|
startDragging();
|
|
870
|
-
select(
|
|
871
|
+
select(_chunkZKVOS57Qcjs.blockRangeSelection.call(void 0, current.start, block));
|
|
871
872
|
}
|
|
872
873
|
function follow(x, y) {
|
|
873
874
|
if (_optionalChain([press, 'optionalAccess', _40 => _40.kind]) === "text") followText(press, x, y);
|
|
@@ -915,7 +916,7 @@ function createCrossBlockPointer(controller) {
|
|
|
915
916
|
press = { kind: "blocks", start: block, x: event.clientX, y: event.clientY };
|
|
916
917
|
if (!event.shiftKey && entryEdge(controller, block, 1).kind === "node") {
|
|
917
918
|
controller.nodeReveal.pressed(block);
|
|
918
|
-
select(
|
|
919
|
+
select(_chunkZKVOS57Qcjs.nodeSelection.call(void 0, block));
|
|
919
920
|
}
|
|
920
921
|
} else {
|
|
921
922
|
return;
|
|
@@ -943,7 +944,7 @@ function createCrossBlockPointer(controller) {
|
|
|
943
944
|
// src/view/selection/paint-selection.ts
|
|
944
945
|
var NAME = "quoin-selection";
|
|
945
946
|
function coveredRanges(controller) {
|
|
946
|
-
return
|
|
947
|
+
return _chunkZKVOS57Qcjs.markRanges.call(void 0, controller.editor.state).flatMap(({ block, region, from, to }) => {
|
|
947
948
|
const host = controller.registry.get(block, region);
|
|
948
949
|
const map = host && domMapOf(host);
|
|
949
950
|
if (!host || !map) return [];
|
|
@@ -1014,7 +1015,7 @@ function heldBySink(selection) {
|
|
|
1014
1015
|
}
|
|
1015
1016
|
var NO_TEXT = "\xA0";
|
|
1016
1017
|
function selectionText(state) {
|
|
1017
|
-
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");
|
|
1018
1019
|
return text === "" ? NO_TEXT : text;
|
|
1019
1020
|
}
|
|
1020
1021
|
var focusInPlace = (sink) => inPlace(sink, () => sink.focus({ preventScroll: true }));
|
|
@@ -1037,7 +1038,7 @@ function focusSink(controller) {
|
|
|
1037
1038
|
_optionalChain([sink, 'access', _46 => _46.ownerDocument, 'access', _47 => _47.getSelection, 'call', _48 => _48(), 'optionalAccess', _49 => _49.selectAllChildren, 'call', _50 => _50(sink)]);
|
|
1038
1039
|
}
|
|
1039
1040
|
function selectedBlockName({ doc, schema, selection }, blockLabel) {
|
|
1040
|
-
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;
|
|
1041
1042
|
return block === void 0 ? null : _nullishCoalesce(_optionalChain([blockLabel, 'optionalCall', _52 => _52(block, schema)]), () => ( ""));
|
|
1042
1043
|
}
|
|
1043
1044
|
function clearSink(controller) {
|
|
@@ -1174,7 +1175,7 @@ function createElementSlot(changed) {
|
|
|
1174
1175
|
|
|
1175
1176
|
// src/view/controller/selection-element.ts
|
|
1176
1177
|
function elementFor({ doc }, selection, rendered) {
|
|
1177
|
-
const id =
|
|
1178
|
+
const id = _chunkZKVOS57Qcjs.headBlockId.call(void 0, selection);
|
|
1178
1179
|
const index = id === null ? void 0 : doc.index.get(id);
|
|
1179
1180
|
if (id === null || index === void 0) return void 0;
|
|
1180
1181
|
const hiding = hidingToggleAt(doc, index);
|
|
@@ -1187,7 +1188,7 @@ function selectionElement(state, rendered) {
|
|
|
1187
1188
|
if (doc.blocks.length === 0) return _nullishCoalesce(_optionalChain([rendered, 'access', _75 => _75.empty, 'optionalCall', _76 => _76()]), () => ( void 0));
|
|
1188
1189
|
const sink = heldBySink(selection) ? _optionalChain([rendered, 'access', _77 => _77.sink, 'optionalCall', _78 => _78()]) : null;
|
|
1189
1190
|
if (sink) return sink;
|
|
1190
|
-
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)));
|
|
1191
1192
|
}
|
|
1192
1193
|
|
|
1193
1194
|
// src/view/controller/tab-stop.ts
|
|
@@ -1254,9 +1255,9 @@ function ownsFocus(controller, doc) {
|
|
|
1254
1255
|
function focusTarget(state, target) {
|
|
1255
1256
|
const { doc, schema, selection } = state;
|
|
1256
1257
|
if (doc.blocks.length === 0) return null;
|
|
1257
|
-
if (target === "end") return
|
|
1258
|
-
if (target === "start" || target === void 0 && selection === null) return
|
|
1259
|
-
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);
|
|
1260
1261
|
}
|
|
1261
1262
|
|
|
1262
1263
|
// src/view/controller/host-decorations.ts
|
|
@@ -1272,7 +1273,7 @@ function decorationsByHost(decorations) {
|
|
|
1272
1273
|
return byHost;
|
|
1273
1274
|
}
|
|
1274
1275
|
function sameDecoration(a, b) {
|
|
1275
|
-
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;
|
|
1276
1277
|
if (a.kind === "inline" && b.kind === "inline") {
|
|
1277
1278
|
return a.region === b.region && a.from === b.from && a.to === b.to;
|
|
1278
1279
|
}
|
|
@@ -1283,7 +1284,7 @@ function sameDecoration(a, b) {
|
|
|
1283
1284
|
return true;
|
|
1284
1285
|
}
|
|
1285
1286
|
function sameDecorations(a, b) {
|
|
1286
|
-
return a === b ||
|
|
1287
|
+
return a === b || _chunk4SLJNZSMcjs.sameItems.call(void 0, a, b, sameDecoration);
|
|
1287
1288
|
}
|
|
1288
1289
|
var byMode = { highlight: /* @__PURE__ */ new WeakMap(), decorations: /* @__PURE__ */ new WeakMap() };
|
|
1289
1290
|
function hostDecorations(editor, block, region, mode = "highlight") {
|
|
@@ -1299,7 +1300,7 @@ function hostDecorations(editor, block, region, mode = "highlight") {
|
|
|
1299
1300
|
|
|
1300
1301
|
// src/view/controller/region-inline.ts
|
|
1301
1302
|
function regionInline(state, block, region) {
|
|
1302
|
-
const regions = _optionalChain([
|
|
1303
|
+
const regions = _optionalChain([_chunk4SLJNZSMcjs.blockById.call(void 0, state.doc, block), 'optionalAccess', _86 => _86.regions]);
|
|
1303
1304
|
return regions && Object.hasOwn(regions, region) ? regions[region] : void 0;
|
|
1304
1305
|
}
|
|
1305
1306
|
|
|
@@ -1349,7 +1350,7 @@ function createOutsideChanges(editorHasFocus, movedFrom) {
|
|
|
1349
1350
|
}
|
|
1350
1351
|
const from = _nullishCoalesce(moved, () => ( (outside && !settled ? movedFrom(tr.before.selection) : null)));
|
|
1351
1352
|
settled ||= outside;
|
|
1352
|
-
moved = from &&
|
|
1353
|
+
moved = from && _chunkZKVOS57Qcjs.mapSelection.call(void 0, from, (pos, assoc) => tr.mapPos(pos, assoc), tr.before.doc);
|
|
1353
1354
|
},
|
|
1354
1355
|
takeFocused() {
|
|
1355
1356
|
const value = focused;
|
|
@@ -1442,7 +1443,7 @@ function handleCopy(controller, event, cut) {
|
|
|
1442
1443
|
clipboardData.setData("text/plain", copied.text);
|
|
1443
1444
|
clipboardData.setData("text/html", wrapSliceHTML(copied.html, copied.json));
|
|
1444
1445
|
clipboardData.setData(QUOIN_SLICE_TYPE, copied.json);
|
|
1445
|
-
if (cut) controller.run(
|
|
1446
|
+
if (cut) controller.run(_chunkZKVOS57Qcjs.deleteSelection);
|
|
1446
1447
|
}
|
|
1447
1448
|
function handlePaste(controller, event) {
|
|
1448
1449
|
if (!event.clipboardData) return;
|
|
@@ -1474,7 +1475,7 @@ function handleDrop(controller, event) {
|
|
|
1474
1475
|
return;
|
|
1475
1476
|
}
|
|
1476
1477
|
const pos = dropPos(controller, event.clientX, event.clientY);
|
|
1477
|
-
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(
|
|
1478
|
+
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(_chunkZKVOS57Qcjs.textSelection.call(void 0, pos)).setOrigin("drop"));
|
|
1478
1479
|
pasteTransfer(controller, dataTransfer);
|
|
1479
1480
|
}
|
|
1480
1481
|
function handleDragOver(event) {
|
|
@@ -1602,29 +1603,29 @@ function createSinkComposition(controller) {
|
|
|
1602
1603
|
var LINE_BREAK = "\n";
|
|
1603
1604
|
var transposeChars = (state, dispatch) => {
|
|
1604
1605
|
const { selection } = state;
|
|
1605
|
-
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;
|
|
1606
1607
|
const { head } = selection;
|
|
1607
|
-
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]]);
|
|
1608
1609
|
if (inline === void 0) return false;
|
|
1609
|
-
const value =
|
|
1610
|
+
const value = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1610
1611
|
const atLineEnd = head.offset === value.length || value[head.offset] === LINE_BREAK;
|
|
1611
|
-
const end = atLineEnd ? head.offset :
|
|
1612
|
-
const middle =
|
|
1613
|
-
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);
|
|
1614
1615
|
if (start === middle || value.slice(start, end).includes(LINE_BREAK)) return false;
|
|
1615
|
-
const swapped = [...
|
|
1616
|
-
const tr = new (0,
|
|
1617
|
-
tr.step(
|
|
1618
|
-
_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 })))]);
|
|
1619
1620
|
return true;
|
|
1620
1621
|
};
|
|
1621
1622
|
|
|
1622
1623
|
// src/view/input/replace-range.ts
|
|
1623
1624
|
function replaceRange(editor, range, text, withRules) {
|
|
1624
1625
|
const dispatch = (tr) => editor.dispatch(tr);
|
|
1625
|
-
dispatch(editor.createTransaction().setSelection(
|
|
1626
|
-
if (text === "") return
|
|
1627
|
-
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);
|
|
1628
1629
|
}
|
|
1629
1630
|
|
|
1630
1631
|
// src/view/input/target-range.ts
|
|
@@ -1635,13 +1636,13 @@ function targetRangeToModel(controller, event) {
|
|
|
1635
1636
|
const to = domToPos(controller.registry, range.endContainer, range.endOffset);
|
|
1636
1637
|
return from && to && { from, to };
|
|
1637
1638
|
}
|
|
1638
|
-
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));
|
|
1639
1640
|
function targetBeyondSelection(controller, event) {
|
|
1640
1641
|
const range = targetRangeToModel(controller, event);
|
|
1641
1642
|
if (range === null || isEmpty(range)) return null;
|
|
1642
1643
|
const { doc, selection } = controller.editor.state;
|
|
1643
|
-
const selected =
|
|
1644
|
-
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));
|
|
1645
1646
|
return same ? null : range;
|
|
1646
1647
|
}
|
|
1647
1648
|
|
|
@@ -1663,34 +1664,34 @@ function insertTypedText(controller, event) {
|
|
|
1663
1664
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1664
1665
|
}
|
|
1665
1666
|
function deleteContentBackward(controller, event) {
|
|
1666
|
-
if (!controller.run(
|
|
1667
|
+
if (!controller.run(_chunkZKVOS57Qcjs.undoInputRule)) targetOr((0, _chunkZKVOS57Qcjs.deleteBackward))(controller, event);
|
|
1667
1668
|
}
|
|
1668
1669
|
function insertReplacementText(controller, event) {
|
|
1669
1670
|
const text = _optionalChain([event, 'access', _117 => _117.dataTransfer, 'optionalAccess', _118 => _118.getData, 'call', _119 => _119("text/plain")]) || event.data;
|
|
1670
1671
|
if (!text) return;
|
|
1671
1672
|
const range = targetRangeToModel(controller, event);
|
|
1672
|
-
if (range === null) controller.run(
|
|
1673
|
+
if (range === null) controller.run(_chunkZKVOS57Qcjs.insertText.call(void 0, text, { origin: "input" }));
|
|
1673
1674
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1674
1675
|
}
|
|
1675
1676
|
var actions = {
|
|
1676
1677
|
insertText: insertTypedText,
|
|
1677
1678
|
insertReplacementText,
|
|
1678
1679
|
insertParagraph: (controller) => void controller.edit(() => controller.editor.handleKey(ENTER)),
|
|
1679
|
-
insertLineBreak: run(
|
|
1680
|
+
insertLineBreak: run(_chunkZKVOS57Qcjs.insertHardBreak),
|
|
1680
1681
|
deleteContentBackward,
|
|
1681
|
-
deleteContentForward: targetOr(
|
|
1682
|
-
deleteWordBackward: targetOr(
|
|
1683
|
-
deleteWordForward: targetOr(
|
|
1684
|
-
deleteSoftLineBackward: targetOr(
|
|
1685
|
-
deleteHardLineBackward: targetOr(
|
|
1686
|
-
deleteSoftLineForward: targetOr(
|
|
1687
|
-
deleteHardLineForward: targetOr(
|
|
1688
|
-
formatBold: run(
|
|
1689
|
-
formatItalic: run(
|
|
1690
|
-
formatUnderline: run(
|
|
1691
|
-
formatStrikeThrough: run(
|
|
1692
|
-
historyUndo: run(
|
|
1693
|
-
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),
|
|
1694
1695
|
insertTranspose: run(transposeChars),
|
|
1695
1696
|
insertFromPaste: leaveToHandlers,
|
|
1696
1697
|
insertFromDrop: leaveToHandlers,
|
|
@@ -1791,7 +1792,7 @@ function snapshotComposition(controller, block, region) {
|
|
|
1791
1792
|
const element = controller.registry.get(block, region);
|
|
1792
1793
|
const inline = regionInline(editor.state, block, region);
|
|
1793
1794
|
if (element === void 0 || inline === void 0) return null;
|
|
1794
|
-
const text =
|
|
1795
|
+
const text = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1795
1796
|
const end = composedEnd(controller, block, region);
|
|
1796
1797
|
const since = [];
|
|
1797
1798
|
const release = editor.subscribe((_, tr) => void (tr && since.push(tr)));
|
|
@@ -1903,7 +1904,7 @@ function reconcileHost(controller, block, region, caretHint) {
|
|
|
1903
1904
|
const element = controller.registry.get(block, region);
|
|
1904
1905
|
const inline = regionInline(controller.editor.state, block, region);
|
|
1905
1906
|
if (element === void 0 || inline === void 0) return false;
|
|
1906
|
-
const before =
|
|
1907
|
+
const before = _chunk4SLJNZSMcjs.inlineText.call(void 0, inline);
|
|
1907
1908
|
const after = readDomText(element);
|
|
1908
1909
|
const edit = before === after ? null : textDiff(before, after, _nullishCoalesce(caretHint, () => ( domCaretOffset(element))));
|
|
1909
1910
|
if (edit === null) return false;
|
|
@@ -1968,33 +1969,33 @@ function createDomInputFallback(controller) {
|
|
|
1968
1969
|
|
|
1969
1970
|
// src/view/navigation/cross-moves.ts
|
|
1970
1971
|
function moveHead(controller, { anchor }, head) {
|
|
1971
|
-
dispatchSelection(controller,
|
|
1972
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.textSelection.call(void 0, anchor, head));
|
|
1972
1973
|
return true;
|
|
1973
1974
|
}
|
|
1974
1975
|
function blockOf(controller, { block }) {
|
|
1975
1976
|
const { doc } = controller.editor.state;
|
|
1976
|
-
return doc.blocks[
|
|
1977
|
+
return doc.blocks[_chunk4SLJNZSMcjs.requireBlockIndex.call(void 0, doc, block)];
|
|
1977
1978
|
}
|
|
1978
1979
|
function collapseCross(controller, selection, direction) {
|
|
1979
|
-
const { from, to } =
|
|
1980
|
-
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));
|
|
1981
1982
|
return true;
|
|
1982
1983
|
}
|
|
1983
1984
|
function crossHeadVertically(controller, selection, direction) {
|
|
1984
1985
|
const { head } = selection;
|
|
1985
1986
|
const edge = neighbourHead(controller, head.block, direction);
|
|
1986
1987
|
if (edge !== null) {
|
|
1987
|
-
const end2 =
|
|
1988
|
+
const end2 = _chunkZKVOS57Qcjs.regionLength.call(void 0, blockOf(controller, edge), edge.region);
|
|
1988
1989
|
return moveHead(controller, selection, { ...edge, offset: Math.min(head.offset, end2) });
|
|
1989
1990
|
}
|
|
1990
|
-
const end =
|
|
1991
|
+
const end = _chunkZKVOS57Qcjs.regionLength.call(void 0, blockOf(controller, head), head.region);
|
|
1991
1992
|
return moveHead(controller, selection, { ...head, offset: direction < 0 ? 0 : end });
|
|
1992
1993
|
}
|
|
1993
1994
|
function crossHeadHorizontally(controller, selection, direction) {
|
|
1994
1995
|
const { head } = selection;
|
|
1995
|
-
const text =
|
|
1996
|
+
const text = _chunk4SLJNZSMcjs.inlineText.call(void 0, _nullishCoalesce(blockOf(controller, head).regions[head.region], () => ( [])));
|
|
1996
1997
|
if (direction < 0 ? head.offset > 0 : head.offset < text.length) {
|
|
1997
|
-
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);
|
|
1998
1999
|
return moveHead(controller, selection, { ...head, offset });
|
|
1999
2000
|
}
|
|
2000
2001
|
const edge = neighbourHead(controller, head.block, direction);
|
|
@@ -2013,9 +2014,9 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
2013
2014
|
const move = extend ? crossHeadHorizontally : collapseCross;
|
|
2014
2015
|
return move(controller, selection, direction);
|
|
2015
2016
|
}
|
|
2016
|
-
if (!extend && !
|
|
2017
|
+
if (!extend && !_chunkZKVOS57Qcjs.isCollapsed.call(void 0, selection)) return false;
|
|
2017
2018
|
const { head } = selection;
|
|
2018
|
-
const length =
|
|
2019
|
+
const length = _chunkZKVOS57Qcjs.regionLength.call(void 0, doc.blocks[_chunk4SLJNZSMcjs.requireBlockIndex.call(void 0, doc, head.block)], head.region);
|
|
2019
2020
|
if (direction < 0 ? head.offset > 0 : head.offset < length) return false;
|
|
2020
2021
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2021
2022
|
if (own2 !== null) {
|
|
@@ -2025,7 +2026,7 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
2025
2026
|
if (!extend) return moveToNeighbour(controller, head.block, direction);
|
|
2026
2027
|
const edge = neighbourHead(controller, head.block, direction);
|
|
2027
2028
|
if (edge === null) return false;
|
|
2028
|
-
dispatchSelection(controller,
|
|
2029
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.textSelection.call(void 0, selection.anchor, edge));
|
|
2029
2030
|
return true;
|
|
2030
2031
|
}
|
|
2031
2032
|
|
|
@@ -2123,12 +2124,12 @@ function caretAtGoal(controller, host, at, y) {
|
|
|
2123
2124
|
}
|
|
2124
2125
|
function landAtGoal(controller, block, direction) {
|
|
2125
2126
|
const { schema } = controller.editor.state;
|
|
2126
|
-
const region =
|
|
2127
|
+
const region = _chunkZKVOS57Qcjs.isTextFlow.call(void 0, schema, block) ? _chunkZKVOS57Qcjs.primaryRegion.call(void 0, schema, block) : null;
|
|
2127
2128
|
const host = region === null ? void 0 : controller.registry.get(block.id, region);
|
|
2128
2129
|
if (!host || region === null || controller.goalX === null) return null;
|
|
2129
2130
|
const line = lineInView(host, direction < 0);
|
|
2130
2131
|
const pos = line && caretAtGoal(controller, host, { block: block.id, region }, line.top + line.height / 2);
|
|
2131
|
-
return pos ?
|
|
2132
|
+
return pos ? _chunkZKVOS57Qcjs.textSelection.call(void 0, pos) : null;
|
|
2132
2133
|
}
|
|
2133
2134
|
function moveInHost(controller, host, head, caret, direction) {
|
|
2134
2135
|
const { goalX } = controller;
|
|
@@ -2146,7 +2147,7 @@ function landing(controller, { head }, direction, extend) {
|
|
|
2146
2147
|
controller.goalX ??= _nullishCoalesce(_optionalChain([caret, 'optionalAccess', _147 => _147.left]), () => ( null));
|
|
2147
2148
|
if (!(direction < 0 ? isOnFirstLine(host, point) : isOnLastLine(host, point))) {
|
|
2148
2149
|
const pos = moveInHost(controller, host, head, caret, direction);
|
|
2149
|
-
return pos &&
|
|
2150
|
+
return pos && _chunkZKVOS57Qcjs.textSelection.call(void 0, pos);
|
|
2150
2151
|
}
|
|
2151
2152
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2152
2153
|
if (own2 !== null) return own2;
|
|
@@ -2160,14 +2161,14 @@ function moveText(controller, selection, direction, extend) {
|
|
|
2160
2161
|
controller.nativeVerticalMove = true;
|
|
2161
2162
|
return false;
|
|
2162
2163
|
}
|
|
2163
|
-
const moved = extend && next.kind === "text" ?
|
|
2164
|
+
const moved = extend && next.kind === "text" ? _chunkZKVOS57Qcjs.textSelection.call(void 0, selection.anchor, next.head) : next;
|
|
2164
2165
|
dispatchSelection(controller, moved);
|
|
2165
2166
|
return true;
|
|
2166
2167
|
}
|
|
2167
2168
|
function extendBlocks(controller, { anchor, head }, direction) {
|
|
2168
2169
|
const next = neighbourBlock(controller.editor.state.doc, head, direction);
|
|
2169
2170
|
if (next === null) return false;
|
|
2170
|
-
dispatchSelection(controller,
|
|
2171
|
+
dispatchSelection(controller, _chunkZKVOS57Qcjs.blockRangeSelection.call(void 0, anchor, next.id));
|
|
2171
2172
|
return true;
|
|
2172
2173
|
}
|
|
2173
2174
|
function moveVertically(controller, direction, extend) {
|
|
@@ -2183,8 +2184,8 @@ function moveVertically(controller, direction, extend) {
|
|
|
2183
2184
|
// src/view/input/flip-block.ts
|
|
2184
2185
|
var isTask = ({ type, attrs }) => type === "MARKDOWN" && attrs.kind === "task";
|
|
2185
2186
|
function flipCommand(block) {
|
|
2186
|
-
if (isTask(block)) return
|
|
2187
|
-
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;
|
|
2188
2189
|
}
|
|
2189
2190
|
var toggleState = (open) => open ? "expanded" : "collapsed";
|
|
2190
2191
|
function stateName(block) {
|
|
@@ -2193,7 +2194,7 @@ function stateName(block) {
|
|
|
2193
2194
|
}
|
|
2194
2195
|
function blockHoldingCaret({ doc, selection }) {
|
|
2195
2196
|
if (_optionalChain([selection, 'optionalAccess', _151 => _151.kind]) !== "text" || selection.anchor.block !== selection.head.block) return null;
|
|
2196
|
-
return _nullishCoalesce(
|
|
2197
|
+
return _nullishCoalesce(_chunk4SLJNZSMcjs.blockById.call(void 0, doc, selection.head.block), () => ( null));
|
|
2197
2198
|
}
|
|
2198
2199
|
function flipForReader(controller, block) {
|
|
2199
2200
|
if (_optionalChain([block, 'optionalAccess', _152 => _152.type]) !== "TOGGLE") return false;
|
|
@@ -2208,7 +2209,7 @@ function flipSelectedBlock(controller) {
|
|
|
2208
2209
|
if (controller.readOnly) return flipForReader(controller, block);
|
|
2209
2210
|
const command = block && flipCommand(block);
|
|
2210
2211
|
if (!block || !command || !controller.run(command)) return false;
|
|
2211
|
-
const after =
|
|
2212
|
+
const after = _chunk4SLJNZSMcjs.blockById.call(void 0, editor.state.doc, block.id);
|
|
2212
2213
|
if (after) controller.announce(stateName(after));
|
|
2213
2214
|
return true;
|
|
2214
2215
|
}
|
|
@@ -2419,7 +2420,7 @@ function bindRoot(controller, root, cross, committed) {
|
|
|
2419
2420
|
function movedSelection(controller, doc, model) {
|
|
2420
2421
|
if (controller.composingKey !== null || controller.dragging || !doc || !ownsFocus(controller, doc)) return null;
|
|
2421
2422
|
const selection = readSelection(controller.registry, doc.getSelection(), (node) => controller.blockAt(node));
|
|
2422
|
-
return selection === null ||
|
|
2423
|
+
return selection === null || _chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, model) ? null : selection;
|
|
2423
2424
|
}
|
|
2424
2425
|
function writeModelSelection(controller, doc, moved, local) {
|
|
2425
2426
|
const domSelection = _optionalChain([doc, 'optionalAccess', _168 => _168.getSelection, 'call', _169 => _169()]);
|
|
@@ -2477,7 +2478,7 @@ var ViewController = (_class = class {
|
|
|
2477
2478
|
});
|
|
2478
2479
|
this.#flush = _nullishCoalesce(options.flush, () => ( runNow));
|
|
2479
2480
|
this.onFiles = options.onFiles;
|
|
2480
|
-
this.isMac = _nullishCoalesce(options.isMac, () => (
|
|
2481
|
+
this.isMac = _nullishCoalesce(options.isMac, () => ( _chunkZKVOS57Qcjs.detectMac.call(void 0, )));
|
|
2481
2482
|
const decorationsOf = (block, region) => this.decorationsFor(block, region);
|
|
2482
2483
|
const drain = (element) => _optionalChain([this, 'access', _188 => _188.#binding, 'optionalAccess', _189 => _189.input, 'access', _190 => _190.drain, 'call', _191 => _191(element)]);
|
|
2483
2484
|
this.#hosts = createHostRenderer(options.editor, options.render, decorationsOf, drain);
|
|
@@ -2630,7 +2631,7 @@ var ViewController = (_class = class {
|
|
|
2630
2631
|
focus(target) {
|
|
2631
2632
|
const { editor } = this;
|
|
2632
2633
|
const selection = focusTarget(editor.state, target);
|
|
2633
|
-
if (selection !== null && !
|
|
2634
|
+
if (selection !== null && !_chunkZKVOS57Qcjs.sameSelection.call(void 0, selection, editor.state.selection)) dispatchSelection(this, selection);
|
|
2634
2635
|
this.#takeFocus();
|
|
2635
2636
|
this.syncSelectionToDom();
|
|
2636
2637
|
}
|
|
@@ -2688,7 +2689,7 @@ function useQuoinEditor(options) {
|
|
|
2688
2689
|
const { blocks, readOnly = false } = options;
|
|
2689
2690
|
const callbacks = _react.useRef.call(void 0, options);
|
|
2690
2691
|
const [controller] = _react.useState.call(void 0, () => {
|
|
2691
|
-
const editor =
|
|
2692
|
+
const editor = _chunkZKVOS57Qcjs.createEditor.call(void 0, {
|
|
2692
2693
|
blocks,
|
|
2693
2694
|
extensions: options.extensions,
|
|
2694
2695
|
onChange: (next) => callbacks.current.onChange(next),
|
|
@@ -2766,11 +2767,11 @@ function SelectionSink({ label = "Selected content", blockLabel }) {
|
|
|
2766
2767
|
|
|
2767
2768
|
// src/view/react/block-placeholder.ts
|
|
2768
2769
|
|
|
2769
|
-
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;
|
|
2770
2771
|
var BlockPlaceholderContext = _react.createContext.call(void 0, headingPlaceholder);
|
|
2771
2772
|
function regionPlaceholder(state, blockId, region, placeholderOf) {
|
|
2772
|
-
const block =
|
|
2773
|
-
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;
|
|
2774
2775
|
}
|
|
2775
2776
|
|
|
2776
2777
|
// src/view/react/EditableRegion.tsx
|
|
@@ -2784,7 +2785,7 @@ function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
|
2784
2785
|
const select = _react.useCallback.call(void 0,
|
|
2785
2786
|
(state) => {
|
|
2786
2787
|
const inline2 = regionInline(state, block, region);
|
|
2787
|
-
const empty = inline2 === void 0 ||
|
|
2788
|
+
const empty = inline2 === void 0 || _chunk4SLJNZSMcjs.inlineLength.call(void 0, inline2) === 0;
|
|
2788
2789
|
return {
|
|
2789
2790
|
inline: inline2,
|
|
2790
2791
|
decorations: controller.decorationsFor(block, region),
|
|
@@ -2835,7 +2836,7 @@ var CalloutBlock = ({ block }) => {
|
|
|
2835
2836
|
// src/view/react/block-command.ts
|
|
2836
2837
|
function onBlock(id, command) {
|
|
2837
2838
|
return (state, dispatch) => {
|
|
2838
|
-
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]);
|
|
2839
2840
|
if (!ok || tr === null) return false;
|
|
2840
2841
|
_optionalChain([dispatch, 'optionalCall', _227 => _227(tr.setSelection(state.selection))]);
|
|
2841
2842
|
return true;
|
|
@@ -2847,7 +2848,7 @@ var keepFocus = (event) => event.preventDefault();
|
|
|
2847
2848
|
|
|
2848
2849
|
// src/view/react/TaskCheckbox.tsx
|
|
2849
2850
|
|
|
2850
|
-
function TaskCheckbox({ block, controller, label
|
|
2851
|
+
function TaskCheckbox({ block, controller, label, labelledBy }) {
|
|
2851
2852
|
const checked = block.attrs.checked === true;
|
|
2852
2853
|
const flip2 = flipCommand(block);
|
|
2853
2854
|
const readOnly = useReadOnly(controller);
|
|
@@ -2858,7 +2859,7 @@ function TaskCheckbox({ block, controller, label = "Task", labelledBy }) {
|
|
|
2858
2859
|
role: "checkbox",
|
|
2859
2860
|
"aria-checked": checked,
|
|
2860
2861
|
"aria-readonly": readOnly ? "true" : void 0,
|
|
2861
|
-
"aria-label": label,
|
|
2862
|
+
"aria-label": _chunk4SLJNZSMcjs.firstNamed.call(void 0, label, "Task"),
|
|
2862
2863
|
"aria-labelledby": labelledBy,
|
|
2863
2864
|
className: "quoin-task-box",
|
|
2864
2865
|
contentEditable: false,
|
|
@@ -2889,7 +2890,7 @@ function numberDoc(doc) {
|
|
|
2889
2890
|
numbers[index] = run2.next++;
|
|
2890
2891
|
return;
|
|
2891
2892
|
}
|
|
2892
|
-
const start =
|
|
2893
|
+
const start = _chunk4SLJNZSMcjs.orderedStart.call(void 0, block.attrs.start);
|
|
2893
2894
|
numbers[index] = start;
|
|
2894
2895
|
runs.push({ indent: block.indent, next: start + 1 });
|
|
2895
2896
|
});
|
|
@@ -2930,7 +2931,7 @@ var MarkdownBlock = (props) => {
|
|
|
2930
2931
|
const { block } = props;
|
|
2931
2932
|
switch (block.attrs.kind) {
|
|
2932
2933
|
case "heading": {
|
|
2933
|
-
const level =
|
|
2934
|
+
const level = _chunk4SLJNZSMcjs.headingLevel.call(void 0, block.attrs.level);
|
|
2934
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}` }) });
|
|
2935
2936
|
}
|
|
2936
2937
|
case "bullet":
|
|
@@ -3041,7 +3042,7 @@ function covers(state, id, index) {
|
|
|
3041
3042
|
if (selection === null) return false;
|
|
3042
3043
|
if (selection.kind === "node") return selection.block === id;
|
|
3043
3044
|
if (selection.kind === "blocks") return within(state, index, [selection.anchor, selection.head]);
|
|
3044
|
-
if (!isCrossSelection(selection) ||
|
|
3045
|
+
if (!isCrossSelection(selection) || _chunkZKVOS57Qcjs.isTextFlow.call(void 0, schema, doc.blocks[index])) return false;
|
|
3045
3046
|
return within(state, index, [selection.anchor.block, selection.head.block]);
|
|
3046
3047
|
}
|
|
3047
3048
|
function blockStatus(state, id, choices = NO_CHOICES) {
|
|
@@ -3081,11 +3082,11 @@ var BlockShell = _react.memo.call(void 0, function BlockShell2({ block, renderer
|
|
|
3081
3082
|
"data-quoin-block": "",
|
|
3082
3083
|
"data-block-id": block.id,
|
|
3083
3084
|
"data-type": block.type,
|
|
3084
|
-
"data-kind":
|
|
3085
|
+
"data-kind": _chunk4SLJNZSMcjs.optionalString.call(void 0, kind),
|
|
3085
3086
|
"data-indent": block.indent,
|
|
3086
|
-
"data-color":
|
|
3087
|
-
"data-bg":
|
|
3088
|
-
"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),
|
|
3089
3090
|
style: { "--quoin-indent": block.indent },
|
|
3090
3091
|
tabIndex: -1,
|
|
3091
3092
|
"data-selected": status === "selected" ? "true" : void 0,
|
|
@@ -3300,4 +3301,4 @@ function EditorView({
|
|
|
3300
3301
|
|
|
3301
3302
|
|
|
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;
|
|
3303
|
-
//# sourceMappingURL=chunk-
|
|
3304
|
+
//# sourceMappingURL=chunk-P6KYXFZC.cjs.map
|