@haklex/rich-editor 0.23.0 → 0.24.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.
@@ -899,6 +899,28 @@ function CorePlugins() {
899
899
  ] });
900
900
  }
901
901
  //#endregion
902
+ //#region src/context/ImagePreprocessContext.tsx
903
+ var ImagePreprocessContext = createContext(null);
904
+ function ImagePreprocessProvider({ children }) {
905
+ const ref = useRef(null);
906
+ const value = useMemo(() => ({
907
+ ref,
908
+ register: (fn) => {
909
+ ref.current = fn;
910
+ return () => {
911
+ if (ref.current === fn) ref.current = null;
912
+ };
913
+ }
914
+ }), []);
915
+ return /* @__PURE__ */ jsx(ImagePreprocessContext.Provider, {
916
+ value,
917
+ children
918
+ });
919
+ }
920
+ function useImagePreprocess() {
921
+ return use(ImagePreprocessContext);
922
+ }
923
+ //#endregion
902
924
  //#region src/context/ImageUploadContext.tsx
903
925
  var ImageUploadContext = createContext(null);
904
926
  function ImageUploadProvider({ upload, children }) {
@@ -1023,6 +1045,20 @@ function BlockIdPlugin() {
1023
1045
  return null;
1024
1046
  }
1025
1047
  //#endregion
1048
+ //#region src/utils/image-preprocess.ts
1049
+ async function resolvePreprocessTargets(files, source, preprocess) {
1050
+ if (!preprocess || files.length !== 1) return files;
1051
+ try {
1052
+ const result = await preprocess(files[0], { source });
1053
+ if (result === null) return [];
1054
+ if (result === "skip") return files;
1055
+ return [result];
1056
+ } catch (err) {
1057
+ console.error("[ImageUploadPlugin] preprocess failed, uploading original", err);
1058
+ return files;
1059
+ }
1060
+ }
1061
+ //#endregion
1026
1062
  //#region src/plugins/image-upload.css.ts
1027
1063
  var draggingWrapperClass = "rich-image-upload-dragging";
1028
1064
  var toastStack = "_1x58dbf1";
@@ -1098,6 +1134,8 @@ function ImageUploadPlugin({ onUpload }) {
1098
1134
  const [editor] = useLexicalComposerContext();
1099
1135
  const uploadRef = useRef(onUpload);
1100
1136
  uploadRef.current = onUpload;
1137
+ const preprocessRef = useImagePreprocess()?.ref ?? null;
1138
+ const getPreprocess = useCallback(() => preprocessRef?.current ?? null, [preprocessRef]);
1101
1139
  const fileInputRef = useRef(null);
1102
1140
  const toastTimerRef = useRef(null);
1103
1141
  const [dialogOpen, setDialogOpen] = useState(false);
@@ -1161,19 +1199,22 @@ function ImageUploadPlugin({ onUpload }) {
1161
1199
  setDialogUploading(false);
1162
1200
  }
1163
1201
  }, [editor, pushToast]);
1164
- const handleFiles = useCallback((files) => {
1202
+ const handleFiles = useCallback((files, source) => {
1165
1203
  const images = files.filter(isImageFile);
1166
1204
  if (images.length === 0) return false;
1167
- for (const file of images) insertByUpload(file);
1205
+ (async () => {
1206
+ const targets = await resolvePreprocessTargets(images, source, getPreprocess());
1207
+ for (const file of targets) insertByUpload(file);
1208
+ })();
1168
1209
  return true;
1169
- }, [insertByUpload]);
1210
+ }, [insertByUpload, getPreprocess]);
1170
1211
  useEffect(() => {
1171
- const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files) => handleFiles(files), COMMAND_PRIORITY_HIGH);
1212
+ const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files) => handleFiles(files, "drop"), COMMAND_PRIORITY_HIGH);
1172
1213
  const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event) => {
1173
1214
  const clipboardData = "clipboardData" in event ? event.clipboardData : null;
1174
1215
  if (!clipboardData) return false;
1175
1216
  const files = [...clipboardData.files];
1176
- if (files.some(isImageFile)) return handleFiles(files);
1217
+ if (files.some(isImageFile)) return handleFiles(files, "paste");
1177
1218
  return false;
1178
1219
  }, COMMAND_PRIORITY_HIGH);
1179
1220
  const unregisterOpenDialog = editor.registerCommand(OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, () => {
@@ -1234,8 +1275,11 @@ function ImageUploadPlugin({ onUpload }) {
1234
1275
  }, []);
1235
1276
  const handleDialogFile = useCallback(async (file) => {
1236
1277
  if (!file) return;
1237
- await insertByUpload(file, { closeDialog: true });
1238
- }, [insertByUpload]);
1278
+ let target = file;
1279
+ if (isImageFile(file)) [target] = await resolvePreprocessTargets([file], "dialog", getPreprocess());
1280
+ if (!target) return;
1281
+ await insertByUpload(target, { closeDialog: true });
1282
+ }, [insertByUpload, getPreprocess]);
1239
1283
  const handleUrlPreview = useCallback(async () => {
1240
1284
  const nextUrl = urlInput.trim();
1241
1285
  if (!nextUrl) return;
@@ -2361,4 +2405,4 @@ function SubmitShortcutPlugin({ onSubmit }) {
2361
2405
  return null;
2362
2406
  }
2363
2407
  //#endregion
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 };
2408
+ export { blockIdState as A, ALL_TRANSFORMERS as B, createTextSelectionStore as C, ImageUploadPlugin as D, LinkFaviconPlugin as E, ImagePreprocessProvider as F, AutoLinkPlugin as G, ClickBelowPlugin as H, useImagePreprocess as I, CorePlugins as L, useVideoUpload as M, ImageUploadProvider as N, defaultImageUpload as O, useImageUpload as P, MarkdownShortcutsPlugin as R, TextSelectionStoreProvider as S, useTextSelectionStore as T, registerClickBelowCommand as U, HorizontalRulePlugin as V, BlockExitPlugin as W, $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, MarkdownPastePlugin as z };
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichEditor.tsx"],"names":[],"mappings":"AAcA,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,+BA2BjB"}
@@ -0,0 +1,14 @@
1
+ import { ReactNode, RefObject } from 'react';
2
+ export type ImagePreprocessResult = File | 'skip' | null;
3
+ export type ImagePreprocessFn = (file: File, meta: {
4
+ source: 'drop' | 'paste' | 'dialog';
5
+ }) => Promise<ImagePreprocessResult>;
6
+ export interface ImagePreprocessContextValue {
7
+ ref: RefObject<ImagePreprocessFn | null>;
8
+ register: (fn: ImagePreprocessFn | null) => () => void;
9
+ }
10
+ export declare function ImagePreprocessProvider({ children }: {
11
+ children: ReactNode;
12
+ }): import("react").JSX.Element;
13
+ export declare function useImagePreprocess(): ImagePreprocessContextValue | null;
14
+ //# sourceMappingURL=ImagePreprocessContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImagePreprocessContext.d.ts","sourceRoot":"","sources":["../../src/context/ImagePreprocessContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CAAE,KAC1C,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACzC,QAAQ,EAAE,CAAC,EAAE,EAAE,iBAAiB,GAAG,IAAI,KAAK,MAAM,IAAI,CAAC;CACxD;AAID,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAkB5E;AAED,wBAAgB,kBAAkB,IAAI,2BAA2B,GAAG,IAAI,CAEvE"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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-CetzNUTq.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-DBUEDVy_.js";
2
2
  import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-DAnTwlmy.js";
3
3
  import { B as useNestedContentRenderer, V as useOptionalNestedContentRenderer, t as editorTheme, z as NestedContentRendererProvider } from "./theme-BKgua-pr.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";
@@ -110,7 +110,7 @@ function RichEditorShell({ nodes, initialValue, onChange, variant = "article", t
110
110
  function RichEditor({ extraNodes, imageUpload, videoUpload, children, ...shellProps }) {
111
111
  const nodes = extraNodes ? [...allEditNodes, ...extraNodes] : allEditNodes;
112
112
  const resolvedImageUpload = imageUpload ?? defaultImageUpload;
113
- return /* @__PURE__ */ jsx(ImageUploadProvider, {
113
+ return /* @__PURE__ */ jsx(ImagePreprocessProvider, { children: /* @__PURE__ */ jsx(ImageUploadProvider, {
114
114
  upload: resolvedImageUpload,
115
115
  children: /* @__PURE__ */ jsx(VideoUploadProvider, {
116
116
  upload: videoUpload ?? null,
@@ -135,7 +135,7 @@ function RichEditor({ extraNodes, imageUpload, videoUpload, children, ...shellPr
135
135
  })
136
136
  })
137
137
  })
138
- });
138
+ }) });
139
139
  }
140
140
  //#endregion
141
141
  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, 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, useOptionalNestedContentRenderer, useRendererConfig, useRendererMode, useTextSelectionSnapshot, useTextSelectionStore, useVariant, vars };
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"AAwBA,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,+BAobrE"}
1
+ {"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"AA0BA,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,+BAgcrE"}
@@ -1,4 +1,5 @@
1
1
  export { CorePlugins } from './components/CorePlugins';
2
+ export { type ImagePreprocessContextValue, type ImagePreprocessFn, ImagePreprocessProvider, type ImagePreprocessResult, useImagePreprocess, } from './context/ImagePreprocessContext';
2
3
  export { ImageUploadProvider, useImageUpload } from './context/ImageUploadContext';
3
4
  export { useVideoUpload, VideoUploadProvider } from './context/VideoUploadContext';
4
5
  export { AlertPlugin } from './plugins/AlertPlugin';
@@ -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,cAAc,EAAE,mBAAmB,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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C,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 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-CetzNUTq.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-DBUEDVy_.js";
2
2
  import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-BFrJaBkH.js";
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 };
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 };
@@ -0,0 +1,3 @@
1
+ import { ImagePreprocessFn } from '../context/ImagePreprocessContext';
2
+ export declare function resolvePreprocessTargets(files: File[], source: 'drop' | 'paste' | 'dialog', preprocess: ImagePreprocessFn | null): Promise<File[]>;
3
+ //# sourceMappingURL=image-preprocess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-preprocess.d.ts","sourceRoot":"","sources":["../../src/utils/image-preprocess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,IAAI,EAAE,EACb,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,EACnC,UAAU,EAAE,iBAAiB,GAAG,IAAI,GACnC,OAAO,CAAC,IAAI,EAAE,CAAC,CAcjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.23.0",
3
+ "version": "0.24.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.45.0",
49
49
  "nanoid": "^5.1.11",
50
50
  "thumbhash": "^0.1.1",
51
- "@haklex/rich-editor-ui": "0.23.0",
52
- "@haklex/rich-style-token": "0.23.0",
53
- "@haklex/rich-headless": "0.23.0"
51
+ "@haklex/rich-editor-ui": "0.24.0",
52
+ "@haklex/rich-headless": "0.24.0",
53
+ "@haklex/rich-style-token": "0.24.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@lexical/extension": "^0.45.0",