@haklex/rich-editor 0.37.0 → 0.39.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.
@@ -14,7 +14,7 @@ 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
20
  import { createPortal } from "react-dom";
@@ -40,6 +40,7 @@ function AutoLinkPlugin({ matchers }) {
40
40
  }
41
41
  //#endregion
42
42
  //#region src/plugins/BlockExitPlugin.tsx
43
+ var INLINE_CODE_EXIT_CARET = "​";
43
44
  function selectDecoratorNode(node, cursorPlacement = "start") {
44
45
  if (node.getType() === "code-block") setCodeBlockCursorIntent(node.getKey(), cursorPlacement);
45
46
  const selection = $createNodeSelection();
@@ -69,15 +70,6 @@ function isAtTopLevelBoundary(selection, direction) {
69
70
  function isSingleLineParagraph(node) {
70
71
  return $isParagraphNode(node) && !node.getTextContent().includes("\n");
71
72
  }
72
- function getOutermostNodeWithinTopLevel(node, topLevel) {
73
- let current = node;
74
- while (current.getParent() !== topLevel) {
75
- const parent = current.getParent();
76
- if (!parent) break;
77
- current = parent;
78
- }
79
- return current;
80
- }
81
73
  function isDeeplyEmptyElement(node) {
82
74
  if (!$isElementNode(node)) return false;
83
75
  if (node.getChildrenSize() === 0) return true;
@@ -94,18 +86,14 @@ function isSelectionInsideTopLevel(selection, topLevelKey) {
94
86
  return selection.anchor.getNode().getTopLevelElementOrThrow().getKey() === topLevelKey && selection.focus.getNode().getTopLevelElementOrThrow().getKey() === topLevelKey;
95
87
  }
96
88
  function exitInlineCodeAtLineEnd(selection) {
97
- if (!selection.isCollapsed() || selection.anchor.type !== "text") return false;
89
+ if (!selection.isCollapsed() || selection.anchor.type !== "text") return null;
98
90
  const anchorNode = selection.anchor.getNode();
99
- if (!$isTextNode(anchorNode) || !anchorNode.hasFormat("code")) return false;
100
- if (selection.anchor.offset !== anchorNode.getTextContentSize()) return false;
101
- if (!isAtTopLevelBoundary(selection, "end")) return false;
102
- const topLevel = anchorNode.getTopLevelElementOrThrow();
103
- const exitOffset = getOutermostNodeWithinTopLevel(anchorNode, topLevel).getIndexWithinParent() + 1;
104
- selection.anchor.set(topLevel.getKey(), exitOffset, "element");
105
- 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;
106
94
  selection.setFormat(anchorNode.getFormat() & ~IS_CODE);
107
95
  selection.setStyle(anchorNode.getStyle());
108
- return true;
96
+ return anchorNode;
109
97
  }
110
98
  function BlockExitPlugin() {
111
99
  const [editor] = useLexicalComposerContext();
@@ -116,6 +104,8 @@ function BlockExitPlugin() {
116
104
  }
117
105
  function registerBlockExitCommands(editor) {
118
106
  let virtualParagraphKey = null;
107
+ let inlineCodeExitCaretKey = null;
108
+ let inlineCodeExitCaretStyle = "";
119
109
  const clearVirtualParagraph = () => {
120
110
  virtualParagraphKey = null;
121
111
  };
@@ -124,6 +114,24 @@ function registerBlockExitCommands(editor) {
124
114
  const node = $getNodeByKey(virtualParagraphKey);
125
115
  return $isParagraphNode(node) ? node : null;
126
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
+ };
127
135
  const insertVirtualParagraph = (target, position, cursorPlacement = "start") => {
128
136
  const paragraph = $createParagraphNode();
129
137
  if (position === "before") target.insertBefore(paragraph);
@@ -154,13 +162,46 @@ function registerBlockExitCommands(editor) {
154
162
  clearVirtualParagraph();
155
163
  });
156
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);
157
185
  const unregisterArrowRight = editor.registerCommand(KEY_ARROW_RIGHT_COMMAND, (event) => {
158
186
  const selection = $getSelection();
159
187
  if (!$isRangeSelection(selection)) return false;
160
- 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);
161
197
  event?.preventDefault();
162
198
  return true;
163
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);
164
205
  const unregisterArrowDown = editor.registerCommand(KEY_ARROW_DOWN_COMMAND, (event) => {
165
206
  const selection = $getSelection();
166
207
  if (!$isRangeSelection(selection) || !selection.isCollapsed()) return false;
@@ -334,7 +375,12 @@ function registerBlockExitCommands(editor) {
334
375
  }, COMMAND_PRIORITY_CRITICAL);
335
376
  return () => {
336
377
  unregisterVirtualParagraphCleanup();
378
+ unregisterInlineCodeExitCaretCleanup();
379
+ unregisterInlineCodeExitCaretTransform();
380
+ unregisterInlineCodeExitCaretBlur();
381
+ editor.update($releaseInlineCodeExitCaret);
337
382
  unregisterArrowRight();
383
+ unregisterInlineCodeSpace();
338
384
  unregisterArrowDown();
339
385
  unregisterEnter();
340
386
  unregisterBackspace();
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export { blockIdState } from './plugins/BlockIdPlugin';
22
22
  export * from './styles';
23
23
  export type { RichEditorProps, RichEditorVariant } from './types';
24
24
  export type { RendererConfig } from './types/renderer-config';
25
- export { ALERT_NODE_KEY, BANNER_NODE_KEY, CODE_BLOCK_NODE_KEY, FOOTNOTE_NODE_KEY, FOOTNOTE_SECTION_NODE_KEY, IMAGE_NODE_KEY, KATEX_NODE_KEY, LINK_CARD_NODE_KEY, MENTION_NODE_KEY, MERMAID_NODE_KEY, RUBY_NODE_KEY, TAG_NODE_KEY, VIDEO_NODE_KEY, } from './types/renderer-keys';
25
+ export { ALERT_NODE_KEY, BANNER_NODE_KEY, CODE_BLOCK_NODE_KEY, FILE_NODE_KEY, FOOTNOTE_NODE_KEY, FOOTNOTE_SECTION_NODE_KEY, IMAGE_NODE_KEY, KATEX_NODE_KEY, LINK_CARD_NODE_KEY, MENTION_NODE_KEY, MERMAID_NODE_KEY, RUBY_NODE_KEY, TAG_NODE_KEY, VIDEO_NODE_KEY, } from './types/renderer-keys';
26
26
  export type { AnchorError, AnchorResult, BlockAnchor, CommentAnchor, RangeAnchor, } from './utils/comment-anchor';
27
27
  export { $getRootBlock, $getTextOffsetInBlock, $resolveSelectionPoint, buildBlockAnchor, buildRangeAnchor, } from './utils/comment-anchor';
28
28
  export type { DOMSelectionTarget, TextSelectionSnapshot } from './utils/text-selection';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index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B,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EACL,qBAAqB,EACrB,uCAAuC,EACvC,qBAAqB,EACrB,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { B as FileUploadProvider, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, H as CorePlugins, I as ImageUploadProvider, M as BlockIdPlugin, N as blockIdState, O as defaultImageUpload, P as VideoUploadProvider, R as ImagePreprocessProvider, 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, k as FileUploadPlugin, 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-DuKGB15Q.js";
1
+ import { B as FileUploadProvider, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, H as CorePlugins, I as ImageUploadProvider, M as BlockIdPlugin, N as blockIdState, O as defaultImageUpload, P as VideoUploadProvider, R as ImagePreprocessProvider, 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, k as FileUploadPlugin, 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-OoPWBtTU.js";
2
2
  import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-BFDycNE-.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
4
  import { X as useNestedContentRenderer, Y as NestedContentRendererProvider, Z as useOptionalNestedContentRenderer, t as editorTheme } from "./theme-Vu_9D3oG.js";
5
- import { C as LINK_CARD_NODE_KEY, D as TAG_NODE_KEY, E as RUBY_NODE_KEY, O as VIDEO_NODE_KEY, S as KATEX_NODE_KEY, T as MERMAID_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as FOOTNOTE_SECTION_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, w as MENTION_NODE_KEY, x as IMAGE_NODE_KEY, y as FOOTNOTE_NODE_KEY } from "./KaTeXRenderer-DvxFML1l.js";
5
+ import { C as LINK_CARD_NODE_KEY, D as TAG_NODE_KEY, E as RUBY_NODE_KEY, O as VIDEO_NODE_KEY, S as KATEX_NODE_KEY, T as MERMAID_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as FOOTNOTE_SECTION_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 FILE_NODE_KEY, w as MENTION_NODE_KEY, x as IMAGE_NODE_KEY, y as FOOTNOTE_NODE_KEY } from "./KaTeXRenderer-DvxFML1l.js";
6
6
  import { M as useColorScheme, j as ColorSchemeProvider } from "./config-D8JJ7F11.js";
7
7
  import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
8
8
  import { c as useNestedEditorPlugins, s as NestedEditorPluginsProvider } from "./AlertQuoteEditNode-DUvNEyjw.js";
@@ -143,4 +143,4 @@ function RichEditor({ extraNodes, imageUpload, videoUpload, fileUpload, children
143
143
  }) });
144
144
  }
145
145
  //#endregion
146
- export { $captureTextSelection, $captureTextSelectionFromRangeSelection, $getRootBlock, $getTextOffsetInBlock, $resolveSelectionPoint, $restoreTextSelection, ALERT_NODE_KEY, BANNER_NODE_KEY, CODE_BLOCK_NODE_KEY, ColorSchemeProvider, CorePlugins, ExtraNodesProvider, FOOTNOTE_NODE_KEY, FOOTNOTE_SECTION_NODE_KEY, FootnoteDefinitionsProvider, IMAGE_NODE_KEY, KATEX_NODE_KEY, LINK_CARD_NODE_KEY, LinkFavicon, MENTION_NODE_KEY, MERMAID_NODE_KEY, NestedContentRendererProvider, NestedEditorPluginsProvider, RUBY_NODE_KEY, RendererConfigProvider, RichEditor, RichEditorShell, TAG_NODE_KEY, TEXT_SELECTION_HIGHLIGHT_NAME, TextSelectionStoreProvider, VIDEO_NODE_KEY, articleTheme, articleVariant, blockIdState, buildBlockAnchor, buildRangeAnchor, commentTheme, commentVariant, createDOMRangeFromTextSelection, createTextSelectionStore, detailsClassNames, detailsStyles, editorTheme, findDOMPointByTextOffset, getBlockElementById, getDOMRectFromTextSelection, getTextOffsetFromDOMPoint, getVariantClass, gridClassNames, gridStyles, katexClassNames, katexStyles, noteTheme, noteVariant, richContent, semanticClassNames, sharedStyles, useColorScheme, useExtraNodes, useFootnoteContent, useFootnoteDefinitions, useFootnoteDisplayNumber, useNestedContentRenderer, useNestedEditorPlugins, useOptionalNestedContentRenderer, useRendererConfig, useRendererMode, useTextSelectionSnapshot, useTextSelectionStore, useVariant, vars };
146
+ export { $captureTextSelection, $captureTextSelectionFromRangeSelection, $getRootBlock, $getTextOffsetInBlock, $resolveSelectionPoint, $restoreTextSelection, ALERT_NODE_KEY, BANNER_NODE_KEY, CODE_BLOCK_NODE_KEY, ColorSchemeProvider, CorePlugins, ExtraNodesProvider, FILE_NODE_KEY, FOOTNOTE_NODE_KEY, FOOTNOTE_SECTION_NODE_KEY, FootnoteDefinitionsProvider, IMAGE_NODE_KEY, KATEX_NODE_KEY, LINK_CARD_NODE_KEY, LinkFavicon, MENTION_NODE_KEY, MERMAID_NODE_KEY, NestedContentRendererProvider, NestedEditorPluginsProvider, RUBY_NODE_KEY, RendererConfigProvider, RichEditor, RichEditorShell, TAG_NODE_KEY, TEXT_SELECTION_HIGHLIGHT_NAME, TextSelectionStoreProvider, VIDEO_NODE_KEY, articleTheme, articleVariant, blockIdState, buildBlockAnchor, buildRangeAnchor, commentTheme, commentVariant, createDOMRangeFromTextSelection, createTextSelectionStore, detailsClassNames, detailsStyles, editorTheme, findDOMPointByTextOffset, getBlockElementById, getDOMRectFromTextSelection, getTextOffsetFromDOMPoint, getVariantClass, gridClassNames, gridStyles, katexClassNames, katexStyles, noteTheme, noteVariant, richContent, semanticClassNames, sharedStyles, useColorScheme, useExtraNodes, useFootnoteContent, useFootnoteDefinitions, useFootnoteDisplayNumber, useNestedContentRenderer, useNestedEditorPlugins, useOptionalNestedContentRenderer, useRendererConfig, useRendererMode, useTextSelectionSnapshot, useTextSelectionStore, useVariant, vars };
@@ -1 +1 @@
1
- {"version":3,"file":"BlockExitPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/BlockExitPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EAuBL,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAqHjB,wBAAgB,eAAe,SAQ9B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,cA2X9D"}
1
+ {"version":3,"file":"BlockExitPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/BlockExitPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EA4BL,KAAK,aAAa,EAMnB,MAAM,SAAS,CAAC;AAsGjB,wBAAgB,eAAe,SAQ9B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,cA+d9D"}
@@ -1,4 +1,4 @@
1
- import { A as setFileUploadEntry, B as FileUploadProvider, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as useVideoUpload, G as ALL_TRANSFORMERS, H as CorePlugins, I as ImageUploadProvider, J as ClickBelowPlugin, K as InlineDndPlugin, L as useImageUpload, M as BlockIdPlugin, N as blockIdState, O as defaultImageUpload, P as VideoUploadProvider, R as ImagePreprocessProvider, U as MarkdownShortcutsPlugin, V as useFileUpload, W as MarkdownPastePlugin, X as BlockExitPlugin, Y as registerClickBelowCommand, Z as AutoLinkPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as useFileUploadEntry, k as FileUploadPlugin, n as OnChangePlugin, o as VideoUploadPlugin, q as HorizontalRulePlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as useImagePreprocess } from "./SubmitShortcutPlugin-DuKGB15Q.js";
1
+ import { A as setFileUploadEntry, B as FileUploadProvider, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as useVideoUpload, G as ALL_TRANSFORMERS, H as CorePlugins, I as ImageUploadProvider, J as ClickBelowPlugin, K as InlineDndPlugin, L as useImageUpload, M as BlockIdPlugin, N as blockIdState, O as defaultImageUpload, P as VideoUploadProvider, R as ImagePreprocessProvider, U as MarkdownShortcutsPlugin, V as useFileUpload, W as MarkdownPastePlugin, X as BlockExitPlugin, Y as registerClickBelowCommand, Z as AutoLinkPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as useFileUploadEntry, k as FileUploadPlugin, n as OnChangePlugin, o as VideoUploadPlugin, q as HorizontalRulePlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as useImagePreprocess } from "./SubmitShortcutPlugin-OoPWBtTU.js";
2
2
  import { Q as INLINE_DRAG_ATTR, et as markInlineDraggable } from "./theme-Vu_9D3oG.js";
3
3
  import { o as PasteLinkPlugin } from "./AlertQuoteEditNode-DUvNEyjw.js";
4
4
  import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-DgIAgFH8.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.37.0",
3
+ "version": "0.39.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.1",
50
50
  "thumbhash": "^0.1.1",
51
- "@haklex/rich-editor-ui": "0.37.0",
52
- "@haklex/rich-style-token": "0.37.0",
53
- "@haklex/rich-headless": "0.37.0"
51
+ "@haklex/rich-editor-ui": "0.39.0",
52
+ "@haklex/rich-style-token": "0.39.0",
53
+ "@haklex/rich-headless": "0.39.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@lexical/extension": "^0.49.0",