quoin-editor 2.0.3 → 2.0.5
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 +11 -11
- package/dist/ai.cjs +34 -34
- package/dist/ai.js +3 -3
- package/dist/catalogue.cjs +21 -21
- package/dist/catalogue.js +12 -12
- package/dist/{chunk-BNTRGV4A.js → chunk-2BPXVQBP.js} +3 -3
- package/dist/{chunk-BNTRGV4A.js.map → chunk-2BPXVQBP.js.map} +1 -1
- package/dist/{chunk-MGN332NY.cjs → chunk-2QKFRKOP.cjs} +1 -1
- package/dist/{chunk-3B5VEXVQ.cjs → chunk-3HW3WRYC.cjs} +2 -2
- package/dist/{chunk-5URH2Y2L.cjs → chunk-3INFNIGN.cjs} +19 -19
- package/dist/{chunk-WMM56LIB.js → chunk-4G645EYO.js} +3 -3
- package/dist/{chunk-WMM56LIB.js.map → chunk-4G645EYO.js.map} +1 -1
- package/dist/{chunk-LCGOFL7S.js → chunk-556PFYES.js} +4 -4
- package/dist/{chunk-LCGOFL7S.js.map → chunk-556PFYES.js.map} +1 -1
- package/dist/{chunk-BCCFJINI.cjs → chunk-7J63427U.cjs} +64 -64
- package/dist/{chunk-YHAVXOAA.js → chunk-A2IQHMIH.js} +4 -4
- package/dist/{chunk-YHAVXOAA.js.map → chunk-A2IQHMIH.js.map} +1 -1
- package/dist/{chunk-VQDQBMQY.js → chunk-AJT54OMZ.js} +4 -4
- package/dist/{chunk-VQDQBMQY.js.map → chunk-AJT54OMZ.js.map} +1 -1
- package/dist/{chunk-SQHEZ3JY.cjs → chunk-BE2YHZXA.cjs} +2 -2
- package/dist/{chunk-DZ5XR4O6.cjs → chunk-EBSDPHPS.cjs} +105 -105
- package/dist/{chunk-MDIXI7DM.js → chunk-EIWPJWY3.js} +3 -3
- package/dist/{chunk-MDIXI7DM.js.map → chunk-EIWPJWY3.js.map} +1 -1
- package/dist/{chunk-C4SRLMQJ.js → chunk-F2ZK6Z52.js} +3 -3
- package/dist/{chunk-C4SRLMQJ.js.map → chunk-F2ZK6Z52.js.map} +1 -1
- package/dist/{chunk-FGVTDIHT.js → chunk-G6NBQYMM.js} +4 -4
- package/dist/chunk-G6NBQYMM.js.map +1 -0
- package/dist/{chunk-H3TRVI44.cjs → chunk-JGEDJYIV.cjs} +50 -50
- package/dist/{chunk-55MN4QZU.cjs → chunk-JZF6UQH5.cjs} +4 -4
- package/dist/{chunk-UWCU6PJY.cjs → chunk-KHRVCTQQ.cjs} +30 -30
- package/dist/{chunk-NLRSAOCK.js → chunk-LU3T3JB4.js} +5 -5
- package/dist/{chunk-NLRSAOCK.js.map → chunk-LU3T3JB4.js.map} +1 -1
- package/dist/{chunk-NAMZA4NW.cjs → chunk-N7BSFDDM.cjs} +14 -14
- package/dist/{chunk-YWYTLNAO.js → chunk-NHNW5DK3.js} +4 -4
- package/dist/{chunk-YWYTLNAO.js.map → chunk-NHNW5DK3.js.map} +1 -1
- package/dist/{chunk-4EJJ4ZNC.cjs → chunk-NUQ64S5B.cjs} +18 -18
- package/dist/{chunk-QVWNUUMJ.js → chunk-QLVX7MPS.js} +3 -3
- package/dist/{chunk-QVWNUUMJ.js.map → chunk-QLVX7MPS.js.map} +1 -1
- package/dist/{chunk-77THE3KY.js → chunk-W376L2GM.js} +5 -5
- package/dist/{chunk-77THE3KY.js.map → chunk-W376L2GM.js.map} +1 -1
- package/dist/{chunk-OMUXPNCX.cjs → chunk-WDBFGX3U.cjs} +26 -26
- package/dist/{chunk-RNYETN6X.js → chunk-XE3IYW5B.js} +4 -4
- package/dist/{chunk-RNYETN6X.js.map → chunk-XE3IYW5B.js.map} +1 -1
- package/dist/{chunk-SDFJZNYB.cjs → chunk-YYW33WUL.cjs} +3 -3
- package/dist/comments.cjs +30 -30
- package/dist/comments.js +3 -3
- package/dist/diagram.cjs +6 -6
- package/dist/diagram.js +3 -3
- package/dist/embed.cjs +5 -5
- package/dist/embed.js +3 -3
- package/dist/emoji.cjs +6 -6
- package/dist/emoji.js +3 -3
- package/dist/find.cjs +7 -7
- package/dist/find.js +3 -3
- package/dist/headless.cjs +11 -11
- package/dist/headless.js +1 -1
- package/dist/highlight.cjs +3 -3
- package/dist/highlight.js +2 -2
- package/dist/index.cjs +23 -23
- package/dist/index.js +2 -2
- package/dist/math.cjs +6 -6
- package/dist/math.js +4 -4
- package/dist/mention.cjs +6 -6
- package/dist/mention.js +4 -4
- package/dist/presence.cjs +12 -12
- package/dist/presence.js +3 -3
- package/dist/source.cjs +2 -2
- package/dist/source.js +2 -2
- package/dist/stats.cjs +6 -6
- package/dist/stats.js +3 -3
- package/dist/table.cjs +22 -22
- package/dist/table.js +3 -3
- package/dist/toc.cjs +6 -6
- package/dist/toc.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-FGVTDIHT.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2QKFRKOP_cjs = require('./chunk-2QKFRKOP.cjs');
|
|
4
4
|
var chunkZWTIRGY5_cjs = require('./chunk-ZWTIRGY5.cjs');
|
|
5
5
|
var chunkA6PGQVTR_cjs = require('./chunk-A6PGQVTR.cjs');
|
|
6
6
|
var chunkFK7EBZPX_cjs = require('./chunk-FK7EBZPX.cjs');
|
|
@@ -825,7 +825,7 @@ function selectNode(controller, blockId) {
|
|
|
825
825
|
const { editor } = controller;
|
|
826
826
|
const { selection } = editor.state;
|
|
827
827
|
if (selection?.kind === "node" && selection.block === blockId) return;
|
|
828
|
-
|
|
828
|
+
chunk2QKFRKOP_cjs.dispatchSelection(controller, chunkFK7EBZPX_cjs.nodeSelection(blockId));
|
|
829
829
|
}
|
|
830
830
|
function focusNode(controller, blockId) {
|
|
831
831
|
selectNode(controller, blockId);
|
|
@@ -1287,7 +1287,7 @@ function MenuIcon({ icon: Icon2 }) {
|
|
|
1287
1287
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "flex shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4" }) });
|
|
1288
1288
|
}
|
|
1289
1289
|
var sharedTone = (blocks) => {
|
|
1290
|
-
const tones = new Set(blocks.map((block) =>
|
|
1290
|
+
const tones = new Set(blocks.map((block) => chunk2QKFRKOP_cjs.calloutTone(block.attrs.tone)));
|
|
1291
1291
|
return tones.size === 1 ? [...tones][0] : "";
|
|
1292
1292
|
};
|
|
1293
1293
|
function CalloutMenus({ kit, controller, blocks }) {
|
|
@@ -1300,7 +1300,7 @@ function CalloutMenus({ kit, controller, blocks }) {
|
|
|
1300
1300
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: Droplet }),
|
|
1301
1301
|
labels.tone
|
|
1302
1302
|
] }),
|
|
1303
|
-
/* @__PURE__ */ jsxRuntime.jsx(kit.SubContent, { children: /* @__PURE__ */ jsxRuntime.jsx(kit.RadioGroup, { value: sharedTone(blocks), onValueChange: (tone) => apply({ tone }), children:
|
|
1303
|
+
/* @__PURE__ */ jsxRuntime.jsx(kit.SubContent, { children: /* @__PURE__ */ jsxRuntime.jsx(kit.RadioGroup, { value: sharedTone(blocks), onValueChange: (tone) => apply({ tone }), children: chunk2QKFRKOP_cjs.CALLOUT_TONES.map((tone) => /* @__PURE__ */ jsxRuntime.jsx(kit.RadioItem, { value: tone, indicator: /* @__PURE__ */ jsxRuntime.jsx(Check, { className: "size-4" }), children: labels.calloutTones[tone] }, tone)) }) })
|
|
1304
1304
|
] }),
|
|
1305
1305
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.Sub, { children: [
|
|
1306
1306
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.SubTrigger, { children: [
|
|
@@ -1527,7 +1527,7 @@ function codeToParagraph(blockId) {
|
|
|
1527
1527
|
};
|
|
1528
1528
|
}
|
|
1529
1529
|
function leaveCode(controller, blockId, direction, addsLine = false) {
|
|
1530
|
-
const moved =
|
|
1530
|
+
const moved = chunk2QKFRKOP_cjs.moveToNeighbour(controller, blockId, direction);
|
|
1531
1531
|
if (!moved && !(addsLine && controller.run(insertBlocks([{ type: "MARKDOWN" }], "text", blockId)))) return false;
|
|
1532
1532
|
controller.focus();
|
|
1533
1533
|
return true;
|
|
@@ -1652,7 +1652,7 @@ function travel({ controller, blockId, area }, command) {
|
|
|
1652
1652
|
const before = area.value;
|
|
1653
1653
|
controller.run(command);
|
|
1654
1654
|
const { selection } = controller.editor.state;
|
|
1655
|
-
const edit2 =
|
|
1655
|
+
const edit2 = chunk2QKFRKOP_cjs.textDiff(before, area.value);
|
|
1656
1656
|
if (selection?.kind !== "node" || selection.block !== blockId) controller.focus();
|
|
1657
1657
|
else if (edit2 !== null) area.setSelectionRange(edit2.from + edit2.insert.length, edit2.from + edit2.insert.length);
|
|
1658
1658
|
return true;
|
|
@@ -1737,11 +1737,11 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1737
1737
|
useTypeIntoCode(controller, blockId, field, edit2);
|
|
1738
1738
|
const onKeyDown = (event) => {
|
|
1739
1739
|
const area = event.currentTarget;
|
|
1740
|
-
if (
|
|
1740
|
+
if (chunk2QKFRKOP_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1741
1741
|
const action = codeKeyAction(event, fieldOf(area), controller.isMac);
|
|
1742
1742
|
if (action !== null && runCodeAction(action, { controller, blockId, area, edit: edit2, focusControls })) event.preventDefault();
|
|
1743
1743
|
};
|
|
1744
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [
|
|
1744
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [chunk2QKFRKOP_cjs.NATIVE_INTERACTION]: "" }, dir: "ltr", className: "quoin-code-scroll", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-code-lines", children: [
|
|
1745
1745
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1746
1746
|
HighlightOverlay,
|
|
1747
1747
|
{
|
|
@@ -1811,7 +1811,7 @@ var Button = React7__namespace.forwardRef(function Button2({ className, variant
|
|
|
1811
1811
|
var COPIED_FOR_MS = 1500;
|
|
1812
1812
|
function CopyCodeButton({ code, controller }) {
|
|
1813
1813
|
const labels = useLabels();
|
|
1814
|
-
const readOnly =
|
|
1814
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
1815
1815
|
const [copied, setCopied] = React7.useState(false);
|
|
1816
1816
|
React7.useEffect(() => {
|
|
1817
1817
|
if (!copied) return;
|
|
@@ -1894,7 +1894,7 @@ var preventDefault = (event) => event.preventDefault();
|
|
|
1894
1894
|
|
|
1895
1895
|
// src/blocks/text/set-block-attrs.ts
|
|
1896
1896
|
function setBlockAttrs(controller, blockId, patch) {
|
|
1897
|
-
if (!controller.readOnly) controller.run(
|
|
1897
|
+
if (!controller.readOnly) controller.run(chunk2QKFRKOP_cjs.onBlock(blockId, chunkFK7EBZPX_cjs.setAttrs(patch)));
|
|
1898
1898
|
}
|
|
1899
1899
|
var FIELD = `quoin-code-language quoin-code-control ${FOCUS_RING}`;
|
|
1900
1900
|
var CONTENT = `${MENU_CONTENT} flex max-h-64 w-48 flex-col overflow-y-hidden`;
|
|
@@ -1910,7 +1910,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1910
1910
|
const options = draft === null ? [] : languageOptions(draft === shown ? "" : draft, labels.plainText);
|
|
1911
1911
|
const open = options.length > 0;
|
|
1912
1912
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1913
|
-
|
|
1913
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
1914
1914
|
list2.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
|
|
1915
1915
|
}, [active]);
|
|
1916
1916
|
const close = () => {
|
|
@@ -1936,7 +1936,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1936
1936
|
onDone();
|
|
1937
1937
|
};
|
|
1938
1938
|
const onKeyDown = (event) => {
|
|
1939
|
-
if (
|
|
1939
|
+
if (chunk2QKFRKOP_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1940
1940
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1941
1941
|
event.preventDefault();
|
|
1942
1942
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
@@ -2010,7 +2010,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
2010
2010
|
}
|
|
2011
2011
|
var CodeBlock = ({ block, controller }) => {
|
|
2012
2012
|
const labels = useLabels();
|
|
2013
|
-
const readOnly =
|
|
2013
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
2014
2014
|
const languageField = React7.useRef(null);
|
|
2015
2015
|
const codeField = React7.useRef(null);
|
|
2016
2016
|
const code = chunkI7X7B3WD_cjs.str(block.attrs.code);
|
|
@@ -2112,7 +2112,7 @@ function selectHandlers(controller, blockId, root, onSelect) {
|
|
|
2112
2112
|
return {
|
|
2113
2113
|
onKeyDown(event) {
|
|
2114
2114
|
const key = event.nativeEvent;
|
|
2115
|
-
if (
|
|
2115
|
+
if (chunk2QKFRKOP_cjs.isComposingKey(controller, key)) return;
|
|
2116
2116
|
if (event.key === "Escape") select();
|
|
2117
2117
|
else if (!(event.metaKey || event.ctrlKey) || event.target.matches("input:not([type=file])") || !controller.edit(() => controller.editor.handleKey(key)))
|
|
2118
2118
|
return;
|
|
@@ -2310,7 +2310,7 @@ async function uploadInto(controller, blockId, file, { type, category }, { uploa
|
|
|
2310
2310
|
const token = claimUpload(controller, blockId);
|
|
2311
2311
|
const before = assetOf(controller, blockId, type);
|
|
2312
2312
|
const stored = await upload(file, category);
|
|
2313
|
-
if (typeof stored?.storageKey !== "string") throw new Error();
|
|
2313
|
+
if (typeof stored?.storageKey !== "string" || stored.storageKey === "") throw new Error();
|
|
2314
2314
|
if (!isNewestUpload(controller, blockId, token) || !sameAsset(assetOf(controller, blockId, type), before)) return;
|
|
2315
2315
|
onLand?.();
|
|
2316
2316
|
await land2(stored, token);
|
|
@@ -2334,7 +2334,7 @@ var uploadFile = (controller, blockId, file, host) => uploadInto(
|
|
|
2334
2334
|
var anyFile = () => true;
|
|
2335
2335
|
var FileBlock = ({ block, controller }) => {
|
|
2336
2336
|
const labels = useLabels();
|
|
2337
|
-
const readOnly =
|
|
2337
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
2338
2338
|
const root = React7.useRef(null);
|
|
2339
2339
|
const filled = hasFile(block.attrs);
|
|
2340
2340
|
useNodeKeys(controller, block.id, !readOnly, !filled, root);
|
|
@@ -2486,7 +2486,7 @@ function useRovingFocus() {
|
|
|
2486
2486
|
},
|
|
2487
2487
|
[syncTabStop]
|
|
2488
2488
|
);
|
|
2489
|
-
|
|
2489
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(syncTabStop);
|
|
2490
2490
|
const onFocus = (event) => {
|
|
2491
2491
|
if (!owns(event.target)) return;
|
|
2492
2492
|
current.current = event.target;
|
|
@@ -2495,7 +2495,7 @@ function useRovingFocus() {
|
|
|
2495
2495
|
const onKeyDown = (event) => {
|
|
2496
2496
|
const all = items();
|
|
2497
2497
|
const index = all.indexOf(event.target);
|
|
2498
|
-
const key = row.current === null ? event.key :
|
|
2498
|
+
const key = row.current === null ? event.key : chunk2QKFRKOP_cjs.arrowAsWritten(event.key, chunk2QKFRKOP_cjs.inlineDirection(row.current));
|
|
2499
2499
|
if (index === -1 || !Object.hasOwn(MOVES, key)) return;
|
|
2500
2500
|
event.preventDefault();
|
|
2501
2501
|
all[MOVES[key](index, all.length)].focus();
|
|
@@ -2506,7 +2506,7 @@ function useRovingFocus() {
|
|
|
2506
2506
|
// src/menus/floating/use-focus-key.ts
|
|
2507
2507
|
var isFocusKey = (event) => event.key === "F10" && event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
2508
2508
|
function useFocusKey(controller, focus) {
|
|
2509
|
-
|
|
2509
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
2510
2510
|
const intercept = (event) => {
|
|
2511
2511
|
if (!isFocusKey(event)) return false;
|
|
2512
2512
|
event.preventDefault();
|
|
@@ -2518,11 +2518,11 @@ function useFocusKey(controller, focus) {
|
|
|
2518
2518
|
}
|
|
2519
2519
|
function NodeToolbar(props) {
|
|
2520
2520
|
const { blockId, controller, label, anchor, items, next, buttonRefs, children, popover } = props;
|
|
2521
|
-
const state =
|
|
2521
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
2522
2522
|
const roving = useRovingFocus();
|
|
2523
2523
|
useFocusKey(controller, roving.focusCurrent);
|
|
2524
2524
|
const onKeyDown = (event) => {
|
|
2525
|
-
if (!roving.owns(event.target) ||
|
|
2525
|
+
if (!roving.owns(event.target) || chunk2QKFRKOP_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2526
2526
|
const tab = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2527
2527
|
const ahead = tab && !event.shiftKey && next !== void 0 ? blockPart(controller, blockId, next) : void 0;
|
|
2528
2528
|
if (ahead !== void 0) ahead.focus();
|
|
@@ -2604,8 +2604,8 @@ var selectedBlock = (type, filled) => ({ doc, selection }) => {
|
|
|
2604
2604
|
return block?.type === type && filled(block.attrs) ? block.id : null;
|
|
2605
2605
|
};
|
|
2606
2606
|
function useToolbarBlock(controller, selected, keptFor = null) {
|
|
2607
|
-
const blockId =
|
|
2608
|
-
const readOnly =
|
|
2607
|
+
const blockId = chunk2QKFRKOP_cjs.useEditorState(controller, selected);
|
|
2608
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
2609
2609
|
const settled = useSelectionSettled(controller);
|
|
2610
2610
|
return blockId !== null && !readOnly && (settled || keptFor === blockId) ? blockId : null;
|
|
2611
2611
|
}
|
|
@@ -2684,7 +2684,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2684
2684
|
const value = percent ?? drawn;
|
|
2685
2685
|
const write = (widthPercent) => setBlockAttrs(controller, blockId, { widthPercent });
|
|
2686
2686
|
const onKeyDown = (event) => {
|
|
2687
|
-
if (
|
|
2687
|
+
if (chunk2QKFRKOP_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2688
2688
|
const next = keyedWidth(event.key, value);
|
|
2689
2689
|
if (event.key === "Escape") controller.focus();
|
|
2690
2690
|
else if (next === null) return;
|
|
@@ -2726,7 +2726,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2726
2726
|
"aria-valuetext": labels.widthValue(value),
|
|
2727
2727
|
"data-side": side,
|
|
2728
2728
|
className: "quoin-image-handle",
|
|
2729
|
-
...{ [
|
|
2729
|
+
...{ [chunk2QKFRKOP_cjs.NATIVE_INTERACTION]: "" },
|
|
2730
2730
|
...bubblePart(controller),
|
|
2731
2731
|
onKeyDown,
|
|
2732
2732
|
onPointerDown: onPointerDown(side),
|
|
@@ -2799,7 +2799,7 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2799
2799
|
)
|
|
2800
2800
|
] }),
|
|
2801
2801
|
(!readOnly || (regions.caption?.length ?? 0) > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2802
|
-
|
|
2802
|
+
chunk2QKFRKOP_cjs.EditableRegion,
|
|
2803
2803
|
{
|
|
2804
2804
|
block: id,
|
|
2805
2805
|
region: "caption",
|
|
@@ -2967,7 +2967,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2967
2967
|
}
|
|
2968
2968
|
var ImageBlock = ({ block, controller }) => {
|
|
2969
2969
|
const labels = useLabels();
|
|
2970
|
-
const readOnly =
|
|
2970
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
2971
2971
|
const root = React7.useRef(null);
|
|
2972
2972
|
const picture = hasPicture(block.attrs);
|
|
2973
2973
|
useImageKeys(controller, block.id, picture, !readOnly, root);
|
|
@@ -2980,17 +2980,17 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2980
2980
|
"aria-label": labels.blockNames.image,
|
|
2981
2981
|
contentEditable: false,
|
|
2982
2982
|
className: "quoin-image",
|
|
2983
|
-
...picture ? { [
|
|
2983
|
+
...picture ? { [chunk2QKFRKOP_cjs.NODE_ENTRY]: "" } : void 0,
|
|
2984
2984
|
children: picture ? /* @__PURE__ */ jsxRuntime.jsx(ImageFigure, { block, controller, readOnly }) : empty
|
|
2985
2985
|
}
|
|
2986
2986
|
);
|
|
2987
2987
|
};
|
|
2988
2988
|
function useOutsidePress(element, ownerDocument, onPress) {
|
|
2989
2989
|
const latest = React7.useRef(onPress);
|
|
2990
|
-
|
|
2990
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
2991
2991
|
latest.current = onPress;
|
|
2992
2992
|
});
|
|
2993
|
-
|
|
2993
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
2994
2994
|
const doc = ownerDocument();
|
|
2995
2995
|
const inside = (target) => element.current?.contains(target) === true;
|
|
2996
2996
|
let touched = null;
|
|
@@ -3005,7 +3005,7 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
3005
3005
|
if (touched !== null && !inside(event.target)) latest.current(touched);
|
|
3006
3006
|
touched = null;
|
|
3007
3007
|
};
|
|
3008
|
-
return
|
|
3008
|
+
return chunk2QKFRKOP_cjs.listen(doc, { pointerdown: down, click }, true);
|
|
3009
3009
|
}, [element, ownerDocument]);
|
|
3010
3010
|
}
|
|
3011
3011
|
function storeAlt(controller, blockId, opened, patch) {
|
|
@@ -3013,7 +3013,7 @@ function storeAlt(controller, blockId, opened, patch) {
|
|
|
3013
3013
|
const attrs = chunkI7X7B3WD_cjs.blockById(editor.state.doc, blockId)?.attrs ?? {};
|
|
3014
3014
|
const changed = chunkI7X7B3WD_cjs.str(attrs.alt) !== opened.alt || attrs.decorative === true !== opened.decorative;
|
|
3015
3015
|
if (controller.readOnly || controller.root === null || changed) return;
|
|
3016
|
-
|
|
3016
|
+
chunk2QKFRKOP_cjs.onBlock(blockId, chunkFK7EBZPX_cjs.setAttrs(patch))(editor.state, (tr) => editor.dispatch(tr));
|
|
3017
3017
|
}
|
|
3018
3018
|
function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative, onClose }) {
|
|
3019
3019
|
const labels = useLabels();
|
|
@@ -3055,7 +3055,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
3055
3055
|
close(true);
|
|
3056
3056
|
};
|
|
3057
3057
|
const onKeyDown = (event) => {
|
|
3058
|
-
if (event.key !== "Tab" ||
|
|
3058
|
+
if (event.key !== "Tab" || chunk2QKFRKOP_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
3059
3059
|
const controls = [...event.currentTarget.elements];
|
|
3060
3060
|
const next = controls[controls.indexOf(event.target) + (event.shiftKey ? -1 : 1)];
|
|
3061
3061
|
event.preventDefault();
|
|
@@ -3083,7 +3083,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
3083
3083
|
onCloseAutoFocus: preventDefault,
|
|
3084
3084
|
onEscapeKeyDown: (event) => {
|
|
3085
3085
|
event.preventDefault();
|
|
3086
|
-
if (!
|
|
3086
|
+
if (!chunk2QKFRKOP_cjs.isComposingKey(controller, event)) close(false);
|
|
3087
3087
|
},
|
|
3088
3088
|
...bubblePart(controller),
|
|
3089
3089
|
children: /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, className: "quoin-image-alt", onSubmit: save, onKeyDown, children: [
|
|
@@ -3179,7 +3179,7 @@ function ImageToolbarOverlay({ controller }) {
|
|
|
3179
3179
|
}
|
|
3180
3180
|
function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
3181
3181
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
3182
|
-
const state =
|
|
3182
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
3183
3183
|
const picker = useReplacePicker(controller, blockId, uploadImage, "image/*");
|
|
3184
3184
|
const altButton = React7.useRef(null);
|
|
3185
3185
|
const anchor = usePartAnchor(controller, blockId, ".quoin-image-frame");
|
|
@@ -3404,20 +3404,20 @@ function CalloutToneMenu({ blockId, controller, tone }) {
|
|
|
3404
3404
|
{
|
|
3405
3405
|
value: tone,
|
|
3406
3406
|
onValueChange: (value) => setBlockAttrs(controller, blockId, { tone: value }),
|
|
3407
|
-
children:
|
|
3407
|
+
children: chunk2QKFRKOP_cjs.CALLOUT_TONES.map((option) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioItem, { value: option, children: labels.calloutTones[option] }, option))
|
|
3408
3408
|
}
|
|
3409
3409
|
) })
|
|
3410
3410
|
] });
|
|
3411
3411
|
}
|
|
3412
3412
|
var CalloutBlock = ({ block, controller }) => {
|
|
3413
3413
|
const labels = useLabels();
|
|
3414
|
-
const readOnly =
|
|
3415
|
-
const tone =
|
|
3414
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
3415
|
+
const tone = chunk2QKFRKOP_cjs.calloutTone(block.attrs.tone);
|
|
3416
3416
|
const icon = calloutIcon(block.attrs, tone);
|
|
3417
3417
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("quoin-callout group/callout flex items-start gap-2", TONE[tone]), "data-tone": tone, children: [
|
|
3418
3418
|
readOnly ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "flex size-6 items-center justify-center text-base", children: icon }) : /* @__PURE__ */ jsxRuntime.jsx(CalloutIconMenu, { blockId: block.id, controller, icon }),
|
|
3419
3419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3420
|
-
|
|
3420
|
+
chunk2QKFRKOP_cjs.EditableRegion,
|
|
3421
3421
|
{
|
|
3422
3422
|
block: block.id,
|
|
3423
3423
|
region: "body",
|
|
@@ -3486,22 +3486,22 @@ var headingStyles = (level) => `quoin-heading mb-1 font-semibold leading-tight i
|
|
|
3486
3486
|
function Heading({ block }) {
|
|
3487
3487
|
const labels = useLabels();
|
|
3488
3488
|
const level = chunkI7X7B3WD_cjs.headingLevel(block.attrs.level);
|
|
3489
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3489
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.heading(level) }) });
|
|
3490
3490
|
}
|
|
3491
3491
|
function NumberedItem({ block, controller }) {
|
|
3492
3492
|
const labels = useLabels();
|
|
3493
|
-
const number =
|
|
3493
|
+
const number = chunk2QKFRKOP_cjs.useOrderedNumber(controller, block.id);
|
|
3494
3494
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "ordered", children: [
|
|
3495
3495
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "ordered", number, depth: block.indent }),
|
|
3496
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3496
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.numberedItem(number) })
|
|
3497
3497
|
] });
|
|
3498
3498
|
}
|
|
3499
3499
|
function TaskItem({ block, controller }) {
|
|
3500
3500
|
const labels = useLabels();
|
|
3501
|
-
const hostId =
|
|
3501
|
+
const hostId = chunk2QKFRKOP_cjs.useRegionDomId(block.id, REGION);
|
|
3502
3502
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-task", "data-checked": block.attrs.checked === true, children: [
|
|
3503
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3504
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3503
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.TaskCheckbox, { block, controller, label: labels.task, labelledBy: hostId }),
|
|
3504
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { id: hostId, block: block.id, region: REGION, label: labels.task })
|
|
3505
3505
|
] });
|
|
3506
3506
|
}
|
|
3507
3507
|
var MarkdownBlock = (props) => {
|
|
@@ -3513,16 +3513,16 @@ var MarkdownBlock = (props) => {
|
|
|
3513
3513
|
case "bullet":
|
|
3514
3514
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "bullet", children: [
|
|
3515
3515
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "bullet", depth: block.indent }),
|
|
3516
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3516
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.bulletItem })
|
|
3517
3517
|
] });
|
|
3518
3518
|
case "ordered":
|
|
3519
3519
|
return /* @__PURE__ */ jsxRuntime.jsx(NumberedItem, { ...props });
|
|
3520
3520
|
case "task":
|
|
3521
3521
|
return /* @__PURE__ */ jsxRuntime.jsx(TaskItem, { ...props });
|
|
3522
3522
|
case "quote":
|
|
3523
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3523
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.quote }) });
|
|
3524
3524
|
default:
|
|
3525
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3525
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.paragraph });
|
|
3526
3526
|
}
|
|
3527
3527
|
};
|
|
3528
3528
|
|
|
@@ -3533,16 +3533,16 @@ function nestedBlockIds({ doc }, blockId) {
|
|
|
3533
3533
|
return doc.blocks.slice(index + 1, chunkFK7EBZPX_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
3534
3534
|
}
|
|
3535
3535
|
function useNestedBlocks(controller, blockId) {
|
|
3536
|
-
return
|
|
3536
|
+
return chunk2QKFRKOP_cjs.useEditorState(controller, (state) => nestedBlockIds(state, blockId), chunkI7X7B3WD_cjs.sameItems);
|
|
3537
3537
|
}
|
|
3538
3538
|
var ToggleBlock = ({ block, controller }) => {
|
|
3539
3539
|
const labels = useLabels();
|
|
3540
|
-
const domId =
|
|
3540
|
+
const domId = chunk2QKFRKOP_cjs.useBlockDomId();
|
|
3541
3541
|
const nested = useNestedBlocks(controller, block.id);
|
|
3542
|
-
const open =
|
|
3542
|
+
const open = chunk2QKFRKOP_cjs.useToggleOpen(controller, block);
|
|
3543
3543
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-toggle", "data-open": open, children: [
|
|
3544
3544
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3545
|
-
|
|
3545
|
+
chunk2QKFRKOP_cjs.ToggleChevron,
|
|
3546
3546
|
{
|
|
3547
3547
|
block,
|
|
3548
3548
|
controller,
|
|
@@ -3550,7 +3550,7 @@ var ToggleBlock = ({ block, controller }) => {
|
|
|
3550
3550
|
controls: nested.length === 0 ? void 0 : nested.map(domId).join(" ")
|
|
3551
3551
|
}
|
|
3552
3552
|
),
|
|
3553
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3553
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2QKFRKOP_cjs.EditableRegion, { block: block.id, region: "text", label: labels.toggle })
|
|
3554
3554
|
] });
|
|
3555
3555
|
};
|
|
3556
3556
|
|
|
@@ -3647,7 +3647,7 @@ function ActionItem({ kit, controller, action, blockIds }) {
|
|
|
3647
3647
|
);
|
|
3648
3648
|
}
|
|
3649
3649
|
function BlockMenuItems({ kit, controller, blocks, styled, title, actions }) {
|
|
3650
|
-
const state =
|
|
3650
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
3651
3651
|
const blockIds = blocks.map((block) => block.id);
|
|
3652
3652
|
const shown = actions.filter((action) => action.available?.(state, blockIds) ?? true);
|
|
3653
3653
|
const anyText = styled.some((block) => chunkFK7EBZPX_cjs.isTextFlow(state.schema, block));
|
|
@@ -3692,7 +3692,7 @@ var CONTEXT_KIT = {
|
|
|
3692
3692
|
SubTrigger: ContextMenuSubTrigger
|
|
3693
3693
|
};
|
|
3694
3694
|
var GUTTER_BLOCK = "data-quoin-gutter-block";
|
|
3695
|
-
var OWN_MENU = `[${
|
|
3695
|
+
var OWN_MENU = `[${chunk2QKFRKOP_cjs.NATIVE_INTERACTION}], input, textarea, select`;
|
|
3696
3696
|
function contextBlock(controller, target) {
|
|
3697
3697
|
const { state } = controller.editor;
|
|
3698
3698
|
const gutter = target.closest(`[${GUTTER_BLOCK}]`)?.getAttribute(GUTTER_BLOCK);
|
|
@@ -3721,7 +3721,7 @@ function useContextMenuOpener(controller, store, trigger) {
|
|
|
3721
3721
|
openBlockMenuAt(store, controller.editor.state, block, clientX, clientY);
|
|
3722
3722
|
hidden.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX, clientY }));
|
|
3723
3723
|
};
|
|
3724
|
-
return
|
|
3724
|
+
return chunk2QKFRKOP_cjs.listen(root, { mousedown: onMouseDown, contextmenu: onContextMenu });
|
|
3725
3725
|
}, [controller, store, trigger]);
|
|
3726
3726
|
}
|
|
3727
3727
|
|
|
@@ -3757,7 +3757,7 @@ function useLiveBlocks(controller, blockIds) {
|
|
|
3757
3757
|
(state) => blockIds.flatMap((id) => chunkI7X7B3WD_cjs.blockById(state.doc, id) ?? []),
|
|
3758
3758
|
[blockIds]
|
|
3759
3759
|
);
|
|
3760
|
-
return
|
|
3760
|
+
return chunk2QKFRKOP_cjs.useEditorState(controller, select, chunkI7X7B3WD_cjs.sameItems);
|
|
3761
3761
|
}
|
|
3762
3762
|
function useMenuBlocks(controller, store, menu) {
|
|
3763
3763
|
const labels = useLabels();
|
|
@@ -3884,7 +3884,7 @@ var DragOverlay = React7.forwardRef(function DragOverlay2(_props, ref) {
|
|
|
3884
3884
|
var DELETION_STEPS = /* @__PURE__ */ new Set(["removeBlocks", "setIndent"]);
|
|
3885
3885
|
function drawnPosition(doc, blockId) {
|
|
3886
3886
|
const index = doc.index.get(blockId) ?? 0;
|
|
3887
|
-
return [
|
|
3887
|
+
return [chunk2QKFRKOP_cjs.drawnBlockCount(doc, 0, index) + 1, chunk2QKFRKOP_cjs.drawnBlockCount(doc)];
|
|
3888
3888
|
}
|
|
3889
3889
|
function blockMovedMessage(doc, blockId, labels) {
|
|
3890
3890
|
return labels.blockMoved(...drawnPosition(doc, blockId));
|
|
@@ -3900,7 +3900,7 @@ function deletedCount(tr) {
|
|
|
3900
3900
|
return tr.steps.reduce((deleted, step, i) => {
|
|
3901
3901
|
const { index, count } = step.toJSON();
|
|
3902
3902
|
if (step.stepType !== "removeBlocks" || typeof index !== "number" || typeof count !== "number") return deleted;
|
|
3903
|
-
return deleted +
|
|
3903
|
+
return deleted + chunk2QKFRKOP_cjs.drawnBlockCount(tr.docs[i], index, index + count);
|
|
3904
3904
|
}, 0);
|
|
3905
3905
|
}
|
|
3906
3906
|
function insertedBlock(tr) {
|
|
@@ -3939,7 +3939,7 @@ function inlineEdges(shell, box, rtl) {
|
|
|
3939
3939
|
function measure(controller, root, moved, rtl) {
|
|
3940
3940
|
const { doc } = controller.editor.state;
|
|
3941
3941
|
const origin = rootOrigin(root);
|
|
3942
|
-
return
|
|
3942
|
+
return chunk2QKFRKOP_cjs.visibleBlockIndexes(doc).flatMap((index) => {
|
|
3943
3943
|
const { id, indent: indent3 } = doc.blocks[index];
|
|
3944
3944
|
const shell = controller.blockElement(id);
|
|
3945
3945
|
if (shell === void 0) return [];
|
|
@@ -3952,7 +3952,7 @@ function measure(controller, root, moved, rtl) {
|
|
|
3952
3952
|
var furthestEnd = (blocks, rtl) => blocks.reduce((end, block) => rtl ? Math.min(end, block.end) : Math.max(end, block.end), blocks[0].end);
|
|
3953
3953
|
function measureDrag(controller, root, ids) {
|
|
3954
3954
|
const { doc } = controller.editor.state;
|
|
3955
|
-
const direction =
|
|
3955
|
+
const direction = chunk2QKFRKOP_cjs.inlineDirection(root);
|
|
3956
3956
|
const rtl = direction === "rtl";
|
|
3957
3957
|
const moved = new Set(chunkFK7EBZPX_cjs.movedBlockIds(doc, ids));
|
|
3958
3958
|
const blocks = measure(controller, root, moved, rtl);
|
|
@@ -4014,7 +4014,7 @@ function draggedBlocks(controller, blockId) {
|
|
|
4014
4014
|
function followPress(press, root, view) {
|
|
4015
4015
|
const { controller, store, overlay, handle: handle2, pointerId } = press;
|
|
4016
4016
|
const doc = view.document;
|
|
4017
|
-
const scroll =
|
|
4017
|
+
const scroll = chunk2QKFRKOP_cjs.createAutoScroll(root, follow, SCROLL_EDGE);
|
|
4018
4018
|
let pointer = { x: press.x, y: press.y };
|
|
4019
4019
|
let active = null;
|
|
4020
4020
|
let unsubscribe = () => {
|
|
@@ -4089,9 +4089,9 @@ function followPress(press, root, view) {
|
|
|
4089
4089
|
event.stopPropagation();
|
|
4090
4090
|
finish();
|
|
4091
4091
|
}
|
|
4092
|
-
const unlistenDocument =
|
|
4093
|
-
const unlistenBlur =
|
|
4094
|
-
const unlistenKeys =
|
|
4092
|
+
const unlistenDocument = chunk2QKFRKOP_cjs.listen(doc, { pointermove: onPointerMove, pointerup: onPointerUp, pointercancel: finish });
|
|
4093
|
+
const unlistenBlur = chunk2QKFRKOP_cjs.listen(view, { blur: finish });
|
|
4094
|
+
const unlistenKeys = chunk2QKFRKOP_cjs.listen(view, { keydown: onKeyDown }, true);
|
|
4095
4095
|
return finish;
|
|
4096
4096
|
}
|
|
4097
4097
|
function pressDragHandle(press) {
|
|
@@ -4220,13 +4220,13 @@ function place2(controller, root, gutter, block) {
|
|
|
4220
4220
|
const line = firstLine(shell);
|
|
4221
4221
|
const top = line.top + (line.height - gutter.offsetHeight) / 2 - rootBox.top - root.clientTop + root.scrollTop;
|
|
4222
4222
|
const shellBox = shell.getBoundingClientRect();
|
|
4223
|
-
const beside =
|
|
4223
|
+
const beside = chunk2QKFRKOP_cjs.inlineDirection(root) === "rtl" ? shellBox.right + GAP : shellBox.left - gutter.offsetWidth - GAP;
|
|
4224
4224
|
const left = beside - rootBox.left - root.clientLeft + root.scrollLeft;
|
|
4225
4225
|
gutter.style.transform = `translate(${left}px, ${top}px)`;
|
|
4226
4226
|
gutter.style.visibility = "";
|
|
4227
4227
|
}
|
|
4228
4228
|
function useGutterPosition(controller, gutter, block) {
|
|
4229
|
-
|
|
4229
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
4230
4230
|
const element = gutter.current;
|
|
4231
4231
|
const root = controller.root;
|
|
4232
4232
|
const view = root?.ownerDocument.defaultView;
|
|
@@ -4258,7 +4258,7 @@ function blockAcross(controller, root, y) {
|
|
|
4258
4258
|
}
|
|
4259
4259
|
function useGutterTarget(controller, store, gutter) {
|
|
4260
4260
|
const hovered = useCanvasUi(store, (state) => state.hoveredBlock);
|
|
4261
|
-
const head =
|
|
4261
|
+
const head = chunk2QKFRKOP_cjs.useEditorState(controller, headOf);
|
|
4262
4262
|
const [focusWithin, setFocusWithin] = React7.useState(false);
|
|
4263
4263
|
React7.useEffect(() => {
|
|
4264
4264
|
const root = controller.root;
|
|
@@ -4276,7 +4276,7 @@ function useGutterTarget(controller, store, gutter) {
|
|
|
4276
4276
|
const onFocusIn = () => setFocusWithin(true);
|
|
4277
4277
|
const onFocusOut = (event) => setFocusWithin(root.contains(event.relatedTarget));
|
|
4278
4278
|
setFocusWithin(root.contains(root.ownerDocument.activeElement));
|
|
4279
|
-
return
|
|
4279
|
+
return chunk2QKFRKOP_cjs.listen(root, { pointermove: onPointerMove, pointerleave: onPointerLeave, focusin: onFocusIn, focusout: onFocusOut });
|
|
4280
4280
|
}, [controller, store, gutter]);
|
|
4281
4281
|
const fallback = focusWithin ? head : null;
|
|
4282
4282
|
const target = hovered ?? fallback;
|
|
@@ -4377,7 +4377,7 @@ function pointInHost(host, { node, offset }) {
|
|
|
4377
4377
|
return host.contains(node) ? { node, offset: Math.min(offset, nodeLength(node)) } : null;
|
|
4378
4378
|
}
|
|
4379
4379
|
function textRect(host, { from, to }) {
|
|
4380
|
-
const map =
|
|
4380
|
+
const map = chunk2QKFRKOP_cjs.domMapOf(host);
|
|
4381
4381
|
const range = host.ownerDocument.createRange();
|
|
4382
4382
|
if (map === void 0 || typeof range.getBoundingClientRect !== "function") return null;
|
|
4383
4383
|
const start = pointInHost(host, map.toDom(from, 1));
|
|
@@ -4390,7 +4390,7 @@ function textRect(host, { from, to }) {
|
|
|
4390
4390
|
}
|
|
4391
4391
|
function rangeRect(controller, range) {
|
|
4392
4392
|
const host = controller.registry.get(range.block, range.region);
|
|
4393
|
-
if (host === void 0 || !host.isConnected || controller.composingKey ===
|
|
4393
|
+
if (host === void 0 || !host.isConnected || controller.composingKey === chunk2QKFRKOP_cjs.hostKey(range.block, range.region)) {
|
|
4394
4394
|
return null;
|
|
4395
4395
|
}
|
|
4396
4396
|
const rect = textRect(host, range);
|
|
@@ -4431,7 +4431,7 @@ function useSelectionAnchor(controller, state) {
|
|
|
4431
4431
|
[controller, state]
|
|
4432
4432
|
);
|
|
4433
4433
|
const [side, setSide] = React7.useState("top");
|
|
4434
|
-
|
|
4434
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
4435
4435
|
const rect = selectionRect(controller);
|
|
4436
4436
|
if (rect) setSide(rect.top < ROOM_ABOVE ? "bottom" : "top");
|
|
4437
4437
|
}, [controller, state]);
|
|
@@ -4513,7 +4513,7 @@ function TurnIntoDropdown({ controller, state }) {
|
|
|
4513
4513
|
}
|
|
4514
4514
|
var DIVIDER = "mx-0.5 h-5 w-px shrink-0 bg-border";
|
|
4515
4515
|
function BubbleToolbar({ controller, labels, store, extraItems }) {
|
|
4516
|
-
const state =
|
|
4516
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
4517
4517
|
const { anchor, side } = useSelectionAnchor(controller, state);
|
|
4518
4518
|
const roving = useRovingFocus();
|
|
4519
4519
|
const items = React7.useMemo(() => bubbleItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -4577,8 +4577,8 @@ var useFinePointer = () => useMediaQuery("(pointer: fine)", true);
|
|
|
4577
4577
|
// src/menus/bubble/use-bubble-visibility.ts
|
|
4578
4578
|
var hasTextRange = (state) => state.selection?.kind === "text" && !chunkFK7EBZPX_cjs.isCollapsed(state.selection) && chunkFK7EBZPX_cjs.markRanges(state).length > 0;
|
|
4579
4579
|
function useBubbleVisibility(controller) {
|
|
4580
|
-
const range =
|
|
4581
|
-
const readOnly =
|
|
4580
|
+
const range = chunk2QKFRKOP_cjs.useEditorState(controller, hasTextRange);
|
|
4581
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
4582
4582
|
const fine = useFinePointer();
|
|
4583
4583
|
const settled = useSelectionSettled(controller);
|
|
4584
4584
|
return range && !readOnly && fine && settled;
|
|
@@ -4601,7 +4601,7 @@ function bubbleExtension() {
|
|
|
4601
4601
|
// src/menus/link/link-at-selection.ts
|
|
4602
4602
|
function linkAround(state, from, to = from) {
|
|
4603
4603
|
if (from.block !== to.block || from.region !== to.region) return null;
|
|
4604
|
-
const inline =
|
|
4604
|
+
const inline = chunk2QKFRKOP_cjs.regionInline(state, from.block, from.region) ?? [];
|
|
4605
4605
|
const extent = chunkFK7EBZPX_cjs.markExtent(inline, from.offset, "link");
|
|
4606
4606
|
if (extent === null || to.offset > extent.to) return null;
|
|
4607
4607
|
const attrs = chunkI7X7B3WD_cjs.sliceInline(inline, extent.from, extent.to)[0]?.marks.find((mark) => mark.type === "link")?.attrs;
|
|
@@ -4624,7 +4624,7 @@ function linkElementAt(controller, target) {
|
|
|
4624
4624
|
}
|
|
4625
4625
|
function linkAtElement(controller, state, element) {
|
|
4626
4626
|
const host = controller.registry.locate(element);
|
|
4627
|
-
const offset = host === null ? null :
|
|
4627
|
+
const offset = host === null ? null : chunk2QKFRKOP_cjs.domMapOf(host.element)?.fromDom(element, 0) ?? null;
|
|
4628
4628
|
if (host === null || offset === null) return null;
|
|
4629
4629
|
return linkAround(state, { block: host.block, region: host.region, offset });
|
|
4630
4630
|
}
|
|
@@ -4677,7 +4677,7 @@ function caretLinkKey(state) {
|
|
|
4677
4677
|
return link && [link.range.block, link.range.region, link.range.from, link.href].join("\0");
|
|
4678
4678
|
}
|
|
4679
4679
|
function useCaretInLink(controller, delay) {
|
|
4680
|
-
const key =
|
|
4680
|
+
const key = chunk2QKFRKOP_cjs.useEditorState(controller, caretLinkKey);
|
|
4681
4681
|
const settled = useSelectionSettled(controller);
|
|
4682
4682
|
return useRestedValue(settled ? key : null, delay) !== null;
|
|
4683
4683
|
}
|
|
@@ -4711,7 +4711,7 @@ var URL_LENGTH = 48;
|
|
|
4711
4711
|
var CARD = "flex w-auto items-center gap-0.5 py-1 ps-3 pe-1 shadow-md";
|
|
4712
4712
|
var ADDRESS = "me-1 whitespace-nowrap text-sm text-muted-foreground";
|
|
4713
4713
|
function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
4714
|
-
const state =
|
|
4714
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
4715
4715
|
const link = React7.useMemo(
|
|
4716
4716
|
() => element === null ? linkAtSelection(state) : linkAtElement(controller, state, element),
|
|
4717
4717
|
[controller, state, element]
|
|
@@ -4729,7 +4729,7 @@ function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
|
4729
4729
|
const edit2 = () => {
|
|
4730
4730
|
if (element !== null) {
|
|
4731
4731
|
const selection = chunkFK7EBZPX_cjs.textSelection({ block, region, offset: from }, { block, region, offset: to });
|
|
4732
|
-
|
|
4732
|
+
chunk2QKFRKOP_cjs.dispatchSelection(controller, selection);
|
|
4733
4733
|
}
|
|
4734
4734
|
store.set({ linkPopover: { open: true } });
|
|
4735
4735
|
};
|
|
@@ -4896,7 +4896,7 @@ function LinkOverlay({ controller }) {
|
|
|
4896
4896
|
const labels = useLabels();
|
|
4897
4897
|
const store = useCanvasUiStore();
|
|
4898
4898
|
const popoverOpen = useCanvasUi(store, isPopoverOpen);
|
|
4899
|
-
const readOnly =
|
|
4899
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
4900
4900
|
useLinkClicks(controller);
|
|
4901
4901
|
React7.useEffect(() => {
|
|
4902
4902
|
if (readOnly && store.get().linkPopover.open) store.set({ linkPopover: { open: false } });
|
|
@@ -5076,10 +5076,10 @@ function useRangeAnchor(controller, range) {
|
|
|
5076
5076
|
const [side, setSide] = React7.useState("bottom");
|
|
5077
5077
|
const latest = React7.useRef(range);
|
|
5078
5078
|
const start = range === null ? null : `${range.block} ${range.region} ${range.from}`;
|
|
5079
|
-
|
|
5079
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5080
5080
|
latest.current = range;
|
|
5081
5081
|
});
|
|
5082
|
-
|
|
5082
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5083
5083
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
5084
5084
|
const height = controller.root?.ownerDocument.defaultView?.innerHeight;
|
|
5085
5085
|
if (rect && height !== void 0) setSide(sideFor(rect, height));
|
|
@@ -5106,11 +5106,11 @@ function openCombobox(host, listboxId) {
|
|
|
5106
5106
|
}
|
|
5107
5107
|
function useComboboxHost(controller, block, region, listboxId, activeOptionId) {
|
|
5108
5108
|
const host = React7.useRef(null);
|
|
5109
|
-
|
|
5109
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5110
5110
|
host.current = block === null || region === null ? null : controller.registry.get(block, region) ?? null;
|
|
5111
5111
|
return host.current === null ? void 0 : openCombobox(host.current, listboxId);
|
|
5112
5112
|
}, [controller, block, region, listboxId]);
|
|
5113
|
-
|
|
5113
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5114
5114
|
if (host.current !== null) restore(host.current, "aria-activedescendant", activeOptionId);
|
|
5115
5115
|
}, [block, region, activeOptionId]);
|
|
5116
5116
|
}
|
|
@@ -5156,10 +5156,10 @@ function handle(event, menu) {
|
|
|
5156
5156
|
}
|
|
5157
5157
|
function useSuggestionKeys(controller, open, menu) {
|
|
5158
5158
|
const latest = React7.useRef(menu);
|
|
5159
|
-
|
|
5159
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5160
5160
|
latest.current = menu;
|
|
5161
5161
|
});
|
|
5162
|
-
|
|
5162
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5163
5163
|
if (!open) return;
|
|
5164
5164
|
const intercept = (event) => {
|
|
5165
5165
|
const handled = handle(event, latest.current);
|
|
@@ -5180,10 +5180,10 @@ var isPromise = (value) => typeof value?.then === "function";
|
|
|
5180
5180
|
function useSuggestionResults(source, query, onError) {
|
|
5181
5181
|
const [answer, setAnswer] = React7.useState(FORGOTTEN);
|
|
5182
5182
|
const report = React7.useRef(onError);
|
|
5183
|
-
|
|
5183
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5184
5184
|
report.current = onError;
|
|
5185
5185
|
});
|
|
5186
|
-
|
|
5186
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5187
5187
|
if (query === null) {
|
|
5188
5188
|
setAnswer(FORGOTTEN);
|
|
5189
5189
|
return;
|
|
@@ -5227,9 +5227,9 @@ function useSuggestion({
|
|
|
5227
5227
|
emptyLabel
|
|
5228
5228
|
}) {
|
|
5229
5229
|
const { labels, onError } = useQuoin();
|
|
5230
|
-
const readOnly =
|
|
5230
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
5231
5231
|
const selectTrigger = React7.useCallback((state) => chunkFK7EBZPX_cjs.getPluginState(state, pluginKey).active, [pluginKey]);
|
|
5232
|
-
const active =
|
|
5232
|
+
const active = chunk2QKFRKOP_cjs.useEditorState(controller, selectTrigger);
|
|
5233
5233
|
const trigger = readOnly ? null : active;
|
|
5234
5234
|
const results = useSuggestionResults(source, trigger?.query ?? null, onError);
|
|
5235
5235
|
const sections = React7.useMemo(() => groupItems(results.items, groupOf2), [results.items, groupOf2]);
|
|
@@ -5299,7 +5299,7 @@ function SuggestionMenu(props) {
|
|
|
5299
5299
|
const { trigger, sections, activeIndex, listboxId } = suggestion;
|
|
5300
5300
|
const { anchor, side } = useRangeAnchor(controller, trigger);
|
|
5301
5301
|
const listbox = React7.useRef(null);
|
|
5302
|
-
|
|
5302
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5303
5303
|
listbox.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
|
|
5304
5304
|
}, [activeIndex, sections]);
|
|
5305
5305
|
if (trigger === null) return null;
|
|
@@ -5378,7 +5378,7 @@ var TEXT_STEPS = /* @__PURE__ */ new Set(["replaceInline", "addMark", "removeMar
|
|
|
5378
5378
|
var WHITESPACE3 = /\s/;
|
|
5379
5379
|
var changesBlocks = (tr) => tr !== null && tr.steps.some((step) => !TEXT_STEPS.has(step.stepType));
|
|
5380
5380
|
function withSpaceBefore(state, range) {
|
|
5381
|
-
const inline =
|
|
5381
|
+
const inline = chunk2QKFRKOP_cjs.regionInline(state, range.block, range.region);
|
|
5382
5382
|
if (inline === void 0 || range.from === 0) return null;
|
|
5383
5383
|
const text2 = chunkI7X7B3WD_cjs.inlineText(inline);
|
|
5384
5384
|
const after = text2.charAt(range.to);
|
|
@@ -5566,7 +5566,7 @@ function placement(viewport) {
|
|
|
5566
5566
|
function EditingTools({ controller }) {
|
|
5567
5567
|
const labels = useLabels();
|
|
5568
5568
|
const store = useCanvasUiStore();
|
|
5569
|
-
const state =
|
|
5569
|
+
const state = chunk2QKFRKOP_cjs.useEditorState(controller, chunk2QKFRKOP_cjs.wholeState);
|
|
5570
5570
|
const viewport = useVisualViewport();
|
|
5571
5571
|
const roving = useRovingFocus();
|
|
5572
5572
|
const items = React7.useMemo(() => mobileItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -5831,9 +5831,9 @@ function shortcutsExtension(store) {
|
|
|
5831
5831
|
}
|
|
5832
5832
|
function useRootDirection(controller) {
|
|
5833
5833
|
const [direction, setDirection] = React7.useState("ltr");
|
|
5834
|
-
|
|
5834
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
5835
5835
|
const root = controller.root;
|
|
5836
|
-
if (root !== null) setDirection(
|
|
5836
|
+
if (root !== null) setDirection(chunk2QKFRKOP_cjs.inlineDirection(root));
|
|
5837
5837
|
}, [controller]);
|
|
5838
5838
|
return direction;
|
|
5839
5839
|
}
|
|
@@ -5898,7 +5898,7 @@ function runHistoryKey(controller, event) {
|
|
|
5898
5898
|
}
|
|
5899
5899
|
function useBlockIndex(controller, blockId) {
|
|
5900
5900
|
const select = React7.useCallback((state) => state.doc.index.get(blockId) ?? -1, [blockId]);
|
|
5901
|
-
return
|
|
5901
|
+
return chunk2QKFRKOP_cjs.useEditorState(controller, select);
|
|
5902
5902
|
}
|
|
5903
5903
|
var FOCUSABLE = [
|
|
5904
5904
|
"input:not([disabled])",
|
|
@@ -5925,8 +5925,8 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5925
5925
|
const leaveUnlessInside = (event) => {
|
|
5926
5926
|
if (!inside.current.has(event)) stop();
|
|
5927
5927
|
};
|
|
5928
|
-
const unlistenCapture =
|
|
5929
|
-
const unlisten =
|
|
5928
|
+
const unlistenCapture = chunk2QKFRKOP_cjs.listen(doc, { pointerdown: leaveForCanvas }, true);
|
|
5929
|
+
const unlisten = chunk2QKFRKOP_cjs.listen(doc, { pointerdown: leaveUnlessInside, focusin: leaveUnlessInside });
|
|
5930
5930
|
return () => {
|
|
5931
5931
|
unlistenCapture();
|
|
5932
5932
|
unlisten();
|
|
@@ -5955,8 +5955,8 @@ function VoidEditor({ Editor, controller, ...props }) {
|
|
|
5955
5955
|
}
|
|
5956
5956
|
function VoidBlock({ block, controller, definition }) {
|
|
5957
5957
|
const { blockTypes, labels } = useQuoin();
|
|
5958
|
-
const { report } = React7.useContext(
|
|
5959
|
-
const readOnly =
|
|
5958
|
+
const { report } = React7.useContext(chunk2QKFRKOP_cjs.BlockErrorContext);
|
|
5959
|
+
const readOnly = chunk2QKFRKOP_cjs.useReadOnly(controller);
|
|
5960
5960
|
const { editor: Editor, alwaysEditing = false } = definition;
|
|
5961
5961
|
const name = blockTypeLabel(labels, block, blockTypes);
|
|
5962
5962
|
const blockId = block.id;
|
|
@@ -6020,7 +6020,7 @@ function VoidBlock({ block, controller, definition }) {
|
|
|
6020
6020
|
role: "group",
|
|
6021
6021
|
"aria-label": name,
|
|
6022
6022
|
tabIndex: editorShown ? -1 : void 0,
|
|
6023
|
-
...{ [
|
|
6023
|
+
...{ [chunk2QKFRKOP_cjs.NATIVE_INTERACTION]: editorShown ? "" : void 0 },
|
|
6024
6024
|
onKeyDown,
|
|
6025
6025
|
...focusHandlers,
|
|
6026
6026
|
onClick,
|
|
@@ -6241,7 +6241,7 @@ function deletions(codec, tr) {
|
|
|
6241
6241
|
}
|
|
6242
6242
|
function useDeleteReporter(controller, onDelete) {
|
|
6243
6243
|
const latest = React7.useRef(onDelete);
|
|
6244
|
-
|
|
6244
|
+
chunk2QKFRKOP_cjs.useIsomorphicLayoutEffect(() => {
|
|
6245
6245
|
latest.current = onDelete;
|
|
6246
6246
|
});
|
|
6247
6247
|
React7.useEffect(() => {
|
|
@@ -6318,7 +6318,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
6318
6318
|
);
|
|
6319
6319
|
useDefinitionWarnings(blockTypes, readOnly);
|
|
6320
6320
|
const [focusOnMount] = React7.useState(autoFocus);
|
|
6321
|
-
const controller =
|
|
6321
|
+
const controller = chunk2QKFRKOP_cjs.useQuoinEditor({
|
|
6322
6322
|
blocks,
|
|
6323
6323
|
onChange,
|
|
6324
6324
|
readOnly,
|
|
@@ -6366,7 +6366,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
6366
6366
|
[controller, resolveAssetUrl]
|
|
6367
6367
|
);
|
|
6368
6368
|
return /* @__PURE__ */ jsxRuntime.jsx(reactDirection.DirectionProvider, { dir: direction, children: /* @__PURE__ */ jsxRuntime.jsx(QuoinProvider, { value: { blockTypes, upload, resolveAssetUrl, onError, highlight, controller, labels }, children: /* @__PURE__ */ jsxRuntime.jsx(VoidEditingContext.Provider, { value: voidEditing, children: /* @__PURE__ */ jsxRuntime.jsx(SlashItemsProvider, { value: slashItems, children: /* @__PURE__ */ jsxRuntime.jsx(BubbleItemsProvider, { value: ui.bubbleItems, children: /* @__PURE__ */ jsxRuntime.jsx(CanvasUiProvider, { value: uiStore, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6369
|
-
|
|
6369
|
+
chunk2QKFRKOP_cjs.EditorView,
|
|
6370
6370
|
{
|
|
6371
6371
|
controller,
|
|
6372
6372
|
renderers: ui.renderers,
|