@ethberry/mui-lexical 1.0.7
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 +16 -0
- package/README.md +1 -0
- package/dist/common/hooks/index.d.ts +1 -0
- package/dist/common/hooks/index.js +18 -0
- package/dist/common/hooks/index.js.map +1 -0
- package/dist/common/hooks/useModal.d.ts +2 -0
- package/dist/common/hooks/useModal.js +28 -0
- package/dist/common/hooks/useModal.js.map +1 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/types/index.d.ts +5 -0
- package/dist/common/types/index.js +3 -0
- package/dist/common/types/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +18 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/ui/Modal/index.d.ts +6 -0
- package/dist/components/ui/Modal/index.js +18 -0
- package/dist/components/ui/Modal/index.js.map +1 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +18 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/config/lexicalEditorConfig.d.ts +78 -0
- package/dist/config/lexicalEditorConfig.js +33 -0
- package/dist/config/lexicalEditorConfig.js.map +1 -0
- package/dist/config/lexicalEditorTheme.d.ts +68 -0
- package/dist/config/lexicalEditorTheme.js +71 -0
- package/dist/config/lexicalEditorTheme.js.map +1 -0
- package/dist/display/index.d.ts +6 -0
- package/dist/display/index.js +47 -0
- package/dist/display/index.js.map +1 -0
- package/dist/display/styled.d.ts +1 -0
- package/dist/display/styled.js +67 -0
- package/dist/display/styled.js.map +1 -0
- package/dist/editor/Editor.d.ts +16 -0
- package/dist/editor/Editor.js +95 -0
- package/dist/editor/Editor.js.map +1 -0
- package/dist/editor/Editor.stories.d.ts +13 -0
- package/dist/editor/Editor.stories.js +135 -0
- package/dist/editor/Editor.stories.js.map +1 -0
- package/dist/editor/commands/index.d.ts +4 -0
- package/dist/editor/commands/index.js +6 -0
- package/dist/editor/commands/index.js.map +1 -0
- package/dist/editor/constants/index.d.ts +2 -0
- package/dist/editor/constants/index.js +40 -0
- package/dist/editor/constants/index.js.map +1 -0
- package/dist/editor/context/SharedHistoryContext.d.ts +11 -0
- package/dist/editor/context/SharedHistoryContext.js +17 -0
- package/dist/editor/context/SharedHistoryContext.js.map +1 -0
- package/dist/editor/context/ToolbarContext.d.ts +56 -0
- package/dist/editor/context/ToolbarContext.js +67 -0
- package/dist/editor/context/ToolbarContext.js.map +1 -0
- package/dist/editor/context/index.d.ts +2 -0
- package/dist/editor/context/index.js +19 -0
- package/dist/editor/context/index.js.map +1 -0
- package/dist/editor/editorStyles.d.ts +1 -0
- package/dist/editor/editorStyles.js +1273 -0
- package/dist/editor/editorStyles.js.map +1 -0
- package/dist/editor/hooks/index.d.ts +1 -0
- package/dist/editor/hooks/index.js +18 -0
- package/dist/editor/hooks/index.js.map +1 -0
- package/dist/editor/hooks/useModal.d.ts +2 -0
- package/dist/editor/hooks/useModal.js +29 -0
- package/dist/editor/hooks/useModal.js.map +1 -0
- package/dist/editor/images/icons/3-columns.d.ts +1 -0
- package/dist/editor/images/icons/3-columns.js +9 -0
- package/dist/editor/images/icons/3-columns.js.map +1 -0
- package/dist/editor/images/icons/add-sign.d.ts +1 -0
- package/dist/editor/images/icons/add-sign.js +9 -0
- package/dist/editor/images/icons/add-sign.js.map +1 -0
- package/dist/editor/images/icons/arrow-clockwise.d.ts +1 -0
- package/dist/editor/images/icons/arrow-clockwise.js +9 -0
- package/dist/editor/images/icons/arrow-clockwise.js.map +1 -0
- package/dist/editor/images/icons/arrow-counterclockwise.d.ts +1 -0
- package/dist/editor/images/icons/arrow-counterclockwise.js +9 -0
- package/dist/editor/images/icons/arrow-counterclockwise.js.map +1 -0
- package/dist/editor/images/icons/bg-color.d.ts +1 -0
- package/dist/editor/images/icons/bg-color.js +9 -0
- package/dist/editor/images/icons/bg-color.js.map +1 -0
- package/dist/editor/images/icons/camera.d.ts +1 -0
- package/dist/editor/images/icons/camera.js +9 -0
- package/dist/editor/images/icons/camera.js.map +1 -0
- package/dist/editor/images/icons/card-checklist.d.ts +1 -0
- package/dist/editor/images/icons/card-checklist.js +9 -0
- package/dist/editor/images/icons/card-checklist.js.map +1 -0
- package/dist/editor/images/icons/caret-right-fill.d.ts +1 -0
- package/dist/editor/images/icons/caret-right-fill.js +9 -0
- package/dist/editor/images/icons/caret-right-fill.js.map +1 -0
- package/dist/editor/images/icons/chat-left-text.d.ts +1 -0
- package/dist/editor/images/icons/chat-left-text.js +9 -0
- package/dist/editor/images/icons/chat-left-text.js.map +1 -0
- package/dist/editor/images/icons/chat-right-dots.d.ts +1 -0
- package/dist/editor/images/icons/chat-right-dots.js +9 -0
- package/dist/editor/images/icons/chat-right-dots.js.map +1 -0
- package/dist/editor/images/icons/chat-right-text.d.ts +1 -0
- package/dist/editor/images/icons/chat-right-text.js +9 -0
- package/dist/editor/images/icons/chat-right-text.js.map +1 -0
- package/dist/editor/images/icons/chat-right.d.ts +1 -0
- package/dist/editor/images/icons/chat-right.js +9 -0
- package/dist/editor/images/icons/chat-right.js.map +1 -0
- package/dist/editor/images/icons/chat-square-quote.d.ts +1 -0
- package/dist/editor/images/icons/chat-square-quote.js +9 -0
- package/dist/editor/images/icons/chat-square-quote.js.map +1 -0
- package/dist/editor/images/icons/chevron-down.d.ts +1 -0
- package/dist/editor/images/icons/chevron-down.js +9 -0
- package/dist/editor/images/icons/chevron-down.js.map +1 -0
- package/dist/editor/images/icons/clipboard.d.ts +1 -0
- package/dist/editor/images/icons/clipboard.js +9 -0
- package/dist/editor/images/icons/clipboard.js.map +1 -0
- package/dist/editor/images/icons/close.d.ts +1 -0
- package/dist/editor/images/icons/close.js +9 -0
- package/dist/editor/images/icons/close.js.map +1 -0
- package/dist/editor/images/icons/code.d.ts +1 -0
- package/dist/editor/images/icons/code.js +9 -0
- package/dist/editor/images/icons/code.js.map +1 -0
- package/dist/editor/images/icons/comments.d.ts +1 -0
- package/dist/editor/images/icons/comments.js +9 -0
- package/dist/editor/images/icons/comments.js.map +1 -0
- package/dist/editor/images/icons/copy.d.ts +1 -0
- package/dist/editor/images/icons/copy.js +9 -0
- package/dist/editor/images/icons/copy.js.map +1 -0
- package/dist/editor/images/icons/diagram-2.d.ts +1 -0
- package/dist/editor/images/icons/diagram-2.js +9 -0
- package/dist/editor/images/icons/diagram-2.js.map +1 -0
- package/dist/editor/images/icons/download.d.ts +1 -0
- package/dist/editor/images/icons/download.js +9 -0
- package/dist/editor/images/icons/download.js.map +1 -0
- package/dist/editor/images/icons/draggable-block-menu.d.ts +1 -0
- package/dist/editor/images/icons/draggable-block-menu.js +9 -0
- package/dist/editor/images/icons/draggable-block-menu.js.map +1 -0
- package/dist/editor/images/icons/dropdown-more.d.ts +1 -0
- package/dist/editor/images/icons/dropdown-more.js +9 -0
- package/dist/editor/images/icons/dropdown-more.js.map +1 -0
- package/dist/editor/images/icons/figma.d.ts +1 -0
- package/dist/editor/images/icons/figma.js +9 -0
- package/dist/editor/images/icons/figma.js.map +1 -0
- package/dist/editor/images/icons/file-earmark-text.d.ts +1 -0
- package/dist/editor/images/icons/file-earmark-text.js +9 -0
- package/dist/editor/images/icons/file-earmark-text.js.map +1 -0
- package/dist/editor/images/icons/file-image.d.ts +1 -0
- package/dist/editor/images/icons/file-image.js +9 -0
- package/dist/editor/images/icons/file-image.js.map +1 -0
- package/dist/editor/images/icons/filetype-gif.d.ts +1 -0
- package/dist/editor/images/icons/filetype-gif.js +9 -0
- package/dist/editor/images/icons/filetype-gif.js.map +1 -0
- package/dist/editor/images/icons/font-color.d.ts +1 -0
- package/dist/editor/images/icons/font-color.js +9 -0
- package/dist/editor/images/icons/font-color.js.map +1 -0
- package/dist/editor/images/icons/font-family.d.ts +1 -0
- package/dist/editor/images/icons/font-family.js +9 -0
- package/dist/editor/images/icons/font-family.js.map +1 -0
- package/dist/editor/images/icons/format-clear.d.ts +1 -0
- package/dist/editor/images/icons/format-clear.js +9 -0
- package/dist/editor/images/icons/format-clear.js.map +1 -0
- package/dist/editor/images/icons/highlighter.d.ts +1 -0
- package/dist/editor/images/icons/highlighter.js +9 -0
- package/dist/editor/images/icons/highlighter.js.map +1 -0
- package/dist/editor/images/icons/horizontal-rule.d.ts +1 -0
- package/dist/editor/images/icons/horizontal-rule.js +9 -0
- package/dist/editor/images/icons/horizontal-rule.js.map +1 -0
- package/dist/editor/images/icons/indent.d.ts +1 -0
- package/dist/editor/images/icons/indent.js +9 -0
- package/dist/editor/images/icons/indent.js.map +1 -0
- package/dist/editor/images/icons/index.d.ts +88 -0
- package/dist/editor/images/icons/index.js +105 -0
- package/dist/editor/images/icons/index.js.map +1 -0
- package/dist/editor/images/icons/journal-text.d.ts +1 -0
- package/dist/editor/images/icons/journal-text.js +9 -0
- package/dist/editor/images/icons/journal-text.js.map +1 -0
- package/dist/editor/images/icons/justify.d.ts +1 -0
- package/dist/editor/images/icons/justify.js +9 -0
- package/dist/editor/images/icons/justify.js.map +1 -0
- package/dist/editor/images/icons/link.d.ts +1 -0
- package/dist/editor/images/icons/link.js +9 -0
- package/dist/editor/images/icons/link.js.map +1 -0
- package/dist/editor/images/icons/list-ol.d.ts +1 -0
- package/dist/editor/images/icons/list-ol.js +9 -0
- package/dist/editor/images/icons/list-ol.js.map +1 -0
- package/dist/editor/images/icons/list-ul.d.ts +1 -0
- package/dist/editor/images/icons/list-ul.js +9 -0
- package/dist/editor/images/icons/list-ul.js.map +1 -0
- package/dist/editor/images/icons/lock-fill.d.ts +1 -0
- package/dist/editor/images/icons/lock-fill.js +9 -0
- package/dist/editor/images/icons/lock-fill.js.map +1 -0
- package/dist/editor/images/icons/lock.d.ts +1 -0
- package/dist/editor/images/icons/lock.js +9 -0
- package/dist/editor/images/icons/lock.js.map +1 -0
- package/dist/editor/images/icons/markdown.d.ts +1 -0
- package/dist/editor/images/icons/markdown.js +9 -0
- package/dist/editor/images/icons/markdown.js.map +1 -0
- package/dist/editor/images/icons/mic.d.ts +1 -0
- package/dist/editor/images/icons/mic.js +9 -0
- package/dist/editor/images/icons/mic.js.map +1 -0
- package/dist/editor/images/icons/minus-sign.d.ts +1 -0
- package/dist/editor/images/icons/minus-sign.js +9 -0
- package/dist/editor/images/icons/minus-sign.js.map +1 -0
- package/dist/editor/images/icons/outdent.d.ts +1 -0
- package/dist/editor/images/icons/outdent.js +9 -0
- package/dist/editor/images/icons/outdent.js.map +1 -0
- package/dist/editor/images/icons/paint-bucket.d.ts +1 -0
- package/dist/editor/images/icons/paint-bucket.js +9 -0
- package/dist/editor/images/icons/paint-bucket.js.map +1 -0
- package/dist/editor/images/icons/palette.d.ts +1 -0
- package/dist/editor/images/icons/palette.js +9 -0
- package/dist/editor/images/icons/palette.js.map +1 -0
- package/dist/editor/images/icons/pencil-fill.d.ts +1 -0
- package/dist/editor/images/icons/pencil-fill.js +9 -0
- package/dist/editor/images/icons/pencil-fill.js.map +1 -0
- package/dist/editor/images/icons/plug-fill.d.ts +1 -0
- package/dist/editor/images/icons/plug-fill.js +9 -0
- package/dist/editor/images/icons/plug-fill.js.map +1 -0
- package/dist/editor/images/icons/plug.d.ts +1 -0
- package/dist/editor/images/icons/plug.js +9 -0
- package/dist/editor/images/icons/plug.js.map +1 -0
- package/dist/editor/images/icons/plus-slash-minus.d.ts +1 -0
- package/dist/editor/images/icons/plus-slash-minus.js +9 -0
- package/dist/editor/images/icons/plus-slash-minus.js.map +1 -0
- package/dist/editor/images/icons/plus.d.ts +1 -0
- package/dist/editor/images/icons/plus.js +9 -0
- package/dist/editor/images/icons/plus.js.map +1 -0
- package/dist/editor/images/icons/prettier-error.d.ts +1 -0
- package/dist/editor/images/icons/prettier-error.js +9 -0
- package/dist/editor/images/icons/prettier-error.js.map +1 -0
- package/dist/editor/images/icons/prettier.d.ts +1 -0
- package/dist/editor/images/icons/prettier.js +9 -0
- package/dist/editor/images/icons/prettier.js.map +1 -0
- package/dist/editor/images/icons/scissors.d.ts +1 -0
- package/dist/editor/images/icons/scissors.js +9 -0
- package/dist/editor/images/icons/scissors.js.map +1 -0
- package/dist/editor/images/icons/send.d.ts +1 -0
- package/dist/editor/images/icons/send.js +9 -0
- package/dist/editor/images/icons/send.js.map +1 -0
- package/dist/editor/images/icons/square-check.d.ts +1 -0
- package/dist/editor/images/icons/square-check.js +9 -0
- package/dist/editor/images/icons/square-check.js.map +1 -0
- package/dist/editor/images/icons/sticky.d.ts +1 -0
- package/dist/editor/images/icons/sticky.js +9 -0
- package/dist/editor/images/icons/sticky.js.map +1 -0
- package/dist/editor/images/icons/success-alt.d.ts +1 -0
- package/dist/editor/images/icons/success-alt.js +9 -0
- package/dist/editor/images/icons/success-alt.js.map +1 -0
- package/dist/editor/images/icons/success.d.ts +1 -0
- package/dist/editor/images/icons/success.js +9 -0
- package/dist/editor/images/icons/success.js.map +1 -0
- package/dist/editor/images/icons/table.d.ts +1 -0
- package/dist/editor/images/icons/table.js +9 -0
- package/dist/editor/images/icons/table.js.map +1 -0
- package/dist/editor/images/icons/text-center.d.ts +1 -0
- package/dist/editor/images/icons/text-center.js +9 -0
- package/dist/editor/images/icons/text-center.js.map +1 -0
- package/dist/editor/images/icons/text-left.d.ts +1 -0
- package/dist/editor/images/icons/text-left.js +9 -0
- package/dist/editor/images/icons/text-left.js.map +1 -0
- package/dist/editor/images/icons/text-paragraph.d.ts +1 -0
- package/dist/editor/images/icons/text-paragraph.js +9 -0
- package/dist/editor/images/icons/text-paragraph.js.map +1 -0
- package/dist/editor/images/icons/text-right.d.ts +1 -0
- package/dist/editor/images/icons/text-right.js +9 -0
- package/dist/editor/images/icons/text-right.js.map +1 -0
- package/dist/editor/images/icons/trash.d.ts +1 -0
- package/dist/editor/images/icons/trash.js +9 -0
- package/dist/editor/images/icons/trash.js.map +1 -0
- package/dist/editor/images/icons/trash3.d.ts +1 -0
- package/dist/editor/images/icons/trash3.js +9 -0
- package/dist/editor/images/icons/trash3.js.map +1 -0
- package/dist/editor/images/icons/type-bold.d.ts +1 -0
- package/dist/editor/images/icons/type-bold.js +9 -0
- package/dist/editor/images/icons/type-bold.js.map +1 -0
- package/dist/editor/images/icons/type-capitalize.d.ts +1 -0
- package/dist/editor/images/icons/type-capitalize.js +9 -0
- package/dist/editor/images/icons/type-capitalize.js.map +1 -0
- package/dist/editor/images/icons/type-h1.d.ts +1 -0
- package/dist/editor/images/icons/type-h1.js +9 -0
- package/dist/editor/images/icons/type-h1.js.map +1 -0
- package/dist/editor/images/icons/type-h2.d.ts +1 -0
- package/dist/editor/images/icons/type-h2.js +9 -0
- package/dist/editor/images/icons/type-h2.js.map +1 -0
- package/dist/editor/images/icons/type-h3.d.ts +1 -0
- package/dist/editor/images/icons/type-h3.js +9 -0
- package/dist/editor/images/icons/type-h3.js.map +1 -0
- package/dist/editor/images/icons/type-h4.d.ts +1 -0
- package/dist/editor/images/icons/type-h4.js +9 -0
- package/dist/editor/images/icons/type-h4.js.map +1 -0
- package/dist/editor/images/icons/type-h5.d.ts +1 -0
- package/dist/editor/images/icons/type-h5.js +9 -0
- package/dist/editor/images/icons/type-h5.js.map +1 -0
- package/dist/editor/images/icons/type-h6.d.ts +1 -0
- package/dist/editor/images/icons/type-h6.js +9 -0
- package/dist/editor/images/icons/type-h6.js.map +1 -0
- package/dist/editor/images/icons/type-italic.d.ts +1 -0
- package/dist/editor/images/icons/type-italic.js +9 -0
- package/dist/editor/images/icons/type-italic.js.map +1 -0
- package/dist/editor/images/icons/type-lowercase.d.ts +1 -0
- package/dist/editor/images/icons/type-lowercase.js +9 -0
- package/dist/editor/images/icons/type-lowercase.js.map +1 -0
- package/dist/editor/images/icons/type-strikethrough.d.ts +1 -0
- package/dist/editor/images/icons/type-strikethrough.js +9 -0
- package/dist/editor/images/icons/type-strikethrough.js.map +1 -0
- package/dist/editor/images/icons/type-subscript.d.ts +1 -0
- package/dist/editor/images/icons/type-subscript.js +9 -0
- package/dist/editor/images/icons/type-subscript.js.map +1 -0
- package/dist/editor/images/icons/type-superscript.d.ts +1 -0
- package/dist/editor/images/icons/type-superscript.js +9 -0
- package/dist/editor/images/icons/type-superscript.js.map +1 -0
- package/dist/editor/images/icons/type-underline.d.ts +1 -0
- package/dist/editor/images/icons/type-underline.js +9 -0
- package/dist/editor/images/icons/type-underline.js.map +1 -0
- package/dist/editor/images/icons/type-uppercase.d.ts +1 -0
- package/dist/editor/images/icons/type-uppercase.js +9 -0
- package/dist/editor/images/icons/type-uppercase.js.map +1 -0
- package/dist/editor/images/icons/upload.d.ts +1 -0
- package/dist/editor/images/icons/upload.js +9 -0
- package/dist/editor/images/icons/upload.js.map +1 -0
- package/dist/editor/images/icons/user.d.ts +1 -0
- package/dist/editor/images/icons/user.js +9 -0
- package/dist/editor/images/icons/user.js.map +1 -0
- package/dist/editor/images/icons/vertical-bottom.d.ts +1 -0
- package/dist/editor/images/icons/vertical-bottom.js +9 -0
- package/dist/editor/images/icons/vertical-bottom.js.map +1 -0
- package/dist/editor/images/icons/vertical-middle.d.ts +1 -0
- package/dist/editor/images/icons/vertical-middle.js +9 -0
- package/dist/editor/images/icons/vertical-middle.js.map +1 -0
- package/dist/editor/images/icons/vertical-top.d.ts +1 -0
- package/dist/editor/images/icons/vertical-top.js +9 -0
- package/dist/editor/images/icons/vertical-top.js.map +1 -0
- package/dist/editor/images/icons/x.d.ts +1 -0
- package/dist/editor/images/icons/x.js +9 -0
- package/dist/editor/images/icons/x.js.map +1 -0
- package/dist/editor/images/icons/youtube.d.ts +1 -0
- package/dist/editor/images/icons/youtube.js +9 -0
- package/dist/editor/images/icons/youtube.js.map +1 -0
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +6 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/nodes/Image/ImageComponent.d.ts +15 -0
- package/dist/editor/nodes/Image/ImageComponent.js +248 -0
- package/dist/editor/nodes/Image/ImageComponent.js.map +1 -0
- package/dist/editor/nodes/Image/ImageNode.d.ts +50 -0
- package/dist/editor/nodes/Image/ImageNode.js +128 -0
- package/dist/editor/nodes/Image/ImageNode.js.map +1 -0
- package/dist/editor/nodes/Image/imageNodeStyles.d.ts +1 -0
- package/dist/editor/nodes/Image/imageNodeStyles.js +41 -0
- package/dist/editor/nodes/Image/imageNodeStyles.js.map +1 -0
- package/dist/editor/nodes/Image/index.d.ts +3 -0
- package/dist/editor/nodes/Image/index.js +10 -0
- package/dist/editor/nodes/Image/index.js.map +1 -0
- package/dist/editor/nodes/InlineImage/InlineImageComponent.d.ts +18 -0
- package/dist/editor/nodes/InlineImage/InlineImageComponent.js +160 -0
- package/dist/editor/nodes/InlineImage/InlineImageComponent.js.map +1 -0
- package/dist/editor/nodes/InlineImage/InlineImageNode.d.ts +59 -0
- package/dist/editor/nodes/InlineImage/InlineImageNode.js +149 -0
- package/dist/editor/nodes/InlineImage/InlineImageNode.js.map +1 -0
- package/dist/editor/nodes/InlineImage/index.d.ts +3 -0
- package/dist/editor/nodes/InlineImage/index.js +10 -0
- package/dist/editor/nodes/InlineImage/index.js.map +1 -0
- package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.d.ts +1 -0
- package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.js +90 -0
- package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.js.map +1 -0
- package/dist/editor/nodes/PlaygroundNodes.d.ts +2 -0
- package/dist/editor/nodes/PlaygroundNodes.js +32 -0
- package/dist/editor/nodes/PlaygroundNodes.js.map +1 -0
- package/dist/editor/nodes/Video/VideoComponent.d.ts +9 -0
- package/dist/editor/nodes/Video/VideoComponent.js +15 -0
- package/dist/editor/nodes/Video/VideoComponent.js.map +1 -0
- package/dist/editor/nodes/Video/VideoNode.d.ts +34 -0
- package/dist/editor/nodes/Video/VideoNode.js +129 -0
- package/dist/editor/nodes/Video/VideoNode.js.map +1 -0
- package/dist/editor/nodes/Video/index.d.ts +3 -0
- package/dist/editor/nodes/Video/index.js +10 -0
- package/dist/editor/nodes/Video/index.js.map +1 -0
- package/dist/editor/nodes/Video/videoNodeStyles.d.ts +1 -0
- package/dist/editor/nodes/Video/videoNodeStyles.js +44 -0
- package/dist/editor/nodes/Video/videoNodeStyles.js.map +1 -0
- package/dist/editor/nodes/index.d.ts +4 -0
- package/dist/editor/nodes/index.js +21 -0
- package/dist/editor/nodes/index.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.d.ts +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.js +68 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +48 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +136 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/index.d.ts +2 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/index.js +19 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/components/index.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/index.d.ts +12 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/index.js +118 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/index.js.map +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/utils.d.ts +1 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/utils.js +15 -0
- package/dist/editor/plugins/CodeActionMenuPlugin/utils.js.map +1 -0
- package/dist/editor/plugins/CodeHighlightPlugin/index.d.ts +2 -0
- package/dist/editor/plugins/CodeHighlightPlugin/index.js +15 -0
- package/dist/editor/plugins/CodeHighlightPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ComponentPickerPlugin/index.d.ts +9 -0
- package/dist/editor/plugins/ComponentPickerPlugin/index.js +217 -0
- package/dist/editor/plugins/ComponentPickerPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ContextMenuPlugin/index.d.ts +18 -0
- package/dist/editor/plugins/ContextMenuPlugin/index.js +190 -0
- package/dist/editor/plugins/ContextMenuPlugin/index.js.map +1 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.d.ts +1 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.js +48 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.js.map +1 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/index.d.ts +14 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/index.js +275 -0
- package/dist/editor/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.d.ts +1 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.js +141 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.js.map +1 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +15 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.js +214 -0
- package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ImagesPlugin/index.d.ts +28 -0
- package/dist/editor/plugins/ImagesPlugin/index.js +175 -0
- package/dist/editor/plugins/ImagesPlugin/index.js.map +1 -0
- package/dist/editor/plugins/LinkPlugin/index.d.ts +9 -0
- package/dist/editor/plugins/LinkPlugin/index.js +14 -0
- package/dist/editor/plugins/LinkPlugin/index.js.map +1 -0
- package/dist/editor/plugins/MarkdownShortcutPlugin/index.d.ts +9 -0
- package/dist/editor/plugins/MarkdownShortcutPlugin/index.js +11 -0
- package/dist/editor/plugins/MarkdownShortcutPlugin/index.js.map +1 -0
- package/dist/editor/plugins/MarkdownTransformers/index.d.ts +5 -0
- package/dist/editor/plugins/MarkdownTransformers/index.js +181 -0
- package/dist/editor/plugins/MarkdownTransformers/index.js.map +1 -0
- package/dist/editor/plugins/MaxLengthPlugin/index.d.ts +10 -0
- package/dist/editor/plugins/MaxLengthPlugin/index.js +48 -0
- package/dist/editor/plugins/MaxLengthPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ShortcutsPlugin/index.d.ts +13 -0
- package/dist/editor/plugins/ShortcutsPlugin/index.js +102 -0
- package/dist/editor/plugins/ShortcutsPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ShortcutsPlugin/shortcuts.d.ts +56 -0
- package/dist/editor/plugins/ShortcutsPlugin/shortcuts.js +145 -0
- package/dist/editor/plugins/ShortcutsPlugin/shortcuts.js.map +1 -0
- package/dist/editor/plugins/TabFocusPlugin/index.d.ts +8 -0
- package/dist/editor/plugins/TabFocusPlugin/index.js +46 -0
- package/dist/editor/plugins/TabFocusPlugin/index.js.map +1 -0
- package/dist/editor/plugins/TableActionMenuPlugin/index.d.ts +12 -0
- package/dist/editor/plugins/TableActionMenuPlugin/index.js +371 -0
- package/dist/editor/plugins/TableActionMenuPlugin/index.js.map +1 -0
- package/dist/editor/plugins/TableCellResizer/index.d.ts +3 -0
- package/dist/editor/plugins/TableCellResizer/index.js +301 -0
- package/dist/editor/plugins/TableCellResizer/index.js.map +1 -0
- package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.d.ts +1 -0
- package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.js +18 -0
- package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.js.map +1 -0
- package/dist/editor/plugins/TableHoverActionsPlugin/index.d.ts +11 -0
- package/dist/editor/plugins/TableHoverActionsPlugin/index.js +193 -0
- package/dist/editor/plugins/TableHoverActionsPlugin/index.js.map +1 -0
- package/dist/editor/plugins/TablePlugin.d.ts +38 -0
- package/dist/editor/plugins/TablePlugin.js +77 -0
- package/dist/editor/plugins/TablePlugin.js.map +1 -0
- package/dist/editor/plugins/ToolbarPlugin/index.d.ts +19 -0
- package/dist/editor/plugins/ToolbarPlugin/index.js +199 -0
- package/dist/editor/plugins/ToolbarPlugin/index.js.map +1 -0
- package/dist/editor/plugins/ToolbarPlugin/utils.d.ts +22 -0
- package/dist/editor/plugins/ToolbarPlugin/utils.js +224 -0
- package/dist/editor/plugins/ToolbarPlugin/utils.js.map +1 -0
- package/dist/editor/plugins/VideoPlugin/index.d.ts +7 -0
- package/dist/editor/plugins/VideoPlugin/index.js +61 -0
- package/dist/editor/plugins/VideoPlugin/index.js.map +1 -0
- package/dist/editor/plugins/index.d.ts +19 -0
- package/dist/editor/plugins/index.js +36 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/themes/index.d.ts +1 -0
- package/dist/editor/themes/index.js +6 -0
- package/dist/editor/themes/index.js.map +1 -0
- package/dist/editor/themes/playgroundEditorTheme.d.ts +2 -0
- package/dist/editor/themes/playgroundEditorTheme.js +116 -0
- package/dist/editor/themes/playgroundEditorTheme.js.map +1 -0
- package/dist/editor/themes/playgroundEditorThemeStyles.d.ts +1 -0
- package/dist/editor/themes/playgroundEditorThemeStyles.js +702 -0
- package/dist/editor/themes/playgroundEditorThemeStyles.js.map +1 -0
- package/dist/editor/types/index.d.ts +19 -0
- package/dist/editor/types/index.js +3 -0
- package/dist/editor/types/index.js.map +1 -0
- package/dist/editor/ui/BlockFormatDropdown/index.d.ts +18 -0
- package/dist/editor/ui/BlockFormatDropdown/index.js +73 -0
- package/dist/editor/ui/BlockFormatDropdown/index.js.map +1 -0
- package/dist/editor/ui/BoldButton/index.d.ts +7 -0
- package/dist/editor/ui/BoldButton/index.js +14 -0
- package/dist/editor/ui/BoldButton/index.js.map +1 -0
- package/dist/editor/ui/Button.d.ts +12 -0
- package/dist/editor/ui/Button.js +38 -0
- package/dist/editor/ui/Button.js.map +1 -0
- package/dist/editor/ui/CenterAlignButton/index.d.ts +7 -0
- package/dist/editor/ui/CenterAlignButton/index.js +14 -0
- package/dist/editor/ui/CenterAlignButton/index.js.map +1 -0
- package/dist/editor/ui/ClearEditorButton/index.d.ts +7 -0
- package/dist/editor/ui/ClearEditorButton/index.js +10 -0
- package/dist/editor/ui/ClearEditorButton/index.js.map +1 -0
- package/dist/editor/ui/ClearFormattingButton/index.d.ts +7 -0
- package/dist/editor/ui/ClearFormattingButton/index.js +10 -0
- package/dist/editor/ui/ClearFormattingButton/index.js.map +1 -0
- package/dist/editor/ui/CodeButton/index.d.ts +7 -0
- package/dist/editor/ui/CodeButton/index.js +14 -0
- package/dist/editor/ui/CodeButton/index.js.map +1 -0
- package/dist/editor/ui/CodeLanguageDropdown/index.d.ts +10 -0
- package/dist/editor/ui/CodeLanguageDropdown/index.js +26 -0
- package/dist/editor/ui/CodeLanguageDropdown/index.js.map +1 -0
- package/dist/editor/ui/ContentEditable.d.ts +9 -0
- package/dist/editor/ui/ContentEditable.js +63 -0
- package/dist/editor/ui/ContentEditable.js.map +1 -0
- package/dist/editor/ui/Dialog.d.ts +10 -0
- package/dist/editor/ui/Dialog.js +33 -0
- package/dist/editor/ui/Dialog.js.map +1 -0
- package/dist/editor/ui/Divider/index.d.ts +2 -0
- package/dist/editor/ui/Divider/index.js +9 -0
- package/dist/editor/ui/Divider/index.js.map +1 -0
- package/dist/editor/ui/DropDown.d.ts +16 -0
- package/dist/editor/ui/DropDown.js +141 -0
- package/dist/editor/ui/DropDown.js.map +1 -0
- package/dist/editor/ui/FlashMessage.d.ts +6 -0
- package/dist/editor/ui/FlashMessage.js +32 -0
- package/dist/editor/ui/FlashMessage.js.map +1 -0
- package/dist/editor/ui/HorizontalRuleButton/index.d.ts +3 -0
- package/dist/editor/ui/HorizontalRuleButton/index.js +13 -0
- package/dist/editor/ui/HorizontalRuleButton/index.js.map +1 -0
- package/dist/editor/ui/ImageButton/index.d.ts +8 -0
- package/dist/editor/ui/ImageButton/index.js +13 -0
- package/dist/editor/ui/ImageButton/index.js.map +1 -0
- package/dist/editor/ui/ImageResizer.d.ts +17 -0
- package/dist/editor/ui/ImageResizer.js +174 -0
- package/dist/editor/ui/ImageResizer.js.map +1 -0
- package/dist/editor/ui/ItalicButton/index.d.ts +7 -0
- package/dist/editor/ui/ItalicButton/index.js +14 -0
- package/dist/editor/ui/ItalicButton/index.js.map +1 -0
- package/dist/editor/ui/LeftAlignButton/index.d.ts +7 -0
- package/dist/editor/ui/LeftAlignButton/index.js +14 -0
- package/dist/editor/ui/LeftAlignButton/index.js.map +1 -0
- package/dist/editor/ui/LinkButton/index.d.ts +8 -0
- package/dist/editor/ui/LinkButton/index.js +11 -0
- package/dist/editor/ui/LinkButton/index.js.map +1 -0
- package/dist/editor/ui/Modal.d.ts +9 -0
- package/dist/editor/ui/Modal.js +110 -0
- package/dist/editor/ui/Modal.js.map +1 -0
- package/dist/editor/ui/RedoButton/index.d.ts +3 -0
- package/dist/editor/ui/RedoButton/index.js +14 -0
- package/dist/editor/ui/RedoButton/index.js.map +1 -0
- package/dist/editor/ui/RightAlignButton/index.d.ts +7 -0
- package/dist/editor/ui/RightAlignButton/index.js +14 -0
- package/dist/editor/ui/RightAlignButton/index.js.map +1 -0
- package/dist/editor/ui/Select.d.ts +8 -0
- package/dist/editor/ui/Select.js +52 -0
- package/dist/editor/ui/Select.js.map +1 -0
- package/dist/editor/ui/StrikethroughButton/index.d.ts +7 -0
- package/dist/editor/ui/StrikethroughButton/index.js +14 -0
- package/dist/editor/ui/StrikethroughButton/index.js.map +1 -0
- package/dist/editor/ui/TableButton/index.d.ts +8 -0
- package/dist/editor/ui/TableButton/index.js +13 -0
- package/dist/editor/ui/TableButton/index.js.map +1 -0
- package/dist/editor/ui/TextInput.d.ts +13 -0
- package/dist/editor/ui/TextInput.js +36 -0
- package/dist/editor/ui/TextInput.js.map +1 -0
- package/dist/editor/ui/UnderlineButton/index.d.ts +7 -0
- package/dist/editor/ui/UnderlineButton/index.js +14 -0
- package/dist/editor/ui/UnderlineButton/index.js.map +1 -0
- package/dist/editor/ui/UndoButton/index.d.ts +3 -0
- package/dist/editor/ui/UndoButton/index.js +14 -0
- package/dist/editor/ui/UndoButton/index.js.map +1 -0
- package/dist/editor/ui/VideoButton/index.d.ts +8 -0
- package/dist/editor/ui/VideoButton/index.js +13 -0
- package/dist/editor/ui/VideoButton/index.js.map +1 -0
- package/dist/editor/ui/index.d.ts +30 -0
- package/dist/editor/ui/index.js +74 -0
- package/dist/editor/ui/index.js.map +1 -0
- package/dist/editor/utils/dropDownActiveClass.d.ts +1 -0
- package/dist/editor/utils/dropDownActiveClass.js +12 -0
- package/dist/editor/utils/dropDownActiveClass.js.map +1 -0
- package/dist/editor/utils/getDOMRangeRect.d.ts +1 -0
- package/dist/editor/utils/getDOMRangeRect.js +19 -0
- package/dist/editor/utils/getDOMRangeRect.js.map +1 -0
- package/dist/editor/utils/getSelectedNode.d.ts +2 -0
- package/dist/editor/utils/getSelectedNode.js +21 -0
- package/dist/editor/utils/getSelectedNode.js.map +1 -0
- package/dist/editor/utils/getThemeSelector.d.ts +2 -0
- package/dist/editor/utils/getThemeSelector.js +15 -0
- package/dist/editor/utils/getThemeSelector.js.map +1 -0
- package/dist/editor/utils/index.d.ts +9 -0
- package/dist/editor/utils/index.js +26 -0
- package/dist/editor/utils/index.js.map +1 -0
- package/dist/editor/utils/joinClasses.d.ts +1 -0
- package/dist/editor/utils/joinClasses.js +8 -0
- package/dist/editor/utils/joinClasses.js.map +1 -0
- package/dist/editor/utils/parseVideoUrl.d.ts +15 -0
- package/dist/editor/utils/parseVideoUrl.js +115 -0
- package/dist/editor/utils/parseVideoUrl.js.map +1 -0
- package/dist/editor/utils/setFloatingElemPosition.d.ts +1 -0
- package/dist/editor/utils/setFloatingElemPosition.js +47 -0
- package/dist/editor/utils/setFloatingElemPosition.js.map +1 -0
- package/dist/editor/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
- package/dist/editor/utils/setFloatingElemPositionForLinkEditor.js +29 -0
- package/dist/editor/utils/setFloatingElemPositionForLinkEditor.js.map +1 -0
- package/dist/editor/utils/url.d.ts +2 -0
- package/dist/editor/utils/url.js +25 -0
- package/dist/editor/utils/url.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.mjs +27 -0
- package/package.json +110 -0
- package/tsconfig.eslint.json +10 -0
package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.floatTextFormatToolbarPluginStyles = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
exports.floatTextFormatToolbarPluginStyles = (0, material_1.css) `
|
|
6
|
+
.floating-text-format-popup {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
background: #fff;
|
|
10
|
+
padding: 4px;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
opacity: 0;
|
|
17
|
+
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
transition: opacity 0.5s;
|
|
20
|
+
height: 35px;
|
|
21
|
+
will-change: transform;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.floating-text-format-popup button.popup-item {
|
|
25
|
+
border: 0;
|
|
26
|
+
display: flex;
|
|
27
|
+
background: none;
|
|
28
|
+
border-radius: 10px;
|
|
29
|
+
padding: 8px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
vertical-align: middle;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.floating-text-format-popup button.popup-item:disabled {
|
|
35
|
+
cursor: not-allowed;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.floating-text-format-popup button.popup-item.spaced {
|
|
39
|
+
margin-right: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.floating-text-format-popup button.popup-item i.format {
|
|
43
|
+
background-size: contain;
|
|
44
|
+
height: 18px;
|
|
45
|
+
width: 18px;
|
|
46
|
+
margin-top: 2px;
|
|
47
|
+
vertical-align: -0.25em;
|
|
48
|
+
display: flex;
|
|
49
|
+
opacity: 0.6;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.floating-text-format-popup button.popup-item:disabled i.format {
|
|
53
|
+
opacity: 0.2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.floating-text-format-popup button.popup-item.active {
|
|
57
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.floating-text-format-popup button.popup-item.active i {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.floating-text-format-popup .popup-item:hover:not([disabled]) {
|
|
65
|
+
background-color: #eee;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.floating-text-format-popup select.popup-item {
|
|
69
|
+
border: 0;
|
|
70
|
+
display: flex;
|
|
71
|
+
background: none;
|
|
72
|
+
border-radius: 10px;
|
|
73
|
+
padding: 8px;
|
|
74
|
+
vertical-align: middle;
|
|
75
|
+
-webkit-appearance: none;
|
|
76
|
+
-moz-appearance: none;
|
|
77
|
+
width: 70px;
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
color: #777;
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.floating-text-format-popup select.code-language {
|
|
84
|
+
text-transform: capitalize;
|
|
85
|
+
width: 130px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.floating-text-format-popup .popup-item .text {
|
|
89
|
+
display: flex;
|
|
90
|
+
line-height: 20px;
|
|
91
|
+
vertical-align: middle;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
color: #777;
|
|
94
|
+
text-overflow: ellipsis;
|
|
95
|
+
width: 70px;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
height: 20px;
|
|
98
|
+
text-align: left;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.floating-text-format-popup .popup-item .icon {
|
|
102
|
+
display: flex;
|
|
103
|
+
width: 20px;
|
|
104
|
+
height: 20px;
|
|
105
|
+
user-select: none;
|
|
106
|
+
margin-right: 8px;
|
|
107
|
+
line-height: 16px;
|
|
108
|
+
background-size: contain;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.floating-text-format-popup i.chevron-down {
|
|
112
|
+
margin-top: 3px;
|
|
113
|
+
width: 16px;
|
|
114
|
+
height: 16px;
|
|
115
|
+
display: flex;
|
|
116
|
+
user-select: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.floating-text-format-popup i.chevron-down.inside {
|
|
120
|
+
width: 16px;
|
|
121
|
+
height: 16px;
|
|
122
|
+
display: flex;
|
|
123
|
+
margin-left: -25px;
|
|
124
|
+
margin-top: 11px;
|
|
125
|
+
margin-right: 10px;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.floating-text-format-popup .divider {
|
|
130
|
+
width: 1px;
|
|
131
|
+
background-color: #eee;
|
|
132
|
+
margin: 0 4px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@media (max-width: 1024px) {
|
|
136
|
+
.floating-text-format-popup button.insert-comment {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
//# sourceMappingURL=floatTextFormatToolbarPluginStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floatTextFormatToolbarPluginStyles.js","sourceRoot":"","sources":["../../../../src/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.ts"],"names":[],"mappings":";;;AAAA,4CAAoC;AAEvB,QAAA,kCAAkC,GAAG,IAAA,cAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIpD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { Dispatch, JSX } from "react";
|
|
9
|
+
import { TToolbarTextFormatControl } from "../../types";
|
|
10
|
+
export declare const FloatingTextFormatToolbarPlugin: ({ anchorElem, setIsLinkEditMode, controls, }: {
|
|
11
|
+
anchorElem?: HTMLElement;
|
|
12
|
+
setIsLinkEditMode: Dispatch<boolean>;
|
|
13
|
+
controls?: Array<TToolbarTextFormatControl>;
|
|
14
|
+
}) => JSX.Element | null;
|
|
15
|
+
export { floatTextFormatToolbarPluginStyles } from "./floatTextFormatToolbarPluginStyles";
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.floatTextFormatToolbarPluginStyles = exports.FloatingTextFormatToolbarPlugin = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const code_1 = require("@lexical/code");
|
|
14
|
+
const link_1 = require("@lexical/link");
|
|
15
|
+
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
16
|
+
const utils_1 = require("@lexical/utils");
|
|
17
|
+
const lexical_1 = require("lexical");
|
|
18
|
+
const react_dom_1 = require("react-dom");
|
|
19
|
+
const utils_2 = require("../../utils");
|
|
20
|
+
const ui_1 = require("../../ui");
|
|
21
|
+
const constants_1 = require("../../constants");
|
|
22
|
+
function TextFormatFloatingToolbar({ editor, anchorElem, isLink, isBold, isItalic, isUnderline, isCode, isStrikethrough, isLeftAlign, isCenterAlign, isRightAlign, setIsLinkEditMode, controls = constants_1.toolbarDefaultControls.textFormat, }) {
|
|
23
|
+
const popupCharStylesEditorRef = (0, react_1.useRef)(null);
|
|
24
|
+
const insertLink = (0, react_1.useCallback)(() => {
|
|
25
|
+
if (!isLink) {
|
|
26
|
+
setIsLinkEditMode(true);
|
|
27
|
+
editor.dispatchCommand(link_1.TOGGLE_LINK_COMMAND, "https://");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setIsLinkEditMode(false);
|
|
31
|
+
editor.dispatchCommand(link_1.TOGGLE_LINK_COMMAND, null);
|
|
32
|
+
}
|
|
33
|
+
}, [editor, isLink, setIsLinkEditMode]);
|
|
34
|
+
function mouseMoveListener(e) {
|
|
35
|
+
if ((popupCharStylesEditorRef === null || popupCharStylesEditorRef === void 0 ? void 0 : popupCharStylesEditorRef.current) && (e.buttons === 1 || e.buttons === 3)) {
|
|
36
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== "none") {
|
|
37
|
+
const x = e.clientX;
|
|
38
|
+
const y = e.clientY;
|
|
39
|
+
const elementUnderMouse = document.elementFromPoint(x, y);
|
|
40
|
+
if (!popupCharStylesEditorRef.current.contains(elementUnderMouse)) {
|
|
41
|
+
// Mouse is not over the target element => not a normal click, but probably a drag
|
|
42
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "none";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function mouseUpListener(_e) {
|
|
48
|
+
if (popupCharStylesEditorRef === null || popupCharStylesEditorRef === void 0 ? void 0 : popupCharStylesEditorRef.current) {
|
|
49
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== "auto") {
|
|
50
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
if (popupCharStylesEditorRef === null || popupCharStylesEditorRef === void 0 ? void 0 : popupCharStylesEditorRef.current) {
|
|
56
|
+
document.addEventListener("mousemove", mouseMoveListener);
|
|
57
|
+
document.addEventListener("mouseup", mouseUpListener);
|
|
58
|
+
return () => {
|
|
59
|
+
document.removeEventListener("mousemove", mouseMoveListener);
|
|
60
|
+
document.removeEventListener("mouseup", mouseUpListener);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}, [popupCharStylesEditorRef]);
|
|
65
|
+
const $updateTextFormatFloatingToolbar = (0, react_1.useCallback)(() => {
|
|
66
|
+
const selection = (0, lexical_1.$getSelection)();
|
|
67
|
+
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
68
|
+
const nativeSelection = (0, lexical_1.getDOMSelection)(editor._window);
|
|
69
|
+
if (popupCharStylesEditorElem === null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const rootElement = editor.getRootElement();
|
|
73
|
+
if (selection !== null &&
|
|
74
|
+
nativeSelection !== null &&
|
|
75
|
+
!nativeSelection.isCollapsed &&
|
|
76
|
+
!!rootElement &&
|
|
77
|
+
rootElement.contains(nativeSelection.anchorNode)) {
|
|
78
|
+
const rangeRect = (0, utils_2.getDOMRangeRect)(nativeSelection, rootElement);
|
|
79
|
+
(0, utils_2.setFloatingElemPosition)(rangeRect, popupCharStylesEditorElem, anchorElem, isLink);
|
|
80
|
+
}
|
|
81
|
+
}, [editor, anchorElem, isLink]);
|
|
82
|
+
(0, react_1.useEffect)(() => {
|
|
83
|
+
const scrollerElem = anchorElem.parentElement;
|
|
84
|
+
const update = () => {
|
|
85
|
+
editor.getEditorState().read(() => {
|
|
86
|
+
$updateTextFormatFloatingToolbar();
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
window.addEventListener("resize", update);
|
|
90
|
+
if (scrollerElem) {
|
|
91
|
+
scrollerElem.addEventListener("scroll", update);
|
|
92
|
+
}
|
|
93
|
+
return () => {
|
|
94
|
+
window.removeEventListener("resize", update);
|
|
95
|
+
if (scrollerElem) {
|
|
96
|
+
scrollerElem.removeEventListener("scroll", update);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}, [editor, $updateTextFormatFloatingToolbar, anchorElem]);
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
101
|
+
editor.getEditorState().read(() => {
|
|
102
|
+
$updateTextFormatFloatingToolbar();
|
|
103
|
+
});
|
|
104
|
+
return (0, utils_1.mergeRegister)(editor.registerUpdateListener(({ editorState }) => {
|
|
105
|
+
editorState.read(() => {
|
|
106
|
+
$updateTextFormatFloatingToolbar();
|
|
107
|
+
});
|
|
108
|
+
}), editor.registerCommand(lexical_1.SELECTION_CHANGE_COMMAND, () => {
|
|
109
|
+
$updateTextFormatFloatingToolbar();
|
|
110
|
+
return false;
|
|
111
|
+
}, lexical_1.COMMAND_PRIORITY_LOW));
|
|
112
|
+
}, [editor, $updateTextFormatFloatingToolbar]);
|
|
113
|
+
const controlsMap = {
|
|
114
|
+
bold: (0, jsx_runtime_1.jsx)(ui_1.BoldButton, { activeEditor: editor, isBold: isBold }),
|
|
115
|
+
italic: (0, jsx_runtime_1.jsx)(ui_1.ItalicButton, { activeEditor: editor, isItalic: isItalic }),
|
|
116
|
+
underline: (0, jsx_runtime_1.jsx)(ui_1.UnderlineButton, { activeEditor: editor, isUnderline: isUnderline }),
|
|
117
|
+
strikethrough: (0, jsx_runtime_1.jsx)(ui_1.StrikethroughButton, { activeEditor: editor, isStrikethrough: isStrikethrough }),
|
|
118
|
+
code: (0, jsx_runtime_1.jsx)(ui_1.CodeButton, { activeEditor: editor, isCode: isCode }),
|
|
119
|
+
link: (0, jsx_runtime_1.jsx)(ui_1.LinkButton, { insertLink: insertLink, isLink: isLink }),
|
|
120
|
+
leftAlign: (0, jsx_runtime_1.jsx)(ui_1.LeftAlignButton, { activeEditor: editor, isLeftAlign: isLeftAlign }),
|
|
121
|
+
centerAlign: (0, jsx_runtime_1.jsx)(ui_1.CenterAlignButton, { activeEditor: editor, isCenterAlign: isCenterAlign }),
|
|
122
|
+
rightAlign: (0, jsx_runtime_1.jsx)(ui_1.RightAlignButton, { activeEditor: editor, isRightAlign: isRightAlign }),
|
|
123
|
+
};
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: popupCharStylesEditorRef, className: "floating-text-format-popup", children: editor.isEditable() && !!(controls === null || controls === void 0 ? void 0 : controls.length) && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: controls.map(c => controlsMap[c]) }) }));
|
|
125
|
+
}
|
|
126
|
+
function useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode, controls) {
|
|
127
|
+
const [isText, setIsText] = (0, react_1.useState)(false);
|
|
128
|
+
const [isLink, setIsLink] = (0, react_1.useState)(false);
|
|
129
|
+
const [isBold, setIsBold] = (0, react_1.useState)(false);
|
|
130
|
+
const [isItalic, setIsItalic] = (0, react_1.useState)(false);
|
|
131
|
+
const [isUnderline, setIsUnderline] = (0, react_1.useState)(false);
|
|
132
|
+
const [isStrikethrough, setIsStrikethrough] = (0, react_1.useState)(false);
|
|
133
|
+
const [isCode, setIsCode] = (0, react_1.useState)(false);
|
|
134
|
+
const [isLeftAlign, setIsLeftAlign] = (0, react_1.useState)(false);
|
|
135
|
+
const [isCenterAlign, setIsCenterAlign] = (0, react_1.useState)(false);
|
|
136
|
+
const [isRightAlign, setIsRightAlign] = (0, react_1.useState)(false);
|
|
137
|
+
const updatePopup = (0, react_1.useCallback)(() => {
|
|
138
|
+
editor.getEditorState().read(() => {
|
|
139
|
+
// Should not to pop up the floating toolbar when using IME input
|
|
140
|
+
if (editor.isComposing()) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const selection = (0, lexical_1.$getSelection)();
|
|
144
|
+
const nativeSelection = (0, lexical_1.getDOMSelection)(editor._window);
|
|
145
|
+
const rootElement = editor.getRootElement();
|
|
146
|
+
if (nativeSelection !== null &&
|
|
147
|
+
(!(0, lexical_1.$isRangeSelection)(selection) || !(rootElement === null || rootElement === void 0 ? void 0 : rootElement.contains(nativeSelection.anchorNode)))) {
|
|
148
|
+
setIsText(false);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (!(0, lexical_1.$isRangeSelection)(selection)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const node = (0, utils_2.getSelectedNode)(selection);
|
|
155
|
+
const element = node.getTopLevelElementOrThrow();
|
|
156
|
+
const align = element.getFormatType();
|
|
157
|
+
// Update text format
|
|
158
|
+
setIsBold(selection.hasFormat("bold"));
|
|
159
|
+
setIsItalic(selection.hasFormat("italic"));
|
|
160
|
+
setIsUnderline(selection.hasFormat("underline"));
|
|
161
|
+
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
162
|
+
setIsCode(selection.hasFormat("code"));
|
|
163
|
+
setIsLeftAlign(align === "left");
|
|
164
|
+
setIsCenterAlign(align === "center");
|
|
165
|
+
setIsRightAlign(align === "right");
|
|
166
|
+
// Update links
|
|
167
|
+
const parent = node.getParent();
|
|
168
|
+
if ((0, link_1.$isLinkNode)(parent) || (0, link_1.$isLinkNode)(node)) {
|
|
169
|
+
setIsLink(true);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
setIsLink(false);
|
|
173
|
+
}
|
|
174
|
+
if (!(0, code_1.$isCodeHighlightNode)(selection.anchor.getNode()) && selection.getTextContent() !== "") {
|
|
175
|
+
setIsText((0, lexical_1.$isTextNode)(node) || (0, lexical_1.$isParagraphNode)(node));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
setIsText(false);
|
|
179
|
+
}
|
|
180
|
+
const rawTextContent = selection.getTextContent().replace(/\n/g, "");
|
|
181
|
+
if (!selection.isCollapsed() && rawTextContent === "") {
|
|
182
|
+
setIsText(false);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}, [editor]);
|
|
187
|
+
(0, react_1.useEffect)(() => {
|
|
188
|
+
document.addEventListener("selectionchange", updatePopup);
|
|
189
|
+
return () => {
|
|
190
|
+
document.removeEventListener("selectionchange", updatePopup);
|
|
191
|
+
};
|
|
192
|
+
}, [updatePopup]);
|
|
193
|
+
(0, react_1.useEffect)(() => {
|
|
194
|
+
return (0, utils_1.mergeRegister)(editor.registerUpdateListener(() => {
|
|
195
|
+
updatePopup();
|
|
196
|
+
}), editor.registerRootListener(() => {
|
|
197
|
+
if (editor.getRootElement() === null) {
|
|
198
|
+
setIsText(false);
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
}, [editor, updatePopup]);
|
|
202
|
+
if (!isText) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(TextFormatFloatingToolbar, { editor: editor, anchorElem: anchorElem, isLink: isLink, isBold: isBold, isItalic: isItalic, isStrikethrough: isStrikethrough, isUnderline: isUnderline, isCode: isCode, isLeftAlign: isLeftAlign, isCenterAlign: isCenterAlign, isRightAlign: isRightAlign, setIsLinkEditMode: setIsLinkEditMode, controls: controls }), anchorElem);
|
|
206
|
+
}
|
|
207
|
+
const FloatingTextFormatToolbarPlugin = ({ anchorElem = document.body, setIsLinkEditMode, controls, }) => {
|
|
208
|
+
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
209
|
+
return useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode, controls);
|
|
210
|
+
};
|
|
211
|
+
exports.FloatingTextFormatToolbarPlugin = FloatingTextFormatToolbarPlugin;
|
|
212
|
+
var floatTextFormatToolbarPluginStyles_1 = require("./floatTextFormatToolbarPluginStyles");
|
|
213
|
+
Object.defineProperty(exports, "floatTextFormatToolbarPluginStyles", { enumerable: true, get: function () { return floatTextFormatToolbarPluginStyles_1.floatTextFormatToolbarPluginStyles; } });
|
|
214
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;GAMG;AAEH,iCAA0F;AAC1F,wCAAqD;AACrD,wCAAiE;AACjE,kFAAkF;AAClF,0CAA+C;AAC/C,qCASiB;AACjB,yCAAyC;AAEzC,uCAAwF;AACxF,iCAUkB;AAElB,+CAAyD;AAEzD,SAAS,yBAAyB,CAAC,EACjC,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,EACN,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GAAG,kCAAsB,CAAC,UAAU,GAe7C;IACC,MAAM,wBAAwB,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IAErE,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,MAAM,CAAC,eAAe,CAAC,0BAAmB,EAAE,UAAU,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,MAAM,CAAC,eAAe,CAAC,0BAAmB,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EA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OAAO,IAAA,wBAAY,EACjB,uBAAC,yBAAyB,IACxB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,GAClB,EACF,UAAU,CACX,CAAC;AACJ,CAAC;AAEM,MAAM,+BAA+B,GAAG,CAAC,EAC9C,UAAU,GAAG,QAAQ,CAAC,IAAI,EAC1B,iBAAiB,EACjB,QAAQ,GAKT,EAAsB,EAAE;IACvB,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,kDAAyB,GAAE,CAAC;IAC7C,OAAO,4BAA4B,CAAC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AACvF,CAAC,CAAC;AAXW,QAAA,+BAA+B,mCAW1C;AAEF,2FAA0F;AAAjF,wJAAA,kCAAkC,OAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { type JSX } from "react";
|
|
9
|
+
import { LexicalCommand, LexicalEditor } from "lexical";
|
|
10
|
+
import { IImagePayload } from "../../nodes/Image/ImageNode";
|
|
11
|
+
export type InsertImagePayload = Readonly<IImagePayload>;
|
|
12
|
+
export declare const INSERT_IMAGE_COMMAND: LexicalCommand<InsertImagePayload>;
|
|
13
|
+
export declare function InsertImageUriDialogBody({ onClick }: {
|
|
14
|
+
onClick: (payload: InsertImagePayload) => void;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function InsertImageDialog({ activeEditor, onClose, }: {
|
|
17
|
+
activeEditor: LexicalEditor;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
}): JSX.Element;
|
|
20
|
+
export declare const ImagesPlugin: ({ captionsEnabled }: {
|
|
21
|
+
captionsEnabled?: boolean;
|
|
22
|
+
}) => JSX.Element | null;
|
|
23
|
+
declare global {
|
|
24
|
+
interface DragEvent {
|
|
25
|
+
rangeOffset?: number;
|
|
26
|
+
rangeParent?: Node;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImagesPlugin = exports.INSERT_IMAGE_COMMAND = void 0;
|
|
4
|
+
exports.InsertImageUriDialogBody = InsertImageUriDialogBody;
|
|
5
|
+
exports.InsertImageDialog = InsertImageDialog;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
16
|
+
const utils_1 = require("@lexical/utils");
|
|
17
|
+
const lexical_1 = require("lexical");
|
|
18
|
+
const ImageNode_1 = require("../../nodes/Image/ImageNode");
|
|
19
|
+
const Button_1 = require("../../ui/Button");
|
|
20
|
+
const Dialog_1 = require("../../ui/Dialog");
|
|
21
|
+
const TextInput_1 = require("../../ui/TextInput");
|
|
22
|
+
exports.INSERT_IMAGE_COMMAND = (0, lexical_1.createCommand)("INSERT_IMAGE_COMMAND");
|
|
23
|
+
function InsertImageUriDialogBody({ onClick }) {
|
|
24
|
+
const [src, setSrc] = (0, react_1.useState)("");
|
|
25
|
+
const [altText, setAltText] = (0, react_1.useState)("");
|
|
26
|
+
const isDisabled = src === "";
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { label: "Image URL", placeholder: "i.e. https://source.unsplash.com/random", onChange: setSrc, value: src, "data-test-id": "image-modal-url-input" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { label: "Alt Text", placeholder: "Random unsplash image", onChange: setAltText, value: altText, "data-test-id": "image-modal-alt-text-input" }), (0, jsx_runtime_1.jsx)(Dialog_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { "data-test-id": "image-modal-confirm-btn", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Confirm" }) })] }));
|
|
28
|
+
}
|
|
29
|
+
function InsertImageDialog({ activeEditor, onClose, }) {
|
|
30
|
+
const hasModifier = (0, react_1.useRef)(false);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
hasModifier.current = false;
|
|
33
|
+
const handler = (e) => {
|
|
34
|
+
hasModifier.current = e.altKey;
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener("keydown", handler);
|
|
37
|
+
return () => {
|
|
38
|
+
document.removeEventListener("keydown", handler);
|
|
39
|
+
};
|
|
40
|
+
}, [activeEditor]);
|
|
41
|
+
const onClick = (payload) => {
|
|
42
|
+
activeEditor.dispatchCommand(exports.INSERT_IMAGE_COMMAND, payload);
|
|
43
|
+
onClose();
|
|
44
|
+
};
|
|
45
|
+
return (0, jsx_runtime_1.jsx)(InsertImageUriDialogBody, { onClick: onClick });
|
|
46
|
+
}
|
|
47
|
+
const ImagesPlugin = ({ captionsEnabled }) => {
|
|
48
|
+
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
if (!editor.hasNodes([ImageNode_1.ImageNode])) {
|
|
51
|
+
throw new Error("ImagesPlugin: ImageNode not registered on editor");
|
|
52
|
+
}
|
|
53
|
+
return (0, utils_1.mergeRegister)(editor.registerCommand(exports.INSERT_IMAGE_COMMAND, payload => {
|
|
54
|
+
const imageNode = (0, ImageNode_1.$createImageNode)(payload);
|
|
55
|
+
(0, lexical_1.$insertNodes)([imageNode]);
|
|
56
|
+
if ((0, lexical_1.$isRootOrShadowRoot)(imageNode.getParentOrThrow())) {
|
|
57
|
+
(0, utils_1.$wrapNodeInElement)(imageNode, lexical_1.$createParagraphNode).selectEnd();
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}, lexical_1.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical_1.DRAGSTART_COMMAND, event => {
|
|
61
|
+
return $onDragStart(event);
|
|
62
|
+
}, lexical_1.COMMAND_PRIORITY_HIGH), editor.registerCommand(lexical_1.DRAGOVER_COMMAND, event => {
|
|
63
|
+
return $onDragover(event);
|
|
64
|
+
}, lexical_1.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical_1.DROP_COMMAND, event => {
|
|
65
|
+
return $onDrop(event, editor);
|
|
66
|
+
}, lexical_1.COMMAND_PRIORITY_HIGH));
|
|
67
|
+
}, [captionsEnabled, editor]);
|
|
68
|
+
return null;
|
|
69
|
+
};
|
|
70
|
+
exports.ImagesPlugin = ImagesPlugin;
|
|
71
|
+
const TRANSPARENT_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
72
|
+
const img = document.createElement("img");
|
|
73
|
+
img.src = TRANSPARENT_IMAGE;
|
|
74
|
+
function $onDragStart(event) {
|
|
75
|
+
const node = $getImageNodeInSelection();
|
|
76
|
+
if (!node) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const dataTransfer = event.dataTransfer;
|
|
80
|
+
if (!dataTransfer) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
dataTransfer.setData("text/plain", "_");
|
|
84
|
+
dataTransfer.setDragImage(img, 0, 0);
|
|
85
|
+
dataTransfer.setData("application/x-lexical-drag", JSON.stringify({
|
|
86
|
+
data: {
|
|
87
|
+
altText: node.__altText,
|
|
88
|
+
caption: node.__caption,
|
|
89
|
+
height: node.__height,
|
|
90
|
+
key: node.getKey(),
|
|
91
|
+
maxWidth: node.__maxWidth,
|
|
92
|
+
showCaption: node.__showCaption,
|
|
93
|
+
src: node.__src,
|
|
94
|
+
width: node.__width,
|
|
95
|
+
},
|
|
96
|
+
type: "image",
|
|
97
|
+
}));
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
function $onDragover(event) {
|
|
101
|
+
const node = $getImageNodeInSelection();
|
|
102
|
+
if (!node) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (!canDropImage(event)) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
function $onDrop(event, editor) {
|
|
111
|
+
const node = $getImageNodeInSelection();
|
|
112
|
+
if (!node) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const data = getDragImageData(event);
|
|
116
|
+
if (!data) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
if (canDropImage(event)) {
|
|
121
|
+
const range = getDragSelection(event);
|
|
122
|
+
node.remove();
|
|
123
|
+
const rangeSelection = (0, lexical_1.$createRangeSelection)();
|
|
124
|
+
if (range !== null && range !== undefined) {
|
|
125
|
+
rangeSelection.applyDOMRange(range);
|
|
126
|
+
}
|
|
127
|
+
(0, lexical_1.$setSelection)(rangeSelection);
|
|
128
|
+
editor.dispatchCommand(exports.INSERT_IMAGE_COMMAND, data);
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
function $getImageNodeInSelection() {
|
|
133
|
+
const selection = (0, lexical_1.$getSelection)();
|
|
134
|
+
if (!(0, lexical_1.$isNodeSelection)(selection)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const nodes = selection.getNodes();
|
|
138
|
+
const node = nodes[0];
|
|
139
|
+
return (0, ImageNode_1.$isImageNode)(node) ? node : null;
|
|
140
|
+
}
|
|
141
|
+
function getDragImageData(event) {
|
|
142
|
+
var _a;
|
|
143
|
+
const dragData = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData("application/x-lexical-drag");
|
|
144
|
+
if (!dragData) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
const { type, data } = JSON.parse(dragData);
|
|
148
|
+
if (type !== "image") {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return data;
|
|
152
|
+
}
|
|
153
|
+
function canDropImage(event) {
|
|
154
|
+
const target = event.target;
|
|
155
|
+
return !!((0, lexical_1.isHTMLElement)(target) &&
|
|
156
|
+
!target.closest("code, span.editor-image") &&
|
|
157
|
+
(0, lexical_1.isHTMLElement)(target.parentElement) &&
|
|
158
|
+
target.parentElement.closest("div.ContentEditable__root"));
|
|
159
|
+
}
|
|
160
|
+
function getDragSelection(event) {
|
|
161
|
+
let range;
|
|
162
|
+
const domSelection = (0, lexical_1.getDOMSelectionFromTarget)(event.target);
|
|
163
|
+
if (document.caretRangeFromPoint) {
|
|
164
|
+
range = document.caretRangeFromPoint(event.clientX, event.clientY);
|
|
165
|
+
}
|
|
166
|
+
else if (event.rangeParent && domSelection !== null) {
|
|
167
|
+
domSelection.collapse(event.rangeParent, event.rangeOffset || 0);
|
|
168
|
+
range = domSelection.getRangeAt(0);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw Error(`Cannot get the selection when dragging`);
|
|
172
|
+
}
|
|
173
|
+
return range;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@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MAAM,CAAC;QACrB,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC;QAC1C,IAAA,uBAAa,EAAC,MAAM,CAAC,aAAa,CAAC;QACnC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB;IACxC,IAAI,KAAK,CAAC;IACV,MAAM,YAAY,GAAG,IAAA,mCAAyB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QACjC,KAAK,GAAG,QAAQ,CAAC,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;SAAM,IAAI,KAAK,CAAC,WAAW,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QACtD,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;QACjE,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { JSX } from "react";
|
|
9
|
+
export declare const LinkPlugin: () => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkPlugin = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const LexicalLinkPlugin_1 = require("@lexical/react/LexicalLinkPlugin");
|
|
6
|
+
const url_1 = require("../../utils/url");
|
|
7
|
+
const LinkPlugin = () => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, { validateUrl: url_1.validateUrl, attributes: {
|
|
9
|
+
rel: "noopener noreferrer",
|
|
10
|
+
target: "_blank",
|
|
11
|
+
} }));
|
|
12
|
+
};
|
|
13
|
+
exports.LinkPlugin = LinkPlugin;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/plugins/LinkPlugin/index.tsx"],"names":[],"mappings":";;;;AASA,wEAAmF;AAEnF,yCAA8C;AAEvC,MAAM,UAAU,GAAG,GAAgB,EAAE;IAC1C,OAAO,CACL,uBAAC,8BAAiB,IAChB,WAAW,EAAE,iBAAW,EACxB,UAAU,EAAE;YACV,GAAG,EAAE,qBAAqB;YAC1B,MAAM,EAAE,QAAQ;SACjB,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { JSX } from "react";
|
|
9
|
+
export declare const MarkdownPlugin: () => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarkdownPlugin = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const LexicalMarkdownShortcutPlugin_1 = require("@lexical/react/LexicalMarkdownShortcutPlugin");
|
|
6
|
+
const MarkdownTransformers_1 = require("../MarkdownTransformers");
|
|
7
|
+
const MarkdownPlugin = () => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(LexicalMarkdownShortcutPlugin_1.MarkdownShortcutPlugin, { transformers: MarkdownTransformers_1.PLAYGROUND_TRANSFORMERS });
|
|
9
|
+
};
|
|
10
|
+
exports.MarkdownPlugin = MarkdownPlugin;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|