quoin-editor 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/ai.cjs +65 -65
- package/dist/ai.js +4 -4
- package/dist/catalogue.cjs +20 -20
- package/dist/catalogue.js +12 -12
- package/dist/{chunk-BKEHG4QV.js → chunk-2IY3LET7.js} +3 -3
- package/dist/{chunk-BKEHG4QV.js.map → chunk-2IY3LET7.js.map} +1 -1
- package/dist/{chunk-X4FDLUXJ.js → chunk-3XPVCSFT.js} +5 -5
- package/dist/{chunk-X4FDLUXJ.js.map → chunk-3XPVCSFT.js.map} +1 -1
- package/dist/{chunk-4EU4BTLZ.js → chunk-4EJ4EGGH.js} +3 -3
- package/dist/{chunk-4EU4BTLZ.js.map → chunk-4EJ4EGGH.js.map} +1 -1
- package/dist/{chunk-NNDLIP2C.cjs → chunk-4SRXM2VS.cjs} +83 -83
- package/dist/{chunk-NNDLIP2C.cjs.map → chunk-4SRXM2VS.cjs.map} +1 -1
- package/dist/{chunk-TG5T7BEJ.js → chunk-4WRIGF7F.js} +6 -6
- package/dist/{chunk-TG5T7BEJ.js.map → chunk-4WRIGF7F.js.map} +1 -1
- package/dist/{chunk-MEXDDWJF.js → chunk-535R45JI.js} +5 -5
- package/dist/{chunk-MEXDDWJF.js.map → chunk-535R45JI.js.map} +1 -1
- package/dist/{chunk-UMTKQVOX.cjs → chunk-5QLDX75X.cjs} +4 -4
- package/dist/{chunk-UMTKQVOX.cjs.map → chunk-5QLDX75X.cjs.map} +1 -1
- package/dist/{chunk-WCAUPASG.js → chunk-7GDKCDU4.js} +5 -5
- package/dist/{chunk-WCAUPASG.js.map → chunk-7GDKCDU4.js.map} +1 -1
- package/dist/{chunk-I4NEX6SZ.js → chunk-B3RY7TN2.js} +5 -5
- package/dist/{chunk-I4NEX6SZ.js.map → chunk-B3RY7TN2.js.map} +1 -1
- package/dist/{chunk-R45RJQRD.cjs → chunk-BGPFGNCL.cjs} +29 -29
- package/dist/{chunk-R45RJQRD.cjs.map → chunk-BGPFGNCL.cjs.map} +1 -1
- package/dist/{chunk-VNRBCUBV.cjs → chunk-C4MLW2QA.cjs} +6 -6
- package/dist/{chunk-VNRBCUBV.cjs.map → chunk-C4MLW2QA.cjs.map} +1 -1
- package/dist/{chunk-KIU5MPZ4.js → chunk-D4ISVKWS.js} +3 -3
- package/dist/{chunk-KIU5MPZ4.js.map → chunk-D4ISVKWS.js.map} +1 -1
- package/dist/{chunk-TLMO46OV.cjs → chunk-EXSNIIOR.cjs} +10 -10
- package/dist/{chunk-TLMO46OV.cjs.map → chunk-EXSNIIOR.cjs.map} +1 -1
- package/dist/{chunk-OWX3Y5UU.js → chunk-HPQM33PG.js} +5 -5
- package/dist/{chunk-OWX3Y5UU.js.map → chunk-HPQM33PG.js.map} +1 -1
- package/dist/{chunk-RENKFSFD.cjs → chunk-I4KBYVSC.cjs} +26 -26
- package/dist/{chunk-RENKFSFD.cjs.map → chunk-I4KBYVSC.cjs.map} +1 -1
- package/dist/{chunk-4F2IWBFM.cjs → chunk-LROGC3SI.cjs} +3 -3
- package/dist/{chunk-4F2IWBFM.cjs.map → chunk-LROGC3SI.cjs.map} +1 -1
- package/dist/{chunk-TN32PKUI.cjs → chunk-LXSVDRMH.cjs} +75 -75
- package/dist/{chunk-TN32PKUI.cjs.map → chunk-LXSVDRMH.cjs.map} +1 -1
- package/dist/{chunk-K7E2DR5W.cjs → chunk-O2VMWE4B.cjs} +20 -20
- package/dist/{chunk-K7E2DR5W.cjs.map → chunk-O2VMWE4B.cjs.map} +1 -1
- package/dist/{chunk-3BCP6ZUM.js → chunk-O4APV37F.js} +6 -6
- package/dist/{chunk-3BCP6ZUM.js.map → chunk-O4APV37F.js.map} +1 -1
- package/dist/{chunk-PMJ3VCSR.js → chunk-PX5CFG5J.js} +4 -4
- package/dist/{chunk-PMJ3VCSR.js.map → chunk-PX5CFG5J.js.map} +1 -1
- package/dist/{chunk-EQKFQK3C.cjs → chunk-RBYK3RGX.cjs} +10 -10
- package/dist/{chunk-EQKFQK3C.cjs.map → chunk-RBYK3RGX.cjs.map} +1 -1
- package/dist/{chunk-I4CSCA3O.js → chunk-RIGAO2QT.js} +4 -4
- package/dist/{chunk-I4CSCA3O.js.map → chunk-RIGAO2QT.js.map} +1 -1
- package/dist/{chunk-IQ2DE3Y3.cjs → chunk-WYGSUSZF.cjs} +66 -66
- package/dist/{chunk-IQ2DE3Y3.cjs.map → chunk-WYGSUSZF.cjs.map} +1 -1
- package/dist/{chunk-UHAAYYMX.cjs → chunk-XT2ZKIYS.cjs} +37 -37
- package/dist/{chunk-UHAAYYMX.cjs.map → chunk-XT2ZKIYS.cjs.map} +1 -1
- package/dist/{chunk-PVCXTSUO.js → chunk-XWKFBLFO.js} +3 -3
- package/dist/{chunk-PVCXTSUO.js.map → chunk-XWKFBLFO.js.map} +1 -1
- package/dist/{chunk-IHTHOAUY.js → chunk-XYR7JW23.js} +6 -6
- package/dist/{chunk-IHTHOAUY.js.map → chunk-XYR7JW23.js.map} +1 -1
- package/dist/{chunk-6X5A4DUQ.cjs → chunk-YVMPIIMO.cjs} +219 -219
- package/dist/{chunk-6X5A4DUQ.cjs.map → chunk-YVMPIIMO.cjs.map} +1 -1
- package/dist/{chunk-TWFMNDOC.cjs → chunk-YWPFC2PX.cjs} +38 -38
- package/dist/{chunk-TWFMNDOC.cjs.map → chunk-YWPFC2PX.cjs.map} +1 -1
- package/dist/comments.cjs +48 -48
- package/dist/comments.js +4 -4
- package/dist/docx.cjs +1 -1
- package/dist/docx.js +1 -1
- package/dist/embed.cjs +6 -6
- package/dist/embed.js +4 -4
- package/dist/emoji.cjs +7 -7
- package/dist/emoji.js +4 -4
- package/dist/engine.cjs +43 -43
- package/dist/engine.js +1 -1
- package/dist/find.cjs +8 -8
- package/dist/find.js +4 -4
- package/dist/headless.cjs +59 -59
- package/dist/headless.js +2 -2
- package/dist/index.cjs +71 -71
- package/dist/index.js +3 -3
- package/dist/math.cjs +7 -7
- package/dist/math.js +5 -5
- package/dist/mention.cjs +7 -7
- package/dist/mention.js +5 -5
- package/dist/presence.cjs +33 -33
- package/dist/presence.js +5 -5
- package/dist/stats.cjs +7 -7
- package/dist/stats.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/table.cjs +23 -23
- package/dist/table.js +4 -4
- package/dist/toc.cjs +7 -7
- package/dist/toc.js +4 -4
- package/dist/yjs.cjs +99 -99
- package/dist/yjs.js +3 -3
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4SRXM2VS_cjs = require('./chunk-4SRXM2VS.cjs');
|
|
4
4
|
var chunkA6PGQVTR_cjs = require('./chunk-A6PGQVTR.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkLROGC3SI_cjs = require('./chunk-LROGC3SI.cjs');
|
|
6
6
|
var chunkWZA5S5EJ_cjs = require('./chunk-WZA5S5EJ.cjs');
|
|
7
7
|
var React7 = require('react');
|
|
8
8
|
var lucideReact = require('lucide-react');
|
|
@@ -325,7 +325,7 @@ function imageSource(attrs, resolveAssetUrl) {
|
|
|
325
325
|
var HINT = "text-sm text-muted-foreground";
|
|
326
326
|
var TONE = {
|
|
327
327
|
info: "border-info bg-info/15",
|
|
328
|
-
tip: "border-
|
|
328
|
+
tip: "border-tip bg-tip/15",
|
|
329
329
|
warning: "border-warning bg-warning/15",
|
|
330
330
|
success: "border-success bg-success/15",
|
|
331
331
|
danger: "border-destructive bg-destructive/15"
|
|
@@ -408,7 +408,7 @@ function selectNode(controller, blockId) {
|
|
|
408
408
|
const { editor } = controller;
|
|
409
409
|
const { selection } = editor.state;
|
|
410
410
|
if (selection?.kind === "node" && selection.block === blockId) return;
|
|
411
|
-
|
|
411
|
+
chunk4SRXM2VS_cjs.dispatchSelection(controller, chunkLROGC3SI_cjs.nodeSelection(blockId));
|
|
412
412
|
}
|
|
413
413
|
function focusNode(controller, blockId) {
|
|
414
414
|
selectNode(controller, blockId);
|
|
@@ -459,7 +459,7 @@ function createVoidEditing() {
|
|
|
459
459
|
start?.();
|
|
460
460
|
};
|
|
461
461
|
return {
|
|
462
|
-
extension:
|
|
462
|
+
extension: chunkLROGC3SI_cjs.defineExtension({
|
|
463
463
|
name: "void-editing",
|
|
464
464
|
priority: ABOVE_CORE_KEYS,
|
|
465
465
|
keymap: { Enter: openEditor },
|
|
@@ -557,7 +557,7 @@ var FOCUS_RING = [
|
|
|
557
557
|
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid",
|
|
558
558
|
"focus-visible:outline-[var(--quoin-ring)]"
|
|
559
559
|
].join(" ");
|
|
560
|
-
var HIGHLIGHT_BAR = "data-[highlighted]:shadow-[inset_2px_0_0_var(--quoin-
|
|
560
|
+
var HIGHLIGHT_BAR = "data-[highlighted]:shadow-[inset_2px_0_0_var(--quoin-ring)]";
|
|
561
561
|
|
|
562
562
|
// src/ui/touch-target.ts
|
|
563
563
|
var TAP_TARGET_FLOOR = "pointer-coarse:min-h-11";
|
|
@@ -736,32 +736,32 @@ function settle(tr, before) {
|
|
|
736
736
|
const { schema } = tr.before;
|
|
737
737
|
const result = tr.selection;
|
|
738
738
|
if (result?.kind !== "blocks" || before?.kind === "blocks") return result;
|
|
739
|
-
const ids =
|
|
740
|
-
const head =
|
|
741
|
-
if (head !== null && ids.includes(head) &&
|
|
742
|
-
return
|
|
739
|
+
const ids = chunkLROGC3SI_cjs.selectedBlockIds(doc, result);
|
|
740
|
+
const head = chunkLROGC3SI_cjs.headBlockId(before);
|
|
741
|
+
if (head !== null && ids.includes(head) && chunkLROGC3SI_cjs.validateSelection(doc, schema, before) === before) return before;
|
|
742
|
+
return chunkLROGC3SI_cjs.endOf(doc, schema, ids[0]);
|
|
743
743
|
}
|
|
744
744
|
function runOnBlocks(controller, blockIds, command) {
|
|
745
745
|
const { state } = controller.editor;
|
|
746
746
|
const ids = blockIds.filter((id) => state.doc.index.has(id));
|
|
747
747
|
if (ids.length === 0) return false;
|
|
748
748
|
const before = state.selection;
|
|
749
|
-
const exact = chunkWZA5S5EJ_cjs.sameItems(
|
|
750
|
-
const ran = exact ? before :
|
|
751
|
-
const { ok, tr } =
|
|
752
|
-
const result = ok && tr !== null ? tr : new
|
|
749
|
+
const exact = chunkWZA5S5EJ_cjs.sameItems(chunkLROGC3SI_cjs.selectedBlockIds(state.doc, before), ids);
|
|
750
|
+
const ran = exact ? before : chunkLROGC3SI_cjs.blockRangeSelection(ids[0], ids[ids.length - 1]);
|
|
751
|
+
const { ok, tr } = chunkLROGC3SI_cjs.runCommands(state, [chunkLROGC3SI_cjs.setSelection(ran), command]);
|
|
752
|
+
const result = ok && tr !== null ? tr : new chunkLROGC3SI_cjs.Transaction(state).setSelection(ran);
|
|
753
753
|
const settled = exact ? result.selection : settle(result, before);
|
|
754
|
-
if (!
|
|
755
|
-
if (result.docChanged || !
|
|
754
|
+
if (!chunkLROGC3SI_cjs.sameSelection(settled, result.selection)) result.setSelection(settled);
|
|
755
|
+
if (result.docChanged || !chunkLROGC3SI_cjs.sameSelection(result.selection, before)) controller.dispatch(result);
|
|
756
756
|
return ok;
|
|
757
757
|
}
|
|
758
758
|
var noChange = () => true;
|
|
759
759
|
|
|
760
760
|
// src/gutter/block-menu-items.ts
|
|
761
|
-
var rangeOf = (blockIds) =>
|
|
761
|
+
var rangeOf = (blockIds) => chunkLROGC3SI_cjs.blockRangeSelection(blockIds[0], blockIds[blockIds.length - 1]);
|
|
762
762
|
function selectedWith(state, blockId) {
|
|
763
763
|
const { doc, selection } = state;
|
|
764
|
-
const selected =
|
|
764
|
+
const selected = chunkLROGC3SI_cjs.selectedBlockIds(doc, selection);
|
|
765
765
|
const ofBlocks = selection?.kind === "blocks" || selection?.kind === "text" && selected.length > 1;
|
|
766
766
|
return ofBlocks && selected.includes(blockId) ? selected : null;
|
|
767
767
|
}
|
|
@@ -770,7 +770,7 @@ function menuTargets(state, blockId) {
|
|
|
770
770
|
if (selected !== null) return selected;
|
|
771
771
|
const { doc } = state;
|
|
772
772
|
const index = chunkWZA5S5EJ_cjs.requireBlockIndex(doc, blockId);
|
|
773
|
-
return doc.blocks.slice(index,
|
|
773
|
+
return doc.blocks.slice(index, chunkLROGC3SI_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
774
774
|
}
|
|
775
775
|
function styleTargets(state, blockId) {
|
|
776
776
|
return selectedWith(state, blockId) ?? [blockId];
|
|
@@ -780,12 +780,12 @@ function menuActions(core, extra = []) {
|
|
|
780
780
|
}
|
|
781
781
|
function markdownOf(editor, blockIds, resolveAssetUrl) {
|
|
782
782
|
const { doc } = editor.state;
|
|
783
|
-
const range =
|
|
783
|
+
const range = chunkLROGC3SI_cjs.selectedBlockRange(doc, rangeOf(blockIds));
|
|
784
784
|
if (range === null) return "";
|
|
785
785
|
const blocks = editor.codec.blocksFromDoc(chunkWZA5S5EJ_cjs.createDoc(doc.blocks.slice(range.start, range.end)));
|
|
786
|
-
return
|
|
786
|
+
return chunkLROGC3SI_cjs.toMarkdown(blocks, { schema: editor.schema, resolveAssetUrl, comments: false });
|
|
787
787
|
}
|
|
788
|
-
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) &&
|
|
788
|
+
var applies = (command) => (state, blockIds) => blockIds.every((id) => state.doc.index.has(id)) && chunkLROGC3SI_cjs.runCommands(state, [chunkLROGC3SI_cjs.setSelection(rangeOf(blockIds)), command]).ok;
|
|
789
789
|
function coreBlockMenuActions(labels, options) {
|
|
790
790
|
const copy = (controller, blockIds, text2) => {
|
|
791
791
|
void copyText(text2).then((copied) => {
|
|
@@ -799,7 +799,7 @@ function coreBlockMenuActions(labels, options) {
|
|
|
799
799
|
label: labels.duplicate,
|
|
800
800
|
icon: lucideReact.CopyPlus,
|
|
801
801
|
shortcut: "Mod-d",
|
|
802
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
802
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.duplicateBlocks())
|
|
803
803
|
},
|
|
804
804
|
{
|
|
805
805
|
id: "copy",
|
|
@@ -818,23 +818,23 @@ function coreBlockMenuActions(labels, options) {
|
|
|
818
818
|
label: labels.moveUp,
|
|
819
819
|
icon: lucideReact.ArrowUp,
|
|
820
820
|
shortcut: "Mod-Shift-ArrowUp",
|
|
821
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
822
|
-
available: applies(
|
|
821
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.moveBlocksUp),
|
|
822
|
+
available: applies(chunkLROGC3SI_cjs.moveBlocksUp)
|
|
823
823
|
},
|
|
824
824
|
{
|
|
825
825
|
id: "move-down",
|
|
826
826
|
label: labels.moveDown,
|
|
827
827
|
icon: lucideReact.ArrowDown,
|
|
828
828
|
shortcut: "Mod-Shift-ArrowDown",
|
|
829
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
830
|
-
available: applies(
|
|
829
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.moveBlocksDown),
|
|
830
|
+
available: applies(chunkLROGC3SI_cjs.moveBlocksDown)
|
|
831
831
|
},
|
|
832
832
|
{
|
|
833
833
|
id: "delete",
|
|
834
834
|
label: labels.delete,
|
|
835
835
|
icon: lucideReact.Trash,
|
|
836
836
|
destructive: true,
|
|
837
|
-
run: (controller, blockIds) => runOnBlocks(controller, blockIds,
|
|
837
|
+
run: (controller, blockIds) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.deleteBlocks)
|
|
838
838
|
}
|
|
839
839
|
];
|
|
840
840
|
}
|
|
@@ -880,7 +880,7 @@ var sharedTone = (blocks) => {
|
|
|
880
880
|
function CalloutMenus({ kit, controller, blocks }) {
|
|
881
881
|
const labels = useLabels();
|
|
882
882
|
const blockIds = blocks.map((block) => block.id);
|
|
883
|
-
const apply = (patch) => runOnBlocks(controller, blockIds,
|
|
883
|
+
const apply = (patch) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.setAttrs(patch));
|
|
884
884
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
885
885
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.Sub, { children: [
|
|
886
886
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.SubTrigger, { children: [
|
|
@@ -928,7 +928,7 @@ function ColorMenu({ kit, controller, blocks }) {
|
|
|
928
928
|
const labels = useLabels();
|
|
929
929
|
const blockIds = blocks.map((block) => block.id);
|
|
930
930
|
const value = { color: sharedColor(blocks, "color"), background: sharedColor(blocks, "background") };
|
|
931
|
-
const pick = (key, name) => runOnBlocks(controller, blockIds,
|
|
931
|
+
const pick = (key, name) => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.setBlockColor({ [key]: name === "default" ? null : name }));
|
|
932
932
|
return /* @__PURE__ */ jsxRuntime.jsxs(kit.Sub, { children: [
|
|
933
933
|
/* @__PURE__ */ jsxRuntime.jsxs(kit.SubTrigger, { children: [
|
|
934
934
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: lucideReact.Palette }),
|
|
@@ -959,7 +959,7 @@ function modifierText(modifier, isMac, { keyNames }) {
|
|
|
959
959
|
return Object.hasOwn(MODIFIERS, name) ? keyNames[MODIFIERS[name]] : capitalized(modifier);
|
|
960
960
|
}
|
|
961
961
|
function formatShortcut(shortcut, platform = {}) {
|
|
962
|
-
const { isMac =
|
|
962
|
+
const { isMac = chunkLROGC3SI_cjs.detectMac(), labels = englishLabels } = platform;
|
|
963
963
|
const parts = shortcut.split(shortcut.includes("+") ? "+" : "-");
|
|
964
964
|
const key = parts.pop() ?? shortcut;
|
|
965
965
|
const written = [...parts.map((modifier) => modifierText(modifier, isMac, labels)), keyText(key, labels)];
|
|
@@ -1039,21 +1039,21 @@ function languageOptions(query, plainText) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
// src/blocks/insert-blocks.ts
|
|
1042
|
-
var isEmptyParagraph = (schema, block) =>
|
|
1042
|
+
var isEmptyParagraph = (schema, block) => chunkLROGC3SI_cjs.isParagraph(block) && chunkLROGC3SI_cjs.regionLength(block, chunkLROGC3SI_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
1043
1043
|
function fresh(schema, { id, type, attrs, regions }, indent3) {
|
|
1044
|
-
const block =
|
|
1044
|
+
const block = chunkLROGC3SI_cjs.createBlock(schema, type, attrs, indent3, id);
|
|
1045
1045
|
return regions === void 0 ? block : { ...block, regions };
|
|
1046
1046
|
}
|
|
1047
1047
|
function landOnLine(tr, schema, index, indent3) {
|
|
1048
1048
|
const next = tr.doc.blocks[index];
|
|
1049
1049
|
const reused = next !== void 0 && next.indent === indent3 && isEmptyParagraph(schema, next);
|
|
1050
|
-
const line = reused ? next :
|
|
1051
|
-
if (!reused) tr.step(
|
|
1052
|
-
tr.setSelection(
|
|
1050
|
+
const line = reused ? next : chunkLROGC3SI_cjs.createBlock(schema, schema.defaultTextBlock, {}, indent3);
|
|
1051
|
+
if (!reused) tr.step(chunkLROGC3SI_cjs.insertBlocksStep(index, [line]));
|
|
1052
|
+
tr.setSelection(chunkLROGC3SI_cjs.startOf(tr.doc, schema, line.id));
|
|
1053
1053
|
}
|
|
1054
1054
|
function land(tr, schema, landing, first, after) {
|
|
1055
|
-
if (landing === "text") tr.setSelection(
|
|
1056
|
-
if (landing === "editor") tr.setSelection(
|
|
1055
|
+
if (landing === "text") tr.setSelection(chunkLROGC3SI_cjs.startOf(tr.doc, schema, first.id));
|
|
1056
|
+
if (landing === "editor") tr.setSelection(chunkLROGC3SI_cjs.nodeSelection(first.id)).setMeta(OPEN_EDITOR, first.id);
|
|
1057
1057
|
if (landing === "line") landOnLine(tr, schema, after, first.indent);
|
|
1058
1058
|
}
|
|
1059
1059
|
function anchorIndex(doc, id) {
|
|
@@ -1063,24 +1063,24 @@ function anchorIndex(doc, id) {
|
|
|
1063
1063
|
function insertBlocks(blocks, landing, anchorId) {
|
|
1064
1064
|
return (state, dispatch) => {
|
|
1065
1065
|
const { doc, schema } = state;
|
|
1066
|
-
const id = anchorId === void 0 ?
|
|
1066
|
+
const id = anchorId === void 0 ? chunkLROGC3SI_cjs.headBlockId(state.selection) : anchorId;
|
|
1067
1067
|
const index = anchorIndex(doc, id);
|
|
1068
1068
|
if (index === void 0 || blocks.length === 0) return false;
|
|
1069
1069
|
const anchor = id === null ? void 0 : doc.blocks[index];
|
|
1070
1070
|
const created2 = blocks.map((block) => fresh(schema, block, anchor?.indent ?? 0));
|
|
1071
|
-
const tr = new
|
|
1071
|
+
const tr = new chunkLROGC3SI_cjs.Transaction(state);
|
|
1072
1072
|
const empty = anchor !== void 0 && landing !== "stay" && isEmptyParagraph(schema, anchor);
|
|
1073
1073
|
if (empty && landing === "line") {
|
|
1074
|
-
tr.step(
|
|
1074
|
+
tr.step(chunkLROGC3SI_cjs.insertBlocksStep(index, created2)).setSelection(chunkLROGC3SI_cjs.startOf(tr.doc, schema, anchor.id));
|
|
1075
1075
|
} else if (empty) {
|
|
1076
1076
|
const [first, ...rest] = created2;
|
|
1077
1077
|
const filled = { ...first, id: anchor.id };
|
|
1078
|
-
tr.step(
|
|
1079
|
-
if (rest.length > 0) tr.step(
|
|
1078
|
+
tr.step(chunkLROGC3SI_cjs.replaceBlockStep(filled));
|
|
1079
|
+
if (rest.length > 0) tr.step(chunkLROGC3SI_cjs.insertBlocksStep(index + 1, rest));
|
|
1080
1080
|
land(tr, schema, landing, filled, index + created2.length);
|
|
1081
1081
|
} else {
|
|
1082
|
-
const at = anchor === void 0 ? 0 :
|
|
1083
|
-
tr.step(
|
|
1082
|
+
const at = anchor === void 0 ? 0 : chunkLROGC3SI_cjs.descendantsEnd(doc, index);
|
|
1083
|
+
tr.step(chunkLROGC3SI_cjs.insertBlocksStep(at, created2));
|
|
1084
1084
|
land(tr, schema, landing, created2[0], at + created2.length);
|
|
1085
1085
|
}
|
|
1086
1086
|
dispatch?.(tr);
|
|
@@ -1103,18 +1103,18 @@ function writeCode(controller, blockId, code, group) {
|
|
|
1103
1103
|
const { editor } = controller;
|
|
1104
1104
|
const block = chunkWZA5S5EJ_cjs.blockById(editor.state.doc, blockId);
|
|
1105
1105
|
if (block === void 0 || block.attrs.code === code) return;
|
|
1106
|
-
controller.dispatch(editor.createTransaction().step(
|
|
1106
|
+
controller.dispatch(editor.createTransaction().step(chunkLROGC3SI_cjs.setAttrsStep(blockId, { code })).setMeta(chunkLROGC3SI_cjs.HISTORY_GROUP, group));
|
|
1107
1107
|
}
|
|
1108
1108
|
function codeToParagraph(blockId) {
|
|
1109
1109
|
return (state, dispatch) => {
|
|
1110
|
-
const turn =
|
|
1111
|
-
const { ok, tr } =
|
|
1110
|
+
const turn = chunkLROGC3SI_cjs.setBlockType("MARKDOWN", { kind: "paragraph" });
|
|
1111
|
+
const { ok, tr } = chunkLROGC3SI_cjs.runCommands(state, [chunkLROGC3SI_cjs.setSelection(chunkLROGC3SI_cjs.nodeSelection(blockId)), turn]);
|
|
1112
1112
|
if (ok && tr !== null) dispatch?.(tr);
|
|
1113
1113
|
return ok;
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
1116
|
function leaveCode(controller, blockId, direction, addsLine = false) {
|
|
1117
|
-
const moved =
|
|
1117
|
+
const moved = chunk4SRXM2VS_cjs.moveToNeighbour(controller, blockId, direction);
|
|
1118
1118
|
if (!moved && !(addsLine && controller.run(insertBlocks([{ type: "MARKDOWN" }], "text", blockId)))) return false;
|
|
1119
1119
|
controller.focus();
|
|
1120
1120
|
return true;
|
|
@@ -1192,8 +1192,8 @@ var MOD_KEYS = [
|
|
|
1192
1192
|
["Mod-a", ({ value, start, end }) => start === 0 && end === value.length ? { kind: "selectAll" } : null]
|
|
1193
1193
|
];
|
|
1194
1194
|
function codeKeyAction(event, field, isMac) {
|
|
1195
|
-
const name =
|
|
1196
|
-
const modKey = MOD_KEYS.find(([key]) =>
|
|
1195
|
+
const name = chunkLROGC3SI_cjs.keyName(event, isMac);
|
|
1196
|
+
const modKey = MOD_KEYS.find(([key]) => chunkLROGC3SI_cjs.normalizeKey(key, isMac) === name);
|
|
1197
1197
|
const handler = modKey?.[1] ?? (Object.hasOwn(KEYS, name) ? KEYS[name] : void 0);
|
|
1198
1198
|
return handler?.(field) ?? null;
|
|
1199
1199
|
}
|
|
@@ -1239,7 +1239,7 @@ function travel({ controller, blockId, area }, command) {
|
|
|
1239
1239
|
const before = area.value;
|
|
1240
1240
|
controller.run(command);
|
|
1241
1241
|
const { selection } = controller.editor.state;
|
|
1242
|
-
const edit2 =
|
|
1242
|
+
const edit2 = chunk4SRXM2VS_cjs.textDiff(before, area.value);
|
|
1243
1243
|
if (selection?.kind !== "node" || selection.block !== blockId) controller.focus();
|
|
1244
1244
|
else if (edit2 !== null) area.setSelectionRange(edit2.from + edit2.insert.length, edit2.from + edit2.insert.length);
|
|
1245
1245
|
return true;
|
|
@@ -1255,13 +1255,13 @@ function runCodeAction(action, context) {
|
|
|
1255
1255
|
case "paragraph":
|
|
1256
1256
|
return selectAndFocus(context, codeToParagraph(blockId));
|
|
1257
1257
|
case "undo":
|
|
1258
|
-
return travel(context,
|
|
1258
|
+
return travel(context, chunkLROGC3SI_cjs.undo);
|
|
1259
1259
|
case "redo":
|
|
1260
|
-
return travel(context,
|
|
1260
|
+
return travel(context, chunkLROGC3SI_cjs.redo);
|
|
1261
1261
|
case "selectAll":
|
|
1262
|
-
return selectAndFocus(context,
|
|
1262
|
+
return selectAndFocus(context, chunkLROGC3SI_cjs.selectAll);
|
|
1263
1263
|
case "escape":
|
|
1264
|
-
return selectAndFocus(context,
|
|
1264
|
+
return selectAndFocus(context, chunkLROGC3SI_cjs.setSelection(chunkLROGC3SI_cjs.blockRangeSelection(blockId)));
|
|
1265
1265
|
case "controls":
|
|
1266
1266
|
context.focusControls();
|
|
1267
1267
|
return true;
|
|
@@ -1324,11 +1324,11 @@ function CodeEditor({ block, controller, field, focusControls }) {
|
|
|
1324
1324
|
useTypeIntoCode(controller, blockId, field, edit2);
|
|
1325
1325
|
const onKeyDown = (event) => {
|
|
1326
1326
|
const area = event.currentTarget;
|
|
1327
|
-
if (
|
|
1327
|
+
if (chunk4SRXM2VS_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1328
1328
|
const action = codeKeyAction(event, fieldOf(area), controller.isMac);
|
|
1329
1329
|
if (action !== null && runCodeAction(action, { controller, blockId, area, edit: edit2, focusControls })) event.preventDefault();
|
|
1330
1330
|
};
|
|
1331
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [
|
|
1331
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...{ [chunk4SRXM2VS_cjs.NATIVE_INTERACTION]: "" }, dir: "ltr", className: "quoin-code-scroll", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-code-lines", children: [
|
|
1332
1332
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
1333
|
HighlightOverlay,
|
|
1334
1334
|
{
|
|
@@ -1398,7 +1398,7 @@ var Button = React7__namespace.forwardRef(function Button2({ className, variant
|
|
|
1398
1398
|
var COPIED_FOR_MS = 1500;
|
|
1399
1399
|
function CopyCodeButton({ code, controller }) {
|
|
1400
1400
|
const labels = useLabels();
|
|
1401
|
-
const readOnly =
|
|
1401
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
1402
1402
|
const [copied, setCopied] = React7.useState(false);
|
|
1403
1403
|
React7.useEffect(() => {
|
|
1404
1404
|
if (!copied) return;
|
|
@@ -1481,7 +1481,7 @@ var preventDefault = (event) => event.preventDefault();
|
|
|
1481
1481
|
|
|
1482
1482
|
// src/blocks/text/set-block-attrs.ts
|
|
1483
1483
|
function setBlockAttrs(controller, blockId, patch) {
|
|
1484
|
-
if (!controller.readOnly) controller.run(
|
|
1484
|
+
if (!controller.readOnly) controller.run(chunk4SRXM2VS_cjs.onBlock(blockId, chunkLROGC3SI_cjs.setAttrs(patch)));
|
|
1485
1485
|
}
|
|
1486
1486
|
var FIELD = `quoin-code-language quoin-code-control ${FOCUS_RING}`;
|
|
1487
1487
|
var CONTENT = `${MENU_CONTENT} flex max-h-64 w-48 flex-col overflow-y-hidden`;
|
|
@@ -1497,7 +1497,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1497
1497
|
const options = draft === null ? [] : languageOptions(draft === shown ? "" : draft, labels.plainText);
|
|
1498
1498
|
const open = options.length > 0;
|
|
1499
1499
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1500
|
-
|
|
1500
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
1501
1501
|
list.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
1502
1502
|
}, [active]);
|
|
1503
1503
|
const close = () => {
|
|
@@ -1523,7 +1523,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1523
1523
|
onDone();
|
|
1524
1524
|
};
|
|
1525
1525
|
const onKeyDown = (event) => {
|
|
1526
|
-
if (
|
|
1526
|
+
if (chunk4SRXM2VS_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
1527
1527
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1528
1528
|
event.preventDefault();
|
|
1529
1529
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
@@ -1597,7 +1597,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1597
1597
|
}
|
|
1598
1598
|
var CodeBlock = ({ block, controller }) => {
|
|
1599
1599
|
const labels = useLabels();
|
|
1600
|
-
const readOnly =
|
|
1600
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
1601
1601
|
const languageField = React7.useRef(null);
|
|
1602
1602
|
const codeField = React7.useRef(null);
|
|
1603
1603
|
const code = chunkWZA5S5EJ_cjs.str(block.attrs.code);
|
|
@@ -1699,7 +1699,7 @@ function selectHandlers(controller, blockId, root, onSelect) {
|
|
|
1699
1699
|
return {
|
|
1700
1700
|
onKeyDown(event) {
|
|
1701
1701
|
const key = event.nativeEvent;
|
|
1702
|
-
if (
|
|
1702
|
+
if (chunk4SRXM2VS_cjs.isComposingKey(controller, key)) return;
|
|
1703
1703
|
if (event.key === "Escape") select();
|
|
1704
1704
|
else if (!(event.metaKey || event.ctrlKey) || event.target.matches("input:not([type=file])") || !controller.edit(() => controller.editor.handleKey(key)))
|
|
1705
1705
|
return;
|
|
@@ -1888,7 +1888,7 @@ function assetOf(controller, blockId, type) {
|
|
|
1888
1888
|
var sameAsset = (a, b) => a !== null && b !== null && a.url === b.url && a.storageKey === b.storageKey;
|
|
1889
1889
|
function writeAttrs(controller, blockId, patch, recorded) {
|
|
1890
1890
|
const { editor } = controller;
|
|
1891
|
-
const tr = editor.createTransaction().step(
|
|
1891
|
+
const tr = editor.createTransaction().step(chunkLROGC3SI_cjs.setAttrsStep(blockId, patch));
|
|
1892
1892
|
editor.dispatch(recorded ? tr : tr.setMeta("addToHistory", false));
|
|
1893
1893
|
}
|
|
1894
1894
|
async function uploadInto(controller, blockId, file, { type, category }, { upload, onLand }, land2) {
|
|
@@ -1919,7 +1919,7 @@ var uploadFile = (controller, blockId, file, host) => uploadInto(
|
|
|
1919
1919
|
var anyFile = () => true;
|
|
1920
1920
|
var FileBlock = ({ block, controller }) => {
|
|
1921
1921
|
const labels = useLabels();
|
|
1922
|
-
const readOnly =
|
|
1922
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
1923
1923
|
const root = React7.useRef(null);
|
|
1924
1924
|
const filled = hasFile(block.attrs);
|
|
1925
1925
|
useNodeKeys(controller, block.id, !readOnly, !filled, root);
|
|
@@ -1983,7 +1983,7 @@ function usePartAnchor(controller, blockId, selector) {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
var replaceItem = (title, run) => run ? [{ id: "replace", title, icon: lucideReact.Upload, run }] : [];
|
|
1985
1985
|
function deleteBlock(controller, blockId) {
|
|
1986
|
-
runOnBlocks(controller, [blockId],
|
|
1986
|
+
runOnBlocks(controller, [blockId], chunkLROGC3SI_cjs.deleteBlocks);
|
|
1987
1987
|
controller.focus();
|
|
1988
1988
|
}
|
|
1989
1989
|
var deleteItem = (blockId, title) => ({
|
|
@@ -1998,8 +1998,8 @@ function markItem(mark, title, icon) {
|
|
|
1998
1998
|
id: mark,
|
|
1999
1999
|
title,
|
|
2000
2000
|
icon,
|
|
2001
|
-
isActive: (state) =>
|
|
2002
|
-
run: (controller) => void controller.run(
|
|
2001
|
+
isActive: (state) => chunkLROGC3SI_cjs.isActive(state, mark),
|
|
2002
|
+
run: (controller) => void controller.run(chunkLROGC3SI_cjs.toggleMark(mark))
|
|
2003
2003
|
};
|
|
2004
2004
|
}
|
|
2005
2005
|
var linkItem = (labels, openLink) => ({
|
|
@@ -2069,7 +2069,7 @@ function useRovingFocus() {
|
|
|
2069
2069
|
},
|
|
2070
2070
|
[syncTabStop]
|
|
2071
2071
|
);
|
|
2072
|
-
|
|
2072
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(syncTabStop);
|
|
2073
2073
|
const onFocus = (event) => {
|
|
2074
2074
|
if (!owns(event.target)) return;
|
|
2075
2075
|
current.current = event.target;
|
|
@@ -2088,7 +2088,7 @@ function useRovingFocus() {
|
|
|
2088
2088
|
// src/menus/floating/use-focus-key.ts
|
|
2089
2089
|
var isFocusKey = (event) => event.key === "F10" && event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
2090
2090
|
function useFocusKey(controller, focus) {
|
|
2091
|
-
|
|
2091
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
2092
2092
|
const intercept = (event) => {
|
|
2093
2093
|
if (!isFocusKey(event)) return false;
|
|
2094
2094
|
event.preventDefault();
|
|
@@ -2100,11 +2100,11 @@ function useFocusKey(controller, focus) {
|
|
|
2100
2100
|
}
|
|
2101
2101
|
function NodeToolbar(props) {
|
|
2102
2102
|
const { blockId, controller, label, anchor, items, next, buttonRefs, children, popover } = props;
|
|
2103
|
-
const state =
|
|
2103
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
2104
2104
|
const roving = useRovingFocus();
|
|
2105
2105
|
useFocusKey(controller, roving.focusCurrent);
|
|
2106
2106
|
const onKeyDown = (event) => {
|
|
2107
|
-
if (!roving.owns(event.target) ||
|
|
2107
|
+
if (!roving.owns(event.target) || chunk4SRXM2VS_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2108
2108
|
const tab = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2109
2109
|
const ahead = tab && !event.shiftKey && next !== void 0 ? blockPart(controller, blockId, next) : void 0;
|
|
2110
2110
|
if (ahead !== void 0) ahead.focus();
|
|
@@ -2185,8 +2185,8 @@ var selectedBlock = (type, filled) => ({ doc, selection }) => {
|
|
|
2185
2185
|
return block?.type === type && filled(block.attrs) ? block.id : null;
|
|
2186
2186
|
};
|
|
2187
2187
|
function useToolbarBlock(controller, selected, keptFor = null) {
|
|
2188
|
-
const blockId =
|
|
2189
|
-
const readOnly =
|
|
2188
|
+
const blockId = chunk4SRXM2VS_cjs.useEditorState(controller, selected);
|
|
2189
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
2190
2190
|
const settled = useSelectionSettled(controller);
|
|
2191
2191
|
return blockId !== null && !readOnly && (settled || keptFor === blockId) ? blockId : null;
|
|
2192
2192
|
}
|
|
@@ -2265,7 +2265,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2265
2265
|
const value = percent ?? drawn;
|
|
2266
2266
|
const write = (widthPercent) => setBlockAttrs(controller, blockId, { widthPercent });
|
|
2267
2267
|
const onKeyDown = (event) => {
|
|
2268
|
-
if (
|
|
2268
|
+
if (chunk4SRXM2VS_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2269
2269
|
const next = keyedWidth(event.key, value);
|
|
2270
2270
|
if (event.key === "Escape") controller.focus();
|
|
2271
2271
|
else if (next === null) return;
|
|
@@ -2307,7 +2307,7 @@ function ResizeHandles({ blockId, controller, frame, percent, centred, onPreview
|
|
|
2307
2307
|
"aria-valuetext": labels.widthValue(value),
|
|
2308
2308
|
"data-side": side,
|
|
2309
2309
|
className: "quoin-image-handle",
|
|
2310
|
-
...{ [
|
|
2310
|
+
...{ [chunk4SRXM2VS_cjs.NATIVE_INTERACTION]: "" },
|
|
2311
2311
|
...bubblePart(controller),
|
|
2312
2312
|
onKeyDown,
|
|
2313
2313
|
onPointerDown: onPointerDown(side),
|
|
@@ -2380,7 +2380,7 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2380
2380
|
)
|
|
2381
2381
|
] }),
|
|
2382
2382
|
(!readOnly || (regions.caption?.length ?? 0) > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2383
|
-
|
|
2383
|
+
chunk4SRXM2VS_cjs.EditableRegion,
|
|
2384
2384
|
{
|
|
2385
2385
|
block: id,
|
|
2386
2386
|
region: "caption",
|
|
@@ -2519,7 +2519,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2519
2519
|
// then follows.
|
|
2520
2520
|
enter() {
|
|
2521
2521
|
const { editor } = controller;
|
|
2522
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
2522
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkLROGC3SI_cjs.textSelection(captionEnd(controller, blockId))));
|
|
2523
2523
|
controller.focus();
|
|
2524
2524
|
},
|
|
2525
2525
|
type(key) {
|
|
@@ -2544,7 +2544,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
var ImageBlock = ({ block, controller }) => {
|
|
2546
2546
|
const labels = useLabels();
|
|
2547
|
-
const readOnly =
|
|
2547
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
2548
2548
|
const root = React7.useRef(null);
|
|
2549
2549
|
const picture = hasPicture(block.attrs);
|
|
2550
2550
|
useImageKeys(controller, block.id, picture, !readOnly, root);
|
|
@@ -2557,17 +2557,17 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2557
2557
|
"aria-label": labels.blockNames.image,
|
|
2558
2558
|
contentEditable: false,
|
|
2559
2559
|
className: "quoin-image",
|
|
2560
|
-
...picture ? { [
|
|
2560
|
+
...picture ? { [chunk4SRXM2VS_cjs.NODE_ENTRY]: "" } : void 0,
|
|
2561
2561
|
children: picture ? /* @__PURE__ */ jsxRuntime.jsx(ImageFigure, { block, controller, readOnly }) : empty
|
|
2562
2562
|
}
|
|
2563
2563
|
);
|
|
2564
2564
|
};
|
|
2565
2565
|
function useOutsidePress(element, ownerDocument, onPress) {
|
|
2566
2566
|
const latest = React7.useRef(onPress);
|
|
2567
|
-
|
|
2567
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
2568
2568
|
latest.current = onPress;
|
|
2569
2569
|
});
|
|
2570
|
-
|
|
2570
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
2571
2571
|
const doc = ownerDocument();
|
|
2572
2572
|
const inside = (target) => element.current?.contains(target) === true;
|
|
2573
2573
|
let touched = null;
|
|
@@ -2582,7 +2582,7 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
2582
2582
|
if (touched !== null && !inside(event.target)) latest.current(touched);
|
|
2583
2583
|
touched = null;
|
|
2584
2584
|
};
|
|
2585
|
-
return
|
|
2585
|
+
return chunk4SRXM2VS_cjs.listen(doc, { pointerdown: down, click }, true);
|
|
2586
2586
|
}, [element, ownerDocument]);
|
|
2587
2587
|
}
|
|
2588
2588
|
function storeAlt(controller, blockId, opened, patch) {
|
|
@@ -2590,7 +2590,7 @@ function storeAlt(controller, blockId, opened, patch) {
|
|
|
2590
2590
|
const attrs = chunkWZA5S5EJ_cjs.blockById(editor.state.doc, blockId)?.attrs ?? {};
|
|
2591
2591
|
const changed = chunkWZA5S5EJ_cjs.str(attrs.alt) !== opened.alt || attrs.decorative === true !== opened.decorative;
|
|
2592
2592
|
if (controller.readOnly || controller.root === null || changed) return;
|
|
2593
|
-
|
|
2593
|
+
chunk4SRXM2VS_cjs.onBlock(blockId, chunkLROGC3SI_cjs.setAttrs(patch))(editor.state, (tr) => editor.dispatch(tr));
|
|
2594
2594
|
}
|
|
2595
2595
|
function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative, onClose }) {
|
|
2596
2596
|
const labels = useLabels();
|
|
@@ -2632,7 +2632,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
2632
2632
|
close(true);
|
|
2633
2633
|
};
|
|
2634
2634
|
const onKeyDown = (event) => {
|
|
2635
|
-
if (event.key !== "Tab" ||
|
|
2635
|
+
if (event.key !== "Tab" || chunk4SRXM2VS_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2636
2636
|
const controls = [...event.currentTarget.elements];
|
|
2637
2637
|
const next = controls[controls.indexOf(event.target) + (event.shiftKey ? -1 : 1)];
|
|
2638
2638
|
event.preventDefault();
|
|
@@ -2660,7 +2660,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
2660
2660
|
onCloseAutoFocus: preventDefault,
|
|
2661
2661
|
onEscapeKeyDown: (event) => {
|
|
2662
2662
|
event.preventDefault();
|
|
2663
|
-
if (!
|
|
2663
|
+
if (!chunk4SRXM2VS_cjs.isComposingKey(controller, event)) close(false);
|
|
2664
2664
|
},
|
|
2665
2665
|
...bubblePart(controller),
|
|
2666
2666
|
children: /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, className: "quoin-image-alt", onSubmit: save, onKeyDown, children: [
|
|
@@ -2754,7 +2754,7 @@ function ImageToolbarOverlay({ controller }) {
|
|
|
2754
2754
|
}
|
|
2755
2755
|
function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
2756
2756
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
2757
|
-
const state =
|
|
2757
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
2758
2758
|
const picker = useReplacePicker(controller, blockId, uploadImage, "image/*");
|
|
2759
2759
|
const altButton = React7.useRef(null);
|
|
2760
2760
|
const anchor = usePartAnchor(controller, blockId, ".quoin-image-frame");
|
|
@@ -2986,13 +2986,13 @@ function CalloutToneMenu({ blockId, controller, tone }) {
|
|
|
2986
2986
|
}
|
|
2987
2987
|
var CalloutBlock = ({ block, controller }) => {
|
|
2988
2988
|
const labels = useLabels();
|
|
2989
|
-
const readOnly =
|
|
2989
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
2990
2990
|
const tone = calloutTone(block.attrs.tone);
|
|
2991
2991
|
const icon = calloutIcon(block.attrs, tone);
|
|
2992
2992
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("quoin-callout group/callout flex items-start gap-2", TONE[tone]), "data-tone": tone, children: [
|
|
2993
2993
|
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 }),
|
|
2994
2994
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2995
|
-
|
|
2995
|
+
chunk4SRXM2VS_cjs.EditableRegion,
|
|
2996
2996
|
{
|
|
2997
2997
|
block: block.id,
|
|
2998
2998
|
region: "body",
|
|
@@ -3061,22 +3061,22 @@ var headingStyles = (level) => `quoin-heading mb-1 font-semibold leading-tight i
|
|
|
3061
3061
|
function Heading({ block }) {
|
|
3062
3062
|
const labels = useLabels();
|
|
3063
3063
|
const level = chunkWZA5S5EJ_cjs.headingLevel(block.attrs.level);
|
|
3064
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3064
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.heading(level) }) });
|
|
3065
3065
|
}
|
|
3066
3066
|
function NumberedItem({ block, controller }) {
|
|
3067
3067
|
const labels = useLabels();
|
|
3068
|
-
const number =
|
|
3068
|
+
const number = chunk4SRXM2VS_cjs.useOrderedNumber(controller, block.id);
|
|
3069
3069
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "ordered", children: [
|
|
3070
3070
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "ordered", number, depth: block.indent }),
|
|
3071
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3071
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.numberedItem(number) })
|
|
3072
3072
|
] });
|
|
3073
3073
|
}
|
|
3074
3074
|
function TaskItem({ block, controller }) {
|
|
3075
3075
|
const labels = useLabels();
|
|
3076
|
-
const hostId =
|
|
3076
|
+
const hostId = chunk4SRXM2VS_cjs.useRegionDomId(block.id, REGION);
|
|
3077
3077
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-task", "data-checked": block.attrs.checked === true, children: [
|
|
3078
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3079
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.TaskCheckbox, { block, controller, label: labels.task, labelledBy: hostId }),
|
|
3079
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { id: hostId, block: block.id, region: REGION, label: labels.task })
|
|
3080
3080
|
] });
|
|
3081
3081
|
}
|
|
3082
3082
|
var MarkdownBlock = (props) => {
|
|
@@ -3088,16 +3088,16 @@ var MarkdownBlock = (props) => {
|
|
|
3088
3088
|
case "bullet":
|
|
3089
3089
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "bullet", children: [
|
|
3090
3090
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "bullet", depth: block.indent }),
|
|
3091
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3091
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.bulletItem })
|
|
3092
3092
|
] });
|
|
3093
3093
|
case "ordered":
|
|
3094
3094
|
return /* @__PURE__ */ jsxRuntime.jsx(NumberedItem, { ...props });
|
|
3095
3095
|
case "task":
|
|
3096
3096
|
return /* @__PURE__ */ jsxRuntime.jsx(TaskItem, { ...props });
|
|
3097
3097
|
case "quote":
|
|
3098
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3098
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.quote }) });
|
|
3099
3099
|
default:
|
|
3100
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3100
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.paragraph });
|
|
3101
3101
|
}
|
|
3102
3102
|
};
|
|
3103
3103
|
|
|
@@ -3105,19 +3105,19 @@ var MarkdownBlock = (props) => {
|
|
|
3105
3105
|
function nestedBlockIds({ doc }, blockId) {
|
|
3106
3106
|
const index = doc.index.get(blockId);
|
|
3107
3107
|
if (index === void 0) return [];
|
|
3108
|
-
return doc.blocks.slice(index + 1,
|
|
3108
|
+
return doc.blocks.slice(index + 1, chunkLROGC3SI_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
3109
3109
|
}
|
|
3110
3110
|
function useNestedBlocks(controller, blockId) {
|
|
3111
|
-
return
|
|
3111
|
+
return chunk4SRXM2VS_cjs.useEditorState(controller, (state) => nestedBlockIds(state, blockId), chunkWZA5S5EJ_cjs.sameItems);
|
|
3112
3112
|
}
|
|
3113
3113
|
var ToggleBlock = ({ block, controller }) => {
|
|
3114
3114
|
const labels = useLabels();
|
|
3115
|
-
const domId =
|
|
3115
|
+
const domId = chunk4SRXM2VS_cjs.useBlockDomId();
|
|
3116
3116
|
const nested = useNestedBlocks(controller, block.id);
|
|
3117
|
-
const open =
|
|
3117
|
+
const open = chunk4SRXM2VS_cjs.useToggleOpen(controller, block);
|
|
3118
3118
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-toggle", "data-open": open, children: [
|
|
3119
3119
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3120
|
-
|
|
3120
|
+
chunk4SRXM2VS_cjs.ToggleChevron,
|
|
3121
3121
|
{
|
|
3122
3122
|
block,
|
|
3123
3123
|
controller,
|
|
@@ -3125,7 +3125,7 @@ var ToggleBlock = ({ block, controller }) => {
|
|
|
3125
3125
|
controls: nested.length === 0 ? void 0 : nested.map(domId).join(" ")
|
|
3126
3126
|
}
|
|
3127
3127
|
),
|
|
3128
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3128
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4SRXM2VS_cjs.EditableRegion, { block: block.id, region: "text", label: labels.toggle })
|
|
3129
3129
|
] });
|
|
3130
3130
|
};
|
|
3131
3131
|
|
|
@@ -3184,7 +3184,7 @@ function turnIntoTargets(labels) {
|
|
|
3184
3184
|
function TurnIntoItems({ kit, controller, blockIds }) {
|
|
3185
3185
|
const { blockTypes, labels } = useQuoin();
|
|
3186
3186
|
const targets = turnIntoTargets(labels).filter((target) => drawsType(blockTypes, target.type));
|
|
3187
|
-
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds,
|
|
3187
|
+
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds, chunkLROGC3SI_cjs.setBlockType(target.type, target.attrs)), children: [
|
|
3188
3188
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: target.icon }),
|
|
3189
3189
|
target.label
|
|
3190
3190
|
] }, target.id));
|
|
@@ -3219,10 +3219,10 @@ function ActionItem({ kit, controller, action, blockIds }) {
|
|
|
3219
3219
|
);
|
|
3220
3220
|
}
|
|
3221
3221
|
function BlockMenuItems({ kit, controller, blocks, styled, title, actions }) {
|
|
3222
|
-
const state =
|
|
3222
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
3223
3223
|
const blockIds = blocks.map((block) => block.id);
|
|
3224
3224
|
const shown = actions.filter((action) => action.available?.(state, blockIds) ?? true);
|
|
3225
|
-
const anyText = styled.some((block) =>
|
|
3225
|
+
const anyText = styled.some((block) => chunkLROGC3SI_cjs.isTextFlow(state.schema, block));
|
|
3226
3226
|
const anyMarkdown = styled.some((block) => block.type === "MARKDOWN");
|
|
3227
3227
|
const allCallouts = styled.length > 0 && styled.every((block) => block.type === "CALLOUT");
|
|
3228
3228
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3264,7 +3264,7 @@ var CONTEXT_KIT = {
|
|
|
3264
3264
|
SubTrigger: ContextMenuSubTrigger
|
|
3265
3265
|
};
|
|
3266
3266
|
var GUTTER_BLOCK = "data-quoin-gutter-block";
|
|
3267
|
-
var OWN_MENU = `[${
|
|
3267
|
+
var OWN_MENU = `[${chunk4SRXM2VS_cjs.NATIVE_INTERACTION}], input, textarea, select`;
|
|
3268
3268
|
function contextBlock(controller, target) {
|
|
3269
3269
|
const { state } = controller.editor;
|
|
3270
3270
|
const gutter = target.closest(`[${GUTTER_BLOCK}]`)?.getAttribute(GUTTER_BLOCK);
|
|
@@ -3274,7 +3274,7 @@ function contextBlock(controller, target) {
|
|
|
3274
3274
|
if (target.closest(OWN_MENU) || controller.registry.locate(target) !== null) return null;
|
|
3275
3275
|
const id = controller.blockAt(target);
|
|
3276
3276
|
const block = id === void 0 ? void 0 : chunkWZA5S5EJ_cjs.blockById(state.doc, id);
|
|
3277
|
-
return block === void 0 ||
|
|
3277
|
+
return block === void 0 || chunkLROGC3SI_cjs.isTextFlow(state.schema, block) ? null : block.id;
|
|
3278
3278
|
}
|
|
3279
3279
|
function useContextMenuOpener(controller, store, trigger) {
|
|
3280
3280
|
React7.useEffect(() => {
|
|
@@ -3293,7 +3293,7 @@ function useContextMenuOpener(controller, store, trigger) {
|
|
|
3293
3293
|
openBlockMenuAt(store, controller.editor.state, block, clientX, clientY);
|
|
3294
3294
|
hidden.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX, clientY }));
|
|
3295
3295
|
};
|
|
3296
|
-
return
|
|
3296
|
+
return chunk4SRXM2VS_cjs.listen(root, { mousedown: onMouseDown, contextmenu: onContextMenu });
|
|
3297
3297
|
}, [controller, store, trigger]);
|
|
3298
3298
|
}
|
|
3299
3299
|
|
|
@@ -3329,7 +3329,7 @@ function useLiveBlocks(controller, blockIds) {
|
|
|
3329
3329
|
(state) => blockIds.flatMap((id) => chunkWZA5S5EJ_cjs.blockById(state.doc, id) ?? []),
|
|
3330
3330
|
[blockIds]
|
|
3331
3331
|
);
|
|
3332
|
-
return
|
|
3332
|
+
return chunk4SRXM2VS_cjs.useEditorState(controller, select, chunkWZA5S5EJ_cjs.sameItems);
|
|
3333
3333
|
}
|
|
3334
3334
|
function useMenuBlocks(controller, store, menu) {
|
|
3335
3335
|
const labels = useLabels();
|
|
@@ -3382,12 +3382,12 @@ function BlockContextMenu({ controller, store, actions }) {
|
|
|
3382
3382
|
// src/gutter/block-menu-keymap.ts
|
|
3383
3383
|
function blockMenuKeymap(store) {
|
|
3384
3384
|
const openForHead = (state, dispatch) => {
|
|
3385
|
-
const head =
|
|
3385
|
+
const head = chunkLROGC3SI_cjs.headBlockId(state.selection);
|
|
3386
3386
|
if (head === null || !state.doc.index.has(head)) return false;
|
|
3387
3387
|
if (dispatch) openBlockMenu(store, state, head);
|
|
3388
3388
|
return true;
|
|
3389
3389
|
};
|
|
3390
|
-
return
|
|
3390
|
+
return chunkLROGC3SI_cjs.defineExtension({ name: "block-menu", keymap: { "Mod-/": openForHead } });
|
|
3391
3391
|
}
|
|
3392
3392
|
var UNIQUE_OR_FOCUSABLE = ["id", "data-block-id", "contenteditable", "tabindex"];
|
|
3393
3393
|
function copyOf(shell) {
|
|
@@ -3456,7 +3456,7 @@ var DragOverlay = React7.forwardRef(function DragOverlay2(_props, ref) {
|
|
|
3456
3456
|
var DELETION_STEPS = /* @__PURE__ */ new Set(["removeBlocks", "setIndent"]);
|
|
3457
3457
|
function drawnPosition(doc, blockId) {
|
|
3458
3458
|
const index = doc.index.get(blockId) ?? 0;
|
|
3459
|
-
return [
|
|
3459
|
+
return [chunk4SRXM2VS_cjs.drawnBlockCount(doc, 0, index) + 1, chunk4SRXM2VS_cjs.drawnBlockCount(doc)];
|
|
3460
3460
|
}
|
|
3461
3461
|
function blockMovedMessage(doc, blockId, labels) {
|
|
3462
3462
|
return labels.blockMoved(...drawnPosition(doc, blockId));
|
|
@@ -3472,11 +3472,11 @@ function deletedCount(tr) {
|
|
|
3472
3472
|
return tr.steps.reduce((deleted, step, i) => {
|
|
3473
3473
|
const { index, count } = step.toJSON();
|
|
3474
3474
|
if (step.stepType !== "removeBlocks" || typeof index !== "number" || typeof count !== "number") return deleted;
|
|
3475
|
-
return deleted +
|
|
3475
|
+
return deleted + chunk4SRXM2VS_cjs.drawnBlockCount(tr.docs[i], index, index + count);
|
|
3476
3476
|
}, 0);
|
|
3477
3477
|
}
|
|
3478
3478
|
function insertedBlock(tr) {
|
|
3479
|
-
if (tr.getMeta(
|
|
3479
|
+
if (tr.getMeta(chunkLROGC3SI_cjs.LINE_SPLIT) === true || tr.steps.some((step) => step.stepType === "removeBlocks")) return null;
|
|
3480
3480
|
const inserted = tr.steps.flatMap((step) => {
|
|
3481
3481
|
const { blocks } = step.toJSON();
|
|
3482
3482
|
return step.stepType === "insertBlocks" && Array.isArray(blocks) ? blocks : [];
|
|
@@ -3484,7 +3484,7 @@ function insertedBlock(tr) {
|
|
|
3484
3484
|
return inserted.find((block) => tr.doc.index.has(block.id))?.id ?? null;
|
|
3485
3485
|
}
|
|
3486
3486
|
function structureAnnouncement(tr, labels, undoKeys) {
|
|
3487
|
-
if (tr.origin !== "command" || tr.getMeta(
|
|
3487
|
+
if (tr.origin !== "command" || tr.getMeta(chunkLROGC3SI_cjs.LINE_JOIN) === true) return null;
|
|
3488
3488
|
const moved = movedBlock(tr);
|
|
3489
3489
|
if (moved !== null) return blockMovedMessage(tr.doc, moved, labels);
|
|
3490
3490
|
const deleted = deletedCount(tr);
|
|
@@ -3514,7 +3514,7 @@ function inlineEdges(shell, box, rtl) {
|
|
|
3514
3514
|
function measure(controller, root, moved, rtl) {
|
|
3515
3515
|
const { doc } = controller.editor.state;
|
|
3516
3516
|
const origin = rootOrigin(root);
|
|
3517
|
-
return
|
|
3517
|
+
return chunk4SRXM2VS_cjs.visibleBlockIndexes(doc).flatMap((index) => {
|
|
3518
3518
|
const { id, indent: indent3 } = doc.blocks[index];
|
|
3519
3519
|
const shell = controller.blockElement(id);
|
|
3520
3520
|
if (shell === void 0) return [];
|
|
@@ -3529,7 +3529,7 @@ function measureDrag(controller, root, ids) {
|
|
|
3529
3529
|
const { doc } = controller.editor.state;
|
|
3530
3530
|
const direction = inlineDirection(root);
|
|
3531
3531
|
const rtl = direction === "rtl";
|
|
3532
|
-
const moved = new Set(
|
|
3532
|
+
const moved = new Set(chunkLROGC3SI_cjs.movedBlockIds(doc, ids));
|
|
3533
3533
|
const blocks = measure(controller, root, moved, rtl);
|
|
3534
3534
|
const dragged = blocks.filter((block) => block.dragged);
|
|
3535
3535
|
if (dragged.length === 0) return null;
|
|
@@ -3589,7 +3589,7 @@ function draggedBlocks(controller, blockId) {
|
|
|
3589
3589
|
function followPress(press, root, view) {
|
|
3590
3590
|
const { controller, store, overlay, handle: handle2, pointerId } = press;
|
|
3591
3591
|
const doc = view.document;
|
|
3592
|
-
const scroll =
|
|
3592
|
+
const scroll = chunk4SRXM2VS_cjs.createAutoScroll(root, follow, SCROLL_EDGE);
|
|
3593
3593
|
let pointer = { x: press.x, y: press.y };
|
|
3594
3594
|
let active = null;
|
|
3595
3595
|
let unsubscribe = () => {
|
|
@@ -3642,7 +3642,7 @@ function followPress(press, root, view) {
|
|
|
3642
3642
|
finish();
|
|
3643
3643
|
if (dropped === null || dropped.target === null || controller.readOnly) return;
|
|
3644
3644
|
const { ids, layout, target } = dropped;
|
|
3645
|
-
if (!controller.run(
|
|
3645
|
+
if (!controller.run(chunkLROGC3SI_cjs.moveBlocksTo(ids, layout.toIndex(target.index), target.indent))) return;
|
|
3646
3646
|
controller.focus();
|
|
3647
3647
|
press.onMoved(ids[0]);
|
|
3648
3648
|
}
|
|
@@ -3664,9 +3664,9 @@ function followPress(press, root, view) {
|
|
|
3664
3664
|
event.stopPropagation();
|
|
3665
3665
|
finish();
|
|
3666
3666
|
}
|
|
3667
|
-
const unlistenDocument =
|
|
3668
|
-
const unlistenBlur =
|
|
3669
|
-
const unlistenKeys =
|
|
3667
|
+
const unlistenDocument = chunk4SRXM2VS_cjs.listen(doc, { pointermove: onPointerMove, pointerup: onPointerUp, pointercancel: finish });
|
|
3668
|
+
const unlistenBlur = chunk4SRXM2VS_cjs.listen(view, { blur: finish });
|
|
3669
|
+
const unlistenKeys = chunk4SRXM2VS_cjs.listen(view, { keydown: onKeyDown }, true);
|
|
3670
3670
|
return finish;
|
|
3671
3671
|
}
|
|
3672
3672
|
function pressDragHandle(press) {
|
|
@@ -3720,10 +3720,10 @@ function addBlockBelow(controller, blockId) {
|
|
|
3720
3720
|
const { doc, schema } = state;
|
|
3721
3721
|
const block = chunkWZA5S5EJ_cjs.blockById(doc, blockId);
|
|
3722
3722
|
if (block === void 0) return false;
|
|
3723
|
-
const empty =
|
|
3724
|
-
const fill = empty ?
|
|
3725
|
-
const slash =
|
|
3726
|
-
const { ok, tr } =
|
|
3723
|
+
const empty = chunkLROGC3SI_cjs.isParagraph(block) && chunkLROGC3SI_cjs.regionLength(block, chunkLROGC3SI_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
3724
|
+
const fill = empty ? chunkLROGC3SI_cjs.setSelection(chunkLROGC3SI_cjs.startOf(doc, schema, blockId)) : chunkLROGC3SI_cjs.insertBlockAfter("MARKDOWN", { kind: "paragraph" });
|
|
3725
|
+
const slash = chunkLROGC3SI_cjs.insertText("/", { origin: "command" });
|
|
3726
|
+
const { ok, tr } = chunkLROGC3SI_cjs.runCommands(state, [chunkLROGC3SI_cjs.setSelection(chunkLROGC3SI_cjs.blockRangeSelection(blockId)), fill, slash]);
|
|
3727
3727
|
if (ok && tr !== null) controller.dispatch(tr);
|
|
3728
3728
|
controller.focus();
|
|
3729
3729
|
return ok;
|
|
@@ -3801,7 +3801,7 @@ function place2(controller, root, gutter, block) {
|
|
|
3801
3801
|
gutter.style.visibility = "";
|
|
3802
3802
|
}
|
|
3803
3803
|
function useGutterPosition(controller, gutter, block) {
|
|
3804
|
-
|
|
3804
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
3805
3805
|
const element = gutter.current;
|
|
3806
3806
|
const root = controller.root;
|
|
3807
3807
|
const view = root?.ownerDocument.defaultView;
|
|
@@ -3825,7 +3825,7 @@ function useGutterPosition(controller, gutter, block) {
|
|
|
3825
3825
|
};
|
|
3826
3826
|
}, [controller, gutter, block]);
|
|
3827
3827
|
}
|
|
3828
|
-
var headOf = (state) =>
|
|
3828
|
+
var headOf = (state) => chunkLROGC3SI_cjs.headBlockId(state.selection);
|
|
3829
3829
|
function blockAcross(controller, root, y) {
|
|
3830
3830
|
const box = root.getBoundingClientRect();
|
|
3831
3831
|
const probe = root.ownerDocument.elementFromPoint?.(box.left + box.width / 2, y);
|
|
@@ -3833,7 +3833,7 @@ function blockAcross(controller, root, y) {
|
|
|
3833
3833
|
}
|
|
3834
3834
|
function useGutterTarget(controller, store, gutter) {
|
|
3835
3835
|
const hovered = useCanvasUi(store, (state) => state.hoveredBlock);
|
|
3836
|
-
const head =
|
|
3836
|
+
const head = chunk4SRXM2VS_cjs.useEditorState(controller, headOf);
|
|
3837
3837
|
const [focusWithin, setFocusWithin] = React7.useState(false);
|
|
3838
3838
|
React7.useEffect(() => {
|
|
3839
3839
|
const root = controller.root;
|
|
@@ -3851,7 +3851,7 @@ function useGutterTarget(controller, store, gutter) {
|
|
|
3851
3851
|
const onFocusIn = () => setFocusWithin(true);
|
|
3852
3852
|
const onFocusOut = (event) => setFocusWithin(root.contains(event.relatedTarget));
|
|
3853
3853
|
setFocusWithin(root.contains(root.ownerDocument.activeElement));
|
|
3854
|
-
return
|
|
3854
|
+
return chunk4SRXM2VS_cjs.listen(root, { pointermove: onPointerMove, pointerleave: onPointerLeave, focusin: onFocusIn, focusout: onFocusOut });
|
|
3855
3855
|
}, [controller, store, gutter]);
|
|
3856
3856
|
const fallback = focusWithin ? head : null;
|
|
3857
3857
|
const target = hovered ?? fallback;
|
|
@@ -3948,7 +3948,7 @@ function pointInHost(host, { node, offset }) {
|
|
|
3948
3948
|
return host.contains(node) ? { node, offset: Math.min(offset, nodeLength(node)) } : null;
|
|
3949
3949
|
}
|
|
3950
3950
|
function textRect(host, { from, to }) {
|
|
3951
|
-
const map =
|
|
3951
|
+
const map = chunk4SRXM2VS_cjs.domMapOf(host);
|
|
3952
3952
|
const range = host.ownerDocument.createRange();
|
|
3953
3953
|
if (map === void 0 || typeof range.getBoundingClientRect !== "function") return null;
|
|
3954
3954
|
const start = pointInHost(host, map.toDom(from, 1));
|
|
@@ -3961,7 +3961,7 @@ function textRect(host, { from, to }) {
|
|
|
3961
3961
|
}
|
|
3962
3962
|
function rangeRect(controller, range) {
|
|
3963
3963
|
const host = controller.registry.get(range.block, range.region);
|
|
3964
|
-
if (host === void 0 || !host.isConnected || controller.composingKey ===
|
|
3964
|
+
if (host === void 0 || !host.isConnected || controller.composingKey === chunk4SRXM2VS_cjs.hostKey(range.block, range.region)) {
|
|
3965
3965
|
return null;
|
|
3966
3966
|
}
|
|
3967
3967
|
const rect = textRect(host, range);
|
|
@@ -3977,7 +3977,7 @@ function union(a, b) {
|
|
|
3977
3977
|
function selectionRect(controller) {
|
|
3978
3978
|
const { state } = controller.editor;
|
|
3979
3979
|
if (state.selection?.kind !== "text") return null;
|
|
3980
|
-
const ranges =
|
|
3980
|
+
const ranges = chunkLROGC3SI_cjs.markRanges(state);
|
|
3981
3981
|
if (ranges.length === 0) return null;
|
|
3982
3982
|
const first = rangeRect(controller, ranges[0]);
|
|
3983
3983
|
if (ranges.length === 1) return first;
|
|
@@ -3988,7 +3988,7 @@ function selectionRect(controller) {
|
|
|
3988
3988
|
// src/menus/floating/use-selection-anchor.ts
|
|
3989
3989
|
var ROOM_ABOVE = 56;
|
|
3990
3990
|
function selectionHost(controller) {
|
|
3991
|
-
const [first] =
|
|
3991
|
+
const [first] = chunkLROGC3SI_cjs.markRanges(controller.editor.state);
|
|
3992
3992
|
return (first && controller.registry.get(first.block, first.region)) ?? controller.root ?? void 0;
|
|
3993
3993
|
}
|
|
3994
3994
|
function useSelectionAnchor(controller, state) {
|
|
@@ -4002,7 +4002,7 @@ function useSelectionAnchor(controller, state) {
|
|
|
4002
4002
|
[controller, state]
|
|
4003
4003
|
);
|
|
4004
4004
|
const [side, setSide] = React7.useState("top");
|
|
4005
|
-
|
|
4005
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4006
4006
|
const rect = selectionRect(controller);
|
|
4007
4007
|
if (rect) setSide(rect.top < ROOM_ABOVE ? "bottom" : "top");
|
|
4008
4008
|
}, [controller, state]);
|
|
@@ -4037,7 +4037,7 @@ var ICONS = { left: lucideReact.AlignLeft, center: lucideReact.AlignCenter, righ
|
|
|
4037
4037
|
var ALIGNS2 = Object.keys(ICONS);
|
|
4038
4038
|
var LABEL_KEYS = { left: "alignLeft", center: "alignCenter", right: "alignRight", justify: "alignJustify" };
|
|
4039
4039
|
function sharedAlign(state) {
|
|
4040
|
-
const blocks =
|
|
4040
|
+
const blocks = chunkLROGC3SI_cjs.selectedBlockIds(state.doc, state.selection).map((id) => chunkWZA5S5EJ_cjs.blockById(state.doc, id)).filter((block) => block?.type === "MARKDOWN");
|
|
4041
4041
|
if (blocks.length === 0) return null;
|
|
4042
4042
|
const aligns = new Set(blocks.map((block) => chunkWZA5S5EJ_cjs.alignOrUndefined(block?.attrs.align) ?? "left"));
|
|
4043
4043
|
return aligns.size === 1 ? [...aligns][0] : "";
|
|
@@ -4048,7 +4048,7 @@ function AlignDropdown({ controller, state }) {
|
|
|
4048
4048
|
if (value === null) return null;
|
|
4049
4049
|
const Icon = value === "" ? lucideReact.AlignLeft : ICONS[value];
|
|
4050
4050
|
const trigger = /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.align, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {}) });
|
|
4051
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(
|
|
4051
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(chunkLROGC3SI_cjs.setTextAlign(align)), children: ALIGNS2.map((align) => /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuRadioItem, { value: align, indicator: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }), children: [
|
|
4052
4052
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: ICONS[align] }),
|
|
4053
4053
|
labels[LABEL_KEYS[align]]
|
|
4054
4054
|
] }, align)) }) });
|
|
@@ -4056,8 +4056,8 @@ function AlignDropdown({ controller, state }) {
|
|
|
4056
4056
|
var MARKS = { color: "color", background: "highlight" };
|
|
4057
4057
|
function selectionColor(state, mark) {
|
|
4058
4058
|
const names = /* @__PURE__ */ new Set();
|
|
4059
|
-
for (const range of
|
|
4060
|
-
for (const node of
|
|
4059
|
+
for (const range of chunkLROGC3SI_cjs.markRanges(state)) {
|
|
4060
|
+
for (const node of chunkLROGC3SI_cjs.rangeContent(state, range)) {
|
|
4061
4061
|
const found = node.marks.find((candidate) => candidate.type === mark);
|
|
4062
4062
|
names.add(found === void 0 ? "default" : found.attrs?.color);
|
|
4063
4063
|
}
|
|
@@ -4066,7 +4066,7 @@ function selectionColor(state, mark) {
|
|
|
4066
4066
|
return names.size === 1 && typeof only === "string" ? only : "";
|
|
4067
4067
|
}
|
|
4068
4068
|
function colorCommand(key, name) {
|
|
4069
|
-
return name === "default" ?
|
|
4069
|
+
return name === "default" ? chunkLROGC3SI_cjs.unsetMark(MARKS[key]) : chunkLROGC3SI_cjs.setMark(MARKS[key], { color: name });
|
|
4070
4070
|
}
|
|
4071
4071
|
function ColorPopover({ controller, state }) {
|
|
4072
4072
|
const labels = useLabels();
|
|
@@ -4080,11 +4080,11 @@ function TurnIntoDropdown({ controller, state }) {
|
|
|
4080
4080
|
labels.turnInto,
|
|
4081
4081
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {})
|
|
4082
4082
|
] });
|
|
4083
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds:
|
|
4083
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds: chunkLROGC3SI_cjs.selectedBlockIds(state.doc, state.selection) }) });
|
|
4084
4084
|
}
|
|
4085
4085
|
var DIVIDER = "mx-0.5 h-5 w-px shrink-0 bg-border";
|
|
4086
4086
|
function BubbleToolbar({ controller, labels, store, extraItems }) {
|
|
4087
|
-
const state =
|
|
4087
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
4088
4088
|
const { anchor, side } = useSelectionAnchor(controller, state);
|
|
4089
4089
|
const roving = useRovingFocus();
|
|
4090
4090
|
const items = React7.useMemo(() => bubbleItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -4146,10 +4146,10 @@ function useMediaQuery(query, unsupported) {
|
|
|
4146
4146
|
var useFinePointer = () => useMediaQuery("(pointer: fine)", true);
|
|
4147
4147
|
|
|
4148
4148
|
// src/menus/bubble/use-bubble-visibility.ts
|
|
4149
|
-
var hasTextRange = (state) => state.selection?.kind === "text" && !
|
|
4149
|
+
var hasTextRange = (state) => state.selection?.kind === "text" && !chunkLROGC3SI_cjs.isCollapsed(state.selection) && chunkLROGC3SI_cjs.markRanges(state).length > 0;
|
|
4150
4150
|
function useBubbleVisibility(controller) {
|
|
4151
|
-
const range =
|
|
4152
|
-
const readOnly =
|
|
4151
|
+
const range = chunk4SRXM2VS_cjs.useEditorState(controller, hasTextRange);
|
|
4152
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
4153
4153
|
const fine = useFinePointer();
|
|
4154
4154
|
const settled = useSelectionSettled(controller);
|
|
4155
4155
|
return range && !readOnly && fine && settled;
|
|
@@ -4166,14 +4166,14 @@ function BubbleOverlay({ controller }) {
|
|
|
4166
4166
|
return /* @__PURE__ */ jsxRuntime.jsx(BubbleToolbar, { controller, labels, store, extraItems });
|
|
4167
4167
|
}
|
|
4168
4168
|
function bubbleExtension() {
|
|
4169
|
-
return
|
|
4169
|
+
return chunkLROGC3SI_cjs.defineExtension({ name: "bubble", ui: { overlays: [BubbleOverlay] } });
|
|
4170
4170
|
}
|
|
4171
4171
|
|
|
4172
4172
|
// src/menus/link/link-at-selection.ts
|
|
4173
4173
|
function linkAround(state, from, to = from) {
|
|
4174
4174
|
if (from.block !== to.block || from.region !== to.region) return null;
|
|
4175
|
-
const inline =
|
|
4176
|
-
const extent =
|
|
4175
|
+
const inline = chunk4SRXM2VS_cjs.regionInline(state, from.block, from.region) ?? [];
|
|
4176
|
+
const extent = chunkLROGC3SI_cjs.markExtent(inline, from.offset, "link");
|
|
4177
4177
|
if (extent === null || to.offset > extent.to) return null;
|
|
4178
4178
|
const attrs = chunkWZA5S5EJ_cjs.sliceInline(inline, extent.from, extent.to)[0]?.marks.find((mark) => mark.type === "link")?.attrs;
|
|
4179
4179
|
if (attrs?.href === void 0) return null;
|
|
@@ -4183,7 +4183,7 @@ function linkAround(state, from, to = from) {
|
|
|
4183
4183
|
function linkAtSelection(state) {
|
|
4184
4184
|
const { selection } = state;
|
|
4185
4185
|
if (selection?.kind !== "text") return null;
|
|
4186
|
-
const { from, to } =
|
|
4186
|
+
const { from, to } = chunkLROGC3SI_cjs.orderedRange(state.doc, selection.anchor, selection.head);
|
|
4187
4187
|
return linkAround(state, from, to);
|
|
4188
4188
|
}
|
|
4189
4189
|
|
|
@@ -4195,7 +4195,7 @@ function linkElementAt(controller, target) {
|
|
|
4195
4195
|
}
|
|
4196
4196
|
function linkAtElement(controller, state, element) {
|
|
4197
4197
|
const host = controller.registry.locate(element);
|
|
4198
|
-
const offset = host === null ? null :
|
|
4198
|
+
const offset = host === null ? null : chunk4SRXM2VS_cjs.domMapOf(host.element)?.fromDom(element, 0) ?? null;
|
|
4199
4199
|
if (host === null || offset === null) return null;
|
|
4200
4200
|
return linkAround(state, { block: host.block, region: host.region, offset });
|
|
4201
4201
|
}
|
|
@@ -4221,7 +4221,7 @@ function truncateMiddle(text2, max) {
|
|
|
4221
4221
|
// src/menus/link/unlink-range.ts
|
|
4222
4222
|
function unlinkRange({ block, region, from, to }) {
|
|
4223
4223
|
return (state, dispatch) => {
|
|
4224
|
-
const tr = new
|
|
4224
|
+
const tr = new chunkLROGC3SI_cjs.Transaction(state).step(chunkLROGC3SI_cjs.removeMarkStep(block, region, from, to, "link"));
|
|
4225
4225
|
if (!tr.docChanged) return false;
|
|
4226
4226
|
dispatch?.(tr);
|
|
4227
4227
|
return true;
|
|
@@ -4243,12 +4243,12 @@ function useRestedValue(value, delay) {
|
|
|
4243
4243
|
// src/menus/link/use-caret-in-link.ts
|
|
4244
4244
|
function caretLinkKey(state) {
|
|
4245
4245
|
const { selection } = state;
|
|
4246
|
-
if (selection?.kind !== "text" || !
|
|
4246
|
+
if (selection?.kind !== "text" || !chunkLROGC3SI_cjs.isCollapsed(selection)) return null;
|
|
4247
4247
|
const link = linkAtSelection(state);
|
|
4248
4248
|
return link && [link.range.block, link.range.region, link.range.from, link.href].join("\0");
|
|
4249
4249
|
}
|
|
4250
4250
|
function useCaretInLink(controller, delay) {
|
|
4251
|
-
const key =
|
|
4251
|
+
const key = chunk4SRXM2VS_cjs.useEditorState(controller, caretLinkKey);
|
|
4252
4252
|
const settled = useSelectionSettled(controller);
|
|
4253
4253
|
return useRestedValue(settled ? key : null, delay) !== null;
|
|
4254
4254
|
}
|
|
@@ -4282,7 +4282,7 @@ var URL_LENGTH = 48;
|
|
|
4282
4282
|
var CARD = "flex w-auto items-center gap-0.5 py-1 ps-3 pe-1 shadow-md";
|
|
4283
4283
|
var ADDRESS = "me-1 whitespace-nowrap text-sm text-muted-foreground";
|
|
4284
4284
|
function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
4285
|
-
const state =
|
|
4285
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
4286
4286
|
const link = React7.useMemo(
|
|
4287
4287
|
() => element === null ? linkAtSelection(state) : linkAtElement(controller, state, element),
|
|
4288
4288
|
[controller, state, element]
|
|
@@ -4299,8 +4299,8 @@ function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
|
4299
4299
|
const address = truncateMiddle(link.href, URL_LENGTH);
|
|
4300
4300
|
const edit2 = () => {
|
|
4301
4301
|
if (element !== null) {
|
|
4302
|
-
const selection =
|
|
4303
|
-
|
|
4302
|
+
const selection = chunkLROGC3SI_cjs.textSelection({ block, region, offset: from }, { block, region, offset: to });
|
|
4303
|
+
chunk4SRXM2VS_cjs.dispatchSelection(controller, selection);
|
|
4304
4304
|
}
|
|
4305
4305
|
store.set({ linkPopover: { open: true } });
|
|
4306
4306
|
};
|
|
@@ -4346,8 +4346,8 @@ function insertLinkedText(value, href, caret) {
|
|
|
4346
4346
|
return (state, dispatch) => {
|
|
4347
4347
|
if (!safe) return false;
|
|
4348
4348
|
const link = { type: "link", attrs: { href: safe } };
|
|
4349
|
-
const marks = chunkWZA5S5EJ_cjs.addMark(
|
|
4350
|
-
const tr = new
|
|
4349
|
+
const marks = chunkWZA5S5EJ_cjs.addMark(chunkLROGC3SI_cjs.caretMarks(state.doc, state.schema, state.storedMarks, caret), link);
|
|
4350
|
+
const tr = new chunkLROGC3SI_cjs.Transaction(state).step(chunkLROGC3SI_cjs.replaceInlineStep(caret.block, caret.region, caret.offset, caret.offset, [chunkWZA5S5EJ_cjs.text(value, marks)])).setSelection(chunkLROGC3SI_cjs.textSelection({ ...caret, offset: caret.offset + value.length }));
|
|
4351
4351
|
dispatch?.(tr);
|
|
4352
4352
|
return true;
|
|
4353
4353
|
};
|
|
@@ -4356,10 +4356,10 @@ function applyLink(href, value) {
|
|
|
4356
4356
|
return (state, dispatch) => {
|
|
4357
4357
|
const { selection } = state;
|
|
4358
4358
|
const link = linkAtSelection(state);
|
|
4359
|
-
if (selection?.kind === "text" &&
|
|
4359
|
+
if (selection?.kind === "text" && chunkLROGC3SI_cjs.isCollapsed(selection) && link === null) {
|
|
4360
4360
|
return insertLinkedText(value, href, selection.head)(state, dispatch);
|
|
4361
4361
|
}
|
|
4362
|
-
return
|
|
4362
|
+
return chunkLROGC3SI_cjs.setLink(href, link?.title)(state, dispatch);
|
|
4363
4363
|
};
|
|
4364
4364
|
}
|
|
4365
4365
|
var CONTENT2 = "w-80 p-2 shadow-md";
|
|
@@ -4370,7 +4370,7 @@ function popoverAnchor(controller, link) {
|
|
|
4370
4370
|
if (selection?.kind !== "text") return null;
|
|
4371
4371
|
const { block, region, offset } = selection.head;
|
|
4372
4372
|
const caret = link?.range ?? { block, region, from: offset, to: offset };
|
|
4373
|
-
const collapsed =
|
|
4373
|
+
const collapsed = chunkLROGC3SI_cjs.isCollapsed(selection);
|
|
4374
4374
|
return virtualAnchor(
|
|
4375
4375
|
() => collapsed ? rangeRect(controller, caret) : selectionRect(controller),
|
|
4376
4376
|
() => controller.registry.get(block, region)
|
|
@@ -4399,7 +4399,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4399
4399
|
backToText();
|
|
4400
4400
|
};
|
|
4401
4401
|
const remove = () => {
|
|
4402
|
-
controller.run(
|
|
4402
|
+
controller.run(chunkLROGC3SI_cjs.unsetLink);
|
|
4403
4403
|
backToText();
|
|
4404
4404
|
};
|
|
4405
4405
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4467,7 +4467,7 @@ function LinkOverlay({ controller }) {
|
|
|
4467
4467
|
const labels = useLabels();
|
|
4468
4468
|
const store = useCanvasUiStore();
|
|
4469
4469
|
const popoverOpen = useCanvasUi(store, isPopoverOpen);
|
|
4470
|
-
const readOnly =
|
|
4470
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
4471
4471
|
useLinkClicks(controller);
|
|
4472
4472
|
React7.useEffect(() => {
|
|
4473
4473
|
if (readOnly && store.get().linkPopover.open) store.set({ linkPopover: { open: false } });
|
|
@@ -4482,7 +4482,7 @@ function linkExtension(store) {
|
|
|
4482
4482
|
if (dispatch) store.set({ linkPopover: { open: true } });
|
|
4483
4483
|
return true;
|
|
4484
4484
|
};
|
|
4485
|
-
return
|
|
4485
|
+
return chunkLROGC3SI_cjs.defineExtension({ name: "link", keymap: { "Mod-k": openPopover }, ui: { overlays: [LinkOverlay] } });
|
|
4486
4486
|
}
|
|
4487
4487
|
|
|
4488
4488
|
// src/menus/suggestion/find-trigger.ts
|
|
@@ -4507,7 +4507,7 @@ function triggerOffset(text2, start, config) {
|
|
|
4507
4507
|
}
|
|
4508
4508
|
function findTrigger(state, config) {
|
|
4509
4509
|
const { doc, selection } = state;
|
|
4510
|
-
if (selection?.kind !== "text" || !
|
|
4510
|
+
if (selection?.kind !== "text" || !chunkLROGC3SI_cjs.isCollapsed(selection)) return null;
|
|
4511
4511
|
const { block: blockId, region, offset: caret } = selection.head;
|
|
4512
4512
|
const block = chunkWZA5S5EJ_cjs.blockById(doc, blockId);
|
|
4513
4513
|
if (block === void 0 || NO_TRIGGER_TYPES.has(block.type) || !Object.hasOwn(block.regions, region)) return null;
|
|
@@ -4545,7 +4545,7 @@ function suggestionPlugin(key, config) {
|
|
|
4545
4545
|
init: (state) => ({ active: nearest(state, findTrigger(state, config)), dismissedAt: null }),
|
|
4546
4546
|
apply(tr, value, oldState, newState) {
|
|
4547
4547
|
const dismissing = tr.getMeta(DISMISS) === key.name;
|
|
4548
|
-
if (!dismissing && !tr.docChanged &&
|
|
4548
|
+
if (!dismissing && !tr.docChanged && chunkLROGC3SI_cjs.sameSelection(oldState.selection, newState.selection)) return value;
|
|
4549
4549
|
const found = findTrigger(newState, config);
|
|
4550
4550
|
let dismissedAt = null;
|
|
4551
4551
|
if (dismissing) dismissedAt = found && rangeOf2(found);
|
|
@@ -4562,14 +4562,14 @@ function suggestionPlugin(key, config) {
|
|
|
4562
4562
|
}
|
|
4563
4563
|
function dismissSuggestion(key) {
|
|
4564
4564
|
return (state, dispatch) => {
|
|
4565
|
-
if (
|
|
4566
|
-
dispatch?.(new
|
|
4565
|
+
if (chunkLROGC3SI_cjs.getPluginState(state, key).active === null) return false;
|
|
4566
|
+
dispatch?.(new chunkLROGC3SI_cjs.Transaction(state).setMeta(DISMISS, key.name));
|
|
4567
4567
|
return true;
|
|
4568
4568
|
};
|
|
4569
4569
|
}
|
|
4570
4570
|
|
|
4571
4571
|
// src/menus/slash/slash-key.ts
|
|
4572
|
-
var slashKey =
|
|
4572
|
+
var slashKey = chunkLROGC3SI_cjs.createPluginKey("slash");
|
|
4573
4573
|
var DETAILS = {
|
|
4574
4574
|
text: { group: "basic", keywords: ["paragraph", "plain"], shortcut: "Mod-Alt-0" },
|
|
4575
4575
|
heading1: { group: "basic", keywords: ["h1", "title", "#"], shortcut: "Mod-Alt-1" },
|
|
@@ -4645,10 +4645,10 @@ function useRangeAnchor(controller, range) {
|
|
|
4645
4645
|
const [side, setSide] = React7.useState("bottom");
|
|
4646
4646
|
const latest = React7.useRef(range);
|
|
4647
4647
|
const start = range === null ? null : `${range.block} ${range.region} ${range.from}`;
|
|
4648
|
-
|
|
4648
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4649
4649
|
latest.current = range;
|
|
4650
4650
|
});
|
|
4651
|
-
|
|
4651
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4652
4652
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
4653
4653
|
if (rect) setSide(sideFor(rect, window.innerHeight));
|
|
4654
4654
|
}, [controller, start]);
|
|
@@ -4674,11 +4674,11 @@ function openCombobox(host, listboxId) {
|
|
|
4674
4674
|
}
|
|
4675
4675
|
function useComboboxHost(controller, block, region, listboxId, activeOptionId) {
|
|
4676
4676
|
const host = React7.useRef(null);
|
|
4677
|
-
|
|
4677
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4678
4678
|
host.current = block === null || region === null ? null : controller.registry.get(block, region) ?? null;
|
|
4679
4679
|
return host.current === null ? void 0 : openCombobox(host.current, listboxId);
|
|
4680
4680
|
}, [controller, block, region, listboxId]);
|
|
4681
|
-
|
|
4681
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4682
4682
|
if (host.current !== null) restore(host.current, "aria-activedescendant", activeOptionId);
|
|
4683
4683
|
}, [block, region, activeOptionId]);
|
|
4684
4684
|
}
|
|
@@ -4724,10 +4724,10 @@ function handle(event, menu) {
|
|
|
4724
4724
|
}
|
|
4725
4725
|
function useSuggestionKeys(controller, open, menu) {
|
|
4726
4726
|
const latest = React7.useRef(menu);
|
|
4727
|
-
|
|
4727
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4728
4728
|
latest.current = menu;
|
|
4729
4729
|
});
|
|
4730
|
-
|
|
4730
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4731
4731
|
if (!open) return;
|
|
4732
4732
|
const intercept = (event) => {
|
|
4733
4733
|
const handled = handle(event, latest.current);
|
|
@@ -4748,10 +4748,10 @@ var isPromise = (value) => typeof value?.then === "function";
|
|
|
4748
4748
|
function useSuggestionResults(source, query, onError) {
|
|
4749
4749
|
const [answer, setAnswer] = React7.useState(FORGOTTEN);
|
|
4750
4750
|
const report = React7.useRef(onError);
|
|
4751
|
-
|
|
4751
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4752
4752
|
report.current = onError;
|
|
4753
4753
|
});
|
|
4754
|
-
|
|
4754
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4755
4755
|
if (query === null) {
|
|
4756
4756
|
setAnswer(FORGOTTEN);
|
|
4757
4757
|
return;
|
|
@@ -4795,9 +4795,9 @@ function useSuggestion({
|
|
|
4795
4795
|
emptyLabel
|
|
4796
4796
|
}) {
|
|
4797
4797
|
const { labels, onError } = useQuoin();
|
|
4798
|
-
const readOnly =
|
|
4799
|
-
const selectTrigger = React7.useCallback((state) =>
|
|
4800
|
-
const active =
|
|
4798
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
4799
|
+
const selectTrigger = React7.useCallback((state) => chunkLROGC3SI_cjs.getPluginState(state, pluginKey).active, [pluginKey]);
|
|
4800
|
+
const active = chunk4SRXM2VS_cjs.useEditorState(controller, selectTrigger);
|
|
4801
4801
|
const trigger = readOnly ? null : active;
|
|
4802
4802
|
const results = useSuggestionResults(source, trigger?.query ?? null, onError);
|
|
4803
4803
|
const sections = React7.useMemo(() => groupItems(results.items, groupOf2), [results.items, groupOf2]);
|
|
@@ -4819,7 +4819,7 @@ function useSuggestion({
|
|
|
4819
4819
|
);
|
|
4820
4820
|
const select = React7.useCallback(
|
|
4821
4821
|
(index) => {
|
|
4822
|
-
const current =
|
|
4822
|
+
const current = chunkLROGC3SI_cjs.getPluginState(controller.editor.state, pluginKey).active;
|
|
4823
4823
|
if (current !== null && index < ordered.length) onSelect(ordered[index], rangeOf2(current));
|
|
4824
4824
|
},
|
|
4825
4825
|
[controller, pluginKey, ordered, onSelect]
|
|
@@ -4867,7 +4867,7 @@ function SuggestionMenu(props) {
|
|
|
4867
4867
|
const { trigger, sections, activeIndex, listboxId } = suggestion;
|
|
4868
4868
|
const { anchor, side } = useRangeAnchor(controller, trigger);
|
|
4869
4869
|
const listbox = React7.useRef(null);
|
|
4870
|
-
|
|
4870
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
4871
4871
|
listbox.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
4872
4872
|
}, [activeIndex, sections]);
|
|
4873
4873
|
if (trigger === null) return null;
|
|
@@ -4926,14 +4926,14 @@ function SuggestionMenu(props) {
|
|
|
4926
4926
|
// src/menus/suggestion/replace-trigger.ts
|
|
4927
4927
|
function deleteTrigger({ block, region, from, to }) {
|
|
4928
4928
|
return (state, dispatch) => {
|
|
4929
|
-
const tr = new
|
|
4930
|
-
if (from >= to || !tr.maybeStep(
|
|
4931
|
-
dispatch?.(tr.setSelection(
|
|
4929
|
+
const tr = new chunkLROGC3SI_cjs.Transaction(state);
|
|
4930
|
+
if (from >= to || !tr.maybeStep(chunkLROGC3SI_cjs.replaceInlineStep(block, region, from, to, []))) return false;
|
|
4931
|
+
dispatch?.(tr.setSelection(chunkLROGC3SI_cjs.textSelection({ block, region, offset: from })));
|
|
4932
4932
|
return true;
|
|
4933
4933
|
};
|
|
4934
4934
|
}
|
|
4935
4935
|
function triggerReplacement(state, range, command) {
|
|
4936
|
-
return
|
|
4936
|
+
return chunkLROGC3SI_cjs.runCommands(state, command === void 0 ? [deleteTrigger(range)] : [deleteTrigger(range), command]);
|
|
4937
4937
|
}
|
|
4938
4938
|
function replaceTrigger(controller, range, command) {
|
|
4939
4939
|
const { ok, tr } = triggerReplacement(controller.editor.state, range, command);
|
|
@@ -4946,7 +4946,7 @@ var TEXT_STEPS = /* @__PURE__ */ new Set(["replaceInline", "addMark", "removeMar
|
|
|
4946
4946
|
var WHITESPACE3 = /\s/;
|
|
4947
4947
|
var changesBlocks = (tr) => tr !== null && tr.steps.some((step) => !TEXT_STEPS.has(step.stepType));
|
|
4948
4948
|
function withSpaceBefore(state, range) {
|
|
4949
|
-
const inline =
|
|
4949
|
+
const inline = chunk4SRXM2VS_cjs.regionInline(state, range.block, range.region);
|
|
4950
4950
|
if (inline === void 0 || range.from === 0) return null;
|
|
4951
4951
|
const text2 = chunkWZA5S5EJ_cjs.inlineText(inline);
|
|
4952
4952
|
const after = text2.charAt(range.to);
|
|
@@ -5053,7 +5053,7 @@ function SlashOverlay({ controller }) {
|
|
|
5053
5053
|
return /* @__PURE__ */ jsxRuntime.jsx(SlashMenu, { controller, labels, items });
|
|
5054
5054
|
}
|
|
5055
5055
|
function slashExtension() {
|
|
5056
|
-
return
|
|
5056
|
+
return chunkLROGC3SI_cjs.defineExtension({
|
|
5057
5057
|
name: "slash",
|
|
5058
5058
|
plugins: [suggestionPlugin(slashKey, { char: "/" })],
|
|
5059
5059
|
ui: { overlays: [SlashOverlay] }
|
|
@@ -5063,7 +5063,7 @@ function commandItem(id, title, icon, command) {
|
|
|
5063
5063
|
return { id, title, icon, run: (controller) => void controller.run(command) };
|
|
5064
5064
|
}
|
|
5065
5065
|
function addBlockAtCaret(controller) {
|
|
5066
|
-
const block =
|
|
5066
|
+
const block = chunkLROGC3SI_cjs.headBlockId(controller.editor.state.selection);
|
|
5067
5067
|
if (block !== null) addBlockBelow(controller, block);
|
|
5068
5068
|
}
|
|
5069
5069
|
function mobileItems(labels, openLink) {
|
|
@@ -5075,10 +5075,10 @@ function mobileItems(labels, openLink) {
|
|
|
5075
5075
|
markItem("strike", labels.strike, lucideReact.Strikethrough),
|
|
5076
5076
|
markItem("code", labels.code, lucideReact.Code),
|
|
5077
5077
|
linkItem(labels, openLink),
|
|
5078
|
-
commandItem("indent", labels.indent, lucideReact.ListIndentIncrease,
|
|
5079
|
-
commandItem("outdent", labels.outdent, lucideReact.ListIndentDecrease,
|
|
5080
|
-
commandItem("undo", labels.undo, lucideReact.Undo2,
|
|
5081
|
-
commandItem("redo", labels.redo, lucideReact.Redo2,
|
|
5078
|
+
commandItem("indent", labels.indent, lucideReact.ListIndentIncrease, chunkLROGC3SI_cjs.indent),
|
|
5079
|
+
commandItem("outdent", labels.outdent, lucideReact.ListIndentDecrease, chunkLROGC3SI_cjs.outdent),
|
|
5080
|
+
commandItem("undo", labels.undo, lucideReact.Undo2, chunkLROGC3SI_cjs.undo),
|
|
5081
|
+
commandItem("redo", labels.redo, lucideReact.Redo2, chunkLROGC3SI_cjs.redo)
|
|
5082
5082
|
]
|
|
5083
5083
|
};
|
|
5084
5084
|
}
|
|
@@ -5132,7 +5132,7 @@ function placement(viewport) {
|
|
|
5132
5132
|
function EditingTools({ controller }) {
|
|
5133
5133
|
const labels = useLabels();
|
|
5134
5134
|
const store = useCanvasUiStore();
|
|
5135
|
-
const state =
|
|
5135
|
+
const state = chunk4SRXM2VS_cjs.useEditorState(controller, chunk4SRXM2VS_cjs.wholeState);
|
|
5136
5136
|
const viewport = useVisualViewport();
|
|
5137
5137
|
const roving = useRovingFocus();
|
|
5138
5138
|
const items = React7.useMemo(() => mobileItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -5389,7 +5389,7 @@ function shortcutsExtension(store) {
|
|
|
5389
5389
|
if (dispatch) store.set({ shortcutsOpen: true });
|
|
5390
5390
|
return true;
|
|
5391
5391
|
};
|
|
5392
|
-
return
|
|
5392
|
+
return chunkLROGC3SI_cjs.defineExtension({
|
|
5393
5393
|
name: "shortcuts",
|
|
5394
5394
|
keymap: { [SHORTCUT]: open, "Mod-Shift-?": open },
|
|
5395
5395
|
ui: { overlays: [ShortcutsOverlay] }
|
|
@@ -5425,8 +5425,8 @@ function writeBlockData(controller, blockId, data) {
|
|
|
5425
5425
|
const block = doc.blocks[index];
|
|
5426
5426
|
const { attrs, regions } = chunkWZA5S5EJ_cjs.specFor(schema, block.type).fromData(data, editor.codec.context);
|
|
5427
5427
|
if (chunkWZA5S5EJ_cjs.sameValue(attrs, block.attrs) && chunkWZA5S5EJ_cjs.sameValue(regions, block.regions)) return;
|
|
5428
|
-
const tr = editor.createTransaction().step(
|
|
5429
|
-
editor.dispatch(tr.setMeta(
|
|
5428
|
+
const tr = editor.createTransaction().step(chunkLROGC3SI_cjs.replaceBlockStep({ ...block, attrs, regions }));
|
|
5429
|
+
editor.dispatch(tr.setMeta(chunkLROGC3SI_cjs.HISTORY_GROUP, `block-data:${blockId}`));
|
|
5430
5430
|
}
|
|
5431
5431
|
function insertAfterBlock(controller, blockId, type, definitions, onError) {
|
|
5432
5432
|
const editor = internal(controller);
|
|
@@ -5456,7 +5456,7 @@ function runHistoryKey(controller, event) {
|
|
|
5456
5456
|
}
|
|
5457
5457
|
function useBlockIndex(controller, blockId) {
|
|
5458
5458
|
const select = React7.useCallback((state) => state.doc.index.get(blockId) ?? -1, [blockId]);
|
|
5459
|
-
return
|
|
5459
|
+
return chunk4SRXM2VS_cjs.useEditorState(controller, select);
|
|
5460
5460
|
}
|
|
5461
5461
|
var FOCUSABLE = [
|
|
5462
5462
|
"input:not([disabled])",
|
|
@@ -5483,8 +5483,8 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5483
5483
|
const leaveUnlessInside = (event) => {
|
|
5484
5484
|
if (!inside.current.has(event)) stop();
|
|
5485
5485
|
};
|
|
5486
|
-
const unlistenCapture =
|
|
5487
|
-
const unlisten =
|
|
5486
|
+
const unlistenCapture = chunk4SRXM2VS_cjs.listen(doc, { pointerdown: leaveForCanvas }, true);
|
|
5487
|
+
const unlisten = chunk4SRXM2VS_cjs.listen(doc, { pointerdown: leaveUnlessInside, focusin: leaveUnlessInside });
|
|
5488
5488
|
return () => {
|
|
5489
5489
|
unlistenCapture();
|
|
5490
5490
|
unlisten();
|
|
@@ -5513,8 +5513,8 @@ function VoidEditor({ Editor, controller, ...props }) {
|
|
|
5513
5513
|
}
|
|
5514
5514
|
function VoidBlock({ block, controller, definition }) {
|
|
5515
5515
|
const { blockTypes, labels } = useQuoin();
|
|
5516
|
-
const { report } = React7.useContext(
|
|
5517
|
-
const readOnly =
|
|
5516
|
+
const { report } = React7.useContext(chunk4SRXM2VS_cjs.BlockErrorContext);
|
|
5517
|
+
const readOnly = chunk4SRXM2VS_cjs.useReadOnly(controller);
|
|
5518
5518
|
const { editor: Editor, alwaysEditing = false } = definition;
|
|
5519
5519
|
const name = blockTypeLabel(labels, block, blockTypes);
|
|
5520
5520
|
const blockId = block.id;
|
|
@@ -5578,7 +5578,7 @@ function VoidBlock({ block, controller, definition }) {
|
|
|
5578
5578
|
role: "group",
|
|
5579
5579
|
"aria-label": name,
|
|
5580
5580
|
tabIndex: editorShown ? -1 : void 0,
|
|
5581
|
-
...{ [
|
|
5581
|
+
...{ [chunk4SRXM2VS_cjs.NATIVE_INTERACTION]: editorShown ? "" : void 0 },
|
|
5582
5582
|
onKeyDown,
|
|
5583
5583
|
...focusHandlers,
|
|
5584
5584
|
onClick,
|
|
@@ -5679,7 +5679,7 @@ function fileBlock(file, stored) {
|
|
|
5679
5679
|
}
|
|
5680
5680
|
function anchorBlock(controller, at) {
|
|
5681
5681
|
const { doc, selection } = controller.editor.state;
|
|
5682
|
-
const candidates = [at?.block,
|
|
5682
|
+
const candidates = [at?.block, chunkLROGC3SI_cjs.headBlockId(selection), doc.blocks[doc.blocks.length - 1]?.id];
|
|
5683
5683
|
return candidates.find((id) => typeof id === "string" && doc.index.has(id)) ?? null;
|
|
5684
5684
|
}
|
|
5685
5685
|
var writerOf = (controller) => ({
|
|
@@ -5688,7 +5688,7 @@ var writerOf = (controller) => ({
|
|
|
5688
5688
|
});
|
|
5689
5689
|
function movedOn(controller, before) {
|
|
5690
5690
|
const now = writerOf(controller);
|
|
5691
|
-
return now.focus !== before.focus || !
|
|
5691
|
+
return now.focus !== before.focus || !chunkLROGC3SI_cjs.sameSelection(now.selection, before.selection);
|
|
5692
5692
|
}
|
|
5693
5693
|
async function insertUploads(controller, files, at, { upload, resolveAssetUrl, onError, unavailable, failed }) {
|
|
5694
5694
|
if (!upload) return onError(new Error(unavailable));
|
|
@@ -5723,8 +5723,8 @@ function markdownPlaceholder(state, block, labels) {
|
|
|
5723
5723
|
return holdsHead(state, block) || state.doc.blocks.length === 1 ? labels.placeholderEmpty : void 0;
|
|
5724
5724
|
}
|
|
5725
5725
|
function placeholderFor(state, block, labels) {
|
|
5726
|
-
const region =
|
|
5727
|
-
if (region === null ||
|
|
5726
|
+
const region = chunkLROGC3SI_cjs.primaryRegion(state.schema, block);
|
|
5727
|
+
if (region === null || chunkLROGC3SI_cjs.regionLength(block, region) > 0) return void 0;
|
|
5728
5728
|
switch (block.type) {
|
|
5729
5729
|
case "MARKDOWN":
|
|
5730
5730
|
return markdownPlaceholder(state, block, labels);
|
|
@@ -5759,7 +5759,7 @@ function revealLinkedBlock(controller, hash) {
|
|
|
5759
5759
|
if (id === null || shell === void 0) return false;
|
|
5760
5760
|
const { editor } = controller;
|
|
5761
5761
|
const { doc, schema } = editor.state;
|
|
5762
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
5762
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkLROGC3SI_cjs.startOf(doc, schema, id)));
|
|
5763
5763
|
shell.scrollIntoView({ block: "center" });
|
|
5764
5764
|
return true;
|
|
5765
5765
|
}
|
|
@@ -5776,8 +5776,8 @@ function useBlockLinkTarget(controller, focusOnMount) {
|
|
|
5776
5776
|
}, [controller, focusOnMount]);
|
|
5777
5777
|
}
|
|
5778
5778
|
var WRITER_ORIGINS = /* @__PURE__ */ new Set(["command", "input", "paste"]);
|
|
5779
|
-
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(
|
|
5780
|
-
var isEmptyText = (schema, block) =>
|
|
5779
|
+
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(chunkLROGC3SI_cjs.LINE_JOIN) !== true;
|
|
5780
|
+
var isEmptyText = (schema, block) => chunkLROGC3SI_cjs.isTextFlow(schema, block) && chunkLROGC3SI_cjs.regionLength(block, chunkLROGC3SI_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
5781
5781
|
function filledLine({ origin, before }, schema) {
|
|
5782
5782
|
const { selection } = before;
|
|
5783
5783
|
if (origin !== "paste" || selection?.kind !== "text") return () => false;
|
|
@@ -5797,7 +5797,7 @@ function deletions(codec, tr) {
|
|
|
5797
5797
|
}
|
|
5798
5798
|
function useDeleteReporter(controller, onDelete) {
|
|
5799
5799
|
const latest = React7.useRef(onDelete);
|
|
5800
|
-
|
|
5800
|
+
chunk4SRXM2VS_cjs.useIsomorphicLayoutEffect(() => {
|
|
5801
5801
|
latest.current = onDelete;
|
|
5802
5802
|
});
|
|
5803
5803
|
React7.useEffect(() => {
|
|
@@ -5851,7 +5851,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5851
5851
|
const [voidEditing] = React7.useState(createVoidEditing);
|
|
5852
5852
|
const [uiStore] = React7.useState(createCanvasUiStore);
|
|
5853
5853
|
const [allExtensions] = React7.useState(() => [
|
|
5854
|
-
...
|
|
5854
|
+
...chunkLROGC3SI_cjs.coreExtensions(),
|
|
5855
5855
|
voidEditing.extension,
|
|
5856
5856
|
blockMenuKeymap(uiStore),
|
|
5857
5857
|
slashExtension(),
|
|
@@ -5869,7 +5869,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5869
5869
|
);
|
|
5870
5870
|
useTypedInPlaceWarning(blockTypes, readOnly);
|
|
5871
5871
|
const [focusOnMount] = React7.useState(autoFocus);
|
|
5872
|
-
const controller =
|
|
5872
|
+
const controller = chunk4SRXM2VS_cjs.useQuoinEditor({
|
|
5873
5873
|
blocks,
|
|
5874
5874
|
onChange,
|
|
5875
5875
|
readOnly,
|
|
@@ -5913,7 +5913,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5913
5913
|
[controller, resolveAssetUrl]
|
|
5914
5914
|
);
|
|
5915
5915
|
return /* @__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(
|
|
5916
|
-
|
|
5916
|
+
chunk4SRXM2VS_cjs.EditorView,
|
|
5917
5917
|
{
|
|
5918
5918
|
controller,
|
|
5919
5919
|
renderers: ui.renderers,
|
|
@@ -6191,5 +6191,5 @@ exports.useQuoin = useQuoin;
|
|
|
6191
6191
|
exports.useRangeAnchor = useRangeAnchor;
|
|
6192
6192
|
exports.useRovingFocus = useRovingFocus;
|
|
6193
6193
|
exports.virtualAnchor = virtualAnchor;
|
|
6194
|
-
//# sourceMappingURL=chunk-
|
|
6195
|
-
//# sourceMappingURL=chunk-
|
|
6194
|
+
//# sourceMappingURL=chunk-YVMPIIMO.cjs.map
|
|
6195
|
+
//# sourceMappingURL=chunk-YVMPIIMO.cjs.map
|