@haklex/rich-editor 0.51.1 → 0.53.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.
- package/dist/{SubmitShortcutPlugin-BbQBy2MJ.js → SubmitShortcutPlugin-DwZzJlZ0.js} +2 -2
- package/dist/components/renderers/CodeBlockRenderer.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{node-registry-BSEUpIjy.js → node-registry-B2ZLKN5B.js} +4 -21
- package/dist/nodes-entry.mjs +1 -1
- package/dist/plugins-entry.mjs +1 -1
- package/package.json +5 -10
- package/dist/utils/shiki.d.ts +0 -6
- package/dist/utils/shiki.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-
|
|
1
|
+
import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-B2ZLKN5B.js";
|
|
2
2
|
import "./utils-CdxPji5z.js";
|
|
3
3
|
import { $ as INLINE_DRAG_MIME, B as FootnoteNode, C as KaTeXBlockNode, G as AlertQuoteNode, O as $withAdaptiveImageDisplayWidth, Q as INLINE_DRAG_ATTR, V as OPEN_FILE_PICKER_COMMAND, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, k as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as $createSpoilerNode, q as extractTextContent, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode, z as $createFootnoteNode } from "./theme-Blq1EG_t.js";
|
|
4
4
|
import { i as FootnoteDefinitionsProvider, t as computeImageMeta } from "./thumbhash-DHHqtr0c.js";
|
|
@@ -22,9 +22,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
import { $convertFromMarkdownString, CHECK_LIST, CODE, QUOTE, TRANSFORMERS } from "@lexical/markdown";
|
|
23
23
|
import { $createTableCellNode, $createTableNode, $createTableRowNode, TableCellHeaderStates } from "@lexical/table";
|
|
24
24
|
import { Check, Info, Link2, Upload } from "lucide-react";
|
|
25
|
+
import { ActionBar, ActionButton, Dialog, DialogPopup, DialogTitle, SegmentedControl } from "@haklex/rich-editor-ui";
|
|
25
26
|
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
26
27
|
import { nanoid } from "nanoid";
|
|
27
|
-
import { ActionBar, ActionButton, Dialog, DialogPopup, DialogTitle, SegmentedControl } from "@haklex/rich-editor-ui";
|
|
28
28
|
//#region src/plugins/AutoLinkPlugin.tsx
|
|
29
29
|
var DEFAULT_MATCHERS = [createLinkMatcherWithRegExp(/https?:\/\/(?:www\.)?[\w#%+.:=@~-]{1,256}\.[A-Za-z]{2}[\w#%&()+./:=?@~-]*/), createLinkMatcherWithRegExp(/(?:[\w%+.-]+@[\d.a-z-]+\.[a-z]{2,})/i, (text) => `mailto:${text}`)];
|
|
30
30
|
function AutoLinkPlugin({ matchers }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/CodeBlockRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeBlockRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/renderers/CodeBlockRenderer.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,KAAK,IAAI,CAAC;IACtD,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,QAAQ,EACR,eAAe,EAAE,mBAAmB,GACrC,EAAE,sBAAsB,+BA6FxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { CorePlugins } from './components/CorePlugins';
|
|
2
|
+
export { NestedEditorCorePlugins } from './components/decorators/NestedEditorCorePlugins';
|
|
2
3
|
export type { LinkFaviconProps } from './components/LinkFavicon';
|
|
3
4
|
export { LinkFavicon } from './components/LinkFavicon';
|
|
4
5
|
export { RichEditor } from './components/RichEditor';
|
|
@@ -18,6 +19,7 @@ export type { RendererMode } from './context/RendererConfigContext';
|
|
|
18
19
|
export { RendererConfigProvider, useRendererConfig, useRendererMode, useVariant, } from './context/RendererConfigContext';
|
|
19
20
|
export type { TextSelectionStore, TextSelectionStoreState } from './context/TextSelectionContext';
|
|
20
21
|
export { createTextSelectionStore, TextSelectionStoreProvider, useTextSelectionSnapshot, useTextSelectionStore, } from './context/TextSelectionContext';
|
|
22
|
+
export { createNestedEditor, NESTED_EDITOR_NODES } from './nodes/shared';
|
|
21
23
|
export { blockIdState } from './plugins/BlockIdPlugin';
|
|
22
24
|
export * from './styles';
|
|
23
25
|
export type { RichEditorProps, RichEditorVariant } from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,M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L,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,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,11 +1,11 @@
|
|
|
1
|
-
import { A as FileUploadPlugin, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as VideoUploadProvider, L as ImageUploadProvider, N as BlockIdPlugin, O as defaultImageUpload, P as blockIdState, S as TextSelectionStoreProvider, T as useTextSelectionStore, U as CorePlugins, V as FileUploadProvider, _ 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, 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, z as ImagePreprocessProvider } from "./SubmitShortcutPlugin-
|
|
2
|
-
import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-
|
|
1
|
+
import { A as FileUploadPlugin, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as VideoUploadProvider, L as ImageUploadProvider, N as BlockIdPlugin, O as defaultImageUpload, P as blockIdState, S as TextSelectionStoreProvider, T as useTextSelectionStore, U as CorePlugins, V as FileUploadProvider, _ 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, 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, z as ImagePreprocessProvider } from "./SubmitShortcutPlugin-DwZzJlZ0.js";
|
|
2
|
+
import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-B2ZLKN5B.js";
|
|
3
3
|
import { a as chatVariant, c as semanticClassNames, i as commentVariant, l as sharedStyles, n as getVariantClass, o as articleVariant, r as noteVariant, s as richContent, t as clsx } from "./utils-CdxPji5z.js";
|
|
4
4
|
import { X as useNestedContentRenderer, Y as NestedContentRendererProvider, Z as useOptionalNestedContentRenderer, t as editorTheme } from "./theme-Blq1EG_t.js";
|
|
5
5
|
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 FILE_NODE_KEY, a as useFootnoteContent, b as IMAGE_NODE_KEY, d as useRendererConfig, f as useRendererMode, g as CODE_BLOCK_NODE_KEY, h as BANNER_NODE_KEY, i as FootnoteDefinitionsProvider, m as ALERT_NODE_KEY, o as useFootnoteDefinitions, p as useVariant, s as useFootnoteDisplayNumber, u as RendererConfigProvider, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./thumbhash-DHHqtr0c.js";
|
|
6
6
|
import { n as useColorScheme, t as ColorSchemeProvider } from "./ColorSchemeContext-RLg0uDRt.js";
|
|
7
7
|
import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-CUb_icKZ.js";
|
|
8
|
-
import { c as useNestedEditorPlugins, s as NestedEditorPluginsProvider } from "./AlertQuoteEditNode-DuAjHXTP.js";
|
|
8
|
+
import { a as NestedEditorCorePlugins, c as useNestedEditorPlugins, i as createNestedEditor, r as NESTED_EDITOR_NODES, s as NestedEditorPluginsProvider } from "./AlertQuoteEditNode-DuAjHXTP.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-DdU7MZwS.js";
|
|
11
11
|
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-By_8nKNX.js";
|
|
@@ -144,4 +144,4 @@ function RichEditor({ extraNodes, imageUpload, videoUpload, fileUpload, children
|
|
|
144
144
|
}) });
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
|
-
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, chatTheme, chatVariant, 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 };
|
|
147
|
+
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, NESTED_EDITOR_NODES, NestedContentRendererProvider, NestedEditorCorePlugins, NestedEditorPluginsProvider, RUBY_NODE_KEY, RendererConfigProvider, RichEditor, RichEditorShell, TAG_NODE_KEY, TEXT_SELECTION_HIGHLIGHT_NAME, TextSelectionStoreProvider, VIDEO_NODE_KEY, articleTheme, articleVariant, blockIdState, buildBlockAnchor, buildRangeAnchor, chatTheme, chatVariant, commentTheme, commentVariant, createDOMRangeFromTextSelection, createNestedEditor, 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 };
|
|
@@ -14,6 +14,7 @@ import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
|
14
14
|
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
15
15
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
16
16
|
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
17
|
+
import { highlightCode } from "@haklex/rich-editor-ui";
|
|
17
18
|
//#region src/utils/codeBlockSelectionIntent.ts
|
|
18
19
|
var codeBlockCursorIntentMap = /* @__PURE__ */ new Map();
|
|
19
20
|
function setCodeBlockCursorIntent(nodeKey, placement) {
|
|
@@ -143,36 +144,18 @@ function $createBannerEditNode(bannerType, contentState) {
|
|
|
143
144
|
return new BannerEditNode(bannerType, contentState);
|
|
144
145
|
}
|
|
145
146
|
//#endregion
|
|
146
|
-
//#region src/utils/shiki.ts
|
|
147
|
-
var codeToHtmlFn = null;
|
|
148
|
-
var shikiLoadPromise = null;
|
|
149
|
-
function loadCodeToHtml() {
|
|
150
|
-
if (codeToHtmlFn) return Promise.resolve(codeToHtmlFn);
|
|
151
|
-
if (!shikiLoadPromise) shikiLoadPromise = import("shiki/bundle/full").then((mod) => {
|
|
152
|
-
codeToHtmlFn = mod.codeToHtml;
|
|
153
|
-
return mod.codeToHtml;
|
|
154
|
-
}).catch((err) => {
|
|
155
|
-
shikiLoadPromise = null;
|
|
156
|
-
throw err;
|
|
157
|
-
});
|
|
158
|
-
return shikiLoadPromise;
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
147
|
//#region src/components/renderers/CodeBlockRenderer.tsx
|
|
162
148
|
function CodeBlockRenderer({ code, language, showLineNumbers: showLineNumbersProp }) {
|
|
163
149
|
const variant = useVariant();
|
|
164
150
|
const showLineNumbers = showLineNumbersProp ?? (variant !== "comment" && variant !== "chat");
|
|
165
|
-
const
|
|
151
|
+
const colorScheme = useColorScheme();
|
|
166
152
|
const [highlightedHtml, setHighlightedHtml] = useState(null);
|
|
167
153
|
const [copied, setCopied] = useState(false);
|
|
168
154
|
const copyTimerRef = useRef(void 0);
|
|
169
155
|
useEffect(() => {
|
|
170
156
|
let cancelled = false;
|
|
171
157
|
setHighlightedHtml(null);
|
|
172
|
-
|
|
173
|
-
lang: language,
|
|
174
|
-
theme: shikiTheme
|
|
175
|
-
})).then((html) => {
|
|
158
|
+
highlightCode(code, language, colorScheme === "dark" ? "dark" : "light").then((html) => {
|
|
176
159
|
if (!cancelled) setHighlightedHtml(html);
|
|
177
160
|
}).catch(() => {
|
|
178
161
|
if (!cancelled) setHighlightedHtml(null);
|
|
@@ -183,7 +166,7 @@ function CodeBlockRenderer({ code, language, showLineNumbers: showLineNumbersPro
|
|
|
183
166
|
}, [
|
|
184
167
|
code,
|
|
185
168
|
language,
|
|
186
|
-
|
|
169
|
+
colorScheme
|
|
187
170
|
]);
|
|
188
171
|
useEffect(() => {
|
|
189
172
|
return () => clearTimeout(copyTimerRef.current);
|
package/dist/nodes-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-
|
|
1
|
+
import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-B2ZLKN5B.js";
|
|
2
2
|
import { A as computeImageDisplayPixels, C as KaTeXBlockNode, D as sanitizeImageLayout, E as ImageNode, F as imageDisplaySizeAfterResize, I as resolveImageDisplaySize, L as sanitizeImageDisplayWidth, M as imageDisplayCssVars, N as imageDisplayDataAttr, P as imageDisplayFieldsFromSize, R as sanitizeImageFixedPx, S as $isKaTeXBlockNode, T as $isImageNode, U as ALERT_LABELS, W as ALERT_TYPES, _ as MentionNode, b as KaTeXInlineNode, d as RichQuoteNode, f as $createMermaidNode, g as $isMentionNode, h as $createMentionNode, i as TagNode, j as convertImageDisplaySize, 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-Blq1EG_t.js";
|
|
3
3
|
import { C as fileExtFromName, E as $createCommentNode, N as BANNER_LABELS, O as $isCommentNode, P as BANNER_TYPES, S as FileNode, _ as $createFootnoteSectionNode, a as customNodes, b as $createFileNode, c as $createRubyNode, d as $createLinkCardNode, f as $isLinkCardNode, g as GridContainerNode, h as $isGridContainerNode, i as builtinNodes, k as CommentNode, l as $isRubyNode, m as $createGridContainerNode, p as LinkCardNode, r as allNodes, u as RubyNode, v as $isFootnoteSectionNode, x as $isFileNode, y as FootnoteSectionNode } from "./ColorSchemeContext-RLg0uDRt.js";
|
|
4
4
|
import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-DuAjHXTP.js";
|
package/dist/plugins-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as FileUploadPlugin, B as useImagePreprocess, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as VideoUploadProvider, G as MarkdownPastePlugin, H as useFileUpload, I as useVideoUpload, J as HorizontalRulePlugin, K as ALL_TRANSFORMERS, L as ImageUploadProvider, M as useFileUploadEntry, N as BlockIdPlugin, O as defaultImageUpload, P as blockIdState, Q as AutoLinkPlugin, R as useImageUpload, U as CorePlugins, V as FileUploadProvider, W as MarkdownShortcutsPlugin, X as registerClickBelowCommand, Y as ClickBelowPlugin, Z as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as setFileUploadEntry, k as resolvePreprocessTargets, n as OnChangePlugin, o as VideoUploadPlugin, q as InlineDndPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as ImagePreprocessProvider } from "./SubmitShortcutPlugin-
|
|
1
|
+
import { A as FileUploadPlugin, B as useImagePreprocess, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as VideoUploadProvider, G as MarkdownPastePlugin, H as useFileUpload, I as useVideoUpload, J as HorizontalRulePlugin, K as ALL_TRANSFORMERS, L as ImageUploadProvider, M as useFileUploadEntry, N as BlockIdPlugin, O as defaultImageUpload, P as blockIdState, Q as AutoLinkPlugin, R as useImageUpload, U as CorePlugins, V as FileUploadProvider, W as MarkdownShortcutsPlugin, X as registerClickBelowCommand, Y as ClickBelowPlugin, Z as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as setFileUploadEntry, k as resolvePreprocessTargets, n as OnChangePlugin, o as VideoUploadPlugin, q as InlineDndPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as ImagePreprocessProvider } from "./SubmitShortcutPlugin-DwZzJlZ0.js";
|
|
2
2
|
import { Q as INLINE_DRAG_ATTR, et as markInlineDraggable } from "./theme-Blq1EG_t.js";
|
|
3
3
|
import { o as PasteLinkPlugin } from "./AlertQuoteEditNode-DuAjHXTP.js";
|
|
4
4
|
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-By_8nKNX.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.1",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@haklex/rich-editor-ui": "0.
|
|
49
|
-
"@haklex/rich-headless": "0.
|
|
50
|
-
"@haklex/rich-style-token": "0.
|
|
48
|
+
"@haklex/rich-editor-ui": "0.53.1",
|
|
49
|
+
"@haklex/rich-headless": "0.53.1",
|
|
50
|
+
"@haklex/rich-style-token": "0.53.1",
|
|
51
51
|
"@lexical/code-core": "^0.52.0",
|
|
52
52
|
"nanoid": "^6.0.2",
|
|
53
53
|
"thumbhash": "^0.1.1"
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"lucide-react": "^1.59.0",
|
|
70
70
|
"react": "^19.3.1",
|
|
71
71
|
"react-dom": "^19.3.1",
|
|
72
|
-
"shiki": "^4.5.0",
|
|
73
72
|
"typescript": "^7.0.2",
|
|
74
73
|
"unplugin-dts": "^1.1.2",
|
|
75
74
|
"vite": "^8.3.4"
|
|
@@ -87,15 +86,11 @@
|
|
|
87
86
|
"lexical": "^0.52.0",
|
|
88
87
|
"lucide-react": "^1.0.0",
|
|
89
88
|
"react": ">=19",
|
|
90
|
-
"react-dom": ">=19"
|
|
91
|
-
"shiki": ">=4.0.0"
|
|
89
|
+
"react-dom": ">=19"
|
|
92
90
|
},
|
|
93
91
|
"peerDependenciesMeta": {
|
|
94
92
|
"katex": {
|
|
95
93
|
"optional": true
|
|
96
|
-
},
|
|
97
|
-
"shiki": {
|
|
98
|
-
"optional": true
|
|
99
94
|
}
|
|
100
95
|
},
|
|
101
96
|
"publishConfig": {
|
package/dist/utils/shiki.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shiki.d.ts","sourceRoot":"","sources":["../../src/utils/shiki.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KACrC,OAAO,CAAC,MAAM,CAAC,CAAC;AAKrB,wBAAgB,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC,CActD"}
|