quoin-editor 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/ai.cjs +65 -65
- package/dist/ai.js +4 -4
- package/dist/catalogue.cjs +20 -20
- package/dist/catalogue.js +12 -12
- package/dist/{chunk-BKEHG4QV.js → chunk-2IY3LET7.js} +3 -3
- package/dist/{chunk-BKEHG4QV.js.map → chunk-2IY3LET7.js.map} +1 -1
- package/dist/{chunk-X4FDLUXJ.js → chunk-3XPVCSFT.js} +5 -5
- package/dist/{chunk-X4FDLUXJ.js.map → chunk-3XPVCSFT.js.map} +1 -1
- package/dist/{chunk-4EU4BTLZ.js → chunk-4EJ4EGGH.js} +3 -3
- package/dist/{chunk-4EU4BTLZ.js.map → chunk-4EJ4EGGH.js.map} +1 -1
- package/dist/{chunk-NNDLIP2C.cjs → chunk-4SRXM2VS.cjs} +83 -83
- package/dist/{chunk-NNDLIP2C.cjs.map → chunk-4SRXM2VS.cjs.map} +1 -1
- package/dist/{chunk-TG5T7BEJ.js → chunk-4WRIGF7F.js} +6 -6
- package/dist/{chunk-TG5T7BEJ.js.map → chunk-4WRIGF7F.js.map} +1 -1
- package/dist/{chunk-MEXDDWJF.js → chunk-535R45JI.js} +5 -5
- package/dist/{chunk-MEXDDWJF.js.map → chunk-535R45JI.js.map} +1 -1
- package/dist/{chunk-UMTKQVOX.cjs → chunk-5QLDX75X.cjs} +4 -4
- package/dist/{chunk-UMTKQVOX.cjs.map → chunk-5QLDX75X.cjs.map} +1 -1
- package/dist/{chunk-WCAUPASG.js → chunk-7GDKCDU4.js} +5 -5
- package/dist/{chunk-WCAUPASG.js.map → chunk-7GDKCDU4.js.map} +1 -1
- package/dist/{chunk-I4NEX6SZ.js → chunk-B3RY7TN2.js} +5 -5
- package/dist/{chunk-I4NEX6SZ.js.map → chunk-B3RY7TN2.js.map} +1 -1
- package/dist/{chunk-R45RJQRD.cjs → chunk-BGPFGNCL.cjs} +29 -29
- package/dist/{chunk-R45RJQRD.cjs.map → chunk-BGPFGNCL.cjs.map} +1 -1
- package/dist/{chunk-VNRBCUBV.cjs → chunk-C4MLW2QA.cjs} +6 -6
- package/dist/{chunk-VNRBCUBV.cjs.map → chunk-C4MLW2QA.cjs.map} +1 -1
- package/dist/{chunk-KIU5MPZ4.js → chunk-D4ISVKWS.js} +3 -3
- package/dist/{chunk-KIU5MPZ4.js.map → chunk-D4ISVKWS.js.map} +1 -1
- package/dist/{chunk-TLMO46OV.cjs → chunk-EXSNIIOR.cjs} +10 -10
- package/dist/{chunk-TLMO46OV.cjs.map → chunk-EXSNIIOR.cjs.map} +1 -1
- package/dist/{chunk-OWX3Y5UU.js → chunk-HPQM33PG.js} +5 -5
- package/dist/{chunk-OWX3Y5UU.js.map → chunk-HPQM33PG.js.map} +1 -1
- package/dist/{chunk-RENKFSFD.cjs → chunk-I4KBYVSC.cjs} +26 -26
- package/dist/{chunk-RENKFSFD.cjs.map → chunk-I4KBYVSC.cjs.map} +1 -1
- package/dist/{chunk-4F2IWBFM.cjs → chunk-LROGC3SI.cjs} +3 -3
- package/dist/{chunk-4F2IWBFM.cjs.map → chunk-LROGC3SI.cjs.map} +1 -1
- package/dist/{chunk-TN32PKUI.cjs → chunk-LXSVDRMH.cjs} +75 -75
- package/dist/{chunk-TN32PKUI.cjs.map → chunk-LXSVDRMH.cjs.map} +1 -1
- package/dist/{chunk-K7E2DR5W.cjs → chunk-O2VMWE4B.cjs} +20 -20
- package/dist/{chunk-K7E2DR5W.cjs.map → chunk-O2VMWE4B.cjs.map} +1 -1
- package/dist/{chunk-3BCP6ZUM.js → chunk-O4APV37F.js} +6 -6
- package/dist/{chunk-3BCP6ZUM.js.map → chunk-O4APV37F.js.map} +1 -1
- package/dist/{chunk-PMJ3VCSR.js → chunk-PX5CFG5J.js} +4 -4
- package/dist/{chunk-PMJ3VCSR.js.map → chunk-PX5CFG5J.js.map} +1 -1
- package/dist/{chunk-EQKFQK3C.cjs → chunk-RBYK3RGX.cjs} +10 -10
- package/dist/{chunk-EQKFQK3C.cjs.map → chunk-RBYK3RGX.cjs.map} +1 -1
- package/dist/{chunk-I4CSCA3O.js → chunk-RIGAO2QT.js} +4 -4
- package/dist/{chunk-I4CSCA3O.js.map → chunk-RIGAO2QT.js.map} +1 -1
- package/dist/{chunk-IQ2DE3Y3.cjs → chunk-WYGSUSZF.cjs} +66 -66
- package/dist/{chunk-IQ2DE3Y3.cjs.map → chunk-WYGSUSZF.cjs.map} +1 -1
- package/dist/{chunk-UHAAYYMX.cjs → chunk-XT2ZKIYS.cjs} +37 -37
- package/dist/{chunk-UHAAYYMX.cjs.map → chunk-XT2ZKIYS.cjs.map} +1 -1
- package/dist/{chunk-PVCXTSUO.js → chunk-XWKFBLFO.js} +3 -3
- package/dist/{chunk-PVCXTSUO.js.map → chunk-XWKFBLFO.js.map} +1 -1
- package/dist/{chunk-IHTHOAUY.js → chunk-XYR7JW23.js} +6 -6
- package/dist/{chunk-IHTHOAUY.js.map → chunk-XYR7JW23.js.map} +1 -1
- package/dist/{chunk-6X5A4DUQ.cjs → chunk-YVMPIIMO.cjs} +219 -219
- package/dist/{chunk-6X5A4DUQ.cjs.map → chunk-YVMPIIMO.cjs.map} +1 -1
- package/dist/{chunk-TWFMNDOC.cjs → chunk-YWPFC2PX.cjs} +38 -38
- package/dist/{chunk-TWFMNDOC.cjs.map → chunk-YWPFC2PX.cjs.map} +1 -1
- package/dist/comments.cjs +48 -48
- package/dist/comments.js +4 -4
- package/dist/docx.cjs +1 -1
- package/dist/docx.js +1 -1
- package/dist/embed.cjs +6 -6
- package/dist/embed.js +4 -4
- package/dist/emoji.cjs +7 -7
- package/dist/emoji.js +4 -4
- package/dist/engine.cjs +43 -43
- package/dist/engine.js +1 -1
- package/dist/find.cjs +8 -8
- package/dist/find.js +4 -4
- package/dist/headless.cjs +59 -59
- package/dist/headless.js +2 -2
- package/dist/index.cjs +71 -71
- package/dist/index.js +3 -3
- package/dist/math.cjs +7 -7
- package/dist/math.js +5 -5
- package/dist/mention.cjs +7 -7
- package/dist/mention.js +5 -5
- package/dist/presence.cjs +33 -33
- package/dist/presence.js +5 -5
- package/dist/stats.cjs +7 -7
- package/dist/stats.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/table.cjs +23 -23
- package/dist/table.js +4 -4
- package/dist/toc.cjs +7 -7
- package/dist/toc.js +4 -4
- package/dist/yjs.cjs +99 -99
- package/dist/yjs.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLROGC3SI_cjs = require('./chunk-LROGC3SI.cjs');
|
|
4
4
|
var chunkWZA5S5EJ_cjs = require('./chunk-WZA5S5EJ.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
@@ -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 chunkLROGC3SI_cjs.markRanges(state).map(({ block, region, from, to }) => ({
|
|
38
38
|
kind: "inline",
|
|
39
39
|
block,
|
|
40
40
|
region,
|
|
@@ -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 = chunkLROGC3SI_cjs.commonPrefix(before, after);
|
|
343
|
+
const suffix = chunkLROGC3SI_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;
|
|
@@ -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 chunkLROGC3SI_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) ? chunkLROGC3SI_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 (chunkLROGC3SI_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(chunkLROGC3SI_cjs.isClosedToggle);
|
|
614
|
+
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null : chunkLROGC3SI_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 chunkLROGC3SI_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 ? chunkLROGC3SI_cjs.endOf(doc, schema, block) : chunkLROGC3SI_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 : chunkLROGC3SI_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) ? chunkLROGC3SI_cjs.nodeSelection(block) : null;
|
|
654
654
|
var canBeEntered = (controller) => (block) => {
|
|
655
655
|
const { schema } = controller.editor.state;
|
|
656
|
-
const region =
|
|
656
|
+
const region = chunkLROGC3SI_cjs.isTextFlow(schema, block) ? chunkLROGC3SI_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) => chunkLROGC3SI_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 (chunkLROGC3SI_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(chunkLROGC3SI_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(chunkLROGC3SI_cjs.blockRangeSelection(current.start, block));
|
|
822
822
|
}
|
|
823
823
|
function follow(x, y) {
|
|
824
824
|
if (press?.kind === "text") followText(press, x, y);
|
|
@@ -854,9 +854,9 @@ function createCrossBlockPointer(controller) {
|
|
|
854
854
|
function pressWhole(block) {
|
|
855
855
|
if (entryEdge(controller, block, 1).kind !== "node") return;
|
|
856
856
|
const pressed = chunkWZA5S5EJ_cjs.blockById(controller.editor.state.doc, block);
|
|
857
|
-
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(
|
|
857
|
+
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(chunkLROGC3SI_cjs.blockRangeSelection(block));
|
|
858
858
|
controller.nodeReveal.pressed(block);
|
|
859
|
-
select(
|
|
859
|
+
select(chunkLROGC3SI_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 chunkLROGC3SI_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 = chunkLROGC3SI_cjs.markRanges(state).map((range) => chunkWZA5S5EJ_cjs.inlinePlainText(chunkLROGC3SI_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 }));
|
|
@@ -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 = chunkLROGC3SI_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, chunkLROGC3SI_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 chunkLROGC3SI_cjs.endOf(doc, schema, doc.blocks[doc.blocks.length - 1].id);
|
|
1213
|
+
if (target === "start" || target === void 0 && selection === null) return chunkLROGC3SI_cjs.startOf(doc, schema, doc.blocks[0].id);
|
|
1214
|
+
return target === void 0 ? selection : chunkLROGC3SI_cjs.textSelection(target);
|
|
1215
1215
|
}
|
|
1216
1216
|
|
|
1217
1217
|
// src/view/controller/host-decorations.ts
|
|
@@ -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 && chunkLROGC3SI_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(chunkLROGC3SI_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(chunkLROGC3SI_cjs.textSelection(pos)).setOrigin("drop"));
|
|
1433
1433
|
pasteTransfer(controller, dataTransfer);
|
|
1434
1434
|
}
|
|
1435
1435
|
function handleDragOver(event) {
|
|
@@ -1559,29 +1559,29 @@ function createSinkComposition(controller, settled = () => {
|
|
|
1559
1559
|
var LINE_BREAK = "\n";
|
|
1560
1560
|
var transposeChars = (state, dispatch) => {
|
|
1561
1561
|
const { selection } = state;
|
|
1562
|
-
if (selection?.kind !== "text" || !
|
|
1562
|
+
if (selection?.kind !== "text" || !chunkLROGC3SI_cjs.isCollapsed(selection)) return false;
|
|
1563
1563
|
const { head } = selection;
|
|
1564
1564
|
const inline = chunkWZA5S5EJ_cjs.blockById(state.doc, head.block)?.regions[head.region];
|
|
1565
1565
|
if (inline === void 0) return false;
|
|
1566
1566
|
const value = chunkWZA5S5EJ_cjs.inlineText(inline);
|
|
1567
1567
|
const atLineEnd = head.offset === value.length || value[head.offset] === LINE_BREAK;
|
|
1568
|
-
const end = atLineEnd ? head.offset :
|
|
1569
|
-
const middle =
|
|
1570
|
-
const start =
|
|
1568
|
+
const end = atLineEnd ? head.offset : chunkLROGC3SI_cjs.nextGraphemeOffset(value, head.offset);
|
|
1569
|
+
const middle = chunkLROGC3SI_cjs.prevGraphemeOffset(value, end);
|
|
1570
|
+
const start = chunkLROGC3SI_cjs.prevGraphemeOffset(value, middle);
|
|
1571
1571
|
if (start === middle || value.slice(start, end).includes(LINE_BREAK)) return false;
|
|
1572
1572
|
const swapped = [...chunkWZA5S5EJ_cjs.sliceInline(inline, middle, end), ...chunkWZA5S5EJ_cjs.sliceInline(inline, start, middle)];
|
|
1573
|
-
const tr = new
|
|
1574
|
-
tr.step(
|
|
1575
|
-
dispatch?.(tr.setSelection(
|
|
1573
|
+
const tr = new chunkLROGC3SI_cjs.Transaction(state).setOrigin("input");
|
|
1574
|
+
tr.step(chunkLROGC3SI_cjs.replaceInlineStep(head.block, head.region, start, end, swapped));
|
|
1575
|
+
dispatch?.(tr.setSelection(chunkLROGC3SI_cjs.textSelection({ ...head, offset: end })));
|
|
1576
1576
|
return true;
|
|
1577
1577
|
};
|
|
1578
1578
|
|
|
1579
1579
|
// src/view/input/replace-range.ts
|
|
1580
1580
|
function replaceRange(editor, range, text, withRules) {
|
|
1581
1581
|
const dispatch = (tr) => editor.dispatch(tr);
|
|
1582
|
-
dispatch(editor.createTransaction().setSelection(
|
|
1583
|
-
if (text === "") return
|
|
1584
|
-
return withRules ? editor.insertText(text) :
|
|
1582
|
+
dispatch(editor.createTransaction().setSelection(chunkLROGC3SI_cjs.textSelection(range.from, range.to)).setOrigin("input"));
|
|
1583
|
+
if (text === "") return chunkLROGC3SI_cjs.deleteSelection(editor.state, (tr) => dispatch(tr.setOrigin("input")));
|
|
1584
|
+
return withRules ? editor.insertText(text) : chunkLROGC3SI_cjs.insertText(text, { origin: "input" })(editor.state, dispatch);
|
|
1585
1585
|
}
|
|
1586
1586
|
|
|
1587
1587
|
// src/view/input/target-range.ts
|
|
@@ -1592,13 +1592,13 @@ function targetRangeToModel(controller, event) {
|
|
|
1592
1592
|
const to = domToPos(controller.registry, range.endContainer, range.endOffset);
|
|
1593
1593
|
return from && to && { from, to };
|
|
1594
1594
|
}
|
|
1595
|
-
var isEmpty = ({ from, to }) =>
|
|
1595
|
+
var isEmpty = ({ from, to }) => chunkLROGC3SI_cjs.sameSelection(chunkLROGC3SI_cjs.textSelection(from), chunkLROGC3SI_cjs.textSelection(to));
|
|
1596
1596
|
function targetBeyondSelection(controller, event) {
|
|
1597
1597
|
const range = targetRangeToModel(controller, event);
|
|
1598
1598
|
if (range === null || isEmpty(range)) return null;
|
|
1599
1599
|
const { doc, selection } = controller.editor.state;
|
|
1600
|
-
const selected =
|
|
1601
|
-
const same = selected !== null &&
|
|
1600
|
+
const selected = chunkLROGC3SI_cjs.selectionRange(doc, selection);
|
|
1601
|
+
const same = selected !== null && chunkLROGC3SI_cjs.sameSelection(chunkLROGC3SI_cjs.textSelection(selected.from, selected.to), chunkLROGC3SI_cjs.textSelection(range.from, range.to));
|
|
1602
1602
|
return same ? null : range;
|
|
1603
1603
|
}
|
|
1604
1604
|
|
|
@@ -1620,34 +1620,34 @@ function insertTypedText(controller, event) {
|
|
|
1620
1620
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1621
1621
|
}
|
|
1622
1622
|
function deleteContentBackward(controller, event) {
|
|
1623
|
-
if (!controller.run(
|
|
1623
|
+
if (!controller.run(chunkLROGC3SI_cjs.undoInputRule)) targetOr(chunkLROGC3SI_cjs.deleteBackward)(controller, event);
|
|
1624
1624
|
}
|
|
1625
1625
|
function insertReplacementText(controller, event) {
|
|
1626
1626
|
const text = event.dataTransfer?.getData("text/plain") || event.data;
|
|
1627
1627
|
if (!text) return;
|
|
1628
1628
|
const range = targetRangeToModel(controller, event);
|
|
1629
|
-
if (range === null) controller.run(
|
|
1629
|
+
if (range === null) controller.run(chunkLROGC3SI_cjs.insertText(text, { origin: "input" }));
|
|
1630
1630
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1631
1631
|
}
|
|
1632
1632
|
var actions = {
|
|
1633
1633
|
insertText: insertTypedText,
|
|
1634
1634
|
insertReplacementText,
|
|
1635
1635
|
insertParagraph: (controller) => void controller.edit(() => controller.editor.handleKey(ENTER)),
|
|
1636
|
-
insertLineBreak: run(
|
|
1636
|
+
insertLineBreak: run(chunkLROGC3SI_cjs.insertHardBreak),
|
|
1637
1637
|
deleteContentBackward,
|
|
1638
|
-
deleteContentForward: targetOr(
|
|
1639
|
-
deleteWordBackward: targetOr(
|
|
1640
|
-
deleteWordForward: targetOr(
|
|
1641
|
-
deleteSoftLineBackward: targetOr(
|
|
1642
|
-
deleteHardLineBackward: targetOr(
|
|
1643
|
-
deleteSoftLineForward: targetOr(
|
|
1644
|
-
deleteHardLineForward: targetOr(
|
|
1645
|
-
formatBold: run(
|
|
1646
|
-
formatItalic: run(
|
|
1647
|
-
formatUnderline: run(
|
|
1648
|
-
formatStrikeThrough: run(
|
|
1649
|
-
historyUndo: run(
|
|
1650
|
-
historyRedo: run(
|
|
1638
|
+
deleteContentForward: targetOr(chunkLROGC3SI_cjs.deleteForward),
|
|
1639
|
+
deleteWordBackward: targetOr(chunkLROGC3SI_cjs.deleteWordBackward),
|
|
1640
|
+
deleteWordForward: targetOr(chunkLROGC3SI_cjs.deleteWordForward),
|
|
1641
|
+
deleteSoftLineBackward: targetOr(chunkLROGC3SI_cjs.deleteToLineStart),
|
|
1642
|
+
deleteHardLineBackward: targetOr(chunkLROGC3SI_cjs.deleteToLineStart),
|
|
1643
|
+
deleteSoftLineForward: targetOr(chunkLROGC3SI_cjs.deleteToLineEnd),
|
|
1644
|
+
deleteHardLineForward: targetOr(chunkLROGC3SI_cjs.deleteToLineEnd),
|
|
1645
|
+
formatBold: run(chunkLROGC3SI_cjs.toggleMark("bold")),
|
|
1646
|
+
formatItalic: run(chunkLROGC3SI_cjs.toggleMark("italic")),
|
|
1647
|
+
formatUnderline: run(chunkLROGC3SI_cjs.toggleMark("underline")),
|
|
1648
|
+
formatStrikeThrough: run(chunkLROGC3SI_cjs.toggleMark("strike")),
|
|
1649
|
+
historyUndo: run(chunkLROGC3SI_cjs.undo),
|
|
1650
|
+
historyRedo: run(chunkLROGC3SI_cjs.redo),
|
|
1651
1651
|
insertTranspose: run(transposeChars),
|
|
1652
1652
|
insertFromPaste: leaveToHandlers,
|
|
1653
1653
|
insertFromDrop: leaveToHandlers,
|
|
@@ -1928,7 +1928,7 @@ function createDomInputFallback(controller) {
|
|
|
1928
1928
|
|
|
1929
1929
|
// src/view/navigation/cross-moves.ts
|
|
1930
1930
|
function moveHead(controller, { anchor }, head) {
|
|
1931
|
-
dispatchSelection(controller,
|
|
1931
|
+
dispatchSelection(controller, chunkLROGC3SI_cjs.textSelection(anchor, head));
|
|
1932
1932
|
return true;
|
|
1933
1933
|
}
|
|
1934
1934
|
function blockOf(controller, { block }) {
|
|
@@ -1936,25 +1936,25 @@ function blockOf(controller, { block }) {
|
|
|
1936
1936
|
return doc.blocks[chunkWZA5S5EJ_cjs.requireBlockIndex(doc, block)];
|
|
1937
1937
|
}
|
|
1938
1938
|
function collapseCross(controller, selection, direction) {
|
|
1939
|
-
const { from, to } =
|
|
1940
|
-
dispatchSelection(controller,
|
|
1939
|
+
const { from, to } = chunkLROGC3SI_cjs.selectionRange(controller.editor.state.doc, selection);
|
|
1940
|
+
dispatchSelection(controller, chunkLROGC3SI_cjs.textSelection(direction < 0 ? from : to));
|
|
1941
1941
|
return true;
|
|
1942
1942
|
}
|
|
1943
1943
|
function crossHeadVertically(controller, selection, direction) {
|
|
1944
1944
|
const { head } = selection;
|
|
1945
1945
|
const edge = neighbourHead(controller, head.block, direction);
|
|
1946
1946
|
if (edge !== null) {
|
|
1947
|
-
const end2 =
|
|
1947
|
+
const end2 = chunkLROGC3SI_cjs.regionLength(blockOf(controller, edge), edge.region);
|
|
1948
1948
|
return moveHead(controller, selection, { ...edge, offset: Math.min(head.offset, end2) });
|
|
1949
1949
|
}
|
|
1950
|
-
const end =
|
|
1950
|
+
const end = chunkLROGC3SI_cjs.regionLength(blockOf(controller, head), head.region);
|
|
1951
1951
|
return moveHead(controller, selection, { ...head, offset: direction < 0 ? 0 : end });
|
|
1952
1952
|
}
|
|
1953
1953
|
function crossHeadHorizontally(controller, selection, direction) {
|
|
1954
1954
|
const { head } = selection;
|
|
1955
1955
|
const text = chunkWZA5S5EJ_cjs.inlineText(blockOf(controller, head).regions[head.region] ?? []);
|
|
1956
1956
|
if (direction < 0 ? head.offset > 0 : head.offset < text.length) {
|
|
1957
|
-
const offset = direction < 0 ?
|
|
1957
|
+
const offset = direction < 0 ? chunkLROGC3SI_cjs.prevGraphemeOffset(text, head.offset) : chunkLROGC3SI_cjs.nextGraphemeOffset(text, head.offset);
|
|
1958
1958
|
return moveHead(controller, selection, { ...head, offset });
|
|
1959
1959
|
}
|
|
1960
1960
|
const edge = neighbourHead(controller, head.block, direction);
|
|
@@ -1973,9 +1973,9 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
1973
1973
|
const move = extend ? crossHeadHorizontally : collapseCross;
|
|
1974
1974
|
return move(controller, selection, direction);
|
|
1975
1975
|
}
|
|
1976
|
-
if (!extend && !
|
|
1976
|
+
if (!extend && !chunkLROGC3SI_cjs.isCollapsed(selection)) return false;
|
|
1977
1977
|
const { head } = selection;
|
|
1978
|
-
const length =
|
|
1978
|
+
const length = chunkLROGC3SI_cjs.regionLength(doc.blocks[chunkWZA5S5EJ_cjs.requireBlockIndex(doc, head.block)], head.region);
|
|
1979
1979
|
if (direction < 0 ? head.offset > 0 : head.offset < length) return false;
|
|
1980
1980
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
1981
1981
|
if (own2 !== null) {
|
|
@@ -2081,12 +2081,12 @@ function caretAtGoal(controller, host, at, y) {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
function landAtGoal(controller, block, direction) {
|
|
2083
2083
|
const { schema } = controller.editor.state;
|
|
2084
|
-
const region =
|
|
2084
|
+
const region = chunkLROGC3SI_cjs.isTextFlow(schema, block) ? chunkLROGC3SI_cjs.primaryRegion(schema, block) : null;
|
|
2085
2085
|
const host = region === null ? void 0 : controller.registry.get(block.id, region);
|
|
2086
2086
|
if (!host || region === null || controller.goalX === null) return null;
|
|
2087
2087
|
const line = lineInView(host, direction < 0);
|
|
2088
2088
|
const pos = line && caretAtGoal(controller, host, { block: block.id, region }, line.top + line.height / 2);
|
|
2089
|
-
return pos ?
|
|
2089
|
+
return pos ? chunkLROGC3SI_cjs.textSelection(pos) : null;
|
|
2090
2090
|
}
|
|
2091
2091
|
function moveInHost(controller, host, head, caret, direction) {
|
|
2092
2092
|
const { goalX } = controller;
|
|
@@ -2105,7 +2105,7 @@ function landing(controller, { head }, direction, extend) {
|
|
|
2105
2105
|
controller.goalX ??= caret?.left ?? null;
|
|
2106
2106
|
if (!(direction < 0 ? isOnFirstLine(host, point) : isOnLastLine(host, point))) {
|
|
2107
2107
|
const pos = moveInHost(controller, host, head, caret, direction);
|
|
2108
|
-
return pos &&
|
|
2108
|
+
return pos && chunkLROGC3SI_cjs.textSelection(pos);
|
|
2109
2109
|
}
|
|
2110
2110
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2111
2111
|
if (own2 !== null) return own2;
|
|
@@ -2127,7 +2127,7 @@ function moveText(controller, selection, direction, extend) {
|
|
|
2127
2127
|
function extendBlocks(controller, { anchor, head }, direction) {
|
|
2128
2128
|
const next = neighbourBlock(controller.editor.state.doc, head, direction);
|
|
2129
2129
|
if (next === null) return false;
|
|
2130
|
-
dispatchSelection(controller,
|
|
2130
|
+
dispatchSelection(controller, chunkLROGC3SI_cjs.blockRangeSelection(anchor, next.id));
|
|
2131
2131
|
return true;
|
|
2132
2132
|
}
|
|
2133
2133
|
function moveVertically(controller, direction, extend) {
|
|
@@ -2143,8 +2143,8 @@ function moveVertically(controller, direction, extend) {
|
|
|
2143
2143
|
// src/view/input/flip-block.ts
|
|
2144
2144
|
var isTask = ({ type, attrs }) => type === "MARKDOWN" && attrs.kind === "task";
|
|
2145
2145
|
function flipCommand(block) {
|
|
2146
|
-
if (isTask(block)) return
|
|
2147
|
-
return block.type === "TOGGLE" ?
|
|
2146
|
+
if (isTask(block)) return chunkLROGC3SI_cjs.toggleTask;
|
|
2147
|
+
return block.type === "TOGGLE" ? chunkLROGC3SI_cjs.setAttrs({ open: block.attrs.open !== true }) : null;
|
|
2148
2148
|
}
|
|
2149
2149
|
var toggleState = (open) => open ? "expanded" : "collapsed";
|
|
2150
2150
|
function stateName(block) {
|
|
@@ -2242,7 +2242,7 @@ function attachInput(controller, root) {
|
|
|
2242
2242
|
const { editor } = controller;
|
|
2243
2243
|
let { selection } = editor.state;
|
|
2244
2244
|
const stop = editor.subscribe((_, tr) => {
|
|
2245
|
-
if (tr && selection) selection =
|
|
2245
|
+
if (tr && selection) selection = chunkLROGC3SI_cjs.mapSelection(selection, (pos, assoc) => tr.mapPos(pos, assoc));
|
|
2246
2246
|
});
|
|
2247
2247
|
fallback.flush();
|
|
2248
2248
|
stop();
|
|
@@ -2399,7 +2399,7 @@ function bindRoot(controller, root, cross, committed) {
|
|
|
2399
2399
|
function movedSelection(controller, doc, model) {
|
|
2400
2400
|
if (controller.composingKey !== null || controller.dragging || !doc || !ownsFocus(controller, doc)) return null;
|
|
2401
2401
|
const selection = readSelection(controller.registry, doc.getSelection(), (node) => controller.blockAt(node));
|
|
2402
|
-
return selection === null ||
|
|
2402
|
+
return selection === null || chunkLROGC3SI_cjs.sameSelection(selection, model) ? null : selection;
|
|
2403
2403
|
}
|
|
2404
2404
|
function writeModelSelection(controller, doc, moved, local) {
|
|
2405
2405
|
const domSelection = doc?.getSelection();
|
|
@@ -2457,7 +2457,7 @@ var ViewController = class {
|
|
|
2457
2457
|
});
|
|
2458
2458
|
this.#flush = options.flush ?? runNow;
|
|
2459
2459
|
this.onFiles = options.onFiles;
|
|
2460
|
-
this.isMac = options.isMac ??
|
|
2460
|
+
this.isMac = options.isMac ?? chunkLROGC3SI_cjs.detectMac();
|
|
2461
2461
|
const decorationsOf = (block, region) => this.decorationsFor(block, region);
|
|
2462
2462
|
const drain = (element) => this.#binding?.input.drain(element);
|
|
2463
2463
|
this.#hosts = createHostRenderer(options.editor, options.render, decorationsOf, drain);
|
|
@@ -2610,7 +2610,7 @@ var ViewController = class {
|
|
|
2610
2610
|
focus(target) {
|
|
2611
2611
|
const { editor } = this;
|
|
2612
2612
|
const selection = focusTarget(editor.state, target);
|
|
2613
|
-
if (selection !== null && !
|
|
2613
|
+
if (selection !== null && !chunkLROGC3SI_cjs.sameSelection(selection, editor.state.selection)) dispatchSelection(this, selection);
|
|
2614
2614
|
this.#takeFocus();
|
|
2615
2615
|
this.syncSelectionToDom();
|
|
2616
2616
|
}
|
|
@@ -2658,7 +2658,7 @@ function useQuoinEditor(options) {
|
|
|
2658
2658
|
const { blocks, readOnly = false } = options;
|
|
2659
2659
|
const callbacks = react.useRef(options);
|
|
2660
2660
|
const [controller] = react.useState(() => {
|
|
2661
|
-
const editor =
|
|
2661
|
+
const editor = chunkLROGC3SI_cjs.createEditor({
|
|
2662
2662
|
blocks,
|
|
2663
2663
|
extensions: options.extensions,
|
|
2664
2664
|
onChange: (next) => callbacks.current.onChange(next),
|
|
@@ -2725,7 +2725,7 @@ var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && att
|
|
|
2725
2725
|
var BlockPlaceholderContext = react.createContext(headingPlaceholder);
|
|
2726
2726
|
function regionPlaceholder(state, blockId, region, placeholderOf) {
|
|
2727
2727
|
const block = chunkWZA5S5EJ_cjs.blockById(state.doc, blockId);
|
|
2728
|
-
return block !== void 0 &&
|
|
2728
|
+
return block !== void 0 && chunkLROGC3SI_cjs.primaryRegion(state.schema, block) === region ? placeholderOf(state, block) : void 0;
|
|
2729
2729
|
}
|
|
2730
2730
|
var samePainted = (a, b) => a.inline === b.inline && a.placeholder === b.placeholder && sameDecorations(a.decorations, b.decorations);
|
|
2731
2731
|
function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
@@ -2781,7 +2781,7 @@ var CalloutBlock = ({ block }) => {
|
|
|
2781
2781
|
// src/view/react/block-command.ts
|
|
2782
2782
|
function onBlock(id, command) {
|
|
2783
2783
|
return (state, dispatch) => {
|
|
2784
|
-
const { ok, tr } =
|
|
2784
|
+
const { ok, tr } = chunkLROGC3SI_cjs.runCommands(state, [chunkLROGC3SI_cjs.setSelection(chunkLROGC3SI_cjs.blockRangeSelection(id)), command]);
|
|
2785
2785
|
if (!ok || tr === null) return false;
|
|
2786
2786
|
dispatch?.(tr.setSelection(state.selection));
|
|
2787
2787
|
return true;
|
|
@@ -2984,7 +2984,7 @@ function covers(state, id, index) {
|
|
|
2984
2984
|
if (selection === null) return false;
|
|
2985
2985
|
if (selection.kind === "node") return selection.block === id;
|
|
2986
2986
|
if (selection.kind === "blocks") return within(state, index, [selection.anchor, selection.head]);
|
|
2987
|
-
if (!isCrossSelection(selection) ||
|
|
2987
|
+
if (!isCrossSelection(selection) || chunkLROGC3SI_cjs.isTextFlow(schema, doc.blocks[index])) return false;
|
|
2988
2988
|
return within(state, index, [selection.anchor.block, selection.head.block]);
|
|
2989
2989
|
}
|
|
2990
2990
|
function blockStatus(state, id, choices = NO_CHOICES) {
|
|
@@ -3227,5 +3227,5 @@ exports.useToggleOpen = useToggleOpen;
|
|
|
3227
3227
|
exports.useViewController = useViewController;
|
|
3228
3228
|
exports.visibleBlockIndexes = visibleBlockIndexes;
|
|
3229
3229
|
exports.wholeState = wholeState;
|
|
3230
|
-
//# sourceMappingURL=chunk-
|
|
3231
|
-
//# sourceMappingURL=chunk-
|
|
3230
|
+
//# sourceMappingURL=chunk-4SRXM2VS.cjs.map
|
|
3231
|
+
//# sourceMappingURL=chunk-4SRXM2VS.cjs.map
|