quoin-editor 1.7.0 → 1.8.0
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/README.md +25 -10
- package/dist/ai-labels-BXX32H9a.d.cts +53 -0
- package/dist/ai-labels-BXX32H9a.d.ts +53 -0
- package/dist/ai.cjs +84 -86
- package/dist/ai.d.cts +4 -53
- package/dist/ai.d.ts +4 -53
- package/dist/ai.js +8 -10
- package/dist/ai.js.map +1 -1
- package/dist/catalogue.cjs +27 -26
- package/dist/catalogue.d.cts +10 -1
- package/dist/catalogue.d.ts +10 -1
- package/dist/catalogue.js +18 -17
- package/dist/catalogue.js.map +1 -1
- package/dist/{chunk-QR2NIDUK.cjs → chunk-4MCYQHFL.cjs} +2 -2
- package/dist/{chunk-YEFPH27F.cjs → chunk-53CNYRVQ.cjs} +92 -94
- package/dist/{chunk-FNJOPGMN.cjs → chunk-53FJFYBR.cjs} +115 -117
- package/dist/{chunk-OJ4O6HWC.js → chunk-5OZX2LV4.js} +10 -12
- package/dist/chunk-5OZX2LV4.js.map +1 -0
- package/dist/{chunk-OS2O6IKX.js → chunk-5RBMZGKV.js} +4 -4
- package/dist/{chunk-OS2O6IKX.js.map → chunk-5RBMZGKV.js.map} +1 -1
- package/dist/{chunk-4T4TJ2QS.cjs → chunk-7E43TURF.cjs} +7 -7
- package/dist/{chunk-I722LBD3.cjs → chunk-7X3T7VXV.cjs} +32 -34
- package/dist/{chunk-BJTOLCRR.js → chunk-7Y4B7NHO.js} +2 -2
- package/dist/chunk-7Y4B7NHO.js.map +1 -0
- package/dist/{chunk-MZXW2HXP.cjs → chunk-B3OBM6I4.cjs} +25 -27
- package/dist/{chunk-6T5YGCZ5.cjs → chunk-BA5WXBGE.cjs} +290 -293
- package/dist/{chunk-CSKKSXCE.js → chunk-CSPCDVCT.js} +3 -3
- package/dist/{chunk-CSKKSXCE.js.map → chunk-CSPCDVCT.js.map} +1 -1
- package/dist/{chunk-R7MYG522.js → chunk-D4L5FINK.js} +3 -3
- package/dist/{chunk-R7MYG522.js.map → chunk-D4L5FINK.js.map} +1 -1
- package/dist/{chunk-GHNQKJMD.js → chunk-DBOZFNWU.js} +3 -3
- package/dist/{chunk-GHNQKJMD.js.map → chunk-DBOZFNWU.js.map} +1 -1
- package/dist/{chunk-BM2GRZNM.cjs → chunk-DJU25PFC.cjs} +11 -11
- package/dist/chunk-DLQCTGC3.js +10 -0
- package/dist/chunk-DLQCTGC3.js.map +1 -0
- package/dist/{chunk-7GU25Z6L.js → chunk-DXUDBPG5.js} +9 -11
- package/dist/chunk-DXUDBPG5.js.map +1 -0
- package/dist/{chunk-KDK2ATMB.cjs → chunk-EZWJRBQT.cjs} +51 -53
- package/dist/{chunk-PWUFFHAQ.js → chunk-EZX37R5D.js} +8 -10
- package/dist/chunk-EZX37R5D.js.map +1 -0
- package/dist/{chunk-VZZPCYA3.cjs → chunk-FK7EBZPX.cjs} +226 -226
- package/dist/{chunk-BXSWZEA5.js → chunk-GPTJYWGS.js} +3 -3
- package/dist/{chunk-BXSWZEA5.js.map → chunk-GPTJYWGS.js.map} +1 -1
- package/dist/{chunk-H3C3MJW5.cjs → chunk-LM3DHROX.cjs} +2 -2
- package/dist/{chunk-AD3NY7NA.js → chunk-LSI4RMTY.js} +3 -3
- package/dist/{chunk-AD3NY7NA.js.map → chunk-LSI4RMTY.js.map} +1 -1
- package/dist/{chunk-LKZJ2TDU.cjs → chunk-MMS4D4MK.cjs} +10 -13
- package/dist/{chunk-PLUMKN4B.js → chunk-MRHDPXQ7.js} +8 -10
- package/dist/chunk-MRHDPXQ7.js.map +1 -0
- package/dist/{chunk-XFEDJEJF.js → chunk-MSWA5ZZM.js} +4 -4
- package/dist/{chunk-XFEDJEJF.js.map → chunk-MSWA5ZZM.js.map} +1 -1
- package/dist/{chunk-RQXJKJ5S.js → chunk-NCDMQCZR.js} +7 -10
- package/dist/chunk-NCDMQCZR.js.map +1 -0
- package/dist/{chunk-QJ34MOFV.cjs → chunk-P6HC7RUN.cjs} +120 -120
- package/dist/{chunk-UZS3TW75.js → chunk-PHQMHXNG.js} +9 -11
- package/dist/chunk-PHQMHXNG.js.map +1 -0
- package/dist/{chunk-WN7BZDNH.cjs → chunk-PURYVDC3.cjs} +13 -13
- package/dist/{chunk-JY5VUHKN.cjs → chunk-PVFSJXYQ.cjs} +28 -30
- package/dist/{chunk-QOIVLYMW.js → chunk-SP4F5F6V.js} +5 -5
- package/dist/{chunk-QOIVLYMW.js.map → chunk-SP4F5F6V.js.map} +1 -1
- package/dist/{chunk-BF7733XS.cjs → chunk-TQHFGSTT.cjs} +57 -59
- package/dist/{chunk-G25FMFEZ.js → chunk-UDBLZILE.js} +4 -4
- package/dist/{chunk-G25FMFEZ.js.map → chunk-UDBLZILE.js.map} +1 -1
- package/dist/{chunk-5JEQZIRI.js → chunk-VM567D6O.js} +8 -10
- package/dist/chunk-VM567D6O.js.map +1 -0
- package/dist/{chunk-MNA7MBCH.js → chunk-VWYPO6SX.js} +8 -10
- package/dist/chunk-VWYPO6SX.js.map +1 -0
- package/dist/{chunk-IJKGF6SC.js → chunk-WOGCD7JN.js} +8 -10
- package/dist/chunk-WOGCD7JN.js.map +1 -0
- package/dist/{chunk-AZF7B2AE.cjs → chunk-XKYNINUX.cjs} +11 -11
- package/dist/{chunk-HSLOPJVT.js → chunk-Y4EJ6UBV.js} +7 -10
- package/dist/chunk-Y4EJ6UBV.js.map +1 -0
- package/dist/{chunk-XZ4NC3Q7.cjs → chunk-YEDPBYO5.cjs} +4 -4
- package/dist/{chunk-STKGRXSA.cjs → chunk-YVPZDTVZ.cjs} +15 -17
- package/dist/chunk-ZWTIRGY5.cjs +10 -0
- package/dist/comments-labels-DWqsSz8G.d.cts +30 -0
- package/dist/comments-labels-DWqsSz8G.d.ts +30 -0
- package/dist/comments.cjs +63 -65
- package/dist/comments.d.cts +4 -30
- package/dist/comments.d.ts +4 -30
- package/dist/comments.js +9 -11
- package/dist/comments.js.map +1 -1
- package/dist/{diagram-extension-Da7hp-tv.d.ts → diagram-extension-22x_njXB.d.ts} +4 -12
- package/dist/{diagram-extension-D573COJv.d.cts → diagram-extension-C_FSkoj9.d.cts} +4 -12
- package/dist/diagram-labels-Bi_jEZ8_.d.cts +11 -0
- package/dist/diagram-labels-Bi_jEZ8_.d.ts +11 -0
- package/dist/diagram.cjs +10 -9
- package/dist/diagram.d.cts +3 -2
- package/dist/diagram.d.ts +3 -2
- package/dist/diagram.js +7 -6
- package/dist/diff-labels-DWwg7N0n.d.cts +27 -0
- package/dist/diff-labels-DWwg7N0n.d.ts +27 -0
- package/dist/diff.cjs +27 -29
- package/dist/diff.d.cts +4 -27
- package/dist/diff.d.ts +4 -27
- package/dist/diff.js +5 -7
- package/dist/diff.js.map +1 -1
- package/dist/docx.cjs +30 -30
- package/dist/docx.js +3 -3
- package/dist/embed-labels-BiVa9HYl.d.cts +23 -0
- package/dist/embed-labels-BiVa9HYl.d.ts +23 -0
- package/dist/embed.cjs +10 -9
- package/dist/embed.d.cts +4 -23
- package/dist/embed.d.ts +4 -23
- package/dist/embed.js +8 -7
- package/dist/emoji-extension-C832oGeT.d.ts +16 -0
- package/dist/emoji-extension-Dk5IQLZf.d.cts +16 -0
- package/dist/{emoji-extension-gRKnbW8G.d.ts → emoji-labels-YwOms7ZJ.d.cts} +2 -15
- package/dist/{emoji-extension-C3o_Y5uC.d.cts → emoji-labels-YwOms7ZJ.d.ts} +2 -15
- package/dist/emoji.cjs +10 -9
- package/dist/emoji.d.cts +4 -3
- package/dist/emoji.d.ts +4 -3
- package/dist/emoji.js +7 -6
- package/dist/engine.cjs +58 -58
- package/dist/engine.d.cts +8 -7
- package/dist/engine.d.ts +8 -7
- package/dist/engine.js +3 -3
- package/dist/find-extension-BfruAPLi.d.cts +15 -0
- package/dist/find-extension-DmK9_N81.d.ts +15 -0
- package/dist/{find-extension-B_Ctrs6T.d.ts → find-labels-C4vs8Qe9.d.cts} +2 -14
- package/dist/{find-extension-BGGsJMu4.d.cts → find-labels-C4vs8Qe9.d.ts} +2 -14
- package/dist/find.cjs +11 -10
- package/dist/find.d.cts +2 -1
- package/dist/find.d.ts +2 -1
- package/dist/find.js +7 -6
- package/dist/headless.cjs +74 -74
- package/dist/headless.d.cts +38 -8
- package/dist/headless.d.ts +38 -8
- package/dist/headless.js +4 -4
- package/dist/highlight.cjs +7 -6
- package/dist/highlight.js +6 -5
- package/dist/highlight.js.map +1 -1
- package/dist/{index-CsG7OQoq.d.cts → index-3fYvwqUZ.d.cts} +1 -1
- package/dist/{index-h1llgZM-.d.ts → index-CgxnzCO5.d.ts} +1 -1
- package/dist/index.cjs +87 -86
- package/dist/index.d.cts +18 -185
- package/dist/index.d.ts +18 -185
- package/dist/index.js +6 -5
- package/dist/labels-BhRJYo46.d.ts +176 -0
- package/dist/labels-CiCxj2jP.d.cts +176 -0
- package/dist/locale-ar.cjs +565 -0
- package/dist/locale-ar.d.cts +63 -0
- package/dist/locale-ar.d.ts +63 -0
- package/dist/locale-ar.js +551 -0
- package/dist/locale-ar.js.map +1 -0
- package/dist/locale-de.cjs +510 -0
- package/dist/locale-de.d.cts +63 -0
- package/dist/locale-de.d.ts +63 -0
- package/dist/locale-de.js +496 -0
- package/dist/locale-de.js.map +1 -0
- package/dist/locale-es.cjs +510 -0
- package/dist/locale-es.d.cts +63 -0
- package/dist/locale-es.d.ts +63 -0
- package/dist/locale-es.js +496 -0
- package/dist/locale-es.js.map +1 -0
- package/dist/locale-fr.cjs +510 -0
- package/dist/locale-fr.d.cts +63 -0
- package/dist/locale-fr.d.ts +63 -0
- package/dist/locale-fr.js +496 -0
- package/dist/locale-fr.js.map +1 -0
- package/dist/locale-ja.cjs +505 -0
- package/dist/locale-ja.d.cts +63 -0
- package/dist/locale-ja.d.ts +63 -0
- package/dist/locale-ja.js +491 -0
- package/dist/locale-ja.js.map +1 -0
- package/dist/locale-pt.cjs +511 -0
- package/dist/locale-pt.d.cts +63 -0
- package/dist/locale-pt.d.ts +63 -0
- package/dist/locale-pt.js +497 -0
- package/dist/locale-pt.js.map +1 -0
- package/dist/locale-zh.cjs +505 -0
- package/dist/locale-zh.d.cts +63 -0
- package/dist/locale-zh.d.ts +63 -0
- package/dist/locale-zh.js +491 -0
- package/dist/locale-zh.js.map +1 -0
- package/dist/math-labels-DOf5KFxp.d.cts +24 -0
- package/dist/math-labels-DOf5KFxp.d.ts +24 -0
- package/dist/math.cjs +11 -10
- package/dist/math.d.cts +4 -24
- package/dist/math.d.ts +4 -24
- package/dist/math.js +9 -8
- package/dist/mention-labels-DIQy8LRT.d.cts +15 -0
- package/dist/mention-labels-DIQy8LRT.d.ts +15 -0
- package/dist/mention.cjs +11 -10
- package/dist/mention.d.cts +4 -15
- package/dist/mention.d.ts +4 -15
- package/dist/mention.js +9 -8
- package/dist/{view-controller-p-2x3J7Y.d.ts → node-reveal-BnFcnHhz.d.ts} +14 -14
- package/dist/{view-controller-BfVSNZYZ.d.cts → node-reveal-DY6bimv3.d.cts} +14 -14
- package/dist/palette-BrX-hEd-.d.cts +4 -0
- package/dist/palette-BrX-hEd-.d.ts +4 -0
- package/dist/presence-labels-DXVJLifl.d.cts +15 -0
- package/dist/presence-labels-DXVJLifl.d.ts +15 -0
- package/dist/presence.cjs +40 -42
- package/dist/presence.d.cts +4 -15
- package/dist/presence.d.ts +4 -15
- package/dist/presence.js +9 -11
- package/dist/presence.js.map +1 -1
- package/dist/source-labels-CeQDXsYZ.d.cts +9 -0
- package/dist/source-labels-CeQDXsYZ.d.ts +9 -0
- package/dist/source.cjs +11 -14
- package/dist/source.d.cts +5 -10
- package/dist/source.d.ts +5 -10
- package/dist/source.js +7 -10
- package/dist/source.js.map +1 -1
- package/dist/{stats-extension-oD6D1cYy.d.ts → stats-extension-D5HySF0a.d.cts} +4 -16
- package/dist/{stats-extension-XqOTvRaq.d.cts → stats-extension-Dmw0Ujxe.d.ts} +4 -16
- package/dist/stats-labels-W8gep51s.d.cts +15 -0
- package/dist/stats-labels-W8gep51s.d.ts +15 -0
- package/dist/stats.cjs +11 -10
- package/dist/stats.d.cts +3 -2
- package/dist/stats.d.ts +3 -2
- package/dist/stats.js +8 -7
- package/dist/table-extension-7LkLNK6Q.d.cts +15 -0
- package/dist/table-extension-DEpV0DnP.d.ts +15 -0
- package/dist/{table-extension-v6VB59bF.d.ts → table-labels-Dc-MzU3j.d.cts} +2 -14
- package/dist/{table-extension-BP47hHoz.d.cts → table-labels-Dc-MzU3j.d.ts} +2 -14
- package/dist/table.cjs +26 -25
- package/dist/table.d.cts +2 -1
- package/dist/table.d.ts +2 -1
- package/dist/table.js +7 -6
- package/dist/{to-html-1oD-CDle.d.cts → to-html-C19PbIzh.d.cts} +1 -0
- package/dist/{to-html-CLRBCX0I.d.ts → to-html-CogwrQer.d.ts} +1 -0
- package/dist/{to-markdown-CFPMbbiX.d.cts → to-markdown-C2w7Dzg8.d.cts} +1 -0
- package/dist/{to-markdown-BVOzhgVM.d.ts → to-markdown-DC1EUye5.d.ts} +1 -0
- package/dist/toc-extension-Dvh37bWQ.d.cts +15 -0
- package/dist/toc-extension-SVckrFmb.d.ts +15 -0
- package/dist/toc-labels-B2apPfXG.d.cts +14 -0
- package/dist/toc-labels-B2apPfXG.d.ts +14 -0
- package/dist/toc.cjs +10 -9
- package/dist/toc.d.cts +3 -2
- package/dist/toc.d.ts +3 -2
- package/dist/toc.js +7 -6
- package/dist/{types-DXF9p4qV.d.cts → types-Bzhq5AXj.d.cts} +1 -0
- package/dist/{types-BjLcmV00.d.ts → types-DMuuDBVh.d.ts} +1 -0
- package/dist/view.cjs +4 -4
- package/dist/view.js +2 -2
- package/dist/yjs.cjs +121 -121
- package/dist/yjs.d.cts +2 -2
- package/dist/yjs.d.ts +2 -2
- package/dist/yjs.js +5 -5
- package/package.json +71 -1
- package/dist/chunk-5JEQZIRI.js.map +0 -1
- package/dist/chunk-7GU25Z6L.js.map +0 -1
- package/dist/chunk-BJTOLCRR.js.map +0 -1
- package/dist/chunk-HSLOPJVT.js.map +0 -1
- package/dist/chunk-IJKGF6SC.js.map +0 -1
- package/dist/chunk-MNA7MBCH.js.map +0 -1
- package/dist/chunk-OJ4O6HWC.js.map +0 -1
- package/dist/chunk-PLUMKN4B.js.map +0 -1
- package/dist/chunk-PWUFFHAQ.js.map +0 -1
- package/dist/chunk-RQXJKJ5S.js.map +0 -1
- package/dist/chunk-UZS3TW75.js.map +0 -1
- package/dist/toc-extension-CI6jNOYl.d.cts +0 -26
- package/dist/toc-extension-CTHWjNJC.d.ts +0 -26
- /package/dist/{chunk-WZA5S5EJ.cjs → chunk-I7X7B3WD.cjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkFK7EBZPX_cjs = require('./chunk-FK7EBZPX.cjs');
|
|
4
|
+
var chunkI7X7B3WD_cjs = require('./chunk-I7X7B3WD.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 chunkFK7EBZPX_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) => chunkI7X7B3WD_cjs.dataAttributes(attrs, "");
|
|
49
49
|
function setAttributes(element, attrs, prefix = "") {
|
|
50
|
-
for (const [name, value] of
|
|
50
|
+
for (const [name, value] of chunkI7X7B3WD_cjs.writtenAttrs(chunkI7X7B3WD_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 = chunkI7X7B3WD_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 + chunkI7X7B3WD_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 = chunkI7X7B3WD_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 } = chunkI7X7B3WD_cjs.markElement(mark2);
|
|
145
|
+
return create(doc, tag, chunkI7X7B3WD_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 = chunkFK7EBZPX_cjs.commonPrefix(before, after);
|
|
343
|
+
const suffix = chunkFK7EBZPX_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 = chunkI7X7B3WD_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 = chunkI7X7B3WD_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 chunkFK7EBZPX_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) ? chunkFK7EBZPX_cjs.nodeSelection(block) : null;
|
|
535
535
|
}
|
|
536
536
|
function selectBlock(domSelection, element) {
|
|
537
537
|
if (!element) return false;
|
|
@@ -544,8 +544,8 @@ function selectBlock(domSelection, element) {
|
|
|
544
544
|
}
|
|
545
545
|
var drawnUpstream = /* @__PURE__ */ new WeakMap();
|
|
546
546
|
function drawUpstream(registry, pos, domSelection, drawn) {
|
|
547
|
-
const caret =
|
|
548
|
-
const isAt = () =>
|
|
547
|
+
const caret = chunkFK7EBZPX_cjs.textSelection(pos);
|
|
548
|
+
const isAt = () => chunkFK7EBZPX_cjs.sameSelection(readSelection(registry, domSelection), caret);
|
|
549
549
|
if (drawn?.node === domSelection.focusNode && drawn.offset === domSelection.focusOffset && isAt()) {
|
|
550
550
|
drawnUpstream.set(domSelection, drawn);
|
|
551
551
|
return true;
|
|
@@ -565,7 +565,7 @@ function writeSelection(registry, selection, domSelection, blockElement) {
|
|
|
565
565
|
if (anchor.block !== head.block || anchor.region !== head.region) return false;
|
|
566
566
|
const drawn = drawnUpstream.get(domSelection);
|
|
567
567
|
drawnUpstream.delete(domSelection);
|
|
568
|
-
if (
|
|
568
|
+
if (chunkFK7EBZPX_cjs.sameSelection(readSelection(registry, domSelection), selection)) return true;
|
|
569
569
|
if (selection.assoc === -1 && anchor.offset === head.offset && drawUpstream(registry, head, domSelection, drawn)) {
|
|
570
570
|
return true;
|
|
571
571
|
}
|
|
@@ -618,20 +618,20 @@ function wrapsAt(pos, y, glyphAt2) {
|
|
|
618
618
|
return after !== null && !onLine(after, y) && onLine(before, y) ? before : null;
|
|
619
619
|
}
|
|
620
620
|
function stayOnLine(pos, y, glyphAt2) {
|
|
621
|
-
const caret =
|
|
621
|
+
const caret = chunkFK7EBZPX_cjs.textSelection(pos);
|
|
622
622
|
const before = wrapsAt(pos, y, glyphAt2);
|
|
623
623
|
if (before === null) return caret;
|
|
624
|
-
return /\S/.test(before.text) ? { ...caret, assoc: -1 } :
|
|
624
|
+
return /\S/.test(before.text) ? { ...caret, assoc: -1 } : chunkFK7EBZPX_cjs.textSelection({ ...pos, offset: pos.offset - 1 });
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
// src/view/navigation/clicked-side.ts
|
|
628
628
|
function keepClickedSide(controller, y) {
|
|
629
629
|
controller.readSelectionFromDom();
|
|
630
630
|
const { selection } = controller.editor.state;
|
|
631
|
-
if (selection?.kind !== "text" || !
|
|
631
|
+
if (selection?.kind !== "text" || !chunkFK7EBZPX_cjs.isCollapsed(selection)) return;
|
|
632
632
|
const upstream = wrapsAt(selection.head, y, glyphsAround(controller.registry, selection.head)) !== null;
|
|
633
633
|
if (upstream !== (selection.assoc === -1)) {
|
|
634
|
-
const caret =
|
|
634
|
+
const caret = chunkFK7EBZPX_cjs.textSelection(selection.head);
|
|
635
635
|
dispatchSelection(controller, upstream ? { ...caret, assoc: -1 } : caret);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
@@ -681,8 +681,8 @@ var known = /* @__PURE__ */ new WeakMap();
|
|
|
681
681
|
function hidersOf(doc) {
|
|
682
682
|
let hiders = known.get(doc);
|
|
683
683
|
if (hiders === void 0) {
|
|
684
|
-
const first = doc.blocks.findIndex(
|
|
685
|
-
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null :
|
|
684
|
+
const first = doc.blocks.findIndex(chunkFK7EBZPX_cjs.isClosedToggle);
|
|
685
|
+
hiders = doc.blocks.map((_, index) => first < 0 || index <= first ? null : chunkFK7EBZPX_cjs.hidingToggle(doc, index + 1));
|
|
686
686
|
known.set(doc, hiders);
|
|
687
687
|
}
|
|
688
688
|
return hiders;
|
|
@@ -691,7 +691,7 @@ var hidingToggleAt = (doc, index) => hidersOf(doc)[index] ?? null;
|
|
|
691
691
|
function isHiddenAt(doc, index, choices) {
|
|
692
692
|
if (choices.size === 0) return hidingToggleAt(doc, index) !== null;
|
|
693
693
|
const closed = (block) => block.type === "TOGGLE" && !shownOpen(block, choices);
|
|
694
|
-
return
|
|
694
|
+
return chunkFK7EBZPX_cjs.hidingToggle(doc, index + 1, closed) !== null;
|
|
695
695
|
}
|
|
696
696
|
var visibleBlockIndexes = (doc) => hidersOf(doc).flatMap((hider, index) => hider === null ? [index] : []);
|
|
697
697
|
function drawnBlockCount(doc, start = 0, end = doc.blocks.length) {
|
|
@@ -713,18 +713,18 @@ function neighbourBlock(doc, from, direction, accept = anyBlock) {
|
|
|
713
713
|
}
|
|
714
714
|
function entryEdge(controller, block, direction) {
|
|
715
715
|
const { doc, schema } = controller.editor.state;
|
|
716
|
-
const edge = direction < 0 ?
|
|
716
|
+
const edge = direction < 0 ? chunkFK7EBZPX_cjs.endOf(doc, schema, block) : chunkFK7EBZPX_cjs.startOf(doc, schema, block);
|
|
717
717
|
if (edge.kind !== "text") return edge;
|
|
718
718
|
const drawn = controller.registry.get(edge.head.block, edge.head.region) !== void 0;
|
|
719
|
-
return drawn && !entersAsNode(controller, block) ? edge :
|
|
719
|
+
return drawn && !entersAsNode(controller, block) ? edge : chunkFK7EBZPX_cjs.nodeSelection(block);
|
|
720
720
|
}
|
|
721
|
-
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ?
|
|
721
|
+
var ownNode = (controller, block, direction) => direction < 0 && entersAsNode(controller, block) ? chunkFK7EBZPX_cjs.nodeSelection(block) : null;
|
|
722
722
|
var canBeEntered = (controller) => (block) => {
|
|
723
723
|
const { schema } = controller.editor.state;
|
|
724
|
-
const region =
|
|
724
|
+
const region = chunkFK7EBZPX_cjs.isTextFlow(schema, block) ? chunkFK7EBZPX_cjs.primaryRegion(schema, block) : null;
|
|
725
725
|
return region === null || controller.registry.get(block.id, region) !== void 0 || entersAsNode(controller, block.id);
|
|
726
726
|
};
|
|
727
|
-
var holdsTextHead = (controller) => (block) =>
|
|
727
|
+
var holdsTextHead = (controller) => (block) => chunkFK7EBZPX_cjs.isTextFlow(controller.editor.state.schema, block) && entryEdge(controller, block.id, 1).kind === "text";
|
|
728
728
|
function neighbourHead(controller, from, direction) {
|
|
729
729
|
const target = neighbourBlock(controller.editor.state.doc, from, direction, holdsTextHead(controller));
|
|
730
730
|
const edge = target && entryEdge(controller, target.id, direction);
|
|
@@ -863,7 +863,7 @@ function createCrossBlockPointer(controller) {
|
|
|
863
863
|
let preventMouseDown = false;
|
|
864
864
|
const scroll = createAutoScroll(root, () => follow(last.x, last.y));
|
|
865
865
|
function select(selection) {
|
|
866
|
-
if (
|
|
866
|
+
if (chunkFK7EBZPX_cjs.sameSelection(selection, controller.editor.state.selection)) return;
|
|
867
867
|
dispatchSelection(controller, selection);
|
|
868
868
|
}
|
|
869
869
|
function startDragging() {
|
|
@@ -879,14 +879,14 @@ function createCrossBlockPointer(controller) {
|
|
|
879
879
|
if (current.anchor === null) return;
|
|
880
880
|
startDragging();
|
|
881
881
|
}
|
|
882
|
-
select(
|
|
882
|
+
select(chunkFK7EBZPX_cjs.textSelection(current.anchor, caretPosAt(controller, target, x, y)));
|
|
883
883
|
}
|
|
884
884
|
function followBlocks(current, x, y) {
|
|
885
885
|
if (!controller.dragging && Math.hypot(x - current.x, y - current.y) < DRAG_DISTANCE) return;
|
|
886
886
|
const block = blockAt(controller, x, y);
|
|
887
887
|
if (block === null) return;
|
|
888
888
|
startDragging();
|
|
889
|
-
select(
|
|
889
|
+
select(chunkFK7EBZPX_cjs.blockRangeSelection(current.start, block));
|
|
890
890
|
}
|
|
891
891
|
function follow(x, y) {
|
|
892
892
|
if (press?.kind === "text") followText(press, x, y);
|
|
@@ -926,10 +926,10 @@ function createCrossBlockPointer(controller) {
|
|
|
926
926
|
}
|
|
927
927
|
function pressWhole(block) {
|
|
928
928
|
if (entryEdge(controller, block, 1).kind !== "node") return;
|
|
929
|
-
const pressed =
|
|
930
|
-
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(
|
|
929
|
+
const pressed = chunkI7X7B3WD_cjs.blockById(controller.editor.state.doc, block);
|
|
930
|
+
if (pressed !== void 0 && !canBeEntered(controller)(pressed)) return select(chunkFK7EBZPX_cjs.blockRangeSelection(block));
|
|
931
931
|
controller.nodeReveal.pressed(block);
|
|
932
|
-
select(
|
|
932
|
+
select(chunkFK7EBZPX_cjs.nodeSelection(block));
|
|
933
933
|
}
|
|
934
934
|
function onPointerDown(event) {
|
|
935
935
|
end();
|
|
@@ -975,7 +975,7 @@ function createCrossBlockPointer(controller) {
|
|
|
975
975
|
// src/view/selection/paint-selection.ts
|
|
976
976
|
var NAME = "quoin-selection";
|
|
977
977
|
function coveredRanges(controller) {
|
|
978
|
-
return
|
|
978
|
+
return chunkFK7EBZPX_cjs.markRanges(controller.editor.state).flatMap(({ block, region, from, to }) => {
|
|
979
979
|
const host = controller.registry.get(block, region);
|
|
980
980
|
const map = host && domMapOf(host);
|
|
981
981
|
if (!host || !map) return [];
|
|
@@ -1046,7 +1046,7 @@ function heldBySink(selection) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
var NO_TEXT = "\xA0";
|
|
1048
1048
|
function selectionText(state) {
|
|
1049
|
-
const text =
|
|
1049
|
+
const text = chunkFK7EBZPX_cjs.markRanges(state).map((range) => chunkI7X7B3WD_cjs.inlinePlainText(chunkFK7EBZPX_cjs.rangeContent(state, range), state.schema)).join("\n");
|
|
1050
1050
|
return text === "" ? NO_TEXT : text;
|
|
1051
1051
|
}
|
|
1052
1052
|
var focusInPlace = (sink) => inPlace(sink, () => sink.focus({ preventScroll: true }));
|
|
@@ -1069,7 +1069,7 @@ function focusSink(controller) {
|
|
|
1069
1069
|
sink.ownerDocument.getSelection()?.selectAllChildren(sink);
|
|
1070
1070
|
}
|
|
1071
1071
|
function selectedBlockName({ doc, schema, selection }, blockLabel) {
|
|
1072
|
-
const block = selection?.kind === "node" ?
|
|
1072
|
+
const block = selection?.kind === "node" ? chunkI7X7B3WD_cjs.blockById(doc, selection.block) : void 0;
|
|
1073
1073
|
return block === void 0 ? null : blockLabel?.(block, schema) ?? "";
|
|
1074
1074
|
}
|
|
1075
1075
|
function clearSink(controller) {
|
|
@@ -1206,7 +1206,7 @@ function createElementSlot(changed) {
|
|
|
1206
1206
|
|
|
1207
1207
|
// src/view/controller/selection-element.ts
|
|
1208
1208
|
function elementFor({ doc }, selection, rendered) {
|
|
1209
|
-
const id =
|
|
1209
|
+
const id = chunkFK7EBZPX_cjs.headBlockId(selection);
|
|
1210
1210
|
const index = id === null ? void 0 : doc.index.get(id);
|
|
1211
1211
|
if (id === null || index === void 0) return void 0;
|
|
1212
1212
|
const hiding = hidingToggleAt(doc, index);
|
|
@@ -1219,7 +1219,7 @@ function selectionElement(state, rendered) {
|
|
|
1219
1219
|
if (doc.blocks.length === 0) return rendered.empty?.() ?? void 0;
|
|
1220
1220
|
const sink = heldBySink(selection) ? rendered.sink?.() : null;
|
|
1221
1221
|
if (sink) return sink;
|
|
1222
|
-
return elementFor(state, selection, rendered) ?? elementFor(state,
|
|
1222
|
+
return elementFor(state, selection, rendered) ?? elementFor(state, chunkFK7EBZPX_cjs.startOf(doc, schema, doc.blocks[0].id), rendered);
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
1225
|
// src/view/controller/tab-stop.ts
|
|
@@ -1273,7 +1273,7 @@ function createDrawnElements(hosts, state) {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
|
|
1275
1275
|
// src/view/controller/engagement.ts
|
|
1276
|
-
var chosenHere = (tr) => tr !== null && tr.selectionSet && !
|
|
1276
|
+
var chosenHere = (tr) => tr !== null && tr.selectionSet && !chunkFK7EBZPX_cjs.foreignOrigins.includes(tr.origin);
|
|
1277
1277
|
function createEngagement(editor) {
|
|
1278
1278
|
let engaged = false;
|
|
1279
1279
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -1311,9 +1311,9 @@ function ownsFocus(controller, doc) {
|
|
|
1311
1311
|
function focusTarget(state, target) {
|
|
1312
1312
|
const { doc, schema, selection } = state;
|
|
1313
1313
|
if (doc.blocks.length === 0) return null;
|
|
1314
|
-
if (target === "end") return
|
|
1315
|
-
if (target === "start" || target === void 0 && selection === null) return
|
|
1316
|
-
return target === void 0 ? selection :
|
|
1314
|
+
if (target === "end") return chunkFK7EBZPX_cjs.endOf(doc, schema, doc.blocks[doc.blocks.length - 1].id);
|
|
1315
|
+
if (target === "start" || target === void 0 && selection === null) return chunkFK7EBZPX_cjs.startOf(doc, schema, doc.blocks[0].id);
|
|
1316
|
+
return target === void 0 ? selection : chunkFK7EBZPX_cjs.textSelection(target);
|
|
1317
1317
|
}
|
|
1318
1318
|
|
|
1319
1319
|
// src/view/controller/host-decorations.ts
|
|
@@ -1329,7 +1329,7 @@ function decorationsByHost(decorations) {
|
|
|
1329
1329
|
return byHost;
|
|
1330
1330
|
}
|
|
1331
1331
|
function sameDecoration(a, b) {
|
|
1332
|
-
if (a.kind !== b.kind || a.block !== b.block || !
|
|
1332
|
+
if (a.kind !== b.kind || a.block !== b.block || !chunkI7X7B3WD_cjs.sameAttrs(a.attrs, b.attrs)) return false;
|
|
1333
1333
|
if (a.kind === "inline" && b.kind === "inline") {
|
|
1334
1334
|
return a.region === b.region && a.from === b.from && a.to === b.to;
|
|
1335
1335
|
}
|
|
@@ -1340,7 +1340,7 @@ function sameDecoration(a, b) {
|
|
|
1340
1340
|
return true;
|
|
1341
1341
|
}
|
|
1342
1342
|
function sameDecorations(a, b) {
|
|
1343
|
-
return a === b ||
|
|
1343
|
+
return a === b || chunkI7X7B3WD_cjs.sameItems(a, b, sameDecoration);
|
|
1344
1344
|
}
|
|
1345
1345
|
var byMode = { highlight: /* @__PURE__ */ new WeakMap(), decorations: /* @__PURE__ */ new WeakMap() };
|
|
1346
1346
|
function hostDecorations(editor, block, region, mode = "highlight") {
|
|
@@ -1356,7 +1356,7 @@ function hostDecorations(editor, block, region, mode = "highlight") {
|
|
|
1356
1356
|
|
|
1357
1357
|
// src/view/controller/region-inline.ts
|
|
1358
1358
|
function regionInline(state, block, region) {
|
|
1359
|
-
const regions =
|
|
1359
|
+
const regions = chunkI7X7B3WD_cjs.blockById(state.doc, block)?.regions;
|
|
1360
1360
|
return regions && Object.hasOwn(regions, region) ? regions[region] : void 0;
|
|
1361
1361
|
}
|
|
1362
1362
|
|
|
@@ -1406,7 +1406,7 @@ function createOutsideChanges(editorHasFocus, movedFrom) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
const from = moved ?? (outside && !settled ? movedFrom(tr.before.selection) : null);
|
|
1408
1408
|
settled ||= outside;
|
|
1409
|
-
moved = from &&
|
|
1409
|
+
moved = from && chunkFK7EBZPX_cjs.mapSelection(from, (pos, assoc) => tr.mapPos(pos, assoc), tr.before.doc);
|
|
1410
1410
|
},
|
|
1411
1411
|
takeFocused() {
|
|
1412
1412
|
const value = focused;
|
|
@@ -1499,7 +1499,7 @@ function handleCopy(controller, event, cut) {
|
|
|
1499
1499
|
clipboardData.setData("text/plain", copied.text);
|
|
1500
1500
|
clipboardData.setData("text/html", wrapSliceHTML(copied.html, copied.json));
|
|
1501
1501
|
clipboardData.setData(QUOIN_SLICE_TYPE, copied.json);
|
|
1502
|
-
if (cut) controller.run(
|
|
1502
|
+
if (cut) controller.run(chunkFK7EBZPX_cjs.deleteSelection);
|
|
1503
1503
|
}
|
|
1504
1504
|
function handlePaste(controller, event) {
|
|
1505
1505
|
if (!event.clipboardData) return;
|
|
@@ -1531,7 +1531,7 @@ function handleDrop(controller, event) {
|
|
|
1531
1531
|
return;
|
|
1532
1532
|
}
|
|
1533
1533
|
const pos = dropPos(controller, event.clientX, event.clientY);
|
|
1534
|
-
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(
|
|
1534
|
+
if (pos) controller.dispatch(controller.editor.createTransaction().setSelection(chunkFK7EBZPX_cjs.textSelection(pos)).setOrigin("drop"));
|
|
1535
1535
|
pasteTransfer(controller, dataTransfer);
|
|
1536
1536
|
}
|
|
1537
1537
|
function handleDragOver(event) {
|
|
@@ -1661,29 +1661,29 @@ function createSinkComposition(controller, settled = () => {
|
|
|
1661
1661
|
var LINE_BREAK = "\n";
|
|
1662
1662
|
var transposeChars = (state, dispatch) => {
|
|
1663
1663
|
const { selection } = state;
|
|
1664
|
-
if (selection?.kind !== "text" || !
|
|
1664
|
+
if (selection?.kind !== "text" || !chunkFK7EBZPX_cjs.isCollapsed(selection)) return false;
|
|
1665
1665
|
const { head } = selection;
|
|
1666
|
-
const inline =
|
|
1666
|
+
const inline = chunkI7X7B3WD_cjs.blockById(state.doc, head.block)?.regions[head.region];
|
|
1667
1667
|
if (inline === void 0) return false;
|
|
1668
|
-
const value =
|
|
1668
|
+
const value = chunkI7X7B3WD_cjs.inlineText(inline);
|
|
1669
1669
|
const atLineEnd = head.offset === value.length || value[head.offset] === LINE_BREAK;
|
|
1670
|
-
const end = atLineEnd ? head.offset :
|
|
1671
|
-
const middle =
|
|
1672
|
-
const start =
|
|
1670
|
+
const end = atLineEnd ? head.offset : chunkFK7EBZPX_cjs.nextGraphemeOffset(value, head.offset);
|
|
1671
|
+
const middle = chunkFK7EBZPX_cjs.prevGraphemeOffset(value, end);
|
|
1672
|
+
const start = chunkFK7EBZPX_cjs.prevGraphemeOffset(value, middle);
|
|
1673
1673
|
if (start === middle || value.slice(start, end).includes(LINE_BREAK)) return false;
|
|
1674
|
-
const swapped = [...
|
|
1675
|
-
const tr = new
|
|
1676
|
-
tr.step(
|
|
1677
|
-
dispatch?.(tr.setSelection(
|
|
1674
|
+
const swapped = [...chunkI7X7B3WD_cjs.sliceInline(inline, middle, end), ...chunkI7X7B3WD_cjs.sliceInline(inline, start, middle)];
|
|
1675
|
+
const tr = new chunkFK7EBZPX_cjs.Transaction(state).setOrigin("input");
|
|
1676
|
+
tr.step(chunkFK7EBZPX_cjs.replaceInlineStep(head.block, head.region, start, end, swapped));
|
|
1677
|
+
dispatch?.(tr.setSelection(chunkFK7EBZPX_cjs.textSelection({ ...head, offset: end })));
|
|
1678
1678
|
return true;
|
|
1679
1679
|
};
|
|
1680
1680
|
|
|
1681
1681
|
// src/view/input/replace-range.ts
|
|
1682
1682
|
function replaceRange(editor, range, text, withRules) {
|
|
1683
1683
|
const dispatch = (tr) => editor.dispatch(tr);
|
|
1684
|
-
dispatch(editor.createTransaction().setSelection(
|
|
1685
|
-
if (text === "") return
|
|
1686
|
-
return withRules ? editor.insertText(text) :
|
|
1684
|
+
dispatch(editor.createTransaction().setSelection(chunkFK7EBZPX_cjs.textSelection(range.from, range.to)).setOrigin("input"));
|
|
1685
|
+
if (text === "") return chunkFK7EBZPX_cjs.deleteSelection(editor.state, (tr) => dispatch(tr.setOrigin("input")));
|
|
1686
|
+
return withRules ? editor.insertText(text) : chunkFK7EBZPX_cjs.insertText(text, { origin: "input" })(editor.state, dispatch);
|
|
1687
1687
|
}
|
|
1688
1688
|
|
|
1689
1689
|
// src/view/input/target-range.ts
|
|
@@ -1694,13 +1694,13 @@ function targetRangeToModel(controller, event) {
|
|
|
1694
1694
|
const to = domToPos(controller.registry, range.endContainer, range.endOffset);
|
|
1695
1695
|
return from && to && { from, to };
|
|
1696
1696
|
}
|
|
1697
|
-
var isEmpty = ({ from, to }) =>
|
|
1697
|
+
var isEmpty = ({ from, to }) => chunkFK7EBZPX_cjs.sameSelection(chunkFK7EBZPX_cjs.textSelection(from), chunkFK7EBZPX_cjs.textSelection(to));
|
|
1698
1698
|
function targetBeyondSelection(controller, event) {
|
|
1699
1699
|
const range = targetRangeToModel(controller, event);
|
|
1700
1700
|
if (range === null || isEmpty(range)) return null;
|
|
1701
1701
|
const { doc, selection } = controller.editor.state;
|
|
1702
|
-
const selected =
|
|
1703
|
-
const same = selected !== null &&
|
|
1702
|
+
const selected = chunkFK7EBZPX_cjs.selectionRange(doc, selection);
|
|
1703
|
+
const same = selected !== null && chunkFK7EBZPX_cjs.sameSelection(chunkFK7EBZPX_cjs.textSelection(selected.from, selected.to), chunkFK7EBZPX_cjs.textSelection(range.from, range.to));
|
|
1704
1704
|
return same ? null : range;
|
|
1705
1705
|
}
|
|
1706
1706
|
|
|
@@ -1722,34 +1722,34 @@ function insertTypedText(controller, event) {
|
|
|
1722
1722
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1723
1723
|
}
|
|
1724
1724
|
function deleteContentBackward(controller, event) {
|
|
1725
|
-
if (!controller.run(
|
|
1725
|
+
if (!controller.run(chunkFK7EBZPX_cjs.undoInputRule)) targetOr(chunkFK7EBZPX_cjs.deleteBackward)(controller, event);
|
|
1726
1726
|
}
|
|
1727
1727
|
function insertReplacementText(controller, event) {
|
|
1728
1728
|
const text = event.dataTransfer?.getData("text/plain") || event.data;
|
|
1729
1729
|
if (!text) return;
|
|
1730
1730
|
const range = targetRangeToModel(controller, event);
|
|
1731
|
-
if (range === null) controller.run(
|
|
1731
|
+
if (range === null) controller.run(chunkFK7EBZPX_cjs.insertText(text, { origin: "input" }));
|
|
1732
1732
|
else controller.edit(() => replaceRange(controller.editor, range, text, false));
|
|
1733
1733
|
}
|
|
1734
1734
|
var actions = {
|
|
1735
1735
|
insertText: insertTypedText,
|
|
1736
1736
|
insertReplacementText,
|
|
1737
1737
|
insertParagraph: (controller) => void controller.edit(() => controller.editor.handleKey(ENTER)),
|
|
1738
|
-
insertLineBreak: run(
|
|
1738
|
+
insertLineBreak: run(chunkFK7EBZPX_cjs.insertHardBreak),
|
|
1739
1739
|
deleteContentBackward,
|
|
1740
|
-
deleteContentForward: targetOr(
|
|
1741
|
-
deleteWordBackward: targetOr(
|
|
1742
|
-
deleteWordForward: targetOr(
|
|
1743
|
-
deleteSoftLineBackward: targetOr(
|
|
1744
|
-
deleteHardLineBackward: targetOr(
|
|
1745
|
-
deleteSoftLineForward: targetOr(
|
|
1746
|
-
deleteHardLineForward: targetOr(
|
|
1747
|
-
formatBold: run(
|
|
1748
|
-
formatItalic: run(
|
|
1749
|
-
formatUnderline: run(
|
|
1750
|
-
formatStrikeThrough: run(
|
|
1751
|
-
historyUndo: run(
|
|
1752
|
-
historyRedo: run(
|
|
1740
|
+
deleteContentForward: targetOr(chunkFK7EBZPX_cjs.deleteForward),
|
|
1741
|
+
deleteWordBackward: targetOr(chunkFK7EBZPX_cjs.deleteWordBackward),
|
|
1742
|
+
deleteWordForward: targetOr(chunkFK7EBZPX_cjs.deleteWordForward),
|
|
1743
|
+
deleteSoftLineBackward: targetOr(chunkFK7EBZPX_cjs.deleteToLineStart),
|
|
1744
|
+
deleteHardLineBackward: targetOr(chunkFK7EBZPX_cjs.deleteToLineStart),
|
|
1745
|
+
deleteSoftLineForward: targetOr(chunkFK7EBZPX_cjs.deleteToLineEnd),
|
|
1746
|
+
deleteHardLineForward: targetOr(chunkFK7EBZPX_cjs.deleteToLineEnd),
|
|
1747
|
+
formatBold: run(chunkFK7EBZPX_cjs.toggleMark("bold")),
|
|
1748
|
+
formatItalic: run(chunkFK7EBZPX_cjs.toggleMark("italic")),
|
|
1749
|
+
formatUnderline: run(chunkFK7EBZPX_cjs.toggleMark("underline")),
|
|
1750
|
+
formatStrikeThrough: run(chunkFK7EBZPX_cjs.toggleMark("strike")),
|
|
1751
|
+
historyUndo: run(chunkFK7EBZPX_cjs.undo),
|
|
1752
|
+
historyRedo: run(chunkFK7EBZPX_cjs.redo),
|
|
1753
1753
|
insertTranspose: run(transposeChars),
|
|
1754
1754
|
insertFromPaste: leaveToHandlers,
|
|
1755
1755
|
insertFromDrop: leaveToHandlers,
|
|
@@ -1850,7 +1850,7 @@ function snapshotComposition(controller, block, region) {
|
|
|
1850
1850
|
const element = controller.registry.get(block, region);
|
|
1851
1851
|
const inline = regionInline(editor.state, block, region);
|
|
1852
1852
|
if (element === void 0 || inline === void 0) return null;
|
|
1853
|
-
const text =
|
|
1853
|
+
const text = chunkI7X7B3WD_cjs.inlineText(inline);
|
|
1854
1854
|
const end = composedEnd(controller, block, region);
|
|
1855
1855
|
const since = [];
|
|
1856
1856
|
const release = editor.subscribe((_, tr) => void (tr && since.push(tr)));
|
|
@@ -1964,7 +1964,7 @@ function reconcileHost(controller, block, region, caretHint) {
|
|
|
1964
1964
|
const element = controller.registry.get(block, region);
|
|
1965
1965
|
const inline = regionInline(controller.editor.state, block, region);
|
|
1966
1966
|
if (element === void 0 || inline === void 0) return false;
|
|
1967
|
-
const before =
|
|
1967
|
+
const before = chunkI7X7B3WD_cjs.inlineText(inline);
|
|
1968
1968
|
const after = readDomText(element);
|
|
1969
1969
|
const edit = before === after ? null : textDiff(before, after, domCaretOffset(element));
|
|
1970
1970
|
if (edit === null) return false;
|
|
@@ -2030,33 +2030,33 @@ function createDomInputFallback(controller) {
|
|
|
2030
2030
|
|
|
2031
2031
|
// src/view/navigation/cross-moves.ts
|
|
2032
2032
|
function moveHead(controller, { anchor }, head) {
|
|
2033
|
-
dispatchSelection(controller,
|
|
2033
|
+
dispatchSelection(controller, chunkFK7EBZPX_cjs.textSelection(anchor, head));
|
|
2034
2034
|
return true;
|
|
2035
2035
|
}
|
|
2036
2036
|
function blockOf(controller, { block }) {
|
|
2037
2037
|
const { doc } = controller.editor.state;
|
|
2038
|
-
return doc.blocks[
|
|
2038
|
+
return doc.blocks[chunkI7X7B3WD_cjs.requireBlockIndex(doc, block)];
|
|
2039
2039
|
}
|
|
2040
2040
|
function collapseCross(controller, selection, direction) {
|
|
2041
|
-
const { from, to } =
|
|
2042
|
-
dispatchSelection(controller,
|
|
2041
|
+
const { from, to } = chunkFK7EBZPX_cjs.selectionRange(controller.editor.state.doc, selection);
|
|
2042
|
+
dispatchSelection(controller, chunkFK7EBZPX_cjs.textSelection(direction < 0 ? from : to));
|
|
2043
2043
|
return true;
|
|
2044
2044
|
}
|
|
2045
2045
|
function crossHeadVertically(controller, selection, direction) {
|
|
2046
2046
|
const { head } = selection;
|
|
2047
2047
|
const edge = neighbourHead(controller, head.block, direction);
|
|
2048
2048
|
if (edge !== null) {
|
|
2049
|
-
const end2 =
|
|
2049
|
+
const end2 = chunkFK7EBZPX_cjs.regionLength(blockOf(controller, edge), edge.region);
|
|
2050
2050
|
return moveHead(controller, selection, { ...edge, offset: Math.min(head.offset, end2) });
|
|
2051
2051
|
}
|
|
2052
|
-
const end =
|
|
2052
|
+
const end = chunkFK7EBZPX_cjs.regionLength(blockOf(controller, head), head.region);
|
|
2053
2053
|
return moveHead(controller, selection, { ...head, offset: direction < 0 ? 0 : end });
|
|
2054
2054
|
}
|
|
2055
2055
|
function crossHeadHorizontally(controller, selection, direction) {
|
|
2056
2056
|
const { head } = selection;
|
|
2057
|
-
const text =
|
|
2057
|
+
const text = chunkI7X7B3WD_cjs.inlineText(blockOf(controller, head).regions[head.region] ?? []);
|
|
2058
2058
|
if (direction < 0 ? head.offset > 0 : head.offset < text.length) {
|
|
2059
|
-
const offset = direction < 0 ?
|
|
2059
|
+
const offset = direction < 0 ? chunkFK7EBZPX_cjs.prevGraphemeOffset(text, head.offset) : chunkFK7EBZPX_cjs.nextGraphemeOffset(text, head.offset);
|
|
2060
2060
|
return moveHead(controller, selection, { ...head, offset });
|
|
2061
2061
|
}
|
|
2062
2062
|
const edge = neighbourHead(controller, head.block, direction);
|
|
@@ -2075,9 +2075,9 @@ function moveHorizontally(controller, direction, extend) {
|
|
|
2075
2075
|
const move = extend ? crossHeadHorizontally : collapseCross;
|
|
2076
2076
|
return move(controller, selection, direction);
|
|
2077
2077
|
}
|
|
2078
|
-
if (!extend && !
|
|
2078
|
+
if (!extend && !chunkFK7EBZPX_cjs.isCollapsed(selection)) return false;
|
|
2079
2079
|
const { head } = selection;
|
|
2080
|
-
const length =
|
|
2080
|
+
const length = chunkFK7EBZPX_cjs.regionLength(doc.blocks[chunkI7X7B3WD_cjs.requireBlockIndex(doc, head.block)], head.region);
|
|
2081
2081
|
if (direction < 0 ? head.offset > 0 : head.offset < length) return false;
|
|
2082
2082
|
const own2 = extend ? null : ownNode(controller, head.block, direction);
|
|
2083
2083
|
if (own2 !== null) {
|
|
@@ -2170,7 +2170,7 @@ function caretAtGoal(controller, host, at, y) {
|
|
|
2170
2170
|
var keepOnLine = ({ registry }, pos, y) => stayOnLine(pos, y, glyphsAround(registry, pos));
|
|
2171
2171
|
function landAtGoal(controller, block, direction) {
|
|
2172
2172
|
const { schema } = controller.editor.state;
|
|
2173
|
-
const region =
|
|
2173
|
+
const region = chunkFK7EBZPX_cjs.isTextFlow(schema, block) ? chunkFK7EBZPX_cjs.primaryRegion(schema, block) : null;
|
|
2174
2174
|
const host = region === null ? void 0 : controller.registry.get(block.id, region);
|
|
2175
2175
|
if (!host || region === null || controller.goalX === null) return null;
|
|
2176
2176
|
const line = lineInView(host, direction < 0);
|
|
@@ -2221,7 +2221,7 @@ function moveText(controller, selection, direction, extend) {
|
|
|
2221
2221
|
function extendBlocks(controller, { anchor, head }, direction) {
|
|
2222
2222
|
const next = neighbourBlock(controller.editor.state.doc, head, direction);
|
|
2223
2223
|
if (next === null) return false;
|
|
2224
|
-
dispatchSelection(controller,
|
|
2224
|
+
dispatchSelection(controller, chunkFK7EBZPX_cjs.blockRangeSelection(anchor, next.id));
|
|
2225
2225
|
return true;
|
|
2226
2226
|
}
|
|
2227
2227
|
function moveVertically(controller, direction, extend) {
|
|
@@ -2237,8 +2237,8 @@ function moveVertically(controller, direction, extend) {
|
|
|
2237
2237
|
// src/view/input/flip-block.ts
|
|
2238
2238
|
var isTask = ({ type, attrs }) => type === "MARKDOWN" && attrs.kind === "task";
|
|
2239
2239
|
function flipCommand(block) {
|
|
2240
|
-
if (isTask(block)) return
|
|
2241
|
-
return block.type === "TOGGLE" ?
|
|
2240
|
+
if (isTask(block)) return chunkFK7EBZPX_cjs.toggleTask;
|
|
2241
|
+
return block.type === "TOGGLE" ? chunkFK7EBZPX_cjs.setAttrs({ open: block.attrs.open !== true }) : null;
|
|
2242
2242
|
}
|
|
2243
2243
|
var toggleState = (open) => open ? "expanded" : "collapsed";
|
|
2244
2244
|
function stateName(block) {
|
|
@@ -2247,7 +2247,7 @@ function stateName(block) {
|
|
|
2247
2247
|
}
|
|
2248
2248
|
function blockHoldingCaret({ doc, selection }) {
|
|
2249
2249
|
if (selection?.kind !== "text" || selection.anchor.block !== selection.head.block) return null;
|
|
2250
|
-
return
|
|
2250
|
+
return chunkI7X7B3WD_cjs.blockById(doc, selection.head.block) ?? null;
|
|
2251
2251
|
}
|
|
2252
2252
|
function flipForReader(controller, block) {
|
|
2253
2253
|
if (block?.type !== "TOGGLE") return false;
|
|
@@ -2262,7 +2262,7 @@ function flipSelectedBlock(controller) {
|
|
|
2262
2262
|
if (controller.readOnly) return flipForReader(controller, block);
|
|
2263
2263
|
const command = block && flipCommand(block);
|
|
2264
2264
|
if (!block || !command || !controller.run(command)) return false;
|
|
2265
|
-
const after =
|
|
2265
|
+
const after = chunkI7X7B3WD_cjs.blockById(editor.state.doc, block.id);
|
|
2266
2266
|
if (after) controller.announce(stateName(after));
|
|
2267
2267
|
return true;
|
|
2268
2268
|
}
|
|
@@ -2336,7 +2336,7 @@ function attachInput(controller, root) {
|
|
|
2336
2336
|
const { editor } = controller;
|
|
2337
2337
|
let { selection } = editor.state;
|
|
2338
2338
|
const stop = editor.subscribe((_, tr) => {
|
|
2339
|
-
if (tr && selection) selection =
|
|
2339
|
+
if (tr && selection) selection = chunkFK7EBZPX_cjs.mapSelection(selection, (pos, assoc) => tr.mapPos(pos, assoc));
|
|
2340
2340
|
});
|
|
2341
2341
|
fallback.flush();
|
|
2342
2342
|
stop();
|
|
@@ -2494,7 +2494,7 @@ function movedSelection(controller, doc, model) {
|
|
|
2494
2494
|
if (controller.composingKey !== null || controller.dragging || !doc || !ownsFocus(controller, doc)) return null;
|
|
2495
2495
|
const selection = readSelection(controller.registry, doc.getSelection(), (node) => controller.blockAt(node));
|
|
2496
2496
|
const sided = selection?.kind === "text" && model?.kind === "text" ? { ...selection, assoc: model.assoc } : selection;
|
|
2497
|
-
return sided === null ||
|
|
2497
|
+
return sided === null || chunkFK7EBZPX_cjs.sameSelection(sided, model) ? null : selection;
|
|
2498
2498
|
}
|
|
2499
2499
|
function writeModelSelection(controller, doc, moved, local) {
|
|
2500
2500
|
const domSelection = doc?.getSelection();
|
|
@@ -2554,7 +2554,7 @@ var ViewController = class {
|
|
|
2554
2554
|
this.engagement = createEngagement(options.editor);
|
|
2555
2555
|
this.#flush = options.flush ?? runNow;
|
|
2556
2556
|
this.onFiles = options.onFiles;
|
|
2557
|
-
this.isMac = options.isMac ??
|
|
2557
|
+
this.isMac = options.isMac ?? chunkFK7EBZPX_cjs.detectMac();
|
|
2558
2558
|
const decorationsOf = (block, region) => this.decorationsFor(block, region);
|
|
2559
2559
|
const drain = (element) => this.#binding?.input.drain(element);
|
|
2560
2560
|
this.#hosts = createHostRenderer(options.editor, options.render, decorationsOf, drain);
|
|
@@ -2707,7 +2707,7 @@ var ViewController = class {
|
|
|
2707
2707
|
focus(target) {
|
|
2708
2708
|
const { editor } = this;
|
|
2709
2709
|
const selection = focusTarget(editor.state, target);
|
|
2710
|
-
if (selection !== null && !
|
|
2710
|
+
if (selection !== null && !chunkFK7EBZPX_cjs.sameSelection(selection, editor.state.selection)) dispatchSelection(this, selection);
|
|
2711
2711
|
this.#takeFocus();
|
|
2712
2712
|
this.syncSelectionToDom();
|
|
2713
2713
|
}
|
|
@@ -2755,7 +2755,7 @@ function useQuoinEditor(options) {
|
|
|
2755
2755
|
const { blocks, readOnly = false } = options;
|
|
2756
2756
|
const callbacks = react.useRef(options);
|
|
2757
2757
|
const [controller] = react.useState(() => {
|
|
2758
|
-
const editor =
|
|
2758
|
+
const editor = chunkFK7EBZPX_cjs.createEditor({
|
|
2759
2759
|
blocks,
|
|
2760
2760
|
extensions: options.extensions,
|
|
2761
2761
|
onChange: (next) => callbacks.current.onChange(next),
|
|
@@ -2818,11 +2818,11 @@ function SelectionSink({ label = "Selected content", blockLabel }) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
);
|
|
2820
2820
|
}
|
|
2821
|
-
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${
|
|
2821
|
+
var headingPlaceholder = (_state, { type, attrs }) => type === "MARKDOWN" && attrs.kind === "heading" ? `Heading ${chunkI7X7B3WD_cjs.headingLevel(attrs.level)}` : void 0;
|
|
2822
2822
|
var BlockPlaceholderContext = react.createContext(headingPlaceholder);
|
|
2823
2823
|
function regionPlaceholder(state, blockId, region, placeholderOf) {
|
|
2824
|
-
const block =
|
|
2825
|
-
return block !== void 0 &&
|
|
2824
|
+
const block = chunkI7X7B3WD_cjs.blockById(state.doc, blockId);
|
|
2825
|
+
return block !== void 0 && chunkFK7EBZPX_cjs.primaryRegion(state.schema, block) === region ? placeholderOf(state, block) : void 0;
|
|
2826
2826
|
}
|
|
2827
2827
|
var samePainted = (a, b) => a.inline === b.inline && a.placeholder === b.placeholder && sameDecorations(a.decorations, b.decorations);
|
|
2828
2828
|
function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
@@ -2833,7 +2833,7 @@ function EditableRegion({ block, region, label, id, placeholder, className }) {
|
|
|
2833
2833
|
const select = react.useCallback(
|
|
2834
2834
|
(state) => {
|
|
2835
2835
|
const inline2 = regionInline(state, block, region);
|
|
2836
|
-
const empty = inline2 === void 0 ||
|
|
2836
|
+
const empty = inline2 === void 0 || chunkI7X7B3WD_cjs.inlineLength(inline2) === 0;
|
|
2837
2837
|
return {
|
|
2838
2838
|
inline: inline2,
|
|
2839
2839
|
decorations: controller.decorationsFor(block, region),
|
|
@@ -2878,7 +2878,7 @@ var CalloutBlock = ({ block }) => {
|
|
|
2878
2878
|
// src/view/react/block-command.ts
|
|
2879
2879
|
function onBlock(id, command) {
|
|
2880
2880
|
return (state, dispatch) => {
|
|
2881
|
-
const { ok, tr } =
|
|
2881
|
+
const { ok, tr } = chunkFK7EBZPX_cjs.runCommands(state, [chunkFK7EBZPX_cjs.setSelection(chunkFK7EBZPX_cjs.blockRangeSelection(id)), command]);
|
|
2882
2882
|
if (!ok || tr === null) return false;
|
|
2883
2883
|
dispatch?.(tr.setSelection(state.selection));
|
|
2884
2884
|
return true;
|
|
@@ -2898,7 +2898,7 @@ function TaskCheckbox({ block, controller, label, labelledBy }) {
|
|
|
2898
2898
|
role: "checkbox",
|
|
2899
2899
|
"aria-checked": checked,
|
|
2900
2900
|
"aria-readonly": readOnly ? "true" : void 0,
|
|
2901
|
-
"aria-label":
|
|
2901
|
+
"aria-label": chunkI7X7B3WD_cjs.firstNamed(label, "Task"),
|
|
2902
2902
|
"aria-labelledby": labelledBy,
|
|
2903
2903
|
className: "quoin-task-box",
|
|
2904
2904
|
contentEditable: false,
|
|
@@ -2929,7 +2929,7 @@ function numberDoc(doc) {
|
|
|
2929
2929
|
numbers[index] = run2.next++;
|
|
2930
2930
|
return;
|
|
2931
2931
|
}
|
|
2932
|
-
const start =
|
|
2932
|
+
const start = chunkI7X7B3WD_cjs.orderedStart(block.attrs.start);
|
|
2933
2933
|
numbers[index] = start;
|
|
2934
2934
|
runs.push({ indent: block.indent, next: start + 1 });
|
|
2935
2935
|
});
|
|
@@ -2967,7 +2967,7 @@ var MarkdownBlock = (props) => {
|
|
|
2967
2967
|
const { block } = props;
|
|
2968
2968
|
switch (block.attrs.kind) {
|
|
2969
2969
|
case "heading": {
|
|
2970
|
-
const level =
|
|
2970
|
+
const level = chunkI7X7B3WD_cjs.headingLevel(block.attrs.level);
|
|
2971
2971
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: "quoin-heading", children: /* @__PURE__ */ jsxRuntime.jsx(TextRegion, { block, label: `Heading ${level}` }) });
|
|
2972
2972
|
}
|
|
2973
2973
|
case "bullet":
|
|
@@ -3081,7 +3081,7 @@ function covers(state, id, index) {
|
|
|
3081
3081
|
if (selection === null) return false;
|
|
3082
3082
|
if (selection.kind === "node") return selection.block === id;
|
|
3083
3083
|
if (selection.kind === "blocks") return within(state, index, [selection.anchor, selection.head]);
|
|
3084
|
-
if (!isCrossSelection(selection) ||
|
|
3084
|
+
if (!isCrossSelection(selection) || chunkFK7EBZPX_cjs.isTextFlow(schema, doc.blocks[index])) return false;
|
|
3085
3085
|
return within(state, index, [selection.anchor.block, selection.head.block]);
|
|
3086
3086
|
}
|
|
3087
3087
|
function blockStatus(state, id, choices = NO_CHOICES) {
|
|
@@ -3131,11 +3131,11 @@ var BlockShell = react.memo(function BlockShell2({ block, renderers }) {
|
|
|
3131
3131
|
"data-quoin-block": "",
|
|
3132
3132
|
"data-block-id": block.id,
|
|
3133
3133
|
"data-type": block.type,
|
|
3134
|
-
"data-kind":
|
|
3134
|
+
"data-kind": chunkI7X7B3WD_cjs.optionalString(kind),
|
|
3135
3135
|
"data-indent": block.indent,
|
|
3136
|
-
"data-color":
|
|
3137
|
-
"data-bg":
|
|
3138
|
-
"data-align":
|
|
3136
|
+
"data-color": chunkI7X7B3WD_cjs.paletteOrUndefined(color),
|
|
3137
|
+
"data-bg": chunkI7X7B3WD_cjs.paletteOrUndefined(background),
|
|
3138
|
+
"data-align": chunkI7X7B3WD_cjs.alignOrUndefined(align),
|
|
3139
3139
|
style: { "--quoin-indent": block.indent },
|
|
3140
3140
|
tabIndex: -1,
|
|
3141
3141
|
"data-selected": status === "selected" && engaged ? "true" : void 0,
|