quoin-editor 1.1.1 → 1.1.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 +6 -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-CKHKCPGL.js → chunk-36OSSZDK.js} +6 -6
- package/dist/{chunk-CKHKCPGL.js.map → chunk-36OSSZDK.js.map} +1 -1
- package/dist/{chunk-3BXUGX5F.js → chunk-3G4ZWUUY.js} +4 -16
- package/dist/chunk-3G4ZWUUY.js.map +1 -0
- package/dist/{chunk-VNRI5DAL.cjs → chunk-5DEPLPDS.cjs} +28 -28
- package/dist/{chunk-VNRI5DAL.cjs.map → chunk-5DEPLPDS.cjs.map} +1 -1
- package/dist/{chunk-2EQ6FKSK.js → chunk-5LWJDRWD.js} +3 -3
- package/dist/{chunk-2EQ6FKSK.js.map → chunk-5LWJDRWD.js.map} +1 -1
- package/dist/{chunk-WAGBELKA.js → chunk-5QNNF5ZJ.js} +5 -5
- package/dist/{chunk-WAGBELKA.js.map → chunk-5QNNF5ZJ.js.map} +1 -1
- package/dist/{chunk-AIS37SL2.cjs → chunk-6H76FAI3.cjs} +79 -7
- package/dist/chunk-6H76FAI3.cjs.map +1 -0
- package/dist/{chunk-KXRGY5LK.cjs → chunk-6QLA3JOU.cjs} +90 -90
- package/dist/{chunk-KXRGY5LK.cjs.map → chunk-6QLA3JOU.cjs.map} +1 -1
- package/dist/{chunk-7XQGOCUG.cjs → chunk-ABVSP2XR.cjs} +290 -291
- package/dist/chunk-ABVSP2XR.cjs.map +1 -0
- package/dist/{chunk-MUIPM26J.js → chunk-AQNVYFEU.js} +6 -6
- package/dist/{chunk-MUIPM26J.js.map → chunk-AQNVYFEU.js.map} +1 -1
- package/dist/{chunk-U5BSCAMP.cjs → chunk-BMEEEI43.cjs} +13 -13
- package/dist/{chunk-U5BSCAMP.cjs.map → chunk-BMEEEI43.cjs.map} +1 -1
- package/dist/{chunk-RIIXJWBR.cjs → chunk-E52VO5JT.cjs} +4 -4
- package/dist/{chunk-RIIXJWBR.cjs.map → chunk-E52VO5JT.cjs.map} +1 -1
- package/dist/{chunk-7NAONESM.cjs → chunk-EABO523V.cjs} +31 -31
- package/dist/{chunk-7NAONESM.cjs.map → chunk-EABO523V.cjs.map} +1 -1
- package/dist/{chunk-VBJY2CSK.js → chunk-EDKQQKQR.js} +6 -6
- package/dist/{chunk-VBJY2CSK.js.map → chunk-EDKQQKQR.js.map} +1 -1
- package/dist/{chunk-OKWER2RV.cjs → chunk-ES2QYHXL.cjs} +45 -45
- package/dist/{chunk-OKWER2RV.cjs.map → chunk-ES2QYHXL.cjs.map} +1 -1
- package/dist/{chunk-IEP7BPFN.js → chunk-G7HK4OHE.js} +4 -4
- package/dist/{chunk-IEP7BPFN.js.map → chunk-G7HK4OHE.js.map} +1 -1
- package/dist/{chunk-L4D23LM2.js → chunk-IVWFPFUG.js} +4 -4
- package/dist/{chunk-L4D23LM2.js.map → chunk-IVWFPFUG.js.map} +1 -1
- package/dist/{chunk-SFMORPWB.js → chunk-J37ORWSG.js} +7 -7
- package/dist/{chunk-SFMORPWB.js.map → chunk-J37ORWSG.js.map} +1 -1
- package/dist/{chunk-DYWU4SQ2.js → chunk-JEFQNZO4.js} +5 -6
- package/dist/chunk-JEFQNZO4.js.map +1 -0
- package/dist/{chunk-UEVR4B5S.js → chunk-JHA23OOK.js} +6 -6
- package/dist/{chunk-UEVR4B5S.js.map → chunk-JHA23OOK.js.map} +1 -1
- package/dist/{chunk-7FAVFJAS.js → chunk-JYO2T4MC.js} +3 -3
- package/dist/{chunk-7FAVFJAS.js.map → chunk-JYO2T4MC.js.map} +1 -1
- package/dist/{chunk-HQ43EIYO.cjs → chunk-K5HWMBWH.cjs} +9 -9
- package/dist/{chunk-HQ43EIYO.cjs.map → chunk-K5HWMBWH.cjs.map} +1 -1
- package/dist/{chunk-OM7E43ZN.cjs → chunk-KFIE4OJE.cjs} +15 -15
- package/dist/{chunk-OM7E43ZN.cjs.map → chunk-KFIE4OJE.cjs.map} +1 -1
- package/dist/{chunk-W7B4WQ3L.cjs → chunk-KKRQDVBJ.cjs} +24 -24
- package/dist/{chunk-W7B4WQ3L.cjs.map → chunk-KKRQDVBJ.cjs.map} +1 -1
- package/dist/{chunk-VFSVN5IQ.cjs → chunk-M5FREXRQ.cjs} +218 -218
- package/dist/{chunk-VFSVN5IQ.cjs.map → chunk-M5FREXRQ.cjs.map} +1 -1
- package/dist/{chunk-7SVKLWDT.cjs → chunk-OAAYF2EI.cjs} +13 -26
- package/dist/chunk-OAAYF2EI.cjs.map +1 -0
- package/dist/{chunk-HTLWPSMU.js → chunk-OIQAO7QU.js} +4 -4
- package/dist/{chunk-HTLWPSMU.js.map → chunk-OIQAO7QU.js.map} +1 -1
- package/dist/{chunk-3QRVAI53.cjs → chunk-P3T5XBYW.cjs} +6 -6
- package/dist/{chunk-3QRVAI53.cjs.map → chunk-P3T5XBYW.cjs.map} +1 -1
- package/dist/{chunk-EFRQMYZ6.cjs → chunk-PNMBRBAT.cjs} +4 -4
- package/dist/{chunk-EFRQMYZ6.cjs.map → chunk-PNMBRBAT.cjs.map} +1 -1
- package/dist/{chunk-RFLFRIPV.js → chunk-PRXIYHSX.js} +6 -6
- package/dist/{chunk-RFLFRIPV.js.map → chunk-PRXIYHSX.js.map} +1 -1
- package/dist/{chunk-JCEFSTVG.cjs → chunk-QAI3CM7V.cjs} +55 -55
- package/dist/{chunk-JCEFSTVG.cjs.map → chunk-QAI3CM7V.cjs.map} +1 -1
- package/dist/{chunk-L6OW2FL3.js → chunk-QLDXQOHQ.js} +79 -8
- package/dist/chunk-QLDXQOHQ.js.map +1 -0
- package/dist/{chunk-TYZSB7JT.js → chunk-RUC5OZXO.js} +3 -3
- package/dist/{chunk-TYZSB7JT.js.map → chunk-RUC5OZXO.js.map} +1 -1
- package/dist/{chunk-WH56EW3H.cjs → chunk-UGAOEZ3O.cjs} +15 -15
- package/dist/{chunk-WH56EW3H.cjs.map → chunk-UGAOEZ3O.cjs.map} +1 -1
- package/dist/{chunk-KZ6ZFCGO.js → chunk-V2ZBA5VC.js} +8 -8
- package/dist/{chunk-KZ6ZFCGO.js.map → chunk-V2ZBA5VC.js.map} +1 -1
- package/dist/{chunk-IGZRZIAF.cjs → chunk-VSUGJZ7G.cjs} +118 -118
- package/dist/{chunk-IGZRZIAF.cjs.map → chunk-VSUGJZ7G.cjs.map} +1 -1
- package/dist/{chunk-XAS7LANM.cjs → chunk-XJ32XESJ.cjs} +98 -98
- package/dist/{chunk-XAS7LANM.cjs.map → chunk-XJ32XESJ.cjs.map} +1 -1
- package/dist/{chunk-QSXPKZ2F.js → chunk-ZEQXMRJW.js} +3 -3
- package/dist/{chunk-QSXPKZ2F.js.map → chunk-ZEQXMRJW.js.map} +1 -1
- package/dist/{chunk-L2QA2UTY.js → chunk-ZPGA5UIY.js} +7 -7
- package/dist/{chunk-L2QA2UTY.js.map → chunk-ZPGA5UIY.js.map} +1 -1
- package/dist/comments.cjs +58 -58
- package/dist/comments.js +7 -7
- package/dist/diff.cjs +27 -27
- package/dist/diff.js +3 -3
- package/dist/docx.cjs +30 -30
- package/dist/docx.js +3 -3
- package/dist/embed.cjs +9 -9
- package/dist/embed.js +7 -7
- package/dist/emoji.cjs +9 -9
- package/dist/emoji.js +6 -6
- package/dist/engine.cjs +58 -58
- package/dist/engine.js +3 -3
- package/dist/find.cjs +10 -10
- package/dist/find.js +6 -6
- package/dist/headless.cjs +74 -74
- package/dist/headless.js +4 -4
- package/dist/index.cjs +86 -86
- package/dist/index.js +5 -5
- package/dist/math.cjs +10 -10
- package/dist/math.js +8 -8
- package/dist/mention.cjs +10 -10
- package/dist/mention.js +8 -8
- package/dist/presence.cjs +38 -38
- package/dist/presence.js +7 -7
- package/dist/stats.cjs +10 -10
- package/dist/stats.js +7 -7
- package/dist/table.cjs +25 -25
- package/dist/table.js +6 -6
- package/dist/toc.cjs +9 -9
- package/dist/toc.js +6 -6
- package/dist/view.cjs +4 -4
- package/dist/view.js +2 -2
- package/dist/yjs.cjs +119 -119
- package/dist/yjs.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-3BXUGX5F.js.map +0 -1
- package/dist/chunk-7SVKLWDT.cjs.map +0 -1
- package/dist/chunk-7XQGOCUG.cjs.map +0 -1
- package/dist/chunk-AIS37SL2.cjs.map +0 -1
- package/dist/chunk-DYWU4SQ2.js.map +0 -1
- package/dist/chunk-L6OW2FL3.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkM5FREXRQ_cjs = require('./chunk-M5FREXRQ.cjs');
|
|
4
|
+
var chunk6H76FAI3_cjs = require('./chunk-6H76FAI3.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -34,7 +34,7 @@ function isCrossSelection(selection) {
|
|
|
34
34
|
}
|
|
35
35
|
function selectionDecorations(state, mode) {
|
|
36
36
|
if (mode !== "decorations" || !isCrossSelection(state.selection)) return [];
|
|
37
|
-
return
|
|
37
|
+
return chunkM5FREXRQ_cjs.markRanges(state).map(({ block, region, from, to }) => ({
|
|
38
38
|
kind: "inline",
|
|
39
39
|
block,
|
|
40
40
|
region,
|
|
@@ -45,9 +45,9 @@ function selectionDecorations(state, mode) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// src/view/dom/attributes.ts
|
|
48
|
-
var sortedEntries = (attrs) =>
|
|
48
|
+
var sortedEntries = (attrs) => chunk6H76FAI3_cjs.dataAttributes(attrs, "");
|
|
49
49
|
function setAttributes(element, attrs, prefix = "") {
|
|
50
|
-
for (const [name, value] of
|
|
50
|
+
for (const [name, value] of chunk6H76FAI3_cjs.writtenAttrs(chunk6H76FAI3_cjs.dataAttributes(attrs, prefix))) element.setAttribute(name, value);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/view/dom/segments.ts
|
|
@@ -62,7 +62,7 @@ function decorationRanges(decorations, length) {
|
|
|
62
62
|
return ranges;
|
|
63
63
|
}
|
|
64
64
|
function toSegments(inline, decorations) {
|
|
65
|
-
const length =
|
|
65
|
+
const length = chunk6H76FAI3_cjs.inlineLength(inline);
|
|
66
66
|
const ranges = decorationRanges(decorations, length);
|
|
67
67
|
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 || (a.decoration.side ?? 1) - (b.decoration.side ?? 1));
|
|
68
68
|
const edges = [...ranges.flatMap((range) => [range.from, range.to]), ...widgets.map((widget) => widget.at)];
|
|
@@ -78,7 +78,7 @@ function toSegments(inline, decorations) {
|
|
|
78
78
|
};
|
|
79
79
|
let start = 0;
|
|
80
80
|
for (const node of inline) {
|
|
81
|
-
const end = start +
|
|
81
|
+
const end = start + chunk6H76FAI3_cjs.nodeLength(node);
|
|
82
82
|
if (node.kind === "atom") {
|
|
83
83
|
placeWidgets(start);
|
|
84
84
|
segments.push({ kind: "atom", node, decorations: covering(start, end), from: start });
|
|
@@ -133,7 +133,7 @@ function create(doc, tag, attributes) {
|
|
|
133
133
|
return element;
|
|
134
134
|
}
|
|
135
135
|
function linkElement({ href = "", title } = {}, doc) {
|
|
136
|
-
const safe =
|
|
136
|
+
const safe = chunk6H76FAI3_cjs.sanitizeHref(href);
|
|
137
137
|
if (safe === null) return create(doc, "span", [["data-quoin-link", ""]]);
|
|
138
138
|
const anchor = create(doc, "a", [["href", safe], ["data-quoin-link", ""]]);
|
|
139
139
|
if (title) anchor.title = title;
|
|
@@ -141,8 +141,8 @@ function linkElement({ href = "", title } = {}, doc) {
|
|
|
141
141
|
}
|
|
142
142
|
function markElement2(mark2, doc) {
|
|
143
143
|
if (mark2.type === "link") return linkElement(mark2.attrs, doc);
|
|
144
|
-
const { tag, attrs } =
|
|
145
|
-
return create(doc, tag,
|
|
144
|
+
const { tag, attrs } = chunk6H76FAI3_cjs.markElement(mark2);
|
|
145
|
+
return create(doc, tag, chunk6H76FAI3_cjs.writtenAttrs(attrs));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// src/view/dom/wrappers.ts
|
|
@@ -339,8 +339,8 @@ function reconcileChildren(parent, specs) {
|
|
|
339
339
|
// src/view/dom/text-diff.ts
|
|
340
340
|
function textDiff(before, after, caretHint) {
|
|
341
341
|
if (before === after) return null;
|
|
342
|
-
const prefix =
|
|
343
|
-
const suffix =
|
|
342
|
+
const prefix = chunkM5FREXRQ_cjs.commonPrefix(before, after);
|
|
343
|
+
const suffix = chunkM5FREXRQ_cjs.commonSuffix(before, after);
|
|
344
344
|
const shared = Math.min(suffix, Math.min(before.length, after.length) - prefix);
|
|
345
345
|
const removed = before.length - prefix - shared;
|
|
346
346
|
const inserted = after.length - prefix - shared;
|
|
@@ -445,12 +445,12 @@ function specsFor(segment, options, doc) {
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
function needsFiller(inline) {
|
|
448
|
-
const content =
|
|
448
|
+
const content = chunk6H76FAI3_cjs.inlineText(inline);
|
|
449
449
|
return content === "" || content.endsWith("\n");
|
|
450
450
|
}
|
|
451
451
|
function renderInline(host, inline, decorations, options = {}) {
|
|
452
452
|
const doc = host.ownerDocument;
|
|
453
|
-
const length =
|
|
453
|
+
const length = chunk6H76FAI3_cjs.inlineLength(inline);
|
|
454
454
|
const specs = toSegments(inline, decorations).flatMap((segment) => specsFor(segment, options, doc));
|
|
455
455
|
if (needsFiller(inline)) specs.push(fillerSpec(doc, length));
|
|
456
456
|
reconcileChildren(host, specs);
|
|
@@ -528,10 +528,10 @@ function readSelection(registry, domSelection, blockAt2 = () => void 0) {
|
|
|
528
528
|
if (!domSelection || !anchorNode || !focusNode) return null;
|
|
529
529
|
const anchor = domToPos(registry, anchorNode, domSelection.anchorOffset);
|
|
530
530
|
const head = domToPos(registry, focusNode, domSelection.focusOffset);
|
|
531
|
-
if (anchor && head) return
|
|
531
|
+
if (anchor && head) return chunkM5FREXRQ_cjs.textSelection(anchor, head);
|
|
532
532
|
if (anchor || head || registry.locate(anchorNode) || registry.locate(focusNode)) return null;
|
|
533
533
|
const block = blockAt2(anchorNode);
|
|
534
|
-
return block !== void 0 && block === blockAt2(focusNode) ?
|
|
534
|
+
return block !== void 0 && block === blockAt2(focusNode) ? chunkM5FREXRQ_cjs.nodeSelection(block) : null;
|
|
535
535
|
}
|
|
536
536
|
function selectBlock(domSelection, element) {
|
|
537
537
|
if (!element) return false;
|
|
@@ -548,7 +548,7 @@ function writeSelection(registry, selection, domSelection, blockElement) {
|
|
|
548
548
|
if (selection.kind !== "text") return false;
|
|
549
549
|
const { anchor, head } = selection;
|
|
550
550
|
if (anchor.block !== head.block || anchor.region !== head.region) return false;
|
|
551
|
-
if (
|
|
551
|
+
if (chunkM5FREXRQ_cjs.sameSelection(readSelection(registry, domSelection), selection)) return true;
|
|
552
552
|
const base = posToDom(registry, anchor, anchor.offset < head.offset ? 1 : -1);
|
|
553
553
|
const extent = posToDom(registry, head, head.offset < anchor.offset ? 1 : -1);
|
|
554
554
|
if (!base || !extent) return false;
|
|
@@ -610,8 +610,8 @@ var known = /* @__PURE__ */ new WeakMap();
|
|
|
610
610
|
function hidersOf(doc) {
|
|
611
611
|
let hiders = known.get(doc);
|
|
612
612
|
if (hiders === void 0) {
|
|
613
|
-
const first = doc.blocks.findIndex(
|
|
614
|
-
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null :
|
|
613
|
+
const first = doc.blocks.findIndex(chunkM5FREXRQ_cjs.isClosedToggle);
|
|
614
|
+
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null : chunkM5FREXRQ_cjs.hidingToggle(doc, index + 1));
|
|
615
615
|
known.set(doc, hiders);
|
|
616
616
|
}
|
|
617
617
|
return hiders;
|
|
@@ -620,7 +620,7 @@ var hidingToggleAt = (doc, index) => hidersOf(doc)[index] ?? null;
|
|
|
620
620
|
function isHiddenAt(doc, index, choices) {
|
|
621
621
|
if (choices.size === 0) return hidingToggleAt(doc, index) !== null;
|
|
622
622
|
const closed = (block) => block.type === "TOGGLE" && !shownOpen(block, choices);
|
|
623
|
-
return
|
|
623
|
+
return chunkM5FREXRQ_cjs.hidingToggle(doc, index + 1, closed) !== null;
|
|
624
624
|
}
|
|
625
625
|
var visibleBlockIndexes = (doc) => hidersOf(doc).flatMap((hider, index) => hider === null ? [index] : []);
|
|
626
626
|
function drawnBlockCount(doc, start = 0, end = doc.blocks.length) {
|
|
@@ -645,18 +645,18 @@ function neighbourBlock(doc, from, direction, accept = anyBlock) {
|
|
|
645
645
|
}
|
|
646
646
|
function entryEdge(controller, block, direction) {
|
|
647
647
|
const { doc, schema } = controller.editor.state;
|
|
648
|
-
const edge = direction < 0 ?
|
|
648
|
+
const edge = direction < 0 ? chunkM5FREXRQ_cjs.endOf(doc, schema, block) : chunkM5FREXRQ_cjs.startOf(doc, schema, block);
|
|
649
649
|
if (edge.kind !== "text") return edge;
|
|
650
650
|
const drawn = controller.registry.get(edge.head.block, edge.head.region) !== void 0;
|
|
651
|
-
return drawn && !entersAsNode(controller, block) ? edge :
|
|
651
|
+
return drawn && !entersAsNode(controller, block) ? edge : chunkM5FREXRQ_cjs.nodeSelection(block);
|
|
652
652
|
}
|
|
653
|
-
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ?
|
|
653
|
+
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ? chunkM5FREXRQ_cjs.nodeSelection(block) : null;
|
|
654
654
|
var canBeEntered = (controller) => (block) => {
|
|
655
655
|
const { schema } = controller.editor.state;
|
|
656
|
-
const region =
|
|
656
|
+
const region = chunkM5FREXRQ_cjs.isTextFlow(schema, block) ? chunkM5FREXRQ_cjs.primaryRegion(schema, block) : null;
|
|
657
657
|
return region === null || controller.registry.get(block.id, region) !== void 0 || entersAsNode(controller, block.id);
|
|
658
658
|
};
|
|
659
|
-
var holdsTextHead = (controller) => (block) =>
|
|
659
|
+
var holdsTextHead = (controller) => (block) => chunkM5FREXRQ_cjs.isTextFlow(controller.editor.state.schema, block) && entryEdge(controller, block.id, 1).kind === "text";
|
|
660
660
|
function neighbourHead(controller, from, direction) {
|
|
661
661
|
const target = neighbourBlock(controller.editor.state.doc, from, direction, holdsTextHead(controller));
|
|
662
662
|
const edge = target && entryEdge(controller, target.id, direction);
|
|
@@ -795,7 +795,7 @@ function createCrossBlockPointer(controller) {
|
|
|
795
795
|
let preventMouseDown = false;
|
|
796
796
|
const scroll = createAutoScroll(root, () => follow(last.x, last.y));
|
|
797
797
|
function select(selection) {
|
|
798
|
-
if (
|
|
798
|
+
if (chunkM5FREXRQ_cjs.sameSelection(selection, controller.editor.state.selection)) return;
|
|
799
799
|
dispatchSelection(controller, selection);
|
|
800
800
|
}
|
|
801
801
|
function startDragging() {
|
|
@@ -811,14 +811,14 @@ function createCrossBlockPointer(controller) {
|
|
|
811
811
|
if (current.anchor === null) return;
|
|
812
812
|
startDragging();
|
|
813
813
|
}
|
|
814
|
-
select(
|
|
814
|
+
select(chunkM5FREXRQ_cjs.textSelection(current.anchor, caretPosAt(controller, target, x, y)));
|
|
815
815
|
}
|
|
816
816
|
function followBlocks(current, x, y) {
|
|
817
817
|
if (!controller.dragging && Math.hypot(x - current.x, y - current.y) < DRAG_DISTANCE) return;
|
|
818
818
|
const block = blockAt(controller, x, y);
|
|
819
819
|
if (block === null) return;
|
|
820
820
|
startDragging();
|
|
821
|
-
select(
|
|
821
|
+
select(chunkM5FREXRQ_cjs.blockRangeSelection(current.start, block));
|
|
822
822
|
}
|
|
823
823
|
function follow(x, y) {
|
|
824
824
|
if (press?.kind === "text") followText(press, x, y);
|
|
@@ -853,10 +853,10 @@ function createCrossBlockPointer(controller) {
|
|
|
853
853
|
}
|
|
854
854
|
function pressWhole(block) {
|
|
855
855
|
if (entryEdge(controller, block, 1).kind !== "node") return;
|
|
856
|
-
const pressed =
|
|
857
|
-
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(
|
|
856
|
+
const pressed = chunk6H76FAI3_cjs.blockById(controller.editor.state.doc, block);
|
|
857
|
+
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(chunkM5FREXRQ_cjs.blockRangeSelection(block));
|
|
858
858
|
controller.nodeReveal.pressed(block);
|
|
859
|
-
select(
|
|
859
|
+
select(chunkM5FREXRQ_cjs.nodeSelection(block));
|
|
860
860
|
}
|
|
861
861
|
function onPointerDown(event) {
|
|
862
862
|
end();
|
|
@@ -898,7 +898,7 @@ function createCrossBlockPointer(controller) {
|
|
|
898
898
|
// src/view/selection/paint-selection.ts
|
|
899
899
|
var NAME = "quoin-selection";
|
|
900
900
|
function coveredRanges(controller) {
|
|
901
|
-
return
|
|
901
|
+
return chunkM5FREXRQ_cjs.markRanges(controller.editor.state).flatMap(({ block, region, from, to }) => {
|
|
902
902
|
const host = controller.registry.get(block, region);
|
|
903
903
|
const map = host && domMapOf(host);
|
|
904
904
|
if (!host || !map) return [];
|
|
@@ -969,7 +969,7 @@ function heldBySink(selection) {
|
|
|
969
969
|
}
|
|
970
970
|
var NO_TEXT = "\xA0";
|
|
971
971
|
function selectionText(state) {
|
|
972
|
-
const text =
|
|
972
|
+
const text = chunkM5FREXRQ_cjs.markRanges(state).map((range) => chunk6H76FAI3_cjs.inlinePlainText(chunkM5FREXRQ_cjs.rangeContent(state, range), state.schema)).join("\n");
|
|
973
973
|
return text === "" ? NO_TEXT : text;
|
|
974
974
|
}
|
|
975
975
|
var focusInPlace = (sink) => inPlace(sink, () => sink.focus({ preventScroll: true }));
|
|
@@ -992,7 +992,7 @@ function focusSink(controller) {
|
|
|
992
992
|
sink.ownerDocument.getSelection()?.selectAllChildren(sink);
|
|
993
993
|
}
|
|
994
994
|
function selectedBlockName({ doc, schema, selection }, blockLabel) {
|
|
995
|
-
const block = selection?.kind === "node" ?
|
|
995
|
+
const block = selection?.kind === "node" ? chunk6H76FAI3_cjs.blockById(doc, selection.block) : void 0;
|
|
996
996
|
return block === void 0 ? null : blockLabel?.(block, schema) ?? "";
|
|
997
997
|
}
|
|
998
998
|
function clearSink(controller) {
|
|
@@ -1129,7 +1129,7 @@ function createElementSlot(changed) {
|
|
|
1129
1129
|
|
|
1130
1130
|
// src/view/controller/selection-element.ts
|
|
1131
1131
|
function elementFor({ doc }, selection, rendered) {
|
|
1132
|
-
const id =
|
|
1132
|
+
const id = chunkM5FREXRQ_cjs.headBlockId(selection);
|
|
1133
1133
|
const index = id === null ? void 0 : doc.index.get(id);
|
|
1134
1134
|
if (id === null || index === void 0) return void 0;
|
|
1135
1135
|
const hiding = hidingToggleAt(doc, index);
|
|
@@ -1142,7 +1142,7 @@ function selectionElement(state, rendered) {
|
|
|
1142
1142
|
if (doc.blocks.length === 0) return rendered.empty?.() ?? void 0;
|
|
1143
1143
|
const sink = heldBySink(selection) ? rendered.sink?.() : null;
|
|
1144
1144
|
if (sink) return sink;
|
|
1145
|
-
return elementFor(state, selection, rendered) ?? elementFor(state,
|
|
1145
|
+
return elementFor(state, selection, rendered) ?? elementFor(state, chunkM5FREXRQ_cjs.startOf(doc, schema, doc.blocks[0].id), rendered);
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
1148
|
// src/view/controller/tab-stop.ts
|
|
@@ -1209,9 +1209,9 @@ function ownsFocus(controller, doc) {
|
|
|
1209
1209
|
function focusTarget(state, target) {
|
|
1210
1210
|
const { doc, schema, selection } = state;
|
|
1211
1211
|
if (doc.blocks.length === 0) return null;
|
|
1212
|
-
if (target === "end") return
|
|
1213
|
-
if (target === "start" || target === void 0 && selection === null) return
|
|
1214
|
-
return target === void 0 ? selection :
|
|
1212
|
+
if (target === "end") return chunkM5FREXRQ_cjs.endOf(doc, schema, doc.blocks[doc.blocks.length - 1].id);
|
|
1213
|
+
if (target === "start" || target === void 0 && selection === null) return chunkM5FREXRQ_cjs.startOf(doc, schema, doc.blocks[0].id);
|
|
1214
|
+
return target === void 0 ? selection : chunkM5FREXRQ_cjs.textSelection(target);
|
|
1215
1215
|
}
|
|
1216
1216
|
|
|
1217
1217
|
// src/view/controller/host-decorations.ts
|
|
@@ -1227,7 +1227,7 @@ function decorationsByHost(decorations) {
|
|
|
1227
1227
|
return byHost;
|
|
1228
1228
|
}
|
|
1229
1229
|
function sameDecoration(a, b) {
|
|
1230
|
-
if (a.kind !== b.kind || a.block !== b.block || !
|
|
1230
|
+
if (a.kind !== b.kind || a.block !== b.block || !chunk6H76FAI3_cjs.sameAttrs(a.attrs, b.attrs)) return false;
|
|
1231
1231
|
if (a.kind === "inline" && b.kind === "inline") {
|
|
1232
1232
|
return a.region === b.region && a.from === b.from && a.to === b.to;
|
|
1233
1233
|
}
|
|
@@ -1238,7 +1238,7 @@ function sameDecoration(a, b) {
|
|
|
1238
1238
|
return true;
|
|
1239
1239
|
}
|
|
1240
1240
|
function sameDecorations(a, b) {
|
|
1241
|
-
return a === b ||
|
|
1241
|
+
return a === b || chunk6H76FAI3_cjs.sameItems(a, b, sameDecoration);
|
|
1242
1242
|
}
|
|
1243
1243
|
var byMode = { highlight: /* @__PURE__ */ new WeakMap(), decorations: /* @__PURE__ */ new WeakMap() };
|
|
1244
1244
|
function hostDecorations(editor, block, region, mode = "highlight") {
|
|
@@ -1254,7 +1254,7 @@ function hostDecorations(editor, block, region, mode = "highlight") {
|
|
|
1254
1254
|
|
|
1255
1255
|
// src/view/controller/region-inline.ts
|
|
1256
1256
|
function regionInline(state, block, region) {
|
|
1257
|
-
const regions =
|
|
1257
|
+
const regions = chunk6H76FAI3_cjs.blockById(state.doc, block)?.regions;
|
|
1258
1258
|
return regions && Object.hasOwn(regions, region) ? regions[region] : void 0;
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
@@ -1304,7 +1304,7 @@ function createOutsideChanges(editorHasFocus, movedFrom) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
const from = moved ?? (outside && !settled ? movedFrom(tr.before.selection) : null);
|
|
1306
1306
|
settled ||= outside;
|
|
1307
|
-
moved = from &&
|
|
1307
|
+
moved = from && chunkM5FREXRQ_cjs.mapSelection(from, (pos, assoc) => tr.mapPos(pos, assoc), tr.before.doc);
|
|
1308
1308
|
},
|
|
1309
1309
|
takeFocused() {
|
|
1310
1310
|
const value = focused;
|
|
@@ -1397,7 +1397,7 @@ function handleCopy(controller, event, cut) {
|
|
|
1397
1397
|
clipboardData.setData("text/plain", copied.text);
|
|
1398
1398
|
clipboardData.setData("text/html", wrapSliceHTML(copied.html, copied.json));
|
|
1399
1399
|
clipboardData.setData(QUOIN_SLICE_TYPE, copied.json);
|
|
1400
|
-
if (cut) controller.run(
|
|
1400
|
+
if (cut) controller.run(chunkM5FREXRQ_cjs.deleteSelection);
|
|
1401
1401
|
}
|
|
1402
1402
|
function handlePaste(controller, event) {
|
|
1403
1403
|
if (!event.clipboardData) return;
|
|
@@ -1429,7 +1429,7 @@ function handleDrop(controller, event) {
|
|
|
1429
1429
|
return;
|
|
1430
1430
|
}
|
|
1431
1431
|
const pos = dropPos(controller, event.clientX, event.clientY);
|
|
1432
|
-
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(
|
|
1432
|
+
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(chunkM5FREXRQ_cjs.textSelection(pos)).setOrigin("drop"));
|
|
1433
1433
|
pasteTransfer(controller, dataTransfer);
|
|
1434
1434
|
}
|
|
1435
1435
|
function handleDragOver(event) {
|
|
@@ -1557,29 +1557,29 @@ function createSinkComposition(controller) {
|
|
|
1557
1557
|
var LINE_BREAK = "\n";
|
|
1558
1558
|
var transposeChars = (state, dispatch) => {
|
|
1559
1559
|
const { selection } = state;
|
|
1560
|
-
if (selection?.kind !== "text" || !
|
|
1560
|
+
if (selection?.kind !== "text" || !chunkM5FREXRQ_cjs.isCollapsed(selection)) return false;
|
|
1561
1561
|
const { head } = selection;
|
|
1562
|
-
const inline =
|
|
1562
|
+
const inline = chunk6H76FAI3_cjs.blockById(state.doc, head.block)?.regions[head.region];
|
|
1563
1563
|
if (inline === void 0) return false;
|
|
1564
|
-
const value =
|
|
1564
|
+
const value = chunk6H76FAI3_cjs.inlineText(inline);
|
|
1565
1565
|
const atLineEnd = head.offset === value.length || value[head.offset] === LINE_BREAK;
|
|
1566
|
-
const end = atLineEnd ? head.offset :
|
|
1567
|
-
const middle =
|
|
1568
|
-
const start =
|
|
1566
|
+
const end = atLineEnd ? head.offset : chunkM5FREXRQ_cjs.nextGraphemeOffset(value, head.offset);
|
|
1567
|
+
const middle = chunkM5FREXRQ_cjs.prevGraphemeOffset(value, end);
|
|
1568
|
+
const start = chunkM5FREXRQ_cjs.prevGraphemeOffset(value, middle);
|
|
1569
1569
|
if (start === middle || value.slice(start, end).includes(LINE_BREAK)) return false;
|
|
1570
|
-
const swapped = [...
|
|
1571
|
-
const tr = new
|
|
1572
|
-
tr.step(
|
|
1573
|
-
dispatch?.(tr.setSelection(
|
|
1570
|
+
const swapped = [...chunk6H76FAI3_cjs.sliceInline(inline, middle, end), ...chunk6H76FAI3_cjs.sliceInline(inline, start, middle)];
|
|
1571
|
+
const tr = new chunkM5FREXRQ_cjs.Transaction(state).setOrigin("input");
|
|
1572
|
+
tr.step(chunkM5FREXRQ_cjs.replaceInlineStep(head.block, head.region, start, end, swapped));
|
|
1573
|
+
dispatch?.(tr.setSelection(chunkM5FREXRQ_cjs.textSelection({ ...head, offset: end })));
|
|
1574
1574
|
return true;
|
|
1575
1575
|
};
|
|
1576
1576
|
|
|
1577
1577
|
// src/view/input/replace-range.ts
|
|
1578
1578
|
function replaceRange(editor, range, text, withRules) {
|
|
1579
1579
|
const dispatch = (tr) => editor.dispatch(tr);
|
|
1580
|
-
dispatch(editor.createTransaction().setSelection(
|
|
1581
|
-
if (text === "") return
|
|
1582
|
-
return withRules ? editor.insertText(text) :
|
|
1580
|
+
dispatch(editor.createTransaction().setSelection(chunkM5FREXRQ_cjs.textSelection(range.from, range.to)).setOrigin("input"));
|
|
1581
|
+
if (text === "") return chunkM5FREXRQ_cjs.deleteSelection(editor.state, (tr) => dispatch(tr.setOrigin("input")));
|
|
1582
|
+
return withRules ? editor.insertText(text) : chunkM5FREXRQ_cjs.insertText(text, { origin: "input" })(editor.state, dispatch);
|
|
1583
1583
|
}
|
|
1584
1584
|
|
|
1585
1585
|
// src/view/input/target-range.ts
|
|
@@ -1590,13 +1590,13 @@ function targetRangeToModel(controller, event) {
|
|
|
1590
1590
|
const to = domToPos(controller.registry, range.endContainer, range.endOffset);
|
|
1591
1591
|
return from && to && { from, to };
|
|
1592
1592
|
}
|
|
1593
|
-
var isEmpty = ({ from, to }) =>
|
|
1593
|
+
var isEmpty = ({ from, to }) => chunkM5FREXRQ_cjs.sameSelection(chunkM5FREXRQ_cjs.textSelection(from), chunkM5FREXRQ_cjs.textSelection(to));
|
|
1594
1594
|
function targetBeyondSelection(controller, event) {
|
|
1595
1595
|
const range = targetRangeToModel(controller, event);
|
|
1596
1596
|
if (range === null || isEmpty(range)) return null;
|
|
1597
1597
|
const { doc, selection } = controller.editor.state;
|
|
1598
|
-
const selected =
|
|
1599
|
-
const same = selected !== null &&
|
|
1598
|
+
const selected = chunkM5FREXRQ_cjs.selectionRange(doc, selection);
|
|
1599
|
+
const same = selected !== null && chunkM5FREXRQ_cjs.sameSelection(chunkM5FREXRQ_cjs.textSelection(selected.from, selected.to), chunkM5FREXRQ_cjs.textSelection(range.from, range.to));
|
|
1600
1600
|
return same ? null : range;
|
|
1601
1601
|
}
|
|
1602
1602
|
|
|
@@ -1618,34 +1618,34 @@ function insertTypedText(controller, event) {
|
|
|
1618
1618
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1619
1619
|
}
|
|
1620
1620
|
function deleteContentBackward(controller, event) {
|
|
1621
|
-
if (!controller.run(
|
|
1621
|
+
if (!controller.run(chunkM5FREXRQ_cjs.undoInputRule)) targetOr(chunkM5FREXRQ_cjs.deleteBackward)(controller, event);
|
|
1622
1622
|
}
|
|
1623
1623
|
function insertReplacementText(controller, event) {
|
|
1624
1624
|
const text = event.dataTransfer?.getData("text/plain") || event.data;
|
|
1625
1625
|
if (!text) return;
|
|
1626
1626
|
const range = targetRangeToModel(controller, event);
|
|
1627
|
-
if (range === null) controller.run(
|
|
1627
|
+
if (range === null) controller.run(chunkM5FREXRQ_cjs.insertText(text, { origin: "input" }));
|
|
1628
1628
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1629
1629
|
}
|
|
1630
1630
|
var actions = {
|
|
1631
1631
|
insertText: insertTypedText,
|
|
1632
1632
|
insertReplacementText,
|
|
1633
1633
|
insertParagraph: (controller) => void controller.edit(() => controller.editor.handleKey(ENTER)),
|
|
1634
|
-
insertLineBreak: run(
|
|
1634
|
+
insertLineBreak: run(chunkM5FREXRQ_cjs.insertHardBreak),
|
|
1635
1635
|
deleteContentBackward,
|
|
1636
|
-
deleteContentForward: targetOr(
|
|
1637
|
-
deleteWordBackward: targetOr(
|
|
1638
|
-
deleteWordForward: targetOr(
|
|
1639
|
-
deleteSoftLineBackward: targetOr(
|
|
1640
|
-
deleteHardLineBackward: targetOr(
|
|
1641
|
-
deleteSoftLineForward: targetOr(
|
|
1642
|
-
deleteHardLineForward: targetOr(
|
|
1643
|
-
formatBold: run(
|
|
1644
|
-
formatItalic: run(
|
|
1645
|
-
formatUnderline: run(
|
|
1646
|
-
formatStrikeThrough: run(
|
|
1647
|
-
historyUndo: run(
|
|
1648
|
-
historyRedo: run(
|
|
1636
|
+
deleteContentForward: targetOr(chunkM5FREXRQ_cjs.deleteForward),
|
|
1637
|
+
deleteWordBackward: targetOr(chunkM5FREXRQ_cjs.deleteWordBackward),
|
|
1638
|
+
deleteWordForward: targetOr(chunkM5FREXRQ_cjs.deleteWordForward),
|
|
1639
|
+
deleteSoftLineBackward: targetOr(chunkM5FREXRQ_cjs.deleteToLineStart),
|
|
1640
|
+
deleteHardLineBackward: targetOr(chunkM5FREXRQ_cjs.deleteToLineStart),
|
|
1641
|
+
deleteSoftLineForward: targetOr(chunkM5FREXRQ_cjs.deleteToLineEnd),
|
|
1642
|
+
deleteHardLineForward: targetOr(chunkM5FREXRQ_cjs.deleteToLineEnd),
|
|
1643
|
+
formatBold: run(chunkM5FREXRQ_cjs.toggleMark("bold")),
|
|
1644
|
+
formatItalic: run(chunkM5FREXRQ_cjs.toggleMark("italic")),
|
|
1645
|
+
formatUnderline: run(chunkM5FREXRQ_cjs.toggleMark("underline")),
|
|
1646
|
+
formatStrikeThrough: run(chunkM5FREXRQ_cjs.toggleMark("strike")),
|
|
1647
|
+
historyUndo: run(chunkM5FREXRQ_cjs.undo),
|
|
1648
|
+
historyRedo: run(chunkM5FREXRQ_cjs.redo),
|
|
1649
1649
|
insertTranspose: run(transposeChars),
|
|
1650
1650
|
insertFromPaste: leaveToHandlers,
|
|
1651
1651
|
insertFromDrop: leaveToHandlers,
|
|
@@ -1746,7 +1746,7 @@ function snapshotComposition(controller, block, region) {
|
|
|
1746
1746
|
const element = controller.registry.get(block, region);
|
|
1747
1747
|
const inline = regionInline(editor.state, block, region);
|
|
1748
1748
|
if (element === void 0 || inline === void 0) return null;
|
|
1749
|
-
const text =
|
|
1749
|
+
const text = chunk6H76FAI3_cjs.inlineText(inline);
|
|
1750
1750
|
const end = composedEnd(controller, block, region);
|
|
1751
1751
|
const since = [];
|
|
1752
1752
|
const release = editor.subscribe((_, tr) => void (tr && since.push(tr)));
|
|
@@ -1858,7 +1858,7 @@ function reconcileHost(controller, block, region, caretHint) {
|
|
|
1858
1858
|
const element = controller.registry.get(block, region);
|
|
1859
1859
|
const inline = regionInline(controller.editor.state, block, region);
|
|
1860
1860
|
if (element === void 0 || inline === void 0) return false;
|
|
1861
|
-
const before =
|
|
1861
|
+
const before = chunk6H76FAI3_cjs.inlineText(inline);
|
|
1862
1862
|
const after = readDomText(element);
|
|
1863
1863
|
const edit = before === after ? null : textDiff(before, after, domCaretOffset(element));
|
|
1864
1864
|
if (edit === null) return false;
|
|
@@ -1923,33 +1923,33 @@ function createDomInputFallback(controller) {
|
|
|
1923
1923
|
|
|
1924
1924
|
// src/view/navigation/cross-moves.ts
|
|
1925
1925
|
function moveHead(controller, { anchor }, head) {
|
|
1926
|
-
dispatchSelection(controller,
|
|
1926
|
+
dispatchSelection(controller, chunkM5FREXRQ_cjs.textSelection(anchor, head));
|
|
1927
1927
|
return true;
|
|
1928
1928
|
}
|
|
1929
1929
|
function blockOf(controller, { block }) {
|
|
1930
1930
|
const { doc } = controller.editor.state;
|
|
1931
|
-
return doc.blocks[
|
|
1931
|
+
return doc.blocks[chunk6H76FAI3_cjs.requireBlockIndex(doc, block)];
|
|
1932
1932
|
}
|
|
1933
1933
|
function collapseCross(controller, selection, direction) {
|
|
1934
|
-
const { from, to } =
|
|
1935
|
-
dispatchSelection(controller,
|
|
1934
|
+
const { from, to } = chunkM5FREXRQ_cjs.selectionRange(controller.editor.state.doc, selection);
|
|
1935
|
+
dispatchSelection(controller, chunkM5FREXRQ_cjs.textSelection(direction < 0 ? from : to));
|
|
1936
1936
|
return true;
|
|
1937
1937
|
}
|
|
1938
1938
|
function crossHeadVertically(controller, selection, direction) {
|
|
1939
1939
|
const { head } = selection;
|
|
1940
1940
|
const edge = neighbourHead(controller, head.block, direction);
|
|
1941
1941
|
if (edge !== null) {
|
|
1942
|
-
const end2 =
|
|
1942
|
+
const end2 = chunkM5FREXRQ_cjs.regionLength(blockOf(controller, edge), edge.region);
|
|
1943
1943
|
return moveHead(controller, selection, { ...edge, offset: Math.min(head.offset, end2) });
|
|
1944
1944
|
}
|
|
1945
|
-
const end =
|
|
1945
|
+
const end = chunkM5FREXRQ_cjs.regionLength(blockOf(controller, head), head.region);
|
|
1946
1946
|
return moveHead(controller, selection, { ...head, offset: direction < 0 ? 0 : end });
|
|
1947
1947
|
}
|
|
1948
1948
|
function crossHeadHorizontally(controller, selection, direction) {
|
|
1949
1949
|
const { head } = selection;
|
|
1950
|
-
const text =
|
|
1950
|
+
const text = chunk6H76FAI3_cjs.inlineText(blockOf(controller, head).regions[head.region] ?? []);
|
|
1951
1951
|
if (direction < 0 ? head.offset > 0 : head.offset < text.length) {
|
|
1952
|
-
const offset = direction < 0 ?
|
|
1952
|
+
const offset = direction < 0 ? chunkM5FREXRQ_cjs.prevGraphemeOffset(text, head.offset) : chunkM5FREXRQ_cjs.nextGraphemeOffset(text, head.offset);
|
|
1953
1953
|
return moveHead(controller, selection, { ...head, offset });
|
|
1954
1954
|
}
|
|
1955
1955
|
const edge = neighbourHead(controller, head.block, direction);
|
|
@@ -1968,9 +1968,9 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
1968
1968
|
const move = extend ? crossHeadHorizontally : collapseCross;
|
|
1969
1969
|
return move(controller, selection, direction);
|
|
1970
1970
|
}
|
|
1971
|
-
if (!extend && !
|
|
1971
|
+
if (!extend && !chunkM5FREXRQ_cjs.isCollapsed(selection)) return false;
|
|
1972
1972
|
const { head } = selection;
|
|
1973
|
-
const length =
|
|
1973
|
+
const length = chunkM5FREXRQ_cjs.regionLength(doc.blocks[chunk6H76FAI3_cjs.requireBlockIndex(doc, head.block)], head.region);
|
|
1974
1974
|
if (direction < 0 ? head.offset > 0 : head.offset < length) return false;
|
|
1975
1975
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
1976
1976
|
if (own2 !== null) {
|
|
@@ -1980,7 +1980,7 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
1980
1980
|
if (!extend) return moveToNeighbour(controller, head.block, direction);
|
|
1981
1981
|
const edge = neighbourHead(controller, head.block, direction);
|
|
1982
1982
|
if (edge === null) return false;
|
|
1983
|
-
dispatchSelection(controller,
|
|
1983
|
+
dispatchSelection(controller, chunkM5FREXRQ_cjs.textSelection(selection.anchor, edge));
|
|
1984
1984
|
return true;
|
|
1985
1985
|
}
|
|
1986
1986
|
|
|
@@ -2078,12 +2078,12 @@ function caretAtGoal(controller, host, at, y) {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
function landAtGoal(controller, block, direction) {
|
|
2080
2080
|
const { schema } = controller.editor.state;
|
|
2081
|
-
const region =
|
|
2081
|
+
const region = chunkM5FREXRQ_cjs.isTextFlow(schema, block) ? chunkM5FREXRQ_cjs.primaryRegion(schema, block) : null;
|
|
2082
2082
|
const host = region === null ? void 0 : controller.registry.get(block.id, region);
|
|
2083
2083
|
if (!host || region === null || controller.goalX === null) return null;
|
|
2084
2084
|
const line = lineInView(host, direction < 0);
|
|
2085
2085
|
const pos = line && caretAtGoal(controller, host, { block: block.id, region }, line.top + line.height / 2);
|
|
2086
|
-
return pos ?
|
|
2086
|
+
return pos ? chunkM5FREXRQ_cjs.textSelection(pos) : null;
|
|
2087
2087
|
}
|
|
2088
2088
|
function moveInHost(controller, host, head, caret, direction) {
|
|
2089
2089
|
const { goalX } = controller;
|
|
@@ -2101,7 +2101,7 @@ function landing(controller, { head }, direction, extend) {
|
|
|
2101
2101
|
controller.goalX ??= caret?.left ?? null;
|
|
2102
2102
|
if (!(direction < 0 ? isOnFirstLine(host, point) : isOnLastLine(host, point))) {
|
|
2103
2103
|
const pos = moveInHost(controller, host, head, caret, direction);
|
|
2104
|
-
return pos &&
|
|
2104
|
+
return pos && chunkM5FREXRQ_cjs.textSelection(pos);
|
|
2105
2105
|
}
|
|
2106
2106
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2107
2107
|
if (own2 !== null) return own2;
|
|
@@ -2115,14 +2115,14 @@ function moveText(controller, selection, direction, extend) {
|
|
|
2115
2115
|
controller.nativeVerticalMove = true;
|
|
2116
2116
|
return false;
|
|
2117
2117
|
}
|
|
2118
|
-
const moved = extend && next.kind === "text" ?
|
|
2118
|
+
const moved = extend && next.kind === "text" ? chunkM5FREXRQ_cjs.textSelection(selection.anchor, next.head) : next;
|
|
2119
2119
|
dispatchSelection(controller, moved);
|
|
2120
2120
|
return true;
|
|
2121
2121
|
}
|
|
2122
2122
|
function extendBlocks(controller, { anchor, head }, direction) {
|
|
2123
2123
|
const next = neighbourBlock(controller.editor.state.doc, head, direction);
|
|
2124
2124
|
if (next === null) return false;
|
|
2125
|
-
dispatchSelection(controller,
|
|
2125
|
+
dispatchSelection(controller, chunkM5FREXRQ_cjs.blockRangeSelection(anchor, next.id));
|
|
2126
2126
|
return true;
|
|
2127
2127
|
}
|
|
2128
2128
|
function moveVertically(controller, direction, extend) {
|
|
@@ -2138,8 +2138,8 @@ function moveVertically(controller, direction, extend) {
|
|
|
2138
2138
|
// src/view/input/flip-block.ts
|
|
2139
2139
|
var isTask = ({ type, attrs }) => type === "MARKDOWN" && attrs.kind === "task";
|
|
2140
2140
|
function flipCommand(block) {
|
|
2141
|
-
if (isTask(block)) return
|
|
2142
|
-
return block.type === "TOGGLE" ?
|
|
2141
|
+
if (isTask(block)) return chunkM5FREXRQ_cjs.toggleTask;
|
|
2142
|
+
return block.type === "TOGGLE" ? chunkM5FREXRQ_cjs.setAttrs({ open: block.attrs.open !== true }) : null;
|
|
2143
2143
|
}
|
|
2144
2144
|
var toggleState = (open) => open ? "expanded" : "collapsed";
|
|
2145
2145
|
function stateName(block) {
|
|
@@ -2148,7 +2148,7 @@ function stateName(block) {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
function blockHoldingCaret({ doc, selection }) {
|
|
2150
2150
|
if (selection?.kind !== "text" || selection.anchor.block !== selection.head.block) return null;
|
|
2151
|
-
return
|
|
2151
|
+
return chunk6H76FAI3_cjs.blockById(doc, selection.head.block) ?? null;
|
|
2152
2152
|
}
|
|
2153
2153
|
function flipForReader(controller, block) {
|
|
2154
2154
|
if (block?.type !== "TOGGLE") return false;
|
|
@@ -2163,7 +2163,7 @@ function flipSelectedBlock(controller) {
|
|
|
2163
2163
|
if (controller.readOnly) return flipForReader(controller, block);
|
|
2164
2164
|
const command = block && flipCommand(block);
|
|
2165
2165
|
if (!block || !command || !controller.run(command)) return false;
|
|
2166
|
-
const after =
|
|
2166
|
+
const after = chunk6H76FAI3_cjs.blockById(editor.state.doc, block.id);
|
|
2167
2167
|
if (after) controller.announce(stateName(after));
|
|
2168
2168
|
return true;
|
|
2169
2169
|
}
|
|
@@ -2374,7 +2374,7 @@ function bindRoot(controller, root, cross, committed) {
|
|
|
2374
2374
|
function movedSelection(controller, doc, model) {
|
|
2375
2375
|
if (controller.composingKey !== null || controller.dragging || !doc || !ownsFocus(controller, doc)) return null;
|
|
2376
2376
|
const selection = readSelection(controller.registry, doc.getSelection(), (node) => controller.blockAt(node));
|
|
2377
|
-
return selection === null ||
|
|
2377
|
+
return selection === null || chunkM5FREXRQ_cjs.sameSelection(selection, model) ? null : selection;
|
|
2378
2378
|
}
|
|
2379
2379
|
function writeModelSelection(controller, doc, moved, local) {
|
|
2380
2380
|
const domSelection = doc?.getSelection();
|
|
@@ -2432,7 +2432,7 @@ var ViewController = class {
|
|
|
2432
2432
|
});
|
|
2433
2433
|
this.#flush = options.flush ?? runNow;
|
|
2434
2434
|
this.onFiles = options.onFiles;
|
|
2435
|
-
this.isMac = options.isMac ??
|
|
2435
|
+
this.isMac = options.isMac ?? chunkM5FREXRQ_cjs.detectMac();
|
|
2436
2436
|
const decorationsOf = (block, region) => this.decorationsFor(block, region);
|
|
2437
2437
|
const drain = (element) => this.#binding?.input.drain(element);
|
|
2438
2438
|
this.#hosts = createHostRenderer(options.editor, options.render, decorationsOf, drain);
|
|
@@ -2585,7 +2585,7 @@ var ViewController = class {
|
|
|
2585
2585
|
focus(target) {
|
|
2586
2586
|
const { editor } = this;
|
|
2587
2587
|
const selection = focusTarget(editor.state, target);
|
|
2588
|
-
if (selection !== null && !
|
|
2588
|
+
if (selection !== null && !chunkM5FREXRQ_cjs.sameSelection(selection, editor.state.selection)) dispatchSelection(this, selection);
|
|
2589
2589
|
this.#takeFocus();
|
|
2590
2590
|
this.syncSelectionToDom();
|
|
2591
2591
|
}
|
|
@@ -2633,7 +2633,7 @@ function useQuoinEditor(options) {
|
|
|
2633
2633
|
const { blocks, readOnly = false } = options;
|
|
2634
2634
|
const callbacks = react.useRef(options);
|
|
2635
2635
|
const [controller] = react.useState(() => {
|
|
2636
|
-
const editor =
|
|
2636
|
+
const editor = chunkM5FREXRQ_cjs.createEditor({
|
|
2637
2637
|
blocks,
|
|
2638
2638
|
extensions: options.extensions,
|
|
2639
2639
|
onChange: (next) => callbacks.current.onChange(next),
|
|
@@ -2696,11 +2696,11 @@ function SelectionSink({ label = "Selected content", blockLabel }) {
|
|
|
2696
2696
|
}
|
|
2697
2697
|
);
|
|
2698
2698
|
}
|
|
2699
|
-
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${
|
|
2699
|
+
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${chunk6H76FAI3_cjs.headingLevel(attrs.level)}` : void 0;
|
|
2700
2700
|
var BlockPlaceholderContext = react.createContext(headingPlaceholder);
|
|
2701
2701
|
function regionPlaceholder(state, blockId, region, placeholderOf) {
|
|
2702
|
-
const block =
|
|
2703
|
-
return block !== void 0 &&
|
|
2702
|
+
const block = chunk6H76FAI3_cjs.blockById(state.doc, blockId);
|
|
2703
|
+
return block !== void 0 && chunkM5FREXRQ_cjs.primaryRegion(state.schema, block) === region ? placeholderOf(state, block) : void 0;
|
|
2704
2704
|
}
|
|
2705
2705
|
var samePainted = (a, b) => a.inline === b.inline && a.placeholder === b.placeholder && sameDecorations(a.decorations, b.decorations);
|
|
2706
2706
|
function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
@@ -2711,7 +2711,7 @@ function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
|
2711
2711
|
const select = react.useCallback(
|
|
2712
2712
|
(state) => {
|
|
2713
2713
|
const inline2 = regionInline(state, block, region);
|
|
2714
|
-
const empty = inline2 === void 0 ||
|
|
2714
|
+
const empty = inline2 === void 0 || chunk6H76FAI3_cjs.inlineLength(inline2) === 0;
|
|
2715
2715
|
return {
|
|
2716
2716
|
inline: inline2,
|
|
2717
2717
|
decorations: controller.decorationsFor(block, region),
|
|
@@ -2756,7 +2756,7 @@ var CalloutBlock = ({ block }) => {
|
|
|
2756
2756
|
// src/view/react/block-command.ts
|
|
2757
2757
|
function onBlock(id, command) {
|
|
2758
2758
|
return (state, dispatch) => {
|
|
2759
|
-
const { ok, tr } =
|
|
2759
|
+
const { ok, tr } = chunkM5FREXRQ_cjs.runCommands(state, [chunkM5FREXRQ_cjs.setSelection(chunkM5FREXRQ_cjs.blockRangeSelection(id)), command]);
|
|
2760
2760
|
if (!ok || tr === null) return false;
|
|
2761
2761
|
dispatch?.(tr.setSelection(state.selection));
|
|
2762
2762
|
return true;
|
|
@@ -2776,7 +2776,7 @@ function TaskCheckbox({ block, controller, label, labelledBy }) {
|
|
|
2776
2776
|
role: "checkbox",
|
|
2777
2777
|
"aria-checked": checked,
|
|
2778
2778
|
"aria-readonly": readOnly ? "true" : void 0,
|
|
2779
|
-
"aria-label":
|
|
2779
|
+
"aria-label": chunk6H76FAI3_cjs.firstNamed(label, "Task"),
|
|
2780
2780
|
"aria-labelledby": labelledBy,
|
|
2781
2781
|
className: "quoin-task-box",
|
|
2782
2782
|
contentEditable: false,
|
|
@@ -2807,7 +2807,7 @@ function numberDoc(doc) {
|
|
|
2807
2807
|
numbers[index] = run2.next++;
|
|
2808
2808
|
return;
|
|
2809
2809
|
}
|
|
2810
|
-
const start =
|
|
2810
|
+
const start = chunk6H76FAI3_cjs.orderedStart(block.attrs.start);
|
|
2811
2811
|
numbers[index] = start;
|
|
2812
2812
|
runs.push({ indent: block.indent, next: start + 1 });
|
|
2813
2813
|
});
|
|
@@ -2845,7 +2845,7 @@ var MarkdownBlock = (props) => {
|
|
|
2845
2845
|
const { block } = props;
|
|
2846
2846
|
switch (block.attrs.kind) {
|
|
2847
2847
|
case "heading": {
|
|
2848
|
-
const level =
|
|
2848
|
+
const level = chunk6H76FAI3_cjs.headingLevel(block.attrs.level);
|
|
2849
2849
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: "quoin-heading", children: /* @__PURE__ */ jsxRuntime.jsx(TextRegion, { block, label: `Heading ${level}` }) });
|
|
2850
2850
|
}
|
|
2851
2851
|
case "bullet":
|
|
@@ -2959,7 +2959,7 @@ function covers(state, id, index) {
|
|
|
2959
2959
|
if (selection === null) return false;
|
|
2960
2960
|
if (selection.kind === "node") return selection.block === id;
|
|
2961
2961
|
if (selection.kind === "blocks") return within(state, index, [selection.anchor, selection.head]);
|
|
2962
|
-
if (!isCrossSelection(selection) ||
|
|
2962
|
+
if (!isCrossSelection(selection) || chunkM5FREXRQ_cjs.isTextFlow(schema, doc.blocks[index])) return false;
|
|
2963
2963
|
return within(state, index, [selection.anchor.block, selection.head.block]);
|
|
2964
2964
|
}
|
|
2965
2965
|
function blockStatus(state, id, choices = NO_CHOICES) {
|
|
@@ -3001,11 +3001,11 @@ var BlockShell = react.memo(function BlockShell2({ block, renderers }) {
|
|
|
3001
3001
|
"data-quoin-block": "",
|
|
3002
3002
|
"data-block-id": block.id,
|
|
3003
3003
|
"data-type": block.type,
|
|
3004
|
-
"data-kind":
|
|
3004
|
+
"data-kind": chunk6H76FAI3_cjs.optionalString(kind),
|
|
3005
3005
|
"data-indent": block.indent,
|
|
3006
|
-
"data-color":
|
|
3007
|
-
"data-bg":
|
|
3008
|
-
"data-align":
|
|
3006
|
+
"data-color": chunk6H76FAI3_cjs.paletteOrUndefined(color),
|
|
3007
|
+
"data-bg": chunk6H76FAI3_cjs.paletteOrUndefined(background),
|
|
3008
|
+
"data-align": chunk6H76FAI3_cjs.alignOrUndefined(align),
|
|
3009
3009
|
style: { "--quoin-indent": block.indent },
|
|
3010
3010
|
tabIndex: -1,
|
|
3011
3011
|
"data-selected": status === "selected" ? "true" : void 0,
|
|
@@ -3202,5 +3202,5 @@ exports.useToggleOpen = useToggleOpen;
|
|
|
3202
3202
|
exports.useViewController = useViewController;
|
|
3203
3203
|
exports.visibleBlockIndexes = visibleBlockIndexes;
|
|
3204
3204
|
exports.wholeState = wholeState;
|
|
3205
|
-
//# sourceMappingURL=chunk-
|
|
3206
|
-
//# sourceMappingURL=chunk-
|
|
3205
|
+
//# sourceMappingURL=chunk-VSUGJZ7G.cjs.map
|
|
3206
|
+
//# sourceMappingURL=chunk-VSUGJZ7G.cjs.map
|