quoin-editor 2.0.1 → 2.0.3
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 +25 -0
- package/dist/ai.cjs +34 -34
- package/dist/ai.js +3 -3
- package/dist/catalogue.cjs +21 -21
- package/dist/catalogue.js +12 -12
- package/dist/{chunk-BYYCD54G.cjs → chunk-3B5VEXVQ.cjs} +2 -2
- package/dist/{chunk-5YAJZSTI.cjs → chunk-4EJJ4ZNC.cjs} +18 -18
- package/dist/{chunk-IKZSCTRF.cjs → chunk-55MN4QZU.cjs} +8 -5
- package/dist/{chunk-NFO3W644.cjs → chunk-5URH2Y2L.cjs} +22 -20
- package/dist/{chunk-B4VCDJSA.js → chunk-77THE3KY.js} +5 -5
- package/dist/{chunk-B4VCDJSA.js.map → chunk-77THE3KY.js.map} +1 -1
- package/dist/{chunk-V4WQG7FR.cjs → chunk-BCCFJINI.cjs} +70 -65
- package/dist/{chunk-NL5J77VD.js → chunk-BNTRGV4A.js} +44 -13
- package/dist/chunk-BNTRGV4A.js.map +1 -0
- package/dist/{chunk-IW4TMECB.js → chunk-C4SRLMQJ.js} +3 -3
- package/dist/{chunk-IW4TMECB.js.map → chunk-C4SRLMQJ.js.map} +1 -1
- package/dist/{chunk-CJVJNMOB.cjs → chunk-DZ5XR4O6.cjs} +177 -143
- package/dist/{chunk-ZN5DHNSL.js → chunk-FGVTDIHT.js} +80 -45
- package/dist/chunk-FGVTDIHT.js.map +1 -0
- package/dist/{chunk-66OPHDFA.cjs → chunk-H3TRVI44.cjs} +50 -50
- package/dist/{chunk-2UKI26JA.js → chunk-LCGOFL7S.js} +15 -10
- package/dist/{chunk-2UKI26JA.js.map → chunk-LCGOFL7S.js.map} +1 -1
- package/dist/{chunk-EU5IGKMP.js → chunk-MDIXI7DM.js} +3 -3
- package/dist/{chunk-EU5IGKMP.js.map → chunk-MDIXI7DM.js.map} +1 -1
- package/dist/{chunk-Z6LAARPB.cjs → chunk-MGN332NY.cjs} +45 -10
- package/dist/{chunk-4PIJC4FD.cjs → chunk-NAMZA4NW.cjs} +14 -14
- package/dist/{chunk-5X52BAZB.js → chunk-NLRSAOCK.js} +5 -5
- package/dist/{chunk-5X52BAZB.js.map → chunk-NLRSAOCK.js.map} +1 -1
- package/dist/{chunk-HOSDMHK6.cjs → chunk-OMUXPNCX.cjs} +27 -26
- package/dist/{chunk-YABGWOAV.js → chunk-QVWNUUMJ.js} +3 -3
- package/dist/{chunk-YABGWOAV.js.map → chunk-QVWNUUMJ.js.map} +1 -1
- package/dist/{chunk-6BVE46K7.js → chunk-RNYETN6X.js} +7 -5
- package/dist/{chunk-6BVE46K7.js.map → chunk-RNYETN6X.js.map} +1 -1
- package/dist/{chunk-77CNOLHY.cjs → chunk-SDFJZNYB.cjs} +3 -3
- package/dist/{chunk-LEICOZYK.cjs → chunk-SQHEZ3JY.cjs} +2 -2
- package/dist/{chunk-D6CIIWCU.cjs → chunk-UWCU6PJY.cjs} +30 -30
- package/dist/{chunk-KQPZTSW3.js → chunk-VQDQBMQY.js} +4 -4
- package/dist/{chunk-KQPZTSW3.js.map → chunk-VQDQBMQY.js.map} +1 -1
- package/dist/{chunk-M77A3EGD.js → chunk-WMM56LIB.js} +8 -5
- package/dist/{chunk-M77A3EGD.js.map → chunk-WMM56LIB.js.map} +1 -1
- package/dist/{chunk-MAS4AEF4.js → chunk-YHAVXOAA.js} +6 -5
- package/dist/chunk-YHAVXOAA.js.map +1 -0
- package/dist/{chunk-J2SVYBTC.js → chunk-YWYTLNAO.js} +4 -4
- package/dist/{chunk-J2SVYBTC.js.map → chunk-YWYTLNAO.js.map} +1 -1
- package/dist/comments.cjs +30 -30
- package/dist/comments.js +3 -3
- package/dist/diagram.cjs +6 -6
- package/dist/diagram.js +3 -3
- package/dist/embed.cjs +5 -5
- package/dist/embed.js +3 -3
- package/dist/emoji-data.cjs +4 -3
- package/dist/emoji-data.js +4 -3
- package/dist/emoji-data.js.map +1 -1
- package/dist/emoji.cjs +6 -6
- package/dist/emoji.js +3 -3
- package/dist/find.cjs +7 -7
- package/dist/find.js +3 -3
- package/dist/headless.cjs +11 -11
- package/dist/headless.js +1 -1
- package/dist/highlight.cjs +3 -3
- package/dist/highlight.js +2 -2
- package/dist/index.cjs +23 -23
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/math.cjs +6 -6
- package/dist/math.js +4 -4
- package/dist/mention.cjs +6 -6
- package/dist/mention.js +4 -4
- package/dist/presence.cjs +12 -12
- package/dist/presence.js +3 -3
- package/dist/source.cjs +2 -2
- package/dist/source.js +2 -2
- package/dist/stats.cjs +6 -6
- package/dist/stats.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/table.cjs +22 -22
- package/dist/table.js +3 -3
- package/dist/toc.cjs +6 -6
- package/dist/toc.js +3 -3
- package/package.json +3 -2
- package/dist/chunk-MAS4AEF4.js.map +0 -1
- package/dist/chunk-NL5J77VD.js.map +0 -1
- package/dist/chunk-ZN5DHNSL.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useQuoinEditor, EditorView, useIsomorphicLayoutEffect, useReadOnly, useEditorState, listen, wholeState, NODE_ENTRY, useBlockDomId, useToggleOpen, ToggleChevron, EditableRegion, drawnBlockCount, isComposingKey, NATIVE_INTERACTION, useRegionDomId, TaskCheckbox, useOrderedNumber, createAutoScroll, domMapOf, dispatchSelection, regionInline, onBlock, hostKey, BlockErrorContext, textDiff, moveToNeighbour, visibleBlockIndexes } from './chunk-
|
|
1
|
+
import { useQuoinEditor, EditorView, useIsomorphicLayoutEffect, inlineDirection, useReadOnly, useEditorState, listen, wholeState, NODE_ENTRY, useBlockDomId, useToggleOpen, ToggleChevron, EditableRegion, calloutTone, drawnBlockCount, isComposingKey, NATIVE_INTERACTION, CALLOUT_TONES, useRegionDomId, TaskCheckbox, useOrderedNumber, createAutoScroll, arrowAsWritten, domMapOf, dispatchSelection, regionInline, onBlock, hostKey, BlockErrorContext, textDiff, moveToNeighbour, visibleBlockIndexes } from './chunk-BNTRGV4A.js';
|
|
2
2
|
import { mergeLabels } from './chunk-DLQCTGC3.js';
|
|
3
3
|
import { defineBlock, devWarn, highlightedLines, blockByType, paletteBlocks, tokenColour, seedData, parsedData } from './chunk-HDJ653LM.js';
|
|
4
4
|
import { createPluginKey, coreExtensions, defineExtension, duplicateBlocks, primaryRegion, regionLength, headBlockId, sameSelection, Transaction, insertBlocksStep, startOf, replaceBlockStep, descendantsEnd, LINE_JOIN, detectMac, selectedBlockIds, blockRangeSelection, runCommands, setSelection, selectedBlockRange, toMarkdown, isCollapsed, createBlock, isParagraph, nodeSelection, setAttrsStep, LINE_SPLIT, validateSelection, endOf, insertBlockAfter, insertText, isTextFlow, markRanges, setTextAlign, orderedRange, unsetLink, textSelection, toggleMark, isActive, setBlockType, getPluginState, rangeContent, unsetMark, setMark, markExtent, setLink, deleteBlocks, setAttrs, HISTORY_GROUP, setBlockColor, removeMarkStep, caretMarks, replaceInlineStep, keyName, normalizeKey, movedBlockIds, moveBlocksUp, moveBlocksDown, selectAll, redo, undo, moveBlocksTo, indent, outdent } from './chunk-5RBMZGKV.js';
|
|
5
5
|
import { str, blockPlainText, sanitizeHref, inlineText, parseInline, newId, createDoc, sameItems, headingLevel, sanitizeAssetUrl, blockById, sliceInline, specFor, createBlockCodec, hasMark, alignOrUndefined, optionalNumber, requireBlockIndex, SCHEME, inlineLength, paletteOrUndefined, PALETTE, addMark, text, sameValue } from './chunk-7Y4B7NHO.js';
|
|
6
|
+
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
6
7
|
import * as React7 from 'react';
|
|
7
8
|
import { createContext, forwardRef, useRef, useImperativeHandle, useState, useMemo, useEffect, Fragment as Fragment$1, useContext, useSyncExternalStore, useCallback, useId, createElement } from 'react';
|
|
8
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -439,7 +440,11 @@ function formatSize(bytes) {
|
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
// src/i18n/english-labels.ts
|
|
442
|
-
|
|
443
|
+
function frozen(labels) {
|
|
444
|
+
for (const label of Object.values(labels)) if (typeof label === "object") Object.freeze(label);
|
|
445
|
+
return Object.freeze(labels);
|
|
446
|
+
}
|
|
447
|
+
var englishLabels = frozen({
|
|
443
448
|
document: "Editor",
|
|
444
449
|
editorHint: "Press Escape, then Tab, to leave the editor.",
|
|
445
450
|
paragraph: "Paragraph",
|
|
@@ -641,7 +646,7 @@ var englishLabels = {
|
|
|
641
646
|
emptyFile: "No file chosen",
|
|
642
647
|
emptyMarkdown: "Empty markdown block",
|
|
643
648
|
emptyCallout: "Empty callout"
|
|
644
|
-
};
|
|
649
|
+
});
|
|
645
650
|
var QuoinContext = React7.createContext(null);
|
|
646
651
|
function QuoinProvider({
|
|
647
652
|
value,
|
|
@@ -1242,7 +1247,6 @@ function closeBlockMenu(store) {
|
|
|
1242
1247
|
}
|
|
1243
1248
|
|
|
1244
1249
|
// src/blocks/text/callout-tone.ts
|
|
1245
|
-
var CALLOUT_TONES = ["info", "tip", "success", "warning", "danger"];
|
|
1246
1250
|
var CALLOUT_ICONS = ["\u{1F4A1}", "\u26A0\uFE0F", "\u2705", "\u2757", "\u2139\uFE0F", "\u{1F4CC}"];
|
|
1247
1251
|
var TONE_ICONS = {
|
|
1248
1252
|
info: "\u2139\uFE0F",
|
|
@@ -1251,9 +1255,6 @@ var TONE_ICONS = {
|
|
|
1251
1255
|
warning: "\u26A0\uFE0F",
|
|
1252
1256
|
danger: "\u2757"
|
|
1253
1257
|
};
|
|
1254
|
-
function calloutTone(value) {
|
|
1255
|
-
return CALLOUT_TONES.find((tone) => tone === value) ?? "info";
|
|
1256
|
-
}
|
|
1257
1258
|
function calloutIcon(attrs, tone) {
|
|
1258
1259
|
return typeof attrs.icon === "string" && attrs.icon !== "" ? attrs.icon : TONE_ICONS[tone];
|
|
1259
1260
|
}
|
|
@@ -1875,7 +1876,7 @@ var CONTENT = `${MENU_CONTENT} flex max-h-64 w-48 flex-col overflow-y-hidden`;
|
|
|
1875
1876
|
function LanguageCombobox({ blockId, controller, language: language2, field, onDone }) {
|
|
1876
1877
|
const labels = useLabels();
|
|
1877
1878
|
const listboxId = useId();
|
|
1878
|
-
const
|
|
1879
|
+
const list2 = useRef(null);
|
|
1879
1880
|
const settled = useRef(false);
|
|
1880
1881
|
const focusedByPress = useRef(false);
|
|
1881
1882
|
const shown = languageName(language2) ?? language2;
|
|
@@ -1885,7 +1886,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1885
1886
|
const open = options.length > 0;
|
|
1886
1887
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1887
1888
|
useIsomorphicLayoutEffect(() => {
|
|
1888
|
-
|
|
1889
|
+
list2.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
|
|
1889
1890
|
}, [active]);
|
|
1890
1891
|
const close = () => {
|
|
1891
1892
|
setDraft(null);
|
|
@@ -1967,7 +1968,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1967
1968
|
className: CONTENT,
|
|
1968
1969
|
onOpenAutoFocus: preventDefault,
|
|
1969
1970
|
onCloseAutoFocus: preventDefault,
|
|
1970
|
-
children: /* @__PURE__ */ jsx("div", { ref:
|
|
1971
|
+
children: /* @__PURE__ */ jsx("div", { ref: list2, role: "listbox", id: listboxId, "aria-label": labels.codeLanguage, className: "min-h-0 overflow-y-auto", children: options.map((option, index) => /* @__PURE__ */ jsx(
|
|
1971
1972
|
SuggestionOption,
|
|
1972
1973
|
{
|
|
1973
1974
|
id: optionId(index),
|
|
@@ -2210,7 +2211,7 @@ function isBubblePart(element, controller) {
|
|
|
2210
2211
|
return element?.closest(`[${BUBBLE_PART}]`)?.getAttribute(BUBBLE_PART) === partId(controller);
|
|
2211
2212
|
}
|
|
2212
2213
|
function focusInEditor(controller) {
|
|
2213
|
-
const active =
|
|
2214
|
+
const active = controller.root?.ownerDocument.activeElement ?? null;
|
|
2214
2215
|
return active !== null && (controller.isEditorElement(active) || isBubblePart(active, controller));
|
|
2215
2216
|
}
|
|
2216
2217
|
|
|
@@ -2223,7 +2224,7 @@ var KINDS = [
|
|
|
2223
2224
|
[FileText, /^(text\/|(txt|md|csv|pdf|rtf|docx?)$)/]
|
|
2224
2225
|
];
|
|
2225
2226
|
var kindOf = (value) => KINDS.find(([, pattern]) => pattern.test(value))?.[0];
|
|
2226
|
-
var fileIcon = (mime, filename) => kindOf(mime) ?? kindOf(/\.([^.]+)$/.exec(filename)?.[1].toLowerCase() ?? "") ?? FileIcon;
|
|
2227
|
+
var fileIcon = (mime, filename) => kindOf(mime.toLowerCase()) ?? kindOf(/\.([^.]+)$/.exec(filename)?.[1].toLowerCase() ?? "") ?? FileIcon;
|
|
2227
2228
|
|
|
2228
2229
|
// src/blocks/file/file-source.ts
|
|
2229
2230
|
var fileName = (attrs) => str(attrs.filename) || str(attrs.storageKey);
|
|
@@ -2469,9 +2470,10 @@ function useRovingFocus() {
|
|
|
2469
2470
|
const onKeyDown = (event) => {
|
|
2470
2471
|
const all = items();
|
|
2471
2472
|
const index = all.indexOf(event.target);
|
|
2472
|
-
|
|
2473
|
+
const key = row.current === null ? event.key : arrowAsWritten(event.key, inlineDirection(row.current));
|
|
2474
|
+
if (index === -1 || !Object.hasOwn(MOVES, key)) return;
|
|
2473
2475
|
event.preventDefault();
|
|
2474
|
-
all[MOVES[
|
|
2476
|
+
all[MOVES[key](index, all.length)].focus();
|
|
2475
2477
|
};
|
|
2476
2478
|
return { ref, owns, focusCurrent, onFocus, onKeyDown };
|
|
2477
2479
|
}
|
|
@@ -2548,13 +2550,14 @@ function createSettled(controller) {
|
|
|
2548
2550
|
return {
|
|
2549
2551
|
read: () => focusInEditor(controller) && !pressed && !composing && !viewComposing(),
|
|
2550
2552
|
subscribe(notify) {
|
|
2553
|
+
const doc = controller.root?.ownerDocument ?? document;
|
|
2551
2554
|
const listeners2 = Object.entries(handlers).map(([type, handle2]) => {
|
|
2552
2555
|
const listener = (event) => {
|
|
2553
2556
|
handle2(event);
|
|
2554
2557
|
notify();
|
|
2555
2558
|
};
|
|
2556
|
-
|
|
2557
|
-
return () =>
|
|
2559
|
+
doc.addEventListener(type, listener, true);
|
|
2560
|
+
return () => doc.removeEventListener(type, listener, true);
|
|
2558
2561
|
});
|
|
2559
2562
|
const stopState = controller.editor.subscribe(() => notify());
|
|
2560
2563
|
return () => {
|
|
@@ -2785,11 +2788,16 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2785
2788
|
|
|
2786
2789
|
// src/menus/link/link-address.ts
|
|
2787
2790
|
var BARE_DOMAIN = /^[^\s/#?.]\S*\.\S*$/;
|
|
2791
|
+
var EMAIL = /^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/;
|
|
2788
2792
|
var WHITESPACE = /\s/;
|
|
2793
|
+
function scheme(address) {
|
|
2794
|
+
if (EMAIL.test(address)) return `mailto:${address}`;
|
|
2795
|
+
return BARE_DOMAIN.test(address) ? `https://${address}` : address;
|
|
2796
|
+
}
|
|
2789
2797
|
function linkAddress(typed2) {
|
|
2790
2798
|
const address = typed2.trim();
|
|
2791
2799
|
if (WHITESPACE.test(address)) return null;
|
|
2792
|
-
const completed =
|
|
2800
|
+
const completed = SCHEME.test(address) ? address : scheme(address);
|
|
2793
2801
|
const href = sanitizeHref(completed);
|
|
2794
2802
|
return href || null;
|
|
2795
2803
|
}
|
|
@@ -3888,9 +3896,6 @@ function structureAnnouncement(tr, labels, undoKeys) {
|
|
|
3888
3896
|
return inserted === null ? null : labels.blockInserted(...drawnPosition(tr.doc, inserted));
|
|
3889
3897
|
}
|
|
3890
3898
|
|
|
3891
|
-
// src/ui/direction.ts
|
|
3892
|
-
var inlineDirection = (element) => getComputedStyle(element).direction === "rtl" ? "rtl" : "ltr";
|
|
3893
|
-
|
|
3894
3899
|
// src/drag/drag-layout.ts
|
|
3895
3900
|
var INDENT_STEP_REM = 1.5;
|
|
3896
3901
|
function rootOrigin(root) {
|
|
@@ -4014,7 +4019,7 @@ function followPress(press, root, view) {
|
|
|
4014
4019
|
overlay.follow(dx, pointer.y - press.y);
|
|
4015
4020
|
overlay.mark({ top: target.lineTop, ...spanBetween(target.lineStart, layout.end) });
|
|
4016
4021
|
if (!sameTarget(active.target, target)) {
|
|
4017
|
-
store.set({ drag: { blockIds: ids,
|
|
4022
|
+
store.set({ drag: { blockIds: ids, targetIndent: target.indent } });
|
|
4018
4023
|
}
|
|
4019
4024
|
active.target = target;
|
|
4020
4025
|
}
|
|
@@ -4324,7 +4329,15 @@ function Gutter({ controller, store, actions }) {
|
|
|
4324
4329
|
}
|
|
4325
4330
|
|
|
4326
4331
|
// src/i18n/resolve-labels.ts
|
|
4327
|
-
var
|
|
4332
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
4333
|
+
function ontoRecords(overrides) {
|
|
4334
|
+
const taken = Object.entries(overrides).map(([key, value]) => {
|
|
4335
|
+
const fallback = englishLabels[key];
|
|
4336
|
+
return [key, isRecord(value) && isRecord(fallback) ? { ...fallback, ...value } : value];
|
|
4337
|
+
});
|
|
4338
|
+
return Object.fromEntries(taken);
|
|
4339
|
+
}
|
|
4340
|
+
var resolveLabels = (overrides) => mergeLabels(englishLabels, overrides && ontoRecords(overrides));
|
|
4328
4341
|
|
|
4329
4342
|
// src/menus/floating/range-rect.ts
|
|
4330
4343
|
var TEXT_NODE = 3;
|
|
@@ -4523,9 +4536,9 @@ var readOnServer = () => false;
|
|
|
4523
4536
|
function useMediaQuery(query, unsupported) {
|
|
4524
4537
|
const subscribe3 = useCallback(
|
|
4525
4538
|
(notify) => {
|
|
4526
|
-
const
|
|
4527
|
-
|
|
4528
|
-
return () =>
|
|
4539
|
+
const list2 = listOf(query);
|
|
4540
|
+
list2?.addEventListener("change", notify);
|
|
4541
|
+
return () => list2?.removeEventListener("change", notify);
|
|
4529
4542
|
},
|
|
4530
4543
|
[query]
|
|
4531
4544
|
);
|
|
@@ -5043,7 +5056,8 @@ function useRangeAnchor(controller, range) {
|
|
|
5043
5056
|
});
|
|
5044
5057
|
useIsomorphicLayoutEffect(() => {
|
|
5045
5058
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
5046
|
-
|
|
5059
|
+
const height = controller.root?.ownerDocument.defaultView?.innerHeight;
|
|
5060
|
+
if (rect && height !== void 0) setSide(sideFor(rect, height));
|
|
5047
5061
|
}, [controller, start]);
|
|
5048
5062
|
return { anchor, side };
|
|
5049
5063
|
}
|
|
@@ -5790,6 +5804,14 @@ function shortcutsExtension(store) {
|
|
|
5790
5804
|
ui: { overlays: [ShortcutsOverlay] }
|
|
5791
5805
|
});
|
|
5792
5806
|
}
|
|
5807
|
+
function useRootDirection(controller) {
|
|
5808
|
+
const [direction, setDirection] = useState("ltr");
|
|
5809
|
+
useIsomorphicLayoutEffect(() => {
|
|
5810
|
+
const root = controller.root;
|
|
5811
|
+
if (root !== null) setDirection(inlineDirection(root));
|
|
5812
|
+
}, [controller]);
|
|
5813
|
+
return direction;
|
|
5814
|
+
}
|
|
5793
5815
|
|
|
5794
5816
|
// src/canvas/block-link.ts
|
|
5795
5817
|
var FRAGMENT = "#block-";
|
|
@@ -6042,6 +6064,8 @@ function extensionUi(extension) {
|
|
|
6042
6064
|
const { ui } = extension;
|
|
6043
6065
|
return typeof ui === "object" && ui !== null ? ui : {};
|
|
6044
6066
|
}
|
|
6067
|
+
var list = (value) => Array.isArray(value) ? value : [];
|
|
6068
|
+
var record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
6045
6069
|
function mergeRender(uis) {
|
|
6046
6070
|
const given = uis.flatMap(({ render }) => render === void 0 ? [] : [render]);
|
|
6047
6071
|
if (given.length === 0) return void 0;
|
|
@@ -6054,14 +6078,14 @@ function mergeRender(uis) {
|
|
|
6054
6078
|
function collectUi(extensions, definitions, readOnly = false, onError) {
|
|
6055
6079
|
const uis = extensions.map(extensionUi);
|
|
6056
6080
|
return {
|
|
6057
|
-
slashItems: [...uis.flatMap((ui) => ui.slashItems
|
|
6058
|
-
bubbleItems: uis.flatMap((ui) => ui.bubbleItems
|
|
6059
|
-
blockMenuItems: uis.flatMap((ui) => ui.blockMenuItems
|
|
6060
|
-
renderers: Object.assign({}, canvasRenderers(definitions, readOnly), ...uis.map((ui) => ui.renderers)),
|
|
6061
|
-
blockNames: Object.assign({}, ...uis.map((ui) => ui.blockNames)),
|
|
6081
|
+
slashItems: [...uis.flatMap((ui) => list(ui.slashItems)), ...blockTypeSlashItems(definitions, onError)],
|
|
6082
|
+
bubbleItems: uis.flatMap((ui) => list(ui.bubbleItems)),
|
|
6083
|
+
blockMenuItems: uis.flatMap((ui) => list(ui.blockMenuItems)),
|
|
6084
|
+
renderers: Object.assign({}, canvasRenderers(definitions, readOnly), ...uis.map((ui) => record(ui.renderers))),
|
|
6085
|
+
blockNames: Object.assign({}, ...uis.map((ui) => record(ui.blockNames))),
|
|
6062
6086
|
render: mergeRender(uis),
|
|
6063
6087
|
overlays: [
|
|
6064
|
-
...uis.flatMap((ui) => ui.overlays
|
|
6088
|
+
...uis.flatMap((ui) => list(ui.overlays)),
|
|
6065
6089
|
...Object.entries(inPlaceOverlays).flatMap(([type, overlay]) => drawnInPlace(definitions, type) ? [overlay] : [])
|
|
6066
6090
|
]
|
|
6067
6091
|
};
|
|
@@ -6275,13 +6299,16 @@ var BlockCanvas = forwardRef(function BlockCanvas2({
|
|
|
6275
6299
|
readOnly,
|
|
6276
6300
|
extensions: allExtensions,
|
|
6277
6301
|
render: ui.render,
|
|
6278
|
-
onFiles
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6302
|
+
onFiles(files, at) {
|
|
6303
|
+
const report = onError ?? console.error;
|
|
6304
|
+
void insertUploads(controller, files, at, {
|
|
6305
|
+
upload,
|
|
6306
|
+
resolveAssetUrl: resolveAssetUrl ?? String,
|
|
6307
|
+
onError: report,
|
|
6308
|
+
unavailable: labels.uploadsUnavailable,
|
|
6309
|
+
failed: labels.uploadFailed
|
|
6310
|
+
}).catch((reason) => report(toError(reason)));
|
|
6311
|
+
}
|
|
6285
6312
|
});
|
|
6286
6313
|
useDeleteReporter(controller, onDelete);
|
|
6287
6314
|
useBlockLinkTarget(controller, focusOnMount);
|
|
@@ -6302,6 +6329,7 @@ var BlockCanvas = forwardRef(function BlockCanvas2({
|
|
|
6302
6329
|
const placeholderLabels = placeholder === void 0 ? labels : { ...labels, placeholderEmpty: placeholder };
|
|
6303
6330
|
return (state, block) => placeholderFor(state, block, placeholderLabels);
|
|
6304
6331
|
}, [labels, placeholder]);
|
|
6332
|
+
const direction = useRootDirection(controller);
|
|
6305
6333
|
useImperativeHandle(
|
|
6306
6334
|
ref,
|
|
6307
6335
|
() => ({
|
|
@@ -6312,7 +6340,7 @@ var BlockCanvas = forwardRef(function BlockCanvas2({
|
|
|
6312
6340
|
}),
|
|
6313
6341
|
[controller, resolveAssetUrl]
|
|
6314
6342
|
);
|
|
6315
|
-
return /* @__PURE__ */ jsx(QuoinProvider, { value: { blockTypes, upload, resolveAssetUrl, onError, highlight, controller, labels }, children: /* @__PURE__ */ jsx(VoidEditingContext.Provider, { value: voidEditing, children: /* @__PURE__ */ jsx(SlashItemsProvider, { value: slashItems, children: /* @__PURE__ */ jsx(BubbleItemsProvider, { value: ui.bubbleItems, children: /* @__PURE__ */ jsx(CanvasUiProvider, { value: uiStore, children: /* @__PURE__ */ jsxs(
|
|
6343
|
+
return /* @__PURE__ */ jsx(DirectionProvider, { dir: direction, children: /* @__PURE__ */ jsx(QuoinProvider, { value: { blockTypes, upload, resolveAssetUrl, onError, highlight, controller, labels }, children: /* @__PURE__ */ jsx(VoidEditingContext.Provider, { value: voidEditing, children: /* @__PURE__ */ jsx(SlashItemsProvider, { value: slashItems, children: /* @__PURE__ */ jsx(BubbleItemsProvider, { value: ui.bubbleItems, children: /* @__PURE__ */ jsx(CanvasUiProvider, { value: uiStore, children: /* @__PURE__ */ jsxs(
|
|
6316
6344
|
EditorView,
|
|
6317
6345
|
{
|
|
6318
6346
|
controller,
|
|
@@ -6339,7 +6367,7 @@ var BlockCanvas = forwardRef(function BlockCanvas2({
|
|
|
6339
6367
|
ui.overlays.map((Overlay2, index) => /* @__PURE__ */ jsx(Overlay2, { controller }, index))
|
|
6340
6368
|
]
|
|
6341
6369
|
}
|
|
6342
|
-
) }) }) }) }) });
|
|
6370
|
+
) }) }) }) }) }) });
|
|
6343
6371
|
});
|
|
6344
6372
|
function progressText(state, labels) {
|
|
6345
6373
|
if (state.phase === "busy") return labels.uploading;
|
|
@@ -6403,8 +6431,15 @@ async function attemptSave(run) {
|
|
|
6403
6431
|
return { error };
|
|
6404
6432
|
}
|
|
6405
6433
|
}
|
|
6434
|
+
function retryable(error, isRetryable) {
|
|
6435
|
+
try {
|
|
6436
|
+
return isRetryable(error);
|
|
6437
|
+
} catch {
|
|
6438
|
+
return false;
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6406
6441
|
function nextRetryDelay(error, retriesSoFar, { debounceMs, maxBackoffMs, maxRetries, isRetryable }) {
|
|
6407
|
-
if (retriesSoFar >= maxRetries || !
|
|
6442
|
+
if (retriesSoFar >= maxRetries || !retryable(error, isRetryable)) return null;
|
|
6408
6443
|
return Math.min(debounceMs * 2 ** (retriesSoFar + 1), maxBackoffMs);
|
|
6409
6444
|
}
|
|
6410
6445
|
|
|
@@ -6532,6 +6567,6 @@ function useAutosave({
|
|
|
6532
6567
|
return { status, error, retry: runner.retry, flush: runner.flush };
|
|
6533
6568
|
}
|
|
6534
6569
|
|
|
6535
|
-
export { AlignCenter, AlignLeft, AlignRight, AppWindow, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, BlockCanvas, Bookmark, Button, CODE_LANGUAGES, CaseSensitive, ChevronDown, ChevronUp, CodeBlock, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, FLOATING_TOOLBAR, FOCUS_RING, FilePickerButton, GripHorizontal, GripVertical, Input, MENU_ITEM, MenuIcon, MessageSquare, MessageSquarePlus, PenLine, Plus, Popover, PopoverAnchor, PopoverContent, QuoinProvider, Radical, Regex, SendHorizontal, Sigma, SmilePlus, Sparkles, SuggestionMenu, Table, TableOfContents, Trash, UploadField, WholeWord, X, blockFragment, bubblePart, cn, coreBlocks, dismissSuggestion, englishLabels, focusNode, formatShortcut,
|
|
6536
|
-
//# sourceMappingURL=chunk-
|
|
6537
|
-
//# sourceMappingURL=chunk-
|
|
6570
|
+
export { AlignCenter, AlignLeft, AlignRight, AppWindow, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, BlockCanvas, Bookmark, Button, CODE_LANGUAGES, CaseSensitive, ChevronDown, ChevronUp, CodeBlock, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, FLOATING_TOOLBAR, FOCUS_RING, FilePickerButton, GripHorizontal, GripVertical, Input, MENU_ITEM, MenuIcon, MessageSquare, MessageSquarePlus, PenLine, Plus, Popover, PopoverAnchor, PopoverContent, QuoinProvider, Radical, Regex, SendHorizontal, Sigma, SmilePlus, Sparkles, SuggestionMenu, Table, TableOfContents, Trash, UploadField, WholeWord, X, blockFragment, bubblePart, cn, coreBlocks, dismissSuggestion, englishLabels, focusNode, formatShortcut, insertBlockToWrite, insertBlocks, interceptKeys, keepFocus, linkAddress, linkedBlockId, noChange, preventDefault, rangeRect, replaceTrigger, resolveLabels, returnFocusToText, runOnBlocks, selectHandlers, selectNode, styleTargets, suggestionPlugin, toError, useAutosave, useFocusKey, useLabels, useNodeKeys, useOutsidePress, usePartAnchor, useQuoin, useRangeAnchor, useRovingFocus, virtualAnchor };
|
|
6571
|
+
//# sourceMappingURL=chunk-FGVTDIHT.js.map
|
|
6572
|
+
//# sourceMappingURL=chunk-FGVTDIHT.js.map
|