@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.
- package/es/editor-kernel/react/useDecorators.js +14 -8
- package/es/headless.d.ts +2 -0
- package/es/headless.js +710 -46
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -3
- package/es/locale/index.d.ts +2 -0
- package/es/locale/index.js +5 -1
- package/es/plugins/auto-complete/plugin/index.js +3 -3
- package/es/plugins/block/index.d.ts +1 -1
- package/es/plugins/block/plugin/index.js +78 -2
- package/es/plugins/block/react/ReactBlockPlugin.js +172 -16
- package/es/plugins/block/react/drag/drag-utils.js +37 -10
- package/es/plugins/block/service/i-block-menu-service.d.ts +18 -1
- package/es/plugins/block/service/i-block-menu-service.js +24 -0
- package/es/plugins/block/service/index.d.ts +1 -1
- package/es/plugins/codeblock/plugin/index.js +25 -1
- package/es/plugins/common/plugin/register.js +2 -2
- package/es/plugins/litexml/plugin/index.js +8 -2
- package/es/plugins/slash/plugin/index.js +1 -1
- package/es/plugins/slash/react/ReactSlashPlugin.js +4 -4
- package/es/plugins/table/command/index.d.ts +13 -1
- package/es/plugins/table/command/index.js +220 -39
- package/es/plugins/table/index.d.ts +3 -2
- package/es/plugins/table/node/index.d.ts +2 -0
- package/es/plugins/table/node/index.js +130 -2
- package/es/plugins/table/plugin/index.d.ts +6 -0
- package/es/plugins/table/plugin/index.js +193 -4
- package/es/plugins/table/react/TableActionMenu/ActionMenu.js +82 -6
- package/es/plugins/table/react/TableActionMenu/index.js +9 -4
- package/es/plugins/table/react/TableColController.js +354 -0
- package/es/plugins/table/react/TableController/hooks.js +201 -0
- package/es/plugins/table/react/TableController/style.js +264 -0
- package/es/plugins/table/react/TableController/utils.js +25 -0
- package/es/plugins/table/react/TableControllerButton.js +81 -0
- package/es/plugins/table/react/TableControllerMenu.js +123 -0
- package/es/plugins/table/react/TableInsertButton.js +25 -0
- package/es/plugins/table/react/TableResize/index.js +153 -78
- package/es/plugins/table/react/TableRowController.js +349 -0
- package/es/plugins/table/react/hooks.js +77 -0
- package/es/plugins/table/react/index.js +139 -16
- package/es/plugins/table/react/style.js +89 -8
- package/es/plugins/table/react/type.d.ts +2 -0
- package/es/plugins/table/react/useAutoFitPastedTable.js +189 -0
- package/es/plugins/table/service/i-table-controller-menu-service.d.ts +44 -0
- package/es/plugins/table/service/i-table-controller-menu-service.js +31 -0
- package/es/plugins/table/service/index.d.ts +1 -0
- package/es/plugins/table/utils/autoFitColumnWidth.js +87 -0
- package/es/plugins/table/utils/distributeColumnWidth.js +37 -0
- package/es/plugins/table/utils/index.js +102 -2
- package/es/react/EditorProvider/index.d.ts +2 -2
- package/es/renderer/LexicalDiff.d.ts +2 -2
- 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)
|
|
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
|
}, [
|