@haklex/rich-editor 0.31.0 → 0.31.1

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.
@@ -1,5 +1,5 @@
1
- import { I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, N as $isAlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, t as editorTheme, z as AlertRenderer } from "./theme-U_m9LjWN.js";
2
- import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, N as $isAlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, t as editorTheme, z as AlertRenderer } from "./theme-BVIoTCzV.js";
2
+ import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-g9a2JrRn.js";
3
3
  import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
4
4
  import { ListPlugin } from "@lexical/react/LexicalListPlugin";
5
5
  import { AutoLinkNode, LinkNode } from "@lexical/link";
@@ -218,10 +218,11 @@ function KaTeXRenderer({ equation, displayMode }) {
218
218
  let cancelled = false;
219
219
  loadKaTeX().then((katex) => {
220
220
  if (cancelled) return;
221
- setHtml(katex.default.renderToString(equation, {
221
+ const rendered = katex.default.renderToString(equation, {
222
222
  displayMode,
223
223
  throwOnError: false
224
- }));
224
+ });
225
+ setHtml(rendered);
225
226
  setError(null);
226
227
  }).catch(() => {
227
228
  if (cancelled) return;
@@ -1,5 +1,5 @@
1
- import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-U_m9LjWN.js";
2
- import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-BfmHO7Jd.js";
1
+ import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-BVIoTCzV.js";
2
+ import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DzAlcunI.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-DvTGvhg8.js";
2
- import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, C as KaTeXBlockNode, I as AlertQuoteNode, M as FootnoteNode, R as extractTextContent, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, j as $createFootnoteNode, k as $withAdaptiveImageDisplayWidth, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-U_m9LjWN.js";
3
- import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-Cv-szVok.js";
2
+ import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, C as KaTeXBlockNode, I as AlertQuoteNode, M as FootnoteNode, R as extractTextContent, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, j as $createFootnoteNode, k as $withAdaptiveImageDisplayWidth, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-BVIoTCzV.js";
3
+ import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-g9a2JrRn.js";
4
4
  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-0MlVOo52.js";
6
- import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-BfmHO7Jd.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-cSO27cEU.js";
6
+ import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DzAlcunI.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";
@@ -443,7 +443,8 @@ var GIT_ALERT_TRANSFORMER$1 = {
443
443
  dependencies: [AlertQuoteNode],
444
444
  regExp: /^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/,
445
445
  replace: (parentNode, children, match) => {
446
- const alertNode = $createAlertQuoteEditNode(ALERT_TYPE_MAP[match[1]] || "note", { root: {
446
+ const typeKey = match[1];
447
+ const alertNode = $createAlertQuoteEditNode(ALERT_TYPE_MAP[typeKey] || "note", { root: {
447
448
  children: [{
448
449
  type: "paragraph",
449
450
  children: children.map((child) => child.exportJSON()),
@@ -1039,7 +1040,8 @@ function BlockIdPlugin() {
1039
1040
  syncBlockIdAttributes(editor);
1040
1041
  return;
1041
1042
  }
1042
- normalizeRootBlockIds(editor, buildPreviousIdIndex(prevEditorState));
1043
+ const previousIdIndex = buildPreviousIdIndex(prevEditorState);
1044
+ normalizeRootBlockIds(editor, previousIdIndex);
1043
1045
  });
1044
1046
  }, [editor]);
1045
1047
  return null;
@@ -1290,7 +1292,8 @@ function ImageUploadPlugin({ onUpload }) {
1290
1292
  setUrlLoading(true);
1291
1293
  setUrlError(null);
1292
1294
  try {
1293
- setUrlMeta(await loadImageByUrl(nextUrl));
1295
+ const meta = await loadImageByUrl(nextUrl);
1296
+ setUrlMeta(meta);
1294
1297
  setUrlPreview(nextUrl);
1295
1298
  } catch {
1296
1299
  setUrlPreview(null);
@@ -1382,7 +1385,8 @@ function ImageUploadPlugin({ onUpload }) {
1382
1385
  onDrop: (event) => {
1383
1386
  event.preventDefault();
1384
1387
  setDialogDragActive(false);
1385
- handleDialogFile([...event.dataTransfer.files].find(isImageFile) ?? null);
1388
+ const file = [...event.dataTransfer.files].find(isImageFile);
1389
+ handleDialogFile(file ?? null);
1386
1390
  },
1387
1391
  onKeyDown: (event) => {
1388
1392
  if (event.key !== "Enter" && event.key !== " ") return;
@@ -1395,7 +1399,8 @@ function ImageUploadPlugin({ onUpload }) {
1395
1399
  ref: fileInputRef,
1396
1400
  type: "file",
1397
1401
  onChange: (event) => {
1398
- handleDialogFile(event.currentTarget.files?.[0] ?? null);
1402
+ const file = event.currentTarget.files?.[0] ?? null;
1403
+ handleDialogFile(file);
1399
1404
  event.currentTarget.value = "";
1400
1405
  }
1401
1406
  }), dialogUploading ? /* @__PURE__ */ jsx("div", {
@@ -1,5 +1,5 @@
1
- import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-U_m9LjWN.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-CQ5m_jba.js";
1
+ import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-BVIoTCzV.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-C9MynNJB.js";
3
3
  import { $createTextNode, $getSelection, $isRangeSelection } from "lexical";
4
4
  //#region src/utils/collect-command-items.ts
5
5
  function collectCommandItems(editor) {
@@ -1,5 +1,5 @@
1
- import { C as KaTeXBlockNode, E as ImageNode, I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, R as extractTextContent, V as useNestedContentRenderer, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, m as MermaidNode } from "./theme-U_m9LjWN.js";
2
- import { D as VIDEO_NODE_KEY, S as LINK_CARD_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, m as useVariant, s as useFootnoteDefinitions, u as createRendererDecoration, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { C as KaTeXBlockNode, E as ImageNode, I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, R as extractTextContent, V as useNestedContentRenderer, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, m as MermaidNode } from "./theme-BVIoTCzV.js";
2
+ import { D as VIDEO_NODE_KEY, S as LINK_CARD_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, m as useVariant, s as useFootnoteDefinitions, u as createRendererDecoration, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-g9a2JrRn.js";
3
3
  import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
4
4
  import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
5
5
  import { t as LinkCardRenderer } from "./LinkCardRenderer-DPV1JP0X.js";
@@ -122,14 +122,17 @@ var BannerNode = class BannerNode extends DecoratorNode {
122
122
  const legacy = serializedNode;
123
123
  const bannerType = normalizeBannerType(serializedNode.bannerType);
124
124
  if (serializedNode.content) return new BannerNode(bannerType, serializedNode.content);
125
- if (legacy.children) return new BannerNode(bannerType, { root: {
126
- children: legacy.children,
127
- direction: null,
128
- format: "",
129
- indent: 0,
130
- type: "root",
131
- version: 1
132
- } });
125
+ if (legacy.children) {
126
+ const content = { root: {
127
+ children: legacy.children,
128
+ direction: null,
129
+ format: "",
130
+ indent: 0,
131
+ type: "root",
132
+ version: 1
133
+ } };
134
+ return new BannerNode(bannerType, content);
135
+ }
133
136
  return new BannerNode(bannerType);
134
137
  }
135
138
  exportJSON() {
@@ -839,16 +842,19 @@ var GridContainerNode = class GridContainerNode extends DecoratorNode {
839
842
  const rawGap = legacy.gap;
840
843
  const gap = typeof rawGap === "number" ? `${rawGap}px` : rawGap;
841
844
  if (legacy.cells && legacy.cells.length > 0) return new GridContainerNode(cols, gap, legacy.cells);
842
- if (legacy.children) return new GridContainerNode(cols, gap, legacy.children.map((child) => {
843
- return { root: {
844
- children: [child],
845
- direction: null,
846
- format: "",
847
- indent: 0,
848
- type: "root",
849
- version: 1
850
- } };
851
- }));
845
+ if (legacy.children) {
846
+ const cellStates = legacy.children.map((child) => {
847
+ return { root: {
848
+ children: [child],
849
+ direction: null,
850
+ format: "",
851
+ indent: 0,
852
+ type: "root",
853
+ version: 1
854
+ } };
855
+ });
856
+ return new GridContainerNode(cols, gap, cellStates);
857
+ }
852
858
  return new GridContainerNode(cols, gap);
853
859
  }
854
860
  exportJSON() {
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { A as blockIdState, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, L as CorePlugins, N as ImageUploadProvider, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, _ as $getRootBlock, a as AutoFocusPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as OnChangePlugin, o as VideoUploadPlugin, p as getBlockElementById, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./SubmitShortcutPlugin-Co0i30pp.js";
2
- import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-DvTGvhg8.js";
3
- import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-U_m9LjWN.js";
4
- import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { A as blockIdState, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, L as CorePlugins, N as ImageUploadProvider, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, _ as $getRootBlock, a as AutoFocusPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as OnChangePlugin, o as VideoUploadPlugin, p as getBlockElementById, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./SubmitShortcutPlugin-BNswmibh.js";
2
+ import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-Cv-szVok.js";
3
+ import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-BVIoTCzV.js";
4
+ import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-g9a2JrRn.js";
5
5
  import { a as noteVariant, c as richContent, i as getVariantClass, l as semanticClassNames, n as katexStyles, o as commentVariant, r as clsx, s as articleVariant, t as katexClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
6
- import { D as ColorSchemeProvider, O as useColorScheme } from "./config-0MlVOo52.js";
6
+ import { D as ColorSchemeProvider, O as useColorScheme } from "./config-cSO27cEU.js";
7
7
  import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
8
- import { a as NestedEditorPluginsProvider, o as useNestedEditorPlugins } from "./AlertQuoteEditNode-BfmHO7Jd.js";
8
+ import { a as NestedEditorPluginsProvider, o as useNestedEditorPlugins } from "./AlertQuoteEditNode-DzAlcunI.js";
9
9
  import { t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
10
10
  import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-Cjb_L5rP.js";
11
- import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-CQ5m_jba.js";
11
+ import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-C9MynNJB.js";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  import { ContentEditable } from "@lexical/react/LexicalContentEditable";
14
14
  import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
@@ -1,9 +1,9 @@
1
- import { C as KaTeXBlockNode, E as ImageNode, L as _defineProperty, M as FootnoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, i as TagNode, m as MermaidNode, t as editorTheme } from "./theme-U_m9LjWN.js";
2
- import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { C as KaTeXBlockNode, E as ImageNode, L as _defineProperty, M as FootnoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, i as TagNode, m as MermaidNode, t as editorTheme } from "./theme-BVIoTCzV.js";
2
+ import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-g9a2JrRn.js";
3
3
  import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
4
- import { C as CommentNode, E as CodeBlockRenderer, M as BannerNode, N as normalizeBannerType, P as BannerRenderer, T as CodeBlockNode, _ as FootnoteSectionNode, a as VideoNode, c as RubyNode, d as LinkCardNode, k as $isBannerNode, m as GridContainerNode, n as builtinNodes, p as $isGridContainerNode, w as $isCodeBlockNode, y as DetailsNode } from "./config-0MlVOo52.js";
4
+ import { C as CommentNode, E as CodeBlockRenderer, M as BannerNode, N as normalizeBannerType, P as BannerRenderer, T as CodeBlockNode, _ as FootnoteSectionNode, a as VideoNode, c as RubyNode, d as LinkCardNode, k as $isBannerNode, m as GridContainerNode, n as builtinNodes, p as $isGridContainerNode, w as $isCodeBlockNode, y as DetailsNode } from "./config-cSO27cEU.js";
5
5
  import { n as gridStyles, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
6
- import { i as NestedEditorCorePlugins, n as AlertQuoteEditNode, r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-BfmHO7Jd.js";
6
+ import { i as NestedEditorCorePlugins, n as AlertQuoteEditNode, r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-DzAlcunI.js";
7
7
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
8
8
  import { createElement, useCallback, useEffect, useState } from "react";
9
9
  import { $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isDecoratorNode, $isElementNode, $isNodeSelection, $nodesOfType, $setSelection, createEditor } from "lexical";
@@ -98,14 +98,17 @@ var BannerEditNode = class BannerEditNode extends BannerNode {
98
98
  const legacy = serializedNode;
99
99
  const bannerType = normalizeBannerType(serializedNode.bannerType);
100
100
  if (serializedNode.content) return new BannerEditNode(bannerType, serializedNode.content);
101
- if (legacy.children) return new BannerEditNode(bannerType, { root: {
102
- children: legacy.children,
103
- direction: null,
104
- format: "",
105
- indent: 0,
106
- type: "root",
107
- version: 1
108
- } });
101
+ if (legacy.children) {
102
+ const content = { root: {
103
+ children: legacy.children,
104
+ direction: null,
105
+ format: "",
106
+ indent: 0,
107
+ type: "root",
108
+ version: 1
109
+ } };
110
+ return new BannerEditNode(bannerType, content);
111
+ }
109
112
  return new BannerEditNode(bannerType);
110
113
  }
111
114
  exportJSON() {
@@ -633,16 +636,19 @@ var GridEditNode = class GridEditNode extends GridContainerNode {
633
636
  const rawGap = legacy.gap;
634
637
  const gap = typeof rawGap === "number" ? `${rawGap}px` : rawGap;
635
638
  if (legacy.cells && legacy.cells.length > 0) return new GridEditNode(cols, gap, legacy.cells);
636
- if (legacy.children) return new GridEditNode(cols, gap, legacy.children.map((child) => {
637
- return { root: {
638
- children: [child],
639
- direction: null,
640
- format: "",
641
- indent: 0,
642
- type: "root",
643
- version: 1
644
- } };
645
- }));
639
+ if (legacy.children) {
640
+ const cellStates = legacy.children.map((child) => {
641
+ return { root: {
642
+ children: [child],
643
+ direction: null,
644
+ format: "",
645
+ indent: 0,
646
+ type: "root",
647
+ version: 1
648
+ } };
649
+ });
650
+ return new GridEditNode(cols, gap, cellStates);
651
+ }
646
652
  return new GridEditNode(cols, gap);
647
653
  }
648
654
  exportJSON() {
@@ -1,5 +1,5 @@
1
- import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-DvTGvhg8.js";
2
- import { C as KaTeXBlockNode, D as sanitizeImageDisplayWidth, E as ImageNode, F as ALERT_TYPES, O as sanitizeImageLayout, P as ALERT_LABELS, S as $isKaTeXBlockNode, T as $isImageNode, _ as MentionNode, b as KaTeXInlineNode, d as RichQuoteNode, f as $createMermaidNode, g as $isMentionNode, h as $createMentionNode, i as TagNode, l as $createRichQuoteNode, m as MermaidNode, n as $createTagNode, p as $isMermaidNode, r as $isTagNode, u as $isRichQuoteNode, w as $createImageNode, y as $isKaTeXInlineNode } from "./theme-U_m9LjWN.js";
3
- import { A as BANNER_LABELS, C as CommentNode, S as $isCommentNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, d as LinkCardNode, f as $createGridContainerNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, j as BANNER_TYPES, l as $createLinkCardNode, m as GridContainerNode, n as builtinNodes, o as $createRubyNode, p as $isGridContainerNode, r as customNodes, s as $isRubyNode, t as allNodes, u as $isLinkCardNode } from "./config-0MlVOo52.js";
4
- import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-BfmHO7Jd.js";
1
+ import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-Cv-szVok.js";
2
+ import { C as KaTeXBlockNode, D as sanitizeImageDisplayWidth, E as ImageNode, F as ALERT_TYPES, O as sanitizeImageLayout, P as ALERT_LABELS, S as $isKaTeXBlockNode, T as $isImageNode, _ as MentionNode, b as KaTeXInlineNode, d as RichQuoteNode, f as $createMermaidNode, g as $isMentionNode, h as $createMentionNode, i as TagNode, l as $createRichQuoteNode, m as MermaidNode, n as $createTagNode, p as $isMermaidNode, r as $isTagNode, u as $isRichQuoteNode, w as $createImageNode, y as $isKaTeXInlineNode } from "./theme-BVIoTCzV.js";
3
+ import { A as BANNER_LABELS, C as CommentNode, S as $isCommentNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, d as LinkCardNode, f as $createGridContainerNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, j as BANNER_TYPES, l as $createLinkCardNode, m as GridContainerNode, n as builtinNodes, o as $createRubyNode, p as $isGridContainerNode, r as customNodes, s as $isRubyNode, t as allNodes, u as $isLinkCardNode } from "./config-cSO27cEU.js";
4
+ import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-DzAlcunI.js";
5
5
  export { $createCommentNode, $createFootnoteSectionNode, $createGridContainerNode, $createImageNode, $createLinkCardNode, $createMentionNode, $createMermaidNode, $createRichQuoteNode, $createRubyNode, $createTagNode, $isCommentNode, $isFootnoteSectionNode, $isGridContainerNode, $isImageNode, $isKaTeXBlockNode, $isKaTeXInlineNode, $isLinkCardNode, $isMentionNode, $isMermaidNode, $isRichQuoteNode, $isRubyNode, $isTagNode, ALERT_LABELS, ALERT_TYPES, BANNER_LABELS, BANNER_TYPES, CommentNode, FootnoteSectionEditNode, FootnoteSectionNode, GridContainerNode, ImageNode, KaTeXBlockNode, KaTeXInlineNode, LinkCardNode, MentionNode, MermaidNode, NESTED_EDITOR_NODES, RichQuoteNode, RubyNode, TagNode, allEditNodes, allNodes, builtinNodes, customEditNodes, customNodes, getResolvedEditNodes, sanitizeImageDisplayWidth, sanitizeImageLayout, setResolvedEditNodes };
@@ -1,3 +1,3 @@
1
- import { A as blockIdState, B as ALL_TRANSFORMERS, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, G as AutoLinkPlugin, H as ClickBelowPlugin, I as useImagePreprocess, L as CorePlugins, M as useVideoUpload, N as ImageUploadProvider, O as defaultImageUpload, P as useImageUpload, R as MarkdownShortcutsPlugin, U as registerClickBelowCommand, V as HorizontalRulePlugin, W as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, n as OnChangePlugin, o as VideoUploadPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as MarkdownPastePlugin } from "./SubmitShortcutPlugin-Co0i30pp.js";
2
- import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-CQ5m_jba.js";
1
+ import { A as blockIdState, B as ALL_TRANSFORMERS, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, G as AutoLinkPlugin, H as ClickBelowPlugin, I as useImagePreprocess, L as CorePlugins, M as useVideoUpload, N as ImageUploadProvider, O as defaultImageUpload, P as useImageUpload, R as MarkdownShortcutsPlugin, U as registerClickBelowCommand, V as HorizontalRulePlugin, W as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, n as OnChangePlugin, o as VideoUploadPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as MarkdownPastePlugin } from "./SubmitShortcutPlugin-BNswmibh.js";
2
+ import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-C9MynNJB.js";
3
3
  export { ALL_TRANSFORMERS, AlertPlugin, AutoFocusPlugin, AutoLinkPlugin, BlockExitPlugin, BlockIdPlugin, ClickBelowPlugin, CorePlugins, EditorRefPlugin, FootnotePlugin, HorizontalRulePlugin, ImagePlugin, ImagePreprocessProvider, ImageUploadPlugin, ImageUploadProvider, KaTeXPlugin, LinkFaviconPlugin, MarkdownPastePlugin, MarkdownShortcutsPlugin, MermaidPlugin, OnChangePlugin, SubmitShortcutPlugin, TextSelectionPlugin, VideoUploadPlugin, VideoUploadProvider, blockIdState, defaultImageUpload, registerClickBelowCommand, useImagePreprocess, useImageUpload, useVideoUpload };
@@ -1,4 +1,4 @@
1
- import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, n as computeImageMeta, o as useFootnoteContent, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, n as computeImageMeta, o as useFootnoteContent, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-g9a2JrRn.js";
2
2
  import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
3
3
  import { t as LinkCardRenderer } from "./LinkCardRenderer-DPV1JP0X.js";
4
4
  import { t as RubyRenderer } from "./RubyRenderer-B76PPUga.js";
@@ -1,7 +1,7 @@
1
- import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, R as extractTextContent, V as useNestedContentRenderer, a as getTagBgColor, t as editorTheme } from "./theme-U_m9LjWN.js";
2
- import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, l as RendererWrapper, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, R as extractTextContent, V as useNestedContentRenderer, a as getTagBgColor, t as editorTheme } from "./theme-BVIoTCzV.js";
2
+ import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, l as RendererWrapper, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-g9a2JrRn.js";
3
3
  import { a as noteVariant, c as richContent, i as getVariantClass, l as semanticClassNames, n as katexStyles, o as commentVariant, r as clsx, s as articleVariant, t as katexClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
4
- import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-0MlVOo52.js";
4
+ import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-cSO27cEU.js";
5
5
  import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
6
6
  import { t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
7
7
  import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-Cjb_L5rP.js";
@@ -1,4 +1,4 @@
1
- import { C as MENTION_NODE_KEY, b as IMAGE_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY } from "./KaTeXRenderer-CRL_A32i.js";
1
+ import { C as MENTION_NODE_KEY, b as IMAGE_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY } from "./KaTeXRenderer-g9a2JrRn.js";
2
2
  import { l as semanticClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
3
3
  import { createContext, createElement, use, useCallback, useEffect, useMemo, useState } from "react";
4
4
  import { QuoteNode } from "@lexical/rich-text";
@@ -69,7 +69,7 @@ function extractTextContent(state) {
69
69
  return walk(state);
70
70
  }
71
71
  //#endregion
72
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
72
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
73
73
  function _typeof(o) {
74
74
  "@babel/helpers - typeof";
75
75
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -79,7 +79,7 @@ function _typeof(o) {
79
79
  }, _typeof(o);
80
80
  }
81
81
  //#endregion
82
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
82
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
83
83
  function toPrimitive(t, r) {
84
84
  if ("object" != _typeof(t) || !t) return t;
85
85
  var e = t[Symbol.toPrimitive];
@@ -91,13 +91,13 @@ function toPrimitive(t, r) {
91
91
  return ("string" === r ? String : Number)(t);
92
92
  }
93
93
  //#endregion
94
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
94
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
95
95
  function toPropertyKey(t) {
96
96
  var i = toPrimitive(t, "string");
97
97
  return "symbol" == _typeof(i) ? i : i + "";
98
98
  }
99
99
  //#endregion
100
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
100
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
101
101
  function _defineProperty(e, r, t) {
102
102
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
103
103
  value: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
4
4
  "description": "Core rich text editor based on Lexical",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,34 +45,34 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "@lexical/code-core": "^0.47.0",
49
- "nanoid": "^5.1.16",
48
+ "@lexical/code-core": "^0.48.0",
49
+ "nanoid": "^6.0.0",
50
50
  "thumbhash": "^0.1.1",
51
- "@haklex/rich-editor-ui": "0.31.0",
52
- "@haklex/rich-style-token": "0.31.0",
53
- "@haklex/rich-headless": "0.31.0"
51
+ "@haklex/rich-editor-ui": "0.31.1",
52
+ "@haklex/rich-headless": "0.31.1",
53
+ "@haklex/rich-style-token": "0.31.1"
54
54
  },
55
55
  "devDependencies": {
56
- "@lexical/extension": "^0.47.0",
57
- "@lexical/link": "^0.47.0",
58
- "@lexical/list": "^0.47.0",
59
- "@lexical/markdown": "^0.47.0",
60
- "@lexical/react": "^0.47.0",
61
- "@lexical/rich-text": "^0.47.0",
62
- "@lexical/table": "^0.47.0",
56
+ "@lexical/extension": "^0.48.0",
57
+ "@lexical/link": "^0.48.0",
58
+ "@lexical/list": "^0.48.0",
59
+ "@lexical/markdown": "^0.48.0",
60
+ "@lexical/react": "^0.48.0",
61
+ "@lexical/rich-text": "^0.48.0",
62
+ "@lexical/table": "^0.48.0",
63
63
  "@types/react": "^19.2.17",
64
64
  "@types/react-dom": "^19.2.3",
65
- "@vanilla-extract/css": "^1.21.0",
66
- "@vanilla-extract/vite-plugin": "^5.2.3",
65
+ "@vanilla-extract/css": "^1.21.1",
66
+ "@vanilla-extract/vite-plugin": "^5.2.5",
67
67
  "katex": "^0.17.0",
68
- "lexical": "^0.47.0",
69
- "lucide-react": "^1.21.0",
68
+ "lexical": "^0.48.0",
69
+ "lucide-react": "^1.25.0",
70
70
  "react": "^19.2.7",
71
71
  "react-dom": "^19.2.7",
72
- "shiki": "^4.3.0",
72
+ "shiki": "^4.3.1",
73
73
  "typescript": "^6.0.3",
74
74
  "unplugin-dts": "^1.0.3",
75
- "vite": "^8.1.0"
75
+ "vite": "^8.1.5"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@base-ui/react": ">=1.5.0",