quoin-editor 2.0.0 → 2.0.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 +19 -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-6BVE46K7.js → chunk-4VCCGBXW.js} +7 -5
- package/dist/{chunk-6BVE46K7.js.map → chunk-4VCCGBXW.js.map} +1 -1
- package/dist/{chunk-M77A3EGD.js → chunk-5A2MHCYI.js} +3 -3
- package/dist/{chunk-M77A3EGD.js.map → chunk-5A2MHCYI.js.map} +1 -1
- package/dist/{chunk-CJVJNMOB.cjs → chunk-5VBDRJ5Y.cjs} +133 -121
- package/dist/{chunk-IW4TMECB.js → chunk-AVD2AI47.js} +3 -3
- package/dist/{chunk-IW4TMECB.js.map → chunk-AVD2AI47.js.map} +1 -1
- package/dist/{chunk-YABGWOAV.js → chunk-DGKIKXB7.js} +3 -3
- package/dist/{chunk-YABGWOAV.js.map → chunk-DGKIKXB7.js.map} +1 -1
- package/dist/{chunk-MAS4AEF4.js → chunk-DT3ODGZ7.js} +4 -4
- package/dist/{chunk-MAS4AEF4.js.map → chunk-DT3ODGZ7.js.map} +1 -1
- package/dist/{chunk-IKZSCTRF.cjs → chunk-F3BC5ITU.cjs} +3 -3
- package/dist/{chunk-D6CIIWCU.cjs → chunk-JM5TRLEC.cjs} +30 -30
- package/dist/{chunk-V4WQG7FR.cjs → chunk-LBP64GKQ.cjs} +63 -63
- package/dist/{chunk-KQPZTSW3.js → chunk-M7L444WV.js} +4 -4
- package/dist/{chunk-KQPZTSW3.js.map → chunk-M7L444WV.js.map} +1 -1
- package/dist/{chunk-BYYCD54G.cjs → chunk-NZFGAV3L.cjs} +2 -2
- package/dist/{chunk-EU5IGKMP.js → chunk-OBOIZ7L3.js} +3 -3
- package/dist/{chunk-EU5IGKMP.js.map → chunk-OBOIZ7L3.js.map} +1 -1
- package/dist/{chunk-ZN5DHNSL.js → chunk-QIGZ5JAY.js} +41 -29
- package/dist/chunk-QIGZ5JAY.js.map +1 -0
- package/dist/{chunk-HOSDMHK6.cjs → chunk-RR67AKP6.cjs} +25 -25
- package/dist/{chunk-5YAJZSTI.cjs → chunk-RWSC47L7.cjs} +18 -18
- package/dist/{chunk-NL5J77VD.js → chunk-SE36LU6G.js} +19 -5
- package/dist/chunk-SE36LU6G.js.map +1 -0
- package/dist/{chunk-4PIJC4FD.cjs → chunk-SHZGRFYY.cjs} +14 -14
- package/dist/{chunk-NFO3W644.cjs → chunk-TDXQSNFS.cjs} +22 -20
- package/dist/{chunk-Z6LAARPB.cjs → chunk-UKUAQJME.cjs} +17 -3
- package/dist/{chunk-66OPHDFA.cjs → chunk-XC4WZTMY.cjs} +50 -50
- package/dist/{chunk-B4VCDJSA.js → chunk-XLR2O4OK.js} +5 -5
- package/dist/{chunk-B4VCDJSA.js.map → chunk-XLR2O4OK.js.map} +1 -1
- package/dist/{chunk-77CNOLHY.cjs → chunk-YETMZ27Q.cjs} +3 -3
- package/dist/{chunk-LEICOZYK.cjs → chunk-YYBPQ4TY.cjs} +2 -2
- package/dist/{chunk-2UKI26JA.js → chunk-Z3GLEAOI.js} +4 -4
- package/dist/{chunk-2UKI26JA.js.map → chunk-Z3GLEAOI.js.map} +1 -1
- package/dist/{chunk-J2SVYBTC.js → chunk-ZDNYIQKM.js} +4 -4
- package/dist/{chunk-J2SVYBTC.js.map → chunk-ZDNYIQKM.js.map} +1 -1
- package/dist/{chunk-5X52BAZB.js → chunk-ZHLNPNE2.js} +5 -5
- package/dist/{chunk-5X52BAZB.js.map → chunk-ZHLNPNE2.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.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 +1 -1
- package/dist/chunk-NL5J77VD.js.map +0 -1
- package/dist/chunk-ZN5DHNSL.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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, 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-SE36LU6G.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';
|
|
@@ -1875,7 +1875,7 @@ var CONTENT = `${MENU_CONTENT} flex max-h-64 w-48 flex-col overflow-y-hidden`;
|
|
|
1875
1875
|
function LanguageCombobox({ blockId, controller, language: language2, field, onDone }) {
|
|
1876
1876
|
const labels = useLabels();
|
|
1877
1877
|
const listboxId = useId();
|
|
1878
|
-
const
|
|
1878
|
+
const list2 = useRef(null);
|
|
1879
1879
|
const settled = useRef(false);
|
|
1880
1880
|
const focusedByPress = useRef(false);
|
|
1881
1881
|
const shown = languageName(language2) ?? language2;
|
|
@@ -1885,7 +1885,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1885
1885
|
const open = options.length > 0;
|
|
1886
1886
|
const optionId = (index) => `${listboxId}-${index}`;
|
|
1887
1887
|
useIsomorphicLayoutEffect(() => {
|
|
1888
|
-
|
|
1888
|
+
list2.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
|
|
1889
1889
|
}, [active]);
|
|
1890
1890
|
const close = () => {
|
|
1891
1891
|
setDraft(null);
|
|
@@ -1967,7 +1967,7 @@ function LanguageCombobox({ blockId, controller, language: language2, field, onD
|
|
|
1967
1967
|
className: CONTENT,
|
|
1968
1968
|
onOpenAutoFocus: preventDefault,
|
|
1969
1969
|
onCloseAutoFocus: preventDefault,
|
|
1970
|
-
children: /* @__PURE__ */ jsx("div", { ref:
|
|
1970
|
+
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
1971
|
SuggestionOption,
|
|
1972
1972
|
{
|
|
1973
1973
|
id: optionId(index),
|
|
@@ -2210,7 +2210,7 @@ function isBubblePart(element, controller) {
|
|
|
2210
2210
|
return element?.closest(`[${BUBBLE_PART}]`)?.getAttribute(BUBBLE_PART) === partId(controller);
|
|
2211
2211
|
}
|
|
2212
2212
|
function focusInEditor(controller) {
|
|
2213
|
-
const active =
|
|
2213
|
+
const active = controller.root?.ownerDocument.activeElement ?? null;
|
|
2214
2214
|
return active !== null && (controller.isEditorElement(active) || isBubblePart(active, controller));
|
|
2215
2215
|
}
|
|
2216
2216
|
|
|
@@ -2223,7 +2223,7 @@ var KINDS = [
|
|
|
2223
2223
|
[FileText, /^(text\/|(txt|md|csv|pdf|rtf|docx?)$)/]
|
|
2224
2224
|
];
|
|
2225
2225
|
var kindOf = (value) => KINDS.find(([, pattern]) => pattern.test(value))?.[0];
|
|
2226
|
-
var fileIcon = (mime, filename) => kindOf(mime) ?? kindOf(/\.([^.]+)$/.exec(filename)?.[1].toLowerCase() ?? "") ?? FileIcon;
|
|
2226
|
+
var fileIcon = (mime, filename) => kindOf(mime.toLowerCase()) ?? kindOf(/\.([^.]+)$/.exec(filename)?.[1].toLowerCase() ?? "") ?? FileIcon;
|
|
2227
2227
|
|
|
2228
2228
|
// src/blocks/file/file-source.ts
|
|
2229
2229
|
var fileName = (attrs) => str(attrs.filename) || str(attrs.storageKey);
|
|
@@ -2548,13 +2548,14 @@ function createSettled(controller) {
|
|
|
2548
2548
|
return {
|
|
2549
2549
|
read: () => focusInEditor(controller) && !pressed && !composing && !viewComposing(),
|
|
2550
2550
|
subscribe(notify) {
|
|
2551
|
+
const doc = controller.root?.ownerDocument ?? document;
|
|
2551
2552
|
const listeners2 = Object.entries(handlers).map(([type, handle2]) => {
|
|
2552
2553
|
const listener = (event) => {
|
|
2553
2554
|
handle2(event);
|
|
2554
2555
|
notify();
|
|
2555
2556
|
};
|
|
2556
|
-
|
|
2557
|
-
return () =>
|
|
2557
|
+
doc.addEventListener(type, listener, true);
|
|
2558
|
+
return () => doc.removeEventListener(type, listener, true);
|
|
2558
2559
|
});
|
|
2559
2560
|
const stopState = controller.editor.subscribe(() => notify());
|
|
2560
2561
|
return () => {
|
|
@@ -2785,11 +2786,16 @@ function ImageFigure({ block, controller, readOnly }) {
|
|
|
2785
2786
|
|
|
2786
2787
|
// src/menus/link/link-address.ts
|
|
2787
2788
|
var BARE_DOMAIN = /^[^\s/#?.]\S*\.\S*$/;
|
|
2789
|
+
var EMAIL = /^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/;
|
|
2788
2790
|
var WHITESPACE = /\s/;
|
|
2791
|
+
function scheme(address) {
|
|
2792
|
+
if (EMAIL.test(address)) return `mailto:${address}`;
|
|
2793
|
+
return BARE_DOMAIN.test(address) ? `https://${address}` : address;
|
|
2794
|
+
}
|
|
2789
2795
|
function linkAddress(typed2) {
|
|
2790
2796
|
const address = typed2.trim();
|
|
2791
2797
|
if (WHITESPACE.test(address)) return null;
|
|
2792
|
-
const completed =
|
|
2798
|
+
const completed = SCHEME.test(address) ? address : scheme(address);
|
|
2793
2799
|
const href = sanitizeHref(completed);
|
|
2794
2800
|
return href || null;
|
|
2795
2801
|
}
|
|
@@ -4014,7 +4020,7 @@ function followPress(press, root, view) {
|
|
|
4014
4020
|
overlay.follow(dx, pointer.y - press.y);
|
|
4015
4021
|
overlay.mark({ top: target.lineTop, ...spanBetween(target.lineStart, layout.end) });
|
|
4016
4022
|
if (!sameTarget(active.target, target)) {
|
|
4017
|
-
store.set({ drag: { blockIds: ids,
|
|
4023
|
+
store.set({ drag: { blockIds: ids, targetIndent: target.indent } });
|
|
4018
4024
|
}
|
|
4019
4025
|
active.target = target;
|
|
4020
4026
|
}
|
|
@@ -4523,9 +4529,9 @@ var readOnServer = () => false;
|
|
|
4523
4529
|
function useMediaQuery(query, unsupported) {
|
|
4524
4530
|
const subscribe3 = useCallback(
|
|
4525
4531
|
(notify) => {
|
|
4526
|
-
const
|
|
4527
|
-
|
|
4528
|
-
return () =>
|
|
4532
|
+
const list2 = listOf(query);
|
|
4533
|
+
list2?.addEventListener("change", notify);
|
|
4534
|
+
return () => list2?.removeEventListener("change", notify);
|
|
4529
4535
|
},
|
|
4530
4536
|
[query]
|
|
4531
4537
|
);
|
|
@@ -5043,7 +5049,8 @@ function useRangeAnchor(controller, range) {
|
|
|
5043
5049
|
});
|
|
5044
5050
|
useIsomorphicLayoutEffect(() => {
|
|
5045
5051
|
const rect = latest.current && rangeRect(controller, latest.current);
|
|
5046
|
-
|
|
5052
|
+
const height = controller.root?.ownerDocument.defaultView?.innerHeight;
|
|
5053
|
+
if (rect && height !== void 0) setSide(sideFor(rect, height));
|
|
5047
5054
|
}, [controller, start]);
|
|
5048
5055
|
return { anchor, side };
|
|
5049
5056
|
}
|
|
@@ -6042,6 +6049,8 @@ function extensionUi(extension) {
|
|
|
6042
6049
|
const { ui } = extension;
|
|
6043
6050
|
return typeof ui === "object" && ui !== null ? ui : {};
|
|
6044
6051
|
}
|
|
6052
|
+
var list = (value) => Array.isArray(value) ? value : [];
|
|
6053
|
+
var record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
6045
6054
|
function mergeRender(uis) {
|
|
6046
6055
|
const given = uis.flatMap(({ render }) => render === void 0 ? [] : [render]);
|
|
6047
6056
|
if (given.length === 0) return void 0;
|
|
@@ -6054,14 +6063,14 @@ function mergeRender(uis) {
|
|
|
6054
6063
|
function collectUi(extensions, definitions, readOnly = false, onError) {
|
|
6055
6064
|
const uis = extensions.map(extensionUi);
|
|
6056
6065
|
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)),
|
|
6066
|
+
slashItems: [...uis.flatMap((ui) => list(ui.slashItems)), ...blockTypeSlashItems(definitions, onError)],
|
|
6067
|
+
bubbleItems: uis.flatMap((ui) => list(ui.bubbleItems)),
|
|
6068
|
+
blockMenuItems: uis.flatMap((ui) => list(ui.blockMenuItems)),
|
|
6069
|
+
renderers: Object.assign({}, canvasRenderers(definitions, readOnly), ...uis.map((ui) => record(ui.renderers))),
|
|
6070
|
+
blockNames: Object.assign({}, ...uis.map((ui) => record(ui.blockNames))),
|
|
6062
6071
|
render: mergeRender(uis),
|
|
6063
6072
|
overlays: [
|
|
6064
|
-
...uis.flatMap((ui) => ui.overlays
|
|
6073
|
+
...uis.flatMap((ui) => list(ui.overlays)),
|
|
6065
6074
|
...Object.entries(inPlaceOverlays).flatMap(([type, overlay]) => drawnInPlace(definitions, type) ? [overlay] : [])
|
|
6066
6075
|
]
|
|
6067
6076
|
};
|
|
@@ -6275,13 +6284,16 @@ var BlockCanvas = forwardRef(function BlockCanvas2({
|
|
|
6275
6284
|
readOnly,
|
|
6276
6285
|
extensions: allExtensions,
|
|
6277
6286
|
render: ui.render,
|
|
6278
|
-
onFiles
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6287
|
+
onFiles(files, at) {
|
|
6288
|
+
const report = onError ?? console.error;
|
|
6289
|
+
void insertUploads(controller, files, at, {
|
|
6290
|
+
upload,
|
|
6291
|
+
resolveAssetUrl: resolveAssetUrl ?? String,
|
|
6292
|
+
onError: report,
|
|
6293
|
+
unavailable: labels.uploadsUnavailable,
|
|
6294
|
+
failed: labels.uploadFailed
|
|
6295
|
+
}).catch((reason) => report(toError(reason)));
|
|
6296
|
+
}
|
|
6285
6297
|
});
|
|
6286
6298
|
useDeleteReporter(controller, onDelete);
|
|
6287
6299
|
useBlockLinkTarget(controller, focusOnMount);
|
|
@@ -6533,5 +6545,5 @@ function useAutosave({
|
|
|
6533
6545
|
}
|
|
6534
6546
|
|
|
6535
6547
|
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, inlineDirection, 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 };
|
|
6536
|
-
//# sourceMappingURL=chunk-
|
|
6537
|
-
//# sourceMappingURL=chunk-
|
|
6548
|
+
//# sourceMappingURL=chunk-QIGZ5JAY.js.map
|
|
6549
|
+
//# sourceMappingURL=chunk-QIGZ5JAY.js.map
|