@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
package/.eslintrc.json
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"env": {
|
3
|
+
"jest/globals": true,
|
4
|
+
"cypress/globals": true
|
5
|
+
},
|
6
|
+
"plugins": ["cypress"],
|
7
|
+
"extends": [
|
8
|
+
"plugin:react/recommended",
|
9
|
+
"plugin:jsx-a11y/recommended",
|
10
|
+
"plugin:cypress/recommended",
|
11
|
+
"plugin:jest/style",
|
12
|
+
"plugin:jest/recommended"
|
13
|
+
],
|
14
|
+
"overrides": [
|
15
|
+
{
|
16
|
+
// Cypress use different assertion methods. Don't validate that tests have assertions.
|
17
|
+
"files": ["**/*.spec.cy.ts"],
|
18
|
+
"rules": { "jest/expect-expect": "off" }
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"settings": {
|
22
|
+
"react": {
|
23
|
+
// Tells eslint-plugin-react to automatically detect the version of React to use.
|
24
|
+
"version": "detect"
|
25
|
+
},
|
26
|
+
// Tells eslint how to resolve imports
|
27
|
+
"import/resolver": {
|
28
|
+
"node": {
|
29
|
+
"paths": ["src"],
|
30
|
+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"rules": {
|
35
|
+
// The rules below are listed in the order they appear on the eslint-plugin-react rules page.
|
36
|
+
|
37
|
+
// React
|
38
|
+
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
39
|
+
"react/button-has-type": "error"
|
40
|
+
}
|
41
|
+
}
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.0.0-rbv2-20240530041851
|
4
|
+
|
5
|
+
### Major Changes
|
6
|
+
|
7
|
+
- f7279c6: Migration to resource-browser 2.x.x and use of plugin model. Alterations to data fetching for url resolution for FTE due to changes in RB2.
|
8
|
+
|
9
|
+
Breaking change: change to resource-browser 2.x.x requires a different context wrapper to version 1.x.x which the component editing ui and the formatted text editor relies upon to render the resource picker when selecting a resource; making the internal update to RB2 incompatible with 1.x.x usages of these packages.
|
10
|
+
|
11
|
+
This change was made to expand the support the resource browser had for data sources other than Matrix.
|
12
|
+
|
13
|
+
Consumers need to update usages of ResourceBrowserContext.provider with ResourceBrowserContextProvider and provide plugins e.g. @squiz/matrix-resource-browser-plugin or @squiz/dam-resource-browser-plugin to the context interface. Consumers also need to provide a new url fetcher to the FTE EditorContext.Provider `resolveNodeToUrl` to resolve MatrixAsset nodes to a url form; previously this relied upon exposed parts of the ResourceBrowser which are no longer exposed outside the RB itself.
|
14
|
+
|
15
|
+
## 1.71.0
|
16
|
+
|
17
|
+
### Minor Changes
|
18
|
+
|
19
|
+
- 882fb82: Added table transormation support between Squiz & Remirror models (allowing saving of tables)
|
20
|
+
|
21
|
+
## 1.70.0
|
22
|
+
|
23
|
+
### Minor Changes
|
24
|
+
|
25
|
+
- 0513957: `enableTableTool` prop added to the Editor to control the display of the table insertion tool until we are ready to release it
|
26
|
+
|
27
|
+
## 1.69.0
|
28
|
+
|
29
|
+
### Minor Changes
|
30
|
+
|
31
|
+
- 6b8b464: Added support for SHIFT + ENTER line breaks to FTE
|
32
|
+
|
33
|
+
## 1.68.1
|
34
|
+
|
35
|
+
### Patch Changes
|
36
|
+
|
37
|
+
- e2010f7: Fixed pasting into FTE from Microsoft office
|
38
|
+
|
39
|
+
## 1.68.0
|
40
|
+
|
41
|
+
### Minor Changes
|
42
|
+
|
43
|
+
- 4d3dbba: Updated FTE shortcuts to change tooltips depending on OS
|
44
|
+
|
45
|
+
## 1.67.1
|
46
|
+
|
47
|
+
### Patch Changes
|
48
|
+
|
49
|
+
- 928cc88: Made children optional for formatted text nodes/tags
|
50
|
+
- Updated dependencies [928cc88]
|
51
|
+
- @squiz/dx-json-schema-lib@1.65.1
|
52
|
+
|
53
|
+
## 1.67.0
|
54
|
+
|
55
|
+
### Minor Changes
|
56
|
+
|
57
|
+
- 6867717: Changed output of FTE to use semantic HTML where applicable
|
58
|
+
|
59
|
+
## 1.66.4
|
60
|
+
|
61
|
+
### Patch Changes
|
62
|
+
|
63
|
+
- 8421756: Selected image assets in the resource browser will now display the actual image instead of just the image asset icon if they have a URL specified
|
64
|
+
- Updated dependencies [8421756]
|
65
|
+
- @squiz/resource-browser@1.66.3
|
66
|
+
|
67
|
+
## 1.66.3
|
68
|
+
|
69
|
+
### Patch Changes
|
70
|
+
|
71
|
+
- 7234d6c: Fixed FTE popover menu from having unusual positioning in certain circumstances
|
72
|
+
|
73
|
+
## 1.66.2
|
74
|
+
|
75
|
+
### Patch Changes
|
76
|
+
|
77
|
+
- 629a64f: Fixed FTE bubble menu from staying visible when unfocusing from editor
|
78
|
+
|
79
|
+
## 1.66.1
|
80
|
+
|
81
|
+
### Patch Changes
|
82
|
+
|
83
|
+
- e01fd51: Fixed FTE floating toolbar overlap
|
84
|
+
|
85
|
+
## 1.66.0
|
86
|
+
|
87
|
+
### Minor Changes
|
88
|
+
|
89
|
+
- a5b0869: Update fte toolbar to max height 100% so that it can be flexible at any width and position placeholder
|
90
|
+
|
91
|
+
## 1.65.1
|
92
|
+
|
93
|
+
### Patch Changes
|
94
|
+
|
95
|
+
- 402e8b1: Fixed issue where some Remirror text alignment options (eg. start and end) were not correctly transformed to Squiz formatted text structure.
|
96
|
+
|
97
|
+
## 1.65.0
|
98
|
+
|
99
|
+
### Minor Changes
|
100
|
+
|
101
|
+
- e11f4e7: Exported function for transforming HTML to formatted text JSON.
|
102
|
+
|
103
|
+
## 1.64.0
|
104
|
+
|
105
|
+
### Minor Changes
|
106
|
+
|
107
|
+
- ac68ec6: Unpinned Squiz dependencies, they should now be following semver.
|
108
|
+
|
109
|
+
### Patch Changes
|
110
|
+
|
111
|
+
- Updated dependencies [ac68ec6]
|
112
|
+
- @squiz/dx-json-schema-lib@1.65.0
|
113
|
+
- @squiz/resource-browser@1.65.0
|
114
|
+
|
115
|
+
## 1.63.2
|
116
|
+
|
117
|
+
### Patch Changes
|
118
|
+
|
119
|
+
- Updated dependencies [e717e6e]
|
120
|
+
- @squiz/dx-json-schema-lib@1.64.0
|
121
|
+
- @squiz/resource-browser@1.64.1
|
122
|
+
|
123
|
+
## 1.63.1
|
124
|
+
|
125
|
+
### Patch Changes
|
126
|
+
|
127
|
+
- Updated dependencies [e7d4c0f]
|
128
|
+
- @squiz/resource-browser@1.64.0
|
129
|
+
|
130
|
+
All notable changes to this project will be documented in this file.
|
131
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
132
|
+
|
133
|
+
## [1.6.1-alpha.5](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.1-alpha.3...v1.6.1-alpha.5) (2023-02-02)
|
134
|
+
|
135
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
136
|
+
|
137
|
+
## [1.6.1-alpha.4](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.1-alpha.3...v1.6.1-alpha.4) (2023-02-02)
|
138
|
+
|
139
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
140
|
+
|
141
|
+
## [1.6.1-alpha.3](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.1-alpha.2...v1.6.1-alpha.3) (2023-02-02)
|
142
|
+
|
143
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
144
|
+
|
145
|
+
## [1.6.1-alpha.2](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.0...v1.6.1-alpha.2) (2023-02-02)
|
146
|
+
|
147
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
148
|
+
|
149
|
+
## [1.6.1-alpha.1](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.0...v1.6.1-alpha.1) (2023-02-02)
|
150
|
+
|
151
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
152
|
+
|
153
|
+
## [1.6.1-alpha.0](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.6.0...v1.6.1-alpha.0) (2023-02-02)
|
154
|
+
|
155
|
+
**Note:** Version bump only for package @squiz/formatted-text-editor
|
package/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# DXP Formatted text editor component
|
2
|
+
|
3
|
+
This repo contains the necessary code to develop and publish an NPM package for creating formatted text editors for use in Squiz products.
|
4
|
+
|
5
|
+
The formatted text editor is using the [Remirror](https://remirror.io/) React library.
|
6
|
+
|
7
|
+
### Requirements
|
8
|
+
|
9
|
+
- [Volta](https://volta.sh/)
|
10
|
+
- [Node/NPM](https://nodejs.org/en/)
|
11
|
+
|
12
|
+
### Working locally
|
13
|
+
|
14
|
+
Provided you have `Volta` installed as soon as you are in the `formatted-text-editor` directory you should be on the correct Node version.
|
15
|
+
See the `package.json` for the specific version.
|
16
|
+
|
17
|
+
Now run the following commands from the `packages/formatted-text-editor/` directory.
|
18
|
+
|
19
|
+
```sh
|
20
|
+
npm i
|
21
|
+
```
|
22
|
+
|
23
|
+
```sh
|
24
|
+
npm run dev
|
25
|
+
```
|
26
|
+
This will expose `http://localhost:5173/` and this can be viewed in the browser.
|
27
|
+
|
28
|
+
> TIP: Make sure you have already installed the node modules at the root level of the repo.
|
29
|
+
|
30
|
+
## WIP: Contributing
|
31
|
+
|
32
|
+
## Testing
|
33
|
+
|
34
|
+
Tests must be written when contributing to this package. Tests are automatically run in CI and test failure will result in unmerged code.
|
35
|
+
|
36
|
+
### Unit testing
|
37
|
+
|
38
|
+
This package using Jest to perform Unit testing. In addition to Jest we are using a few Testing Library utilities:
|
39
|
+
|
40
|
+
- [React testing library](https://testing-library.com/docs/react-testing-library/intro/) - Enables React component testing
|
41
|
+
- [Jest DOM](https://testing-library.com/docs/ecosystem-jest-dom/) - Enables custom matchers
|
42
|
+
|
43
|
+
Tests should be co-located with componentry and should strive for maximum coverage.
|
44
|
+
|
45
|
+
To run tests locally you can run:
|
46
|
+
```sh
|
47
|
+
npm run test
|
48
|
+
```
|
49
|
+
Or if you'd like to "watch" for changes:
|
50
|
+
```sh
|
51
|
+
npm run test:watch
|
52
|
+
```
|
53
|
+
|
54
|
+
When testing text input in the text editor, it is recommended to use the `<MockEditor />` component, which is a simple wrapper around the Remirror component that provides additional functionality for testing (supplying text into the editor).
|
55
|
+
|
56
|
+
### Test coverage
|
57
|
+
|
58
|
+
Test coverage is enforced globally in this package. You can run the test coverage script from the package root:
|
59
|
+
|
60
|
+
```sh
|
61
|
+
npm run test:coverage
|
62
|
+
```
|
63
|
+
|
64
|
+
Coverage will also run as part of the normal test script. Please see ./jest.config.ts for the currently configured thresholds.
|
65
|
+
|
66
|
+
### End to end testing
|
67
|
+
|
68
|
+
This package uses [Cypress](https://docs.cypress.io/) for end to end testing.
|
69
|
+
|
70
|
+
To run tests locally you can run:
|
71
|
+
```sh
|
72
|
+
npm run test:e2e
|
73
|
+
```
|
74
|
+
Cypress is configured to look at a preview dev environment on `http://localhost:8080`.
|
package/build.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
const esbuild = require('esbuild');
|
2
|
+
const { sassPlugin } = require('esbuild-sass-plugin');
|
3
|
+
const postcss = require('postcss');
|
4
|
+
const postcssConfig = require('./postcss.config').plugins;
|
5
|
+
|
6
|
+
esbuild
|
7
|
+
.build({
|
8
|
+
entryPoints: ['src/index.scss'],
|
9
|
+
bundle: true,
|
10
|
+
outdir: 'lib',
|
11
|
+
plugins: [
|
12
|
+
sassPlugin({
|
13
|
+
type: 'css',
|
14
|
+
transform: async (source) => {
|
15
|
+
const { css } = postcss(postcssConfig).process(source);
|
16
|
+
return css;
|
17
|
+
},
|
18
|
+
}),
|
19
|
+
],
|
20
|
+
})
|
21
|
+
.catch(() => process.exit(1));
|