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