@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,236 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
import './index.css';
|
|
11
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
|
+
import { $isCodeHighlightNode } from '@lexical/code';
|
|
13
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
14
|
+
import { mergeRegister } from '@lexical/utils';
|
|
15
|
+
import { formatDrawerSlug, useEditDepth, useModal } from '@payloadcms/ui';
|
|
16
|
+
import { $getSelection, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, } from 'lexical';
|
|
17
|
+
import { createPortal } from 'react-dom';
|
|
18
|
+
import { useEditorConfig } from '../../config/editor-config-context';
|
|
19
|
+
import { $isLinkNode, TOGGLE_LINK_COMMAND } from '../../nodes/link-nodes';
|
|
20
|
+
import { getDOMRangeRect } from '../../utils/getDOMRangeRect';
|
|
21
|
+
import { getSelectedNode } from '../../utils/getSelectedNode';
|
|
22
|
+
import { setFloatingElemPosition } from '../../utils/setFloatingElemPosition';
|
|
23
|
+
function TextFormatFloatingToolbar({ editor, anchorElem, isLink, isBold, isItalic, isUnderline, isCode, isStrikethrough, isSubscript, isSuperscript, }) {
|
|
24
|
+
const popupCharStylesEditorRef = useRef(null);
|
|
25
|
+
const { uuid } = useEditorConfig();
|
|
26
|
+
const editDepth = useEditDepth();
|
|
27
|
+
const { openModal } = useModal();
|
|
28
|
+
const linkDrawerSlug = formatDrawerSlug({
|
|
29
|
+
slug: `rich-text-link-lexical-${uuid}`,
|
|
30
|
+
depth: editDepth,
|
|
31
|
+
});
|
|
32
|
+
const handleOnInsertLink = useCallback(() => {
|
|
33
|
+
if (!isLink) {
|
|
34
|
+
// Only call TOGGLE_LINK_COMMAND and openModal if there is
|
|
35
|
+
// text selected (at least one character).
|
|
36
|
+
const editorState = editor.getEditorState();
|
|
37
|
+
editorState.read(() => {
|
|
38
|
+
const selection = $getSelection();
|
|
39
|
+
if ($isRangeSelection(selection)) {
|
|
40
|
+
if (selection.focus.offset !== selection.anchor.offset) {
|
|
41
|
+
const linkAttributes = {
|
|
42
|
+
linkType: 'custom',
|
|
43
|
+
url: 'https://',
|
|
44
|
+
};
|
|
45
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, linkAttributes);
|
|
46
|
+
// TODO: WARNING: See: link-plugin-payload/floating-link-editor.
|
|
47
|
+
// The Drawer modal is currently wrapped in the floating editor and
|
|
48
|
+
// will only open if $toggleLink in the link node successfully
|
|
49
|
+
// modifies a link now - which will trigger an update in the
|
|
50
|
+
// floating link editor. Not a good way to couple the two.
|
|
51
|
+
openModal(linkDrawerSlug);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
58
|
+
}
|
|
59
|
+
}, [editor, isLink, linkDrawerSlug, openModal]);
|
|
60
|
+
const mouseMoveListener = useCallback((e) => {
|
|
61
|
+
if (popupCharStylesEditorRef?.current != null && (e.buttons === 1 || e.buttons === 3)) {
|
|
62
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== 'none') {
|
|
63
|
+
const x = e.clientX;
|
|
64
|
+
const y = e.clientY;
|
|
65
|
+
const elementUnderMouse = document.elementFromPoint(x, y);
|
|
66
|
+
if (!popupCharStylesEditorRef.current.contains(elementUnderMouse)) {
|
|
67
|
+
// Mouse is not over the target element => not a normal click, but probably a drag
|
|
68
|
+
popupCharStylesEditorRef.current.style.pointerEvents = 'none';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, []);
|
|
73
|
+
const mouseUpListener = useCallback((_e) => {
|
|
74
|
+
if (popupCharStylesEditorRef?.current != null) {
|
|
75
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== 'auto') {
|
|
76
|
+
popupCharStylesEditorRef.current.style.pointerEvents = 'auto';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (popupCharStylesEditorRef?.current != null) {
|
|
82
|
+
document.addEventListener('mousemove', mouseMoveListener);
|
|
83
|
+
document.addEventListener('mouseup', mouseUpListener);
|
|
84
|
+
return () => {
|
|
85
|
+
document.removeEventListener('mousemove', mouseMoveListener);
|
|
86
|
+
document.removeEventListener('mouseup', mouseUpListener);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [mouseMoveListener, mouseUpListener]);
|
|
90
|
+
const updateTextFormatFloatingToolbar = useCallback(() => {
|
|
91
|
+
const selection = $getSelection();
|
|
92
|
+
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
93
|
+
const nativeSelection = window.getSelection();
|
|
94
|
+
if (popupCharStylesEditorElem === null) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const rootElement = editor.getRootElement();
|
|
98
|
+
if (selection !== null &&
|
|
99
|
+
nativeSelection !== null &&
|
|
100
|
+
!nativeSelection.isCollapsed &&
|
|
101
|
+
rootElement !== null &&
|
|
102
|
+
rootElement.contains(nativeSelection.anchorNode)) {
|
|
103
|
+
const rangeRect = getDOMRangeRect(nativeSelection, rootElement);
|
|
104
|
+
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem, isLink);
|
|
105
|
+
}
|
|
106
|
+
}, [editor, anchorElem, isLink]);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const scrollerElem = anchorElem.parentElement;
|
|
109
|
+
const update = () => {
|
|
110
|
+
editor.getEditorState().read(() => {
|
|
111
|
+
updateTextFormatFloatingToolbar();
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
window.addEventListener('resize', update);
|
|
115
|
+
if (scrollerElem != null) {
|
|
116
|
+
scrollerElem.addEventListener('scroll', update);
|
|
117
|
+
}
|
|
118
|
+
return () => {
|
|
119
|
+
window.removeEventListener('resize', update);
|
|
120
|
+
if (scrollerElem != null) {
|
|
121
|
+
scrollerElem.removeEventListener('scroll', update);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
editor.getEditorState().read(() => {
|
|
127
|
+
updateTextFormatFloatingToolbar();
|
|
128
|
+
});
|
|
129
|
+
return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
130
|
+
editorState.read(() => {
|
|
131
|
+
updateTextFormatFloatingToolbar();
|
|
132
|
+
});
|
|
133
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
134
|
+
updateTextFormatFloatingToolbar();
|
|
135
|
+
return false;
|
|
136
|
+
}, COMMAND_PRIORITY_LOW));
|
|
137
|
+
}, [editor, updateTextFormatFloatingToolbar]);
|
|
138
|
+
return (_jsx("div", { ref: popupCharStylesEditorRef, className: "floating-text-format-popup", children: editor.isEditable() && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => {
|
|
139
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
|
|
140
|
+
}, className: `popup-item spaced ${isBold ? 'active' : ''}`, "aria-label": "Format text as bold", children: _jsx("i", { className: "format bold" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
141
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'italic');
|
|
142
|
+
}, className: `popup-item spaced ${isItalic ? 'active' : ''}`, "aria-label": "Format text as italics", children: _jsx("i", { className: "format italic" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
143
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline');
|
|
144
|
+
}, className: `popup-item spaced ${isUnderline ? 'active' : ''}`, "aria-label": "Format text to underlined", children: _jsx("i", { className: "format underline" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
145
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'strikethrough');
|
|
146
|
+
}, className: `popup-item spaced ${isStrikethrough ? 'active' : ''}`, "aria-label": "Format text with a strikethrough", children: _jsx("i", { className: "format strikethrough" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
147
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'subscript');
|
|
148
|
+
}, className: `popup-item spaced ${isSubscript ? 'active' : ''}`, title: "Subscript", "aria-label": "Format Subscript", children: _jsx("i", { className: "format subscript" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
149
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'superscript');
|
|
150
|
+
}, className: `popup-item spaced ${isSuperscript ? 'active' : ''}`, title: "Superscript", "aria-label": "Format Superscript", children: _jsx("i", { className: "format superscript" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
151
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'code');
|
|
152
|
+
}, className: `popup-item spaced ${isCode ? 'active' : ''}`, "aria-label": "Insert code block", children: _jsx("i", { className: "format code" }) }), _jsx("button", { type: "button", onClick: handleOnInsertLink, className: `popup-item spaced ${isLink ? 'active' : ''}`, "aria-label": "Insert link", children: _jsx("i", { className: "format link" }) })] })) }));
|
|
153
|
+
}
|
|
154
|
+
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
155
|
+
const [isText, setIsText] = useState(false);
|
|
156
|
+
const [isLink, setIsLink] = useState(false);
|
|
157
|
+
const [isBold, setIsBold] = useState(false);
|
|
158
|
+
const [isItalic, setIsItalic] = useState(false);
|
|
159
|
+
const [isUnderline, setIsUnderline] = useState(false);
|
|
160
|
+
const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
161
|
+
const [isSubscript, setIsSubscript] = useState(false);
|
|
162
|
+
const [isSuperscript, setIsSuperscript] = useState(false);
|
|
163
|
+
const [isCode, setIsCode] = useState(false);
|
|
164
|
+
const updatePopup = useCallback(() => {
|
|
165
|
+
editor.getEditorState().read(() => {
|
|
166
|
+
// Should not to pop up the floating toolbar when using IME input
|
|
167
|
+
if (editor.isComposing()) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const selection = $getSelection();
|
|
171
|
+
const nativeSelection = window.getSelection();
|
|
172
|
+
const rootElement = editor.getRootElement();
|
|
173
|
+
if (nativeSelection !== null &&
|
|
174
|
+
(!$isRangeSelection(selection) ||
|
|
175
|
+
rootElement === null ||
|
|
176
|
+
!rootElement.contains(nativeSelection.anchorNode))) {
|
|
177
|
+
setIsText(false);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (!$isRangeSelection(selection)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const node = getSelectedNode(selection);
|
|
184
|
+
// Update text format
|
|
185
|
+
setIsBold(selection.hasFormat('bold'));
|
|
186
|
+
setIsItalic(selection.hasFormat('italic'));
|
|
187
|
+
setIsUnderline(selection.hasFormat('underline'));
|
|
188
|
+
setIsStrikethrough(selection.hasFormat('strikethrough'));
|
|
189
|
+
setIsSubscript(selection.hasFormat('subscript'));
|
|
190
|
+
setIsSuperscript(selection.hasFormat('superscript'));
|
|
191
|
+
setIsCode(selection.hasFormat('code'));
|
|
192
|
+
// Update links
|
|
193
|
+
const parent = node.getParent();
|
|
194
|
+
if ($isLinkNode(parent) || $isLinkNode(node)) {
|
|
195
|
+
setIsLink(true);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
setIsLink(false);
|
|
199
|
+
}
|
|
200
|
+
if (!$isCodeHighlightNode(selection.anchor.getNode()) && selection.getTextContent() !== '') {
|
|
201
|
+
setIsText($isTextNode(node) || $isParagraphNode(node));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
setIsText(false);
|
|
205
|
+
}
|
|
206
|
+
const rawTextContent = selection.getTextContent().replace(/\n/g, '');
|
|
207
|
+
if (!selection.isCollapsed() && rawTextContent === '') {
|
|
208
|
+
setIsText(false);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}, [editor]);
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
document.addEventListener('selectionchange', updatePopup);
|
|
214
|
+
return () => {
|
|
215
|
+
document.removeEventListener('selectionchange', updatePopup);
|
|
216
|
+
};
|
|
217
|
+
}, [updatePopup]);
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
return mergeRegister(editor.registerUpdateListener(() => {
|
|
220
|
+
updatePopup();
|
|
221
|
+
}), editor.registerRootListener(() => {
|
|
222
|
+
if (editor.getRootElement() === null) {
|
|
223
|
+
setIsText(false);
|
|
224
|
+
}
|
|
225
|
+
}));
|
|
226
|
+
}, [editor, updatePopup]);
|
|
227
|
+
if (!isText) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return createPortal(_jsx(TextFormatFloatingToolbar, { editor: editor, anchorElem: anchorElem, isLink: isLink, isBold: isBold, isItalic: isItalic, isStrikethrough: isStrikethrough, isSubscript: isSubscript, isSuperscript: isSuperscript, isUnderline: isUnderline, isCode: isCode }), anchorElem);
|
|
231
|
+
}
|
|
232
|
+
export function FloatingTextFormatToolbarPlugin({ anchorElem = document.body, }) {
|
|
233
|
+
const [editor] = useLexicalComposerContext();
|
|
234
|
+
return useFloatingTextFormatToolbar(editor, anchorElem);
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/field/plugins/floating-text-format-toolbar-plugin/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ;;;;;;GAMG;AAEH,OAAO,aAAa,CAAA;AAGpB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EAEnB,wBAAwB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAuB,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAE7E,SAAS,yBAAyB,CAAC,EACjC,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,EACN,eAAe,EACf,WAAW,EACX,aAAa,GAYd;IACC,MAAM,wBAAwB,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAA;IACpE,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,EAAE,CAAA;IAClC,MAAM,SAAS,GAAG,YA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ollectionSlug, FormState, OptionObject } from 'payload';
|
|
2
|
+
import type { InlineImageData } from './types';
|
|
3
|
+
export declare const positionOptions: OptionObject[];
|
|
4
|
+
export declare const sizeOptions: OptionObject[];
|
|
5
|
+
export declare const getFields: (imageCollection: CollectionSlug) => ClientField[];
|
|
6
|
+
export declare function getInitialState(data: InlineImageData | undefined): FormState;
|
|
7
|
+
export declare function isAltTextValid(value: string | undefined): boolean;
|
|
8
|
+
export declare function validateFields(fields: FormState): {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
fields: FormState;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/field/plugins/inline-image-plugin/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,eAAe,EAAE,YAAY,EAiBzC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,YAAY,EAarC,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,iBAAiB,cAAc,KAAG,WAAW,EAiDtE,CAAA;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,GAAG,SAAS,CAoC5E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEjE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CA0CvF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export const positionOptions = [
|
|
2
|
+
{
|
|
3
|
+
label: 'Left',
|
|
4
|
+
value: 'left',
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: 'Right',
|
|
8
|
+
value: 'right',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: 'Full',
|
|
12
|
+
value: 'full',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Wide',
|
|
16
|
+
value: 'wide',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
export const sizeOptions = [
|
|
20
|
+
{
|
|
21
|
+
label: 'Small',
|
|
22
|
+
value: 'small',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'Medium',
|
|
26
|
+
value: 'medium',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Auto',
|
|
30
|
+
value: 'auto',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
export const getFields = (imageCollection) => [
|
|
34
|
+
{
|
|
35
|
+
name: 'image',
|
|
36
|
+
localized: false,
|
|
37
|
+
type: 'upload',
|
|
38
|
+
required: true,
|
|
39
|
+
label: 'Image',
|
|
40
|
+
relationTo: imageCollection,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'version',
|
|
44
|
+
localized: false,
|
|
45
|
+
type: 'text',
|
|
46
|
+
hidden: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'altText',
|
|
50
|
+
required: true,
|
|
51
|
+
label: 'Alt Text',
|
|
52
|
+
localized: false,
|
|
53
|
+
type: 'text',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'position',
|
|
57
|
+
localized: false,
|
|
58
|
+
label: 'Position',
|
|
59
|
+
required: true,
|
|
60
|
+
options: positionOptions,
|
|
61
|
+
type: 'select',
|
|
62
|
+
},
|
|
63
|
+
// @ts-expect-error
|
|
64
|
+
{
|
|
65
|
+
name: 'size',
|
|
66
|
+
localized: false,
|
|
67
|
+
label: 'Size',
|
|
68
|
+
required: true,
|
|
69
|
+
options: sizeOptions,
|
|
70
|
+
type: 'select',
|
|
71
|
+
admin: {
|
|
72
|
+
description: "If an inline image is placed in an editor column layout, its position should be set to 'full' and size should be set to 'medium' for 75% columns, and 'small' for equal width and 25% columns. Otherwise set size to 'auto'.",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'showCaption',
|
|
77
|
+
label: 'Show Caption',
|
|
78
|
+
localized: false,
|
|
79
|
+
type: 'checkbox',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
export function getInitialState(data) {
|
|
83
|
+
return {
|
|
84
|
+
// TODO: Investigate - would love to have used formState and RenderFields / MappedFields
|
|
85
|
+
// for the Image upload field, but for some reason I could not get a return value
|
|
86
|
+
// for the selected image via handleFormOnChange or handleFormOnSubmit :-(
|
|
87
|
+
// image: {
|
|
88
|
+
// value: '',
|
|
89
|
+
// initialValue: null,
|
|
90
|
+
// valid: true,
|
|
91
|
+
// },
|
|
92
|
+
image: {
|
|
93
|
+
value: data?.id,
|
|
94
|
+
initialValue: data?.id,
|
|
95
|
+
valid: true,
|
|
96
|
+
},
|
|
97
|
+
altText: {
|
|
98
|
+
value: data?.altText,
|
|
99
|
+
initialValue: data?.altText,
|
|
100
|
+
valid: true,
|
|
101
|
+
},
|
|
102
|
+
position: {
|
|
103
|
+
value: data?.position ?? 'full',
|
|
104
|
+
initialValue: data?.position ?? 'full',
|
|
105
|
+
valid: true,
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
value: data?.size ?? 'auto',
|
|
109
|
+
initialValue: data?.size ?? 'auto',
|
|
110
|
+
valid: true,
|
|
111
|
+
},
|
|
112
|
+
showCaption: {
|
|
113
|
+
value: data?.showCaption ?? false,
|
|
114
|
+
initialValue: data?.showCaption ?? false,
|
|
115
|
+
valid: true,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function isAltTextValid(value) {
|
|
120
|
+
return value != null && value.length > 0;
|
|
121
|
+
}
|
|
122
|
+
export function validateFields(fields) {
|
|
123
|
+
let valid = true;
|
|
124
|
+
if (fields.altText != null) {
|
|
125
|
+
if (isAltTextValid(fields.altText.value) === false) {
|
|
126
|
+
fields.altText.valid = false;
|
|
127
|
+
valid = false;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
fields.altText.valid = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (fields.position != null) {
|
|
134
|
+
if (fields.position.value !== 'left' &&
|
|
135
|
+
fields.position.value !== 'right' &&
|
|
136
|
+
fields.position.value !== 'full' &&
|
|
137
|
+
fields.position.value !== 'wide') {
|
|
138
|
+
fields.position.valid = false;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
fields.position.valid = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (fields.size != null) {
|
|
145
|
+
if (fields.size.value !== 'small' &&
|
|
146
|
+
fields.size.value !== 'medium' &&
|
|
147
|
+
fields.size.value !== 'auto') {
|
|
148
|
+
fields.size.valid = false;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
fields.size.valid = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Return
|
|
155
|
+
return {
|
|
156
|
+
valid,
|
|
157
|
+
fields,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/field/plugins/inline-image-plugin/fields.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C;QACE,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;KACd;IACD;QACE,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;KACf;IACD;QACE,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;KACd;IACD;QACE,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;KACd;CACF,CAAA;AAED,MAAM,CAAC,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,GAAG,IAAI,CAAA;QAC7B,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC5B,IACE,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;YAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO;YACjC,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;YAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM,EAChC,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAA;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IACE,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,OAAO;YAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ;YAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,EAC5B,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,SAAS;IACT,OAAO;QACL,KAAK;QACL,MAAM;KACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portions copyright (c) Meta Platforms, Inc.
|
|
3
|
+
* and affiliates and is based on examples found here
|
|
4
|
+
* https://github.com/facebook/lexical/tree/main/packages/lexical-playground
|
|
5
|
+
* - in particular the ImagesPlugin
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import type React from 'react';
|
|
12
|
+
import { type LexicalCommand } from 'lexical';
|
|
13
|
+
import type { InlineImageAttributes } from '../../nodes/inline-image-node/types';
|
|
14
|
+
export type InsertInlineImagePayload = Readonly<InlineImageAttributes>;
|
|
15
|
+
export declare const OPEN_INLINE_IMAGE_MODAL_COMMAND: LexicalCommand<null>;
|
|
16
|
+
export declare const INSERT_INLINE_IMAGE_COMMAND: LexicalCommand<InlineImageAttributes>;
|
|
17
|
+
export declare function InlineImagePlugin({ collection }: {
|
|
18
|
+
collection: string;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare global {
|
|
21
|
+
interface DragEvent {
|
|
22
|
+
rangeOffset?: number;
|
|
23
|
+
rangeParent?: Node;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/field/plugins/inline-image-plugin/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAgBL,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAA;AAWhB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAGhF,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAA;AAKtE,eAAO,MAAM,+BAA+B,EAAE,cAAc,CAAC,IAAI,CAEhE,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,qBAAqB,CAE7E,CAAA;AAED,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA+I3F;AAiGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,WAAW,CAAC,EAAE,IAAI,CAAA;KACnB;CACF"}
|