@lobehub/editor 4.15.2 → 4.16.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 (52) hide show
  1. package/es/editor-kernel/react/useDecorators.js +14 -8
  2. package/es/headless.d.ts +2 -0
  3. package/es/headless.js +710 -46
  4. package/es/index.d.ts +4 -3
  5. package/es/index.js +4 -3
  6. package/es/locale/index.d.ts +2 -0
  7. package/es/locale/index.js +5 -1
  8. package/es/plugins/auto-complete/plugin/index.js +3 -3
  9. package/es/plugins/block/index.d.ts +1 -1
  10. package/es/plugins/block/plugin/index.js +78 -2
  11. package/es/plugins/block/react/ReactBlockPlugin.js +172 -16
  12. package/es/plugins/block/react/drag/drag-utils.js +37 -10
  13. package/es/plugins/block/service/i-block-menu-service.d.ts +18 -1
  14. package/es/plugins/block/service/i-block-menu-service.js +24 -0
  15. package/es/plugins/block/service/index.d.ts +1 -1
  16. package/es/plugins/codeblock/plugin/index.js +25 -1
  17. package/es/plugins/common/plugin/register.js +2 -2
  18. package/es/plugins/litexml/plugin/index.js +8 -2
  19. package/es/plugins/slash/plugin/index.js +1 -1
  20. package/es/plugins/slash/react/ReactSlashPlugin.js +4 -4
  21. package/es/plugins/table/command/index.d.ts +13 -1
  22. package/es/plugins/table/command/index.js +220 -39
  23. package/es/plugins/table/index.d.ts +3 -2
  24. package/es/plugins/table/node/index.d.ts +2 -0
  25. package/es/plugins/table/node/index.js +130 -2
  26. package/es/plugins/table/plugin/index.d.ts +6 -0
  27. package/es/plugins/table/plugin/index.js +193 -4
  28. package/es/plugins/table/react/TableActionMenu/ActionMenu.js +82 -6
  29. package/es/plugins/table/react/TableActionMenu/index.js +9 -4
  30. package/es/plugins/table/react/TableColController.js +354 -0
  31. package/es/plugins/table/react/TableController/hooks.js +201 -0
  32. package/es/plugins/table/react/TableController/style.js +264 -0
  33. package/es/plugins/table/react/TableController/utils.js +25 -0
  34. package/es/plugins/table/react/TableControllerButton.js +81 -0
  35. package/es/plugins/table/react/TableControllerMenu.js +123 -0
  36. package/es/plugins/table/react/TableInsertButton.js +25 -0
  37. package/es/plugins/table/react/TableResize/index.js +153 -78
  38. package/es/plugins/table/react/TableRowController.js +349 -0
  39. package/es/plugins/table/react/hooks.js +77 -0
  40. package/es/plugins/table/react/index.js +139 -16
  41. package/es/plugins/table/react/style.js +89 -8
  42. package/es/plugins/table/react/type.d.ts +2 -0
  43. package/es/plugins/table/react/useAutoFitPastedTable.js +189 -0
  44. package/es/plugins/table/service/i-table-controller-menu-service.d.ts +44 -0
  45. package/es/plugins/table/service/i-table-controller-menu-service.js +31 -0
  46. package/es/plugins/table/service/index.d.ts +1 -0
  47. package/es/plugins/table/utils/autoFitColumnWidth.js +87 -0
  48. package/es/plugins/table/utils/distributeColumnWidth.js +37 -0
  49. package/es/plugins/table/utils/index.js +102 -2
  50. package/es/react/EditorProvider/index.d.ts +2 -2
  51. package/es/renderer/LexicalDiff.d.ts +2 -2
  52. package/package.json +1 -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
  }, [
package/es/headless.d.ts CHANGED
@@ -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: {