@haklex/rich-editor 0.33.0 → 0.34.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.
@@ -1,4 +1,4 @@
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-BxnXR-HA.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-C7HnCTta.js";
2
2
  import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-DLtnsRSv.js";
3
3
  import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
4
4
  import { ListPlugin } from "@lexical/react/LexicalListPlugin";
@@ -6,7 +6,7 @@ import { AutoLinkNode, LinkNode } from "@lexical/link";
6
6
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
7
7
  import { createContext, createElement, use, useCallback, useEffect, useMemo } from "react";
8
8
  import { HeadingNode, QuoteNode } from "@lexical/rich-text";
9
- import { $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, createEditor } from "lexical";
9
+ import { $createParagraphNode, $getEditor, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, createEditor } from "lexical";
10
10
  import { HorizontalRuleNode } from "@lexical/extension";
11
11
  import { CodeNode } from "@lexical/code-core";
12
12
  import { ListItemNode, ListNode } from "@lexical/list";
@@ -180,18 +180,27 @@ var NESTED_EDITOR_NODES = [
180
180
  KaTeXInlineNode,
181
181
  TagNode
182
182
  ];
183
- //#endregion
184
- //#region src/nodes/AlertQuoteEditNode.ts
185
- function createContentEditor() {
183
+ function $tryGetEditor() {
184
+ try {
185
+ return $getEditor();
186
+ } catch {
187
+ return null;
188
+ }
189
+ }
190
+ function createNestedEditor(fallbackNamespace) {
191
+ if ($tryGetEditor()) return createEditor();
186
192
  return createEditor({
187
- namespace: "AlertContent",
193
+ namespace: fallbackNamespace,
188
194
  nodes: NESTED_EDITOR_NODES,
189
195
  theme: editorTheme,
190
- onError: (error) => {
191
- console.error("[AlertContent]", error);
192
- }
196
+ onError: (error) => console.error(`[${fallbackNamespace}]`, error)
193
197
  });
194
198
  }
199
+ //#endregion
200
+ //#region src/nodes/AlertQuoteEditNode.ts
201
+ function createContentEditor() {
202
+ return createNestedEditor("AlertContent");
203
+ }
195
204
  var AlertQuoteEditNode = class AlertQuoteEditNode extends AlertQuoteNode {
196
205
  static clone(node) {
197
206
  const cloned = new AlertQuoteEditNode(node.__alertType, node.__contentState, node.__key);
@@ -292,4 +301,4 @@ function $createAlertQuoteEditNode(alertType, contentState) {
292
301
  return new AlertQuoteEditNode(alertType, contentState);
293
302
  }
294
303
  //#endregion
295
- export { NestedEditorPluginsProvider as a, NestedEditorCorePlugins as i, AlertQuoteEditNode as n, useNestedEditorPlugins as o, NESTED_EDITOR_NODES as r, $createAlertQuoteEditNode as t };
304
+ export { NestedEditorCorePlugins as a, createNestedEditor as i, AlertQuoteEditNode as n, NestedEditorPluginsProvider as o, NESTED_EDITOR_NODES as r, useNestedEditorPlugins as s, $createAlertQuoteEditNode as t };
@@ -1,5 +1,5 @@
1
- import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-BxnXR-HA.js";
2
- import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-Ci3XcsfX.js";
1
+ import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-C7HnCTta.js";
2
+ import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.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-CD8rAdly.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-BxnXR-HA.js";
1
+ import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-DPciIuyu.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-C7HnCTta.js";
3
3
  import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-DLtnsRSv.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-67th6WYZ.js";
6
- import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-Ci3XcsfX.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-DMoe8QNB.js";
6
+ import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.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";
@@ -1141,6 +1141,7 @@ function ImageUploadPlugin({ onUpload }) {
1141
1141
  const [editor] = useLexicalComposerContext();
1142
1142
  const uploadRef = useRef(onUpload);
1143
1143
  uploadRef.current = onUpload;
1144
+ const targetEditorRef = useRef(editor);
1144
1145
  const preprocessRef = useImagePreprocess()?.ref ?? null;
1145
1146
  const getPreprocess = useCallback(() => preprocessRef?.current ?? null, [preprocessRef]);
1146
1147
  const fileInputRef = useRef(null);
@@ -1172,14 +1173,14 @@ function ImageUploadPlugin({ onUpload }) {
1172
1173
  if (toastTimerRef.current) window.clearTimeout(toastTimerRef.current);
1173
1174
  toastTimerRef.current = window.setTimeout(setToast, 2200, null);
1174
1175
  }, []);
1175
- const insertByUpload = useCallback(async (file, options) => {
1176
+ const insertByUpload = useCallback(async (file, target, options) => {
1176
1177
  if (!isImageFile(file)) return false;
1177
1178
  const closeDialog = Boolean(options?.closeDialog);
1178
1179
  setPendingUploads((value) => value + 1);
1179
1180
  if (closeDialog) setDialogUploading(true);
1180
1181
  try {
1181
1182
  const [result, meta] = await Promise.all([uploadRef.current(file), computeImageMeta(file)]);
1182
- editor.update(() => {
1183
+ target.update(() => {
1183
1184
  const node = $createImageNode($withAdaptiveImageDisplayWidth({
1184
1185
  src: result.src,
1185
1186
  altText: result.altText ?? file.name,
@@ -1206,26 +1207,27 @@ function ImageUploadPlugin({ onUpload }) {
1206
1207
  setPendingUploads((value) => Math.max(value - 1, 0));
1207
1208
  setDialogUploading(false);
1208
1209
  }
1209
- }, [editor, pushToast]);
1210
- const handleFiles = useCallback((files, source) => {
1210
+ }, [pushToast]);
1211
+ const handleFiles = useCallback((files, source, target) => {
1211
1212
  const images = files.filter(isImageFile);
1212
1213
  if (images.length === 0) return false;
1213
1214
  (async () => {
1214
1215
  const targets = await resolvePreprocessTargets(images, source, getPreprocess());
1215
- for (const file of targets) insertByUpload(file);
1216
+ for (const file of targets) insertByUpload(file, target);
1216
1217
  })();
1217
1218
  return true;
1218
1219
  }, [insertByUpload, getPreprocess]);
1219
1220
  useEffect(() => {
1220
- const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files) => handleFiles(files, "drop"), COMMAND_PRIORITY_HIGH);
1221
- const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event) => {
1221
+ const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files, fromEditor) => handleFiles(files, "drop", fromEditor), COMMAND_PRIORITY_HIGH);
1222
+ const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event, fromEditor) => {
1222
1223
  const clipboardData = "clipboardData" in event ? event.clipboardData : null;
1223
1224
  if (!clipboardData) return false;
1224
1225
  const files = [...clipboardData.files];
1225
- if (files.some(isImageFile)) return handleFiles(files, "paste");
1226
+ if (files.some(isImageFile)) return handleFiles(files, "paste", fromEditor);
1226
1227
  return false;
1227
1228
  }, COMMAND_PRIORITY_HIGH);
1228
- const unregisterOpenDialog = editor.registerCommand(OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, () => {
1229
+ const unregisterOpenDialog = editor.registerCommand(OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, (_payload, fromEditor) => {
1230
+ targetEditorRef.current = fromEditor;
1229
1231
  setDialogOpen(true);
1230
1232
  return true;
1231
1233
  }, COMMAND_PRIORITY_EDITOR);
@@ -1283,10 +1285,10 @@ function ImageUploadPlugin({ onUpload }) {
1283
1285
  }, []);
1284
1286
  const handleDialogFile = useCallback(async (file) => {
1285
1287
  if (!file) return;
1286
- let target = file;
1287
- if (isImageFile(file)) [target] = await resolvePreprocessTargets([file], "dialog", getPreprocess());
1288
- if (!target) return;
1289
- await insertByUpload(target, { closeDialog: true });
1288
+ let uploadFile = file;
1289
+ if (isImageFile(file)) [uploadFile] = await resolvePreprocessTargets([file], "dialog", getPreprocess());
1290
+ if (!uploadFile) return;
1291
+ await insertByUpload(uploadFile, targetEditorRef.current, { closeDialog: true });
1290
1292
  }, [insertByUpload, getPreprocess]);
1291
1293
  const handleUrlPreview = useCallback(async () => {
1292
1294
  const nextUrl = urlInput.trim();
@@ -1311,7 +1313,7 @@ function ImageUploadPlugin({ onUpload }) {
1311
1313
  }, [urlInput]);
1312
1314
  const handleInsertByUrl = useCallback(() => {
1313
1315
  if (!urlPreview$1 || !isSafeImageUrl(urlPreview$1)) return;
1314
- editor.update(() => {
1316
+ targetEditorRef.current.update(() => {
1315
1317
  const node = $createImageNode($withAdaptiveImageDisplayWidth({
1316
1318
  src: urlPreview$1,
1317
1319
  altText: "",
@@ -1324,7 +1326,6 @@ function ImageUploadPlugin({ onUpload }) {
1324
1326
  setDialogOpen(false);
1325
1327
  resetUrlState();
1326
1328
  }, [
1327
- editor,
1328
1329
  pushToast,
1329
1330
  resetUrlState,
1330
1331
  urlMeta,
@@ -1349,6 +1350,7 @@ function ImageUploadPlugin({ onUpload }) {
1349
1350
  resetUrlState();
1350
1351
  setDialogUploading(false);
1351
1352
  setDialogDragActive(false);
1353
+ targetEditorRef.current = editor;
1352
1354
  }
1353
1355
  },
1354
1356
  children: /* @__PURE__ */ jsxs(DialogPopup, {
@@ -1,5 +1,5 @@
1
- import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-BxnXR-HA.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-H3B0DYXL.js";
1
+ import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-C7HnCTta.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-DinmlrKK.js";
3
3
  import { $createTextNode, $getSelection, $isRangeSelection } from "lexical";
4
4
  //#region src/utils/collect-command-items.ts
5
5
  function collectCommandItems(editor) {
@@ -1,4 +1,4 @@
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-BxnXR-HA.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-C7HnCTta.js";
2
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-DLtnsRSv.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";
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-BR2DC6hX.js";
2
- import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-CD8rAdly.js";
3
- import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-BxnXR-HA.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-CSGVA99C.js";
2
+ import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-DPciIuyu.js";
3
+ import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-C7HnCTta.js";
4
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-DLtnsRSv.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-67th6WYZ.js";
6
+ import { D as ColorSchemeProvider, O as useColorScheme } from "./config-DMoe8QNB.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-Ci3XcsfX.js";
8
+ import { o as NestedEditorPluginsProvider, s as useNestedEditorPlugins } from "./AlertQuoteEditNode-DQuC-CkB.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-H3B0DYXL.js";
11
+ import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-DinmlrKK.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,12 +1,12 @@
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-BxnXR-HA.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 } from "./theme-C7HnCTta.js";
2
2
  import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-DLtnsRSv.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-67th6WYZ.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-DMoe8QNB.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-Ci3XcsfX.js";
6
+ import { a as NestedEditorCorePlugins, i as createNestedEditor, n as AlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.js";
7
7
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
8
8
  import { createElement, useCallback, useEffect, useState } from "react";
9
- import { $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isDecoratorNode, $isElementNode, $isNodeSelection, $nodesOfType, $setSelection, createEditor } from "lexical";
9
+ import { $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isDecoratorNode, $isElementNode, $isNodeSelection, $nodesOfType, $setSelection } from "lexical";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { Flag, LayoutGrid, Minus, Plus } from "lucide-react";
12
12
  import { ContentEditable } from "@lexical/react/LexicalContentEditable";
@@ -66,14 +66,7 @@ function BannerEditDecorator({ nodeKey, bannerType, contentEditor }) {
66
66
  //#endregion
67
67
  //#region src/nodes/BannerEditNode.ts
68
68
  function createContentEditor() {
69
- return createEditor({
70
- namespace: "BannerContent",
71
- nodes: NESTED_EDITOR_NODES,
72
- theme: editorTheme,
73
- onError: (error) => {
74
- console.error("[BannerContent]", error);
75
- }
76
- });
69
+ return createNestedEditor("BannerContent");
77
70
  }
78
71
  var BannerEditNode = class BannerEditNode extends BannerNode {
79
72
  static clone(node) {
@@ -528,14 +521,7 @@ function GridEditDecorator({ nodeKey, autoFocusOnMount, cols: initialCols, gap,
528
521
  //#endregion
529
522
  //#region src/nodes/GridEditNode.ts
530
523
  function createCellEditor() {
531
- return createEditor({
532
- namespace: "GridCell",
533
- nodes: NESTED_EDITOR_NODES,
534
- theme: editorTheme,
535
- onError: (error) => {
536
- console.error("[GridCell]", error);
537
- }
538
- });
524
+ return createNestedEditor("GridCell");
539
525
  }
540
526
  var GridEditNode = class GridEditNode extends GridContainerNode {
541
527
  static clone(node) {
@@ -680,6 +666,7 @@ _defineProperty(GridEditNode, "slashMenuItems", [{
680
666
  "columns",
681
667
  "layout"
682
668
  ],
669
+ nested: false,
683
670
  section: "LAYOUT",
684
671
  onSelect: (editor) => {
685
672
  editor.update(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"AlertQuoteEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/AlertQuoteEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAcjG,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,eAAe,EAAE,aAAa,CAAC;IAE/B,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CA2CtC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;gBAM9C,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,MAAM;IASpF,gBAAgB,IAAI,aAA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E;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,EACpB,YAAY,CAAC,EAAE,qBAAqB,GACnC,kBAAkB,CAEpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"BannerEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/BannerEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EAEf,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAkBtB,qBAAa,cAAe,SAAQ,UAAU;IAC5C,eAAe,EAAE,aAAa,CAAC;IAE/B,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAetC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;gBAMtC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,MAAM;IAStF,gBAAgB,IAAI,aAAa;IAIjC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,cAAc;IA0BjB,UAAU,IAAI,oBAAoB;IAUlC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,YAAY,CAAC,EAAE,qBAAqB,GACnC,cAAc,CAEhB"}
1
+ {"version":3,"file":"BannerEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/BannerEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EAEf,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAWtB,qBAAa,cAAe,SAAQ,UAAU;IAC5C,eAAe,EAAE,aAAa,CAAC;IAE/B,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAetC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;gBAMtC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,MAAM;IAStF,gBAAgB,IAAI,aAAa;IAIjC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,cAAc;IA0BjB,UAAU,IAAI,oBAAoB;IAUlC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,YAAY,CAAC,EAAE,qBAAqB,GACnC,cAAc,CAEhB"}
@@ -10,6 +10,7 @@ export declare class CodeBlockEditNode extends CodeBlockNode {
10
10
  isActive?: (editor: LexicalEditor) => boolean;
11
11
  isDisabled?: (editor: LexicalEditor) => boolean;
12
12
  keywords?: string[];
13
+ nested?: boolean;
13
14
  placement?: import('../commands-entry').CommandPlacement[];
14
15
  section?: string;
15
16
  shortcut?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/CodeBlockEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EA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AAyB,IAAI,OAAO;IAIpC,yBAAyB,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI;IAK1D,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAkC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IA8B7B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAiBhC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,YAAY;IA8Bf,UAAU,IAAI,2BAA2B;IAWzC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAStE;AAED,wBAAgB,mBAAmB,CACjC,IAAI,SAAI,EACR,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAEd;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,YAAY,CAE1F"}
@@ -1,3 +1,4 @@
1
- import { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical';
1
+ import { Klass, LexicalEditor, LexicalNode, LexicalNodeReplacement } from 'lexical';
2
2
  export declare const NESTED_EDITOR_NODES: Array<Klass<LexicalNode> | LexicalNodeReplacement>;
3
+ export declare function createNestedEditor(fallbackNamespace: string): LexicalEditor;
3
4
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/nodes/shared.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAS1E,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAmBlF,CAAC"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/nodes/shared.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAWzF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAmBlF,CAAC;AAUF,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAS3E"}
@@ -1,5 +1,5 @@
1
- import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-CD8rAdly.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-BxnXR-HA.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-67th6WYZ.js";
4
- import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-Ci3XcsfX.js";
1
+ import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-DPciIuyu.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-C7HnCTta.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-DMoe8QNB.js";
4
+ import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-DQuC-CkB.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 +1 @@
1
- {"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"AA2BA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AA0CvE,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAK/E;AAED,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,+BAocrE"}
1
+ {"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"AA4BA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AA0CvE,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAK/E;AAED,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,+BAucrE"}
@@ -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-BR2DC6hX.js";
2
- import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-H3B0DYXL.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-CSGVA99C.js";
2
+ import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-DinmlrKK.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,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-BxnXR-HA.js";
1
+ import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, R as extractTextContent, V as useNestedContentRenderer, a as getTagBgColor, t as editorTheme } from "./theme-C7HnCTta.js";
2
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-DLtnsRSv.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-67th6WYZ.js";
4
+ import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-DMoe8QNB.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";
@@ -359,8 +359,11 @@ function $isSelectionInTableCell() {
359
359
  const anchorNode = $getSelectionAnchorNode();
360
360
  return anchorNode ? $getTableCellNodeFromLexicalNode(anchorNode) !== null : false;
361
361
  }
362
+ function $isInNestedEditor() {
363
+ return $getEditor()._parentEditor !== null;
364
+ }
362
365
  function $withAdaptiveImageDisplayWidth(payload) {
363
- if (payload.displayWidth !== void 0 || !$isSelectionInTableCell()) return payload;
366
+ if (payload.displayWidth !== void 0 || !$isSelectionInTableCell() && !$isInNestedEditor()) return payload;
364
367
  return {
365
368
  ...payload,
366
369
  displayWidth: 100
@@ -9,6 +9,7 @@ export interface CommandItemConfig {
9
9
  isActive?: (editor: LexicalEditor) => boolean;
10
10
  isDisabled?: (editor: LexicalEditor) => boolean;
11
11
  keywords?: string[];
12
+ nested?: boolean;
12
13
  onSelect: (editor: LexicalEditor, queryString: string) => void;
13
14
  placement?: CommandPlacement[];
14
15
  section?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"slash-menu.d.ts","sourceRoot":"","sources":["../../src/types/slash-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpG,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;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OAAO,CAAC;IAEjB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { ImageNodePayload } from '../nodes/ImageNode';
2
2
  export declare function $isSelectionInTableCell(): boolean;
3
+ export declare function $isInNestedEditor(): boolean;
3
4
  export declare function $withAdaptiveImageDisplayWidth(payload: ImageNodePayload): ImageNodePayload;
4
5
  //# sourceMappingURL=image-insertion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-insertion.d.ts","sourceRoot":"","sources":["../../src/utils/image-insertion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAgB3D,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAS1F"}
1
+ {"version":3,"file":"image-insertion.d.ts","sourceRoot":"","sources":["../../src/utils/image-insertion.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAgB3D,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAS1F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Core rich text editor based on Lexical",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,9 +48,9 @@
48
48
  "@lexical/code-core": "^0.49.0",
49
49
  "nanoid": "^6.0.0",
50
50
  "thumbhash": "^0.1.1",
51
- "@haklex/rich-editor-ui": "0.33.0",
52
- "@haklex/rich-headless": "0.33.0",
53
- "@haklex/rich-style-token": "0.33.0"
51
+ "@haklex/rich-editor-ui": "0.34.0",
52
+ "@haklex/rich-headless": "0.34.0",
53
+ "@haklex/rich-style-token": "0.34.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@lexical/extension": "^0.49.0",