@squiz/formatted-text-editor 0.0.0-rbv2-20240530041851
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/.eslintrc.json +41 -0
- package/CHANGELOG.md +155 -0
- package/README.md +74 -0
- package/build.js +21 -0
- package/coverage/clover.xml +1544 -0
- package/coverage/coverage-final.json +74 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +911 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/Editor/Editor.tsx.html +436 -0
- package/coverage/lcov-report/src/Editor/EditorContext.ts.html +145 -0
- package/coverage/lcov-report/src/Editor/index.html +131 -0
- package/coverage/lcov-report/src/EditorToolbar/FloatingToolbar.tsx.html +271 -0
- package/coverage/lcov-report/src/EditorToolbar/Toolbar.tsx.html +265 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Bold/BoldButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Bold/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/ClearFormatting/ClearFormattingButton.tsx.html +229 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/ClearFormatting/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/HorizontalLine/HorizontalLineButton.tsx.html +187 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/HorizontalLine/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Image/Form/ImageForm.tsx.html +688 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Image/Form/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Image/ImageButton.tsx.html +301 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Image/ImageModal.tsx.html +181 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Image/index.html +131 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Italic/ItalicButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Italic/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/Form/LinkForm.tsx.html +508 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/Form/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/LinkButton.tsx.html +286 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/LinkModal.tsx.html +196 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/RemoveLinkButton.tsx.html +211 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Link/index.html +146 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/ListButtons.tsx.html +127 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/OrderedList/OrderedListButton.tsx.html +175 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/OrderedList/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/UnorderedList/UnorderedListButton.tsx.html +175 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/UnorderedList/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Lists/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Redo/RedoButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Redo/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Table/TableButton.tsx.html +181 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Table/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/CenterAlign/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/JustifyAlign/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/LeftAlign/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/RightAlign/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/TextAlignButtons.tsx.html +148 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextAlign/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/CodeBlock/CodeBlockButton.tsx.html +181 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/CodeBlock/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Heading/HeadingButton.tsx.html +241 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Heading/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.tsx.html +160 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Paragraph/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.tsx.html +181 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/Preformatted/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/TextTypeDropdown.tsx.html +247 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/TextType/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Underline/UnderlineButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Underline/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Undo/UndoButton.tsx.html +178 -0
- package/coverage/lcov-report/src/EditorToolbar/Tools/Undo/index.html +116 -0
- package/coverage/lcov-report/src/EditorToolbar/index.html +146 -0
- package/coverage/lcov-report/src/EditorToolbar/index.ts.html +91 -0
- package/coverage/lcov-report/src/Extensions/ClearFormattingExtension/ClearFormattingExtension.ts.html +256 -0
- package/coverage/lcov-report/src/Extensions/ClearFormattingExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/CodeBlockExtension/CodeBlockExtension.ts.html +187 -0
- package/coverage/lcov-report/src/Extensions/CodeBlockExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/CommandsExtension/CommandsExtension.ts.html +247 -0
- package/coverage/lcov-report/src/Extensions/CommandsExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/Extensions.ts.html +349 -0
- package/coverage/lcov-report/src/Extensions/FetchUrlExtension/FetchUrlExtension.ts.html +289 -0
- package/coverage/lcov-report/src/Extensions/FetchUrlExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/ImageExtension/AssetImageExtension.ts.html +412 -0
- package/coverage/lcov-report/src/Extensions/ImageExtension/ImageExtension.ts.html +142 -0
- package/coverage/lcov-report/src/Extensions/ImageExtension/index.html +131 -0
- package/coverage/lcov-report/src/Extensions/LinkExtension/AssetLinkExtension.ts.html +466 -0
- package/coverage/lcov-report/src/Extensions/LinkExtension/LinkExtension.ts.html +400 -0
- package/coverage/lcov-report/src/Extensions/LinkExtension/common.ts.html +115 -0
- package/coverage/lcov-report/src/Extensions/LinkExtension/index.html +146 -0
- package/coverage/lcov-report/src/Extensions/PreformattedExtension/PreformattedExtension.ts.html +340 -0
- package/coverage/lcov-report/src/Extensions/PreformattedExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/UnsuportedExtension/UnsupportedNodeExtension.tsx.html +325 -0
- package/coverage/lcov-report/src/Extensions/UnsuportedExtension/index.html +116 -0
- package/coverage/lcov-report/src/Extensions/index.html +116 -0
- package/coverage/lcov-report/src/hooks/index.html +161 -0
- package/coverage/lcov-report/src/hooks/index.ts.html +91 -0
- package/coverage/lcov-report/src/hooks/useExpandedSelection.ts.html +217 -0
- package/coverage/lcov-report/src/hooks/useExtensionNames.ts.html +130 -0
- package/coverage/lcov-report/src/hooks/useFocus.ts.html +268 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.ts.html +112 -0
- package/coverage/lcov-report/src/ui/Button/Button.tsx.html +190 -0
- package/coverage/lcov-report/src/ui/Button/index.html +116 -0
- package/coverage/lcov-report/src/ui/CollapseBox/CollapseBox.tsx.html +193 -0
- package/coverage/lcov-report/src/ui/CollapseBox/index.html +116 -0
- package/coverage/lcov-report/src/ui/Fields/Checkbox/Checkbox.tsx.html +232 -0
- package/coverage/lcov-report/src/ui/Fields/Checkbox/index.html +116 -0
- package/coverage/lcov-report/src/ui/Fields/Input/Input.tsx.html +160 -0
- package/coverage/lcov-report/src/ui/Fields/Input/index.html +116 -0
- package/coverage/lcov-report/src/ui/Fields/InputContainer/InputContainer.tsx.html +172 -0
- package/coverage/lcov-report/src/ui/Fields/InputContainer/index.html +116 -0
- package/coverage/lcov-report/src/ui/Fields/MatrixAsset/MatrixAsset.tsx.html +256 -0
- package/coverage/lcov-report/src/ui/Fields/MatrixAsset/index.html +116 -0
- package/coverage/lcov-report/src/ui/Fields/Select/Select.tsx.html +283 -0
- package/coverage/lcov-report/src/ui/Fields/Select/index.html +116 -0
- package/coverage/lcov-report/src/ui/Modal/FormModal.tsx.html +136 -0
- package/coverage/lcov-report/src/ui/Modal/Modal.tsx.html +397 -0
- package/coverage/lcov-report/src/ui/Modal/index.html +131 -0
- package/coverage/lcov-report/src/ui/Tabs/Tabs.tsx.html +208 -0
- package/coverage/lcov-report/src/ui/Tabs/index.html +116 -0
- package/coverage/lcov-report/src/ui/ToolbarDropdown/ToolbarDropdown.tsx.html +211 -0
- package/coverage/lcov-report/src/ui/ToolbarDropdown/index.html +116 -0
- package/coverage/lcov-report/src/ui/ToolbarDropdownButton/ToolbarDropdownButton.tsx.html +184 -0
- package/coverage/lcov-report/src/ui/ToolbarDropdownButton/index.html +116 -0
- package/coverage/lcov-report/src/utils/converters/htmlToSquizNode/htmlToSquizNode.ts.html +166 -0
- package/coverage/lcov-report/src/utils/converters/htmlToSquizNode/index.html +116 -0
- package/coverage/lcov-report/src/utils/converters/mocks/index.html +116 -0
- package/coverage/lcov-report/src/utils/converters/mocks/squizNodeJson.mock.ts.html +895 -0
- package/coverage/lcov-report/src/utils/converters/remirrorNodeToSquizNode/index.html +116 -0
- package/coverage/lcov-report/src/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.ts.html +976 -0
- package/coverage/lcov-report/src/utils/converters/squizNodeToRemirrorNode/index.html +116 -0
- package/coverage/lcov-report/src/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.ts.html +748 -0
- package/coverage/lcov-report/src/utils/createToolbarPositioner.ts.html +469 -0
- package/coverage/lcov-report/src/utils/getCursorRect.ts.html +100 -0
- package/coverage/lcov-report/src/utils/getMarkNamesByGroup.ts.html +106 -0
- package/coverage/lcov-report/src/utils/getNodeNamesByGroup.ts.html +106 -0
- package/coverage/lcov-report/src/utils/getShortcutSymbol.ts.html +97 -0
- package/coverage/lcov-report/src/utils/index.html +206 -0
- package/coverage/lcov-report/src/utils/undefinedIfEmpty.ts.html +94 -0
- package/coverage/lcov-report/src/utils/validation.ts.html +133 -0
- package/coverage/lcov.info +2737 -0
- package/cypress/e2e/bold.spec.cy.ts +18 -0
- package/cypress/global.d.ts +9 -0
- package/cypress/support/commands.ts +130 -0
- package/cypress/support/e2e.ts +20 -0
- package/cypress/tsconfig.json +8 -0
- package/cypress.config.ts +7 -0
- package/demo/App.tsx +107 -0
- package/demo/AppContext.tsx +70 -0
- package/demo/index.html +13 -0
- package/demo/index.scss +33 -0
- package/demo/main.tsx +12 -0
- package/demo/public/favicon-dxp.svg +3 -0
- package/demo/resources.json +204 -0
- package/demo/sources.json +27 -0
- package/demo/vite-env.d.ts +1 -0
- package/file-transformer.js +1 -0
- package/jest.bootstrap.ts +3 -0
- package/jest.config.ts +27 -0
- package/lib/Editor/Editor.d.ts +16 -0
- package/lib/Editor/Editor.js +85 -0
- package/lib/Editor/EditorContext.d.ts +10 -0
- package/lib/Editor/EditorContext.js +16 -0
- package/lib/EditorToolbar/FloatingToolbar.d.ts +2 -0
- package/lib/EditorToolbar/FloatingToolbar.js +76 -0
- package/lib/EditorToolbar/Toolbar.d.ts +7 -0
- package/lib/EditorToolbar/Toolbar.js +47 -0
- package/lib/EditorToolbar/Tools/Bold/BoldButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Bold/BoldButton.js +23 -0
- package/lib/EditorToolbar/Tools/ClearFormatting/ClearFormattingButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/ClearFormatting/ClearFormattingButton.js +57 -0
- package/lib/EditorToolbar/Tools/HorizontalLine/HorizontalLineButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/HorizontalLine/HorizontalLineButton.js +25 -0
- package/lib/EditorToolbar/Tools/Image/Form/ImageForm.d.ts +18 -0
- package/lib/EditorToolbar/Tools/Image/Form/ImageForm.js +143 -0
- package/lib/EditorToolbar/Tools/Image/ImageButton.d.ts +6 -0
- package/lib/EditorToolbar/Tools/Image/ImageButton.js +76 -0
- package/lib/EditorToolbar/Tools/Image/ImageModal.d.ts +9 -0
- package/lib/EditorToolbar/Tools/Image/ImageModal.js +24 -0
- package/lib/EditorToolbar/Tools/Italic/ItalicButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Italic/ItalicButton.js +23 -0
- package/lib/EditorToolbar/Tools/Link/Form/LinkForm.d.ts +19 -0
- package/lib/EditorToolbar/Tools/Link/Form/LinkForm.js +63 -0
- package/lib/EditorToolbar/Tools/Link/LinkButton.d.ts +6 -0
- package/lib/EditorToolbar/Tools/Link/LinkButton.js +71 -0
- package/lib/EditorToolbar/Tools/Link/LinkModal.d.ts +9 -0
- package/lib/EditorToolbar/Tools/Link/LinkModal.js +27 -0
- package/lib/EditorToolbar/Tools/Link/RemoveLinkButton.d.ts +4 -0
- package/lib/EditorToolbar/Tools/Link/RemoveLinkButton.js +54 -0
- package/lib/EditorToolbar/Tools/Lists/ListButtons.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Lists/ListButtons.js +14 -0
- package/lib/EditorToolbar/Tools/Lists/OrderedList/OrderedListButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Lists/OrderedList/OrderedListButton.js +22 -0
- package/lib/EditorToolbar/Tools/Lists/UnorderedList/UnorderedListButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Lists/UnorderedList/UnorderedListButton.js +22 -0
- package/lib/EditorToolbar/Tools/Redo/RedoButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Redo/RedoButton.js +22 -0
- package/lib/EditorToolbar/Tools/Table/TableButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Table/TableButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextAlign/TextAlignButtons.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextAlign/TextAlignButtons.js +21 -0
- package/lib/EditorToolbar/Tools/TextType/CodeBlock/CodeBlockButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextType/CodeBlock/CodeBlockButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextType/Heading/HeadingButton.d.ts +6 -0
- package/lib/EditorToolbar/Tools/TextType/Heading/HeadingButton.js +37 -0
- package/lib/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.js +21 -0
- package/lib/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.js +22 -0
- package/lib/EditorToolbar/Tools/TextType/TextTypeDropdown.d.ts +3 -0
- package/lib/EditorToolbar/Tools/TextType/TextTypeDropdown.js +46 -0
- package/lib/EditorToolbar/Tools/Underline/UnderlineButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Underline/UnderlineButton.js +23 -0
- package/lib/EditorToolbar/Tools/Undo/UndoButton.d.ts +3 -0
- package/lib/EditorToolbar/Tools/Undo/UndoButton.js +22 -0
- package/lib/EditorToolbar/index.d.ts +2 -0
- package/lib/EditorToolbar/index.js +18 -0
- package/lib/Extensions/ClearFormattingExtension/ClearFormattingExtension.d.ts +5 -0
- package/lib/Extensions/ClearFormattingExtension/ClearFormattingExtension.js +63 -0
- package/lib/Extensions/CodeBlockExtension/CodeBlockExtension.d.ts +5 -0
- package/lib/Extensions/CodeBlockExtension/CodeBlockExtension.js +30 -0
- package/lib/Extensions/CommandsExtension/CommandsExtension.d.ts +20 -0
- package/lib/Extensions/CommandsExtension/CommandsExtension.js +52 -0
- package/lib/Extensions/Extensions.d.ts +17 -0
- package/lib/Extensions/Extensions.js +73 -0
- package/lib/Extensions/FetchUrlExtension/FetchUrlExtension.d.ts +12 -0
- package/lib/Extensions/FetchUrlExtension/FetchUrlExtension.js +63 -0
- package/lib/Extensions/ImageExtension/AssetImageExtension.d.ts +17 -0
- package/lib/Extensions/ImageExtension/AssetImageExtension.js +91 -0
- package/lib/Extensions/ImageExtension/ImageExtension.d.ts +7 -0
- package/lib/Extensions/ImageExtension/ImageExtension.js +18 -0
- package/lib/Extensions/LinkExtension/AssetLinkExtension.d.ts +27 -0
- package/lib/Extensions/LinkExtension/AssetLinkExtension.js +101 -0
- package/lib/Extensions/LinkExtension/LinkExtension.d.ts +23 -0
- package/lib/Extensions/LinkExtension/LinkExtension.js +87 -0
- package/lib/Extensions/LinkExtension/common.d.ts +7 -0
- package/lib/Extensions/LinkExtension/common.js +14 -0
- package/lib/Extensions/PreformattedExtension/PreformattedExtension.d.ts +12 -0
- package/lib/Extensions/PreformattedExtension/PreformattedExtension.js +76 -0
- package/lib/Extensions/UnsuportedExtension/UnsupportedNodeExtension.d.ts +10 -0
- package/lib/Extensions/UnsuportedExtension/UnsupportedNodeExtension.js +76 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +18 -0
- package/lib/hooks/useExpandedSelection.d.ts +23 -0
- package/lib/hooks/useExpandedSelection.js +37 -0
- package/lib/hooks/useExtensionNames.d.ts +1 -0
- package/lib/hooks/useExtensionNames.js +16 -0
- package/lib/hooks/useFocus.d.ts +8 -0
- package/lib/hooks/useFocus.js +43 -0
- package/lib/index.css +1525 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +16 -0
- package/lib/types.d.ts +7 -0
- package/lib/types.js +2 -0
- package/lib/ui/Button/Button.d.ts +12 -0
- package/lib/ui/Button/Button.js +13 -0
- package/lib/ui/CollapseBox/CollapseBox.d.ts +7 -0
- package/lib/ui/CollapseBox/CollapseBox.js +48 -0
- package/lib/ui/Fields/Checkbox/Checkbox.d.ts +9 -0
- package/lib/ui/Fields/Checkbox/Checkbox.js +47 -0
- package/lib/ui/Fields/Input/Input.d.ts +3 -0
- package/lib/ui/Fields/Input/Input.js +33 -0
- package/lib/ui/Fields/InputContainer/InputContainer.d.ts +9 -0
- package/lib/ui/Fields/InputContainer/InputContainer.js +16 -0
- package/lib/ui/Fields/MatrixAsset/MatrixAsset.d.ts +19 -0
- package/lib/ui/Fields/MatrixAsset/MatrixAsset.js +30 -0
- package/lib/ui/Modal/FormModal.d.ts +5 -0
- package/lib/ui/Modal/FormModal.js +39 -0
- package/lib/ui/Modal/Modal.d.ts +11 -0
- package/lib/ui/Modal/Modal.js +79 -0
- package/lib/ui/Tabs/Tabs.d.ts +11 -0
- package/lib/ui/Tabs/Tabs.js +46 -0
- package/lib/ui/ToolbarDropdown/ToolbarDropdown.d.ts +7 -0
- package/lib/ui/ToolbarDropdown/ToolbarDropdown.js +48 -0
- package/lib/ui/ToolbarDropdownButton/ToolbarDropdownButton.d.ts +11 -0
- package/lib/ui/ToolbarDropdownButton/ToolbarDropdownButton.js +15 -0
- package/lib/utils/converters/htmlToSquizNode/htmlToSquizNode.d.ts +5 -0
- package/lib/utils/converters/htmlToSquizNode/htmlToSquizNode.js +23 -0
- package/lib/utils/converters/htmlToSquizNode/htmlToSquizNode.props.d.ts +3 -0
- package/lib/utils/converters/htmlToSquizNode/htmlToSquizNode.props.js +2 -0
- package/lib/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.d.ts +11 -0
- package/lib/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.js +229 -0
- package/lib/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.d.ts +9 -0
- package/lib/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.js +205 -0
- package/lib/utils/createToolbarPositioner.d.ts +18 -0
- package/lib/utils/createToolbarPositioner.js +96 -0
- package/lib/utils/getCursorRect.d.ts +2 -0
- package/lib/utils/getCursorRect.js +7 -0
- package/lib/utils/getMarkNamesByGroup.d.ts +2 -0
- package/lib/utils/getMarkNamesByGroup.js +9 -0
- package/lib/utils/getNodeNamesByGroup.d.ts +2 -0
- package/lib/utils/getNodeNamesByGroup.js +9 -0
- package/lib/utils/getShortcutSymbol.d.ts +1 -0
- package/lib/utils/getShortcutSymbol.js +8 -0
- package/lib/utils/undefinedIfEmpty.d.ts +1 -0
- package/lib/utils/undefinedIfEmpty.js +7 -0
- package/lib/utils/validation.d.ts +3 -0
- package/lib/utils/validation.js +16 -0
- package/package.json +83 -0
- package/postcss.config.js +12 -0
- package/src/Editor/Editor.spec.tsx +465 -0
- package/src/Editor/Editor.tsx +117 -0
- package/src/Editor/EditorContext.spec.tsx +25 -0
- package/src/Editor/EditorContext.ts +20 -0
- package/src/Editor/_editor.scss +430 -0
- package/src/EditorToolbar/FloatingToolbar.spec.tsx +49 -0
- package/src/EditorToolbar/FloatingToolbar.tsx +62 -0
- package/src/EditorToolbar/Toolbar.tsx +60 -0
- package/src/EditorToolbar/Tools/Bold/BoldButton.spec.tsx +19 -0
- package/src/EditorToolbar/Tools/Bold/BoldButton.tsx +31 -0
- package/src/EditorToolbar/Tools/ClearFormatting/ClearFormattingButton.spec.tsx +34 -0
- package/src/EditorToolbar/Tools/ClearFormatting/ClearFormattingButton.tsx +48 -0
- package/src/EditorToolbar/Tools/HorizontalLine/HorizontalLineButton.spec.tsx +23 -0
- package/src/EditorToolbar/Tools/HorizontalLine/HorizontalLineButton.tsx +34 -0
- package/src/EditorToolbar/Tools/Image/Form/ImageForm.spec.tsx +117 -0
- package/src/EditorToolbar/Tools/Image/Form/ImageForm.tsx +201 -0
- package/src/EditorToolbar/Tools/Image/ImageButton.spec.tsx +385 -0
- package/src/EditorToolbar/Tools/Image/ImageButton.tsx +72 -0
- package/src/EditorToolbar/Tools/Image/ImageModal.spec.tsx +123 -0
- package/src/EditorToolbar/Tools/Image/ImageModal.tsx +32 -0
- package/src/EditorToolbar/Tools/Italic/ItalicButton.spec.tsx +19 -0
- package/src/EditorToolbar/Tools/Italic/ItalicButton.tsx +31 -0
- package/src/EditorToolbar/Tools/Link/Form/LinkForm.spec.tsx +79 -0
- package/src/EditorToolbar/Tools/Link/Form/LinkForm.tsx +141 -0
- package/src/EditorToolbar/Tools/Link/LinkButton.spec.tsx +402 -0
- package/src/EditorToolbar/Tools/Link/LinkButton.tsx +67 -0
- package/src/EditorToolbar/Tools/Link/LinkModal.tsx +37 -0
- package/src/EditorToolbar/Tools/Link/RemoveLinkButton.spec.tsx +143 -0
- package/src/EditorToolbar/Tools/Link/RemoveLinkButton.tsx +42 -0
- package/src/EditorToolbar/Tools/Lists/ListButtons.tsx +14 -0
- package/src/EditorToolbar/Tools/Lists/OrderedList/OrderListButton.spec.tsx +39 -0
- package/src/EditorToolbar/Tools/Lists/OrderedList/OrderedListButton.tsx +30 -0
- package/src/EditorToolbar/Tools/Lists/UnorderedList/UnorderedList.spec.tsx +19 -0
- package/src/EditorToolbar/Tools/Lists/UnorderedList/UnorderedListButton.tsx +30 -0
- package/src/EditorToolbar/Tools/Redo/RedoButton.spec.tsx +59 -0
- package/src/EditorToolbar/Tools/Redo/RedoButton.tsx +31 -0
- package/src/EditorToolbar/Tools/Table/TableButton.spec.tsx +25 -0
- package/src/EditorToolbar/Tools/Table/TableButton.tsx +32 -0
- package/src/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.spec.tsx +39 -0
- package/src/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.tsx +31 -0
- package/src/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.spec.tsx +39 -0
- package/src/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.tsx +31 -0
- package/src/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.spec.tsx +39 -0
- package/src/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.tsx +31 -0
- package/src/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.spec.tsx +39 -0
- package/src/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.tsx +31 -0
- package/src/EditorToolbar/Tools/TextAlign/TextAlignButtons.tsx +21 -0
- package/src/EditorToolbar/Tools/TextType/CodeBlock/CodeBlockButton.spec.tsx +47 -0
- package/src/EditorToolbar/Tools/TextType/CodeBlock/CodeBlockButton.tsx +32 -0
- package/src/EditorToolbar/Tools/TextType/Heading/HeadingButton.spec.tsx +56 -0
- package/src/EditorToolbar/Tools/TextType/Heading/HeadingButton.tsx +52 -0
- package/src/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.spec.tsx +30 -0
- package/src/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.tsx +25 -0
- package/src/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.spec.tsx +47 -0
- package/src/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.tsx +32 -0
- package/src/EditorToolbar/Tools/TextType/TextTypeDropdown.spec.tsx +51 -0
- package/src/EditorToolbar/Tools/TextType/TextTypeDropdown.tsx +54 -0
- package/src/EditorToolbar/Tools/Underline/Underline.spec.tsx +19 -0
- package/src/EditorToolbar/Tools/Underline/UnderlineButton.tsx +31 -0
- package/src/EditorToolbar/Tools/Undo/UndoButton.spec.tsx +70 -0
- package/src/EditorToolbar/Tools/Undo/UndoButton.tsx +31 -0
- package/src/EditorToolbar/_floating-toolbar.scss +9 -0
- package/src/EditorToolbar/_toolbar.scss +37 -0
- package/src/EditorToolbar/index.ts +2 -0
- package/src/Extensions/ClearFormattingExtension/ClearFormattingExtension.ts +57 -0
- package/src/Extensions/CodeBlockExtension/CodeBlockExtension.ts +34 -0
- package/src/Extensions/CommandsExtension/CommandsExtension.ts +54 -0
- package/src/Extensions/Extensions.ts +88 -0
- package/src/Extensions/FetchUrlExtension/FetchUrlExtension.ts +68 -0
- package/src/Extensions/ImageExtension/AssetImageExtension.spec.ts +77 -0
- package/src/Extensions/ImageExtension/AssetImageExtension.ts +109 -0
- package/src/Extensions/ImageExtension/ImageExtension.ts +19 -0
- package/src/Extensions/LinkExtension/AssetLinkExtension.spec.ts +106 -0
- package/src/Extensions/LinkExtension/AssetLinkExtension.ts +127 -0
- package/src/Extensions/LinkExtension/LinkExtension.spec.ts +68 -0
- package/src/Extensions/LinkExtension/LinkExtension.ts +105 -0
- package/src/Extensions/LinkExtension/common.ts +10 -0
- package/src/Extensions/PreformattedExtension/PreformattedExtension.spec.ts +43 -0
- package/src/Extensions/PreformattedExtension/PreformattedExtension.ts +85 -0
- package/src/Extensions/UnsuportedExtension/UnsupportedNodeExtension.spec.ts +137 -0
- package/src/Extensions/UnsuportedExtension/UnsupportedNodeExtension.tsx +80 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useExpandedSelection.ts +44 -0
- package/src/hooks/useExtensionNames.ts +15 -0
- package/src/hooks/useFocus.ts +61 -0
- package/src/index.scss +24 -0
- package/src/index.ts +9 -0
- package/src/types.ts +10 -0
- package/src/ui/Button/Button.spec.tsx +44 -0
- package/src/ui/Button/Button.tsx +35 -0
- package/src/ui/Button/_button.scss +37 -0
- package/src/ui/CollapseBox/CollapseBox.spec.tsx +49 -0
- package/src/ui/CollapseBox/CollapseBox.tsx +36 -0
- package/src/ui/CollapseBox/_collapseBox.scss +23 -0
- package/src/ui/Fields/Checkbox/Checkbox.spec.tsx +50 -0
- package/src/ui/Fields/Checkbox/Checkbox.tsx +49 -0
- package/src/ui/Fields/Checkbox/_checkbox.scss +26 -0
- package/src/ui/Fields/Input/Input.spec.tsx +49 -0
- package/src/ui/Fields/Input/Input.tsx +25 -0
- package/src/ui/Fields/InputContainer/InputContainer.spec.tsx +18 -0
- package/src/ui/Fields/InputContainer/InputContainer.tsx +29 -0
- package/src/ui/Fields/MatrixAsset/MatrixAsset.spec.tsx +121 -0
- package/src/ui/Fields/MatrixAsset/MatrixAsset.tsx +57 -0
- package/src/ui/Fields/Select/Select.spec.tsx +30 -0
- package/src/ui/Fields/Select/Select.tsx +66 -0
- package/src/ui/Modal/FormModal.spec.tsx +21 -0
- package/src/ui/Modal/FormModal.tsx +17 -0
- package/src/ui/Modal/Modal.spec.tsx +136 -0
- package/src/ui/Modal/Modal.tsx +104 -0
- package/src/ui/Modal/_modal.scss +24 -0
- package/src/ui/Tabs/Tabs.spec.tsx +44 -0
- package/src/ui/Tabs/Tabs.tsx +41 -0
- package/src/ui/ToolbarDropdown/ToolbarDropdown.spec.tsx +80 -0
- package/src/ui/ToolbarDropdown/ToolbarDropdown.tsx +42 -0
- package/src/ui/ToolbarDropdown/_toolbar-dropdown.scss +32 -0
- package/src/ui/ToolbarDropdownButton/ToolbarDropdownButton.spec.tsx +48 -0
- package/src/ui/ToolbarDropdownButton/ToolbarDropdownButton.tsx +33 -0
- package/src/ui/ToolbarDropdownButton/_toolbar-dropdown-button.scss +25 -0
- package/src/ui/_forms.scss +32 -0
- package/src/ui/_typography.scss +95 -0
- package/src/utils/converters/htmlToSquizNode/htmlToSquizNode.props.ts +3 -0
- package/src/utils/converters/htmlToSquizNode/htmlToSquizNode.spec.ts +179 -0
- package/src/utils/converters/htmlToSquizNode/htmlToSquizNode.ts +27 -0
- package/src/utils/converters/mocks/squizNodeJson.mock.ts +270 -0
- package/src/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.spec.ts +1058 -0
- package/src/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.ts +297 -0
- package/src/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.spec.ts +878 -0
- package/src/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.ts +221 -0
- package/src/utils/createToolbarPositioner.ts +128 -0
- package/src/utils/getCursorRect.ts +5 -0
- package/src/utils/getMarkNamesByGroup.spec.ts +20 -0
- package/src/utils/getMarkNamesByGroup.ts +7 -0
- package/src/utils/getNodeNamesByGroup.spec.ts +37 -0
- package/src/utils/getNodeNamesByGroup.ts +7 -0
- package/src/utils/getShortcutSymbol.spec.ts +27 -0
- package/src/utils/getShortcutSymbol.ts +4 -0
- package/src/utils/undefinedIfEmpty.spec.ts +12 -0
- package/src/utils/undefinedIfEmpty.ts +3 -0
- package/src/utils/validation.spec.ts +22 -0
- package/src/utils/validation.ts +16 -0
- package/tailwind.config.cjs +87 -0
- package/tests/index.ts +4 -0
- package/tests/mockResourceBrowserContext.tsx +99 -0
- package/tests/renderWithContext.tsx +75 -0
- package/tests/renderWithEditor.tsx +123 -0
- package/tests/select.ts +16 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +27 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.FetchUrlExtension = void 0;
|
10
|
+
const core_1 = require("@remirror/core");
|
11
|
+
const Extensions_1 = require("../Extensions");
|
12
|
+
let FetchUrlExtension = class FetchUrlExtension extends core_1.PlainExtension {
|
13
|
+
get name() {
|
14
|
+
return 'fetchUrl';
|
15
|
+
}
|
16
|
+
// Implement the `onView` lifecycle method to scan for `[fetch]` and replace attributes
|
17
|
+
onView(view) {
|
18
|
+
const { state } = view;
|
19
|
+
const { tr } = state;
|
20
|
+
const promises = [];
|
21
|
+
state.doc.descendants((node, pos) => {
|
22
|
+
if (node.type.name === Extensions_1.NodeName.AssetImage && node.attrs.src === '') {
|
23
|
+
promises.push(this.fetchAndReplace(node.attrs, (url) => {
|
24
|
+
const newNode = state.schema.nodes[Extensions_1.NodeName.AssetImage].create({ ...node.attrs, src: url });
|
25
|
+
tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
26
|
+
}));
|
27
|
+
}
|
28
|
+
const assetLinkMark = this.findAssetLinkMark(node.marks);
|
29
|
+
if (node.type.name === 'text' && assetLinkMark) {
|
30
|
+
promises.push(this.fetchAndReplace(assetLinkMark.attrs, (url) => {
|
31
|
+
const updatedMark = assetLinkMark.type.create({ ...assetLinkMark.attrs, href: url });
|
32
|
+
tr.addMark(pos, pos + node.nodeSize, updatedMark);
|
33
|
+
}));
|
34
|
+
}
|
35
|
+
});
|
36
|
+
if (promises.length) {
|
37
|
+
Promise.all(promises).then(() => {
|
38
|
+
view.dispatch(tr);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}
|
42
|
+
findAssetLinkMark(marks) {
|
43
|
+
return marks.find((mark) => mark.type.name === Extensions_1.MarkName.AssetLink && mark.attrs.href === '');
|
44
|
+
}
|
45
|
+
fetchAndReplace(nodeAttrs, onFetched) {
|
46
|
+
return this.options
|
47
|
+
.fetchUrl(nodeAttrs)
|
48
|
+
.then((url) => {
|
49
|
+
onFetched(url);
|
50
|
+
})
|
51
|
+
.catch((error) => {
|
52
|
+
console.error('Error fetching URL:', error);
|
53
|
+
});
|
54
|
+
}
|
55
|
+
};
|
56
|
+
FetchUrlExtension = __decorate([
|
57
|
+
(0, core_1.extension)({
|
58
|
+
defaultOptions: {
|
59
|
+
fetchUrl: () => Promise.resolve(''),
|
60
|
+
},
|
61
|
+
})
|
62
|
+
], FetchUrlExtension);
|
63
|
+
exports.FetchUrlExtension = FetchUrlExtension;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ApplySchemaAttributes, NodeExtension, NodeExtensionSpec, NodeSpecOverride, CommandFunction } from '@remirror/core';
|
2
|
+
import { NodeName } from '../Extensions';
|
3
|
+
export type AssetImageOptions = {
|
4
|
+
matrixDomain?: string;
|
5
|
+
};
|
6
|
+
export type AssetImageAttributes = {
|
7
|
+
matrixAssetId: string;
|
8
|
+
matrixIdentifier: string;
|
9
|
+
matrixDomain: string;
|
10
|
+
url: string;
|
11
|
+
};
|
12
|
+
export declare class AssetImageExtension extends NodeExtension<AssetImageOptions> {
|
13
|
+
get name(): NodeName.AssetImage;
|
14
|
+
createTags(): ("inline" | "media")[];
|
15
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
16
|
+
insertAssetImage(attrs: AssetImageAttributes): CommandFunction;
|
17
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.AssetImageExtension = void 0;
|
10
|
+
const core_1 = require("@remirror/core");
|
11
|
+
const remirror_1 = require("remirror");
|
12
|
+
const Extensions_1 = require("../Extensions");
|
13
|
+
let AssetImageExtension = class AssetImageExtension extends core_1.NodeExtension {
|
14
|
+
get name() {
|
15
|
+
return Extensions_1.NodeName.AssetImage;
|
16
|
+
}
|
17
|
+
createTags() {
|
18
|
+
return [core_1.ExtensionTag.InlineNode, core_1.ExtensionTag.Media];
|
19
|
+
}
|
20
|
+
createNodeSpec(extra, override) {
|
21
|
+
return {
|
22
|
+
inline: true,
|
23
|
+
draggable: true,
|
24
|
+
selectable: true,
|
25
|
+
...override,
|
26
|
+
attrs: {
|
27
|
+
...extra.defaults(),
|
28
|
+
matrixAssetId: {},
|
29
|
+
matrixIdentifier: {},
|
30
|
+
matrixDomain: { default: this.options.matrixDomain },
|
31
|
+
src: { default: '' },
|
32
|
+
},
|
33
|
+
parseDOM: [
|
34
|
+
{
|
35
|
+
tag: 'img[data-matrix-asset-id]',
|
36
|
+
getAttrs: (node) => {
|
37
|
+
if (!(0, core_1.isElementDomNode)(node)) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
const matrixAssetId = node.getAttribute('data-matrix-asset-id');
|
41
|
+
const matrixIdentifier = node.getAttribute('data-matrix-identifier');
|
42
|
+
const matrixDomain = node.getAttribute('data-matrix-domain');
|
43
|
+
if (!matrixAssetId || !matrixIdentifier || !matrixDomain) {
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
return {
|
47
|
+
...extra.parse(node),
|
48
|
+
matrixAssetId,
|
49
|
+
matrixIdentifier,
|
50
|
+
matrixDomain,
|
51
|
+
};
|
52
|
+
},
|
53
|
+
},
|
54
|
+
],
|
55
|
+
toDOM: (node) => {
|
56
|
+
const { matrixAssetId, matrixIdentifier, matrixDomain, src, ...rest } = (0, core_1.omitExtraAttributes)(node.attrs, extra);
|
57
|
+
return [
|
58
|
+
'img',
|
59
|
+
{
|
60
|
+
...extra.dom(node),
|
61
|
+
...rest,
|
62
|
+
src,
|
63
|
+
'data-matrix-asset-id': matrixAssetId,
|
64
|
+
'data-matrix-identifier': matrixIdentifier,
|
65
|
+
'data-matrix-domain': matrixDomain,
|
66
|
+
},
|
67
|
+
];
|
68
|
+
},
|
69
|
+
};
|
70
|
+
}
|
71
|
+
insertAssetImage(attrs) {
|
72
|
+
return ({ tr, dispatch }) => {
|
73
|
+
const { from, to } = (0, remirror_1.getTextSelection)(tr.selection, tr.doc);
|
74
|
+
const node = this.type.create({ ...attrs, src: attrs.url });
|
75
|
+
dispatch?.(tr.replaceRangeWith(from, to, node));
|
76
|
+
return true;
|
77
|
+
};
|
78
|
+
}
|
79
|
+
};
|
80
|
+
__decorate([
|
81
|
+
(0, core_1.command)()
|
82
|
+
], AssetImageExtension.prototype, "insertAssetImage", null);
|
83
|
+
AssetImageExtension = __decorate([
|
84
|
+
(0, core_1.extension)({
|
85
|
+
defaultOptions: {
|
86
|
+
matrixDomain: '',
|
87
|
+
},
|
88
|
+
defaultPriority: core_1.ExtensionPriority.High,
|
89
|
+
})
|
90
|
+
], AssetImageExtension);
|
91
|
+
exports.AssetImageExtension = AssetImageExtension;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { ImageExtension as RemirrorImageExtension } from 'remirror/extensions';
|
2
|
+
import { PasteRule } from 'prosemirror-paste-rules';
|
3
|
+
import { ApplySchemaAttributes, NodeSpecOverride, NodeExtensionSpec } from '@remirror/core';
|
4
|
+
export declare class ImageExtension extends RemirrorImageExtension {
|
5
|
+
createPasteRules(): PasteRule[];
|
6
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
7
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ImageExtension = void 0;
|
4
|
+
const extensions_1 = require("remirror/extensions");
|
5
|
+
class ImageExtension extends extensions_1.ImageExtension {
|
6
|
+
createPasteRules() {
|
7
|
+
// override super behaviour of handling file uploads.
|
8
|
+
return [];
|
9
|
+
}
|
10
|
+
createNodeSpec(extra, override) {
|
11
|
+
const spec = super.createNodeSpec(extra, override);
|
12
|
+
return {
|
13
|
+
...spec,
|
14
|
+
selectable: true,
|
15
|
+
};
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.ImageExtension = ImageExtension;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { ApplySchemaAttributes, FromToProps, MarkExtensionSpec, MarkSpecOverride } from 'remirror';
|
2
|
+
import { CommandFunction, MarkExtension } from '@remirror/core';
|
3
|
+
import { LinkTarget } from './common';
|
4
|
+
export type AssetLinkAttributes = {
|
5
|
+
matrixAssetId: string;
|
6
|
+
matrixIdentifier: string;
|
7
|
+
matrixDomain: string;
|
8
|
+
target: LinkTarget;
|
9
|
+
href: string;
|
10
|
+
url: string;
|
11
|
+
};
|
12
|
+
export type AssetLinkOptions = {
|
13
|
+
matrixDomain?: string;
|
14
|
+
defaultTarget?: LinkTarget;
|
15
|
+
supportedTargets?: LinkTarget[];
|
16
|
+
};
|
17
|
+
export type UpdateAssetLinkProps = {
|
18
|
+
text: string;
|
19
|
+
attrs: Partial<AssetLinkAttributes>;
|
20
|
+
range: FromToProps;
|
21
|
+
};
|
22
|
+
export declare class AssetLinkExtension extends MarkExtension<AssetLinkOptions> {
|
23
|
+
get name(): string;
|
24
|
+
createMarkSpec(extra: ApplySchemaAttributes, override: MarkSpecOverride): MarkExtensionSpec;
|
25
|
+
updateAssetLink({ text, attrs, range }: UpdateAssetLinkProps): CommandFunction;
|
26
|
+
removeAssetLink(): CommandFunction;
|
27
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.AssetLinkExtension = void 0;
|
10
|
+
const remirror_1 = require("remirror");
|
11
|
+
const core_1 = require("@remirror/core");
|
12
|
+
const common_1 = require("./common");
|
13
|
+
const CommandsExtension_1 = require("../CommandsExtension/CommandsExtension");
|
14
|
+
const Extensions_1 = require("../Extensions");
|
15
|
+
let AssetLinkExtension = class AssetLinkExtension extends core_1.MarkExtension {
|
16
|
+
get name() {
|
17
|
+
return Extensions_1.MarkName.AssetLink;
|
18
|
+
}
|
19
|
+
createMarkSpec(extra, override) {
|
20
|
+
return {
|
21
|
+
inclusive: false,
|
22
|
+
excludes: [this.name, Extensions_1.MarkName.Link].join(' '),
|
23
|
+
...override,
|
24
|
+
attrs: {
|
25
|
+
...extra.defaults(),
|
26
|
+
matrixAssetId: {},
|
27
|
+
matrixIdentifier: {},
|
28
|
+
href: { default: '' },
|
29
|
+
matrixDomain: { default: this.options.matrixDomain },
|
30
|
+
target: { default: this.options.defaultTarget },
|
31
|
+
},
|
32
|
+
parseDOM: [
|
33
|
+
{
|
34
|
+
tag: 'a[data-matrix-asset-id]',
|
35
|
+
getAttrs: (node) => {
|
36
|
+
if (!(0, remirror_1.isElementDomNode)(node)) {
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
const matrixAssetId = node.getAttribute('data-matrix-asset-id');
|
40
|
+
const matrixIdentifier = node.getAttribute('data-matrix-identifier');
|
41
|
+
const matrixDomain = node.getAttribute('data-matrix-domain');
|
42
|
+
if (!matrixAssetId || !matrixIdentifier || !matrixDomain) {
|
43
|
+
return false;
|
44
|
+
}
|
45
|
+
return {
|
46
|
+
...extra.parse(node),
|
47
|
+
matrixAssetId,
|
48
|
+
matrixIdentifier,
|
49
|
+
matrixDomain,
|
50
|
+
target: (0, common_1.validateTarget)(node.getAttribute('target'), this.options.supportedTargets, this.options.defaultTarget),
|
51
|
+
};
|
52
|
+
},
|
53
|
+
},
|
54
|
+
],
|
55
|
+
toDOM: (node) => {
|
56
|
+
const { matrixAssetId, matrixIdentifier, matrixDomain, target, href, ...rest } = (0, core_1.omitExtraAttributes)(node.attrs, extra);
|
57
|
+
const rel = 'noopener noreferrer nofollow';
|
58
|
+
const attrs = {
|
59
|
+
...extra.dom(node),
|
60
|
+
...rest,
|
61
|
+
rel,
|
62
|
+
href,
|
63
|
+
target: (0, common_1.validateTarget)(target, this.options.supportedTargets, this.options.defaultTarget),
|
64
|
+
'data-matrix-asset-id': matrixAssetId,
|
65
|
+
'data-matrix-identifier': matrixIdentifier,
|
66
|
+
'data-matrix-domain': matrixDomain,
|
67
|
+
};
|
68
|
+
return ['a', attrs, 0];
|
69
|
+
},
|
70
|
+
};
|
71
|
+
}
|
72
|
+
updateAssetLink({ text, attrs, range }) {
|
73
|
+
return this.store.getExtension(CommandsExtension_1.CommandsExtension).updateMark({
|
74
|
+
attrs: { ...attrs, href: attrs.url },
|
75
|
+
text,
|
76
|
+
range,
|
77
|
+
mark: this.type,
|
78
|
+
removeMark: !attrs.matrixAssetId,
|
79
|
+
});
|
80
|
+
}
|
81
|
+
removeAssetLink() {
|
82
|
+
return (0, core_1.removeMark)({ type: this.type });
|
83
|
+
}
|
84
|
+
};
|
85
|
+
__decorate([
|
86
|
+
(0, core_1.command)()
|
87
|
+
], AssetLinkExtension.prototype, "updateAssetLink", null);
|
88
|
+
__decorate([
|
89
|
+
(0, core_1.command)()
|
90
|
+
], AssetLinkExtension.prototype, "removeAssetLink", null);
|
91
|
+
AssetLinkExtension = __decorate([
|
92
|
+
(0, core_1.extension)({
|
93
|
+
defaultOptions: {
|
94
|
+
matrixDomain: '',
|
95
|
+
defaultTarget: common_1.LinkTarget.Self,
|
96
|
+
supportedTargets: [common_1.LinkTarget.Self, common_1.LinkTarget.Blank],
|
97
|
+
},
|
98
|
+
defaultPriority: remirror_1.ExtensionPriority.High,
|
99
|
+
})
|
100
|
+
], AssetLinkExtension);
|
101
|
+
exports.AssetLinkExtension = AssetLinkExtension;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { ApplySchemaAttributes, FromToProps, MarkExtensionSpec, MarkSpecOverride } from 'remirror';
|
2
|
+
import { CommandFunction, MarkExtension } from '@remirror/core';
|
3
|
+
import { LinkTarget } from './common';
|
4
|
+
export type LinkAttributes = {
|
5
|
+
href: string;
|
6
|
+
title?: string;
|
7
|
+
target: LinkTarget;
|
8
|
+
};
|
9
|
+
export type LinkOptions = {
|
10
|
+
defaultTarget?: LinkTarget;
|
11
|
+
supportedTargets?: LinkTarget[];
|
12
|
+
};
|
13
|
+
export type UpdateLinkProps = {
|
14
|
+
text: string;
|
15
|
+
attrs: Partial<LinkAttributes>;
|
16
|
+
range: FromToProps;
|
17
|
+
};
|
18
|
+
export declare class LinkExtension extends MarkExtension<LinkOptions> {
|
19
|
+
get name(): string;
|
20
|
+
createMarkSpec(extra: ApplySchemaAttributes, override: MarkSpecOverride): MarkExtensionSpec;
|
21
|
+
updateLink({ text, attrs, range }: UpdateLinkProps): CommandFunction;
|
22
|
+
removeLink(): CommandFunction;
|
23
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.LinkExtension = void 0;
|
10
|
+
const remirror_1 = require("remirror");
|
11
|
+
const core_1 = require("@remirror/core");
|
12
|
+
const common_1 = require("./common");
|
13
|
+
const CommandsExtension_1 = require("../CommandsExtension/CommandsExtension");
|
14
|
+
const Extensions_1 = require("../Extensions");
|
15
|
+
let LinkExtension = class LinkExtension extends core_1.MarkExtension {
|
16
|
+
get name() {
|
17
|
+
return Extensions_1.MarkName.Link;
|
18
|
+
}
|
19
|
+
createMarkSpec(extra, override) {
|
20
|
+
return {
|
21
|
+
inclusive: false,
|
22
|
+
excludes: [this.name, Extensions_1.MarkName.AssetLink].join(' '),
|
23
|
+
...override,
|
24
|
+
attrs: {
|
25
|
+
...extra.defaults(),
|
26
|
+
href: {},
|
27
|
+
title: { default: undefined },
|
28
|
+
target: { default: this.options.defaultTarget },
|
29
|
+
},
|
30
|
+
parseDOM: [
|
31
|
+
{
|
32
|
+
tag: 'a[href]',
|
33
|
+
getAttrs: (node) => {
|
34
|
+
if (!(0, remirror_1.isElementDomNode)(node)) {
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
return {
|
38
|
+
...extra.parse(node),
|
39
|
+
href: node.getAttribute('href'),
|
40
|
+
title: node.getAttribute('title'),
|
41
|
+
target: (0, common_1.validateTarget)(node.getAttribute('target'), this.options.supportedTargets, this.options.defaultTarget),
|
42
|
+
};
|
43
|
+
},
|
44
|
+
},
|
45
|
+
],
|
46
|
+
toDOM: (node) => {
|
47
|
+
const { target, ...rest } = (0, core_1.omitExtraAttributes)(node.attrs, extra);
|
48
|
+
const rel = 'noopener noreferrer nofollow';
|
49
|
+
const attrs = {
|
50
|
+
...extra.dom(node),
|
51
|
+
...rest,
|
52
|
+
rel,
|
53
|
+
target: (0, common_1.validateTarget)(target, this.options.supportedTargets, this.options.defaultTarget),
|
54
|
+
};
|
55
|
+
return ['a', attrs, 0];
|
56
|
+
},
|
57
|
+
};
|
58
|
+
}
|
59
|
+
updateLink({ text, attrs, range }) {
|
60
|
+
return this.store.getExtension(CommandsExtension_1.CommandsExtension).updateMark({
|
61
|
+
attrs,
|
62
|
+
text,
|
63
|
+
range,
|
64
|
+
mark: this.type,
|
65
|
+
removeMark: !attrs.href,
|
66
|
+
});
|
67
|
+
}
|
68
|
+
removeLink() {
|
69
|
+
return (0, core_1.removeMark)({ type: this.type });
|
70
|
+
}
|
71
|
+
};
|
72
|
+
__decorate([
|
73
|
+
(0, core_1.command)()
|
74
|
+
], LinkExtension.prototype, "updateLink", null);
|
75
|
+
__decorate([
|
76
|
+
(0, core_1.command)()
|
77
|
+
], LinkExtension.prototype, "removeLink", null);
|
78
|
+
LinkExtension = __decorate([
|
79
|
+
(0, core_1.extension)({
|
80
|
+
defaultOptions: {
|
81
|
+
defaultTarget: common_1.LinkTarget.Self,
|
82
|
+
supportedTargets: [common_1.LinkTarget.Self, common_1.LinkTarget.Blank],
|
83
|
+
},
|
84
|
+
defaultPriority: remirror_1.ExtensionPriority.Medium,
|
85
|
+
})
|
86
|
+
], LinkExtension);
|
87
|
+
exports.LinkExtension = LinkExtension;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validateTarget = exports.LinkTarget = void 0;
|
4
|
+
var LinkTarget;
|
5
|
+
(function (LinkTarget) {
|
6
|
+
LinkTarget["Self"] = "_self";
|
7
|
+
LinkTarget["Blank"] = "_blank";
|
8
|
+
LinkTarget["Parent"] = "_parent";
|
9
|
+
LinkTarget["Top"] = "_top";
|
10
|
+
})(LinkTarget = exports.LinkTarget || (exports.LinkTarget = {}));
|
11
|
+
const validateTarget = (target, supportedTargets, defaultTarget) => {
|
12
|
+
return supportedTargets.includes(target) ? target : defaultTarget;
|
13
|
+
};
|
14
|
+
exports.validateTarget = validateTarget;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { ApplySchemaAttributes, CommandFunction, NodeExtension, NodeExtensionSpec, NodeSpecOverride } from '@remirror/core';
|
2
|
+
import { NodeViewMethod } from 'remirror';
|
3
|
+
export declare class PreformattedExtension extends NodeExtension {
|
4
|
+
get name(): "preformatted";
|
5
|
+
createTags(): ("block" | "formattingNode" | "textBlock")[];
|
6
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
7
|
+
createNodeViews(): NodeViewMethod;
|
8
|
+
/**
|
9
|
+
* Toggle the <pre> for the current block.
|
10
|
+
*/
|
11
|
+
togglePreformatted(): CommandFunction;
|
12
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.PreformattedExtension = void 0;
|
10
|
+
const core_1 = require("@remirror/core");
|
11
|
+
let PreformattedExtension = class PreformattedExtension extends core_1.NodeExtension {
|
12
|
+
get name() {
|
13
|
+
return 'preformatted';
|
14
|
+
}
|
15
|
+
createTags() {
|
16
|
+
return [core_1.ExtensionTag.Block, core_1.ExtensionTag.TextBlock, core_1.ExtensionTag.FormattingNode];
|
17
|
+
}
|
18
|
+
createNodeSpec(extra, override) {
|
19
|
+
return {
|
20
|
+
content: 'inline*',
|
21
|
+
defining: true,
|
22
|
+
draggable: false,
|
23
|
+
...override,
|
24
|
+
attrs: {
|
25
|
+
...extra.defaults(),
|
26
|
+
},
|
27
|
+
parseDOM: [
|
28
|
+
{
|
29
|
+
tag: 'pre',
|
30
|
+
},
|
31
|
+
],
|
32
|
+
toDOM: (node) => {
|
33
|
+
return ['pre', extra.dom(node), 0];
|
34
|
+
},
|
35
|
+
};
|
36
|
+
}
|
37
|
+
createNodeViews() {
|
38
|
+
return (node) => {
|
39
|
+
const { nodeTextAlignment } = node.attrs;
|
40
|
+
// This is the pre container for the code block
|
41
|
+
const dom = document.createElement('div');
|
42
|
+
dom.classList.add(`preformatted`);
|
43
|
+
// This is the actual code content in the code block
|
44
|
+
const contentDOM = document.createElement('pre');
|
45
|
+
contentDOM.setAttribute('data-node-text-align', nodeTextAlignment);
|
46
|
+
contentDOM.setAttribute('style', `text-align:${nodeTextAlignment}`);
|
47
|
+
// Divider between code block and pre container
|
48
|
+
const dividerElement = document.createElement('div');
|
49
|
+
dividerElement.classList.add('block-divider');
|
50
|
+
// The material icon to use
|
51
|
+
const codeIcon = document.createElement('svg');
|
52
|
+
codeIcon.classList.add('material-symbols-rounded');
|
53
|
+
codeIcon.textContent = 'short_text';
|
54
|
+
dom.append(codeIcon);
|
55
|
+
dom.append(dividerElement);
|
56
|
+
dom.append(contentDOM);
|
57
|
+
return { dom, contentDOM };
|
58
|
+
};
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Toggle the <pre> for the current block.
|
62
|
+
*/
|
63
|
+
togglePreformatted() {
|
64
|
+
return (0, core_1.toggleBlockItem)({
|
65
|
+
type: this.type,
|
66
|
+
toggleType: 'paragraph',
|
67
|
+
});
|
68
|
+
}
|
69
|
+
};
|
70
|
+
__decorate([
|
71
|
+
(0, core_1.command)()
|
72
|
+
], PreformattedExtension.prototype, "togglePreformatted", null);
|
73
|
+
PreformattedExtension = __decorate([
|
74
|
+
(0, core_1.extension)({})
|
75
|
+
], PreformattedExtension);
|
76
|
+
exports.PreformattedExtension = PreformattedExtension;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ApplySchemaAttributes, NodeExtension, NodeExtensionSpec, NodeSpecOverride } from '@remirror/core';
|
2
|
+
import { NodeName } from '../Extensions';
|
3
|
+
import { ComponentType } from 'react';
|
4
|
+
import { NodeViewComponentProps } from '@remirror/react';
|
5
|
+
export declare class UnsupportedNodeExtension extends NodeExtension {
|
6
|
+
get name(): NodeName.Unsupported;
|
7
|
+
ReactComponent: ComponentType<NodeViewComponentProps>;
|
8
|
+
createTags(): "inline"[];
|
9
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
10
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.UnsupportedNodeExtension = void 0;
|
13
|
+
const core_1 = require("@remirror/core");
|
14
|
+
const Extensions_1 = require("../Extensions");
|
15
|
+
const CollapseBox_1 = __importDefault(require("../../ui/CollapseBox/CollapseBox"));
|
16
|
+
let UnsupportedNodeExtension = class UnsupportedNodeExtension extends core_1.NodeExtension {
|
17
|
+
get name() {
|
18
|
+
return Extensions_1.NodeName.Unsupported;
|
19
|
+
}
|
20
|
+
ReactComponent = CollapseBox_1.default;
|
21
|
+
createTags() {
|
22
|
+
return [core_1.ExtensionTag.InlineNode];
|
23
|
+
}
|
24
|
+
createNodeSpec(extra, override) {
|
25
|
+
return {
|
26
|
+
selectable: false,
|
27
|
+
draggable: false,
|
28
|
+
atom: true,
|
29
|
+
inline: true,
|
30
|
+
...override,
|
31
|
+
attrs: {
|
32
|
+
...extra.defaults(),
|
33
|
+
originalNode: {},
|
34
|
+
errorMessage: {},
|
35
|
+
},
|
36
|
+
parseDOM: [
|
37
|
+
{
|
38
|
+
tag: `[data-unsupported-node]`,
|
39
|
+
getAttrs: (node) => {
|
40
|
+
if (!(0, core_1.isElementDomNode)(node)) {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
const unsupportedNodes = node.getAttribute('data-unsupported-node');
|
44
|
+
try {
|
45
|
+
const decodedNodes = JSON.parse(unsupportedNodes);
|
46
|
+
return {
|
47
|
+
...extra.parse(node),
|
48
|
+
originalNode: decodedNodes?.originalNode,
|
49
|
+
errorMessage: decodedNodes?.errorMessage,
|
50
|
+
};
|
51
|
+
}
|
52
|
+
catch (error) {
|
53
|
+
console.error('Failed to parse Remirror nodes from data-unsupported-node', error);
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
},
|
57
|
+
},
|
58
|
+
],
|
59
|
+
toDOM: (node) => {
|
60
|
+
const { originalNode, errorMessage, ...rest } = (0, core_1.omitExtraAttributes)(node.attrs, extra);
|
61
|
+
const attrs = {
|
62
|
+
...extra.dom(node),
|
63
|
+
...rest,
|
64
|
+
originalNode,
|
65
|
+
errorMessage,
|
66
|
+
'data-unsupported-node': JSON.stringify({ originalNode, errorMessage }),
|
67
|
+
};
|
68
|
+
return ['div', attrs];
|
69
|
+
},
|
70
|
+
};
|
71
|
+
}
|
72
|
+
};
|
73
|
+
UnsupportedNodeExtension = __decorate([
|
74
|
+
(0, core_1.extension)({})
|
75
|
+
], UnsupportedNodeExtension);
|
76
|
+
exports.UnsupportedNodeExtension = UnsupportedNodeExtension;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./useExtensionNames"), exports);
|
18
|
+
__exportStar(require("./useExpandedSelection"), exports);
|