@infonomic/payload-alternative-lexical-editor 1.0.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/LICENSE +21 -0
- package/dist/adapter.d.ts +11 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +124 -0
- package/dist/adapter.js.map +1 -0
- package/dist/cell/rsc-entry.d.ts +20 -0
- package/dist/cell/rsc-entry.d.ts.map +1 -0
- package/dist/cell/rsc-entry.js +68 -0
- package/dist/cell/rsc-entry.js.map +1 -0
- package/dist/field/apply-value-plugin.d.ts +9 -0
- package/dist/field/apply-value-plugin.d.ts.map +1 -0
- package/dist/field/apply-value-plugin.js +66 -0
- package/dist/field/apply-value-plugin.js.map +1 -0
- package/dist/field/build-initial-state.d.ts +29 -0
- package/dist/field/build-initial-state.d.ts.map +1 -0
- package/dist/field/build-initial-state.js +14 -0
- package/dist/field/build-initial-state.js.map +1 -0
- package/dist/field/config/default.d.ts +6 -0
- package/dist/field/config/default.d.ts.map +1 -0
- package/dist/field/config/default.js +52 -0
- package/dist/field/config/default.js.map +1 -0
- package/dist/field/config/editor-config-context.d.ts +14 -0
- package/dist/field/config/editor-config-context.d.ts.map +1 -0
- package/dist/field/config/editor-config-context.js +38 -0
- package/dist/field/config/editor-config-context.js.map +1 -0
- package/dist/field/config/types.d.ts +22 -0
- package/dist/field/config/types.d.ts.map +1 -0
- package/dist/field/config/types.js +2 -0
- package/dist/field/config/types.js.map +1 -0
- package/dist/field/constants.d.ts +2 -0
- package/dist/field/constants.d.ts.map +1 -0
- package/dist/field/constants.js +2 -0
- package/dist/field/constants.js.map +1 -0
- package/dist/field/context/shared-autocomplete-context.d.ts +18 -0
- package/dist/field/context/shared-autocomplete-context.d.ts.map +1 -0
- package/dist/field/context/shared-autocomplete-context.js +40 -0
- package/dist/field/context/shared-autocomplete-context.js.map +1 -0
- package/dist/field/context/shared-history-context.d.ts +19 -0
- package/dist/field/context/shared-history-context.d.ts.map +1 -0
- package/dist/field/context/shared-history-context.js +13 -0
- package/dist/field/context/shared-history-context.js.map +1 -0
- package/dist/field/context/shared-on-change-context.d.ts +13 -0
- package/dist/field/context/shared-on-change-context.d.ts.map +1 -0
- package/dist/field/context/shared-on-change-context.js +18 -0
- package/dist/field/context/shared-on-change-context.js.map +1 -0
- package/dist/field/debug.d.ts +3 -0
- package/dist/field/debug.d.ts.map +1 -0
- package/dist/field/debug.js +17 -0
- package/dist/field/debug.js.map +1 -0
- package/dist/field/editor-context.d.ts +15 -0
- package/dist/field/editor-context.d.ts.map +1 -0
- package/dist/field/editor-context.js +37 -0
- package/dist/field/editor-context.js.map +1 -0
- package/dist/field/editor.css +1477 -0
- package/dist/field/editor.d.ts +4 -0
- package/dist/field/editor.d.ts.map +1 -0
- package/dist/field/editor.js +86 -0
- package/dist/field/editor.js.map +1 -0
- package/dist/field/field-component.css +44 -0
- package/dist/field/field-component.d.ts +16 -0
- package/dist/field/field-component.d.ts.map +1 -0
- package/dist/field/field-component.js +136 -0
- package/dist/field/field-component.js.map +1 -0
- package/dist/field/hooks/useMediaQuery.d.ts +3 -0
- package/dist/field/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/field/hooks/useMediaQuery.js +20 -0
- package/dist/field/hooks/useMediaQuery.js.map +1 -0
- package/dist/field/hooks/useModal.d.ts +13 -0
- package/dist/field/hooks/useModal.d.ts.map +1 -0
- package/dist/field/hooks/useModal.js +28 -0
- package/dist/field/hooks/useModal.js.map +1 -0
- package/dist/field/hooks/useReport.d.ts +9 -0
- package/dist/field/hooks/useReport.d.ts.map +1 -0
- package/dist/field/hooks/useReport.js +51 -0
- package/dist/field/hooks/useReport.js.map +1 -0
- package/dist/field/images/cat-typing.gif +0 -0
- package/dist/field/images/emoji/1F600.png +0 -0
- package/dist/field/images/emoji/1F641.png +0 -0
- package/dist/field/images/emoji/1F642.png +0 -0
- package/dist/field/images/emoji/2764.png +0 -0
- package/dist/field/images/icons/3-columns.svg +3 -0
- package/dist/field/images/icons/admonition.svg +1 -0
- package/dist/field/images/icons/arrow-clockwise.svg +1 -0
- package/dist/field/images/icons/arrow-counterclockwise.svg +1 -0
- package/dist/field/images/icons/bg-color.svg +1 -0
- package/dist/field/images/icons/camera.svg +1 -0
- package/dist/field/images/icons/card-checklist.svg +1 -0
- package/dist/field/images/icons/caret-right-fill.svg +1 -0
- package/dist/field/images/icons/chat-left-text.svg +1 -0
- package/dist/field/images/icons/chat-right-dots.svg +1 -0
- package/dist/field/images/icons/chat-right-text.svg +1 -0
- package/dist/field/images/icons/chat-right.svg +1 -0
- package/dist/field/images/icons/chat-square-quote.svg +1 -0
- package/dist/field/images/icons/chevron-down.svg +1 -0
- package/dist/field/images/icons/clipboard.svg +1 -0
- package/dist/field/images/icons/close.svg +1 -0
- package/dist/field/images/icons/code.svg +1 -0
- package/dist/field/images/icons/comments.svg +1 -0
- package/dist/field/images/icons/copy.svg +1 -0
- package/dist/field/images/icons/diagram-2.svg +1 -0
- package/dist/field/images/icons/download.svg +1 -0
- package/dist/field/images/icons/draggable-block-menu.svg +1 -0
- package/dist/field/images/icons/dropdown-more.svg +1 -0
- package/dist/field/images/icons/figma.svg +1 -0
- package/dist/field/images/icons/file-earmark-text.svg +4 -0
- package/dist/field/images/icons/file-image.svg +1 -0
- package/dist/field/images/icons/filetype-gif.svg +1 -0
- package/dist/field/images/icons/font-color.svg +1 -0
- package/dist/field/images/icons/font-family.svg +1 -0
- package/dist/field/images/icons/gear.svg +1 -0
- package/dist/field/images/icons/horizontal-rule.svg +1 -0
- package/dist/field/images/icons/indent.svg +1 -0
- package/dist/field/images/icons/journal-code.svg +1 -0
- package/dist/field/images/icons/journal-text.svg +1 -0
- package/dist/field/images/icons/justify.svg +1 -0
- package/dist/field/images/icons/link.svg +1 -0
- package/dist/field/images/icons/list-ol.svg +1 -0
- package/dist/field/images/icons/list-ul.svg +1 -0
- package/dist/field/images/icons/lock-fill.svg +1 -0
- package/dist/field/images/icons/lock.svg +1 -0
- package/dist/field/images/icons/markdown.svg +1 -0
- package/dist/field/images/icons/mic.svg +1 -0
- package/dist/field/images/icons/outdent.svg +1 -0
- package/dist/field/images/icons/paint-bucket.svg +1 -0
- package/dist/field/images/icons/palette.svg +1 -0
- package/dist/field/images/icons/pencil-fill.svg +1 -0
- package/dist/field/images/icons/plug-fill.svg +1 -0
- package/dist/field/images/icons/plug.svg +1 -0
- package/dist/field/images/icons/plus-slash-minus.svg +1 -0
- package/dist/field/images/icons/plus.svg +1 -0
- package/dist/field/images/icons/prettier-error.svg +1 -0
- package/dist/field/images/icons/prettier.svg +1 -0
- package/dist/field/images/icons/send.svg +1 -0
- package/dist/field/images/icons/square-check.svg +1 -0
- package/dist/field/images/icons/sticky.svg +1 -0
- package/dist/field/images/icons/success-alt.svg +1 -0
- package/dist/field/images/icons/success.svg +1 -0
- package/dist/field/images/icons/table.svg +1 -0
- package/dist/field/images/icons/text-center.svg +1 -0
- package/dist/field/images/icons/text-left.svg +1 -0
- package/dist/field/images/icons/text-paragraph.svg +1 -0
- package/dist/field/images/icons/text-right.svg +1 -0
- package/dist/field/images/icons/trash.svg +1 -0
- package/dist/field/images/icons/trash3.svg +1 -0
- package/dist/field/images/icons/tweet.svg +1 -0
- package/dist/field/images/icons/type-bold.svg +1 -0
- package/dist/field/images/icons/type-h1.svg +1 -0
- package/dist/field/images/icons/type-h2.svg +1 -0
- package/dist/field/images/icons/type-h3.svg +1 -0
- package/dist/field/images/icons/type-h4.svg +1 -0
- package/dist/field/images/icons/type-h5.svg +1 -0
- package/dist/field/images/icons/type-h6.svg +1 -0
- package/dist/field/images/icons/type-italic.svg +1 -0
- package/dist/field/images/icons/type-strikethrough.svg +1 -0
- package/dist/field/images/icons/type-subscript.svg +1 -0
- package/dist/field/images/icons/type-superscript.svg +1 -0
- package/dist/field/images/icons/type-underline.svg +1 -0
- package/dist/field/images/icons/upload.svg +1 -0
- package/dist/field/images/icons/user.svg +1 -0
- package/dist/field/images/icons/vimeo.svg +1 -0
- package/dist/field/images/icons/youtube.svg +1 -0
- package/dist/field/images/landscape.jpg +0 -0
- package/dist/field/images/logo.svg +1 -0
- package/dist/field/images/yellow-flower-small.jpg +0 -0
- package/dist/field/images/yellow-flower.jpg +0 -0
- package/dist/field/index.d.ts +12 -0
- package/dist/field/index.d.ts.map +1 -0
- package/dist/field/index.js +9 -0
- package/dist/field/index.js.map +1 -0
- package/dist/field/lexical-after-read-populate-links.d.ts +47 -0
- package/dist/field/lexical-after-read-populate-links.d.ts.map +1 -0
- package/dist/field/lexical-after-read-populate-links.js +118 -0
- package/dist/field/lexical-after-read-populate-links.js.map +1 -0
- package/dist/field/lexical-after-read-populate-media.d.ts +34 -0
- package/dist/field/lexical-after-read-populate-media.d.ts.map +1 -0
- package/dist/field/lexical-after-read-populate-media.js +40 -0
- package/dist/field/lexical-after-read-populate-media.js.map +1 -0
- package/dist/field/lexical-before-change-populate-links.d.ts +52 -0
- package/dist/field/lexical-before-change-populate-links.d.ts.map +1 -0
- package/dist/field/lexical-before-change-populate-links.js +116 -0
- package/dist/field/lexical-before-change-populate-links.js.map +1 -0
- package/dist/field/nodes/admonition-node/admonition-node-component.css +115 -0
- package/dist/field/nodes/admonition-node/admonition-node-component.d.ts +11 -0
- package/dist/field/nodes/admonition-node/admonition-node-component.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/admonition-node-component.js +157 -0
- package/dist/field/nodes/admonition-node/admonition-node-component.js.map +1 -0
- package/dist/field/nodes/admonition-node/admonition-node.d.ts +28 -0
- package/dist/field/nodes/admonition-node/admonition-node.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/admonition-node.js +134 -0
- package/dist/field/nodes/admonition-node/admonition-node.js.map +1 -0
- package/dist/field/nodes/admonition-node/icons/danger-icon.css +11 -0
- package/dist/field/nodes/admonition-node/icons/danger-icon.d.ts +8 -0
- package/dist/field/nodes/admonition-node/icons/danger-icon.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/icons/danger-icon.js +7 -0
- package/dist/field/nodes/admonition-node/icons/danger-icon.js.map +1 -0
- package/dist/field/nodes/admonition-node/icons/index.d.ts +5 -0
- package/dist/field/nodes/admonition-node/icons/index.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/icons/index.js +5 -0
- package/dist/field/nodes/admonition-node/icons/index.js.map +1 -0
- package/dist/field/nodes/admonition-node/icons/note-icon.css +11 -0
- package/dist/field/nodes/admonition-node/icons/note-icon.d.ts +8 -0
- package/dist/field/nodes/admonition-node/icons/note-icon.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/icons/note-icon.js +7 -0
- package/dist/field/nodes/admonition-node/icons/note-icon.js.map +1 -0
- package/dist/field/nodes/admonition-node/icons/tip-icon.css +11 -0
- package/dist/field/nodes/admonition-node/icons/tip-icon.d.ts +8 -0
- package/dist/field/nodes/admonition-node/icons/tip-icon.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/icons/tip-icon.js +7 -0
- package/dist/field/nodes/admonition-node/icons/tip-icon.js.map +1 -0
- package/dist/field/nodes/admonition-node/icons/warning-icon.css +11 -0
- package/dist/field/nodes/admonition-node/icons/warning-icon.d.ts +8 -0
- package/dist/field/nodes/admonition-node/icons/warning-icon.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/icons/warning-icon.js +7 -0
- package/dist/field/nodes/admonition-node/icons/warning-icon.js.map +1 -0
- package/dist/field/nodes/admonition-node/index.d.ts +4 -0
- package/dist/field/nodes/admonition-node/index.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/index.js +4 -0
- package/dist/field/nodes/admonition-node/index.js.map +1 -0
- package/dist/field/nodes/admonition-node/types.d.ts +14 -0
- package/dist/field/nodes/admonition-node/types.d.ts.map +1 -0
- package/dist/field/nodes/admonition-node/types.js +2 -0
- package/dist/field/nodes/admonition-node/types.js.map +1 -0
- package/dist/field/nodes/index.d.ts +10 -0
- package/dist/field/nodes/index.d.ts.map +1 -0
- package/dist/field/nodes/index.js +44 -0
- package/dist/field/nodes/index.js.map +1 -0
- package/dist/field/nodes/inline-image-node/index.d.ts +4 -0
- package/dist/field/nodes/inline-image-node/index.d.ts.map +1 -0
- package/dist/field/nodes/inline-image-node/index.js +4 -0
- package/dist/field/nodes/inline-image-node/index.js.map +1 -0
- package/dist/field/nodes/inline-image-node/inline-image-node-component.css +205 -0
- package/dist/field/nodes/inline-image-node/inline-image-node-component.d.ts +18 -0
- package/dist/field/nodes/inline-image-node/inline-image-node-component.d.ts.map +1 -0
- package/dist/field/nodes/inline-image-node/inline-image-node-component.js +239 -0
- package/dist/field/nodes/inline-image-node/inline-image-node-component.js.map +1 -0
- package/dist/field/nodes/inline-image-node/inline-image-node.d.ts +39 -0
- package/dist/field/nodes/inline-image-node/inline-image-node.d.ts.map +1 -0
- package/dist/field/nodes/inline-image-node/inline-image-node.js +204 -0
- package/dist/field/nodes/inline-image-node/inline-image-node.js.map +1 -0
- package/dist/field/nodes/inline-image-node/types.d.ts +33 -0
- package/dist/field/nodes/inline-image-node/types.d.ts.map +1 -0
- package/dist/field/nodes/inline-image-node/types.js +2 -0
- package/dist/field/nodes/inline-image-node/types.js.map +1 -0
- package/dist/field/nodes/layout-container-node/layout-container-node.d.ts +29 -0
- package/dist/field/nodes/layout-container-node/layout-container-node.d.ts.map +1 -0
- package/dist/field/nodes/layout-container-node/layout-container-node.js +66 -0
- package/dist/field/nodes/layout-container-node/layout-container-node.js.map +1 -0
- package/dist/field/nodes/layout-container-node/layout-item-node.d.ts +23 -0
- package/dist/field/nodes/layout-container-node/layout-item-node.d.ts.map +1 -0
- package/dist/field/nodes/layout-container-node/layout-item-node.js +50 -0
- package/dist/field/nodes/layout-container-node/layout-item-node.js.map +1 -0
- package/dist/field/nodes/link-nodes/auto-link-node.d.ts +17 -0
- package/dist/field/nodes/link-nodes/auto-link-node.d.ts.map +1 -0
- package/dist/field/nodes/link-nodes/auto-link-node.js +46 -0
- package/dist/field/nodes/link-nodes/auto-link-node.js.map +1 -0
- package/dist/field/nodes/link-nodes/index.d.ts +4 -0
- package/dist/field/nodes/link-nodes/index.d.ts.map +1 -0
- package/dist/field/nodes/link-nodes/index.js +4 -0
- package/dist/field/nodes/link-nodes/index.js.map +1 -0
- package/dist/field/nodes/link-nodes/link-node.d.ts +42 -0
- package/dist/field/nodes/link-nodes/link-node.d.ts.map +1 -0
- package/dist/field/nodes/link-nodes/link-node.js +340 -0
- package/dist/field/nodes/link-nodes/link-node.js.map +1 -0
- package/dist/field/nodes/link-nodes/types.d.ts +16 -0
- package/dist/field/nodes/link-nodes/types.d.ts.map +1 -0
- package/dist/field/nodes/link-nodes/types.js +2 -0
- package/dist/field/nodes/link-nodes/types.js.map +1 -0
- package/dist/field/nodes/vimeo-node/index.d.ts +30 -0
- package/dist/field/nodes/vimeo-node/index.d.ts.map +1 -0
- package/dist/field/nodes/vimeo-node/index.js +92 -0
- package/dist/field/nodes/vimeo-node/index.js.map +1 -0
- package/dist/field/nodes/youtube-node/index.d.ts +30 -0
- package/dist/field/nodes/youtube-node/index.d.ts.map +1 -0
- package/dist/field/nodes/youtube-node/index.js +92 -0
- package/dist/field/nodes/youtube-node/index.js.map +1 -0
- package/dist/field/plugins/admonition-plugin/admonition-drawer.css +8 -0
- package/dist/field/plugins/admonition-plugin/admonition-drawer.d.ts +5 -0
- package/dist/field/plugins/admonition-plugin/admonition-drawer.d.ts.map +1 -0
- package/dist/field/plugins/admonition-plugin/admonition-drawer.js +44 -0
- package/dist/field/plugins/admonition-plugin/admonition-drawer.js.map +1 -0
- package/dist/field/plugins/admonition-plugin/fields.d.ts +14 -0
- package/dist/field/plugins/admonition-plugin/fields.d.ts.map +1 -0
- package/dist/field/plugins/admonition-plugin/fields.js +72 -0
- package/dist/field/plugins/admonition-plugin/fields.js.map +1 -0
- package/dist/field/plugins/admonition-plugin/index.d.ts +8 -0
- package/dist/field/plugins/admonition-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/admonition-plugin/index.js +65 -0
- package/dist/field/plugins/admonition-plugin/index.js.map +1 -0
- package/dist/field/plugins/admonition-plugin/types.d.ts +15 -0
- package/dist/field/plugins/admonition-plugin/types.d.ts.map +1 -0
- package/dist/field/plugins/admonition-plugin/types.js +2 -0
- package/dist/field/plugins/admonition-plugin/types.js.map +1 -0
- package/dist/field/plugins/auto-embed-plugin/index.d.ts +26 -0
- package/dist/field/plugins/auto-embed-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/auto-embed-plugin/index.js +191 -0
- package/dist/field/plugins/auto-embed-plugin/index.js.map +1 -0
- package/dist/field/plugins/code-highlight-plugin/index.d.ts +10 -0
- package/dist/field/plugins/code-highlight-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/code-highlight-plugin/index.js +11 -0
- package/dist/field/plugins/code-highlight-plugin/index.js.map +1 -0
- package/dist/field/plugins/drag-drop-paste-plugin/index.d.ts +9 -0
- package/dist/field/plugins/drag-drop-paste-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/drag-drop-paste-plugin/index.js +37 -0
- package/dist/field/plugins/drag-drop-paste-plugin/index.js.map +1 -0
- package/dist/field/plugins/floating-text-format-toolbar-plugin/index.css +150 -0
- package/dist/field/plugins/floating-text-format-toolbar-plugin/index.d.ts +13 -0
- package/dist/field/plugins/floating-text-format-toolbar-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/floating-text-format-toolbar-plugin/index.js +236 -0
- package/dist/field/plugins/floating-text-format-toolbar-plugin/index.js.map +1 -0
- package/dist/field/plugins/inline-image-plugin/fields.d.ts +12 -0
- package/dist/field/plugins/inline-image-plugin/fields.d.ts.map +1 -0
- package/dist/field/plugins/inline-image-plugin/fields.js +160 -0
- package/dist/field/plugins/inline-image-plugin/fields.js.map +1 -0
- package/dist/field/plugins/inline-image-plugin/index.d.ts +26 -0
- package/dist/field/plugins/inline-image-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/inline-image-plugin/index.js +222 -0
- package/dist/field/plugins/inline-image-plugin/index.js.map +1 -0
- package/dist/field/plugins/inline-image-plugin/inline-image-drawer.css +29 -0
- package/dist/field/plugins/inline-image-plugin/inline-image-drawer.d.ts +5 -0
- package/dist/field/plugins/inline-image-plugin/inline-image-drawer.d.ts.map +1 -0
- package/dist/field/plugins/inline-image-plugin/inline-image-drawer.js +51 -0
- package/dist/field/plugins/inline-image-plugin/inline-image-drawer.js.map +1 -0
- package/dist/field/plugins/inline-image-plugin/types.d.ts +16 -0
- package/dist/field/plugins/inline-image-plugin/types.d.ts.map +1 -0
- package/dist/field/plugins/inline-image-plugin/types.js +2 -0
- package/dist/field/plugins/inline-image-plugin/types.js.map +1 -0
- package/dist/field/plugins/inline-image-plugin/utils.d.ts +9 -0
- package/dist/field/plugins/inline-image-plugin/utils.d.ts.map +1 -0
- package/dist/field/plugins/inline-image-plugin/utils.js +27 -0
- package/dist/field/plugins/inline-image-plugin/utils.js.map +1 -0
- package/dist/field/plugins/layout-plugin/insert-layout-dialog.d.ts +14 -0
- package/dist/field/plugins/layout-plugin/insert-layout-dialog.d.ts.map +1 -0
- package/dist/field/plugins/layout-plugin/insert-layout-dialog.js +26 -0
- package/dist/field/plugins/layout-plugin/insert-layout-dialog.js.map +1 -0
- package/dist/field/plugins/layout-plugin/layout-plugin.d.ts +8 -0
- package/dist/field/plugins/layout-plugin/layout-plugin.d.ts.map +1 -0
- package/dist/field/plugins/layout-plugin/layout-plugin.js +87 -0
- package/dist/field/plugins/layout-plugin/layout-plugin.js.map +1 -0
- package/dist/field/plugins/link-plugin/auto-link/auto-link-plugin.d.ts +22 -0
- package/dist/field/plugins/link-plugin/auto-link/auto-link-plugin.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/auto-link/auto-link-plugin.js +218 -0
- package/dist/field/plugins/link-plugin/auto-link/auto-link-plugin.js.map +1 -0
- package/dist/field/plugins/link-plugin/auto-link/index.d.ts +10 -0
- package/dist/field/plugins/link-plugin/auto-link/index.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/auto-link/index.js +17 -0
- package/dist/field/plugins/link-plugin/auto-link/index.js.map +1 -0
- package/dist/field/plugins/link-plugin/link/fields.d.ts +11 -0
- package/dist/field/plugins/link-plugin/link/fields.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/link/fields.js +120 -0
- package/dist/field/plugins/link-plugin/link/fields.js.map +1 -0
- package/dist/field/plugins/link-plugin/link/floating-link-editor.css +128 -0
- package/dist/field/plugins/link-plugin/link/floating-link-editor.d.ts +13 -0
- package/dist/field/plugins/link-plugin/link/floating-link-editor.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/link/floating-link-editor.js +239 -0
- package/dist/field/plugins/link-plugin/link/floating-link-editor.js.map +1 -0
- package/dist/field/plugins/link-plugin/link/index.d.ts +2 -0
- package/dist/field/plugins/link-plugin/link/index.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/link/index.js +65 -0
- package/dist/field/plugins/link-plugin/link/index.js.map +1 -0
- package/dist/field/plugins/link-plugin/link/link-drawer.css +21 -0
- package/dist/field/plugins/link-plugin/link/link-drawer.d.ts +5 -0
- package/dist/field/plugins/link-plugin/link/link-drawer.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/link/link-drawer.js +72 -0
- package/dist/field/plugins/link-plugin/link/link-drawer.js.map +1 -0
- package/dist/field/plugins/link-plugin/link/types.d.ts +20 -0
- package/dist/field/plugins/link-plugin/link/types.d.ts.map +1 -0
- package/dist/field/plugins/link-plugin/link/types.js +2 -0
- package/dist/field/plugins/link-plugin/link/types.js.map +1 -0
- package/dist/field/plugins/table-action-menu-plugin/index.d.ts +6 -0
- package/dist/field/plugins/table-action-menu-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/table-action-menu-plugin/index.js +476 -0
- package/dist/field/plugins/table-action-menu-plugin/index.js.map +1 -0
- package/dist/field/plugins/table-plugin/index.d.ts +4 -0
- package/dist/field/plugins/table-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/table-plugin/index.js +30 -0
- package/dist/field/plugins/table-plugin/index.js.map +1 -0
- package/dist/field/plugins/table-plugin/table-drawer.d.ts +12 -0
- package/dist/field/plugins/table-plugin/table-drawer.d.ts.map +1 -0
- package/dist/field/plugins/table-plugin/table-drawer.js +42 -0
- package/dist/field/plugins/table-plugin/table-drawer.js.map +1 -0
- package/dist/field/plugins/toolbar-plugin/index.d.ts +10 -0
- package/dist/field/plugins/toolbar-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/toolbar-plugin/index.js +394 -0
- package/dist/field/plugins/toolbar-plugin/index.js.map +1 -0
- package/dist/field/plugins/treeview-plugin/index.d.ts +10 -0
- package/dist/field/plugins/treeview-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/treeview-plugin/index.js +9 -0
- package/dist/field/plugins/treeview-plugin/index.js.map +1 -0
- package/dist/field/plugins/vimeo-plugin/index.d.ts +4 -0
- package/dist/field/plugins/vimeo-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/vimeo-plugin/index.js +29 -0
- package/dist/field/plugins/vimeo-plugin/index.js.map +1 -0
- package/dist/field/plugins/youtube-plugin/index.d.ts +4 -0
- package/dist/field/plugins/youtube-plugin/index.d.ts.map +1 -0
- package/dist/field/plugins/youtube-plugin/index.js +29 -0
- package/dist/field/plugins/youtube-plugin/index.js.map +1 -0
- package/dist/field/rsc-entry.d.ts +9 -0
- package/dist/field/rsc-entry.d.ts.map +1 -0
- package/dist/field/rsc-entry.js +57 -0
- package/dist/field/rsc-entry.js.map +1 -0
- package/dist/field/shared/canUseDOM.d.ts +9 -0
- package/dist/field/shared/canUseDOM.d.ts.map +1 -0
- package/dist/field/shared/canUseDOM.js +9 -0
- package/dist/field/shared/canUseDOM.js.map +1 -0
- package/dist/field/shared/environment.d.ts +23 -0
- package/dist/field/shared/environment.d.ts.map +1 -0
- package/dist/field/shared/environment.js +22 -0
- package/dist/field/shared/environment.js.map +1 -0
- package/dist/field/shared/invariant.d.ts +9 -0
- package/dist/field/shared/invariant.d.ts.map +1 -0
- package/dist/field/shared/invariant.js +18 -0
- package/dist/field/shared/invariant.js.map +1 -0
- package/dist/field/shared/simpleDiffWithCursor.d.ts +13 -0
- package/dist/field/shared/simpleDiffWithCursor.d.ts.map +1 -0
- package/dist/field/shared/simpleDiffWithCursor.js +34 -0
- package/dist/field/shared/simpleDiffWithCursor.js.map +1 -0
- package/dist/field/shared/useLayoutEffect.d.ts +11 -0
- package/dist/field/shared/useLayoutEffect.d.ts.map +1 -0
- package/dist/field/shared/useLayoutEffect.js +12 -0
- package/dist/field/shared/useLayoutEffect.js.map +1 -0
- package/dist/field/shared/warnOnlyOnce.d.ts +9 -0
- package/dist/field/shared/warnOnlyOnce.d.ts.map +1 -0
- package/dist/field/shared/warnOnlyOnce.js +21 -0
- package/dist/field/shared/warnOnlyOnce.js.map +1 -0
- package/dist/field/themes/lexical-editor-theme.css +558 -0
- package/dist/field/themes/lexical-editor-theme.d.ts +10 -0
- package/dist/field/themes/lexical-editor-theme.d.ts.map +1 -0
- package/dist/field/themes/lexical-editor-theme.js +105 -0
- package/dist/field/themes/lexical-editor-theme.js.map +1 -0
- package/dist/field/types.d.ts +10 -0
- package/dist/field/types.d.ts.map +1 -0
- package/dist/field/types.js +2 -0
- package/dist/field/types.js.map +1 -0
- package/dist/field/ui/button.css +45 -0
- package/dist/field/ui/button.d.ts +19 -0
- package/dist/field/ui/button.d.ts.map +1 -0
- package/dist/field/ui/button.js +8 -0
- package/dist/field/ui/button.js.map +1 -0
- package/dist/field/ui/checkbox.css +52 -0
- package/dist/field/ui/color-picker.css +88 -0
- package/dist/field/ui/color-picker.d.ts +21 -0
- package/dist/field/ui/color-picker.d.ts.map +1 -0
- package/dist/field/ui/color-picker.js +250 -0
- package/dist/field/ui/color-picker.js.map +1 -0
- package/dist/field/ui/content-editable-inline.d.ts +13 -0
- package/dist/field/ui/content-editable-inline.d.ts.map +1 -0
- package/dist/field/ui/content-editable-inline.js +14 -0
- package/dist/field/ui/content-editable-inline.js.map +1 -0
- package/dist/field/ui/content-editable.css +28 -0
- package/dist/field/ui/content-editable.d.ts +13 -0
- package/dist/field/ui/content-editable.d.ts.map +1 -0
- package/dist/field/ui/content-editable.js +15 -0
- package/dist/field/ui/content-editable.js.map +1 -0
- package/dist/field/ui/dialog.css +17 -0
- package/dist/field/ui/dialog.d.ts +17 -0
- package/dist/field/ui/dialog.d.ts.map +1 -0
- package/dist/field/ui/dialog.js +10 -0
- package/dist/field/ui/dialog.js.map +1 -0
- package/dist/field/ui/dropdown.d.ts +25 -0
- package/dist/field/ui/dropdown.d.ts.map +1 -0
- package/dist/field/ui/dropdown.js +118 -0
- package/dist/field/ui/dropdown.js.map +1 -0
- package/dist/field/ui/file-input.d.ts +18 -0
- package/dist/field/ui/file-input.d.ts.map +1 -0
- package/dist/field/ui/file-input.js +17 -0
- package/dist/field/ui/file-input.js.map +1 -0
- package/dist/field/ui/input.css +32 -0
- package/dist/field/ui/modal.css +84 -0
- package/dist/field/ui/modal.d.ts +17 -0
- package/dist/field/ui/modal.d.ts.map +1 -0
- package/dist/field/ui/modal.js +48 -0
- package/dist/field/ui/modal.js.map +1 -0
- package/dist/field/ui/placeholder-inline.d.ts +14 -0
- package/dist/field/ui/placeholder-inline.d.ts.map +1 -0
- package/dist/field/ui/placeholder-inline.js +12 -0
- package/dist/field/ui/placeholder-inline.js.map +1 -0
- package/dist/field/ui/placeholder.css +33 -0
- package/dist/field/ui/placeholder.d.ts +14 -0
- package/dist/field/ui/placeholder.d.ts.map +1 -0
- package/dist/field/ui/placeholder.js +14 -0
- package/dist/field/ui/placeholder.js.map +1 -0
- package/dist/field/ui/select.css +34 -0
- package/dist/field/ui/select.d.ts +16 -0
- package/dist/field/ui/select.d.ts.map +1 -0
- package/dist/field/ui/select.js +17 -0
- package/dist/field/ui/select.js.map +1 -0
- package/dist/field/ui/switch.d.ts +15 -0
- package/dist/field/ui/switch.d.ts.map +1 -0
- package/dist/field/ui/switch.js +8 -0
- package/dist/field/ui/switch.js.map +1 -0
- package/dist/field/ui/text-input.d.ts +20 -0
- package/dist/field/ui/text-input.d.ts.map +1 -0
- package/dist/field/ui/text-input.js +18 -0
- package/dist/field/ui/text-input.js.map +1 -0
- package/dist/field/utils/cloneDeep.d.ts +2 -0
- package/dist/field/utils/cloneDeep.d.ts.map +1 -0
- package/dist/field/utils/cloneDeep.js +50 -0
- package/dist/field/utils/cloneDeep.js.map +1 -0
- package/dist/field/utils/deepEqual.d.ts +2 -0
- package/dist/field/utils/deepEqual.d.ts.map +1 -0
- package/dist/field/utils/deepEqual.js +48 -0
- package/dist/field/utils/deepEqual.js.map +1 -0
- package/dist/field/utils/emoji-list.d.ts +28 -0
- package/dist/field/utils/emoji-list.d.ts.map +1 -0
- package/dist/field/utils/emoji-list.js +16613 -0
- package/dist/field/utils/emoji-list.js.map +1 -0
- package/dist/field/utils/getDOMRangeRect.d.ts +9 -0
- package/dist/field/utils/getDOMRangeRect.d.ts.map +1 -0
- package/dist/field/utils/getDOMRangeRect.js +23 -0
- package/dist/field/utils/getDOMRangeRect.js.map +1 -0
- package/dist/field/utils/getSelectedNode.d.ts +3 -0
- package/dist/field/utils/getSelectedNode.d.ts.map +1 -0
- package/dist/field/utils/getSelectedNode.js +25 -0
- package/dist/field/utils/getSelectedNode.js.map +1 -0
- package/dist/field/utils/guard.d.ts +9 -0
- package/dist/field/utils/guard.d.ts.map +1 -0
- package/dist/field/utils/guard.js +11 -0
- package/dist/field/utils/guard.js.map +1 -0
- package/dist/field/utils/hashSerializedState.d.ts +3 -0
- package/dist/field/utils/hashSerializedState.d.ts.map +1 -0
- package/dist/field/utils/hashSerializedState.js +32 -0
- package/dist/field/utils/hashSerializedState.js.map +1 -0
- package/dist/field/utils/isMobileWidth.d.ts +9 -0
- package/dist/field/utils/isMobileWidth.d.ts.map +1 -0
- package/dist/field/utils/isMobileWidth.js +9 -0
- package/dist/field/utils/isMobileWidth.js.map +1 -0
- package/dist/field/utils/joinClasses.d.ts +9 -0
- package/dist/field/utils/joinClasses.d.ts.map +1 -0
- package/dist/field/utils/joinClasses.js +11 -0
- package/dist/field/utils/joinClasses.js.map +1 -0
- package/dist/field/utils/load-related.d.ts +4 -0
- package/dist/field/utils/load-related.d.ts.map +1 -0
- package/dist/field/utils/load-related.js +45 -0
- package/dist/field/utils/load-related.js.map +1 -0
- package/dist/field/utils/point.d.ts +22 -0
- package/dist/field/utils/point.d.ts.map +1 -0
- package/dist/field/utils/point.js +43 -0
- package/dist/field/utils/point.js.map +1 -0
- package/dist/field/utils/rect.d.ts +46 -0
- package/dist/field/utils/rect.d.ts.map +1 -0
- package/dist/field/utils/rect.js +101 -0
- package/dist/field/utils/rect.js.map +1 -0
- package/dist/field/utils/setFloatingElemPosition.d.ts +2 -0
- package/dist/field/utils/setFloatingElemPosition.d.ts.map +1 -0
- package/dist/field/utils/setFloatingElemPosition.js +34 -0
- package/dist/field/utils/setFloatingElemPosition.js.map +1 -0
- package/dist/field/utils/setFloatingElemPositionForLinkEditor.d.ts +2 -0
- package/dist/field/utils/setFloatingElemPositionForLinkEditor.d.ts.map +1 -0
- package/dist/field/utils/setFloatingElemPositionForLinkEditor.js +33 -0
- package/dist/field/utils/setFloatingElemPositionForLinkEditor.js.map +1 -0
- package/dist/field/utils/swipe.d.ts +12 -0
- package/dist/field/utils/swipe.d.ts.map +1 -0
- package/dist/field/utils/swipe.js +100 -0
- package/dist/field/utils/swipe.js.map +1 -0
- package/dist/field/utils/url.d.ts +11 -0
- package/dist/field/utils/url.d.ts.map +1 -0
- package/dist/field/utils/url.js +45 -0
- package/dist/field/utils/url.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validate/hasText.d.ts +3 -0
- package/dist/validate/hasText.d.ts.map +1 -0
- package/dist/validate/hasText.js +29 -0
- package/dist/validate/hasText.js.map +1 -0
- package/dist/validate/validate-client.d.ts +4 -0
- package/dist/validate/validate-client.d.ts.map +1 -0
- package/dist/validate/validate-client.js +17 -0
- package/dist/validate/validate-client.js.map +1 -0
- package/dist/validate/validate-server.d.ts +4 -0
- package/dist/validate/validate-server.d.ts.map +1 -0
- package/dist/validate/validate-server.js +10 -0
- package/dist/validate/validate-server.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
|
+
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
6
|
+
import { formatDrawerSlug, useConfig, useEditDepth, useModal } from '@payloadcms/ui';
|
|
7
|
+
import { $getSelection, $isLineBreakNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from 'lexical';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
9
|
+
import { useEditorConfig } from '../../../config/editor-config-context';
|
|
10
|
+
import { $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '../../../nodes/link-nodes';
|
|
11
|
+
import { getSelectedNode } from '../../../utils/getSelectedNode';
|
|
12
|
+
import { setFloatingElemPositionForLinkEditor } from '../../../utils/setFloatingElemPositionForLinkEditor';
|
|
13
|
+
import { sanitizeUrl } from '../../../utils/url';
|
|
14
|
+
import { LinkDrawer } from './link-drawer';
|
|
15
|
+
import './floating-link-editor.css';
|
|
16
|
+
function createPreviewLink(config, url) {
|
|
17
|
+
if (url?.startsWith('/') ?? false) {
|
|
18
|
+
return `${config.serverURL}${url}`;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function FloatingLinkEditor({ editor, isLink, setIsLink, anchorElem, }) {
|
|
25
|
+
const editorRef = useRef(null);
|
|
26
|
+
const [linkEditorState, setLinkEditorState] = useState({ label: null, url: '' });
|
|
27
|
+
const [linkDrawerData, setLinkDrawerData] = useState(undefined);
|
|
28
|
+
const { uuid } = useEditorConfig();
|
|
29
|
+
const { config } = useConfig();
|
|
30
|
+
const { toggleModal, isModalOpen, closeModal } = useModal();
|
|
31
|
+
const editDepth = useEditDepth();
|
|
32
|
+
const drawerSlug = formatDrawerSlug({
|
|
33
|
+
slug: `rich-text-link-lexical-${uuid}`,
|
|
34
|
+
depth: editDepth,
|
|
35
|
+
});
|
|
36
|
+
const $updateLinkEditor = useCallback(() => {
|
|
37
|
+
const selection = $getSelection();
|
|
38
|
+
if ($isRangeSelection(selection)) {
|
|
39
|
+
const node = getSelectedNode(selection);
|
|
40
|
+
const linkParent = $findMatchingParent(node, $isLinkNode);
|
|
41
|
+
// Initial state:
|
|
42
|
+
let data = {
|
|
43
|
+
text: '',
|
|
44
|
+
fields: {
|
|
45
|
+
url: '',
|
|
46
|
+
linkType: undefined,
|
|
47
|
+
newTab: undefined,
|
|
48
|
+
doc: undefined,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
const linkNode = linkParent ?? ($isLinkNode(node) ? node : null);
|
|
52
|
+
if (linkNode != null && $isLinkNode(linkNode)) {
|
|
53
|
+
// Prepare LinkDrawer data
|
|
54
|
+
data = {
|
|
55
|
+
text: linkNode.getTextContent(),
|
|
56
|
+
fields: linkNode.getAttributes(),
|
|
57
|
+
};
|
|
58
|
+
if (data.fields?.linkType === 'custom') {
|
|
59
|
+
// custom
|
|
60
|
+
setLinkEditorState({
|
|
61
|
+
label: null,
|
|
62
|
+
url: createPreviewLink(config, data.fields?.url) ?? '',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// internal
|
|
67
|
+
setLinkEditorState({
|
|
68
|
+
label: `relation to ${data.fields?.doc?.relationTo}: ${data.fields?.doc?.value}`,
|
|
69
|
+
url: `${config.serverURL}${config.routes.admin}/collections/${data.fields?.doc?.relationTo}/${data.fields?.doc?.value}`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setLinkEditorState({
|
|
75
|
+
label: null,
|
|
76
|
+
url: '',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
setLinkDrawerData(data);
|
|
80
|
+
}
|
|
81
|
+
const editorElem = editorRef.current;
|
|
82
|
+
const nativeSelection = window.getSelection();
|
|
83
|
+
const { activeElement } = document;
|
|
84
|
+
if (editorElem === null) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const rootElement = editor.getRootElement();
|
|
88
|
+
if (selection !== null &&
|
|
89
|
+
nativeSelection !== null &&
|
|
90
|
+
rootElement !== null &&
|
|
91
|
+
rootElement.contains(nativeSelection.anchorNode) &&
|
|
92
|
+
editor.isEditable()) {
|
|
93
|
+
const domRect = nativeSelection.focusNode?.parentElement?.getBoundingClientRect();
|
|
94
|
+
if (domRect != null) {
|
|
95
|
+
domRect.y += 40;
|
|
96
|
+
setFloatingElemPositionForLinkEditor(domRect, editorElem, anchorElem);
|
|
97
|
+
}
|
|
98
|
+
// setLastSelection(selection)
|
|
99
|
+
}
|
|
100
|
+
else if (activeElement == null || activeElement.className !== 'link-input') {
|
|
101
|
+
if (rootElement !== null) {
|
|
102
|
+
setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem);
|
|
103
|
+
}
|
|
104
|
+
// setLastSelection(null)
|
|
105
|
+
setLinkEditorState({ label: null, url: '' });
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}, [anchorElem, editor, config]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const scrollerElem = anchorElem.parentElement;
|
|
111
|
+
const update = () => {
|
|
112
|
+
editor.getEditorState().read(() => {
|
|
113
|
+
$updateLinkEditor();
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
window.addEventListener('resize', update);
|
|
117
|
+
if (scrollerElem != null) {
|
|
118
|
+
scrollerElem.addEventListener('scroll', update);
|
|
119
|
+
}
|
|
120
|
+
return () => {
|
|
121
|
+
window.removeEventListener('resize', update);
|
|
122
|
+
if (scrollerElem != null) {
|
|
123
|
+
scrollerElem.removeEventListener('scroll', update);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}, [anchorElem.parentElement, editor, $updateLinkEditor]);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
129
|
+
editorState.read(() => {
|
|
130
|
+
$updateLinkEditor();
|
|
131
|
+
});
|
|
132
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
133
|
+
void $updateLinkEditor();
|
|
134
|
+
return true;
|
|
135
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ESCAPE_COMMAND, () => {
|
|
136
|
+
if (isLink) {
|
|
137
|
+
setIsLink(false);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
}, COMMAND_PRIORITY_HIGH));
|
|
142
|
+
}, [editor, $updateLinkEditor, setIsLink, isLink]);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
editor.getEditorState().read(() => {
|
|
145
|
+
$updateLinkEditor();
|
|
146
|
+
});
|
|
147
|
+
}, [editor, $updateLinkEditor]);
|
|
148
|
+
/**
|
|
149
|
+
* handleModalSubmit
|
|
150
|
+
* @param data
|
|
151
|
+
*/
|
|
152
|
+
const handleModalSubmit = (data) => {
|
|
153
|
+
closeModal(drawerSlug);
|
|
154
|
+
const newNode = {
|
|
155
|
+
newTab: data.fields?.newTab,
|
|
156
|
+
url: data?.fields?.linkType === 'custom' ? data?.fields?.url : undefined,
|
|
157
|
+
linkType: data?.fields?.linkType,
|
|
158
|
+
doc: data?.fields?.linkType === 'internal' ? data?.fields?.doc : undefined,
|
|
159
|
+
text: data?.text,
|
|
160
|
+
};
|
|
161
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, newNode);
|
|
162
|
+
};
|
|
163
|
+
return (_jsx("div", { ref: editorRef, className: "link-editor", children: isLink === true && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "link-input", children: [_jsx("a", { href: sanitizeUrl(linkEditorState.url), target: "_blank", rel: "noopener noreferrer", children: linkEditorState.label != null && linkEditorState.label.length > 0
|
|
164
|
+
? linkEditorState.label
|
|
165
|
+
: linkEditorState.url }), _jsx("div", { "aria-label": "Edit link", className: "link-edit", role: "button", tabIndex: 0,
|
|
166
|
+
// We don't want to navigate away from the editor when clicking the link
|
|
167
|
+
onMouseDown: (event) => {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
}, onClick: () => {
|
|
170
|
+
toggleModal(drawerSlug);
|
|
171
|
+
}, onKeyDown: (event) => {
|
|
172
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
toggleModal(drawerSlug);
|
|
175
|
+
}
|
|
176
|
+
} }), _jsx("div", { "aria-label": "Remove link", className: "link-trash", role: "button", tabIndex: 0, onMouseDown: (event) => {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
}, onClick: () => {
|
|
179
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
180
|
+
}, onKeyDown: (event) => {
|
|
181
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
184
|
+
}
|
|
185
|
+
} })] }), _jsx(LinkDrawer, { isOpen: isModalOpen(drawerSlug), drawerSlug: drawerSlug, data: linkDrawerData, onSubmit: handleModalSubmit, onClose: () => {
|
|
186
|
+
closeModal(drawerSlug);
|
|
187
|
+
} })] })) }));
|
|
188
|
+
}
|
|
189
|
+
function useFloatingLinkEditor(editor, anchorElem) {
|
|
190
|
+
const [activeEditor, setActiveEditor] = useState(editor);
|
|
191
|
+
const [isLink, setIsLink] = useState(false);
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
const $determineIsLink = () => {
|
|
194
|
+
const selection = $getSelection();
|
|
195
|
+
if ($isRangeSelection(selection)) {
|
|
196
|
+
const focusNode = getSelectedNode(selection);
|
|
197
|
+
const focusLinkNode = $findMatchingParent(focusNode, $isLinkNode);
|
|
198
|
+
const focusAutoLinkNode = $findMatchingParent(focusNode, $isAutoLinkNode);
|
|
199
|
+
if (focusLinkNode == null && focusAutoLinkNode == null) {
|
|
200
|
+
setIsLink(false);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// Test that we have a valid link node
|
|
204
|
+
const invalidLinkNode = selection
|
|
205
|
+
.getNodes()
|
|
206
|
+
.filter((node) => !$isLineBreakNode(node))
|
|
207
|
+
.find((node) => {
|
|
208
|
+
const linkNode = $findMatchingParent(node, $isLinkNode);
|
|
209
|
+
const autoLinkNode = $findMatchingParent(node, $isAutoLinkNode);
|
|
210
|
+
return ((focusLinkNode && !focusLinkNode.is(linkNode)) ||
|
|
211
|
+
(linkNode && !linkNode.is(focusLinkNode)) ||
|
|
212
|
+
(focusAutoLinkNode && !focusAutoLinkNode.is(autoLinkNode)) ||
|
|
213
|
+
(autoLinkNode && !autoLinkNode.is(focusAutoLinkNode)));
|
|
214
|
+
});
|
|
215
|
+
if (invalidLinkNode == null) {
|
|
216
|
+
setIsLink(true);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
setIsLink(false);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
224
|
+
editorState.read(() => {
|
|
225
|
+
$determineIsLink();
|
|
226
|
+
});
|
|
227
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, (_payload, newEditor) => {
|
|
228
|
+
$determineIsLink();
|
|
229
|
+
setActiveEditor(newEditor);
|
|
230
|
+
return false;
|
|
231
|
+
}, COMMAND_PRIORITY_CRITICAL));
|
|
232
|
+
}, [editor]);
|
|
233
|
+
return createPortal(_jsx(FloatingLinkEditor, { editor: activeEditor, anchorElem: anchorElem, isLink: isLink, setIsLink: setIsLink }), anchorElem);
|
|
234
|
+
}
|
|
235
|
+
export function FloatingLinkEditorPlugin({ anchorElem = document.body, }) {
|
|
236
|
+
const [editor] = useLexicalComposerContext();
|
|
237
|
+
return useFloatingLinkEditor(editor, anchorElem);
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=floating-link-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-link-editor.js","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/floating-link-editor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAWZ,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEpF,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,oCAAoC,EAAE,MAAM,qDAAqD,CAAA;AAC1G,OAA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M,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACpB,EACF,UAAU,CACX,CAAA;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,EACvC,UAAU,GAAG,QAAQ,CAAC,IAAI,GAG3B;IACC,MAAM,CAAC,MAAM,CAAC,GAAG,yBAAyB,EAAE,CAAA;IAC5C,OAAO,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/index.tsx"],"names":[],"mappings":"AA8BA,wBAAgB,UAAU,IAAI,IAAI,CAmEjC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect } from 'react';
|
|
10
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
11
|
+
import { mergeRegister } from '@lexical/utils';
|
|
12
|
+
import { $getSelection, $isElementNode, $isRangeSelection, COMMAND_PRIORITY_LOW, PASTE_COMMAND, } from 'lexical';
|
|
13
|
+
import { $toggleLink, LinkNode, TOGGLE_LINK_COMMAND, } from '../../../nodes/link-nodes';
|
|
14
|
+
import { validateUrl } from '../../../utils/url';
|
|
15
|
+
export function LinkPlugin() {
|
|
16
|
+
const [editor] = useLexicalComposerContext();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!editor.hasNodes([LinkNode])) {
|
|
19
|
+
throw new Error('LinkPlugin: LinkNode not registered on editor');
|
|
20
|
+
}
|
|
21
|
+
return mergeRegister(editor.registerCommand(TOGGLE_LINK_COMMAND, (payload) => {
|
|
22
|
+
const linkAttributes = payload;
|
|
23
|
+
// TODO - revisit encoding / decoding of URL
|
|
24
|
+
// validate
|
|
25
|
+
// currently short-circuiting for custom relative URLs that begin with a forward slash
|
|
26
|
+
if (linkAttributes?.linkType === 'custom' &&
|
|
27
|
+
linkAttributes?.url?.startsWith('/') === false) {
|
|
28
|
+
if (validateUrl !== undefined && validateUrl(linkAttributes?.url) === false) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
$toggleLink(linkAttributes);
|
|
33
|
+
return true;
|
|
34
|
+
}, COMMAND_PRIORITY_LOW), validateUrl !== undefined
|
|
35
|
+
? editor.registerCommand(PASTE_COMMAND, (event) => {
|
|
36
|
+
const selection = $getSelection();
|
|
37
|
+
if (!$isRangeSelection(selection) ||
|
|
38
|
+
selection.isCollapsed() ||
|
|
39
|
+
!(event instanceof ClipboardEvent) ||
|
|
40
|
+
event.clipboardData == null) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const clipboardText = event.clipboardData.getData('text');
|
|
44
|
+
if (!validateUrl(clipboardText)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// If we select nodes that are elements then avoid applying the link.
|
|
48
|
+
if (!selection.getNodes().some((node) => $isElementNode(node))) {
|
|
49
|
+
const linkAttributes = {
|
|
50
|
+
linkType: 'custom',
|
|
51
|
+
url: clipboardText,
|
|
52
|
+
};
|
|
53
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, linkAttributes);
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}, COMMAND_PRIORITY_LOW)
|
|
59
|
+
: () => {
|
|
60
|
+
// Don't paste arbitrary text as a link when there's no validate function
|
|
61
|
+
});
|
|
62
|
+
}, [editor]);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=index.js.map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ugin--modal-actions {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 12px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.link-drawer--text {
|
|
7
|
+
margin: 0 0 2rem 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.link-drawer--radio-group {
|
|
11
|
+
margin: 0 0 2rem 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.link-drawer--radio-group--options {
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: 12px;
|
|
17
|
+
margin: 0 0 1rem 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
list-style: none;
|
|
20
|
+
list-style-position: inside;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/link-drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAA;AAExD,OAAO,mBAAmB,CAAA;AAI1B,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyGhD,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Button, Drawer, Form, FormSubmit, RenderFields, useConfig, useTranslation, } from '@payloadcms/ui';
|
|
4
|
+
import { v4 as uuid } from 'uuid';
|
|
5
|
+
import { getFields, getInitialState, validateFields } from './fields';
|
|
6
|
+
import './link-drawer.css';
|
|
7
|
+
const baseClass = 'rich-text-link-edit-modal';
|
|
8
|
+
export const LinkDrawer = ({ isOpen = false, drawerSlug, onSubmit, onClose, data: dataFromProps, }) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const { config } = useConfig();
|
|
11
|
+
const [synchronizedFormState, setSynchronizedFormState] = useState(undefined);
|
|
12
|
+
// NOTE: enableRichTextLink is currently true by default for all collections
|
|
13
|
+
// and so we need to check for both enableRichTextLink and hidden. For example
|
|
14
|
+
// payload-preferences and payload-migrations have enableRichTextLink: true 🫨.
|
|
15
|
+
const validRelationships = useMemo(() => {
|
|
16
|
+
const results = [];
|
|
17
|
+
for (const c of config.collections) {
|
|
18
|
+
if (c?.admin?.enableRichTextLink === true &&
|
|
19
|
+
// (c?.admin?.hidden == null || c?.admin?.hidden === false) &&
|
|
20
|
+
c?.slug !== 'payload-preferences' &&
|
|
21
|
+
c?.slug !== 'payload-migrations') {
|
|
22
|
+
results.push(c.slug);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return results;
|
|
26
|
+
}, [config]);
|
|
27
|
+
const handleOnCancel = () => {
|
|
28
|
+
setSynchronizedFormState(undefined);
|
|
29
|
+
onClose();
|
|
30
|
+
};
|
|
31
|
+
async function handleFormOnChange({ formState }) {
|
|
32
|
+
return new Promise((resolve, _reject) => {
|
|
33
|
+
validateFields(formState);
|
|
34
|
+
resolve(formState);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const handleFormOnSubmit = (fields, data) => {
|
|
38
|
+
const { valid } = validateFields(fields);
|
|
39
|
+
if (valid === true) {
|
|
40
|
+
if (onSubmit != null) {
|
|
41
|
+
const doc = data.doc;
|
|
42
|
+
const submitData = {
|
|
43
|
+
text: data.text,
|
|
44
|
+
fields: {
|
|
45
|
+
url: data.url,
|
|
46
|
+
newTab: data.newTab,
|
|
47
|
+
doc: {
|
|
48
|
+
value: doc?.value,
|
|
49
|
+
relationTo: doc?.relationTo,
|
|
50
|
+
data: {},
|
|
51
|
+
},
|
|
52
|
+
linkType: data.linkType === 'custom' ? 'custom' : 'internal',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
onSubmit(submitData);
|
|
56
|
+
}
|
|
57
|
+
setSynchronizedFormState(undefined);
|
|
58
|
+
onClose();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (synchronizedFormState == null && isOpen === true) {
|
|
63
|
+
const formState = getInitialState(dataFromProps);
|
|
64
|
+
setSynchronizedFormState(formState);
|
|
65
|
+
}
|
|
66
|
+
}, [synchronizedFormState, isOpen, dataFromProps]);
|
|
67
|
+
if (isOpen === false) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return (_jsx(Drawer, { slug: drawerSlug, className: baseClass, title: t('fields:editLink') ?? '', children: _jsxs(Form, { initialState: synchronizedFormState, onChange: [handleFormOnChange], onSubmit: handleFormOnSubmit, uuid: uuid(), children: [_jsx(RenderFields, { fields: getFields(validRelationships), forceRender: true, parentSchemaPath: "", parentPath: "", parentIndexPath: "", permissions: true, readOnly: false }), _jsxs("div", { className: "link-plugin--modal-actions", "data-test-id": "link-plugin-model-actions", children: [_jsx(FormSubmit, { children: t('general:save') }), _jsx(Button, { buttonStyle: "secondary", onClick: handleOnCancel, children: t('general:cancel') })] })] }) }));
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=link-drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-drawer.js","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/link-drawer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AAEjC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGrE,OAAO,mBAAmB,CAAA;AAE1B,MAAM,SAAS,GAAG,2BAA2B,CAAA;AAE7C,MAAM,C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EAAE,YAC/E,MAAC,IAAI,IACH,YAAY,EAAE,qBAAqB,EACnC,QAAQ,EAAE,CAAC,kBAAkB,CAAC,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE,IAAI,EAAE,aAEZ,KAAC,YAAY,IACX,MAAM,EAAE,SAAS,CAAC,kBAAkB,CAAC,EACrC,WAAW,QACX,gBAAgB,EAAC,EAAE,EACnB,UAAU,EAAC,EAAE,EACb,eAAe,EAAC,EAAE,EAClB,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,KAAK,GACf,EACF,eAAK,SAAS,EAAC,4BAA4B,kBAAc,2BAA2B,aAClF,KAAC,UAAU,cAAE,CAAC,CAAC,cAAc,CAAC,GAAc,EAC5C,KAAC,MAAM,IAAC,WAAW,EAAC,WAAW,EAAC,OAAO,EAAE,cAAc,YACpD,CAAC,CAAC,gBAAgB,CAAC,GACb,IACL,IACD,GACA,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LinkAttributes } from '../../../nodes/link-nodes';
|
|
2
|
+
/**
|
|
3
|
+
* The payload of a link node
|
|
4
|
+
* This can be delivered from the link node to the drawer, or from the drawer/anything to the TOGGLE_LINK_COMMAND
|
|
5
|
+
*/
|
|
6
|
+
export interface LinkData {
|
|
7
|
+
fields: LinkAttributes;
|
|
8
|
+
/**
|
|
9
|
+
* The text content of the link node - will be displayed in the drawer
|
|
10
|
+
*/
|
|
11
|
+
text: null | string;
|
|
12
|
+
}
|
|
13
|
+
export interface LinkDrawerProps {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
drawerSlug: string;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
onSubmit: (data: LinkData) => void;
|
|
18
|
+
data?: LinkData;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/field/plugins/link-plugin/link/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/field/plugins/table-action-menu-plugin/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,WAAW,EAA4C,MAAM,OAAO,CAAA;AAgxBlF,wBAAgB,qBAAqB,CAAC,EACpC,UAA0B,EAC1B,SAAiB,GAClB,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,GAAG,IAAI,GAAG,WAAW,CAQrB"}
|