@lobehub/editor 4.15.2 → 4.16.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.
Files changed (63) hide show
  1. package/es/editor-kernel/react/useDecorators.js +14 -8
  2. package/es/headless/index.d.ts +1 -1
  3. package/es/headless/index.js +1 -1
  4. package/es/headless.d.ts +3 -18
  5. package/es/headless.js +711 -52
  6. package/es/index.d.ts +5 -5
  7. package/es/index.js +5 -5
  8. package/es/locale/index.d.ts +2 -0
  9. package/es/locale/index.js +5 -1
  10. package/es/plugins/auto-complete/plugin/index.js +3 -3
  11. package/es/plugins/block/index.d.ts +1 -1
  12. package/es/plugins/block/plugin/index.js +78 -2
  13. package/es/plugins/block/react/ReactBlockPlugin.js +172 -16
  14. package/es/plugins/block/react/drag/drag-utils.js +37 -10
  15. package/es/plugins/block/service/i-block-menu-service.d.ts +18 -1
  16. package/es/plugins/block/service/i-block-menu-service.js +24 -0
  17. package/es/plugins/block/service/index.d.ts +1 -1
  18. package/es/plugins/codeblock/plugin/index.js +25 -1
  19. package/es/plugins/common/plugin/register.js +2 -2
  20. package/es/plugins/litexml/command/diffCommand.d.ts +2 -17
  21. package/es/plugins/litexml/command/diffCommand.js +3 -9
  22. package/es/plugins/litexml/command/index.d.ts +2 -38
  23. package/es/plugins/litexml/command/index.js +3 -6
  24. package/es/plugins/litexml/command/symbols.d.ts +67 -0
  25. package/es/plugins/litexml/command/symbols.js +34 -0
  26. package/es/plugins/litexml/index.d.ts +1 -2
  27. package/es/plugins/litexml/plugin/index.js +8 -2
  28. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -1
  29. package/es/plugins/slash/plugin/index.js +1 -1
  30. package/es/plugins/slash/react/ReactSlashPlugin.js +4 -4
  31. package/es/plugins/table/command/index.d.ts +13 -1
  32. package/es/plugins/table/command/index.js +220 -39
  33. package/es/plugins/table/index.d.ts +3 -2
  34. package/es/plugins/table/node/index.d.ts +2 -0
  35. package/es/plugins/table/node/index.js +130 -2
  36. package/es/plugins/table/plugin/index.d.ts +6 -0
  37. package/es/plugins/table/plugin/index.js +193 -4
  38. package/es/plugins/table/react/TableActionMenu/ActionMenu.js +82 -6
  39. package/es/plugins/table/react/TableActionMenu/index.js +9 -4
  40. package/es/plugins/table/react/TableColController.js +354 -0
  41. package/es/plugins/table/react/TableController/hooks.js +201 -0
  42. package/es/plugins/table/react/TableController/style.js +264 -0
  43. package/es/plugins/table/react/TableController/utils.js +25 -0
  44. package/es/plugins/table/react/TableControllerButton.js +81 -0
  45. package/es/plugins/table/react/TableControllerMenu.js +123 -0
  46. package/es/plugins/table/react/TableInsertButton.js +25 -0
  47. package/es/plugins/table/react/TableResize/index.js +153 -78
  48. package/es/plugins/table/react/TableRowController.js +349 -0
  49. package/es/plugins/table/react/hooks.js +77 -0
  50. package/es/plugins/table/react/index.js +139 -16
  51. package/es/plugins/table/react/style.js +89 -8
  52. package/es/plugins/table/react/type.d.ts +2 -0
  53. package/es/plugins/table/react/useAutoFitPastedTable.js +189 -0
  54. package/es/plugins/table/service/i-table-controller-menu-service.d.ts +44 -0
  55. package/es/plugins/table/service/i-table-controller-menu-service.js +31 -0
  56. package/es/plugins/table/service/index.d.ts +1 -0
  57. package/es/plugins/table/utils/autoFitColumnWidth.js +87 -0
  58. package/es/plugins/table/utils/distributeColumnWidth.js +37 -0
  59. package/es/plugins/table/utils/index.js +102 -2
  60. package/es/react/EditorProvider/index.d.ts +2 -2
  61. package/es/renderer/LexicalDiff.d.ts +2 -2
  62. package/es/symbols-DEEvsKq4.d.ts +67 -0
  63. package/package.json +5 -1
@@ -33,15 +33,21 @@ function useDecorators(editor, ErrorBoundary) {
33
33
  const decoratorKeys = Object.keys(decorators);
34
34
  for (const nodeKey of decoratorKeys) {
35
35
  const decorator = decorators[nodeKey];
36
- const reactDecorator = /* @__PURE__ */ jsx(ErrorBoundary, {
37
- onError: (e) => editor.getLexicalEditor()?._onError(e),
38
- children: /* @__PURE__ */ jsx(Suspense, {
39
- fallback: null,
40
- children: "render" in decorator ? decorator.render : decorator
41
- })
42
- });
43
36
  const element = editor.getLexicalEditor()?.getElementByKey(nodeKey);
44
- if (element !== null && element !== void 0) decoratedPortals.push(createPortal(reactDecorator, "queryDOM" in decorator ? decorator.queryDOM(element) : element, nodeKey));
37
+ if (element !== null && element !== void 0) ("multi" in decorator ? decorator.multi : ["queryDOM" in decorator ? decorator : {
38
+ queryDOM: () => element,
39
+ render: decorator
40
+ }]).forEach((portalDecorator, index) => {
41
+ const targetElement = portalDecorator.queryDOM(element);
42
+ if (!(targetElement instanceof HTMLElement)) return;
43
+ decoratedPortals.push(createPortal(/* @__PURE__ */ jsx(ErrorBoundary, {
44
+ onError: (e) => editor.getLexicalEditor()?._onError(e),
45
+ children: /* @__PURE__ */ jsx(Suspense, {
46
+ fallback: null,
47
+ children: portalDecorator.render
48
+ })
49
+ }), targetElement, `${nodeKey}:${index}`));
50
+ });
45
51
  }
46
52
  return decoratedPortals;
47
53
  }, [
@@ -1,5 +1,5 @@
1
1
  import { IDocumentOptions, IEditor, IPlugin } from "../types/kernel.js";
2
- import { LITEXML_MODIFY_COMMAND } from "../plugins/litexml/command/index.js";
2
+ import { LITEXML_MODIFY_COMMAND } from "../plugins/litexml/command/symbols.js";
3
3
  import { FileListItem, ImageListItem, MediaLists, extractMediaFromEditorState } from "./extract-media-from-editor-state.js";
4
4
  import { CommandPayloadType, SerializedEditorState, SerializedLexicalNode } from "lexical";
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { moment } from "../editor-kernel/utils.js";
2
2
  import Editor from "../editor-kernel/index.js";
3
- import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "../plugins/litexml/command/index.js";
3
+ import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "../plugins/litexml/command/symbols.js";
4
4
  import { MarkdownPlugin } from "../plugins/markdown/plugin/index.js";
5
5
  import { LitexmlPlugin } from "../plugins/litexml/plugin/index.js";
6
6
  import { CommonPlugin } from "../plugins/common/plugin/index.js";
package/es/headless.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { o as LITEXML_MODIFY_COMMAND } from "./symbols-DEEvsKq4.js";
1
2
  import { HistoryState, HistoryStateEntry } from "@lexical/history";
2
- import * as _$lexical from "lexical";
3
3
  import { CommandListener, CommandListenerPriority, CommandPayloadType, EditorState, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, SerializedEditorState, SerializedLexicalNode } from "lexical";
4
4
 
5
5
  //#region src/editor-kernel/data-source.d.ts
@@ -55,7 +55,9 @@ type HotkeyOptions = {
55
55
  //#region src/locale/index.d.ts
56
56
  declare const _default: {
57
57
  block: {
58
+ copy: string;
58
59
  delete: string;
60
+ select: string;
59
61
  };
60
62
  cancel: string;
61
63
  codemirror: {
@@ -471,23 +473,6 @@ interface IEditorPluginConstructor<IConfig> {
471
473
  }
472
474
  type IPlugin<T = any> = IEditorPluginConstructor<T> | [IEditorPluginConstructor<T>, T?];
473
475
  //#endregion
474
- //#region src/plugins/litexml/command/index.d.ts
475
- declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
476
- action: "insert";
477
- beforeId: string;
478
- litexml: string;
479
- } | {
480
- action: "insert";
481
- afterId: string;
482
- litexml: string;
483
- } | {
484
- action: "remove";
485
- id: string;
486
- } | {
487
- action: "modify";
488
- litexml: string | string[];
489
- })[]>;
490
- //#endregion
491
476
  //#region src/headless/extract-media-from-editor-state.d.ts
492
477
  interface ImageListItem {
493
478
  alt: string;