@haklex/rich-editor 0.21.1 → 0.22.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,8 +1,8 @@
1
- import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-C_EUwDDU.js";
1
+ import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-BmMoa_84.js";
2
2
  import { C as KaTeXBlockNode, D as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, F as extractTextContent, N as AlertQuoteNode, O as $createFootnoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, k as FootnoteNode, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-BGKUes-K.js";
3
3
  import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-CRL_A32i.js";
4
4
  import "./katex.css-0TJGE4On.js";
5
- import { S as CommentNode, _ as $createDetailsNode, a as $createRubyNode, b as $createCommentPlaceholderNode, f as $isGridContainerNode, g as FootnoteSectionNode, h as $isFootnoteSectionNode, j as BannerNode, m as $createFootnoteSectionNode, s as RubyNode, v as DetailsNode, w as CodeBlockNode, y as $createCommentNode } from "./config-wy9S6JPy.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-CplWQTph.js";
6
6
  import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-CaCADTx3.js";
7
7
  import { n as getHostname, r as probeFavicon, t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-C7VzxLf5.js";
8
8
  import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
@@ -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, 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, 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";
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 { $convertFromMarkdownString, CHECK_LIST, CODE, QUOTE, TRANSFORMERS } from "@lexical/markdown";
@@ -204,24 +204,30 @@ function registerBlockExitCommands(editor) {
204
204
  }
205
205
  return false;
206
206
  }, COMMAND_PRIORITY_CRITICAL);
207
- const unregisterCmdEnter = editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
208
- if (!event?.metaKey && !event?.ctrlKey) return false;
207
+ const unregisterEnter = editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
209
208
  const selection = $getSelection();
210
- if ($isNodeSelection(selection)) {
209
+ if ($isNodeSelection(selection) && !event?.shiftKey) {
211
210
  const nodes = selection.getNodes();
212
211
  if (nodes.length !== 1) return false;
213
212
  const node = nodes[0];
214
213
  if (!$isDecoratorNode(node)) return false;
215
- event.preventDefault();
216
- let next = node.getNextSibling();
217
- if (!next) {
218
- next = $createParagraphNode();
219
- node.insertAfter(next);
214
+ event?.preventDefault();
215
+ if (event?.metaKey || event?.ctrlKey) {
216
+ let next = node.getNextSibling();
217
+ if (!next) {
218
+ next = $createParagraphNode();
219
+ node.insertAfter(next);
220
+ }
221
+ if ($isElementNode(next)) next.selectStart();
222
+ else if ($isDecoratorNode(next)) selectDecoratorNode(next, "start");
223
+ return true;
220
224
  }
221
- if ($isElementNode(next)) next.selectStart();
222
- else if ($isDecoratorNode(next)) selectDecoratorNode(next, "start");
225
+ const paragraph = $createParagraphNode();
226
+ node.insertAfter(paragraph);
227
+ paragraph.selectStart();
223
228
  return true;
224
229
  }
230
+ if (!event?.metaKey && !event?.ctrlKey) return false;
225
231
  if (!$isRangeSelection(selection)) return false;
226
232
  const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow();
227
233
  if ($isParagraphNode(topLevelElement)) return false;
@@ -329,7 +335,7 @@ function registerBlockExitCommands(editor) {
329
335
  unregisterVirtualParagraphCleanup();
330
336
  unregisterArrowRight();
331
337
  unregisterArrowDown();
332
- unregisterCmdEnter();
338
+ unregisterEnter();
333
339
  unregisterBackspace();
334
340
  unregisterDelete();
335
341
  unregisterArrowUpDecorator();
@@ -338,6 +344,36 @@ function registerBlockExitCommands(editor) {
338
344
  };
339
345
  }
340
346
  //#endregion
347
+ //#region src/plugins/ClickBelowPlugin.tsx
348
+ function ClickBelowPlugin() {
349
+ const [editor] = useLexicalComposerContext();
350
+ useEffect(() => {
351
+ return registerClickBelowCommand(editor);
352
+ }, [editor]);
353
+ return null;
354
+ }
355
+ function registerClickBelowCommand(editor) {
356
+ return editor.registerCommand(CLICK_COMMAND, (event) => {
357
+ const rootElement = editor.getRootElement();
358
+ if (!rootElement || event.target !== rootElement) return false;
359
+ const root = $getRoot();
360
+ const last = root.getLastChild();
361
+ if (last === null) {
362
+ const paragraph = $createParagraphNode();
363
+ root.append(paragraph);
364
+ paragraph.selectStart();
365
+ return true;
366
+ }
367
+ if (!$isDecoratorNode(last)) return false;
368
+ const lastDom = editor.getElementByKey(last.getKey());
369
+ if (lastDom && event.clientY <= lastDom.getBoundingClientRect().bottom) return false;
370
+ const paragraph = $createParagraphNode();
371
+ last.insertAfter(paragraph);
372
+ paragraph.selectStart();
373
+ return true;
374
+ }, COMMAND_PRIORITY_LOW);
375
+ }
376
+ //#endregion
341
377
  //#region src/transformers/horizontal-rule.ts
342
378
  var HORIZONTAL_RULE_REGEX = /^(---|\*\*\*|___)\s?$/;
343
379
  var HORIZONTAL_RULE_BLOCK_TRANSFORMER$1 = {
@@ -857,6 +893,7 @@ function CorePlugins() {
857
893
  /* @__PURE__ */ jsx(MarkdownShortcutsPlugin, {}),
858
894
  /* @__PURE__ */ jsx(MarkdownPastePlugin, {}),
859
895
  /* @__PURE__ */ jsx(BlockExitPlugin, {}),
896
+ /* @__PURE__ */ jsx(ClickBelowPlugin, {}),
860
897
  /* @__PURE__ */ jsx(HorizontalRulePlugin, {}),
861
898
  /* @__PURE__ */ jsx(AutoLinkPlugin, {})
862
899
  ] });
@@ -874,6 +911,18 @@ function useImageUpload() {
874
911
  return use(ImageUploadContext);
875
912
  }
876
913
  //#endregion
914
+ //#region src/context/VideoUploadContext.tsx
915
+ var VideoUploadContext = createContext(null);
916
+ function VideoUploadProvider({ upload, children }) {
917
+ return /* @__PURE__ */ jsx(VideoUploadContext.Provider, {
918
+ value: upload,
919
+ children
920
+ });
921
+ }
922
+ function useVideoUpload() {
923
+ return use(VideoUploadContext);
924
+ }
925
+ //#endregion
877
926
  //#region src/plugins/BlockIdPlugin.tsx
878
927
  var blockIdState = createState("blockId", { parse: (v) => typeof v === "string" ? v : "" });
879
928
  var NORMALIZATION_TAG = "block-id-normalization";
@@ -976,6 +1025,7 @@ function BlockIdPlugin() {
976
1025
  //#endregion
977
1026
  //#region src/plugins/image-upload.css.ts
978
1027
  var draggingWrapperClass = "rich-image-upload-dragging";
1028
+ var toastStack = "_1x58dbf1";
979
1029
  var toastVariant = {
980
1030
  info: "_1x58dbf3",
981
1031
  success: "_1x58dbf4",
@@ -1056,7 +1106,7 @@ function ImageUploadPlugin({ onUpload }) {
1056
1106
  const [dialogDragActive, setDialogDragActive] = useState(false);
1057
1107
  const [pendingUploads, setPendingUploads] = useState(0);
1058
1108
  const [dialogUploading, setDialogUploading] = useState(false);
1059
- const [toast$1, setToast] = useState(null);
1109
+ const [toast$2, setToast] = useState(null);
1060
1110
  const [urlInput, setUrlInput] = useState("");
1061
1111
  const [urlPreview$1, setUrlPreview] = useState(null);
1062
1112
  const [urlMeta, setUrlMeta] = useState(null);
@@ -1227,14 +1277,14 @@ function ImageUploadPlugin({ onUpload }) {
1227
1277
  urlPreview$1
1228
1278
  ]);
1229
1279
  const helperMessage = pendingUploads > 0 ? `Uploading ${pendingUploads} image${pendingUploads > 1 ? "s" : ""}...` : rootDragActive ? "Drop image files to upload" : null;
1230
- return /* @__PURE__ */ jsxs(Fragment, { children: [(helperMessage || toast$1) && /* @__PURE__ */ jsxs("div", {
1280
+ return /* @__PURE__ */ jsxs(Fragment, { children: [(helperMessage || toast$2) && /* @__PURE__ */ jsxs("div", {
1231
1281
  className: "_1x58dbf1",
1232
1282
  children: [helperMessage && /* @__PURE__ */ jsxs("div", {
1233
1283
  className: `_1x58dbf2 ${toastVariant.info}`,
1234
1284
  children: [/* @__PURE__ */ jsx("span", { className: "_1x58dbf7" }), helperMessage]
1235
- }), toast$1 && /* @__PURE__ */ jsxs("div", {
1236
- className: `_1x58dbf2 ${toastVariant[toast$1.kind]}`,
1237
- children: [toast$1.kind === "success" ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Info, { size: 12 }), toast$1.message]
1285
+ }), toast$2 && /* @__PURE__ */ jsxs("div", {
1286
+ className: `_1x58dbf2 ${toastVariant[toast$2.kind]}`,
1287
+ children: [toast$2.kind === "success" ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Info, { size: 12 }), toast$2.message]
1238
1288
  })]
1239
1289
  }), /* @__PURE__ */ jsx(Dialog, {
1240
1290
  open: dialogOpen,
@@ -2036,6 +2086,134 @@ function TextSelectionPlugin() {
2036
2086
  return null;
2037
2087
  }
2038
2088
  //#endregion
2089
+ //#region src/plugins/VideoUploadPlugin.tsx
2090
+ function isVideoFile(file) {
2091
+ return file.type.startsWith("video/");
2092
+ }
2093
+ function hasVideoData(dataTransfer) {
2094
+ if (!dataTransfer) return false;
2095
+ if ([...dataTransfer.files].some(isVideoFile)) return true;
2096
+ return [...dataTransfer.items].some((item) => item.type.startsWith("video/"));
2097
+ }
2098
+ function VideoUploadPlugin({ onUpload }) {
2099
+ const [editor] = useLexicalComposerContext();
2100
+ const uploadRef = useRef(onUpload);
2101
+ uploadRef.current = onUpload;
2102
+ const toastTimerRef = useRef(null);
2103
+ const nextUploadIdRef = useRef(0);
2104
+ const [uploads, setUploads] = useState(/* @__PURE__ */ new Map());
2105
+ const [rootDragActive, setRootDragActive] = useState(false);
2106
+ const [toast$1, setToast] = useState(null);
2107
+ const pushToast = useCallback((kind, message) => {
2108
+ setToast({
2109
+ kind,
2110
+ message
2111
+ });
2112
+ if (toastTimerRef.current) window.clearTimeout(toastTimerRef.current);
2113
+ toastTimerRef.current = window.setTimeout(setToast, 2200, null);
2114
+ }, []);
2115
+ const uploadVideo = useCallback(async (file) => {
2116
+ const id = nextUploadIdRef.current++;
2117
+ setUploads((prev) => new Map(prev).set(id, 0));
2118
+ try {
2119
+ const result = await uploadRef.current(file, { onProgress: (percent) => {
2120
+ setUploads((prev) => new Map(prev).set(id, percent));
2121
+ } });
2122
+ editor.update(() => {
2123
+ $insertNodes([$createVideoNode({ src: result.src })]);
2124
+ });
2125
+ pushToast("success", "Video uploaded");
2126
+ } catch (err) {
2127
+ console.error("[VideoUploadPlugin]", err);
2128
+ pushToast("error", "Video upload failed");
2129
+ } finally {
2130
+ setUploads((prev) => {
2131
+ const next = new Map(prev);
2132
+ next.delete(id);
2133
+ return next;
2134
+ });
2135
+ }
2136
+ }, [editor, pushToast]);
2137
+ const handleFiles = useCallback((files) => {
2138
+ const videos = files.filter(isVideoFile);
2139
+ if (videos.length === 0) return false;
2140
+ for (const file of videos) uploadVideo(file);
2141
+ return videos.length === files.length;
2142
+ }, [uploadVideo]);
2143
+ useEffect(() => {
2144
+ const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files) => handleFiles(files), COMMAND_PRIORITY_CRITICAL);
2145
+ const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event) => {
2146
+ const clipboardData = "clipboardData" in event ? event.clipboardData : null;
2147
+ if (!clipboardData) return false;
2148
+ const files = [...clipboardData.files];
2149
+ if (files.some(isVideoFile)) return handleFiles(files);
2150
+ return false;
2151
+ }, COMMAND_PRIORITY_CRITICAL);
2152
+ const rootElement = editor.getRootElement();
2153
+ const wrapper = rootElement?.parentElement ?? null;
2154
+ if (!wrapper) return () => {
2155
+ unregisterDragDrop();
2156
+ unregisterPaste();
2157
+ };
2158
+ let dragCounter = 0;
2159
+ const setWrapperDragging = (next) => {
2160
+ setRootDragActive(next);
2161
+ wrapper.classList.toggle(draggingWrapperClass, next);
2162
+ };
2163
+ const onDragEnter = (event) => {
2164
+ if (!hasVideoData(event.dataTransfer)) return;
2165
+ dragCounter += 1;
2166
+ setWrapperDragging(true);
2167
+ };
2168
+ const onDragOver = (event) => {
2169
+ if (!hasVideoData(event.dataTransfer)) return;
2170
+ event.preventDefault();
2171
+ };
2172
+ const onDragLeave = () => {
2173
+ dragCounter = Math.max(dragCounter - 1, 0);
2174
+ if (dragCounter === 0) setWrapperDragging(false);
2175
+ };
2176
+ const onDrop = () => {
2177
+ dragCounter = 0;
2178
+ setWrapperDragging(false);
2179
+ };
2180
+ rootElement?.addEventListener("dragenter", onDragEnter);
2181
+ rootElement?.addEventListener("dragover", onDragOver);
2182
+ rootElement?.addEventListener("dragleave", onDragLeave);
2183
+ rootElement?.addEventListener("drop", onDrop);
2184
+ return () => {
2185
+ if (toastTimerRef.current) window.clearTimeout(toastTimerRef.current);
2186
+ unregisterDragDrop();
2187
+ unregisterPaste();
2188
+ setWrapperDragging(false);
2189
+ rootElement?.removeEventListener("dragenter", onDragEnter);
2190
+ rootElement?.removeEventListener("dragover", onDragOver);
2191
+ rootElement?.removeEventListener("dragleave", onDragLeave);
2192
+ rootElement?.removeEventListener("drop", onDrop);
2193
+ };
2194
+ }, [editor, handleFiles]);
2195
+ const helperMessage = (() => {
2196
+ if (uploads.size === 1) {
2197
+ const percent = [...uploads.values()][0] ?? 0;
2198
+ return `Uploading video... ${Math.round(percent)}%`;
2199
+ }
2200
+ if (uploads.size > 1) return `Uploading ${uploads.size} videos...`;
2201
+ if (rootDragActive) return "Drop video files to upload";
2202
+ return null;
2203
+ })();
2204
+ if (!helperMessage && !toast$1) return null;
2205
+ return /* @__PURE__ */ jsxs("div", {
2206
+ className: toastStack,
2207
+ children: [helperMessage && /* @__PURE__ */ jsxs("div", {
2208
+ className: `_1x58dbf2 ${toastVariant.info}`,
2209
+ children: [/* @__PURE__ */ jsx("span", { className: "_1x58dbf7" }), helperMessage]
2210
+ }), toast$1 && /* @__PURE__ */ jsxs("div", {
2211
+ className: `_1x58dbf2 ${toastVariant[toast$1.kind]}`,
2212
+ children: [toast$1.kind === "success" ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Info, { size: 12 }), toast$1.message]
2213
+ })]
2214
+ });
2215
+ }
2216
+ //#endregion
2039
2217
  //#region src/plugins/AutoFocusPlugin.tsx
2040
2218
  function AutoFocusPlugin() {
2041
2219
  const [editor] = useLexicalComposerContext();
@@ -2183,4 +2361,4 @@ function SubmitShortcutPlugin({ onSubmit }) {
2183
2361
  return null;
2184
2362
  }
2185
2363
  //#endregion
2186
- export { ImageUploadProvider as A, useTextSelectionSnapshot as C, defaultImageUpload as D, ImageUploadPlugin as E, ALL_TRANSFORMERS as F, HorizontalRulePlugin as I, BlockExitPlugin as L, CorePlugins as M, MarkdownShortcutsPlugin as N, BlockIdPlugin as O, MarkdownPastePlugin as P, AutoLinkPlugin as R, createTextSelectionStore as S, LinkFaviconPlugin as T, $getTextOffsetInBlock as _, AutoFocusPlugin as a, buildRangeAnchor as b, $captureTextSelectionFromRangeSelection as c, findDOMPointByTextOffset as d, getBlockElementById as f, $getRootBlock as g, TEXT_SELECTION_HIGHLIGHT_NAME as h, EditorRefPlugin as i, useImageUpload as j, blockIdState as k, $restoreTextSelection as l, getTextOffsetFromDOMPoint as m, OnChangePlugin as n, TextSelectionPlugin as o, getDOMRectFromTextSelection as p, FootnotePlugin as r, $captureTextSelection as s, SubmitShortcutPlugin as t, createDOMRangeFromTextSelection as u, $resolveSelectionPoint as v, useTextSelectionStore as w, TextSelectionStoreProvider as x, buildBlockAnchor as y };
2364
+ export { blockIdState as A, ClickBelowPlugin as B, createTextSelectionStore as C, ImageUploadPlugin as D, LinkFaviconPlugin as E, CorePlugins as F, BlockExitPlugin as H, MarkdownShortcutsPlugin as I, MarkdownPastePlugin as L, useVideoUpload as M, ImageUploadProvider as N, defaultImageUpload as O, useImageUpload as P, ALL_TRANSFORMERS as R, TextSelectionStoreProvider as S, useTextSelectionStore as T, AutoLinkPlugin as U, registerClickBelowCommand as V, $getRootBlock as _, AutoFocusPlugin as a, buildBlockAnchor as b, $captureTextSelection as c, createDOMRangeFromTextSelection as d, findDOMPointByTextOffset as f, TEXT_SELECTION_HIGHLIGHT_NAME as g, getTextOffsetFromDOMPoint as h, EditorRefPlugin as i, VideoUploadProvider as j, BlockIdPlugin as k, $captureTextSelectionFromRangeSelection as l, getDOMRectFromTextSelection as m, OnChangePlugin as n, VideoUploadPlugin as o, getBlockElementById as p, FootnotePlugin as r, TextSelectionPlugin as s, SubmitShortcutPlugin as t, $restoreTextSelection as u, $getTextOffsetInBlock as v, useTextSelectionSnapshot as w, buildRangeAnchor as x, $resolveSelectionPoint as y, HorizontalRulePlugin as z };
@@ -1 +1 @@
1
- {"version":3,"file":"CorePlugins.d.ts","sourceRoot":"","sources":["../../src/components/CorePlugins.tsx"],"names":[],"mappings":"AAYA,wBAAgB,WAAW,gCAe1B"}
1
+ {"version":3,"file":"CorePlugins.d.ts","sourceRoot":"","sources":["../../src/components/CorePlugins.tsx"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,gCAgB1B"}
@@ -1,3 +1,3 @@
1
1
  import { RichEditorProps } from '../types';
2
- export declare function RichEditor({ extraNodes, imageUpload, children, ...shellProps }: RichEditorProps): import("react").JSX.Element;
2
+ export declare function RichEditor({ extraNodes, imageUpload, videoUpload, children, ...shellProps }: RichEditorProps): import("react").JSX.Element;
3
3
  //# sourceMappingURL=RichEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichEditor.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAAE,eAAe,+BAsB/F"}
1
+ {"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,GAAG,UAAU,EACd,EAAE,eAAe,+BAyBjB"}
@@ -1252,4 +1252,4 @@ var customNodes = [
1252
1252
  ];
1253
1253
  var allNodes = [...builtinNodes, ...customNodes];
1254
1254
  //#endregion
1255
- export { BANNER_TYPES as A, $isCodeBlockNode as C, useColorScheme as D, ColorSchemeProvider as E, normalizeBannerType as M, BannerRenderer as N, $isBannerNode as O, CommentNode as S, CodeBlockRenderer as T, $createDetailsNode as _, $createRubyNode as a, $createCommentPlaceholderNode as b, $createLinkCardNode as c, $createGridContainerNode as d, $isGridContainerNode as f, FootnoteSectionNode as g, $isFootnoteSectionNode as h, VideoNode as i, BannerNode as j, BANNER_LABELS as k, $isLinkCardNode as l, $createFootnoteSectionNode as m, builtinNodes as n, $isRubyNode as o, GridContainerNode as p, customNodes as r, RubyNode as s, allNodes as t, LinkCardNode as u, DetailsNode as v, CodeBlockNode as w, $isCommentNode as x, $createCommentNode as y };
1255
+ export { BANNER_LABELS as A, CommentNode as C, ColorSchemeProvider as D, CodeBlockRenderer as E, BannerNode as M, normalizeBannerType as N, useColorScheme as O, BannerRenderer as P, $isCommentNode as S, CodeBlockNode as T, FootnoteSectionNode as _, VideoNode as a, $createCommentNode as b, RubyNode as c, LinkCardNode as d, $createGridContainerNode as f, $isFootnoteSectionNode as g, $createFootnoteSectionNode as h, $createVideoNode as i, BANNER_TYPES as j, $isBannerNode as k, $createLinkCardNode as l, GridContainerNode as m, builtinNodes as n, $createRubyNode as o, $isGridContainerNode as p, customNodes as r, $isRubyNode as s, allNodes as t, $isLinkCardNode as u, $createDetailsNode as v, $isCodeBlockNode as w, $createCommentPlaceholderNode as x, DetailsNode as y };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { VideoUploadFn } from '../plugins/VideoUploadPlugin';
3
+ export declare function VideoUploadProvider({ upload, children, }: {
4
+ upload: VideoUploadFn | null;
5
+ children: ReactNode;
6
+ }): import("react").JSX.Element;
7
+ export declare function useVideoUpload(): VideoUploadFn | null;
8
+ //# sourceMappingURL=VideoUploadContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoUploadContext.d.ts","sourceRoot":"","sources":["../../src/context/VideoUploadContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAEA;AAED,wBAAgB,cAAc,IAAI,aAAa,GAAG,IAAI,CAErD"}
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { A as ImageUploadProvider, C as useTextSelectionSnapshot, D as defaultImageUpload, E as ImageUploadPlugin, M as CorePlugins, O as BlockIdPlugin, S as createTextSelectionStore, T as LinkFaviconPlugin, _ as $getTextOffsetInBlock, a as AutoFocusPlugin, b as buildRangeAnchor, c as $captureTextSelectionFromRangeSelection, d as findDOMPointByTextOffset, f as getBlockElementById, g as $getRootBlock, h as TEXT_SELECTION_HIGHLIGHT_NAME, i as EditorRefPlugin, k as blockIdState, l as $restoreTextSelection, m as getTextOffsetFromDOMPoint, n as OnChangePlugin, o as TextSelectionPlugin, p as getDOMRectFromTextSelection, r as FootnotePlugin, s as $captureTextSelection, t as SubmitShortcutPlugin, u as createDOMRangeFromTextSelection, v as $resolveSelectionPoint, w as useTextSelectionStore, x as TextSelectionStoreProvider, y as buildBlockAnchor } from "./SubmitShortcutPlugin-CFIOt7Yx.js";
2
- import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-C_EUwDDU.js";
1
+ import { A as blockIdState, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F 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-HTwCVN0m.js";
2
+ import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-BmMoa_84.js";
3
3
  import { L as NestedContentRendererProvider, R as useNestedContentRenderer, t as editorTheme, z as useOptionalNestedContentRenderer } from "./theme-BGKUes-K.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-CRL_A32i.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 useColorScheme, E as ColorSchemeProvider } from "./config-wy9S6JPy.js";
6
+ import { D as ColorSchemeProvider, O as useColorScheme } from "./config-CplWQTph.js";
7
7
  import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
8
8
  import { t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-C7VzxLf5.js";
9
9
  import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-BVJeViBr.js";
@@ -107,28 +107,32 @@ function RichEditorShell({ nodes, initialValue, onChange, variant = "article", t
107
107
  }
108
108
  //#endregion
109
109
  //#region src/components/RichEditor.tsx
110
- function RichEditor({ extraNodes, imageUpload, children, ...shellProps }) {
110
+ function RichEditor({ extraNodes, imageUpload, videoUpload, children, ...shellProps }) {
111
111
  const nodes = extraNodes ? [...allEditNodes, ...extraNodes] : allEditNodes;
112
112
  const resolvedImageUpload = imageUpload ?? defaultImageUpload;
113
113
  return /* @__PURE__ */ jsx(ImageUploadProvider, {
114
114
  upload: resolvedImageUpload,
115
- children: /* @__PURE__ */ jsx(ExtraNodesProvider, {
116
- extraNodes,
117
- children: /* @__PURE__ */ jsxs(RichEditorShell, {
118
- nodes,
119
- ...shellProps,
120
- children: [
121
- /* @__PURE__ */ jsx(CorePlugins, {}),
122
- /* @__PURE__ */ jsx(ImagePlugin, {}),
123
- /* @__PURE__ */ jsx(ImageUploadPlugin, { onUpload: resolvedImageUpload }),
124
- /* @__PURE__ */ jsx(KaTeXPlugin, {}),
125
- /* @__PURE__ */ jsx(AlertPlugin, {}),
126
- /* @__PURE__ */ jsx(MermaidPlugin, {}),
127
- /* @__PURE__ */ jsx(LinkFaviconPlugin, {}),
128
- /* @__PURE__ */ jsx(BlockIdPlugin, {}),
129
- /* @__PURE__ */ jsx(TextSelectionPlugin, {}),
130
- children
131
- ]
115
+ children: /* @__PURE__ */ jsx(VideoUploadProvider, {
116
+ upload: videoUpload ?? null,
117
+ children: /* @__PURE__ */ jsx(ExtraNodesProvider, {
118
+ extraNodes,
119
+ children: /* @__PURE__ */ jsxs(RichEditorShell, {
120
+ nodes,
121
+ ...shellProps,
122
+ children: [
123
+ /* @__PURE__ */ jsx(CorePlugins, {}),
124
+ /* @__PURE__ */ jsx(ImagePlugin, {}),
125
+ /* @__PURE__ */ jsx(ImageUploadPlugin, { onUpload: resolvedImageUpload }),
126
+ videoUpload ? /* @__PURE__ */ jsx(VideoUploadPlugin, { onUpload: videoUpload }) : null,
127
+ /* @__PURE__ */ jsx(KaTeXPlugin, {}),
128
+ /* @__PURE__ */ jsx(AlertPlugin, {}),
129
+ /* @__PURE__ */ jsx(MermaidPlugin, {}),
130
+ /* @__PURE__ */ jsx(LinkFaviconPlugin, {}),
131
+ /* @__PURE__ */ jsx(BlockIdPlugin, {}),
132
+ /* @__PURE__ */ jsx(TextSelectionPlugin, {}),
133
+ children
134
+ ]
135
+ })
132
136
  })
133
137
  })
134
138
  });
@@ -1,7 +1,7 @@
1
1
  import { C as KaTeXBlockNode, E as ImageNode, P as _defineProperty, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, i as TagNode, k as FootnoteNode, m as MermaidNode, t as editorTheme } from "./theme-BGKUes-K.js";
2
2
  import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-CRL_A32i.js";
3
3
  import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
4
- import { C as $isCodeBlockNode, M as normalizeBannerType, N as BannerRenderer, O as $isBannerNode, S as CommentNode, T as CodeBlockRenderer, f as $isGridContainerNode, g as FootnoteSectionNode, i as VideoNode, j as BannerNode, n as builtinNodes, p as GridContainerNode, s as RubyNode, u as LinkCardNode, v as DetailsNode, w as CodeBlockNode } from "./config-wy9S6JPy.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-CplWQTph.js";
5
5
  import { n as gridStyles, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
6
6
  import { n as AlertQuoteEditNode, r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-CaCADTx3.js";
7
7
  import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
@@ -1,5 +1,5 @@
1
- import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-C_EUwDDU.js";
1
+ import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-BmMoa_84.js";
2
2
  import { C as KaTeXBlockNode, E as ImageNode, M as ALERT_TYPES, 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, j as ALERT_LABELS, 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-BGKUes-K.js";
3
- import { A as BANNER_TYPES, S as CommentNode, a as $createRubyNode, c as $createLinkCardNode, d as $createGridContainerNode, f as $isGridContainerNode, g as FootnoteSectionNode, h as $isFootnoteSectionNode, k as BANNER_LABELS, l as $isLinkCardNode, m as $createFootnoteSectionNode, n as builtinNodes, o as $isRubyNode, p as GridContainerNode, r as customNodes, s as RubyNode, t as allNodes, u as LinkCardNode, x as $isCommentNode, y as $createCommentNode } from "./config-wy9S6JPy.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-CplWQTph.js";
4
4
  import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-CaCADTx3.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, setResolvedEditNodes };
@@ -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,cAmX9D"}
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"}
@@ -0,0 +1,4 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ export declare function ClickBelowPlugin(): null;
3
+ export declare function registerClickBelowCommand(editor: LexicalEditor): () => void;
4
+ //# sourceMappingURL=ClickBelowPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClickBelowPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ClickBelowPlugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAGjB,wBAAgB,gBAAgB,SAQ/B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,cA+B9D"}
@@ -0,0 +1,12 @@
1
+ export interface VideoUploadResult {
2
+ src: string;
3
+ }
4
+ export type VideoUploadFn = (file: File, opts?: {
5
+ onProgress?: (percent: number) => void;
6
+ }) => Promise<VideoUploadResult>;
7
+ interface VideoUploadPluginProps {
8
+ onUpload: VideoUploadFn;
9
+ }
10
+ export declare function VideoUploadPlugin({ onUpload }: VideoUploadPluginProps): import("react").JSX.Element | null;
11
+ export {};
12
+ //# sourceMappingURL=VideoUploadPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/VideoUploadPlugin.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,aAAa,GAAG,CAC1B,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,KAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAahC,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,sCAiLrE"}
@@ -1,11 +1,13 @@
1
1
  export { CorePlugins } from './components/CorePlugins';
2
2
  export { ImageUploadProvider, useImageUpload } from './context/ImageUploadContext';
3
+ export { useVideoUpload, VideoUploadProvider } from './context/VideoUploadContext';
3
4
  export { AlertPlugin } from './plugins/AlertPlugin';
4
5
  export { AutoFocusPlugin } from './plugins/AutoFocusPlugin';
5
6
  export { AutoLinkPlugin } from './plugins/AutoLinkPlugin';
6
7
  export { BlockExitPlugin } from './plugins/BlockExitPlugin';
7
8
  export { BlockIdPlugin } from './plugins/BlockIdPlugin';
8
9
  export { blockIdState } from './plugins/BlockIdPlugin';
10
+ export { ClickBelowPlugin, registerClickBelowCommand } from './plugins/ClickBelowPlugin';
9
11
  export { EditorRefPlugin } from './plugins/EditorRefPlugin';
10
12
  export { FootnotePlugin } from './plugins/FootnotePlugin';
11
13
  export { HorizontalRulePlugin } from './plugins/HorizontalRulePlugin';
@@ -19,5 +21,6 @@ export { MermaidPlugin } from './plugins/MermaidPlugin';
19
21
  export { OnChangePlugin } from './plugins/OnChangePlugin';
20
22
  export { SubmitShortcutPlugin } from './plugins/SubmitShortcutPlugin';
21
23
  export { TextSelectionPlugin } from './plugins/TextSelectionPlugin';
24
+ export { type VideoUploadFn, VideoUploadPlugin, type VideoUploadResult, } from './plugins/VideoUploadPlugin';
22
25
  export { ALL_TRANSFORMERS } from './transformers';
23
26
  //# sourceMappingURL=plugins-entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins-entry.d.ts","sourceRoot":"","sources":["../src/plugins-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAClB,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OA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,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAClB,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EACL,KAAK,aAAa,EAClB,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,3 +1,3 @@
1
- import { A as ImageUploadProvider, D as defaultImageUpload, E as ImageUploadPlugin, F as ALL_TRANSFORMERS, I as HorizontalRulePlugin, L as BlockExitPlugin, M as CorePlugins, N as MarkdownShortcutsPlugin, O as BlockIdPlugin, P as MarkdownPastePlugin, R as AutoLinkPlugin, T as LinkFaviconPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as useImageUpload, k as blockIdState, n as OnChangePlugin, o as TextSelectionPlugin, r as FootnotePlugin, t as SubmitShortcutPlugin } from "./SubmitShortcutPlugin-CFIOt7Yx.js";
1
+ import { A as blockIdState, B as ClickBelowPlugin, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as CorePlugins, H as BlockExitPlugin, I as MarkdownShortcutsPlugin, L as MarkdownPastePlugin, M as useVideoUpload, N as ImageUploadProvider, O as defaultImageUpload, P as useImageUpload, R as ALL_TRANSFORMERS, U as AutoLinkPlugin, V as registerClickBelowCommand, 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 HorizontalRulePlugin } from "./SubmitShortcutPlugin-HTwCVN0m.js";
2
2
  import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-BK4tJ9xt.js";
3
- export { ALL_TRANSFORMERS, AlertPlugin, AutoFocusPlugin, AutoLinkPlugin, BlockExitPlugin, BlockIdPlugin, CorePlugins, EditorRefPlugin, FootnotePlugin, HorizontalRulePlugin, ImagePlugin, ImageUploadPlugin, ImageUploadProvider, KaTeXPlugin, LinkFaviconPlugin, MarkdownPastePlugin, MarkdownShortcutsPlugin, MermaidPlugin, OnChangePlugin, SubmitShortcutPlugin, TextSelectionPlugin, blockIdState, defaultImageUpload, useImageUpload };
3
+ export { ALL_TRANSFORMERS, AlertPlugin, AutoFocusPlugin, AutoLinkPlugin, BlockExitPlugin, BlockIdPlugin, ClickBelowPlugin, CorePlugins, EditorRefPlugin, FootnotePlugin, HorizontalRulePlugin, ImagePlugin, ImageUploadPlugin, ImageUploadProvider, KaTeXPlugin, LinkFaviconPlugin, MarkdownPastePlugin, MarkdownShortcutsPlugin, MermaidPlugin, OnChangePlugin, SubmitShortcutPlugin, TextSelectionPlugin, VideoUploadPlugin, VideoUploadProvider, blockIdState, defaultImageUpload, registerClickBelowCommand, useImageUpload, useVideoUpload };
@@ -1,7 +1,7 @@
1
1
  import { F as extractTextContent, L as NestedContentRendererProvider, R as useNestedContentRenderer, a as getTagBgColor, t as editorTheme, z as useOptionalNestedContentRenderer } from "./theme-BGKUes-K.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-CRL_A32i.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 useColorScheme, E as ColorSchemeProvider, n as builtinNodes, r as customNodes, t as allNodes } from "./config-wy9S6JPy.js";
4
+ import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-CplWQTph.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-C7VzxLf5.js";
7
7
  import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-BVJeViBr.js";
package/dist/types.d.ts CHANGED
@@ -28,5 +28,10 @@ export interface RichEditorProps {
28
28
  style?: React.CSSProperties;
29
29
  theme?: ColorScheme;
30
30
  variant?: RichEditorVariant;
31
+ videoUpload?: (file: File, opts?: {
32
+ onProgress?: (percent: number) => void;
33
+ }) => Promise<{
34
+ src: string;
35
+ }>;
31
36
  }
32
37
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE,MA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a,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,WAAW,CAAC,EAAE,CACZ,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,KAC9C,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.21.1",
3
+ "version": "0.22.1",
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.45.0",
49
49
  "nanoid": "^5.1.11",
50
50
  "thumbhash": "^0.1.1",
51
- "@haklex/rich-editor-ui": "0.21.1",
52
- "@haklex/rich-style-token": "0.21.1",
53
- "@haklex/rich-headless": "0.21.1"
51
+ "@haklex/rich-editor-ui": "0.22.1",
52
+ "@haklex/rich-headless": "0.22.1",
53
+ "@haklex/rich-style-token": "0.22.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@lexical/extension": "^0.45.0",