@mdxeditor/editor 0.12.0 → 0.14.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.
Files changed (42) hide show
  1. package/dist/MDXEditor.d.ts +4 -0
  2. package/dist/MDXEditor.js +11 -10
  3. package/dist/gurx/react.d.ts +4 -1
  4. package/dist/gurx/react.js +2 -1
  5. package/dist/plugins/codeblock/index.d.ts +13 -3
  6. package/dist/plugins/codemirror/index.d.ts +17 -3
  7. package/dist/plugins/core/NestedLexicalEditor.d.ts +1 -1
  8. package/dist/plugins/core/NestedLexicalEditor.js +4 -4
  9. package/dist/plugins/core/SharedHistoryPlugin.js +1 -1
  10. package/dist/plugins/core/index.d.ts +12 -3
  11. package/dist/plugins/core/index.js +4 -1
  12. package/dist/plugins/diff-source/index.d.ts +13 -3
  13. package/dist/plugins/directives/index.d.ts +13 -3
  14. package/dist/plugins/frontmatter/index.d.ts +13 -3
  15. package/dist/plugins/headings/index.d.ts +3 -1
  16. package/dist/plugins/image/ImageEditor.js +5 -3
  17. package/dist/plugins/image/index.d.ts +32 -12
  18. package/dist/plugins/image/index.js +23 -21
  19. package/dist/plugins/jsx/index.d.ts +12 -2
  20. package/dist/plugins/link/AutoLinkPlugin.d.ts +9 -0
  21. package/dist/plugins/link/AutoLinkPlugin.js +18 -0
  22. package/dist/plugins/link/index.d.ts +21 -4
  23. package/dist/plugins/link/index.js +16 -5
  24. package/dist/plugins/link-dialog/index.d.ts +11 -3
  25. package/dist/plugins/link-dialog/index.js +1 -0
  26. package/dist/plugins/lists/index.d.ts +13 -3
  27. package/dist/plugins/lists/index.js +2 -2
  28. package/dist/plugins/markdown-shortcut/index.d.ts +1 -0
  29. package/dist/plugins/markdown-shortcut/index.js +45 -21
  30. package/dist/plugins/quote/index.d.ts +10 -3
  31. package/dist/plugins/sandpack/index.d.ts +16 -2
  32. package/dist/plugins/table/TableEditor.js +5 -5
  33. package/dist/plugins/table/index.d.ts +13 -3
  34. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +1 -1
  35. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.js +1 -1
  36. package/dist/plugins/thematic-break/MdastThematicBreakVisitor.js +1 -1
  37. package/dist/plugins/thematic-break/index.d.ts +13 -3
  38. package/dist/plugins/thematic-break/index.js +2 -2
  39. package/dist/plugins/toolbar/index.d.ts +10 -2
  40. package/dist/style.css +184 -165
  41. package/dist/styles/ui.module.css.js +90 -84
  42. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { RefObject, ComponentType, ReactNode } from 'react';
1
+ import type { RefObject, ReactNode, ComponentType } from 'react';
2
2
  import type { Options } from 'mdast-util-to-markdown';
3
3
  import type { Config } from 'mdast-util-from-markdown/lib';
4
4
  import type { Extension } from 'micromark-util-types';
@@ -100,6 +100,7 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
100
100
  markdown: RealmNode<string>;
101
101
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
102
102
  contentEditableClassName: RealmNode<string>;
103
+ placeholder: RealmNode<ReactNode>;
103
104
  autoFocus: RealmNode<boolean>;
104
105
  composerChildren: RealmNode<ComponentType<{}>[]>;
105
106
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -149,6 +150,7 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
149
150
  markdown: RealmNode<string>;
150
151
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
151
152
  contentEditableClassName: RealmNode<string>;
153
+ placeholder: RealmNode<ReactNode>;
152
154
  autoFocus: RealmNode<boolean>;
153
155
  composerChildren: RealmNode<ComponentType<{}>[]>;
154
156
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -216,6 +218,7 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
216
218
  markdown: RealmNode<string>;
217
219
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
218
220
  contentEditableClassName: RealmNode<string>;
221
+ placeholder: RealmNode<ReactNode>;
219
222
  autoFocus: RealmNode<boolean>;
220
223
  composerChildren: RealmNode<ComponentType<{}>[]>;
221
224
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -265,6 +268,7 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
265
268
  markdown: RealmNode<string>;
266
269
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
267
270
  contentEditableClassName: RealmNode<string>;
271
+ placeholder: RealmNode<ReactNode>;
268
272
  autoFocus: RealmNode<boolean>;
269
273
  composerChildren: RealmNode<ComponentType<{}>[]>;
270
274
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -323,6 +327,7 @@ directivesPluginHooks: {
323
327
  markdown: RealmNode<string>;
324
328
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
325
329
  contentEditableClassName: RealmNode<string>;
330
+ placeholder: RealmNode<ReactNode>;
326
331
  autoFocus: RealmNode<boolean>;
327
332
  composerChildren: RealmNode<ComponentType<{}>[]>;
328
333
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -344,7 +349,7 @@ directivesPluginHooks: {
344
349
  convertSelectionToNode: RealmNode<() => ElementNode>;
345
350
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
346
351
  }>;
347
- useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
352
+ useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
348
353
  directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
349
354
  insertDirective: RealmNode<InsertDirectivePayload>;
350
355
  } & {
@@ -376,6 +381,7 @@ directivesPluginHooks: {
376
381
  markdown: RealmNode<string>;
377
382
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
378
383
  contentEditableClassName: RealmNode<string>;
384
+ placeholder: RealmNode<ReactNode>;
379
385
  autoFocus: RealmNode<boolean>;
380
386
  composerChildren: RealmNode<ComponentType<{}>[]>;
381
387
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -429,6 +435,7 @@ directivesPluginHooks: {
429
435
  markdown: RealmNode<string>;
430
436
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
431
437
  contentEditableClassName: RealmNode<string>;
438
+ placeholder: RealmNode<ReactNode>;
432
439
  autoFocus: RealmNode<boolean>;
433
440
  composerChildren: RealmNode<ComponentType<{}>[]>;
434
441
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -481,6 +488,7 @@ directivesPluginHooks: {
481
488
  markdown: RealmNode<string>;
482
489
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
483
490
  contentEditableClassName: RealmNode<string>;
491
+ placeholder: RealmNode<ReactNode>;
484
492
  autoFocus: RealmNode<boolean>;
485
493
  composerChildren: RealmNode<ComponentType<{}>[]>;
486
494
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -534,6 +542,7 @@ directivesPluginHooks: {
534
542
  markdown: RealmNode<string>;
535
543
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
536
544
  contentEditableClassName: RealmNode<string>;
545
+ placeholder: RealmNode<ReactNode>;
537
546
  autoFocus: RealmNode<boolean>;
538
547
  composerChildren: RealmNode<ComponentType<{}>[]>;
539
548
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -555,7 +564,7 @@ directivesPluginHooks: {
555
564
  convertSelectionToNode: RealmNode<() => ElementNode>;
556
565
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
557
566
  }>) => void;
558
- usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
567
+ usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
559
568
  directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
560
569
  insertDirective: RealmNode<InsertDirectivePayload>;
561
570
  } & {
@@ -587,6 +596,7 @@ directivesPluginHooks: {
587
596
  markdown: RealmNode<string>;
588
597
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
589
598
  contentEditableClassName: RealmNode<string>;
599
+ placeholder: RealmNode<ReactNode>;
590
600
  autoFocus: RealmNode<boolean>;
591
601
  composerChildren: RealmNode<ComponentType<{}>[]>;
592
602
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -1,4 +1,4 @@
1
- import type { RefObject, ComponentType, ReactNode } from 'react';
1
+ import type { RefObject, ReactNode, ComponentType } from 'react';
2
2
  import type { Options } from 'mdast-util-to-markdown';
3
3
  import type { Config } from 'mdast-util-from-markdown/lib';
4
4
  import type { Extension } from 'micromark-util-types';
@@ -41,6 +41,7 @@ export declare const frontmatterSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
41
41
  markdown: RealmNode<string>;
42
42
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
43
43
  contentEditableClassName: RealmNode<string>;
44
+ placeholder: RealmNode<ReactNode>;
44
45
  autoFocus: RealmNode<boolean>;
45
46
  composerChildren: RealmNode<ComponentType<{}>[]>;
46
47
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -90,6 +91,7 @@ export declare const frontmatterSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
90
91
  markdown: RealmNode<string>;
91
92
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
92
93
  contentEditableClassName: RealmNode<string>;
94
+ placeholder: RealmNode<ReactNode>;
93
95
  autoFocus: RealmNode<boolean>;
94
96
  composerChildren: RealmNode<ComponentType<{}>[]>;
95
97
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -144,6 +146,7 @@ frontmatterPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
144
146
  markdown: RealmNode<string>;
145
147
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
146
148
  contentEditableClassName: RealmNode<string>;
149
+ placeholder: RealmNode<ReactNode>;
147
150
  autoFocus: RealmNode<boolean>;
148
151
  composerChildren: RealmNode<ComponentType<{}>[]>;
149
152
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -193,6 +196,7 @@ frontmatterPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
193
196
  markdown: RealmNode<string>;
194
197
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
195
198
  contentEditableClassName: RealmNode<string>;
199
+ placeholder: RealmNode<ReactNode>;
196
200
  autoFocus: RealmNode<boolean>;
197
201
  composerChildren: RealmNode<ComponentType<{}>[]>;
198
202
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -249,6 +253,7 @@ frontmatterPluginHooks: {
249
253
  markdown: RealmNode<string>;
250
254
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
251
255
  contentEditableClassName: RealmNode<string>;
256
+ placeholder: RealmNode<ReactNode>;
252
257
  autoFocus: RealmNode<boolean>;
253
258
  composerChildren: RealmNode<ComponentType<{}>[]>;
254
259
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -270,7 +275,7 @@ frontmatterPluginHooks: {
270
275
  convertSelectionToNode: RealmNode<() => ElementNode>;
271
276
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
272
277
  }>;
273
- useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertFrontmatter">(key: K, callback: (value: ValueForKey<{
278
+ useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertFrontmatter">(key: K, callback: (value: ValueForKey<{
274
279
  insertFrontmatter: RealmNode<true>;
275
280
  } & {
276
281
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -301,6 +306,7 @@ frontmatterPluginHooks: {
301
306
  markdown: RealmNode<string>;
302
307
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
303
308
  contentEditableClassName: RealmNode<string>;
309
+ placeholder: RealmNode<ReactNode>;
304
310
  autoFocus: RealmNode<boolean>;
305
311
  composerChildren: RealmNode<ComponentType<{}>[]>;
306
312
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -353,6 +359,7 @@ frontmatterPluginHooks: {
353
359
  markdown: RealmNode<string>;
354
360
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
355
361
  contentEditableClassName: RealmNode<string>;
362
+ placeholder: RealmNode<ReactNode>;
356
363
  autoFocus: RealmNode<boolean>;
357
364
  composerChildren: RealmNode<ComponentType<{}>[]>;
358
365
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -404,6 +411,7 @@ frontmatterPluginHooks: {
404
411
  markdown: RealmNode<string>;
405
412
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
406
413
  contentEditableClassName: RealmNode<string>;
414
+ placeholder: RealmNode<ReactNode>;
407
415
  autoFocus: RealmNode<boolean>;
408
416
  composerChildren: RealmNode<ComponentType<{}>[]>;
409
417
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -456,6 +464,7 @@ frontmatterPluginHooks: {
456
464
  markdown: RealmNode<string>;
457
465
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
458
466
  contentEditableClassName: RealmNode<string>;
467
+ placeholder: RealmNode<ReactNode>;
459
468
  autoFocus: RealmNode<boolean>;
460
469
  composerChildren: RealmNode<ComponentType<{}>[]>;
461
470
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -477,7 +486,7 @@ frontmatterPluginHooks: {
477
486
  convertSelectionToNode: RealmNode<() => ElementNode>;
478
487
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
479
488
  }>) => void;
480
- usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertFrontmatter">(key: K_2) => (value: ValueForKey<{
489
+ usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertFrontmatter">(key: K_2) => (value: ValueForKey<{
481
490
  insertFrontmatter: RealmNode<true>;
482
491
  } & {
483
492
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -508,6 +517,7 @@ frontmatterPluginHooks: {
508
517
  markdown: RealmNode<string>;
509
518
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
510
519
  contentEditableClassName: RealmNode<string>;
520
+ placeholder: RealmNode<ReactNode>;
511
521
  autoFocus: RealmNode<boolean>;
512
522
  composerChildren: RealmNode<ComponentType<{}>[]>;
513
523
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -1,4 +1,4 @@
1
- import type { RefObject, ComponentType, ReactNode } from 'react';
1
+ import type { RefObject, ReactNode, ComponentType } from 'react';
2
2
  import type { Options } from 'mdast-util-to-markdown';
3
3
  import type { Config } from 'mdast-util-from-markdown/lib';
4
4
  import type { Extension } from 'micromark-util-types';
@@ -43,6 +43,7 @@ export declare const headingsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
43
43
  markdown: RealmNode<string>;
44
44
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
45
45
  contentEditableClassName: RealmNode<string>;
46
+ placeholder: RealmNode<ReactNode>;
46
47
  autoFocus: RealmNode<boolean>;
47
48
  composerChildren: RealmNode<ComponentType<{}>[]>;
48
49
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -96,6 +97,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
96
97
  markdown: RealmNode<string>;
97
98
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
98
99
  contentEditableClassName: RealmNode<string>;
100
+ placeholder: RealmNode<ReactNode>;
99
101
  autoFocus: RealmNode<boolean>;
100
102
  composerChildren: RealmNode<ComponentType<{}>[]>;
101
103
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -1,12 +1,13 @@
1
1
  import React__default from "react";
2
- import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
3
- import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
2
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext.js";
3
+ import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection.js";
4
4
  import { mergeRegister } from "@lexical/utils";
5
5
  import { $isNodeSelection, $getSelection, $getNodeByKey, $setSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, CLICK_COMMAND, DRAGSTART_COMMAND, KEY_DELETE_COMMAND, KEY_BACKSPACE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND } from "lexical";
6
6
  import styles from "../../styles/ui.module.css.js";
7
7
  import classNames from "classnames";
8
8
  import { $isImageNode } from "./ImageNode.js";
9
9
  import ImageResizer from "./ImageResizer.js";
10
+ import { imagePluginHooks } from "./index.js";
10
11
  const imageCache = /* @__PURE__ */ new Set();
11
12
  function useSuspenseImage(src) {
12
13
  if (!imageCache.has(src)) {
@@ -39,6 +40,7 @@ function ImageEditor({ src, title, nodeKey, width, height }) {
39
40
  const [selection, setSelection] = React__default.useState(null);
40
41
  const activeEditorRef = React__default.useRef(null);
41
42
  const [isResizing, setIsResizing] = React__default.useState(false);
43
+ const [disableImageResize] = imagePluginHooks.useEmitterValues("disableImageResize");
42
44
  const onDelete = React__default.useCallback(
43
45
  (payload) => {
44
46
  if (isSelected && $isNodeSelection($getSelection())) {
@@ -170,7 +172,7 @@ function ImageEditor({ src, title, nodeKey, width, height }) {
170
172
  title: title || "",
171
173
  imageRef
172
174
  }
173
- )), draggable && isFocused && /* @__PURE__ */ React__default.createElement(ImageResizer, { editor, imageRef, onResizeStart, onResizeEnd })));
175
+ )), draggable && isFocused && !disableImageResize && /* @__PURE__ */ React__default.createElement(ImageResizer, { editor, imageRef, onResizeStart, onResizeEnd })));
174
176
  }
175
177
  export {
176
178
  ImageEditor
@@ -1,4 +1,4 @@
1
- import type { RefObject, ComponentType, ReactNode } from 'react';
1
+ import type { RefObject, ReactNode, ComponentType } from 'react';
2
2
  import type { Options } from 'mdast-util-to-markdown';
3
3
  import type { Config } from 'mdast-util-from-markdown/lib';
4
4
  import type { Extension } from 'micromark-util-types';
@@ -13,6 +13,7 @@ import type { SystemSpec, Realm, RealmNode, PluginConstructor, TypedRealm, Value
13
13
  import type { RangeSelection, Klass, LexicalNode, TextFormatType, ElementNode, DecoratorNode, LexicalCommand, LexicalEditor } from 'lexical';
14
14
  import { CreateImageNodeOptions } from './ImageNode';
15
15
  export * from './ImageNode';
16
+ export type ImageUploadHandler = ((image: File) => Promise<string>) | null;
16
17
  /** @internal */
17
18
  export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
18
19
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -43,6 +44,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
43
44
  markdown: RealmNode<string>;
44
45
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
45
46
  contentEditableClassName: RealmNode<string>;
47
+ placeholder: RealmNode<ReactNode>;
46
48
  autoFocus: RealmNode<boolean>;
47
49
  composerChildren: RealmNode<ComponentType<{}>[]>;
48
50
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -92,6 +94,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
92
94
  markdown: RealmNode<string>;
93
95
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
94
96
  contentEditableClassName: RealmNode<string>;
97
+ placeholder: RealmNode<ReactNode>;
95
98
  autoFocus: RealmNode<boolean>;
96
99
  composerChildren: RealmNode<ComponentType<{}>[]>;
97
100
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -113,13 +116,15 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
113
116
  convertSelectionToNode: RealmNode<() => ElementNode>;
114
117
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
115
118
  }]) => {
116
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
119
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
117
120
  imageAutocompleteSuggestions: RealmNode<string[]>;
121
+ disableImageResize: RealmNode<boolean>;
118
122
  insertImage: RealmNode<string>;
119
123
  }>;
120
124
  interface ImagePluginParams {
121
- imageUploadHandler: (image: File) => Promise<string>;
125
+ imageUploadHandler?: ImageUploadHandler;
122
126
  imageAutocompleteSuggestions?: string[];
127
+ disableImageResize?: boolean;
123
128
  }
124
129
  export declare const
125
130
  /** @internal */
@@ -152,6 +157,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
152
157
  markdown: RealmNode<string>;
153
158
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
154
159
  contentEditableClassName: RealmNode<string>;
160
+ placeholder: RealmNode<ReactNode>;
155
161
  autoFocus: RealmNode<boolean>;
156
162
  composerChildren: RealmNode<ComponentType<{}>[]>;
157
163
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -201,6 +207,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
201
207
  markdown: RealmNode<string>;
202
208
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
203
209
  contentEditableClassName: RealmNode<string>;
210
+ placeholder: RealmNode<ReactNode>;
204
211
  autoFocus: RealmNode<boolean>;
205
212
  composerChildren: RealmNode<ComponentType<{}>[]>;
206
213
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -222,15 +229,17 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
222
229
  convertSelectionToNode: RealmNode<() => ElementNode>;
223
230
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
224
231
  }]) => {
225
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
232
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
226
233
  imageAutocompleteSuggestions: RealmNode<string[]>;
234
+ disableImageResize: RealmNode<boolean>;
227
235
  insertImage: RealmNode<string>;
228
236
  }>, ImagePluginParams>,
229
237
  /** @internal */
230
238
  imagePluginHooks: {
231
239
  useRealmContext: () => TypedRealm<{
232
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
240
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
233
241
  imageAutocompleteSuggestions: RealmNode<string[]>;
242
+ disableImageResize: RealmNode<boolean>;
234
243
  insertImage: RealmNode<string>;
235
244
  } & {
236
245
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -261,6 +270,7 @@ imagePluginHooks: {
261
270
  markdown: RealmNode<string>;
262
271
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
263
272
  contentEditableClassName: RealmNode<string>;
273
+ placeholder: RealmNode<ReactNode>;
264
274
  autoFocus: RealmNode<boolean>;
265
275
  composerChildren: RealmNode<ComponentType<{}>[]>;
266
276
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -282,9 +292,10 @@ imagePluginHooks: {
282
292
  convertSelectionToNode: RealmNode<() => ElementNode>;
283
293
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
284
294
  }>;
285
- useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "insertImage">(key: K, callback: (value: ValueForKey<{
286
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
295
+ useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K, callback: (value: ValueForKey<{
296
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
287
297
  imageAutocompleteSuggestions: RealmNode<string[]>;
298
+ disableImageResize: RealmNode<boolean>;
288
299
  insertImage: RealmNode<string>;
289
300
  } & {
290
301
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -315,6 +326,7 @@ imagePluginHooks: {
315
326
  markdown: RealmNode<string>;
316
327
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
317
328
  contentEditableClassName: RealmNode<string>;
329
+ placeholder: RealmNode<ReactNode>;
318
330
  autoFocus: RealmNode<boolean>;
319
331
  composerChildren: RealmNode<ComponentType<{}>[]>;
320
332
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -337,8 +349,9 @@ imagePluginHooks: {
337
349
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
338
350
  }, K>) => void) => void;
339
351
  useEmitterValues: <K_1 extends SystemKeys<{
340
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
352
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
341
353
  imageAutocompleteSuggestions: RealmNode<string[]>;
354
+ disableImageResize: RealmNode<boolean>;
342
355
  insertImage: RealmNode<string>;
343
356
  } & {
344
357
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -369,6 +382,7 @@ imagePluginHooks: {
369
382
  markdown: RealmNode<string>;
370
383
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
371
384
  contentEditableClassName: RealmNode<string>;
385
+ placeholder: RealmNode<ReactNode>;
372
386
  autoFocus: RealmNode<boolean>;
373
387
  composerChildren: RealmNode<ComponentType<{}>[]>;
374
388
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -390,8 +404,9 @@ imagePluginHooks: {
390
404
  convertSelectionToNode: RealmNode<() => ElementNode>;
391
405
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
392
406
  }>>(...keys: K_1) => ValuesForKeys<{
393
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
407
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
394
408
  imageAutocompleteSuggestions: RealmNode<string[]>;
409
+ disableImageResize: RealmNode<boolean>;
395
410
  insertImage: RealmNode<string>;
396
411
  } & {
397
412
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -422,6 +437,7 @@ imagePluginHooks: {
422
437
  markdown: RealmNode<string>;
423
438
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
424
439
  contentEditableClassName: RealmNode<string>;
440
+ placeholder: RealmNode<ReactNode>;
425
441
  autoFocus: RealmNode<boolean>;
426
442
  composerChildren: RealmNode<ComponentType<{}>[]>;
427
443
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -444,8 +460,9 @@ imagePluginHooks: {
444
460
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
445
461
  }, K_1>;
446
462
  usePubKeys: () => (values: SystemDict<{
447
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
463
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
448
464
  imageAutocompleteSuggestions: RealmNode<string[]>;
465
+ disableImageResize: RealmNode<boolean>;
449
466
  insertImage: RealmNode<string>;
450
467
  } & {
451
468
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -476,6 +493,7 @@ imagePluginHooks: {
476
493
  markdown: RealmNode<string>;
477
494
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
478
495
  contentEditableClassName: RealmNode<string>;
496
+ placeholder: RealmNode<ReactNode>;
479
497
  autoFocus: RealmNode<boolean>;
480
498
  composerChildren: RealmNode<ComponentType<{}>[]>;
481
499
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -497,9 +515,10 @@ imagePluginHooks: {
497
515
  convertSelectionToNode: RealmNode<() => ElementNode>;
498
516
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
499
517
  }>) => void;
500
- usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "insertImage">(key: K_2) => (value: ValueForKey<{
501
- imageUploadHandler: RealmNode<(image: File) => Promise<string>>;
518
+ usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K_2) => (value: ValueForKey<{
519
+ imageUploadHandler: RealmNode<ImageUploadHandler>;
502
520
  imageAutocompleteSuggestions: RealmNode<string[]>;
521
+ disableImageResize: RealmNode<boolean>;
503
522
  insertImage: RealmNode<string>;
504
523
  } & {
505
524
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -530,6 +549,7 @@ imagePluginHooks: {
530
549
  markdown: RealmNode<string>;
531
550
  editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
532
551
  contentEditableClassName: RealmNode<string>;
552
+ placeholder: RealmNode<ReactNode>;
533
553
  autoFocus: RealmNode<boolean>;
534
554
  composerChildren: RealmNode<ComponentType<{}>[]>;
535
555
  addComposerChild: RealmNode<ComponentType<{}>>;
@@ -11,9 +11,8 @@ const imageSystem = system(
11
11
  (r, [{ rootEditor }]) => {
12
12
  const insertImage = r.node();
13
13
  const imageAutocompleteSuggestions = r.node([]);
14
- const imageUploadHandler = r.node((_) => {
15
- throw new Error("Image upload handling is not implemented");
16
- });
14
+ const disableImageResize = r.node(false);
15
+ const imageUploadHandler = r.node(null);
17
16
  r.sub(r.pipe(insertImage, r.o.withLatestFrom(rootEditor)), ([src, theEditor]) => {
18
17
  theEditor == null ? void 0 : theEditor.update(() => {
19
18
  const imageNode = $createImageNode({ altText: "", src, title: "" });
@@ -36,6 +35,7 @@ const imageSystem = system(
36
35
  },
37
36
  COMMAND_PRIORITY_EDITOR
38
37
  );
38
+ const theUploadHandler = r.getValue(imageUploadHandler);
39
39
  editor == null ? void 0 : editor.registerCommand(
40
40
  DRAGSTART_COMMAND,
41
41
  (event) => {
@@ -57,6 +57,9 @@ const imageSystem = system(
57
57
  },
58
58
  COMMAND_PRIORITY_HIGH
59
59
  );
60
+ if (theUploadHandler === null) {
61
+ return;
62
+ }
60
63
  editor == null ? void 0 : editor.registerCommand(
61
64
  PASTE_COMMAND,
62
65
  (event) => {
@@ -82,16 +85,12 @@ const imageSystem = system(
82
85
  return {
83
86
  imageUploadHandler,
84
87
  imageAutocompleteSuggestions,
88
+ disableImageResize,
85
89
  insertImage
86
90
  };
87
91
  },
88
92
  [coreSystem]
89
93
  );
90
- const defaultParams = {
91
- imageUploadHandler: () => {
92
- throw new Error("Image upload handling is not implemented");
93
- }
94
- };
95
94
  const [
96
95
  /** @internal */
97
96
  imagePlugin,
@@ -100,9 +99,10 @@ const [
100
99
  ] = realmPlugin({
101
100
  id: "image",
102
101
  systemSpec: imageSystem,
103
- applyParamsToSystem: (realm, params = defaultParams) => {
104
- realm.pubKey("imageUploadHandler", params.imageUploadHandler);
105
- realm.pubKey("imageAutocompleteSuggestions", params.imageAutocompleteSuggestions || []);
102
+ applyParamsToSystem: (realm, params) => {
103
+ realm.pubKey("imageUploadHandler", (params == null ? void 0 : params.imageUploadHandler) || null);
104
+ realm.pubKey("imageAutocompleteSuggestions", (params == null ? void 0 : params.imageAutocompleteSuggestions) || []);
105
+ realm.pubKey("disableImageResize", Boolean(params == null ? void 0 : params.disableImageResize));
106
106
  },
107
107
  init: (realm) => {
108
108
  realm.pubKey("addImportVisitor", MdastImageVisitor);
@@ -164,18 +164,20 @@ function onDrop(event, editor, imageUploadHandler) {
164
164
  let cbPayload = Array.from(((_a = event.dataTransfer) == null ? void 0 : _a.items) || []);
165
165
  cbPayload = cbPayload.filter((i) => /image/.test(i.type));
166
166
  if (cbPayload.length > 0) {
167
- event.preventDefault();
168
- Promise.all(cbPayload.map((image) => imageUploadHandler(image.getAsFile()))).then((urls) => {
169
- urls.forEach((url) => {
170
- editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
171
- src: url,
172
- altText: ""
167
+ if (imageUploadHandler !== null) {
168
+ event.preventDefault();
169
+ Promise.all(cbPayload.map((image) => imageUploadHandler(image.getAsFile()))).then((urls) => {
170
+ urls.forEach((url) => {
171
+ editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
172
+ src: url,
173
+ altText: ""
174
+ });
173
175
  });
176
+ }).catch((e) => {
177
+ throw e;
174
178
  });
175
- }).catch((e) => {
176
- throw e;
177
- });
178
- return true;
179
+ return true;
180
+ }
179
181
  }
180
182
  const node = getImageNodeInSelection();
181
183
  if (!node) {