@byline/richtext-lexical 1.11.2 → 1.12.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/dist/field/apply-value-plugin.js +1 -3
- package/dist/field/config/default-extensions.d.ts +32 -0
- package/dist/field/config/default-extensions.js +49 -0
- package/dist/field/config/default.d.ts +8 -0
- package/dist/field/config/default.js +0 -28
- package/dist/field/config/editor-config-context.js +2 -6
- package/dist/field/config/extensions-list.d.ts +44 -0
- package/dist/field/config/extensions-list.js +55 -0
- package/dist/field/config/types.d.ts +28 -1
- package/dist/field/editor-context.d.ts +1 -1
- package/dist/field/editor-context.js +39 -35
- package/dist/field/editor.js +11 -57
- package/dist/field/{plugins/admonition-plugin/index.d.ts → extensions/admonition/admonition-extension.d.ts} +2 -1
- package/dist/field/{plugins/admonition-plugin/index.js → extensions/admonition/admonition-extension.js} +51 -4
- package/dist/field/{nodes/admonition-node → extensions/admonition}/admonition-node-component.d.ts +1 -1
- package/dist/field/{nodes/admonition-node → extensions/admonition}/admonition-node-component.js +1 -1
- package/dist/field/{nodes/admonition-node → extensions/admonition}/admonition-node.d.ts +1 -1
- package/dist/field/{plugins/admonition-plugin → extensions/admonition}/fields.d.ts +1 -1
- package/dist/field/{nodes/admonition-node → extensions/admonition}/index.js +1 -1
- package/dist/field/{plugins/admonition-plugin → extensions/admonition}/types.d.ts +1 -1
- package/dist/field/{plugins/auto-embed-plugin/index.d.ts → extensions/auto-embed/auto-embed-extension.d.ts} +1 -0
- package/dist/field/{plugins/auto-embed-plugin/index.js → extensions/auto-embed/auto-embed-extension.js} +47 -4
- package/dist/field/{plugins/auto-embed-plugin → extensions/auto-embed}/auto-embed-modal.d.ts +1 -1
- package/dist/field/extensions/byline-floating-ui/byline-floating-ui-extension.d.ts +68 -0
- package/dist/field/extensions/byline-floating-ui/byline-floating-ui-extension.js +19 -0
- package/dist/field/{nodes/admonition-node → extensions/byline-floating-ui}/index.d.ts +1 -2
- package/dist/field/extensions/byline-floating-ui/index.js +1 -0
- package/dist/field/extensions/byline-toolbar/byline-toolbar-extension.d.ts +69 -0
- package/dist/field/extensions/byline-toolbar/byline-toolbar-extension.js +19 -0
- package/dist/field/{nodes/inline-image-node → extensions/byline-toolbar}/index.d.ts +1 -2
- package/dist/field/extensions/byline-toolbar/index.js +1 -0
- package/dist/field/extensions/code-highlight/code-highlight-extension.d.ts +10 -0
- package/dist/field/extensions/code-highlight/code-highlight-extension.js +11 -0
- package/dist/field/extensions/floating-text-format/floating-text-format-extension.d.ts +18 -0
- package/dist/field/extensions/floating-text-format/floating-text-format-extension.js +17 -0
- package/dist/field/{plugins/floating-text-format-toolbar-plugin → extensions/floating-text-format}/index.js +1 -1
- package/dist/field/extensions/horizontal-rule/horizontal-rule-extension.d.ts +6 -0
- package/dist/field/extensions/horizontal-rule/horizontal-rule-extension.js +45 -0
- package/dist/field/{nodes/inline-image-node → extensions/inline-image}/index.js +1 -1
- package/dist/field/{plugins/inline-image-plugin/index.d.ts → extensions/inline-image/inline-image-extension.d.ts} +6 -3
- package/dist/field/{plugins/inline-image-plugin/index.js → extensions/inline-image/inline-image-extension.js} +57 -5
- package/dist/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node-component.d.ts +2 -2
- package/dist/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node-component.js +4 -4
- package/dist/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node.d.ts +2 -2
- package/dist/field/{nodes/inline-image-node/types.d.ts → extensions/inline-image/node-types.d.ts} +1 -1
- package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/types.d.ts +1 -1
- package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/utils.d.ts +1 -1
- package/dist/field/{plugins/layout-plugin/layout-plugin.d.ts → extensions/layout/layout-extension.d.ts} +1 -0
- package/dist/field/{plugins/layout-plugin/layout-plugin.js → extensions/layout/layout-extension.js} +53 -5
- package/dist/field/extensions/link/auto-link-extension.d.ts +12 -0
- package/dist/field/{plugins/link-plugin/auto-link/index.js → extensions/link/auto-link-extension.js} +14 -2
- package/dist/field/{plugins/link-plugin/auto-link → extensions/link}/auto-link-plugin.d.ts +1 -1
- package/dist/field/{plugins/link-plugin/auto-link → extensions/link}/auto-link-plugin.js +2 -2
- package/dist/field/{plugins/link-plugin → extensions}/link/floating-link-editor.css +2 -2
- package/dist/field/{plugins/link-plugin → extensions}/link/floating-link-editor.js +4 -4
- package/dist/field/extensions/link/index.d.ts +5 -0
- package/dist/field/extensions/link/index.js +5 -0
- package/dist/field/extensions/link/link-extension.d.ts +14 -0
- package/dist/field/extensions/link/link-extension.js +66 -0
- package/dist/field/{plugins/link-plugin/link/types.d.ts → extensions/link/link-modal-types.d.ts} +1 -1
- package/dist/field/{plugins/link-plugin → extensions}/link/link-modal.d.ts +1 -1
- package/dist/field/{plugins/link-plugin → extensions}/link/link-modal.js +3 -3
- package/dist/field/{nodes/link-nodes → extensions/link}/types.d.ts +1 -1
- package/dist/field/extensions/table/table-action-menu-plugin/index.d.ts +4 -0
- package/dist/field/{plugins → extensions/table}/table-action-menu-plugin/index.js +8 -6
- package/dist/field/extensions/table/table-extension.d.ts +17 -0
- package/dist/field/extensions/table/table-extension.js +58 -0
- package/dist/field/extensions/vimeo/vimeo-extension.d.ts +12 -0
- package/dist/field/extensions/vimeo/vimeo-extension.js +16 -0
- package/dist/field/extensions/youtube/youtube-extension.d.ts +12 -0
- package/dist/field/extensions/youtube/youtube-extension.js +16 -0
- package/dist/field/nodes/index.js +7 -7
- package/dist/field/plugins/table-plugin/index.js +5 -6
- package/dist/field/plugins/toolbar-plugin/index.js +40 -114
- package/dist/field/plugins/toolbar-plugin/toolbar-active-editor.d.ts +25 -0
- package/dist/field/plugins/toolbar-plugin/toolbar-active-editor.js +17 -0
- package/dist/field/themes/lexical-editor-theme.css +13 -3
- package/dist/field/themes/lexical-editor-theme.js +1 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +16 -0
- package/dist/lexical-editor.d.ts +25 -13
- package/dist/lexical-editor.js +9 -1
- package/dist/richtext-field.js +6 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/package.json +7 -10
- package/src/field/apply-value-plugin.tsx +6 -6
- package/src/field/config/default-extensions.ts +104 -0
- package/src/field/config/default.ts +8 -28
- package/src/field/config/editor-config-context.tsx +1 -7
- package/src/field/config/extensions-list.ts +107 -0
- package/src/field/config/types.ts +28 -28
- package/src/field/editor-context.tsx +77 -41
- package/src/field/editor.tsx +24 -72
- package/src/field/extensions/README.md +31 -0
- package/src/field/{plugins/admonition-plugin/index.tsx → extensions/admonition/admonition-extension.tsx} +45 -2
- package/src/field/{plugins/admonition-plugin → extensions/admonition}/admonition-modal.tsx +1 -1
- package/src/field/{nodes/admonition-node → extensions/admonition}/admonition-node-component.tsx +5 -5
- package/src/field/{nodes/admonition-node → extensions/admonition}/admonition-node.tsx +1 -1
- package/src/field/{plugins/admonition-plugin → extensions/admonition}/fields.ts +1 -1
- package/src/field/{nodes/admonition-node → extensions/admonition}/index.ts +5 -1
- package/src/field/{plugins/admonition-plugin → extensions/admonition}/types.ts +1 -1
- package/src/field/{plugins/auto-embed-plugin/index.tsx → extensions/auto-embed/auto-embed-extension.tsx} +46 -3
- package/src/field/{plugins/auto-embed-plugin → extensions/auto-embed}/auto-embed-modal.tsx +1 -1
- package/src/field/extensions/byline-floating-ui/byline-floating-ui-extension.ts +90 -0
- package/src/field/extensions/byline-floating-ui/index.ts +15 -0
- package/src/field/extensions/byline-toolbar/byline-toolbar-extension.ts +95 -0
- package/src/field/extensions/byline-toolbar/index.ts +15 -0
- package/src/field/extensions/code-highlight/code-highlight-extension.ts +18 -0
- package/src/field/extensions/floating-text-format/floating-text-format-extension.ts +39 -0
- package/src/field/{plugins/floating-text-format-toolbar-plugin → extensions/floating-text-format}/index.tsx +1 -1
- package/src/field/extensions/horizontal-rule/horizontal-rule-extension.tsx +57 -0
- package/src/field/{nodes/inline-image-node → extensions/inline-image}/index.ts +1 -1
- package/src/field/{plugins/inline-image-plugin/index.tsx → extensions/inline-image/inline-image-extension.tsx} +54 -6
- package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/inline-image-modal.tsx +1 -1
- package/src/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node-component.tsx +6 -6
- package/src/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node.tsx +2 -2
- package/src/field/{nodes/inline-image-node/types.ts → extensions/inline-image/node-types.ts} +1 -1
- package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/types.ts +1 -1
- package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/utils.ts +1 -1
- package/src/field/{plugins/layout-plugin/layout-plugin.tsx → extensions/layout/layout-extension.tsx} +47 -8
- package/src/field/{plugins/link-plugin/auto-link/index.tsx → extensions/link/auto-link-extension.tsx} +13 -3
- package/src/field/{plugins/link-plugin/auto-link → extensions/link}/auto-link-plugin.tsx +2 -2
- package/src/field/{plugins/link-plugin → extensions}/link/floating-link-editor.css +2 -2
- package/src/field/{plugins/link-plugin → extensions}/link/floating-link-editor.tsx +5 -5
- package/src/field/extensions/link/index.ts +5 -0
- package/src/field/extensions/link/link-extension.tsx +131 -0
- package/src/field/{plugins/link-plugin/link/types.ts → extensions/link/link-modal-types.ts} +1 -1
- package/src/field/{plugins/link-plugin → extensions}/link/link-modal.tsx +6 -6
- package/src/field/{nodes/link-nodes → extensions/link}/types.ts +1 -1
- package/src/field/{plugins → extensions/table}/table-action-menu-plugin/index.tsx +12 -8
- package/src/field/extensions/table/table-extension.tsx +86 -0
- package/src/field/extensions/vimeo/vimeo-extension.ts +36 -0
- package/src/field/extensions/youtube/youtube-extension.ts +37 -0
- package/src/field/nodes/index.ts +7 -7
- package/src/field/plugins/table-plugin/index.tsx +10 -10
- package/src/field/plugins/toolbar-plugin/index.tsx +59 -122
- package/src/field/plugins/toolbar-plugin/toolbar-active-editor.tsx +48 -0
- package/src/field/themes/lexical-editor-theme.css +18 -3
- package/src/field/themes/lexical-editor-theme.tsx +1 -0
- package/src/index.ts +45 -2
- package/src/lexical-editor.tsx +35 -14
- package/src/richtext-field.tsx +8 -1
- package/src/server.ts +4 -4
- package/dist/field/nodes/link-nodes/index.d.ts +0 -3
- package/dist/field/nodes/link-nodes/index.js +0 -3
- package/dist/field/plugins/code-highlight-plugin/index.d.ts +0 -9
- package/dist/field/plugins/code-highlight-plugin/index.js +0 -11
- package/dist/field/plugins/link-plugin/auto-link/index.d.ts +0 -9
- package/dist/field/plugins/link-plugin/link/index.d.ts +0 -1
- package/dist/field/plugins/link-plugin/link/index.js +0 -43
- package/dist/field/plugins/table-action-menu-plugin/index.d.ts +0 -5
- package/dist/field/plugins/vimeo-plugin/index.d.ts +0 -3
- package/dist/field/plugins/vimeo-plugin/index.js +0 -24
- package/dist/field/plugins/youtube-plugin/index.d.ts +0 -3
- package/dist/field/plugins/youtube-plugin/index.js +0 -24
- package/dist/field/toolbar-extensions.d.ts +0 -31
- package/dist/field/toolbar-extensions.js +0 -56
- package/src/field/nodes/link-nodes/index.ts +0 -3
- package/src/field/plugins/code-highlight-plugin/index.ts +0 -23
- package/src/field/plugins/link-plugin/link/index.tsx +0 -99
- package/src/field/plugins/vimeo-plugin/index.ts +0 -42
- package/src/field/plugins/youtube-plugin/index.ts +0 -43
- package/src/field/themes/lexical-editor-theme.js +0 -104
- package/src/field/toolbar-extensions.tsx +0 -93
- /package/dist/field/{plugins/admonition-plugin → extensions/admonition}/admonition-modal.css +0 -0
- /package/dist/field/{plugins/admonition-plugin → extensions/admonition}/admonition-modal.d.ts +0 -0
- /package/dist/field/{plugins/admonition-plugin → extensions/admonition}/admonition-modal.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/admonition-node-component.css +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/admonition-node.js +0 -0
- /package/dist/field/{plugins/admonition-plugin → extensions/admonition}/fields.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.css +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.d.ts +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/index.d.ts +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/index.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.css +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.d.ts +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.css +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.d.ts +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.js +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.css +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.d.ts +0 -0
- /package/dist/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.js +0 -0
- /package/dist/field/{nodes/admonition-node/types.d.ts → extensions/admonition/node-types.d.ts} +0 -0
- /package/dist/field/{nodes/admonition-node/types.js → extensions/admonition/node-types.js} +0 -0
- /package/dist/field/{nodes/inline-image-node → extensions/admonition}/types.js +0 -0
- /package/dist/field/{plugins/auto-embed-plugin → extensions/auto-embed}/auto-embed-modal.css +0 -0
- /package/dist/field/{plugins/auto-embed-plugin → extensions/auto-embed}/auto-embed-modal.js +0 -0
- /package/dist/field/{plugins/floating-text-format-toolbar-plugin → extensions/floating-text-format}/index.css +0 -0
- /package/dist/field/{plugins/floating-text-format-toolbar-plugin → extensions/floating-text-format}/index.d.ts +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/fields.d.ts +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/fields.js +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/inline-image-modal.css +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/inline-image-modal.d.ts +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/inline-image-modal.js +0 -0
- /package/dist/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node-component.css +0 -0
- /package/dist/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node.js +0 -0
- /package/dist/field/{nodes/link-nodes/types.js → extensions/inline-image/node-types.js} +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/populate.d.ts +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/populate.js +0 -0
- /package/dist/field/{plugins/admonition-plugin → extensions/inline-image}/types.js +0 -0
- /package/dist/field/{plugins/inline-image-plugin → extensions/inline-image}/utils.js +0 -0
- /package/dist/field/{plugins/layout-plugin → extensions/layout}/insert-layout-modal.css +0 -0
- /package/dist/field/{plugins/layout-plugin → extensions/layout}/insert-layout-modal.d.ts +0 -0
- /package/dist/field/{plugins/layout-plugin → extensions/layout}/insert-layout-modal.js +0 -0
- /package/dist/field/{nodes/layout-container-node → extensions/layout}/layout-container-node.d.ts +0 -0
- /package/dist/field/{nodes/layout-container-node → extensions/layout}/layout-container-node.js +0 -0
- /package/dist/field/{nodes/layout-container-node → extensions/layout}/layout-item-node.d.ts +0 -0
- /package/dist/field/{nodes/layout-container-node → extensions/layout}/layout-item-node.js +0 -0
- /package/dist/field/{nodes/link-nodes → extensions/link}/auto-link-node.d.ts +0 -0
- /package/dist/field/{nodes/link-nodes → extensions/link}/auto-link-node.js +0 -0
- /package/dist/field/{plugins/link-plugin → extensions}/link/floating-link-editor.d.ts +0 -0
- /package/dist/field/{plugins/inline-image-plugin/types.js → extensions/link/link-modal-types.js} +0 -0
- /package/dist/field/{nodes/link-nodes → extensions/link}/link-node.d.ts +0 -0
- /package/dist/field/{nodes/link-nodes → extensions/link}/link-node.js +0 -0
- /package/dist/field/{plugins/link-plugin → extensions/link}/populate.d.ts +0 -0
- /package/dist/field/{plugins/link-plugin → extensions/link}/populate.js +0 -0
- /package/dist/field/{plugins/link-plugin → extensions}/link/types.js +0 -0
- /package/dist/field/{nodes/vimeo-node/index.d.ts → extensions/vimeo/vimeo-node.d.ts} +0 -0
- /package/dist/field/{nodes/vimeo-node/index.js → extensions/vimeo/vimeo-node.js} +0 -0
- /package/dist/field/{nodes/youtube-node/index.d.ts → extensions/youtube/youtube-node.d.ts} +0 -0
- /package/dist/field/{nodes/youtube-node/index.js → extensions/youtube/youtube-node.js} +0 -0
- /package/src/field/{plugins/admonition-plugin → extensions/admonition}/admonition-modal.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/admonition-node-component.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.js +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/danger-icon.tsx +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/index.js +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/index.ts +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.js +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/note-icon.tsx +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.js +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/tip-icon.tsx +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.css +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.js +0 -0
- /package/src/field/{nodes/admonition-node → extensions/admonition}/icons/warning-icon.tsx +0 -0
- /package/src/field/{nodes/admonition-node/types.ts → extensions/admonition/node-types.ts} +0 -0
- /package/src/field/{plugins/auto-embed-plugin → extensions/auto-embed}/auto-embed-modal.css +0 -0
- /package/src/field/{plugins/floating-text-format-toolbar-plugin → extensions/floating-text-format}/index.css +0 -0
- /package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/fields.ts +0 -0
- /package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/inline-image-modal.css +0 -0
- /package/src/field/{nodes/inline-image-node → extensions/inline-image}/inline-image-node-component.css +0 -0
- /package/src/field/{plugins/inline-image-plugin → extensions/inline-image}/populate.ts +0 -0
- /package/src/field/{plugins/layout-plugin → extensions/layout}/insert-layout-modal.css +0 -0
- /package/src/field/{plugins/layout-plugin → extensions/layout}/insert-layout-modal.tsx +0 -0
- /package/src/field/{nodes/layout-container-node → extensions/layout}/layout-container-node.ts +0 -0
- /package/src/field/{nodes/layout-container-node → extensions/layout}/layout-item-node.ts +0 -0
- /package/src/field/{nodes/link-nodes → extensions/link}/auto-link-node.ts +0 -0
- /package/src/field/{nodes/link-nodes → extensions/link}/link-node.ts +0 -0
- /package/src/field/{plugins/link-plugin → extensions/link}/populate.ts +0 -0
- /package/src/field/{nodes/vimeo-node/index.tsx → extensions/vimeo/vimeo-node.tsx} +0 -0
- /package/src/field/{nodes/youtube-node/index.tsx → extensions/youtube/youtube-node.tsx} +0 -0
|
@@ -7,3 +7,4 @@ export declare const UPDATE_LAYOUT_COMMAND: LexicalCommand<{
|
|
|
7
7
|
nodeKey: NodeKey;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function LayoutPlugin(): React.JSX.Element;
|
|
10
|
+
export declare const LayoutExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/Layout", unknown, unknown>;
|
package/dist/field/{plugins/layout-plugin/layout-plugin.js → extensions/layout/layout-extension.js}
RENAMED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { ReactExtension } from "@lexical/react/ReactExtension";
|
|
4
5
|
import { $insertNodeToNearestRoot, mergeRegister } from "@lexical/utils";
|
|
5
|
-
import { $createParagraphNode, $getNodeByKey, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_NORMAL, createCommand } from "lexical";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { $createParagraphNode, $getNodeByKey, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_NORMAL, configExtension, createCommand, declarePeerDependency, defineExtension } from "lexical";
|
|
7
|
+
import { useToolbarActiveEditor } from "../../plugins/toolbar-plugin/toolbar-active-editor.js";
|
|
8
|
+
import { DropDownItem } from "../../ui/dropdown.js";
|
|
9
|
+
import { BylineToolbarExtension } from "../byline-toolbar/byline-toolbar-extension.js";
|
|
8
10
|
import { InsertLayoutModal } from "./insert-layout-modal.js";
|
|
11
|
+
import { $createLayoutContainerNode, $isLayoutContainerNode, LayoutContainerNode } from "./layout-container-node.js";
|
|
12
|
+
import { $createLayoutItemNode, $isLayoutItemNode, LayoutItemNode } from "./layout-item-node.js";
|
|
9
13
|
import * as __rspack_external_react from "react";
|
|
10
14
|
const OPEN_INSERT_LAYOUT_MODAL_COMMAND = createCommand('OPEN_INSERT_LAYOUT_MODAL_COMMAND');
|
|
11
15
|
const INSERT_LAYOUT_COMMAND = createCommand();
|
|
@@ -78,4 +82,48 @@ function LayoutPlugin() {
|
|
|
78
82
|
function getItemsCountFromTemplate(template) {
|
|
79
83
|
return template.trim().split(/\s+/).length;
|
|
80
84
|
}
|
|
81
|
-
|
|
85
|
+
function LayoutInsertItem() {
|
|
86
|
+
const editor = useToolbarActiveEditor();
|
|
87
|
+
return /*#__PURE__*/ jsxs(DropDownItem, {
|
|
88
|
+
onClick: ()=>{
|
|
89
|
+
editor.dispatchCommand(OPEN_INSERT_LAYOUT_MODAL_COMMAND, null);
|
|
90
|
+
},
|
|
91
|
+
className: "item",
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ jsx("i", {
|
|
94
|
+
className: "icon columns"
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx("span", {
|
|
97
|
+
className: "text",
|
|
98
|
+
children: "Columns Layout"
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const LayoutExtension = defineExtension({
|
|
104
|
+
name: '@byline/richtext-lexical/Layout',
|
|
105
|
+
nodes: ()=>[
|
|
106
|
+
LayoutContainerNode,
|
|
107
|
+
LayoutItemNode
|
|
108
|
+
],
|
|
109
|
+
dependencies: [
|
|
110
|
+
configExtension(ReactExtension, {
|
|
111
|
+
decorators: [
|
|
112
|
+
/*#__PURE__*/ jsx(LayoutPlugin, {}, "d")
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
],
|
|
116
|
+
peerDependencies: [
|
|
117
|
+
declarePeerDependency(BylineToolbarExtension.name, {
|
|
118
|
+
items: [
|
|
119
|
+
{
|
|
120
|
+
id: '@byline/richtext-lexical/Layout/insert',
|
|
121
|
+
placement: 'insert-menu',
|
|
122
|
+
order: 20,
|
|
123
|
+
node: /*#__PURE__*/ jsx(LayoutInsertItem, {})
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
export { INSERT_LAYOUT_COMMAND, LayoutExtension, LayoutPlugin, OPEN_INSERT_LAYOUT_MODAL_COMMAND, UPDATE_LAYOUT_COMMAND };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*
|
|
8
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*/
|
|
10
|
+
import type * as React from 'react';
|
|
11
|
+
export declare function AutoLinkPlugin(): React.JSX.Element;
|
|
12
|
+
export declare const AutoLinkExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/AutoLink", unknown, unknown>;
|
package/dist/field/{plugins/link-plugin/auto-link/index.js → extensions/link/auto-link-extension.js}
RENAMED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ReactExtension } from "@lexical/react/ReactExtension";
|
|
4
|
+
import { configExtension, defineExtension } from "lexical";
|
|
3
5
|
import { AutoLinkPlugin, createLinkMatcherWithRegExp } from "./auto-link-plugin.js";
|
|
4
6
|
const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
5
7
|
const EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
@@ -7,9 +9,19 @@ const MATCHERS = [
|
|
|
7
9
|
createLinkMatcherWithRegExp(URL_REGEX, (text)=>text.startsWith('http') ? text : `https://${text}`),
|
|
8
10
|
createLinkMatcherWithRegExp(EMAIL_REGEX, (text)=>`mailto:${text}`)
|
|
9
11
|
];
|
|
10
|
-
function
|
|
12
|
+
function auto_link_extension_AutoLinkPlugin() {
|
|
11
13
|
return /*#__PURE__*/ jsx(AutoLinkPlugin, {
|
|
12
14
|
matchers: MATCHERS
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
const AutoLinkExtension = defineExtension({
|
|
18
|
+
name: '@byline/richtext-lexical/AutoLink',
|
|
19
|
+
dependencies: [
|
|
20
|
+
configExtension(ReactExtension, {
|
|
21
|
+
decorators: [
|
|
22
|
+
/*#__PURE__*/ jsx(auto_link_extension_AutoLinkPlugin, {}, "d")
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
export { AutoLinkExtension, auto_link_extension_AutoLinkPlugin as AutoLinkPlugin };
|
|
@@ -3,8 +3,8 @@ import { useEffect } from "react";
|
|
|
3
3
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
4
|
import { mergeRegister } from "@lexical/utils";
|
|
5
5
|
import { $createTextNode, $isElementNode, $isLineBreakNode, $isTextNode, TextNode } from "lexical";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import invariant from "../../shared/invariant.js";
|
|
7
|
+
import { $createAutoLinkNode, $isAutoLinkNode, $isLinkNode, AutoLinkNode } from "./index.js";
|
|
8
8
|
function customAttrs(attrs) {
|
|
9
9
|
if (null == attrs || 'internal' === attrs.linkType) return null;
|
|
10
10
|
return attrs;
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
.link-editor div.link-edit {
|
|
68
68
|
vertical-align: -.25em;
|
|
69
69
|
cursor: pointer;
|
|
70
|
-
background-image: url(
|
|
70
|
+
background-image: url(../../../static/svg/pencil-fill.svg);
|
|
71
71
|
background-position: center;
|
|
72
72
|
background-repeat: no-repeat;
|
|
73
73
|
background-size: 16px;
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
.link-editor div.link-trash {
|
|
82
82
|
vertical-align: -.25em;
|
|
83
83
|
cursor: pointer;
|
|
84
|
-
background-image: url(
|
|
84
|
+
background-image: url(../../../static/svg/trash.svg);
|
|
85
85
|
background-position: center;
|
|
86
86
|
background-repeat: no-repeat;
|
|
87
87
|
background-size: 16px;
|
|
@@ -6,10 +6,10 @@ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
|
6
6
|
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
7
7
|
import { $getSelection, $isLineBreakNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND } from "lexical";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { getSelectedNode } from "../../utils/getSelectedNode.js";
|
|
10
|
+
import { setFloatingElemPositionForLinkEditor } from "../../utils/setFloatingElemPositionForLinkEditor.js";
|
|
11
|
+
import { sanitizeUrl } from "../../utils/url.js";
|
|
12
|
+
import { $isAutoLinkNode, $isLinkNode, OPEN_LINK_MODAL_COMMAND, TOGGLE_LINK_COMMAND } from "./index.js";
|
|
13
13
|
import { LinkModal } from "./link-modal.js";
|
|
14
14
|
import "./floating-link-editor.css";
|
|
15
15
|
function FloatingLinkEditor({ editor, isLink, setIsLink, anchorElem }) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type LexicalEditor } from 'lexical';
|
|
2
|
+
/**
|
|
3
|
+
* Registers Byline's custom link command + paste handling on `editor`.
|
|
4
|
+
* Shared between the LinkPlugin React shell (used inside nested composers)
|
|
5
|
+
* and the LinkExtension's `register` phase (used by the top-level editor).
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerLink(editor: LexicalEditor): () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Legacy React shell — still used inside the inline-image nested composer
|
|
10
|
+
* (`inline-image-node-component.tsx`) where the nested editor needs link
|
|
11
|
+
* behaviour wired up. The top-level editor uses `LinkExtension` instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare function LinkPlugin(): null;
|
|
14
|
+
export declare const LinkExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/Link", unknown, unknown>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { mergeRegister } from "@lexical/utils";
|
|
5
|
+
import { $getSelection, $isElementNode, $isRangeSelection, COMMAND_PRIORITY_LOW, PASTE_COMMAND, declarePeerDependency, defineExtension } from "lexical";
|
|
6
|
+
import { validateUrl } from "../../utils/url.js";
|
|
7
|
+
import { BylineFloatingUIExtension } from "../byline-floating-ui/byline-floating-ui-extension.js";
|
|
8
|
+
import { $toggleLink, AutoLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from "./index.js";
|
|
9
|
+
import { FloatingLinkEditorPlugin } from "./floating-link-editor.js";
|
|
10
|
+
function registerLink(editor) {
|
|
11
|
+
return mergeRegister(editor.registerCommand(TOGGLE_LINK_COMMAND, (payload)=>{
|
|
12
|
+
if (null === payload) {
|
|
13
|
+
$toggleLink(payload);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if ('custom' === payload.linkType) {
|
|
17
|
+
const url = payload.url ?? '';
|
|
18
|
+
if (!url.startsWith('/') && !validateUrl(url)) return false;
|
|
19
|
+
}
|
|
20
|
+
$toggleLink(payload);
|
|
21
|
+
return true;
|
|
22
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(PASTE_COMMAND, (event)=>{
|
|
23
|
+
const selection = $getSelection();
|
|
24
|
+
if (!$isRangeSelection(selection) || selection.isCollapsed() || !(event instanceof ClipboardEvent) || null == event.clipboardData) return false;
|
|
25
|
+
const clipboardText = event.clipboardData.getData('text');
|
|
26
|
+
if (!validateUrl(clipboardText)) return false;
|
|
27
|
+
if (selection.getNodes().some((node)=>$isElementNode(node))) return false;
|
|
28
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
|
|
29
|
+
linkType: 'custom',
|
|
30
|
+
url: clipboardText
|
|
31
|
+
});
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
return true;
|
|
34
|
+
}, COMMAND_PRIORITY_LOW));
|
|
35
|
+
}
|
|
36
|
+
function LinkPlugin() {
|
|
37
|
+
const [editor] = useLexicalComposerContext();
|
|
38
|
+
useEffect(()=>{
|
|
39
|
+
if (!editor.hasNodes([
|
|
40
|
+
LinkNode
|
|
41
|
+
])) throw new Error('LinkPlugin: LinkNode not registered on editor');
|
|
42
|
+
return registerLink(editor);
|
|
43
|
+
}, [
|
|
44
|
+
editor
|
|
45
|
+
]);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const LinkExtension = defineExtension({
|
|
49
|
+
name: '@byline/richtext-lexical/Link',
|
|
50
|
+
nodes: ()=>[
|
|
51
|
+
LinkNode,
|
|
52
|
+
AutoLinkNode
|
|
53
|
+
],
|
|
54
|
+
register: registerLink,
|
|
55
|
+
peerDependencies: [
|
|
56
|
+
declarePeerDependency(BylineFloatingUIExtension.name, {
|
|
57
|
+
items: [
|
|
58
|
+
{
|
|
59
|
+
id: '@byline/richtext-lexical/Link/floating-editor',
|
|
60
|
+
Component: FloatingLinkEditorPlugin
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
export { LinkExtension, LinkPlugin, registerLink };
|
|
@@ -3,9 +3,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { getClientConfig, getCollectionDefinition } from "@byline/core";
|
|
5
5
|
import { Button, Checkbox, CloseIcon, IconButton, Input, Label, Modal, RadioGroup, RadioGroupItem, RelationPicker, Select } from "@byline/ui/react";
|
|
6
|
-
import { useEditorConfig } from "
|
|
7
|
-
import { useModalFormState } from "
|
|
8
|
-
import { validateUrl } from "
|
|
6
|
+
import { useEditorConfig } from "../../config/editor-config-context.js";
|
|
7
|
+
import { useModalFormState } from "../../shared/useModalFormState.js";
|
|
8
|
+
import { validateUrl } from "../../utils/url.js";
|
|
9
9
|
function emptyState(linkable) {
|
|
10
10
|
return {
|
|
11
11
|
text: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SerializedElementNode, Spread } from 'lexical';
|
|
2
|
-
import type { DocumentRelation } from '
|
|
2
|
+
import type { DocumentRelation } from '../../nodes/document-relation';
|
|
3
3
|
interface BaseLinkAttributes {
|
|
4
4
|
newTab?: boolean;
|
|
5
5
|
rel?: null | string;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
5
|
+
import { useExtensionDependency } from "@lexical/react/useExtensionComponent";
|
|
5
6
|
import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
|
|
6
|
-
import { $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableRowNode, $isTableSelection, $unmergeCell, TableCellHeaderStates, TableCellNode, getTableObserverFromTableElement } from "@lexical/table";
|
|
7
|
+
import { $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableRowNode, $isTableSelection, $unmergeCell, TableCellHeaderStates, TableCellNode, TableExtension, getTableObserverFromTableElement } from "@lexical/table";
|
|
7
8
|
import { $createParagraphNode, $getRoot, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode } from "lexical";
|
|
8
9
|
import { createPortal } from "react-dom";
|
|
9
|
-
import use_modal from "
|
|
10
|
-
import invariant from "
|
|
11
|
-
import color_picker from "
|
|
10
|
+
import use_modal from "../../../hooks/use-modal.js";
|
|
11
|
+
import invariant from "../../../shared/invariant.js";
|
|
12
|
+
import color_picker from "../../../ui/color-picker.js";
|
|
12
13
|
function computeSelectionCount(selection) {
|
|
13
14
|
const selectionShape = selection.getShape();
|
|
14
15
|
return {
|
|
@@ -588,11 +589,12 @@ function TableCellActionMenuContainer({ anchorElem, cellMerge }) {
|
|
|
588
589
|
})
|
|
589
590
|
});
|
|
590
591
|
}
|
|
591
|
-
function TableActionMenuPlugin({ anchorElem
|
|
592
|
+
function TableActionMenuPlugin({ anchorElem }) {
|
|
592
593
|
const isEditable = useLexicalEditable();
|
|
594
|
+
const { hasCellMerge } = useExtensionDependency(TableExtension).config;
|
|
593
595
|
return /*#__PURE__*/ createPortal(isEditable ? /*#__PURE__*/ jsx(TableCellActionMenuContainer, {
|
|
594
596
|
anchorElem: anchorElem,
|
|
595
|
-
cellMerge:
|
|
597
|
+
cellMerge: hasCellMerge ?? false
|
|
596
598
|
}) : null, anchorElem);
|
|
597
599
|
}
|
|
598
600
|
export { TableActionMenuPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byline wrapper around `@lexical/table`'s `TableExtension`. Forwards
|
|
3
|
+
* cell-merge / cell-background-color config to the upstream extension
|
|
4
|
+
* via `configExtension` and contributes the "Insert table" toolbar item.
|
|
5
|
+
*
|
|
6
|
+
* Override the upstream config with:
|
|
7
|
+
* ```ts
|
|
8
|
+
* lexicalEditor((c) => {
|
|
9
|
+
* c.extensions.configure(LexicalTableExtension, {
|
|
10
|
+
* hasCellMerge: false,
|
|
11
|
+
* hasCellBackgroundColor: false,
|
|
12
|
+
* })
|
|
13
|
+
* return c
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const TableExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/Table", unknown, unknown>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { TableExtension } from "@lexical/table";
|
|
4
|
+
import { configExtension, declarePeerDependency, defineExtension } from "lexical";
|
|
5
|
+
import { OPEN_TABLE_MODAL_COMMAND } from "../../plugins/table-plugin/index.js";
|
|
6
|
+
import { useToolbarActiveEditor } from "../../plugins/toolbar-plugin/toolbar-active-editor.js";
|
|
7
|
+
import { DropDownItem } from "../../ui/dropdown.js";
|
|
8
|
+
import { BylineFloatingUIExtension } from "../byline-floating-ui/byline-floating-ui-extension.js";
|
|
9
|
+
import { BylineToolbarExtension } from "../byline-toolbar/byline-toolbar-extension.js";
|
|
10
|
+
import { TableActionMenuPlugin } from "./table-action-menu-plugin/index.js";
|
|
11
|
+
function TableInsertItem() {
|
|
12
|
+
const editor = useToolbarActiveEditor();
|
|
13
|
+
return /*#__PURE__*/ jsxs(DropDownItem, {
|
|
14
|
+
onClick: ()=>{
|
|
15
|
+
editor.dispatchCommand(OPEN_TABLE_MODAL_COMMAND, null);
|
|
16
|
+
},
|
|
17
|
+
className: "item",
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ jsx("i", {
|
|
20
|
+
className: "icon table"
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ jsx("span", {
|
|
23
|
+
className: "text",
|
|
24
|
+
children: "Table"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const table_extension_TableExtension = defineExtension({
|
|
30
|
+
name: '@byline/richtext-lexical/Table',
|
|
31
|
+
dependencies: [
|
|
32
|
+
configExtension(TableExtension, {
|
|
33
|
+
hasCellMerge: true,
|
|
34
|
+
hasCellBackgroundColor: true
|
|
35
|
+
})
|
|
36
|
+
],
|
|
37
|
+
peerDependencies: [
|
|
38
|
+
declarePeerDependency(BylineToolbarExtension.name, {
|
|
39
|
+
items: [
|
|
40
|
+
{
|
|
41
|
+
id: '@byline/richtext-lexical/Table/insert',
|
|
42
|
+
placement: 'insert-menu',
|
|
43
|
+
order: 50,
|
|
44
|
+
node: /*#__PURE__*/ jsx(TableInsertItem, {})
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
declarePeerDependency(BylineFloatingUIExtension.name, {
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
id: '@byline/richtext-lexical/Table/action-menu',
|
|
52
|
+
Component: TableActionMenuPlugin
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
export { table_extension_TableExtension as TableExtension };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*
|
|
8
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*/
|
|
10
|
+
import { type LexicalCommand } from 'lexical';
|
|
11
|
+
export declare const INSERT_VIMEO_COMMAND: LexicalCommand<string>;
|
|
12
|
+
export declare const VimeoExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/Vimeo", unknown, unknown>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { $insertNodeToNearestRoot } from "@lexical/utils";
|
|
2
|
+
import { COMMAND_PRIORITY_EDITOR, createCommand, defineExtension } from "lexical";
|
|
3
|
+
import { $createVimeoNode, VimeoNode } from "./vimeo-node.js";
|
|
4
|
+
const INSERT_VIMEO_COMMAND = createCommand('INSERT_VIMEO_COMMAND');
|
|
5
|
+
const VimeoExtension = defineExtension({
|
|
6
|
+
name: '@byline/richtext-lexical/Vimeo',
|
|
7
|
+
nodes: ()=>[
|
|
8
|
+
VimeoNode
|
|
9
|
+
],
|
|
10
|
+
register: (editor)=>editor.registerCommand(INSERT_VIMEO_COMMAND, (payload)=>{
|
|
11
|
+
const vimeoNode = $createVimeoNode(payload);
|
|
12
|
+
$insertNodeToNearestRoot(vimeoNode);
|
|
13
|
+
return true;
|
|
14
|
+
}, COMMAND_PRIORITY_EDITOR)
|
|
15
|
+
});
|
|
16
|
+
export { INSERT_VIMEO_COMMAND, VimeoExtension };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*
|
|
8
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*/
|
|
10
|
+
import { type LexicalCommand } from 'lexical';
|
|
11
|
+
export declare const INSERT_YOUTUBE_COMMAND: LexicalCommand<string>;
|
|
12
|
+
export declare const YouTubeExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@byline/richtext-lexical/YouTube", unknown, unknown>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { $insertNodeToNearestRoot } from "@lexical/utils";
|
|
2
|
+
import { COMMAND_PRIORITY_EDITOR, createCommand, defineExtension } from "lexical";
|
|
3
|
+
import { $createYouTubeNode, YouTubeNode } from "./youtube-node.js";
|
|
4
|
+
const INSERT_YOUTUBE_COMMAND = createCommand('INSERT_YOUTUBE_COMMAND');
|
|
5
|
+
const YouTubeExtension = defineExtension({
|
|
6
|
+
name: '@byline/richtext-lexical/YouTube',
|
|
7
|
+
nodes: ()=>[
|
|
8
|
+
YouTubeNode
|
|
9
|
+
],
|
|
10
|
+
register: (editor)=>editor.registerCommand(INSERT_YOUTUBE_COMMAND, (payload)=>{
|
|
11
|
+
const youTubeNode = $createYouTubeNode(payload);
|
|
12
|
+
$insertNodeToNearestRoot(youTubeNode);
|
|
13
|
+
return true;
|
|
14
|
+
}, COMMAND_PRIORITY_EDITOR)
|
|
15
|
+
});
|
|
16
|
+
export { INSERT_YOUTUBE_COMMAND, YouTubeExtension };
|
|
@@ -5,13 +5,13 @@ import { OverflowNode } from "@lexical/overflow";
|
|
|
5
5
|
import { HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
6
6
|
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
7
7
|
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
8
|
-
import { AdmonitionNode } from "
|
|
9
|
-
import { InlineImageNode } from "
|
|
10
|
-
import { LayoutContainerNode } from "
|
|
11
|
-
import { LayoutItemNode } from "
|
|
12
|
-
import { AutoLinkNode, LinkNode } from "
|
|
13
|
-
import { VimeoNode } from "
|
|
14
|
-
import { YouTubeNode } from "
|
|
8
|
+
import { AdmonitionNode } from "../extensions/admonition/admonition-node.js";
|
|
9
|
+
import { InlineImageNode } from "../extensions/inline-image/inline-image-node.js";
|
|
10
|
+
import { LayoutContainerNode } from "../extensions/layout/layout-container-node.js";
|
|
11
|
+
import { LayoutItemNode } from "../extensions/layout/layout-item-node.js";
|
|
12
|
+
import { AutoLinkNode, LinkNode } from "../extensions/link/index.js";
|
|
13
|
+
import { VimeoNode } from "../extensions/vimeo/vimeo-node.js";
|
|
14
|
+
import { YouTubeNode } from "../extensions/youtube/youtube-node.js";
|
|
15
15
|
const Nodes = [
|
|
16
16
|
HeadingNode,
|
|
17
17
|
ListNode,
|
|
@@ -8,13 +8,12 @@ const OPEN_TABLE_MODAL_COMMAND = createCommand('OPEN_TABLE_MODAL_COMMAND');
|
|
|
8
8
|
function TablePlugin() {
|
|
9
9
|
const [editor] = useLexicalComposerContext();
|
|
10
10
|
const [open, setOpen] = __rspack_external_react.useState(false);
|
|
11
|
-
editor.registerCommand(OPEN_TABLE_MODAL_COMMAND, ()=>{
|
|
12
|
-
|
|
13
|
-
setOpen(true);
|
|
11
|
+
(0, __rspack_external_react.useEffect)(()=>editor.registerCommand(OPEN_TABLE_MODAL_COMMAND, ()=>{
|
|
12
|
+
setOpen((prev)=>prev ? prev : true);
|
|
14
13
|
return true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
}, COMMAND_PRIORITY_NORMAL), [
|
|
15
|
+
editor
|
|
16
|
+
]);
|
|
18
17
|
const handleOnClose = ()=>{
|
|
19
18
|
setOpen(false);
|
|
20
19
|
};
|