quoin-editor 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/ai.cjs +65 -65
- package/dist/ai.d.cts +2 -2
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +4 -4
- package/dist/catalogue.cjs +20 -20
- package/dist/catalogue.d.cts +8 -8
- package/dist/catalogue.d.ts +8 -8
- package/dist/catalogue.js +12 -12
- package/dist/{chunk-SCFW4JFT.cjs → chunk-3YXV6LP7.cjs} +37 -37
- package/dist/{chunk-SCFW4JFT.cjs.map → chunk-3YXV6LP7.cjs.map} +1 -1
- package/dist/{chunk-DQV37F7J.cjs → chunk-5ILVILAJ.cjs} +66 -66
- package/dist/{chunk-DQV37F7J.cjs.map → chunk-5ILVILAJ.cjs.map} +1 -1
- package/dist/{chunk-CZ5ZXBWC.cjs → chunk-5MQ2AL7L.cjs} +217 -217
- package/dist/{chunk-CZ5ZXBWC.cjs.map → chunk-5MQ2AL7L.cjs.map} +1 -1
- package/dist/{chunk-TARBFPWC.js → chunk-5YQKKFYB.js} +6 -6
- package/dist/{chunk-TARBFPWC.js.map → chunk-5YQKKFYB.js.map} +1 -1
- package/dist/{chunk-KMIWUFNM.cjs → chunk-7RZNJR4J.cjs} +75 -75
- package/dist/{chunk-KMIWUFNM.cjs.map → chunk-7RZNJR4J.cjs.map} +1 -1
- package/dist/{chunk-A5LIN7FO.cjs → chunk-AY5ANGXK.cjs} +26 -26
- package/dist/{chunk-A5LIN7FO.cjs.map → chunk-AY5ANGXK.cjs.map} +1 -1
- package/dist/{chunk-ZVCBTQA3.cjs → chunk-AZF7B2AE.cjs} +10 -10
- package/dist/{chunk-ZVCBTQA3.cjs.map → chunk-AZF7B2AE.cjs.map} +1 -1
- package/dist/{chunk-4HFE3YFF.js → chunk-DGWAVYTO.js} +6 -6
- package/dist/{chunk-4HFE3YFF.js.map → chunk-DGWAVYTO.js.map} +1 -1
- package/dist/{chunk-BNUQ647G.js → chunk-FWETDMCE.js} +5 -5
- package/dist/{chunk-BNUQ647G.js.map → chunk-FWETDMCE.js.map} +1 -1
- package/dist/{chunk-25HNTVEI.js → chunk-G25FMFEZ.js} +3 -3
- package/dist/{chunk-25HNTVEI.js.map → chunk-G25FMFEZ.js.map} +1 -1
- package/dist/{chunk-35CHEARK.cjs → chunk-HRTIY6NY.cjs} +38 -38
- package/dist/{chunk-35CHEARK.cjs.map → chunk-HRTIY6NY.cjs.map} +1 -1
- package/dist/{chunk-YCVNFRL3.js → chunk-IJKGF6SC.js} +4 -4
- package/dist/{chunk-YCVNFRL3.js.map → chunk-IJKGF6SC.js.map} +1 -1
- package/dist/{chunk-KXOAV7AT.js → chunk-OS2O6IKX.js} +135 -12
- package/dist/chunk-OS2O6IKX.js.map +1 -0
- package/dist/{chunk-Y7UKOBSY.js → chunk-OZIRHN5H.js} +5 -5
- package/dist/{chunk-Y7UKOBSY.js.map → chunk-OZIRHN5H.js.map} +1 -1
- package/dist/{chunk-BR25RE7U.js → chunk-QGQFA5HD.js} +5 -5
- package/dist/{chunk-BR25RE7U.js.map → chunk-QGQFA5HD.js.map} +1 -1
- package/dist/{chunk-OGBD74IR.cjs → chunk-QJ34MOFV.cjs} +187 -117
- package/dist/chunk-QJ34MOFV.cjs.map +1 -0
- package/dist/{chunk-SAPLIQF2.js → chunk-QOIVLYMW.js} +4 -4
- package/dist/{chunk-SAPLIQF2.js.map → chunk-QOIVLYMW.js.map} +1 -1
- package/dist/{chunk-K7JEN3KT.cjs → chunk-QR2NIDUK.cjs} +4 -4
- package/dist/{chunk-K7JEN3KT.cjs.map → chunk-QR2NIDUK.cjs.map} +1 -1
- package/dist/{chunk-FOEEDJ5R.js → chunk-R5RI4SFY.js} +5 -5
- package/dist/{chunk-FOEEDJ5R.js.map → chunk-R5RI4SFY.js.map} +1 -1
- package/dist/{chunk-4D7HZRNC.js → chunk-R7MYG522.js} +3 -3
- package/dist/{chunk-4D7HZRNC.js.map → chunk-R7MYG522.js.map} +1 -1
- package/dist/{chunk-BJIWN7BQ.cjs → chunk-STKGRXSA.cjs} +10 -10
- package/dist/{chunk-BJIWN7BQ.cjs.map → chunk-STKGRXSA.cjs.map} +1 -1
- package/dist/{chunk-I7OOIEZZ.js → chunk-UWTU4V3G.js} +5 -5
- package/dist/{chunk-I7OOIEZZ.js.map → chunk-UWTU4V3G.js.map} +1 -1
- package/dist/{chunk-G37GQ5JE.cjs → chunk-VZZPCYA3.cjs} +135 -12
- package/dist/chunk-VZZPCYA3.cjs.map +1 -0
- package/dist/{chunk-JYKSWEXT.cjs → chunk-WN7BZDNH.cjs} +6 -6
- package/dist/{chunk-JYKSWEXT.cjs.map → chunk-WN7BZDNH.cjs.map} +1 -1
- package/dist/{chunk-5ANJW76W.cjs → chunk-X2CN6FXA.cjs} +20 -20
- package/dist/{chunk-5ANJW76W.cjs.map → chunk-X2CN6FXA.cjs.map} +1 -1
- package/dist/{chunk-CCOPHCXX.js → chunk-XFEDJEJF.js} +109 -39
- package/dist/chunk-XFEDJEJF.js.map +1 -0
- package/dist/{chunk-J552D3A7.js → chunk-YFPEJP6W.js} +4 -4
- package/dist/{chunk-J552D3A7.js.map → chunk-YFPEJP6W.js.map} +1 -1
- package/dist/{chunk-IGEWAL2J.cjs → chunk-YWYOLZWB.cjs} +29 -29
- package/dist/{chunk-IGEWAL2J.cjs.map → chunk-YWYOLZWB.cjs.map} +1 -1
- package/dist/comments.cjs +48 -48
- package/dist/comments.d.cts +2 -2
- package/dist/comments.d.ts +2 -2
- package/dist/comments.js +4 -4
- package/dist/diff.d.cts +2 -2
- package/dist/diff.d.ts +2 -2
- package/dist/docx.cjs +1 -1
- package/dist/docx.d.cts +1 -1
- package/dist/docx.d.ts +1 -1
- package/dist/docx.js +1 -1
- package/dist/embed.cjs +6 -6
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.js +4 -4
- package/dist/{emoji-extension-CmPlRssm.d.ts → emoji-extension-W7WYXOxF.d.ts} +1 -1
- package/dist/{emoji-extension-zJ6F7hW8.d.cts → emoji-extension-j6FdAXPA.d.cts} +1 -1
- package/dist/emoji.cjs +7 -7
- package/dist/emoji.d.cts +4 -4
- package/dist/emoji.d.ts +4 -4
- package/dist/emoji.js +4 -4
- package/dist/engine.cjs +43 -43
- package/dist/engine.d.cts +5 -5
- package/dist/engine.d.ts +5 -5
- package/dist/engine.js +1 -1
- package/dist/{find-extension-CmFehyul.d.ts → find-extension-CwhUbnM7.d.ts} +1 -1
- package/dist/{find-extension-BcRyE9K4.d.cts → find-extension-DhVtoyGx.d.cts} +1 -1
- package/dist/find.cjs +8 -8
- package/dist/find.d.cts +3 -3
- package/dist/find.d.ts +3 -3
- package/dist/find.js +4 -4
- package/dist/headless.cjs +59 -59
- package/dist/headless.d.cts +7 -7
- package/dist/headless.d.ts +7 -7
- package/dist/headless.js +2 -2
- package/dist/{index-DiCGV60d.d.ts → index-CLSQdbjq.d.ts} +1 -1
- package/dist/{index-CFPmCee4.d.cts → index-KM5kJs7H.d.cts} +1 -1
- package/dist/index.cjs +71 -71
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/math.cjs +7 -7
- package/dist/math.d.cts +3 -3
- package/dist/math.d.ts +3 -3
- package/dist/math.js +5 -5
- package/dist/mention.cjs +7 -7
- package/dist/mention.d.cts +2 -2
- package/dist/mention.d.ts +2 -2
- package/dist/mention.js +5 -5
- package/dist/presence.cjs +33 -33
- package/dist/presence.d.cts +3 -3
- package/dist/presence.d.ts +3 -3
- package/dist/presence.js +5 -5
- package/dist/{stats-extension-Dt1lgP3m.d.cts → stats-extension-ByKYtIB5.d.cts} +1 -1
- package/dist/{stats-extension-DisOEbbI.d.ts → stats-extension-DNEtte9E.d.ts} +1 -1
- package/dist/stats.cjs +7 -7
- package/dist/stats.d.cts +4 -4
- package/dist/stats.d.ts +4 -4
- package/dist/stats.js +4 -4
- package/dist/{table-extension-BTMJnT7J.d.ts → table-extension-BT6DTOXL.d.ts} +1 -1
- package/dist/{table-extension-DxZz3jqp.d.cts → table-extension-DuphgC4v.d.cts} +1 -1
- package/dist/table.cjs +23 -23
- package/dist/table.d.cts +3 -3
- package/dist/table.d.ts +3 -3
- package/dist/table.js +4 -4
- package/dist/{to-html-C5t7xyaM.d.ts → to-html-B_NwgPSz.d.ts} +1 -1
- package/dist/{to-html-CNCITCln.d.cts → to-html-DwhNK6-9.d.cts} +1 -1
- package/dist/{toc-extension-CR9U-l6j.d.ts → toc-extension-B0Datrvu.d.ts} +1 -1
- package/dist/{toc-extension-DGHywOBv.d.cts → toc-extension-RtMspT0A.d.cts} +1 -1
- package/dist/toc.cjs +7 -7
- package/dist/toc.d.cts +3 -3
- package/dist/toc.d.ts +3 -3
- package/dist/toc.js +4 -4
- package/dist/{types-DULc8wwg.d.ts → types-CQ8Vw_7N.d.cts} +27 -1
- package/dist/{types-DULc8wwg.d.cts → types-CQ8Vw_7N.d.ts} +27 -1
- package/dist/{types-C6_QkXzy.d.ts → types-DM6gsVga.d.cts} +2 -26
- package/dist/{types-CJ7Gq3GX.d.cts → types-rf9DGNaS.d.ts} +2 -26
- package/dist/{view-controller-cxQJ5rQb.d.cts → view-controller-BzXblb44.d.cts} +2 -2
- package/dist/{view-controller-zNqHm_Qg.d.ts → view-controller-CdzfG_xK.d.ts} +2 -2
- package/dist/view.d.cts +2 -2
- package/dist/view.d.ts +2 -2
- package/dist/yjs.cjs +99 -99
- package/dist/yjs.d.cts +4 -4
- package/dist/yjs.d.ts +4 -4
- package/dist/yjs.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-CCOPHCXX.js.map +0 -1
- package/dist/chunk-G37GQ5JE.cjs.map +0 -1
- package/dist/chunk-KXOAV7AT.js.map +0 -1
- package/dist/chunk-OGBD74IR.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQJ34MOFV_cjs = require('./chunk-QJ34MOFV.cjs');
|
|
4
4
|
var chunkA6PGQVTR_cjs = require('./chunk-A6PGQVTR.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkVZZPCYA3_cjs = require('./chunk-VZZPCYA3.cjs');
|
|
6
6
|
var chunkWZA5S5EJ_cjs = require('./chunk-WZA5S5EJ.cjs');
|
|
7
7
|
var React7 = require('react');
|
|
8
8
|
var lucideReact = require('lucide-react');
|
|
@@ -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
|
+
chunkQJ34MOFV_cjs.dispatchSelection(controller, chunkVZZPCYA3_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: chunkVZZPCYA3_cjs.defineExtension({
|
|
463
463
|
name: "void-editing",
|
|
464
464
|
priority: ABOVE_CORE_KEYS,
|
|
465
465
|
keymap: { Enter: openEditor },
|
|
@@ -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 = chunkVZZPCYA3_cjs.selectedBlockIds(doc, result);
|
|
740
|
+
const head = chunkVZZPCYA3_cjs.headBlockId(before);
|
|
741
|
+
if (head !== null && ids.includes(head) && chunkVZZPCYA3_cjs.validateSelection(doc, schema, before) === before) return before;
|
|
742
|
+
return chunkVZZPCYA3_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(chunkVZZPCYA3_cjs.selectedBlockIds(state.doc, before), ids);
|
|
750
|
+
const ran = exact ? before : chunkVZZPCYA3_cjs.blockRangeSelection(ids[0], ids[ids.length - 1]);
|
|
751
|
+
const { ok, tr } = chunkVZZPCYA3_cjs.runCommands(state, [chunkVZZPCYA3_cjs.setSelection(ran), command]);
|
|
752
|
+
const result = ok && tr !== null ? tr : new chunkVZZPCYA3_cjs.Transaction(state).setSelection(ran);
|
|
753
753
|
const settled = exact ? result.selection : settle(result, before);
|
|
754
|
-
if (!
|
|
755
|
-
if (result.docChanged || !
|
|
754
|
+
if (!chunkVZZPCYA3_cjs.sameSelection(settled, result.selection)) result.setSelection(settled);
|
|
755
|
+
if (result.docChanged || !chunkVZZPCYA3_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) => chunkVZZPCYA3_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 = chunkVZZPCYA3_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, chunkVZZPCYA3_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 = chunkVZZPCYA3_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 chunkVZZPCYA3_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)) && chunkVZZPCYA3_cjs.runCommands(state, [chunkVZZPCYA3_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, chunkVZZPCYA3_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, chunkVZZPCYA3_cjs.moveBlocksUp),
|
|
822
|
+
available: applies(chunkVZZPCYA3_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, chunkVZZPCYA3_cjs.moveBlocksDown),
|
|
830
|
+
available: applies(chunkVZZPCYA3_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, chunkVZZPCYA3_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, chunkVZZPCYA3_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, chunkVZZPCYA3_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 = chunkVZZPCYA3_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) => chunkVZZPCYA3_cjs.isParagraph(block) && chunkVZZPCYA3_cjs.regionLength(block, chunkVZZPCYA3_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
1043
1043
|
function fresh(schema, { id, type, attrs, regions }, indent3) {
|
|
1044
|
-
const block =
|
|
1044
|
+
const block = chunkVZZPCYA3_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 : chunkVZZPCYA3_cjs.createBlock(schema, schema.defaultTextBlock, {}, indent3);
|
|
1051
|
+
if (!reused) tr.step(chunkVZZPCYA3_cjs.insertBlocksStep(index, [line]));
|
|
1052
|
+
tr.setSelection(chunkVZZPCYA3_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(chunkVZZPCYA3_cjs.startOf(tr.doc, schema, first.id));
|
|
1056
|
+
if (landing === "editor") tr.setSelection(chunkVZZPCYA3_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 ? chunkVZZPCYA3_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 chunkVZZPCYA3_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(chunkVZZPCYA3_cjs.insertBlocksStep(index, created2)).setSelection(chunkVZZPCYA3_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(chunkVZZPCYA3_cjs.replaceBlockStep(filled));
|
|
1079
|
+
if (rest.length > 0) tr.step(chunkVZZPCYA3_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 : chunkVZZPCYA3_cjs.descendantsEnd(doc, index);
|
|
1083
|
+
tr.step(chunkVZZPCYA3_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(chunkVZZPCYA3_cjs.setAttrsStep(blockId, { code })).setMeta(chunkVZZPCYA3_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 = chunkVZZPCYA3_cjs.setBlockType("MARKDOWN", { kind: "paragraph" });
|
|
1111
|
+
const { ok, tr } = chunkVZZPCYA3_cjs.runCommands(state, [chunkVZZPCYA3_cjs.setSelection(chunkVZZPCYA3_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 = chunkQJ34MOFV_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 = chunkVZZPCYA3_cjs.keyName(event, isMac);
|
|
1196
|
+
const modKey = MOD_KEYS.find(([key]) => chunkVZZPCYA3_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 = chunkQJ34MOFV_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, chunkVZZPCYA3_cjs.undo);
|
|
1259
1259
|
case "redo":
|
|
1260
|
-
return travel(context,
|
|
1260
|
+
return travel(context, chunkVZZPCYA3_cjs.redo);
|
|
1261
1261
|
case "selectAll":
|
|
1262
|
-
return selectAndFocus(context,
|
|
1262
|
+
return selectAndFocus(context, chunkVZZPCYA3_cjs.selectAll);
|
|
1263
1263
|
case "escape":
|
|
1264
|
-
return selectAndFocus(context,
|
|
1264
|
+
return selectAndFocus(context, chunkVZZPCYA3_cjs.setSelection(chunkVZZPCYA3_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 (chunkQJ34MOFV_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", { ...{ [chunkQJ34MOFV_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 = chunkQJ34MOFV_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(chunkQJ34MOFV_cjs.onBlock(blockId, chunkVZZPCYA3_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
|
+
chunkQJ34MOFV_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 (chunkQJ34MOFV_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 = chunkQJ34MOFV_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 (chunkQJ34MOFV_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(chunkVZZPCYA3_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 = chunkQJ34MOFV_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], chunkVZZPCYA3_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) => chunkVZZPCYA3_cjs.isActive(state, mark),
|
|
2002
|
+
run: (controller) => void controller.run(chunkVZZPCYA3_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
|
+
chunkQJ34MOFV_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
|
+
chunkQJ34MOFV_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 = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_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) || chunkQJ34MOFV_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 = chunkQJ34MOFV_cjs.useEditorState(controller, selected);
|
|
2189
|
+
const readOnly = chunkQJ34MOFV_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 (chunkQJ34MOFV_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
|
+
...{ [chunkQJ34MOFV_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
|
+
chunkQJ34MOFV_cjs.EditableRegion,
|
|
2384
2384
|
{
|
|
2385
2385
|
block: id,
|
|
2386
2386
|
region: "caption",
|
|
@@ -2518,7 +2518,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2518
2518
|
// then follows.
|
|
2519
2519
|
enter() {
|
|
2520
2520
|
const { editor } = controller;
|
|
2521
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
2521
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkVZZPCYA3_cjs.textSelection(captionEnd(controller, blockId))));
|
|
2522
2522
|
controller.focus();
|
|
2523
2523
|
},
|
|
2524
2524
|
type(key) {
|
|
@@ -2543,7 +2543,7 @@ function useImageKeys(controller, blockId, picture, editable, root) {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
var ImageBlock = ({ block, controller }) => {
|
|
2545
2545
|
const labels = useLabels();
|
|
2546
|
-
const readOnly =
|
|
2546
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
2547
2547
|
const root = React7.useRef(null);
|
|
2548
2548
|
const picture = hasPicture(block.attrs);
|
|
2549
2549
|
useImageKeys(controller, block.id, picture, !readOnly, root);
|
|
@@ -2556,17 +2556,17 @@ var ImageBlock = ({ block, controller }) => {
|
|
|
2556
2556
|
"aria-label": labels.blockNames.image,
|
|
2557
2557
|
contentEditable: false,
|
|
2558
2558
|
className: "quoin-image",
|
|
2559
|
-
...picture ? { [
|
|
2559
|
+
...picture ? { [chunkQJ34MOFV_cjs.NODE_ENTRY]: "" } : void 0,
|
|
2560
2560
|
children: picture ? /* @__PURE__ */ jsxRuntime.jsx(ImageFigure, { block, controller, readOnly }) : empty
|
|
2561
2561
|
}
|
|
2562
2562
|
);
|
|
2563
2563
|
};
|
|
2564
2564
|
function useOutsidePress(element, ownerDocument, onPress) {
|
|
2565
2565
|
const latest = React7.useRef(onPress);
|
|
2566
|
-
|
|
2566
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
2567
2567
|
latest.current = onPress;
|
|
2568
2568
|
});
|
|
2569
|
-
|
|
2569
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
2570
2570
|
const doc = ownerDocument();
|
|
2571
2571
|
const inside = (target) => element.current?.contains(target) === true;
|
|
2572
2572
|
let touched = null;
|
|
@@ -2581,7 +2581,7 @@ function useOutsidePress(element, ownerDocument, onPress) {
|
|
|
2581
2581
|
if (touched !== null && !inside(event.target)) latest.current(touched);
|
|
2582
2582
|
touched = null;
|
|
2583
2583
|
};
|
|
2584
|
-
return
|
|
2584
|
+
return chunkQJ34MOFV_cjs.listen(doc, { pointerdown: down, click }, true);
|
|
2585
2585
|
}, [element, ownerDocument]);
|
|
2586
2586
|
}
|
|
2587
2587
|
function storeAlt(controller, blockId, opened, patch) {
|
|
@@ -2589,7 +2589,7 @@ function storeAlt(controller, blockId, opened, patch) {
|
|
|
2589
2589
|
const attrs = chunkWZA5S5EJ_cjs.blockById(editor.state.doc, blockId)?.attrs ?? {};
|
|
2590
2590
|
const changed = chunkWZA5S5EJ_cjs.str(attrs.alt) !== opened.alt || attrs.decorative === true !== opened.decorative;
|
|
2591
2591
|
if (controller.readOnly || controller.root === null || changed) return;
|
|
2592
|
-
|
|
2592
|
+
chunkQJ34MOFV_cjs.onBlock(blockId, chunkVZZPCYA3_cjs.setAttrs(patch))(editor.state, (tr) => editor.dispatch(tr));
|
|
2593
2593
|
}
|
|
2594
2594
|
function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative, onClose }) {
|
|
2595
2595
|
const labels = useLabels();
|
|
@@ -2631,7 +2631,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
2631
2631
|
close(true);
|
|
2632
2632
|
};
|
|
2633
2633
|
const onKeyDown = (event) => {
|
|
2634
|
-
if (event.key !== "Tab" ||
|
|
2634
|
+
if (event.key !== "Tab" || chunkQJ34MOFV_cjs.isComposingKey(controller, event.nativeEvent)) return;
|
|
2635
2635
|
const controls = [...event.currentTarget.elements];
|
|
2636
2636
|
const next = controls[controls.indexOf(event.target) + (event.shiftKey ? -1 : 1)];
|
|
2637
2637
|
event.preventDefault();
|
|
@@ -2659,7 +2659,7 @@ function AltTextPopover({ blockId, controller, anchor, opener, alt, decorative,
|
|
|
2659
2659
|
onCloseAutoFocus: preventDefault,
|
|
2660
2660
|
onEscapeKeyDown: (event) => {
|
|
2661
2661
|
event.preventDefault();
|
|
2662
|
-
if (!
|
|
2662
|
+
if (!chunkQJ34MOFV_cjs.isComposingKey(controller, event)) close(false);
|
|
2663
2663
|
},
|
|
2664
2664
|
...bubblePart(controller),
|
|
2665
2665
|
children: /* @__PURE__ */ jsxRuntime.jsxs("form", { noValidate: true, className: "quoin-image-alt", onSubmit: save, onKeyDown, children: [
|
|
@@ -2753,7 +2753,7 @@ function ImageToolbarOverlay({ controller }) {
|
|
|
2753
2753
|
}
|
|
2754
2754
|
function ImageToolbar({ blockId, controller, editingAlt, onEditAlt }) {
|
|
2755
2755
|
const { labels, resolveAssetUrl } = useQuoin();
|
|
2756
|
-
const state =
|
|
2756
|
+
const state = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_cjs.wholeState);
|
|
2757
2757
|
const picker = useReplacePicker(controller, blockId, uploadImage, "image/*");
|
|
2758
2758
|
const altButton = React7.useRef(null);
|
|
2759
2759
|
const anchor = usePartAnchor(controller, blockId, ".quoin-image-frame");
|
|
@@ -2985,13 +2985,13 @@ function CalloutToneMenu({ blockId, controller, tone }) {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
var CalloutBlock = ({ block, controller }) => {
|
|
2987
2987
|
const labels = useLabels();
|
|
2988
|
-
const readOnly =
|
|
2988
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
2989
2989
|
const tone = calloutTone(block.attrs.tone);
|
|
2990
2990
|
const icon = calloutIcon(block.attrs, tone);
|
|
2991
2991
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("quoin-callout group/callout flex items-start gap-2", TONE[tone]), "data-tone": tone, children: [
|
|
2992
2992
|
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 }),
|
|
2993
2993
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2994
|
-
|
|
2994
|
+
chunkQJ34MOFV_cjs.EditableRegion,
|
|
2995
2995
|
{
|
|
2996
2996
|
block: block.id,
|
|
2997
2997
|
region: "body",
|
|
@@ -3060,22 +3060,22 @@ var headingStyles = (level) => `quoin-heading mb-1 font-semibold leading-tight i
|
|
|
3060
3060
|
function Heading({ block }) {
|
|
3061
3061
|
const labels = useLabels();
|
|
3062
3062
|
const level = chunkWZA5S5EJ_cjs.headingLevel(block.attrs.level);
|
|
3063
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3063
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": level, className: headingStyles(level), children: /* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.heading(level) }) });
|
|
3064
3064
|
}
|
|
3065
3065
|
function NumberedItem({ block, controller }) {
|
|
3066
3066
|
const labels = useLabels();
|
|
3067
|
-
const number =
|
|
3067
|
+
const number = chunkQJ34MOFV_cjs.useOrderedNumber(controller, block.id);
|
|
3068
3068
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "ordered", children: [
|
|
3069
3069
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "ordered", number, depth: block.indent }),
|
|
3070
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3070
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.numberedItem(number) })
|
|
3071
3071
|
] });
|
|
3072
3072
|
}
|
|
3073
3073
|
function TaskItem({ block, controller }) {
|
|
3074
3074
|
const labels = useLabels();
|
|
3075
|
-
const hostId =
|
|
3075
|
+
const hostId = chunkQJ34MOFV_cjs.useRegionDomId(block.id, REGION);
|
|
3076
3076
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-task", "data-checked": block.attrs.checked === true, children: [
|
|
3077
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3078
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3077
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.TaskCheckbox, { block, controller, label: labels.task, labelledBy: hostId }),
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { id: hostId, block: block.id, region: REGION, label: labels.task })
|
|
3079
3079
|
] });
|
|
3080
3080
|
}
|
|
3081
3081
|
var MarkdownBlock = (props) => {
|
|
@@ -3087,16 +3087,16 @@ var MarkdownBlock = (props) => {
|
|
|
3087
3087
|
case "bullet":
|
|
3088
3088
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-list-item", "data-list": "bullet", children: [
|
|
3089
3089
|
/* @__PURE__ */ jsxRuntime.jsx(ListMarker, { list: "bullet", depth: block.indent }),
|
|
3090
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3090
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.bulletItem })
|
|
3091
3091
|
] });
|
|
3092
3092
|
case "ordered":
|
|
3093
3093
|
return /* @__PURE__ */ jsxRuntime.jsx(NumberedItem, { ...props });
|
|
3094
3094
|
case "task":
|
|
3095
3095
|
return /* @__PURE__ */ jsxRuntime.jsx(TaskItem, { ...props });
|
|
3096
3096
|
case "quote":
|
|
3097
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3097
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "quoin-quote", children: /* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.quote }) });
|
|
3098
3098
|
default:
|
|
3099
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3099
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: REGION, label: labels.paragraph });
|
|
3100
3100
|
}
|
|
3101
3101
|
};
|
|
3102
3102
|
|
|
@@ -3104,19 +3104,19 @@ var MarkdownBlock = (props) => {
|
|
|
3104
3104
|
function nestedBlockIds({ doc }, blockId) {
|
|
3105
3105
|
const index = doc.index.get(blockId);
|
|
3106
3106
|
if (index === void 0) return [];
|
|
3107
|
-
return doc.blocks.slice(index + 1,
|
|
3107
|
+
return doc.blocks.slice(index + 1, chunkVZZPCYA3_cjs.descendantsEnd(doc, index)).map((block) => block.id);
|
|
3108
3108
|
}
|
|
3109
3109
|
function useNestedBlocks(controller, blockId) {
|
|
3110
|
-
return
|
|
3110
|
+
return chunkQJ34MOFV_cjs.useEditorState(controller, (state) => nestedBlockIds(state, blockId), chunkWZA5S5EJ_cjs.sameItems);
|
|
3111
3111
|
}
|
|
3112
3112
|
var ToggleBlock = ({ block, controller }) => {
|
|
3113
3113
|
const labels = useLabels();
|
|
3114
|
-
const domId =
|
|
3114
|
+
const domId = chunkQJ34MOFV_cjs.useBlockDomId();
|
|
3115
3115
|
const nested = useNestedBlocks(controller, block.id);
|
|
3116
|
-
const open =
|
|
3116
|
+
const open = chunkQJ34MOFV_cjs.useToggleOpen(controller, block);
|
|
3117
3117
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "quoin-toggle", "data-open": open, children: [
|
|
3118
3118
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3119
|
-
|
|
3119
|
+
chunkQJ34MOFV_cjs.ToggleChevron,
|
|
3120
3120
|
{
|
|
3121
3121
|
block,
|
|
3122
3122
|
controller,
|
|
@@ -3124,7 +3124,7 @@ var ToggleBlock = ({ block, controller }) => {
|
|
|
3124
3124
|
controls: nested.length === 0 ? void 0 : nested.map(domId).join(" ")
|
|
3125
3125
|
}
|
|
3126
3126
|
),
|
|
3127
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3127
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkQJ34MOFV_cjs.EditableRegion, { block: block.id, region: "text", label: labels.toggle })
|
|
3128
3128
|
] });
|
|
3129
3129
|
};
|
|
3130
3130
|
|
|
@@ -3183,7 +3183,7 @@ function turnIntoTargets(labels) {
|
|
|
3183
3183
|
function TurnIntoItems({ kit, controller, blockIds }) {
|
|
3184
3184
|
const { blockTypes, labels } = useQuoin();
|
|
3185
3185
|
const targets = turnIntoTargets(labels).filter((target) => drawsType(blockTypes, target.type));
|
|
3186
|
-
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds,
|
|
3186
|
+
return targets.map((target) => /* @__PURE__ */ jsxRuntime.jsxs(kit.Item, { onSelect: () => runOnBlocks(controller, blockIds, chunkVZZPCYA3_cjs.setBlockType(target.type, target.attrs)), children: [
|
|
3187
3187
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: target.icon }),
|
|
3188
3188
|
target.label
|
|
3189
3189
|
] }, target.id));
|
|
@@ -3218,10 +3218,10 @@ function ActionItem({ kit, controller, action, blockIds }) {
|
|
|
3218
3218
|
);
|
|
3219
3219
|
}
|
|
3220
3220
|
function BlockMenuItems({ kit, controller, blocks, styled, title, actions }) {
|
|
3221
|
-
const state =
|
|
3221
|
+
const state = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_cjs.wholeState);
|
|
3222
3222
|
const blockIds = blocks.map((block) => block.id);
|
|
3223
3223
|
const shown = actions.filter((action) => action.available?.(state, blockIds) ?? true);
|
|
3224
|
-
const anyText = styled.some((block) =>
|
|
3224
|
+
const anyText = styled.some((block) => chunkVZZPCYA3_cjs.isTextFlow(state.schema, block));
|
|
3225
3225
|
const anyMarkdown = styled.some((block) => block.type === "MARKDOWN");
|
|
3226
3226
|
const allCallouts = styled.length > 0 && styled.every((block) => block.type === "CALLOUT");
|
|
3227
3227
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3263,7 +3263,7 @@ var CONTEXT_KIT = {
|
|
|
3263
3263
|
SubTrigger: ContextMenuSubTrigger
|
|
3264
3264
|
};
|
|
3265
3265
|
var GUTTER_BLOCK = "data-quoin-gutter-block";
|
|
3266
|
-
var OWN_MENU = `[${
|
|
3266
|
+
var OWN_MENU = `[${chunkQJ34MOFV_cjs.NATIVE_INTERACTION}], input, textarea, select`;
|
|
3267
3267
|
function contextBlock(controller, target) {
|
|
3268
3268
|
const { state } = controller.editor;
|
|
3269
3269
|
const gutter = target.closest(`[${GUTTER_BLOCK}]`)?.getAttribute(GUTTER_BLOCK);
|
|
@@ -3273,7 +3273,7 @@ function contextBlock(controller, target) {
|
|
|
3273
3273
|
if (target.closest(OWN_MENU) || controller.registry.locate(target) !== null) return null;
|
|
3274
3274
|
const id = controller.blockAt(target);
|
|
3275
3275
|
const block = id === void 0 ? void 0 : chunkWZA5S5EJ_cjs.blockById(state.doc, id);
|
|
3276
|
-
return block === void 0 ||
|
|
3276
|
+
return block === void 0 || chunkVZZPCYA3_cjs.isTextFlow(state.schema, block) ? null : block.id;
|
|
3277
3277
|
}
|
|
3278
3278
|
function useContextMenuOpener(controller, store, trigger) {
|
|
3279
3279
|
React7.useEffect(() => {
|
|
@@ -3292,7 +3292,7 @@ function useContextMenuOpener(controller, store, trigger) {
|
|
|
3292
3292
|
openBlockMenuAt(store, controller.editor.state, block, clientX, clientY);
|
|
3293
3293
|
hidden.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX, clientY }));
|
|
3294
3294
|
};
|
|
3295
|
-
return
|
|
3295
|
+
return chunkQJ34MOFV_cjs.listen(root, { mousedown: onMouseDown, contextmenu: onContextMenu });
|
|
3296
3296
|
}, [controller, store, trigger]);
|
|
3297
3297
|
}
|
|
3298
3298
|
|
|
@@ -3328,7 +3328,7 @@ function useLiveBlocks(controller, blockIds) {
|
|
|
3328
3328
|
(state) => blockIds.flatMap((id) => chunkWZA5S5EJ_cjs.blockById(state.doc, id) ?? []),
|
|
3329
3329
|
[blockIds]
|
|
3330
3330
|
);
|
|
3331
|
-
return
|
|
3331
|
+
return chunkQJ34MOFV_cjs.useEditorState(controller, select, chunkWZA5S5EJ_cjs.sameItems);
|
|
3332
3332
|
}
|
|
3333
3333
|
function useMenuBlocks(controller, store, menu) {
|
|
3334
3334
|
const labels = useLabels();
|
|
@@ -3381,12 +3381,12 @@ function BlockContextMenu({ controller, store, actions }) {
|
|
|
3381
3381
|
// src/gutter/block-menu-keymap.ts
|
|
3382
3382
|
function blockMenuKeymap(store) {
|
|
3383
3383
|
const openForHead = (state, dispatch) => {
|
|
3384
|
-
const head =
|
|
3384
|
+
const head = chunkVZZPCYA3_cjs.headBlockId(state.selection);
|
|
3385
3385
|
if (head === null || !state.doc.index.has(head)) return false;
|
|
3386
3386
|
if (dispatch) openBlockMenu(store, state, head);
|
|
3387
3387
|
return true;
|
|
3388
3388
|
};
|
|
3389
|
-
return
|
|
3389
|
+
return chunkVZZPCYA3_cjs.defineExtension({ name: "block-menu", keymap: { "Mod-/": openForHead } });
|
|
3390
3390
|
}
|
|
3391
3391
|
var UNIQUE_OR_FOCUSABLE = ["id", "data-block-id", "contenteditable", "tabindex"];
|
|
3392
3392
|
function copyOf(shell) {
|
|
@@ -3455,7 +3455,7 @@ var DragOverlay = React7.forwardRef(function DragOverlay2(_props, ref) {
|
|
|
3455
3455
|
var DELETION_STEPS = /* @__PURE__ */ new Set(["removeBlocks", "setIndent"]);
|
|
3456
3456
|
function drawnPosition(doc, blockId) {
|
|
3457
3457
|
const index = doc.index.get(blockId) ?? 0;
|
|
3458
|
-
return [
|
|
3458
|
+
return [chunkQJ34MOFV_cjs.drawnBlockCount(doc, 0, index) + 1, chunkQJ34MOFV_cjs.drawnBlockCount(doc)];
|
|
3459
3459
|
}
|
|
3460
3460
|
function blockMovedMessage(doc, blockId, labels) {
|
|
3461
3461
|
return labels.blockMoved(...drawnPosition(doc, blockId));
|
|
@@ -3471,11 +3471,11 @@ function deletedCount(tr) {
|
|
|
3471
3471
|
return tr.steps.reduce((deleted, step, i) => {
|
|
3472
3472
|
const { index, count } = step.toJSON();
|
|
3473
3473
|
if (step.stepType !== "removeBlocks" || typeof index !== "number" || typeof count !== "number") return deleted;
|
|
3474
|
-
return deleted +
|
|
3474
|
+
return deleted + chunkQJ34MOFV_cjs.drawnBlockCount(tr.docs[i], index, index + count);
|
|
3475
3475
|
}, 0);
|
|
3476
3476
|
}
|
|
3477
3477
|
function insertedBlock(tr) {
|
|
3478
|
-
if (tr.getMeta(
|
|
3478
|
+
if (tr.getMeta(chunkVZZPCYA3_cjs.LINE_SPLIT) === true || tr.steps.some((step) => step.stepType === "removeBlocks")) return null;
|
|
3479
3479
|
const inserted = tr.steps.flatMap((step) => {
|
|
3480
3480
|
const { blocks } = step.toJSON();
|
|
3481
3481
|
return step.stepType === "insertBlocks" && Array.isArray(blocks) ? blocks : [];
|
|
@@ -3483,7 +3483,7 @@ function insertedBlock(tr) {
|
|
|
3483
3483
|
return inserted.find((block) => tr.doc.index.has(block.id))?.id ?? null;
|
|
3484
3484
|
}
|
|
3485
3485
|
function structureAnnouncement(tr, labels, undoKeys) {
|
|
3486
|
-
if (tr.origin !== "command" || tr.getMeta(
|
|
3486
|
+
if (tr.origin !== "command" || tr.getMeta(chunkVZZPCYA3_cjs.LINE_JOIN) === true) return null;
|
|
3487
3487
|
const moved = movedBlock(tr);
|
|
3488
3488
|
if (moved !== null) return blockMovedMessage(tr.doc, moved, labels);
|
|
3489
3489
|
const deleted = deletedCount(tr);
|
|
@@ -3513,7 +3513,7 @@ function inlineEdges(shell, box, rtl) {
|
|
|
3513
3513
|
function measure(controller, root, moved, rtl) {
|
|
3514
3514
|
const { doc } = controller.editor.state;
|
|
3515
3515
|
const origin = rootOrigin(root);
|
|
3516
|
-
return
|
|
3516
|
+
return chunkQJ34MOFV_cjs.visibleBlockIndexes(doc).flatMap((index) => {
|
|
3517
3517
|
const { id, indent: indent3 } = doc.blocks[index];
|
|
3518
3518
|
const shell = controller.blockElement(id);
|
|
3519
3519
|
if (shell === void 0) return [];
|
|
@@ -3528,7 +3528,7 @@ function measureDrag(controller, root, ids) {
|
|
|
3528
3528
|
const { doc } = controller.editor.state;
|
|
3529
3529
|
const direction = inlineDirection(root);
|
|
3530
3530
|
const rtl = direction === "rtl";
|
|
3531
|
-
const moved = new Set(
|
|
3531
|
+
const moved = new Set(chunkVZZPCYA3_cjs.movedBlockIds(doc, ids));
|
|
3532
3532
|
const blocks = measure(controller, root, moved, rtl);
|
|
3533
3533
|
const dragged = blocks.filter((block) => block.dragged);
|
|
3534
3534
|
if (dragged.length === 0) return null;
|
|
@@ -3588,7 +3588,7 @@ function draggedBlocks(controller, blockId) {
|
|
|
3588
3588
|
function followPress(press, root, view) {
|
|
3589
3589
|
const { controller, store, overlay, handle: handle2, pointerId } = press;
|
|
3590
3590
|
const doc = view.document;
|
|
3591
|
-
const scroll =
|
|
3591
|
+
const scroll = chunkQJ34MOFV_cjs.createAutoScroll(root, follow, SCROLL_EDGE);
|
|
3592
3592
|
let pointer = { x: press.x, y: press.y };
|
|
3593
3593
|
let active = null;
|
|
3594
3594
|
let unsubscribe = () => {
|
|
@@ -3641,7 +3641,7 @@ function followPress(press, root, view) {
|
|
|
3641
3641
|
finish();
|
|
3642
3642
|
if (dropped === null || dropped.target === null || controller.readOnly) return;
|
|
3643
3643
|
const { ids, layout, target } = dropped;
|
|
3644
|
-
if (!controller.run(
|
|
3644
|
+
if (!controller.run(chunkVZZPCYA3_cjs.moveBlocksTo(ids, layout.toIndex(target.index), target.indent))) return;
|
|
3645
3645
|
controller.focus();
|
|
3646
3646
|
press.onMoved(ids[0]);
|
|
3647
3647
|
}
|
|
@@ -3663,9 +3663,9 @@ function followPress(press, root, view) {
|
|
|
3663
3663
|
event.stopPropagation();
|
|
3664
3664
|
finish();
|
|
3665
3665
|
}
|
|
3666
|
-
const unlistenDocument =
|
|
3667
|
-
const unlistenBlur =
|
|
3668
|
-
const unlistenKeys =
|
|
3666
|
+
const unlistenDocument = chunkQJ34MOFV_cjs.listen(doc, { pointermove: onPointerMove, pointerup: onPointerUp, pointercancel: finish });
|
|
3667
|
+
const unlistenBlur = chunkQJ34MOFV_cjs.listen(view, { blur: finish });
|
|
3668
|
+
const unlistenKeys = chunkQJ34MOFV_cjs.listen(view, { keydown: onKeyDown }, true);
|
|
3669
3669
|
return finish;
|
|
3670
3670
|
}
|
|
3671
3671
|
function pressDragHandle(press) {
|
|
@@ -3719,10 +3719,10 @@ function addBlockBelow(controller, blockId) {
|
|
|
3719
3719
|
const { doc, schema } = state;
|
|
3720
3720
|
const block = chunkWZA5S5EJ_cjs.blockById(doc, blockId);
|
|
3721
3721
|
if (block === void 0) return false;
|
|
3722
|
-
const empty =
|
|
3723
|
-
const fill = empty ?
|
|
3724
|
-
const slash =
|
|
3725
|
-
const { ok, tr } =
|
|
3722
|
+
const empty = chunkVZZPCYA3_cjs.isParagraph(block) && chunkVZZPCYA3_cjs.regionLength(block, chunkVZZPCYA3_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
3723
|
+
const fill = empty ? chunkVZZPCYA3_cjs.setSelection(chunkVZZPCYA3_cjs.startOf(doc, schema, blockId)) : chunkVZZPCYA3_cjs.insertBlockAfter("MARKDOWN", { kind: "paragraph" });
|
|
3724
|
+
const slash = chunkVZZPCYA3_cjs.insertText("/", { origin: "command" });
|
|
3725
|
+
const { ok, tr } = chunkVZZPCYA3_cjs.runCommands(state, [chunkVZZPCYA3_cjs.setSelection(chunkVZZPCYA3_cjs.blockRangeSelection(blockId)), fill, slash]);
|
|
3726
3726
|
if (ok && tr !== null) controller.dispatch(tr);
|
|
3727
3727
|
controller.focus();
|
|
3728
3728
|
return ok;
|
|
@@ -3800,7 +3800,7 @@ function place2(controller, root, gutter, block) {
|
|
|
3800
3800
|
gutter.style.visibility = "";
|
|
3801
3801
|
}
|
|
3802
3802
|
function useGutterPosition(controller, gutter, block) {
|
|
3803
|
-
|
|
3803
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
3804
3804
|
const element = gutter.current;
|
|
3805
3805
|
const root = controller.root;
|
|
3806
3806
|
const view = root?.ownerDocument.defaultView;
|
|
@@ -3824,7 +3824,7 @@ function useGutterPosition(controller, gutter, block) {
|
|
|
3824
3824
|
};
|
|
3825
3825
|
}, [controller, gutter, block]);
|
|
3826
3826
|
}
|
|
3827
|
-
var headOf = (state) =>
|
|
3827
|
+
var headOf = (state) => chunkVZZPCYA3_cjs.headBlockId(state.selection);
|
|
3828
3828
|
function blockAcross(controller, root, y) {
|
|
3829
3829
|
const box = root.getBoundingClientRect();
|
|
3830
3830
|
const probe = root.ownerDocument.elementFromPoint?.(box.left + box.width / 2, y);
|
|
@@ -3832,7 +3832,7 @@ function blockAcross(controller, root, y) {
|
|
|
3832
3832
|
}
|
|
3833
3833
|
function useGutterTarget(controller, store, gutter) {
|
|
3834
3834
|
const hovered = useCanvasUi(store, (state) => state.hoveredBlock);
|
|
3835
|
-
const head =
|
|
3835
|
+
const head = chunkQJ34MOFV_cjs.useEditorState(controller, headOf);
|
|
3836
3836
|
const [focusWithin, setFocusWithin] = React7.useState(false);
|
|
3837
3837
|
React7.useEffect(() => {
|
|
3838
3838
|
const root = controller.root;
|
|
@@ -3850,7 +3850,7 @@ function useGutterTarget(controller, store, gutter) {
|
|
|
3850
3850
|
const onFocusIn = () => setFocusWithin(true);
|
|
3851
3851
|
const onFocusOut = (event) => setFocusWithin(root.contains(event.relatedTarget));
|
|
3852
3852
|
setFocusWithin(root.contains(root.ownerDocument.activeElement));
|
|
3853
|
-
return
|
|
3853
|
+
return chunkQJ34MOFV_cjs.listen(root, { pointermove: onPointerMove, pointerleave: onPointerLeave, focusin: onFocusIn, focusout: onFocusOut });
|
|
3854
3854
|
}, [controller, store, gutter]);
|
|
3855
3855
|
const fallback = focusWithin ? head : null;
|
|
3856
3856
|
const target = hovered ?? fallback;
|
|
@@ -3947,7 +3947,7 @@ function pointInHost(host, { node, offset }) {
|
|
|
3947
3947
|
return host.contains(node) ? { node, offset: Math.min(offset, nodeLength(node)) } : null;
|
|
3948
3948
|
}
|
|
3949
3949
|
function textRect(host, { from, to }) {
|
|
3950
|
-
const map =
|
|
3950
|
+
const map = chunkQJ34MOFV_cjs.domMapOf(host);
|
|
3951
3951
|
const range = host.ownerDocument.createRange();
|
|
3952
3952
|
if (map === void 0 || typeof range.getBoundingClientRect !== "function") return null;
|
|
3953
3953
|
const start = pointInHost(host, map.toDom(from, 1));
|
|
@@ -3960,7 +3960,7 @@ function textRect(host, { from, to }) {
|
|
|
3960
3960
|
}
|
|
3961
3961
|
function rangeRect(controller, range) {
|
|
3962
3962
|
const host = controller.registry.get(range.block, range.region);
|
|
3963
|
-
if (host === void 0 || !host.isConnected || controller.composingKey ===
|
|
3963
|
+
if (host === void 0 || !host.isConnected || controller.composingKey === chunkQJ34MOFV_cjs.hostKey(range.block, range.region)) {
|
|
3964
3964
|
return null;
|
|
3965
3965
|
}
|
|
3966
3966
|
const rect = textRect(host, range);
|
|
@@ -3976,7 +3976,7 @@ function union(a, b) {
|
|
|
3976
3976
|
function selectionRect(controller) {
|
|
3977
3977
|
const { state } = controller.editor;
|
|
3978
3978
|
if (state.selection?.kind !== "text") return null;
|
|
3979
|
-
const ranges =
|
|
3979
|
+
const ranges = chunkVZZPCYA3_cjs.markRanges(state);
|
|
3980
3980
|
if (ranges.length === 0) return null;
|
|
3981
3981
|
const first = rangeRect(controller, ranges[0]);
|
|
3982
3982
|
if (ranges.length === 1) return first;
|
|
@@ -3987,7 +3987,7 @@ function selectionRect(controller) {
|
|
|
3987
3987
|
// src/menus/floating/use-selection-anchor.ts
|
|
3988
3988
|
var ROOM_ABOVE = 56;
|
|
3989
3989
|
function selectionHost(controller) {
|
|
3990
|
-
const [first] =
|
|
3990
|
+
const [first] = chunkVZZPCYA3_cjs.markRanges(controller.editor.state);
|
|
3991
3991
|
return (first && controller.registry.get(first.block, first.region)) ?? controller.root ?? void 0;
|
|
3992
3992
|
}
|
|
3993
3993
|
function useSelectionAnchor(controller, state) {
|
|
@@ -4001,7 +4001,7 @@ function useSelectionAnchor(controller, state) {
|
|
|
4001
4001
|
[controller, state]
|
|
4002
4002
|
);
|
|
4003
4003
|
const [side, setSide] = React7.useState("top");
|
|
4004
|
-
|
|
4004
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4005
4005
|
const rect = selectionRect(controller);
|
|
4006
4006
|
if (rect) setSide(rect.top < ROOM_ABOVE ? "bottom" : "top");
|
|
4007
4007
|
}, [controller, state]);
|
|
@@ -4036,7 +4036,7 @@ var ICONS = { left: lucideReact.AlignLeft, center: lucideReact.AlignCenter, righ
|
|
|
4036
4036
|
var ALIGNS2 = Object.keys(ICONS);
|
|
4037
4037
|
var LABEL_KEYS = { left: "alignLeft", center: "alignCenter", right: "alignRight", justify: "alignJustify" };
|
|
4038
4038
|
function sharedAlign(state) {
|
|
4039
|
-
const blocks =
|
|
4039
|
+
const blocks = chunkVZZPCYA3_cjs.selectedBlockIds(state.doc, state.selection).map((id) => chunkWZA5S5EJ_cjs.blockById(state.doc, id)).filter((block) => block?.type === "MARKDOWN");
|
|
4040
4040
|
if (blocks.length === 0) return null;
|
|
4041
4041
|
const aligns = new Set(blocks.map((block) => chunkWZA5S5EJ_cjs.alignOrUndefined(block?.attrs.align) ?? "left"));
|
|
4042
4042
|
return aligns.size === 1 ? [...aligns][0] : "";
|
|
@@ -4047,7 +4047,7 @@ function AlignDropdown({ controller, state }) {
|
|
|
4047
4047
|
if (value === null) return null;
|
|
4048
4048
|
const Icon = value === "" ? lucideReact.AlignLeft : ICONS[value];
|
|
4049
4049
|
const trigger = /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": labels.align, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {}) });
|
|
4050
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(
|
|
4050
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRadioGroup, { value, onValueChange: (align) => controller.run(chunkVZZPCYA3_cjs.setTextAlign(align)), children: ALIGNS2.map((align) => /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuRadioItem, { value: align, indicator: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }), children: [
|
|
4051
4051
|
/* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { icon: ICONS[align] }),
|
|
4052
4052
|
labels[LABEL_KEYS[align]]
|
|
4053
4053
|
] }, align)) }) });
|
|
@@ -4055,8 +4055,8 @@ function AlignDropdown({ controller, state }) {
|
|
|
4055
4055
|
var MARKS = { color: "color", background: "highlight" };
|
|
4056
4056
|
function selectionColor(state, mark) {
|
|
4057
4057
|
const names = /* @__PURE__ */ new Set();
|
|
4058
|
-
for (const range of
|
|
4059
|
-
for (const node of
|
|
4058
|
+
for (const range of chunkVZZPCYA3_cjs.markRanges(state)) {
|
|
4059
|
+
for (const node of chunkVZZPCYA3_cjs.rangeContent(state, range)) {
|
|
4060
4060
|
const found = node.marks.find((candidate) => candidate.type === mark);
|
|
4061
4061
|
names.add(found === void 0 ? "default" : found.attrs?.color);
|
|
4062
4062
|
}
|
|
@@ -4065,7 +4065,7 @@ function selectionColor(state, mark) {
|
|
|
4065
4065
|
return names.size === 1 && typeof only === "string" ? only : "";
|
|
4066
4066
|
}
|
|
4067
4067
|
function colorCommand(key, name) {
|
|
4068
|
-
return name === "default" ?
|
|
4068
|
+
return name === "default" ? chunkVZZPCYA3_cjs.unsetMark(MARKS[key]) : chunkVZZPCYA3_cjs.setMark(MARKS[key], { color: name });
|
|
4069
4069
|
}
|
|
4070
4070
|
function ColorPopover({ controller, state }) {
|
|
4071
4071
|
const labels = useLabels();
|
|
@@ -4079,11 +4079,11 @@ function TurnIntoDropdown({ controller, state }) {
|
|
|
4079
4079
|
labels.turnInto,
|
|
4080
4080
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {})
|
|
4081
4081
|
] });
|
|
4082
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds:
|
|
4082
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarMenu, { controller, trigger, children: /* @__PURE__ */ jsxRuntime.jsx(TurnIntoItems, { kit: DROPDOWN_KIT, controller, blockIds: chunkVZZPCYA3_cjs.selectedBlockIds(state.doc, state.selection) }) });
|
|
4083
4083
|
}
|
|
4084
4084
|
var DIVIDER = "mx-0.5 h-5 w-px shrink-0 bg-border";
|
|
4085
4085
|
function BubbleToolbar({ controller, labels, store, extraItems }) {
|
|
4086
|
-
const state =
|
|
4086
|
+
const state = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_cjs.wholeState);
|
|
4087
4087
|
const { anchor, side } = useSelectionAnchor(controller, state);
|
|
4088
4088
|
const roving = useRovingFocus();
|
|
4089
4089
|
const items = React7.useMemo(() => bubbleItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -4145,10 +4145,10 @@ function useMediaQuery(query, unsupported) {
|
|
|
4145
4145
|
var useFinePointer = () => useMediaQuery("(pointer: fine)", true);
|
|
4146
4146
|
|
|
4147
4147
|
// src/menus/bubble/use-bubble-visibility.ts
|
|
4148
|
-
var hasTextRange = (state) => state.selection?.kind === "text" && !
|
|
4148
|
+
var hasTextRange = (state) => state.selection?.kind === "text" && !chunkVZZPCYA3_cjs.isCollapsed(state.selection) && chunkVZZPCYA3_cjs.markRanges(state).length > 0;
|
|
4149
4149
|
function useBubbleVisibility(controller) {
|
|
4150
|
-
const range =
|
|
4151
|
-
const readOnly =
|
|
4150
|
+
const range = chunkQJ34MOFV_cjs.useEditorState(controller, hasTextRange);
|
|
4151
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
4152
4152
|
const fine = useFinePointer();
|
|
4153
4153
|
const settled = useSelectionSettled(controller);
|
|
4154
4154
|
return range && !readOnly && fine && settled;
|
|
@@ -4165,14 +4165,14 @@ function BubbleOverlay({ controller }) {
|
|
|
4165
4165
|
return /* @__PURE__ */ jsxRuntime.jsx(BubbleToolbar, { controller, labels, store, extraItems });
|
|
4166
4166
|
}
|
|
4167
4167
|
function bubbleExtension() {
|
|
4168
|
-
return
|
|
4168
|
+
return chunkVZZPCYA3_cjs.defineExtension({ name: "bubble", ui: { overlays: [BubbleOverlay] } });
|
|
4169
4169
|
}
|
|
4170
4170
|
|
|
4171
4171
|
// src/menus/link/link-at-selection.ts
|
|
4172
4172
|
function linkAround(state, from, to = from) {
|
|
4173
4173
|
if (from.block !== to.block || from.region !== to.region) return null;
|
|
4174
|
-
const inline =
|
|
4175
|
-
const extent =
|
|
4174
|
+
const inline = chunkQJ34MOFV_cjs.regionInline(state, from.block, from.region) ?? [];
|
|
4175
|
+
const extent = chunkVZZPCYA3_cjs.markExtent(inline, from.offset, "link");
|
|
4176
4176
|
if (extent === null || to.offset > extent.to) return null;
|
|
4177
4177
|
const attrs = chunkWZA5S5EJ_cjs.sliceInline(inline, extent.from, extent.to)[0]?.marks.find((mark) => mark.type === "link")?.attrs;
|
|
4178
4178
|
if (attrs?.href === void 0) return null;
|
|
@@ -4182,7 +4182,7 @@ function linkAround(state, from, to = from) {
|
|
|
4182
4182
|
function linkAtSelection(state) {
|
|
4183
4183
|
const { selection } = state;
|
|
4184
4184
|
if (selection?.kind !== "text") return null;
|
|
4185
|
-
const { from, to } =
|
|
4185
|
+
const { from, to } = chunkVZZPCYA3_cjs.orderedRange(state.doc, selection.anchor, selection.head);
|
|
4186
4186
|
return linkAround(state, from, to);
|
|
4187
4187
|
}
|
|
4188
4188
|
|
|
@@ -4194,7 +4194,7 @@ function linkElementAt(controller, target) {
|
|
|
4194
4194
|
}
|
|
4195
4195
|
function linkAtElement(controller, state, element) {
|
|
4196
4196
|
const host = controller.registry.locate(element);
|
|
4197
|
-
const offset = host === null ? null :
|
|
4197
|
+
const offset = host === null ? null : chunkQJ34MOFV_cjs.domMapOf(host.element)?.fromDom(element, 0) ?? null;
|
|
4198
4198
|
if (host === null || offset === null) return null;
|
|
4199
4199
|
return linkAround(state, { block: host.block, region: host.region, offset });
|
|
4200
4200
|
}
|
|
@@ -4220,7 +4220,7 @@ function truncateMiddle(text2, max) {
|
|
|
4220
4220
|
// src/menus/link/unlink-range.ts
|
|
4221
4221
|
function unlinkRange({ block, region, from, to }) {
|
|
4222
4222
|
return (state, dispatch) => {
|
|
4223
|
-
const tr = new
|
|
4223
|
+
const tr = new chunkVZZPCYA3_cjs.Transaction(state).step(chunkVZZPCYA3_cjs.removeMarkStep(block, region, from, to, "link"));
|
|
4224
4224
|
if (!tr.docChanged) return false;
|
|
4225
4225
|
dispatch?.(tr);
|
|
4226
4226
|
return true;
|
|
@@ -4242,12 +4242,12 @@ function useRestedValue(value, delay) {
|
|
|
4242
4242
|
// src/menus/link/use-caret-in-link.ts
|
|
4243
4243
|
function caretLinkKey(state) {
|
|
4244
4244
|
const { selection } = state;
|
|
4245
|
-
if (selection?.kind !== "text" || !
|
|
4245
|
+
if (selection?.kind !== "text" || !chunkVZZPCYA3_cjs.isCollapsed(selection)) return null;
|
|
4246
4246
|
const link = linkAtSelection(state);
|
|
4247
4247
|
return link && [link.range.block, link.range.region, link.range.from, link.href].join("\0");
|
|
4248
4248
|
}
|
|
4249
4249
|
function useCaretInLink(controller, delay) {
|
|
4250
|
-
const key =
|
|
4250
|
+
const key = chunkQJ34MOFV_cjs.useEditorState(controller, caretLinkKey);
|
|
4251
4251
|
const settled = useSelectionSettled(controller);
|
|
4252
4252
|
return useRestedValue(settled ? key : null, delay) !== null;
|
|
4253
4253
|
}
|
|
@@ -4281,7 +4281,7 @@ var URL_LENGTH = 48;
|
|
|
4281
4281
|
var CARD = "flex w-auto items-center gap-0.5 py-1 ps-3 pe-1 shadow-md";
|
|
4282
4282
|
var ADDRESS = "me-1 whitespace-nowrap text-sm text-muted-foreground";
|
|
4283
4283
|
function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
4284
|
-
const state =
|
|
4284
|
+
const state = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_cjs.wholeState);
|
|
4285
4285
|
const link = React7.useMemo(
|
|
4286
4286
|
() => element === null ? linkAtSelection(state) : linkAtElement(controller, state, element),
|
|
4287
4287
|
[controller, state, element]
|
|
@@ -4298,8 +4298,8 @@ function LinkCard({ controller, labels, store, cardRef, element, onUnlinked }) {
|
|
|
4298
4298
|
const address = truncateMiddle(link.href, URL_LENGTH);
|
|
4299
4299
|
const edit2 = () => {
|
|
4300
4300
|
if (element !== null) {
|
|
4301
|
-
const selection =
|
|
4302
|
-
|
|
4301
|
+
const selection = chunkVZZPCYA3_cjs.textSelection({ block, region, offset: from }, { block, region, offset: to });
|
|
4302
|
+
chunkQJ34MOFV_cjs.dispatchSelection(controller, selection);
|
|
4303
4303
|
}
|
|
4304
4304
|
store.set({ linkPopover: { open: true } });
|
|
4305
4305
|
};
|
|
@@ -4345,8 +4345,8 @@ function insertLinkedText(value, href, caret) {
|
|
|
4345
4345
|
return (state, dispatch) => {
|
|
4346
4346
|
if (!safe) return false;
|
|
4347
4347
|
const link = { type: "link", attrs: { href: safe } };
|
|
4348
|
-
const marks = chunkWZA5S5EJ_cjs.addMark(
|
|
4349
|
-
const tr = new
|
|
4348
|
+
const marks = chunkWZA5S5EJ_cjs.addMark(chunkVZZPCYA3_cjs.caretMarks(state.doc, state.schema, state.storedMarks, caret), link);
|
|
4349
|
+
const tr = new chunkVZZPCYA3_cjs.Transaction(state).step(chunkVZZPCYA3_cjs.replaceInlineStep(caret.block, caret.region, caret.offset, caret.offset, [chunkWZA5S5EJ_cjs.text(value, marks)])).setSelection(chunkVZZPCYA3_cjs.textSelection({ ...caret, offset: caret.offset + value.length }));
|
|
4350
4350
|
dispatch?.(tr);
|
|
4351
4351
|
return true;
|
|
4352
4352
|
};
|
|
@@ -4355,10 +4355,10 @@ function applyLink(href, value) {
|
|
|
4355
4355
|
return (state, dispatch) => {
|
|
4356
4356
|
const { selection } = state;
|
|
4357
4357
|
const link = linkAtSelection(state);
|
|
4358
|
-
if (selection?.kind === "text" &&
|
|
4358
|
+
if (selection?.kind === "text" && chunkVZZPCYA3_cjs.isCollapsed(selection) && link === null) {
|
|
4359
4359
|
return insertLinkedText(value, href, selection.head)(state, dispatch);
|
|
4360
4360
|
}
|
|
4361
|
-
return
|
|
4361
|
+
return chunkVZZPCYA3_cjs.setLink(href, link?.title)(state, dispatch);
|
|
4362
4362
|
};
|
|
4363
4363
|
}
|
|
4364
4364
|
var CONTENT2 = "w-80 p-2 shadow-md";
|
|
@@ -4369,7 +4369,7 @@ function popoverAnchor(controller, link) {
|
|
|
4369
4369
|
if (selection?.kind !== "text") return null;
|
|
4370
4370
|
const { block, region, offset } = selection.head;
|
|
4371
4371
|
const caret = link?.range ?? { block, region, from: offset, to: offset };
|
|
4372
|
-
const collapsed =
|
|
4372
|
+
const collapsed = chunkVZZPCYA3_cjs.isCollapsed(selection);
|
|
4373
4373
|
return virtualAnchor(
|
|
4374
4374
|
() => collapsed ? rangeRect(controller, caret) : selectionRect(controller),
|
|
4375
4375
|
() => controller.registry.get(block, region)
|
|
@@ -4398,7 +4398,7 @@ function LinkPopover({ controller, labels, onClose }) {
|
|
|
4398
4398
|
backToText();
|
|
4399
4399
|
};
|
|
4400
4400
|
const remove = () => {
|
|
4401
|
-
controller.run(
|
|
4401
|
+
controller.run(chunkVZZPCYA3_cjs.unsetLink);
|
|
4402
4402
|
backToText();
|
|
4403
4403
|
};
|
|
4404
4404
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4466,7 +4466,7 @@ function LinkOverlay({ controller }) {
|
|
|
4466
4466
|
const labels = useLabels();
|
|
4467
4467
|
const store = useCanvasUiStore();
|
|
4468
4468
|
const popoverOpen = useCanvasUi(store, isPopoverOpen);
|
|
4469
|
-
const readOnly =
|
|
4469
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
4470
4470
|
useLinkClicks(controller);
|
|
4471
4471
|
React7.useEffect(() => {
|
|
4472
4472
|
if (readOnly && store.get().linkPopover.open) store.set({ linkPopover: { open: false } });
|
|
@@ -4481,7 +4481,7 @@ function linkExtension(store) {
|
|
|
4481
4481
|
if (dispatch) store.set({ linkPopover: { open: true } });
|
|
4482
4482
|
return true;
|
|
4483
4483
|
};
|
|
4484
|
-
return
|
|
4484
|
+
return chunkVZZPCYA3_cjs.defineExtension({ name: "link", keymap: { "Mod-k": openPopover }, ui: { overlays: [LinkOverlay] } });
|
|
4485
4485
|
}
|
|
4486
4486
|
|
|
4487
4487
|
// src/menus/suggestion/find-trigger.ts
|
|
@@ -4506,7 +4506,7 @@ function triggerOffset(text2, start, config) {
|
|
|
4506
4506
|
}
|
|
4507
4507
|
function findTrigger(state, config) {
|
|
4508
4508
|
const { doc, selection } = state;
|
|
4509
|
-
if (selection?.kind !== "text" || !
|
|
4509
|
+
if (selection?.kind !== "text" || !chunkVZZPCYA3_cjs.isCollapsed(selection)) return null;
|
|
4510
4510
|
const { block: blockId, region, offset: caret } = selection.head;
|
|
4511
4511
|
const block = chunkWZA5S5EJ_cjs.blockById(doc, blockId);
|
|
4512
4512
|
if (block === void 0 || NO_TRIGGER_TYPES.has(block.type) || !Object.hasOwn(block.regions, region)) return null;
|
|
@@ -4544,7 +4544,7 @@ function suggestionPlugin(key, config) {
|
|
|
4544
4544
|
init: (state) => ({ active: nearest(state, findTrigger(state, config)), dismissedAt: null }),
|
|
4545
4545
|
apply(tr, value, oldState, newState) {
|
|
4546
4546
|
const dismissing = tr.getMeta(DISMISS) === key.name;
|
|
4547
|
-
if (!dismissing && !tr.docChanged &&
|
|
4547
|
+
if (!dismissing && !tr.docChanged && chunkVZZPCYA3_cjs.sameSelection(oldState.selection, newState.selection)) return value;
|
|
4548
4548
|
const found = findTrigger(newState, config);
|
|
4549
4549
|
let dismissedAt = null;
|
|
4550
4550
|
if (dismissing) dismissedAt = found && rangeOf2(found);
|
|
@@ -4561,14 +4561,14 @@ function suggestionPlugin(key, config) {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
function dismissSuggestion(key) {
|
|
4563
4563
|
return (state, dispatch) => {
|
|
4564
|
-
if (
|
|
4565
|
-
dispatch?.(new
|
|
4564
|
+
if (chunkVZZPCYA3_cjs.getPluginState(state, key).active === null) return false;
|
|
4565
|
+
dispatch?.(new chunkVZZPCYA3_cjs.Transaction(state).setMeta(DISMISS, key.name));
|
|
4566
4566
|
return true;
|
|
4567
4567
|
};
|
|
4568
4568
|
}
|
|
4569
4569
|
|
|
4570
4570
|
// src/menus/slash/slash-key.ts
|
|
4571
|
-
var slashKey =
|
|
4571
|
+
var slashKey = chunkVZZPCYA3_cjs.createPluginKey("slash");
|
|
4572
4572
|
var DETAILS = {
|
|
4573
4573
|
text: { group: "basic", keywords: ["paragraph", "plain"], shortcut: "Mod-Alt-0" },
|
|
4574
4574
|
heading1: { group: "basic", keywords: ["h1", "title", "#"], shortcut: "Mod-Alt-1" },
|
|
@@ -4644,10 +4644,10 @@ function useRangeAnchor(controller, range) {
|
|
|
4644
4644
|
const [side, setSide] = React7.useState("bottom");
|
|
4645
4645
|
const latest = React7.useRef(range);
|
|
4646
4646
|
const start = range === null ? null : `${range.block} ${range.region} ${range.from}`;
|
|
4647
|
-
|
|
4647
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4648
4648
|
latest.current = range;
|
|
4649
4649
|
});
|
|
4650
|
-
|
|
4650
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4651
4651
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
4652
4652
|
if (rect) setSide(sideFor(rect, window.innerHeight));
|
|
4653
4653
|
}, [controller, start]);
|
|
@@ -4673,11 +4673,11 @@ function openCombobox(host, listboxId) {
|
|
|
4673
4673
|
}
|
|
4674
4674
|
function useComboboxHost(controller, block, region, listboxId, activeOptionId) {
|
|
4675
4675
|
const host = React7.useRef(null);
|
|
4676
|
-
|
|
4676
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4677
4677
|
host.current = block === null || region === null ? null : controller.registry.get(block, region) ?? null;
|
|
4678
4678
|
return host.current === null ? void 0 : openCombobox(host.current, listboxId);
|
|
4679
4679
|
}, [controller, block, region, listboxId]);
|
|
4680
|
-
|
|
4680
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4681
4681
|
if (host.current !== null) restore(host.current, "aria-activedescendant", activeOptionId);
|
|
4682
4682
|
}, [block, region, activeOptionId]);
|
|
4683
4683
|
}
|
|
@@ -4723,10 +4723,10 @@ function handle(event, menu) {
|
|
|
4723
4723
|
}
|
|
4724
4724
|
function useSuggestionKeys(controller, open, menu) {
|
|
4725
4725
|
const latest = React7.useRef(menu);
|
|
4726
|
-
|
|
4726
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4727
4727
|
latest.current = menu;
|
|
4728
4728
|
});
|
|
4729
|
-
|
|
4729
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4730
4730
|
if (!open) return;
|
|
4731
4731
|
const intercept = (event) => {
|
|
4732
4732
|
const handled = handle(event, latest.current);
|
|
@@ -4747,10 +4747,10 @@ var isPromise = (value) => typeof value?.then === "function";
|
|
|
4747
4747
|
function useSuggestionResults(source, query, onError) {
|
|
4748
4748
|
const [answer, setAnswer] = React7.useState(FORGOTTEN);
|
|
4749
4749
|
const report = React7.useRef(onError);
|
|
4750
|
-
|
|
4750
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4751
4751
|
report.current = onError;
|
|
4752
4752
|
});
|
|
4753
|
-
|
|
4753
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4754
4754
|
if (query === null) {
|
|
4755
4755
|
setAnswer(FORGOTTEN);
|
|
4756
4756
|
return;
|
|
@@ -4794,9 +4794,9 @@ function useSuggestion({
|
|
|
4794
4794
|
emptyLabel
|
|
4795
4795
|
}) {
|
|
4796
4796
|
const { labels, onError } = useQuoin();
|
|
4797
|
-
const readOnly =
|
|
4798
|
-
const selectTrigger = React7.useCallback((state) =>
|
|
4799
|
-
const active =
|
|
4797
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
4798
|
+
const selectTrigger = React7.useCallback((state) => chunkVZZPCYA3_cjs.getPluginState(state, pluginKey).active, [pluginKey]);
|
|
4799
|
+
const active = chunkQJ34MOFV_cjs.useEditorState(controller, selectTrigger);
|
|
4800
4800
|
const trigger = readOnly ? null : active;
|
|
4801
4801
|
const results = useSuggestionResults(source, trigger?.query ?? null, onError);
|
|
4802
4802
|
const sections = React7.useMemo(() => groupItems(results.items, groupOf2), [results.items, groupOf2]);
|
|
@@ -4818,7 +4818,7 @@ function useSuggestion({
|
|
|
4818
4818
|
);
|
|
4819
4819
|
const select = React7.useCallback(
|
|
4820
4820
|
(index) => {
|
|
4821
|
-
const current =
|
|
4821
|
+
const current = chunkVZZPCYA3_cjs.getPluginState(controller.editor.state, pluginKey).active;
|
|
4822
4822
|
if (current !== null && index < ordered.length) onSelect(ordered[index], rangeOf2(current));
|
|
4823
4823
|
},
|
|
4824
4824
|
[controller, pluginKey, ordered, onSelect]
|
|
@@ -4866,7 +4866,7 @@ function SuggestionMenu(props) {
|
|
|
4866
4866
|
const { trigger, sections, activeIndex, listboxId } = suggestion;
|
|
4867
4867
|
const { anchor, side } = useRangeAnchor(controller, trigger);
|
|
4868
4868
|
const listbox = React7.useRef(null);
|
|
4869
|
-
|
|
4869
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
4870
4870
|
listbox.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
4871
4871
|
}, [activeIndex, sections]);
|
|
4872
4872
|
if (trigger === null) return null;
|
|
@@ -4925,14 +4925,14 @@ function SuggestionMenu(props) {
|
|
|
4925
4925
|
// src/menus/suggestion/replace-trigger.ts
|
|
4926
4926
|
function deleteTrigger({ block, region, from, to }) {
|
|
4927
4927
|
return (state, dispatch) => {
|
|
4928
|
-
const tr = new
|
|
4929
|
-
if (from >= to || !tr.maybeStep(
|
|
4930
|
-
dispatch?.(tr.setSelection(
|
|
4928
|
+
const tr = new chunkVZZPCYA3_cjs.Transaction(state);
|
|
4929
|
+
if (from >= to || !tr.maybeStep(chunkVZZPCYA3_cjs.replaceInlineStep(block, region, from, to, []))) return false;
|
|
4930
|
+
dispatch?.(tr.setSelection(chunkVZZPCYA3_cjs.textSelection({ block, region, offset: from })));
|
|
4931
4931
|
return true;
|
|
4932
4932
|
};
|
|
4933
4933
|
}
|
|
4934
4934
|
function triggerReplacement(state, range, command) {
|
|
4935
|
-
return
|
|
4935
|
+
return chunkVZZPCYA3_cjs.runCommands(state, command === void 0 ? [deleteTrigger(range)] : [deleteTrigger(range), command]);
|
|
4936
4936
|
}
|
|
4937
4937
|
function replaceTrigger(controller, range, command) {
|
|
4938
4938
|
const { ok, tr } = triggerReplacement(controller.editor.state, range, command);
|
|
@@ -4945,7 +4945,7 @@ var TEXT_STEPS = /* @__PURE__ */ new Set(["replaceInline", "addMark", "removeMar
|
|
|
4945
4945
|
var WHITESPACE3 = /\s/;
|
|
4946
4946
|
var changesBlocks = (tr) => tr !== null && tr.steps.some((step) => !TEXT_STEPS.has(step.stepType));
|
|
4947
4947
|
function withSpaceBefore(state, range) {
|
|
4948
|
-
const inline =
|
|
4948
|
+
const inline = chunkQJ34MOFV_cjs.regionInline(state, range.block, range.region);
|
|
4949
4949
|
if (inline === void 0 || range.from === 0) return null;
|
|
4950
4950
|
const text2 = chunkWZA5S5EJ_cjs.inlineText(inline);
|
|
4951
4951
|
const after = text2.charAt(range.to);
|
|
@@ -5052,7 +5052,7 @@ function SlashOverlay({ controller }) {
|
|
|
5052
5052
|
return /* @__PURE__ */ jsxRuntime.jsx(SlashMenu, { controller, labels, items });
|
|
5053
5053
|
}
|
|
5054
5054
|
function slashExtension() {
|
|
5055
|
-
return
|
|
5055
|
+
return chunkVZZPCYA3_cjs.defineExtension({
|
|
5056
5056
|
name: "slash",
|
|
5057
5057
|
plugins: [suggestionPlugin(slashKey, { char: "/" })],
|
|
5058
5058
|
ui: { overlays: [SlashOverlay] }
|
|
@@ -5062,7 +5062,7 @@ function commandItem(id, title, icon, command) {
|
|
|
5062
5062
|
return { id, title, icon, run: (controller) => void controller.run(command) };
|
|
5063
5063
|
}
|
|
5064
5064
|
function addBlockAtCaret(controller) {
|
|
5065
|
-
const block =
|
|
5065
|
+
const block = chunkVZZPCYA3_cjs.headBlockId(controller.editor.state.selection);
|
|
5066
5066
|
if (block !== null) addBlockBelow(controller, block);
|
|
5067
5067
|
}
|
|
5068
5068
|
function mobileItems(labels, openLink) {
|
|
@@ -5074,10 +5074,10 @@ function mobileItems(labels, openLink) {
|
|
|
5074
5074
|
markItem("strike", labels.strike, lucideReact.Strikethrough),
|
|
5075
5075
|
markItem("code", labels.code, lucideReact.Code),
|
|
5076
5076
|
linkItem(labels, openLink),
|
|
5077
|
-
commandItem("indent", labels.indent, lucideReact.ListIndentIncrease,
|
|
5078
|
-
commandItem("outdent", labels.outdent, lucideReact.ListIndentDecrease,
|
|
5079
|
-
commandItem("undo", labels.undo, lucideReact.Undo2,
|
|
5080
|
-
commandItem("redo", labels.redo, lucideReact.Redo2,
|
|
5077
|
+
commandItem("indent", labels.indent, lucideReact.ListIndentIncrease, chunkVZZPCYA3_cjs.indent),
|
|
5078
|
+
commandItem("outdent", labels.outdent, lucideReact.ListIndentDecrease, chunkVZZPCYA3_cjs.outdent),
|
|
5079
|
+
commandItem("undo", labels.undo, lucideReact.Undo2, chunkVZZPCYA3_cjs.undo),
|
|
5080
|
+
commandItem("redo", labels.redo, lucideReact.Redo2, chunkVZZPCYA3_cjs.redo)
|
|
5081
5081
|
]
|
|
5082
5082
|
};
|
|
5083
5083
|
}
|
|
@@ -5131,7 +5131,7 @@ function placement(viewport) {
|
|
|
5131
5131
|
function EditingTools({ controller }) {
|
|
5132
5132
|
const labels = useLabels();
|
|
5133
5133
|
const store = useCanvasUiStore();
|
|
5134
|
-
const state =
|
|
5134
|
+
const state = chunkQJ34MOFV_cjs.useEditorState(controller, chunkQJ34MOFV_cjs.wholeState);
|
|
5135
5135
|
const viewport = useVisualViewport();
|
|
5136
5136
|
const roving = useRovingFocus();
|
|
5137
5137
|
const items = React7.useMemo(() => mobileItems(labels, () => store.set({ linkPopover: { open: true } })), [labels, store]);
|
|
@@ -5388,7 +5388,7 @@ function shortcutsExtension(store) {
|
|
|
5388
5388
|
if (dispatch) store.set({ shortcutsOpen: true });
|
|
5389
5389
|
return true;
|
|
5390
5390
|
};
|
|
5391
|
-
return
|
|
5391
|
+
return chunkVZZPCYA3_cjs.defineExtension({
|
|
5392
5392
|
name: "shortcuts",
|
|
5393
5393
|
keymap: { [SHORTCUT]: open, "Mod-Shift-?": open },
|
|
5394
5394
|
ui: { overlays: [ShortcutsOverlay] }
|
|
@@ -5424,8 +5424,8 @@ function writeBlockData(controller, blockId, data) {
|
|
|
5424
5424
|
const block = doc.blocks[index];
|
|
5425
5425
|
const { attrs, regions } = chunkWZA5S5EJ_cjs.specFor(schema, block.type).fromData(data, editor.codec.context);
|
|
5426
5426
|
if (chunkWZA5S5EJ_cjs.sameValue(attrs, block.attrs) && chunkWZA5S5EJ_cjs.sameValue(regions, block.regions)) return;
|
|
5427
|
-
const tr = editor.createTransaction().step(
|
|
5428
|
-
editor.dispatch(tr.setMeta(
|
|
5427
|
+
const tr = editor.createTransaction().step(chunkVZZPCYA3_cjs.replaceBlockStep({ ...block, attrs, regions }));
|
|
5428
|
+
editor.dispatch(tr.setMeta(chunkVZZPCYA3_cjs.HISTORY_GROUP, `block-data:${blockId}`));
|
|
5429
5429
|
}
|
|
5430
5430
|
function insertAfterBlock(controller, blockId, type, definitions, onError) {
|
|
5431
5431
|
const editor = internal(controller);
|
|
@@ -5455,7 +5455,7 @@ function runHistoryKey(controller, event) {
|
|
|
5455
5455
|
}
|
|
5456
5456
|
function useBlockIndex(controller, blockId) {
|
|
5457
5457
|
const select = React7.useCallback((state) => state.doc.index.get(blockId) ?? -1, [blockId]);
|
|
5458
|
-
return
|
|
5458
|
+
return chunkQJ34MOFV_cjs.useEditorState(controller, select);
|
|
5459
5459
|
}
|
|
5460
5460
|
var FOCUSABLE = [
|
|
5461
5461
|
"input:not([disabled])",
|
|
@@ -5482,8 +5482,8 @@ function useEditingFocus(root, editing, stop) {
|
|
|
5482
5482
|
const leaveUnlessInside = (event) => {
|
|
5483
5483
|
if (!inside.current.has(event)) stop();
|
|
5484
5484
|
};
|
|
5485
|
-
const unlistenCapture =
|
|
5486
|
-
const unlisten =
|
|
5485
|
+
const unlistenCapture = chunkQJ34MOFV_cjs.listen(doc, { pointerdown: leaveForCanvas }, true);
|
|
5486
|
+
const unlisten = chunkQJ34MOFV_cjs.listen(doc, { pointerdown: leaveUnlessInside, focusin: leaveUnlessInside });
|
|
5487
5487
|
return () => {
|
|
5488
5488
|
unlistenCapture();
|
|
5489
5489
|
unlisten();
|
|
@@ -5512,8 +5512,8 @@ function VoidEditor({ Editor, controller, ...props }) {
|
|
|
5512
5512
|
}
|
|
5513
5513
|
function VoidBlock({ block, controller, definition }) {
|
|
5514
5514
|
const { blockTypes, labels } = useQuoin();
|
|
5515
|
-
const { report } = React7.useContext(
|
|
5516
|
-
const readOnly =
|
|
5515
|
+
const { report } = React7.useContext(chunkQJ34MOFV_cjs.BlockErrorContext);
|
|
5516
|
+
const readOnly = chunkQJ34MOFV_cjs.useReadOnly(controller);
|
|
5517
5517
|
const { editor: Editor, alwaysEditing = false } = definition;
|
|
5518
5518
|
const name = blockTypeLabel(labels, block, blockTypes);
|
|
5519
5519
|
const blockId = block.id;
|
|
@@ -5577,7 +5577,7 @@ function VoidBlock({ block, controller, definition }) {
|
|
|
5577
5577
|
role: "group",
|
|
5578
5578
|
"aria-label": name,
|
|
5579
5579
|
tabIndex: editorShown ? -1 : void 0,
|
|
5580
|
-
...{ [
|
|
5580
|
+
...{ [chunkQJ34MOFV_cjs.NATIVE_INTERACTION]: editorShown ? "" : void 0 },
|
|
5581
5581
|
onKeyDown,
|
|
5582
5582
|
...focusHandlers,
|
|
5583
5583
|
onClick,
|
|
@@ -5678,7 +5678,7 @@ function fileBlock(file, stored) {
|
|
|
5678
5678
|
}
|
|
5679
5679
|
function anchorBlock(controller, at) {
|
|
5680
5680
|
const { doc, selection } = controller.editor.state;
|
|
5681
|
-
const candidates = [at?.block,
|
|
5681
|
+
const candidates = [at?.block, chunkVZZPCYA3_cjs.headBlockId(selection), doc.blocks[doc.blocks.length - 1]?.id];
|
|
5682
5682
|
return candidates.find((id) => typeof id === "string" && doc.index.has(id)) ?? null;
|
|
5683
5683
|
}
|
|
5684
5684
|
var writerOf = (controller) => ({
|
|
@@ -5687,7 +5687,7 @@ var writerOf = (controller) => ({
|
|
|
5687
5687
|
});
|
|
5688
5688
|
function movedOn(controller, before) {
|
|
5689
5689
|
const now = writerOf(controller);
|
|
5690
|
-
return now.focus !== before.focus || !
|
|
5690
|
+
return now.focus !== before.focus || !chunkVZZPCYA3_cjs.sameSelection(now.selection, before.selection);
|
|
5691
5691
|
}
|
|
5692
5692
|
async function insertUploads(controller, files, at, { upload, resolveAssetUrl, onError, unavailable, failed }) {
|
|
5693
5693
|
if (!upload) return onError(new Error(unavailable));
|
|
@@ -5722,8 +5722,8 @@ function markdownPlaceholder(state, block, labels) {
|
|
|
5722
5722
|
return holdsHead(state, block) || state.doc.blocks.length === 1 ? labels.placeholderEmpty : void 0;
|
|
5723
5723
|
}
|
|
5724
5724
|
function placeholderFor(state, block, labels) {
|
|
5725
|
-
const region =
|
|
5726
|
-
if (region === null ||
|
|
5725
|
+
const region = chunkVZZPCYA3_cjs.primaryRegion(state.schema, block);
|
|
5726
|
+
if (region === null || chunkVZZPCYA3_cjs.regionLength(block, region) > 0) return void 0;
|
|
5727
5727
|
switch (block.type) {
|
|
5728
5728
|
case "MARKDOWN":
|
|
5729
5729
|
return markdownPlaceholder(state, block, labels);
|
|
@@ -5758,7 +5758,7 @@ function revealLinkedBlock(controller, hash) {
|
|
|
5758
5758
|
if (id === null || shell === void 0) return false;
|
|
5759
5759
|
const { editor } = controller;
|
|
5760
5760
|
const { doc, schema } = editor.state;
|
|
5761
|
-
editor.dispatch(editor.createTransaction().setSelection(
|
|
5761
|
+
editor.dispatch(editor.createTransaction().setSelection(chunkVZZPCYA3_cjs.startOf(doc, schema, id)));
|
|
5762
5762
|
shell.scrollIntoView({ block: "center" });
|
|
5763
5763
|
return true;
|
|
5764
5764
|
}
|
|
@@ -5775,8 +5775,8 @@ function useBlockLinkTarget(controller, focusOnMount) {
|
|
|
5775
5775
|
}, [controller, focusOnMount]);
|
|
5776
5776
|
}
|
|
5777
5777
|
var WRITER_ORIGINS = /* @__PURE__ */ new Set(["command", "input", "paste"]);
|
|
5778
|
-
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(
|
|
5779
|
-
var isEmptyText = (schema, block) =>
|
|
5778
|
+
var isBlockDeletion = (tr) => WRITER_ORIGINS.has(tr.origin) && tr.getMeta(chunkVZZPCYA3_cjs.LINE_JOIN) !== true;
|
|
5779
|
+
var isEmptyText = (schema, block) => chunkVZZPCYA3_cjs.isTextFlow(schema, block) && chunkVZZPCYA3_cjs.regionLength(block, chunkVZZPCYA3_cjs.primaryRegion(schema, block) ?? "") === 0;
|
|
5780
5780
|
function filledLine({ origin, before }, schema) {
|
|
5781
5781
|
const { selection } = before;
|
|
5782
5782
|
if (origin !== "paste" || selection?.kind !== "text") return () => false;
|
|
@@ -5796,7 +5796,7 @@ function deletions(codec, tr) {
|
|
|
5796
5796
|
}
|
|
5797
5797
|
function useDeleteReporter(controller, onDelete) {
|
|
5798
5798
|
const latest = React7.useRef(onDelete);
|
|
5799
|
-
|
|
5799
|
+
chunkQJ34MOFV_cjs.useIsomorphicLayoutEffect(() => {
|
|
5800
5800
|
latest.current = onDelete;
|
|
5801
5801
|
});
|
|
5802
5802
|
React7.useEffect(() => {
|
|
@@ -5850,7 +5850,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5850
5850
|
const [voidEditing] = React7.useState(createVoidEditing);
|
|
5851
5851
|
const [uiStore] = React7.useState(createCanvasUiStore);
|
|
5852
5852
|
const [allExtensions] = React7.useState(() => [
|
|
5853
|
-
...
|
|
5853
|
+
...chunkVZZPCYA3_cjs.coreExtensions(),
|
|
5854
5854
|
voidEditing.extension,
|
|
5855
5855
|
blockMenuKeymap(uiStore),
|
|
5856
5856
|
slashExtension(),
|
|
@@ -5868,7 +5868,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5868
5868
|
);
|
|
5869
5869
|
useTypedInPlaceWarning(blockTypes, readOnly);
|
|
5870
5870
|
const [focusOnMount] = React7.useState(autoFocus);
|
|
5871
|
-
const controller =
|
|
5871
|
+
const controller = chunkQJ34MOFV_cjs.useQuoinEditor({
|
|
5872
5872
|
blocks,
|
|
5873
5873
|
onChange,
|
|
5874
5874
|
readOnly,
|
|
@@ -5912,7 +5912,7 @@ var BlockCanvas = React7.forwardRef(function BlockCanvas2({
|
|
|
5912
5912
|
[controller, resolveAssetUrl]
|
|
5913
5913
|
);
|
|
5914
5914
|
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(
|
|
5915
|
-
|
|
5915
|
+
chunkQJ34MOFV_cjs.EditorView,
|
|
5916
5916
|
{
|
|
5917
5917
|
controller,
|
|
5918
5918
|
renderers: ui.renderers,
|
|
@@ -6190,5 +6190,5 @@ exports.useQuoin = useQuoin;
|
|
|
6190
6190
|
exports.useRangeAnchor = useRangeAnchor;
|
|
6191
6191
|
exports.useRovingFocus = useRovingFocus;
|
|
6192
6192
|
exports.virtualAnchor = virtualAnchor;
|
|
6193
|
-
//# sourceMappingURL=chunk-
|
|
6194
|
-
//# sourceMappingURL=chunk-
|
|
6193
|
+
//# sourceMappingURL=chunk-5MQ2AL7L.cjs.map
|
|
6194
|
+
//# sourceMappingURL=chunk-5MQ2AL7L.cjs.map
|