@haklex/rich-editor 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{AlertQuoteEditNode-C4NKE1Lt.js → AlertQuoteEditNode-DUvNEyjw.js} +3 -3
  2. package/dist/{KaTeXRenderer-DLtnsRSv.js → KaTeXRenderer-DvxFML1l.js} +2 -1
  3. package/dist/LinkCardRenderer-BT8P5aJC.js +100 -0
  4. package/dist/{MermaidPlugin-BOP4CFU_.js → MermaidPlugin-DgIAgFH8.js} +2 -2
  5. package/dist/{SubmitShortcutPlugin-DQLW3pPC.js → SubmitShortcutPlugin-OoPWBtTU.js} +352 -27
  6. package/dist/commands-entry.d.ts +1 -0
  7. package/dist/commands-entry.d.ts.map +1 -1
  8. package/dist/commands-entry.mjs +3 -3
  9. package/dist/components/CorePlugins.d.ts.map +1 -1
  10. package/dist/components/RichEditor.d.ts +1 -1
  11. package/dist/components/RichEditor.d.ts.map +1 -1
  12. package/dist/components/renderers/FileRenderer.d.ts +14 -0
  13. package/dist/components/renderers/FileRenderer.d.ts.map +1 -0
  14. package/dist/{config-CwZ9fwU0.js → config-D8JJ7F11.js} +154 -8
  15. package/dist/config-edit.d.ts.map +1 -1
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/context/FileUploadContext.d.ts +8 -0
  18. package/dist/context/FileUploadContext.d.ts.map +1 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.mjs +31 -27
  22. package/dist/{node-registry-BOe08y9j.js → node-registry-BFDycNE-.js} +5 -4
  23. package/dist/nodes/FileNode.d.ts +49 -0
  24. package/dist/nodes/FileNode.d.ts.map +1 -0
  25. package/dist/nodes/KaTeXInlineNode.d.ts.map +1 -1
  26. package/dist/nodes/MentionNode.d.ts.map +1 -1
  27. package/dist/nodes-entry.d.ts +2 -0
  28. package/dist/nodes-entry.d.ts.map +1 -1
  29. package/dist/nodes-entry.mjs +5 -5
  30. package/dist/plugins/BlockExitPlugin.d.ts.map +1 -1
  31. package/dist/plugins/FileUploadPlugin.d.ts +12 -0
  32. package/dist/plugins/FileUploadPlugin.d.ts.map +1 -0
  33. package/dist/plugins/InlineDndPlugin.d.ts +2 -0
  34. package/dist/plugins/InlineDndPlugin.d.ts.map +1 -0
  35. package/dist/plugins/file-upload-command.d.ts +3 -0
  36. package/dist/plugins/file-upload-command.d.ts.map +1 -0
  37. package/dist/plugins/file-upload-store.d.ts +11 -0
  38. package/dist/plugins/file-upload-store.d.ts.map +1 -0
  39. package/dist/plugins/image-upload.css.d.ts +1 -1
  40. package/dist/plugins/inline-dnd-shared.d.ts +4 -0
  41. package/dist/plugins/inline-dnd-shared.d.ts.map +1 -0
  42. package/dist/plugins/inline-dnd.css.d.ts +3 -0
  43. package/dist/plugins/inline-dnd.css.d.ts.map +1 -0
  44. package/dist/plugins-entry.d.ts +5 -0
  45. package/dist/plugins-entry.d.ts.map +1 -1
  46. package/dist/plugins-entry.mjs +5 -4
  47. package/dist/renderers-entry.d.ts +3 -1
  48. package/dist/renderers-entry.d.ts.map +1 -1
  49. package/dist/renderers-entry.mjs +3 -3
  50. package/dist/rich-editor.css +1 -1
  51. package/dist/static-entry.mjs +3 -3
  52. package/dist/{theme-CnNR-Ttt.js → theme-Vu_9D3oG.js} +22 -8
  53. package/dist/types/renderer-config.d.ts +3 -0
  54. package/dist/types/renderer-config.d.ts.map +1 -1
  55. package/dist/types/renderer-keys.d.ts +1 -0
  56. package/dist/types/renderer-keys.d.ts.map +1 -1
  57. package/dist/types.d.ts +5 -0
  58. package/dist/types.d.ts.map +1 -1
  59. package/package.json +6 -6
  60. package/dist/LinkCardRenderer-DPV1JP0X.js +0 -45
@@ -1,5 +1,5 @@
1
- import { B as FootnoteNode, G as _defineProperty, V as $isAlertQuoteNode, W as AlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, q as AlertRenderer, t as editorTheme } from "./theme-CnNR-Ttt.js";
2
- import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-DLtnsRSv.js";
1
+ import { B as FootnoteNode, G as AlertQuoteNode, H as $isAlertQuoteNode, J as AlertRenderer, K as _defineProperty, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, t as editorTheme } from "./theme-Vu_9D3oG.js";
2
+ import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-DvxFML1l.js";
3
3
  import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
4
4
  import { ListPlugin } from "@lexical/react/LexicalListPlugin";
5
5
  import { AutoLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
@@ -8,10 +8,10 @@ import { createContext, createElement, use, useCallback, useEffect, useMemo } fr
8
8
  import { HeadingNode, QuoteNode } from "@lexical/rich-text";
9
9
  import { $createParagraphNode, $getEditor, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, PASTE_COMMAND, createEditor } from "lexical";
10
10
  import { HorizontalRuleNode } from "@lexical/extension";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  import { CodeNode } from "@lexical/code-core";
12
13
  import { ListItemNode, ListNode } from "@lexical/list";
13
14
  import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
14
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
15
  import { Info, Lightbulb, TriangleAlert } from "lucide-react";
16
16
  import { ContentEditable } from "@lexical/react/LexicalContentEditable";
17
17
  import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
@@ -18,6 +18,7 @@ import { rgbaToThumbHash, thumbHashToDataURL } from "thumbhash";
18
18
  var ALERT_NODE_KEY = "Alert";
19
19
  var BANNER_NODE_KEY = "Banner";
20
20
  var CODE_BLOCK_NODE_KEY = "CodeBlock";
21
+ var FILE_NODE_KEY = "File";
21
22
  var FOOTNOTE_NODE_KEY = "Footnote";
22
23
  var FOOTNOTE_SECTION_NODE_KEY = "FootnoteSection";
23
24
  var IMAGE_NODE_KEY = "Image";
@@ -249,4 +250,4 @@ function KaTeXRenderer({ equation, displayMode }) {
249
250
  });
250
251
  }
251
252
  //#endregion
252
- export { MENTION_NODE_KEY as C, VIDEO_NODE_KEY as D, TAG_NODE_KEY as E, LINK_CARD_NODE_KEY as S, RUBY_NODE_KEY as T, CODE_BLOCK_NODE_KEY as _, FootnoteDefinitionsProvider as a, IMAGE_NODE_KEY as b, useFootnoteDisplayNumber as c, RendererConfigProvider as d, useRendererConfig as f, BANNER_NODE_KEY as g, ALERT_NODE_KEY as h, FootnoteStaticRenderer as i, RendererWrapper as l, useVariant as m, computeImageMeta as n, useFootnoteContent as o, useRendererMode as p, decodeThumbHash as r, useFootnoteDefinitions as s, KaTeXRenderer as t, createRendererDecoration as u, FOOTNOTE_NODE_KEY as v, MERMAID_NODE_KEY as w, KATEX_NODE_KEY as x, FOOTNOTE_SECTION_NODE_KEY as y };
253
+ export { LINK_CARD_NODE_KEY as C, TAG_NODE_KEY as D, RUBY_NODE_KEY as E, VIDEO_NODE_KEY as O, KATEX_NODE_KEY as S, MERMAID_NODE_KEY as T, CODE_BLOCK_NODE_KEY as _, FootnoteDefinitionsProvider as a, FOOTNOTE_SECTION_NODE_KEY as b, useFootnoteDisplayNumber as c, RendererConfigProvider as d, useRendererConfig as f, BANNER_NODE_KEY as g, ALERT_NODE_KEY as h, FootnoteStaticRenderer as i, RendererWrapper as l, useVariant as m, computeImageMeta as n, useFootnoteContent as o, useRendererMode as p, decodeThumbHash as r, useFootnoteDefinitions as s, KaTeXRenderer as t, createRendererDecoration as u, FILE_NODE_KEY as v, MENTION_NODE_KEY as w, IMAGE_NODE_KEY as x, FOOTNOTE_NODE_KEY as y };
@@ -0,0 +1,100 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/components/renderers/FileRenderer.tsx
3
+ function formatFileSize(bytes) {
4
+ if (bytes == null || !Number.isFinite(bytes) || bytes < 0) return null;
5
+ if (bytes < 1024) return `${bytes} B`;
6
+ const units = [
7
+ "KB",
8
+ "MB",
9
+ "GB",
10
+ "TB"
11
+ ];
12
+ let value = bytes;
13
+ let unit = "";
14
+ for (const next of units) {
15
+ value /= 1024;
16
+ unit = next;
17
+ if (value < 1024) break;
18
+ }
19
+ return `${value >= 100 ? Math.round(value) : value.toFixed(1)} ${unit}`;
20
+ }
21
+ function fileExtension(name, ext) {
22
+ if (ext) return ext.toUpperCase();
23
+ const index = name.lastIndexOf(".");
24
+ if (index <= 0 || index === name.length - 1) return null;
25
+ const derived = name.slice(index + 1);
26
+ return derived.length > 8 ? null : derived.toUpperCase();
27
+ }
28
+ function fileMetaText(name, size, ext) {
29
+ return [formatFileSize(size), fileExtension(name, ext)].filter(Boolean).join(" · ");
30
+ }
31
+ function FileRenderer({ src, name, size, ext, display }) {
32
+ if (display === "inline") return /* @__PURE__ */ jsx("a", {
33
+ className: "rich-file-chip",
34
+ download: name,
35
+ href: src || void 0,
36
+ rel: "noopener noreferrer",
37
+ target: "_blank",
38
+ children: name
39
+ });
40
+ const meta = fileMetaText(name, size, ext);
41
+ return /* @__PURE__ */ jsxs("a", {
42
+ className: "rich-file-card",
43
+ download: name,
44
+ href: src || void 0,
45
+ rel: "noopener noreferrer",
46
+ target: "_blank",
47
+ children: [/* @__PURE__ */ jsx("span", {
48
+ className: "rich-file-card-name",
49
+ children: name
50
+ }), meta && /* @__PURE__ */ jsx("span", {
51
+ className: "rich-file-card-meta",
52
+ children: meta
53
+ })]
54
+ });
55
+ }
56
+ //#endregion
57
+ //#region src/components/renderers/LinkCardRenderer.tsx
58
+ function LinkCardRenderer({ url, title, description, favicon, image }) {
59
+ return /* @__PURE__ */ jsxs("a", {
60
+ className: "rich-link-card",
61
+ href: url,
62
+ rel: "noopener noreferrer",
63
+ target: "_blank",
64
+ children: [image && /* @__PURE__ */ jsx("span", {
65
+ className: "rich-link-card-image",
66
+ children: /* @__PURE__ */ jsx("img", {
67
+ alt: "",
68
+ loading: "lazy",
69
+ src: image
70
+ })
71
+ }), /* @__PURE__ */ jsxs("span", {
72
+ className: "rich-link-card-content",
73
+ children: [
74
+ /* @__PURE__ */ jsxs("span", {
75
+ className: "rich-link-card-title",
76
+ children: [favicon && /* @__PURE__ */ jsx("img", {
77
+ alt: "",
78
+ className: "rich-link-card-favicon",
79
+ height: 16,
80
+ src: favicon,
81
+ width: 16,
82
+ onError: (e) => {
83
+ e.target.style.display = "none";
84
+ }
85
+ }), title || url]
86
+ }),
87
+ description && /* @__PURE__ */ jsx("span", {
88
+ className: "rich-link-card-description",
89
+ children: description
90
+ }),
91
+ /* @__PURE__ */ jsx("span", {
92
+ className: "rich-link-card-url",
93
+ children: url
94
+ })
95
+ ]
96
+ })]
97
+ });
98
+ }
99
+ //#endregion
100
+ export { formatFileSize as a, fileMetaText as i, FileRenderer as n, fileExtension as r, LinkCardRenderer as t };
@@ -1,5 +1,5 @@
1
- import { O as $withAdaptiveImageDisplayWidth, f as $createMermaidNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-CnNR-Ttt.js";
2
- import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-C4NKE1Lt.js";
1
+ import { O as $withAdaptiveImageDisplayWidth, f as $createMermaidNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-Vu_9D3oG.js";
2
+ import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DUvNEyjw.js";
3
3
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
4
4
  import { useEffect } from "react";
5
5
  import { $insertNodes, COMMAND_PRIORITY_EDITOR, createCommand } from "lexical";
@@ -1,9 +1,9 @@
1
- import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-BOe08y9j.js";
2
- import { B as FootnoteNode, C as KaTeXBlockNode, K as extractTextContent, O as $withAdaptiveImageDisplayWidth, W as AlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, k as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode, z as $createFootnoteNode } from "./theme-CnNR-Ttt.js";
3
- import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-DLtnsRSv.js";
1
+ import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-BFDycNE-.js";
4
2
  import "./katex.css-0TJGE4On.js";
5
- import { C as CommentNode, M as BannerNode, T as CodeBlockNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, i as $createVideoNode, o as $createRubyNode, p as $isGridContainerNode, v as $createDetailsNode, x as $createCommentPlaceholderNode, y as DetailsNode } from "./config-CwZ9fwU0.js";
6
- import { o as PasteLinkPlugin, t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-C4NKE1Lt.js";
3
+ import { $ as INLINE_DRAG_MIME, B as FootnoteNode, C as KaTeXBlockNode, G as AlertQuoteNode, O as $withAdaptiveImageDisplayWidth, Q as INLINE_DRAG_ATTR, V as OPEN_FILE_PICKER_COMMAND, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, k as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as $createSpoilerNode, q as extractTextContent, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode, z as $createFootnoteNode } from "./theme-Vu_9D3oG.js";
4
+ import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-DvxFML1l.js";
5
+ import { C as DetailsNode, D as CommentNode, I as BannerNode, S as $createDetailsNode, T as $createCommentPlaceholderNode, _ as FootnoteSectionNode, c as RubyNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, i as $createVideoNode, k as CodeBlockNode, o as $createRubyNode, p as $isGridContainerNode, v as $createFileNode, w as $createCommentNode, x as fileExtFromName, y as $isFileNode } from "./config-D8JJ7F11.js";
6
+ import { o as PasteLinkPlugin, t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DUvNEyjw.js";
7
7
  import { n as getHostname, r as probeFavicon, t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
8
8
  import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
9
9
  import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
@@ -14,12 +14,13 @@ import { AutoLinkNode, LinkNode, createLinkMatcherWithRegExp, registerAutoLink }
14
14
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
15
15
  import { createContext, use, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
16
16
  import { $createQuoteNode, $isQuoteNode, DRAG_DROP_PASTE, QuoteNode } from "@lexical/rich-text";
17
- import { $addUpdateTag, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createRangeSelection, $createTextNode, $getNodeByKey, $getRoot, $getSelection, $getState, $insertNodes, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isTextNode, $nodesOfType, $parseSerializedNode, $setSelection, $setState, CLICK_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, IS_CODE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_ENTER_COMMAND, PASTE_COMMAND, SELECTION_CHANGE_COMMAND, createEditor, createState } from "lexical";
17
+ import { $addUpdateTag, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createRangeSelection, $createTextNode, $getNodeByKey, $getRoot, $getSelection, $getState, $insertNodes, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isTextNode, $nodesOfType, $parseSerializedNode, $setSelection, $setState, BLUR_COMMAND, CLICK_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, HISTORY_MERGE_TAG, IS_CODE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_ENTER_COMMAND, KEY_SPACE_COMMAND, PASTE_COMMAND, SELECTION_CHANGE_COMMAND, SKIP_COLLAB_TAG, TextNode, createEditor, createState } from "lexical";
18
18
  import { $createHorizontalRuleNode, HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/extension";
19
19
  import { CODE_BLOCK_NODE_TRANSFORMER, COMMENT_TRANSFORMER, CONTAINER_TRANSFORMER, FOOTNOTE_SECTION_TRANSFORMER, FOOTNOTE_TRANSFORMER, GIT_ALERT_TRANSFORMER, HORIZONTAL_RULE_BLOCK_TRANSFORMER, IMAGE_BLOCK_TRANSFORMER, INSERT_TRANSFORMER, KATEX_BLOCK_TRANSFORMER, KATEX_INLINE_TRANSFORMER, LINK_CARD_BLOCK_TRANSFORMER, MENTION_TRANSFORMER, MERMAID_BLOCK_TRANSFORMER, RUBY_TRANSFORMER, SPOILER_TRANSFORMER, SUBSCRIPT_TRANSFORMER, SUPERSCRIPT_TRANSFORMER, TABLE_BLOCK_TRANSFORMER, VIDEO_BLOCK_TRANSFORMER } from "@haklex/rich-headless/transformers";
20
+ import { createPortal } from "react-dom";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
20
22
  import { $convertFromMarkdownString, CHECK_LIST, CODE, QUOTE, TRANSFORMERS } from "@lexical/markdown";
21
23
  import { $createTableCellNode, $createTableNode, $createTableRowNode, TableCellHeaderStates } from "@lexical/table";
22
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
23
24
  import { Check, Info, Link2, Upload } from "lucide-react";
24
25
  import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
25
26
  import { nanoid } from "nanoid";
@@ -39,6 +40,7 @@ function AutoLinkPlugin({ matchers }) {
39
40
  }
40
41
  //#endregion
41
42
  //#region src/plugins/BlockExitPlugin.tsx
43
+ var INLINE_CODE_EXIT_CARET = "​";
42
44
  function selectDecoratorNode(node, cursorPlacement = "start") {
43
45
  if (node.getType() === "code-block") setCodeBlockCursorIntent(node.getKey(), cursorPlacement);
44
46
  const selection = $createNodeSelection();
@@ -68,15 +70,6 @@ function isAtTopLevelBoundary(selection, direction) {
68
70
  function isSingleLineParagraph(node) {
69
71
  return $isParagraphNode(node) && !node.getTextContent().includes("\n");
70
72
  }
71
- function getOutermostNodeWithinTopLevel(node, topLevel) {
72
- let current = node;
73
- while (current.getParent() !== topLevel) {
74
- const parent = current.getParent();
75
- if (!parent) break;
76
- current = parent;
77
- }
78
- return current;
79
- }
80
73
  function isDeeplyEmptyElement(node) {
81
74
  if (!$isElementNode(node)) return false;
82
75
  if (node.getChildrenSize() === 0) return true;
@@ -93,18 +86,14 @@ function isSelectionInsideTopLevel(selection, topLevelKey) {
93
86
  return selection.anchor.getNode().getTopLevelElementOrThrow().getKey() === topLevelKey && selection.focus.getNode().getTopLevelElementOrThrow().getKey() === topLevelKey;
94
87
  }
95
88
  function exitInlineCodeAtLineEnd(selection) {
96
- if (!selection.isCollapsed() || selection.anchor.type !== "text") return false;
89
+ if (!selection.isCollapsed() || selection.anchor.type !== "text") return null;
97
90
  const anchorNode = selection.anchor.getNode();
98
- if (!$isTextNode(anchorNode) || !anchorNode.hasFormat("code")) return false;
99
- if (selection.anchor.offset !== anchorNode.getTextContentSize()) return false;
100
- if (!isAtTopLevelBoundary(selection, "end")) return false;
101
- const topLevel = anchorNode.getTopLevelElementOrThrow();
102
- const exitOffset = getOutermostNodeWithinTopLevel(anchorNode, topLevel).getIndexWithinParent() + 1;
103
- selection.anchor.set(topLevel.getKey(), exitOffset, "element");
104
- selection.focus.set(topLevel.getKey(), exitOffset, "element");
91
+ if (!$isTextNode(anchorNode) || !anchorNode.hasFormat("code")) return null;
92
+ if (selection.anchor.offset !== anchorNode.getTextContentSize()) return null;
93
+ if (!isAtTopLevelBoundary(selection, "end")) return null;
105
94
  selection.setFormat(anchorNode.getFormat() & ~IS_CODE);
106
95
  selection.setStyle(anchorNode.getStyle());
107
- return true;
96
+ return anchorNode;
108
97
  }
109
98
  function BlockExitPlugin() {
110
99
  const [editor] = useLexicalComposerContext();
@@ -115,6 +104,8 @@ function BlockExitPlugin() {
115
104
  }
116
105
  function registerBlockExitCommands(editor) {
117
106
  let virtualParagraphKey = null;
107
+ let inlineCodeExitCaretKey = null;
108
+ let inlineCodeExitCaretStyle = "";
118
109
  const clearVirtualParagraph = () => {
119
110
  virtualParagraphKey = null;
120
111
  };
@@ -123,6 +114,24 @@ function registerBlockExitCommands(editor) {
123
114
  const node = $getNodeByKey(virtualParagraphKey);
124
115
  return $isParagraphNode(node) ? node : null;
125
116
  };
117
+ const $releaseInlineCodeExitCaret = () => {
118
+ const caretKey = inlineCodeExitCaretKey;
119
+ if (!caretKey) return;
120
+ inlineCodeExitCaretKey = null;
121
+ const originalStyle = inlineCodeExitCaretStyle;
122
+ inlineCodeExitCaretStyle = "";
123
+ $addUpdateTag(HISTORY_MERGE_TAG);
124
+ $addUpdateTag(SKIP_COLLAB_TAG);
125
+ const caretNode = $getNodeByKey(caretKey);
126
+ if (!$isTextNode(caretNode)) return;
127
+ const text = caretNode.getTextContent().replaceAll(INLINE_CODE_EXIT_CARET, "");
128
+ if (text === "") {
129
+ caretNode.remove();
130
+ return;
131
+ }
132
+ caretNode.setTextContent(text).setStyle(originalStyle);
133
+ if (caretNode.isUnmergeable()) caretNode.toggleUnmergeable();
134
+ };
126
135
  const insertVirtualParagraph = (target, position, cursorPlacement = "start") => {
127
136
  const paragraph = $createParagraphNode();
128
137
  if (position === "before") target.insertBefore(paragraph);
@@ -153,13 +162,46 @@ function registerBlockExitCommands(editor) {
153
162
  clearVirtualParagraph();
154
163
  });
155
164
  });
165
+ const unregisterInlineCodeExitCaretCleanup = editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
166
+ const caretKey = inlineCodeExitCaretKey;
167
+ if (!caretKey) return false;
168
+ const caretNode = $getNodeByKey(caretKey);
169
+ const selection = $getSelection();
170
+ if (!($isTextNode(caretNode) && (caretNode.isComposing() || $isRangeSelection(selection) && selection.isCollapsed() && selection.anchor.key === caretKey))) $releaseInlineCodeExitCaret();
171
+ return false;
172
+ }, COMMAND_PRIORITY_HIGH);
173
+ const unregisterInlineCodeExitCaretTransform = editor.registerNodeTransform(TextNode, () => {
174
+ const caretKey = inlineCodeExitCaretKey;
175
+ if (!caretKey) return;
176
+ const caretNode = $getNodeByKey(caretKey);
177
+ const selection = $getSelection();
178
+ if ($isTextNode(caretNode) && caretNode.isComposing()) return;
179
+ if (!$isTextNode(caretNode) || caretNode.getTextContent() !== INLINE_CODE_EXIT_CARET || !$isRangeSelection(selection) || selection.anchor.key !== caretKey) $releaseInlineCodeExitCaret();
180
+ });
181
+ const unregisterInlineCodeExitCaretBlur = editor.registerCommand(BLUR_COMMAND, () => {
182
+ $releaseInlineCodeExitCaret();
183
+ return false;
184
+ }, COMMAND_PRIORITY_HIGH);
156
185
  const unregisterArrowRight = editor.registerCommand(KEY_ARROW_RIGHT_COMMAND, (event) => {
157
186
  const selection = $getSelection();
158
187
  if (!$isRangeSelection(selection)) return false;
159
- if (!exitInlineCodeAtLineEnd(selection)) return false;
188
+ const codeNode = exitInlineCodeAtLineEnd(selection);
189
+ if (!codeNode) return false;
190
+ inlineCodeExitCaretStyle = codeNode.getStyle();
191
+ const caretNode = $createTextNode(INLINE_CODE_EXIT_CARET).setFormat(codeNode.getFormat() & ~IS_CODE).setStyle([inlineCodeExitCaretStyle, "margin-left: 4px"].filter(Boolean).join("; ")).toggleUnmergeable();
192
+ codeNode.insertAfter(caretNode);
193
+ caretNode.selectEnd();
194
+ inlineCodeExitCaretKey = caretNode.getKey();
195
+ $addUpdateTag(HISTORY_MERGE_TAG);
196
+ $addUpdateTag(SKIP_COLLAB_TAG);
160
197
  event?.preventDefault();
161
198
  return true;
162
199
  }, COMMAND_PRIORITY_CRITICAL);
200
+ const unregisterInlineCodeSpace = editor.registerCommand(KEY_SPACE_COMMAND, () => {
201
+ const selection = $getSelection();
202
+ if ($isRangeSelection(selection)) exitInlineCodeAtLineEnd(selection);
203
+ return false;
204
+ }, COMMAND_PRIORITY_CRITICAL);
163
205
  const unregisterArrowDown = editor.registerCommand(KEY_ARROW_DOWN_COMMAND, (event) => {
164
206
  const selection = $getSelection();
165
207
  if (!$isRangeSelection(selection) || !selection.isCollapsed()) return false;
@@ -333,7 +375,12 @@ function registerBlockExitCommands(editor) {
333
375
  }, COMMAND_PRIORITY_CRITICAL);
334
376
  return () => {
335
377
  unregisterVirtualParagraphCleanup();
378
+ unregisterInlineCodeExitCaretCleanup();
379
+ unregisterInlineCodeExitCaretTransform();
380
+ unregisterInlineCodeExitCaretBlur();
381
+ editor.update($releaseInlineCodeExitCaret);
336
382
  unregisterArrowRight();
383
+ unregisterInlineCodeSpace();
337
384
  unregisterArrowDown();
338
385
  unregisterEnter();
339
386
  unregisterBackspace();
@@ -430,6 +477,141 @@ function HorizontalRulePlugin() {
430
477
  return null;
431
478
  }
432
479
  //#endregion
480
+ //#region src/plugins/inline-dnd.css.ts
481
+ var dropCaret = "_224tt30";
482
+ var draggingSource = "_224tt31";
483
+ //#endregion
484
+ //#region src/plugins/InlineDndPlugin.tsx
485
+ function caretRangeAtPoint(x, y) {
486
+ if (document.caretRangeFromPoint) return document.caretRangeFromPoint(x, y);
487
+ const position = document.caretPositionFromPoint?.(x, y);
488
+ if (!position) return null;
489
+ const range = document.createRange();
490
+ range.setStart(position.offsetNode, position.offset);
491
+ range.collapse(true);
492
+ return range;
493
+ }
494
+ function snapRangeToNearestBlock(root, y) {
495
+ let nearest = null;
496
+ for (const el of root.children) {
497
+ const rect = el.getBoundingClientRect();
498
+ if (rect.height === 0) continue;
499
+ const distance = y < rect.top ? rect.top - y : y > rect.bottom ? y - rect.bottom : 0;
500
+ const below = y > (rect.top + rect.bottom) / 2;
501
+ if (!nearest || distance < nearest.distance) nearest = {
502
+ el,
503
+ distance,
504
+ below
505
+ };
506
+ }
507
+ if (!nearest) return null;
508
+ const range = document.createRange();
509
+ range.selectNodeContents(nearest.el);
510
+ range.collapse(!nearest.below);
511
+ return range;
512
+ }
513
+ function resolveDropRange(root, event) {
514
+ const range = caretRangeAtPoint(event.clientX, event.clientY);
515
+ if (range && root.contains(range.startContainer)) return range;
516
+ return snapRangeToNearestBlock(root, event.clientY);
517
+ }
518
+ function caretRect(range) {
519
+ const rects = range.getClientRects();
520
+ if (rects.length > 0) return rects[0];
521
+ const rect = range.getBoundingClientRect();
522
+ if (rect.height > 0) return rect;
523
+ const container = range.startContainer;
524
+ const el = container instanceof Element ? container : container.parentElement;
525
+ return el ? el.getBoundingClientRect() : null;
526
+ }
527
+ function InlineDndPlugin() {
528
+ const [editor] = useLexicalComposerContext();
529
+ const [caret, setCaret] = useState(null);
530
+ useEffect(() => {
531
+ const root = editor.getRootElement();
532
+ if (!root) return;
533
+ let draggedKey = null;
534
+ let sourceEl = null;
535
+ const clear = () => {
536
+ draggedKey = null;
537
+ sourceEl?.classList.remove(draggingSource);
538
+ sourceEl = null;
539
+ setCaret(null);
540
+ };
541
+ const onDragStart = (event) => {
542
+ const target = event.target?.closest?.(`[${INLINE_DRAG_ATTR}]`);
543
+ if (!(target instanceof HTMLElement) || !event.dataTransfer) return;
544
+ const nodeKey = target.getAttribute(INLINE_DRAG_ATTR);
545
+ if (!nodeKey) return;
546
+ draggedKey = nodeKey;
547
+ sourceEl = target;
548
+ event.dataTransfer.setData(INLINE_DRAG_MIME, nodeKey);
549
+ event.dataTransfer.setData("text/plain", target.textContent ?? "");
550
+ event.dataTransfer.effectAllowed = "move";
551
+ requestAnimationFrame(() => sourceEl?.classList.add(draggingSource));
552
+ };
553
+ const onDragOver = (event) => {
554
+ if (!draggedKey && !event.dataTransfer?.types.includes("application/x-haklex-inline-node")) return;
555
+ event.preventDefault();
556
+ if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
557
+ const range = resolveDropRange(root, event);
558
+ const rect = range && caretRect(range);
559
+ if (!rect) {
560
+ setCaret(null);
561
+ return;
562
+ }
563
+ setCaret({
564
+ left: rect.left,
565
+ top: rect.top,
566
+ height: rect.height || 20
567
+ });
568
+ };
569
+ const onDrop = (event) => {
570
+ const nodeKey = draggedKey ?? event.dataTransfer?.getData("application/x-haklex-inline-node");
571
+ if (!nodeKey) return;
572
+ event.preventDefault();
573
+ event.stopPropagation();
574
+ const range = resolveDropRange(root, event);
575
+ if (range) editor.update(() => {
576
+ const node = $getNodeByKey(nodeKey);
577
+ if (!node) return;
578
+ node.remove();
579
+ const selection = $createRangeSelection();
580
+ selection.applyDOMRange(range);
581
+ $setSelection(selection);
582
+ selection.insertNodes([node]);
583
+ });
584
+ clear();
585
+ };
586
+ const onDragEnd = () => clear();
587
+ const onDragLeave = (event) => {
588
+ if (!root.contains(event.relatedTarget)) setCaret(null);
589
+ };
590
+ root.addEventListener("dragstart", onDragStart);
591
+ root.addEventListener("dragover", onDragOver);
592
+ root.addEventListener("drop", onDrop);
593
+ root.addEventListener("dragend", onDragEnd);
594
+ root.addEventListener("dragleave", onDragLeave);
595
+ return () => {
596
+ clear();
597
+ root.removeEventListener("dragstart", onDragStart);
598
+ root.removeEventListener("dragover", onDragOver);
599
+ root.removeEventListener("drop", onDrop);
600
+ root.removeEventListener("dragend", onDragEnd);
601
+ root.removeEventListener("dragleave", onDragLeave);
602
+ };
603
+ }, [editor]);
604
+ if (!caret) return null;
605
+ return createPortal(/* @__PURE__ */ jsx("div", {
606
+ className: dropCaret,
607
+ style: {
608
+ left: caret.left,
609
+ top: caret.top,
610
+ height: caret.height
611
+ }
612
+ }), document.body);
613
+ }
614
+ //#endregion
433
615
  //#region src/transformers/alert.ts
434
616
  var ALERT_TYPE_MAP = {
435
617
  NOTE: "note",
@@ -898,6 +1080,7 @@ function CorePlugins() {
898
1080
  /* @__PURE__ */ jsx(TablePlugin, { hasHorizontalScroll: true }),
899
1081
  /* @__PURE__ */ jsx(CheckListPlugin, {}),
900
1082
  /* @__PURE__ */ jsx(MarkdownShortcutsPlugin, {}),
1083
+ /* @__PURE__ */ jsx(InlineDndPlugin, {}),
901
1084
  /* @__PURE__ */ jsx(MarkdownPastePlugin, {}),
902
1085
  /* @__PURE__ */ jsx(BlockExitPlugin, {}),
903
1086
  /* @__PURE__ */ jsx(ClickBelowPlugin, {}),
@@ -906,6 +1089,18 @@ function CorePlugins() {
906
1089
  ] });
907
1090
  }
908
1091
  //#endregion
1092
+ //#region src/context/FileUploadContext.tsx
1093
+ var FileUploadContext = createContext(null);
1094
+ function FileUploadProvider({ upload, children }) {
1095
+ return /* @__PURE__ */ jsx(FileUploadContext.Provider, {
1096
+ value: upload,
1097
+ children
1098
+ });
1099
+ }
1100
+ function useFileUpload() {
1101
+ return use(FileUploadContext);
1102
+ }
1103
+ //#endregion
909
1104
  //#region src/context/ImagePreprocessContext.tsx
910
1105
  var ImagePreprocessContext = createContext(null);
911
1106
  function ImagePreprocessProvider({ children }) {
@@ -1053,6 +1248,136 @@ function BlockIdPlugin() {
1053
1248
  return null;
1054
1249
  }
1055
1250
  //#endregion
1251
+ //#region src/plugins/file-upload-store.ts
1252
+ var stores = /* @__PURE__ */ new WeakMap();
1253
+ function getStore(editor) {
1254
+ let store = stores.get(editor);
1255
+ if (!store) {
1256
+ store = {
1257
+ entries: /* @__PURE__ */ new Map(),
1258
+ listeners: /* @__PURE__ */ new Set()
1259
+ };
1260
+ stores.set(editor, store);
1261
+ }
1262
+ return store;
1263
+ }
1264
+ function setFileUploadEntry(editor, nodeKey, entry) {
1265
+ const store = getStore(editor);
1266
+ if (entry) store.entries.set(nodeKey, entry);
1267
+ else store.entries.delete(nodeKey);
1268
+ for (const listener of store.listeners) listener();
1269
+ }
1270
+ function useFileUploadEntry(editor, nodeKey) {
1271
+ return useSyncExternalStore((onChange) => {
1272
+ const store = getStore(editor);
1273
+ store.listeners.add(onChange);
1274
+ return () => store.listeners.delete(onChange);
1275
+ }, () => nodeKey ? getStore(editor).entries.get(nodeKey) : void 0, () => void 0);
1276
+ }
1277
+ //#endregion
1278
+ //#region src/plugins/FileUploadPlugin.tsx
1279
+ function isMediaFile(file) {
1280
+ return file.type.startsWith("image/") || file.type.startsWith("video/");
1281
+ }
1282
+ function FileUploadPlugin({ onUpload }) {
1283
+ const [editor] = useLexicalComposerContext();
1284
+ const uploadRef = useRef(onUpload);
1285
+ uploadRef.current = onUpload;
1286
+ const targetEditorRef = useRef(editor);
1287
+ const fileInputRef = useRef(null);
1288
+ const uploadFile = useCallback((file, target) => {
1289
+ let nodeKey = "";
1290
+ target.update(() => {
1291
+ const node = $createFileNode({
1292
+ src: "",
1293
+ name: file.name,
1294
+ size: file.size,
1295
+ mimeType: file.type || void 0,
1296
+ ext: fileExtFromName(file.name)
1297
+ });
1298
+ $insertNodes([node]);
1299
+ nodeKey = node.getKey();
1300
+ });
1301
+ const remove = () => {
1302
+ setFileUploadEntry(target, nodeKey, null);
1303
+ target.update(() => {
1304
+ const node = $getNodeByKey(nodeKey);
1305
+ if (node) node.remove();
1306
+ });
1307
+ };
1308
+ const run = async () => {
1309
+ const base = {
1310
+ percent: 0,
1311
+ retry: () => void run(),
1312
+ remove
1313
+ };
1314
+ setFileUploadEntry(target, nodeKey, {
1315
+ ...base,
1316
+ status: "uploading"
1317
+ });
1318
+ try {
1319
+ const result = await uploadRef.current(file, { onProgress: (percent) => {
1320
+ setFileUploadEntry(target, nodeKey, {
1321
+ ...base,
1322
+ status: "uploading",
1323
+ percent: Math.round(percent)
1324
+ });
1325
+ } });
1326
+ target.update(() => {
1327
+ const node = $getNodeByKey(nodeKey);
1328
+ if ($isFileNode(node)) node.setSrc(result.src);
1329
+ });
1330
+ setFileUploadEntry(target, nodeKey, null);
1331
+ } catch (err) {
1332
+ console.error("[FileUploadPlugin]", err);
1333
+ setFileUploadEntry(target, nodeKey, {
1334
+ ...base,
1335
+ status: "error",
1336
+ error: "Upload failed"
1337
+ });
1338
+ }
1339
+ };
1340
+ run();
1341
+ }, []);
1342
+ const handleFiles = useCallback((files, target) => {
1343
+ const plainFiles = files.filter((file) => !isMediaFile(file));
1344
+ if (plainFiles.length === 0) return false;
1345
+ for (const file of plainFiles) uploadFile(file, target);
1346
+ return plainFiles.length === files.length;
1347
+ }, [uploadFile]);
1348
+ useEffect(() => {
1349
+ const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files, fromEditor) => handleFiles(files, fromEditor), COMMAND_PRIORITY_LOW);
1350
+ const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event, fromEditor) => {
1351
+ const clipboardData = "clipboardData" in event ? event.clipboardData : null;
1352
+ if (!clipboardData) return false;
1353
+ const files = [...clipboardData.files];
1354
+ if (files.some((file) => !isMediaFile(file))) return handleFiles(files, fromEditor);
1355
+ return false;
1356
+ }, COMMAND_PRIORITY_LOW);
1357
+ const unregisterOpenPicker = editor.registerCommand(OPEN_FILE_PICKER_COMMAND, (_payload, fromEditor) => {
1358
+ targetEditorRef.current = fromEditor;
1359
+ fileInputRef.current?.click();
1360
+ return true;
1361
+ }, COMMAND_PRIORITY_EDITOR);
1362
+ return () => {
1363
+ unregisterDragDrop();
1364
+ unregisterPaste();
1365
+ unregisterOpenPicker();
1366
+ };
1367
+ }, [editor, handleFiles]);
1368
+ return /* @__PURE__ */ jsx("input", {
1369
+ multiple: true,
1370
+ ref: fileInputRef,
1371
+ style: { display: "none" },
1372
+ type: "file",
1373
+ onChange: (event) => {
1374
+ const files = [...event.currentTarget.files ?? []];
1375
+ for (const file of files) uploadFile(file, targetEditorRef.current);
1376
+ event.currentTarget.value = "";
1377
+ }
1378
+ });
1379
+ }
1380
+ //#endregion
1056
1381
  //#region src/utils/image-preprocess.ts
1057
1382
  async function resolvePreprocessTargets(files, source, preprocess) {
1058
1383
  if (!preprocess || files.length !== 1) return files;
@@ -2420,4 +2745,4 @@ function SubmitShortcutPlugin({ onSubmit }) {
2420
2745
  return null;
2421
2746
  }
2422
2747
  //#endregion
2423
- export { blockIdState as A, ALL_TRANSFORMERS as B, createTextSelectionStore as C, ImageUploadPlugin as D, LinkFaviconPlugin as E, ImagePreprocessProvider as F, AutoLinkPlugin as G, ClickBelowPlugin as H, useImagePreprocess as I, CorePlugins as L, useVideoUpload as M, ImageUploadProvider as N, defaultImageUpload as O, useImageUpload as P, MarkdownShortcutsPlugin as R, TextSelectionStoreProvider as S, useTextSelectionStore as T, registerClickBelowCommand as U, HorizontalRulePlugin as V, BlockExitPlugin as W, $getRootBlock as _, AutoFocusPlugin as a, buildBlockAnchor as b, $captureTextSelection as c, createDOMRangeFromTextSelection as d, findDOMPointByTextOffset as f, TEXT_SELECTION_HIGHLIGHT_NAME as g, getTextOffsetFromDOMPoint as h, EditorRefPlugin as i, VideoUploadProvider as j, BlockIdPlugin as k, $captureTextSelectionFromRangeSelection as l, getDOMRectFromTextSelection as m, OnChangePlugin as n, VideoUploadPlugin as o, getBlockElementById as p, FootnotePlugin as r, TextSelectionPlugin as s, SubmitShortcutPlugin as t, $restoreTextSelection as u, $getTextOffsetInBlock as v, useTextSelectionSnapshot as w, buildRangeAnchor as x, $resolveSelectionPoint as y, MarkdownPastePlugin as z };
2748
+ export { setFileUploadEntry as A, FileUploadProvider as B, createTextSelectionStore as C, ImageUploadPlugin as D, LinkFaviconPlugin as E, useVideoUpload as F, ALL_TRANSFORMERS as G, CorePlugins as H, ImageUploadProvider as I, ClickBelowPlugin as J, InlineDndPlugin as K, useImageUpload as L, BlockIdPlugin as M, blockIdState as N, defaultImageUpload as O, VideoUploadProvider as P, ImagePreprocessProvider as R, TextSelectionStoreProvider as S, useTextSelectionStore as T, MarkdownShortcutsPlugin as U, useFileUpload as V, MarkdownPastePlugin as W, BlockExitPlugin as X, registerClickBelowCommand as Y, AutoLinkPlugin as Z, $getRootBlock as _, AutoFocusPlugin as a, buildBlockAnchor as b, $captureTextSelection as c, createDOMRangeFromTextSelection as d, findDOMPointByTextOffset as f, TEXT_SELECTION_HIGHLIGHT_NAME as g, getTextOffsetFromDOMPoint as h, EditorRefPlugin as i, useFileUploadEntry as j, FileUploadPlugin as k, $captureTextSelectionFromRangeSelection as l, getDOMRectFromTextSelection as m, OnChangePlugin as n, VideoUploadPlugin as o, getBlockElementById as p, HorizontalRulePlugin as q, FootnotePlugin as r, TextSelectionPlugin as s, SubmitShortcutPlugin as t, $restoreTextSelection as u, $getTextOffsetInBlock as v, useTextSelectionSnapshot as w, buildRangeAnchor as x, $resolveSelectionPoint as y, useImagePreprocess as z };
@@ -1,4 +1,5 @@
1
1
  export { INSERT_ALERT_COMMAND } from './plugins/AlertPlugin';
2
+ export { OPEN_FILE_PICKER_COMMAND } from './plugins/file-upload-command';
2
3
  export { OPEN_IMAGE_UPLOAD_DIALOG_COMMAND } from './plugins/image-upload-command';
3
4
  export { INSERT_IMAGE_COMMAND } from './plugins/ImagePlugin';
4
5
  export { INSERT_KATEX_BLOCK_COMMAND, INSERT_KATEX_INLINE_COMMAND } from './plugins/KaTeXPlugin';
@@ -1 +1 @@
1
- {"version":3,"file":"commands-entry.d.ts","sourceRoot":"","sources":["../src/commands-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"commands-entry.d.ts","sourceRoot":"","sources":["../src/commands-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { K as extractTextContent, k as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-CnNR-Ttt.js";
2
- import { i as INSERT_KATEX_INLINE_COMMAND, l as INSERT_ALERT_COMMAND, o as INSERT_IMAGE_COMMAND, r as INSERT_KATEX_BLOCK_COMMAND, t as INSERT_MERMAID_COMMAND } from "./MermaidPlugin-BOP4CFU_.js";
1
+ import { V as OPEN_FILE_PICKER_COMMAND, k as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as $createSpoilerNode, q as extractTextContent, s as $isSpoilerNode } from "./theme-Vu_9D3oG.js";
2
+ import { i as INSERT_KATEX_INLINE_COMMAND, l as INSERT_ALERT_COMMAND, o as INSERT_IMAGE_COMMAND, r as INSERT_KATEX_BLOCK_COMMAND, t as INSERT_MERMAID_COMMAND } from "./MermaidPlugin-DgIAgFH8.js";
3
3
  import { $createTextNode, $getSelection, $isRangeSelection } from "lexical";
4
4
  //#region src/utils/collect-command-items.ts
5
5
  function collectCommandItems(editor) {
@@ -63,4 +63,4 @@ function $toggleSpoilerSelection() {
63
63
  if ($isRangeSelection(freshSelection)) freshSelection.insertNodes([spoiler]);
64
64
  }
65
65
  //#endregion
66
- export { $selectionTouchesSpoiler, $toggleSpoilerSelection, INSERT_ALERT_COMMAND, INSERT_IMAGE_COMMAND, INSERT_KATEX_BLOCK_COMMAND, INSERT_KATEX_INLINE_COMMAND, INSERT_MERMAID_COMMAND, OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, collectCommandItems, extractTextContent };
66
+ export { $selectionTouchesSpoiler, $toggleSpoilerSelection, INSERT_ALERT_COMMAND, INSERT_IMAGE_COMMAND, INSERT_KATEX_BLOCK_COMMAND, INSERT_KATEX_INLINE_COMMAND, INSERT_MERMAID_COMMAND, OPEN_FILE_PICKER_COMMAND, OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, collectCommandItems, extractTextContent };
@@ -1 +1 @@
1
- {"version":3,"file":"CorePlugins.d.ts","sourceRoot":"","sources":["../../src/components/CorePlugins.tsx"],"names":[],"mappings":"AAcA,wBAAgB,WAAW,gCAiB1B"}
1
+ {"version":3,"file":"CorePlugins.d.ts","sourceRoot":"","sources":["../../src/components/CorePlugins.tsx"],"names":[],"mappings":"AAeA,wBAAgB,WAAW,gCAkB1B"}