@dextinity/admin-rte 2.0.0-canary-20260729062014
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/lib/core/BlockElement.d.ts +29 -0
- package/lib/core/BlockElement.d.ts.map +1 -0
- package/lib/core/BlockElement.js +43 -0
- package/lib/core/Controls/BlockTypesControls.d.ts +16 -0
- package/lib/core/Controls/BlockTypesControls.d.ts.map +1 -0
- package/lib/core/Controls/BlockTypesControls.js +91 -0
- package/lib/core/Controls/ControlButton.d.ts +28 -0
- package/lib/core/Controls/ControlButton.d.ts.map +1 -0
- package/lib/core/Controls/ControlButton.js +62 -0
- package/lib/core/Controls/Controls.d.ts +3 -0
- package/lib/core/Controls/Controls.d.ts.map +1 -0
- package/lib/core/Controls/Controls.js +30 -0
- package/lib/core/Controls/CustomControls.d.ts +3 -0
- package/lib/core/Controls/CustomControls.d.ts.map +1 -0
- package/lib/core/Controls/CustomControls.js +20 -0
- package/lib/core/Controls/FeaturesButtonGroup.d.ts +30 -0
- package/lib/core/Controls/FeaturesButtonGroup.d.ts.map +1 -0
- package/lib/core/Controls/FeaturesButtonGroup.js +147 -0
- package/lib/core/Controls/HistoryContols.d.ts +3 -0
- package/lib/core/Controls/HistoryContols.d.ts.map +1 -0
- package/lib/core/Controls/HistoryContols.js +24 -0
- package/lib/core/Controls/InlineStyleTypeControls.d.ts +3 -0
- package/lib/core/Controls/InlineStyleTypeControls.d.ts.map +1 -0
- package/lib/core/Controls/InlineStyleTypeControls.js +29 -0
- package/lib/core/Controls/LinkControls.d.ts +26 -0
- package/lib/core/Controls/LinkControls.d.ts.map +1 -0
- package/lib/core/Controls/LinkControls.js +54 -0
- package/lib/core/Controls/ListsControls.d.ts +3 -0
- package/lib/core/Controls/ListsControls.d.ts.map +1 -0
- package/lib/core/Controls/ListsControls.js +30 -0
- package/lib/core/Controls/ListsIndentControls.d.ts +3 -0
- package/lib/core/Controls/ListsIndentControls.d.ts.map +1 -0
- package/lib/core/Controls/ListsIndentControls.js +27 -0
- package/lib/core/Controls/SpecialCharactersControls.d.ts +4 -0
- package/lib/core/Controls/SpecialCharactersControls.d.ts.map +1 -0
- package/lib/core/Controls/SpecialCharactersControls.js +20 -0
- package/lib/core/Controls/Toolbar/Toolbar.d.ts +28 -0
- package/lib/core/Controls/Toolbar/Toolbar.d.ts.map +1 -0
- package/lib/core/Controls/Toolbar/Toolbar.js +41 -0
- package/lib/core/Controls/Toolbar/Toolbar.styles.d.ts +14 -0
- package/lib/core/Controls/Toolbar/Toolbar.styles.d.ts.map +1 -0
- package/lib/core/Controls/Toolbar/Toolbar.styles.js +21 -0
- package/lib/core/Controls/TranslationControls.d.ts +4 -0
- package/lib/core/Controls/TranslationControls.d.ts.map +1 -0
- package/lib/core/Controls/TranslationControls.js +20 -0
- package/lib/core/Controls/useBlockTypes.d.ts +23 -0
- package/lib/core/Controls/useBlockTypes.d.ts.map +1 -0
- package/lib/core/Controls/useBlockTypes.js +116 -0
- package/lib/core/Controls/useHistory.d.ts +13 -0
- package/lib/core/Controls/useHistory.d.ts.map +1 -0
- package/lib/core/Controls/useHistory.js +63 -0
- package/lib/core/Controls/useInlineStyleType.d.ts +16 -0
- package/lib/core/Controls/useInlineStyleType.d.ts.map +1 -0
- package/lib/core/Controls/useInlineStyleType.js +148 -0
- package/lib/core/Controls/useListIndent.d.ts +14 -0
- package/lib/core/Controls/useListIndent.d.ts.map +1 -0
- package/lib/core/Controls/useListIndent.js +114 -0
- package/lib/core/Rte.d.ts +72 -0
- package/lib/core/Rte.d.ts.map +1 -0
- package/lib/core/Rte.js +256 -0
- package/lib/core/RteReadOnly.d.ts +19 -0
- package/lib/core/RteReadOnly.d.ts.map +1 -0
- package/lib/core/RteReadOnly.js +62 -0
- package/lib/core/defaultBlocktypeMap.d.ts +6 -0
- package/lib/core/defaultBlocktypeMap.d.ts.map +1 -0
- package/lib/core/defaultBlocktypeMap.js +235 -0
- package/lib/core/extension/Link/Decorator.d.ts +5 -0
- package/lib/core/extension/Link/Decorator.d.ts.map +1 -0
- package/lib/core/extension/Link/Decorator.js +13 -0
- package/lib/core/extension/Link/EditorComponent.d.ts +12 -0
- package/lib/core/extension/Link/EditorComponent.d.ts.map +1 -0
- package/lib/core/extension/Link/EditorComponent.js +14 -0
- package/lib/core/extension/Link/ToolbarButton.d.ts +3 -0
- package/lib/core/extension/Link/ToolbarButton.d.ts.map +1 -0
- package/lib/core/extension/Link/ToolbarButton.js +162 -0
- package/lib/core/extension/LinksRemove/ToolbarButton.d.ts +3 -0
- package/lib/core/extension/LinksRemove/ToolbarButton.d.ts.map +1 -0
- package/lib/core/extension/LinksRemove/ToolbarButton.js +20 -0
- package/lib/core/extension/NonBreakingSpace/Decorator.d.ts +4 -0
- package/lib/core/extension/NonBreakingSpace/Decorator.d.ts.map +1 -0
- package/lib/core/extension/NonBreakingSpace/Decorator.js +17 -0
- package/lib/core/extension/NonBreakingSpace/EditorComponent.d.ts +9 -0
- package/lib/core/extension/NonBreakingSpace/EditorComponent.d.ts.map +1 -0
- package/lib/core/extension/NonBreakingSpace/EditorComponent.js +37 -0
- package/lib/core/extension/NonBreakingSpace/ToolbarButton.d.ts +4 -0
- package/lib/core/extension/NonBreakingSpace/ToolbarButton.d.ts.map +1 -0
- package/lib/core/extension/NonBreakingSpace/ToolbarButton.js +42 -0
- package/lib/core/extension/SoftHyphen/Decorator.d.ts +4 -0
- package/lib/core/extension/SoftHyphen/Decorator.d.ts.map +1 -0
- package/lib/core/extension/SoftHyphen/Decorator.js +17 -0
- package/lib/core/extension/SoftHyphen/EditorComponent.d.ts +9 -0
- package/lib/core/extension/SoftHyphen/EditorComponent.d.ts.map +1 -0
- package/lib/core/extension/SoftHyphen/EditorComponent.js +24 -0
- package/lib/core/extension/SoftHyphen/ToolbarButton.d.ts +3 -0
- package/lib/core/extension/SoftHyphen/ToolbarButton.d.ts.map +1 -0
- package/lib/core/extension/SoftHyphen/ToolbarButton.js +35 -0
- package/lib/core/filterEditor/composeFilterEditorFns.d.ts +4 -0
- package/lib/core/filterEditor/composeFilterEditorFns.d.ts.map +1 -0
- package/lib/core/filterEditor/composeFilterEditorFns.js +8 -0
- package/lib/core/filterEditor/default.d.ts +4 -0
- package/lib/core/filterEditor/default.d.ts.map +1 -0
- package/lib/core/filterEditor/default.js +16 -0
- package/lib/core/filterEditor/manageStandardBlockType.d.ts +4 -0
- package/lib/core/filterEditor/manageStandardBlockType.d.ts.map +1 -0
- package/lib/core/filterEditor/manageStandardBlockType.js +16 -0
- package/lib/core/filterEditor/removeBlocksExceedingBlockLimit.d.ts +4 -0
- package/lib/core/filterEditor/removeBlocksExceedingBlockLimit.d.ts.map +1 -0
- package/lib/core/filterEditor/removeBlocksExceedingBlockLimit.js +22 -0
- package/lib/core/filterEditor/removeUnsupportedBlockTypes.d.ts +4 -0
- package/lib/core/filterEditor/removeUnsupportedBlockTypes.d.ts.map +1 -0
- package/lib/core/filterEditor/removeUnsupportedBlockTypes.js +35 -0
- package/lib/core/filterEditor/removeUnsupportedEntities.d.ts +4 -0
- package/lib/core/filterEditor/removeUnsupportedEntities.d.ts.map +1 -0
- package/lib/core/filterEditor/removeUnsupportedEntities.js +18 -0
- package/lib/core/filterEditor/removeUnsupportedInlineStyles.d.ts +4 -0
- package/lib/core/filterEditor/removeUnsupportedInlineStyles.d.ts.map +1 -0
- package/lib/core/filterEditor/removeUnsupportedInlineStyles.js +26 -0
- package/lib/core/filterEditor/removeUnsupportedListLevels.d.ts +4 -0
- package/lib/core/filterEditor/removeUnsupportedListLevels.d.ts.map +1 -0
- package/lib/core/filterEditor/removeUnsupportedListLevels.js +16 -0
- package/lib/core/filterEditor/utils/changeBlockType.d.ts +9 -0
- package/lib/core/filterEditor/utils/changeBlockType.d.ts.map +1 -0
- package/lib/core/filterEditor/utils/changeBlockType.js +37 -0
- package/lib/core/filterEditor/utils/manipulateEntityData.d.ts +6 -0
- package/lib/core/filterEditor/utils/manipulateEntityData.d.ts.map +1 -0
- package/lib/core/filterEditor/utils/manipulateEntityData.js +43 -0
- package/lib/core/filterEditor/utils/removeEntities.d.ts +6 -0
- package/lib/core/filterEditor/utils/removeEntities.d.ts.map +1 -0
- package/lib/core/filterEditor/utils/removeEntities.js +34 -0
- package/lib/core/filterEditor/utils/removeInlineStyles.d.ts +5 -0
- package/lib/core/filterEditor/utils/removeInlineStyles.d.ts.map +1 -0
- package/lib/core/filterEditor/utils/removeInlineStyles.js +28 -0
- package/lib/core/makeRteApi.d.ts +26 -0
- package/lib/core/makeRteApi.d.ts.map +1 -0
- package/lib/core/makeRteApi.js +86 -0
- package/lib/core/translation/EditorStateTranslationDialog.d.ts +11 -0
- package/lib/core/translation/EditorStateTranslationDialog.d.ts.map +1 -0
- package/lib/core/translation/EditorStateTranslationDialog.js +32 -0
- package/lib/core/translation/ToolbarButton.d.ts +4 -0
- package/lib/core/translation/ToolbarButton.d.ts.map +1 -0
- package/lib/core/translation/ToolbarButton.js +98 -0
- package/lib/core/translation/htmlToState.d.ts +9 -0
- package/lib/core/translation/htmlToState.d.ts.map +1 -0
- package/lib/core/translation/htmlToState.js +53 -0
- package/lib/core/translation/htmlToState.spec.d.ts +2 -0
- package/lib/core/translation/htmlToState.spec.d.ts.map +1 -0
- package/lib/core/translation/stateToHtml.d.ts +13 -0
- package/lib/core/translation/stateToHtml.d.ts.map +1 -0
- package/lib/core/translation/stateToHtml.js +60 -0
- package/lib/core/translation/stateToHtml.spec.d.ts +2 -0
- package/lib/core/translation/stateToHtml.spec.d.ts.map +1 -0
- package/lib/core/types.d.ts +64 -0
- package/lib/core/types.d.ts.map +1 -0
- package/lib/core/types.js +1 -0
- package/lib/core/utils/createBlockRenderMap.d.ts +6 -0
- package/lib/core/utils/createBlockRenderMap.d.ts.map +1 -0
- package/lib/core/utils/createBlockRenderMap.js +22 -0
- package/lib/core/utils/findEntityDataInCurrentSelection.d.ts +3 -0
- package/lib/core/utils/findEntityDataInCurrentSelection.d.ts.map +1 -0
- package/lib/core/utils/findEntityDataInCurrentSelection.js +12 -0
- package/lib/core/utils/findEntityInCurrentSelection.d.ts +8 -0
- package/lib/core/utils/findEntityInCurrentSelection.d.ts.map +1 -0
- package/lib/core/utils/findEntityInCurrentSelection.js +81 -0
- package/lib/core/utils/findTextInCurrentSelection.d.ts +3 -0
- package/lib/core/utils/findTextInCurrentSelection.d.ts.map +1 -0
- package/lib/core/utils/findTextInCurrentSelection.js +16 -0
- package/lib/core/utils/getCurrentBlock.d.ts +3 -0
- package/lib/core/utils/getCurrentBlock.d.ts.map +1 -0
- package/lib/core/utils/getCurrentBlock.js +7 -0
- package/lib/core/utils/getRteTheme.d.ts +19 -0
- package/lib/core/utils/getRteTheme.d.ts.map +1 -0
- package/lib/core/utils/getRteTheme.js +18 -0
- package/lib/core/utils/pasteAndFilterText.d.ts +5 -0
- package/lib/core/utils/pasteAndFilterText.d.ts.map +1 -0
- package/lib/core/utils/pasteAndFilterText.js +17 -0
- package/lib/core/utils/rangesIntersect.d.ts +6 -0
- package/lib/core/utils/rangesIntersect.d.ts.map +1 -0
- package/lib/core/utils/rangesIntersect.js +22 -0
- package/lib/core/utils/selectionIsInOneBlock.d.ts +3 -0
- package/lib/core/utils/selectionIsInOneBlock.d.ts.map +1 -0
- package/lib/core/utils/selectionIsInOneBlock.js +6 -0
- package/lib/field/createFinalFormRte.d.ts +22 -0
- package/lib/field/createFinalFormRte.d.ts.map +1 -0
- package/lib/field/createFinalFormRte.js +84 -0
- package/lib/field/createRteField.d.ts +13 -0
- package/lib/field/createRteField.d.ts.map +1 -0
- package/lib/field/createRteField.js +44 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/useDebounce.d.ts +2 -0
- package/lib/useDebounce.d.ts.map +1 -0
- package/lib/useDebounce.js +32 -0
- package/lib/usePrevious.d.ts +4 -0
- package/lib/usePrevious.d.ts.map +1 -0
- package/lib/usePrevious.js +20 -0
- package/lib/utils/requiredValidator.d.ts +4 -0
- package/lib/utils/requiredValidator.d.ts.map +1 -0
- package/lib/utils/requiredValidator.js +16 -0
- package/package.json +93 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
import { RteNonBreakingSpace } from "@dextinity/admin-icons";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
var EditorComponent = function EditorComponent(_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
8
|
+
children: [/*#__PURE__*/_jsx(Icon, {}), children]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var Root = /*#__PURE__*/styled("span", process.env.NODE_ENV === "production" ? {
|
|
12
|
+
target: "egph3tn1"
|
|
13
|
+
} : {
|
|
14
|
+
target: "egph3tn1",
|
|
15
|
+
label: "Root"
|
|
16
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "vv2s67",
|
|
18
|
+
styles: "position:relative;letter-spacing:0.9em"
|
|
19
|
+
} : {
|
|
20
|
+
name: "vv2s67",
|
|
21
|
+
styles: "position:relative;letter-spacing:0.9em/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb3JlL2V4dGVuc2lvbi9Ob25CcmVha2luZ1NwYWNlL0VkaXRvckNvbXBvbmVudC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUIyQiIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMvY29yZS9leHRlbnNpb24vTm9uQnJlYWtpbmdTcGFjZS9FZGl0b3JDb21wb25lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUnRlTm9uQnJlYWtpbmdTcGFjZSB9IGZyb20gXCJAZGV4dGluaXR5L2FkbWluLWljb25zXCI7XG5pbXBvcnQgeyBzdHlsZWQgfSBmcm9tIFwiQG11aS9tYXRlcmlhbC9zdHlsZXNcIjtcbmltcG9ydCB0eXBlIHsgQ29udGVudFN0YXRlIH0gZnJvbSBcImRyYWZ0LWpzXCI7XG5pbXBvcnQgdHlwZSB7IFByb3BzV2l0aENoaWxkcmVuIH0gZnJvbSBcInJlYWN0XCI7XG5cbmludGVyZmFjZSBQcm9wcyB7XG4gICAgY29udGVudFN0YXRlOiBDb250ZW50U3RhdGU7XG4gICAgZW50aXR5S2V5OiBzdHJpbmc7XG59XG5cbmNvbnN0IEVkaXRvckNvbXBvbmVudCA9ICh7IGNoaWxkcmVuIH06IFByb3BzV2l0aENoaWxkcmVuPFByb3BzPikgPT4ge1xuICAgIHJldHVybiAoXG4gICAgICAgIDxSb290PlxuICAgICAgICAgICAgPEljb24gLz5cbiAgICAgICAgICAgIHtjaGlsZHJlbn1cbiAgICAgICAgPC9Sb290PlxuICAgICk7XG59O1xuXG5jb25zdCBSb290ID0gc3R5bGVkKFwic3BhblwiKWBcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgLy8gQXJiaXRyYXJ5IHZhbHVlIHRvIG1ha2UgdGhlIG5vbi1icmVha2luZyBzcGFjZSB0aGUgc2FtZSB3aWR0aCBhcyB0aGUgaWNvblxuICAgIGxldHRlci1zcGFjaW5nOiAwLjllbTtcbmA7XG5cbmNvbnN0IEljb24gPSBzdHlsZWQoUnRlTm9uQnJlYWtpbmdTcGFjZSlgXG4gICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgIC8vIEFyYml0cmFyeSB2YWx1ZXMgdG8gbWFrZSB0aGUgaWNvbiBsb29rIGNlbnRlcmVkXG4gICAgdG9wOiAwLjEyZW07XG4gICAgbGVmdDogMC4wOGVtO1xuICAgIGZvbnQtc2l6ZTogaW5oZXJpdDtcbiAgICBjb2xvcjogY3VycmVudGNvbG9yO1xuICAgIG9wYWNpdHk6IDAuNTtcbmA7XG5cbmV4cG9ydCBkZWZhdWx0IEVkaXRvckNvbXBvbmVudDtcbiJdfQ== */",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
});
|
|
24
|
+
var Icon = /*#__PURE__*/styled(RteNonBreakingSpace, process.env.NODE_ENV === "production" ? {
|
|
25
|
+
target: "egph3tn0"
|
|
26
|
+
} : {
|
|
27
|
+
target: "egph3tn0",
|
|
28
|
+
label: "Icon"
|
|
29
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
30
|
+
name: "11s64h0",
|
|
31
|
+
styles: "position:absolute;top:0.12em;left:0.08em;font-size:inherit;color:currentcolor;opacity:0.5"
|
|
32
|
+
} : {
|
|
33
|
+
name: "11s64h0",
|
|
34
|
+
styles: "position:absolute;top:0.12em;left:0.08em;font-size:inherit;color:currentcolor;opacity:0.5/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb3JlL2V4dGVuc2lvbi9Ob25CcmVha2luZ1NwYWNlL0VkaXRvckNvbXBvbmVudC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBeUJ3QyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMvY29yZS9leHRlbnNpb24vTm9uQnJlYWtpbmdTcGFjZS9FZGl0b3JDb21wb25lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUnRlTm9uQnJlYWtpbmdTcGFjZSB9IGZyb20gXCJAZGV4dGluaXR5L2FkbWluLWljb25zXCI7XG5pbXBvcnQgeyBzdHlsZWQgfSBmcm9tIFwiQG11aS9tYXRlcmlhbC9zdHlsZXNcIjtcbmltcG9ydCB0eXBlIHsgQ29udGVudFN0YXRlIH0gZnJvbSBcImRyYWZ0LWpzXCI7XG5pbXBvcnQgdHlwZSB7IFByb3BzV2l0aENoaWxkcmVuIH0gZnJvbSBcInJlYWN0XCI7XG5cbmludGVyZmFjZSBQcm9wcyB7XG4gICAgY29udGVudFN0YXRlOiBDb250ZW50U3RhdGU7XG4gICAgZW50aXR5S2V5OiBzdHJpbmc7XG59XG5cbmNvbnN0IEVkaXRvckNvbXBvbmVudCA9ICh7IGNoaWxkcmVuIH06IFByb3BzV2l0aENoaWxkcmVuPFByb3BzPikgPT4ge1xuICAgIHJldHVybiAoXG4gICAgICAgIDxSb290PlxuICAgICAgICAgICAgPEljb24gLz5cbiAgICAgICAgICAgIHtjaGlsZHJlbn1cbiAgICAgICAgPC9Sb290PlxuICAgICk7XG59O1xuXG5jb25zdCBSb290ID0gc3R5bGVkKFwic3BhblwiKWBcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgLy8gQXJiaXRyYXJ5IHZhbHVlIHRvIG1ha2UgdGhlIG5vbi1icmVha2luZyBzcGFjZSB0aGUgc2FtZSB3aWR0aCBhcyB0aGUgaWNvblxuICAgIGxldHRlci1zcGFjaW5nOiAwLjllbTtcbmA7XG5cbmNvbnN0IEljb24gPSBzdHlsZWQoUnRlTm9uQnJlYWtpbmdTcGFjZSlgXG4gICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgIC8vIEFyYml0cmFyeSB2YWx1ZXMgdG8gbWFrZSB0aGUgaWNvbiBsb29rIGNlbnRlcmVkXG4gICAgdG9wOiAwLjEyZW07XG4gICAgbGVmdDogMC4wOGVtO1xuICAgIGZvbnQtc2l6ZTogaW5oZXJpdDtcbiAgICBjb2xvcjogY3VycmVudGNvbG9yO1xuICAgIG9wYWNpdHk6IDAuNTtcbmA7XG5cbmV4cG9ydCBkZWZhdWx0IEVkaXRvckNvbXBvbmVudDtcbiJdfQ== */",
|
|
35
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
36
|
+
});
|
|
37
|
+
export default EditorComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../../src/core/extension/NonBreakingSpace/ToolbarButton.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,iBAAS,aAAa,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,aAAa,2CA6BpE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RteNonBreakingSpace } from "@dextinity/admin-icons";
|
|
2
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
+
import { EditorState, Modifier } from "draft-js";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import { ControlButton } from "../../Controls/ControlButton";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
var NO_BREAK_SPACE_UNICODE_CHAR = 0x00a0;
|
|
9
|
+
function ToolbarButton(_ref) {
|
|
10
|
+
var editorState = _ref.editorState,
|
|
11
|
+
setEditorState = _ref.setEditorState;
|
|
12
|
+
function handleClick(event) {
|
|
13
|
+
event.preventDefault(); // Preserve focus in editor
|
|
14
|
+
|
|
15
|
+
var currentContent = editorState.getCurrentContent();
|
|
16
|
+
var selection = editorState.getSelection();
|
|
17
|
+
// TODO insert \u00a0 in a way that link-entities dont break when inserted in the middle of a link text
|
|
18
|
+
// right now the link is split into 2 link-entities
|
|
19
|
+
// works as expected when \u00ad is copied and pasted: https://unicode.flopp.net/c/00A0
|
|
20
|
+
var textWithEntity;
|
|
21
|
+
if (selection.isCollapsed()) {
|
|
22
|
+
textWithEntity = Modifier.insertText(currentContent, selection, String.fromCharCode(NO_BREAK_SPACE_UNICODE_CHAR));
|
|
23
|
+
} else {
|
|
24
|
+
textWithEntity = Modifier.replaceText(currentContent, selection, String.fromCharCode(NO_BREAK_SPACE_UNICODE_CHAR));
|
|
25
|
+
}
|
|
26
|
+
setEditorState(EditorState.push(editorState, textWithEntity, "insert-characters"));
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
29
|
+
title: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
30
|
+
id: "comet.rte.extensions.nonBreakingSpace.buttonTooltip",
|
|
31
|
+
defaultMessage: "Insert a non-breaking space"
|
|
32
|
+
}),
|
|
33
|
+
placement: "top",
|
|
34
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
35
|
+
children: /*#__PURE__*/_jsx(ControlButton, {
|
|
36
|
+
icon: RteNonBreakingSpace,
|
|
37
|
+
onButtonClick: handleClick
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export default ToolbarButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decorator.d.ts","sourceRoot":"","sources":["../../../../src/core/extension/SoftHyphen/Decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/C,QAAA,MAAM,SAAS,EAAE,cAKhB,CAAC;AAWF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EditorComponent } from "./EditorComponent";
|
|
2
|
+
var SHY_UNICHAR_REGEX = /\u00ad/g;
|
|
3
|
+
var Decorator = {
|
|
4
|
+
strategy: function strategy(contentBlock, callback) {
|
|
5
|
+
findWithRegex(SHY_UNICHAR_REGEX, contentBlock, callback);
|
|
6
|
+
},
|
|
7
|
+
component: EditorComponent
|
|
8
|
+
};
|
|
9
|
+
function findWithRegex(regex, contentBlock, callback) {
|
|
10
|
+
var text = contentBlock.getText();
|
|
11
|
+
var matchArr, start;
|
|
12
|
+
while ((matchArr = regex.exec(text)) !== null) {
|
|
13
|
+
start = matchArr.index;
|
|
14
|
+
callback(start, start + matchArr[0].length);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export default Decorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContentState } from "draft-js";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
interface Props {
|
|
4
|
+
contentState: ContentState;
|
|
5
|
+
entityKey: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const EditorComponent: ({ children }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=EditorComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorComponent.d.ts","sourceRoot":"","sources":["../../../../src/core/extension/SoftHyphen/EditorComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,UAAU,KAAK;IACX,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACrB;AAGD,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,CAAC,KAAK,CAAC,4CAOrE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
import { RteSoftHyphen } from "@dextinity/admin-icons";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
//TODO: Allow text selection for SoftHyphen
|
|
6
|
+
export var EditorComponent = function EditorComponent(_ref) {
|
|
7
|
+
var children = _ref.children;
|
|
8
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
9
|
+
children: [/*#__PURE__*/_jsx(VisibleHyphen, {}), children]
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var VisibleHyphen = /*#__PURE__*/styled(RteSoftHyphen, process.env.NODE_ENV === "production" ? {
|
|
13
|
+
target: "e1qpge1n0"
|
|
14
|
+
} : {
|
|
15
|
+
target: "e1qpge1n0",
|
|
16
|
+
label: "VisibleHyphen"
|
|
17
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "1928uno",
|
|
19
|
+
styles: "font-size:inherit;color:currentcolor;opacity:0.5;padding-top:0.2em"
|
|
20
|
+
} : {
|
|
21
|
+
name: "1928uno",
|
|
22
|
+
styles: "font-size:inherit;color:currentcolor;opacity:0.5;padding-top:0.2em/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb3JlL2V4dGVuc2lvbi9Tb2Z0SHlwaGVuL0VkaXRvckNvbXBvbmVudC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0IyQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMvY29yZS9leHRlbnNpb24vU29mdEh5cGhlbi9FZGl0b3JDb21wb25lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUnRlU29mdEh5cGhlbiB9IGZyb20gXCJAZGV4dGluaXR5L2FkbWluLWljb25zXCI7XG5pbXBvcnQgeyBzdHlsZWQgfSBmcm9tIFwiQG11aS9tYXRlcmlhbC9zdHlsZXNcIjtcbmltcG9ydCB0eXBlIHsgQ29udGVudFN0YXRlIH0gZnJvbSBcImRyYWZ0LWpzXCI7XG5pbXBvcnQgdHlwZSB7IFByb3BzV2l0aENoaWxkcmVuIH0gZnJvbSBcInJlYWN0XCI7XG5cbmludGVyZmFjZSBQcm9wcyB7XG4gICAgY29udGVudFN0YXRlOiBDb250ZW50U3RhdGU7XG4gICAgZW50aXR5S2V5OiBzdHJpbmc7XG59XG5cbi8vVE9ETzogQWxsb3cgdGV4dCBzZWxlY3Rpb24gZm9yIFNvZnRIeXBoZW5cbmV4cG9ydCBjb25zdCBFZGl0b3JDb21wb25lbnQgPSAoeyBjaGlsZHJlbiB9OiBQcm9wc1dpdGhDaGlsZHJlbjxQcm9wcz4pID0+IHtcbiAgICByZXR1cm4gKFxuICAgICAgICA8c3Bhbj5cbiAgICAgICAgICAgIDxWaXNpYmxlSHlwaGVuIC8+XG4gICAgICAgICAgICB7Y2hpbGRyZW59XG4gICAgICAgIDwvc3Bhbj5cbiAgICApO1xufTtcblxuY29uc3QgVmlzaWJsZUh5cGhlbiA9IHN0eWxlZChSdGVTb2Z0SHlwaGVuKWBcbiAgICBmb250LXNpemU6IGluaGVyaXQ7XG4gICAgY29sb3I6IGN1cnJlbnRjb2xvcjtcbiAgICBvcGFjaXR5OiAwLjU7XG5cbiAgICAvLyBBcmJpdHJhcnkgdmFsdWUgdG8gbWFrZSB0aGUgaWNvbiBsb29rIGNlbnRlcmVkXG4gICAgcGFkZGluZy10b3A6IDAuMmVtO1xuYDtcbiJdfQ== */",
|
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../../src/core/extension/SoftHyphen/ToolbarButton.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,aAAa,2CAsB3E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RteSoftHyphen } from "@dextinity/admin-icons";
|
|
2
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
+
import { EditorState, Modifier } from "draft-js";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import { ControlButton } from "../../Controls/ControlButton";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
var SHY_UNICODE_CHAR = 0x00ad;
|
|
9
|
+
export function ToolbarButton(_ref) {
|
|
10
|
+
var editorState = _ref.editorState,
|
|
11
|
+
setEditorState = _ref.setEditorState;
|
|
12
|
+
function handleClick(e) {
|
|
13
|
+
e.preventDefault(); // important to preserve focus
|
|
14
|
+
var currentContent = editorState.getCurrentContent();
|
|
15
|
+
var selection = editorState.getSelection();
|
|
16
|
+
//@TODO: insert \u00ad in a way that link-entities don’t break when inserted in the middle of a link text
|
|
17
|
+
// right now the link is split into 2 link-entities
|
|
18
|
+
// works as expected when \u00ad is copied and pasted: https://unicode.flopp.net/c/00AD
|
|
19
|
+
var textWithEntity = Modifier.insertText(currentContent, selection, String.fromCharCode(SHY_UNICODE_CHAR));
|
|
20
|
+
setEditorState(EditorState.push(editorState, textWithEntity, "insert-characters"));
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
23
|
+
title: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
24
|
+
id: "comet.rte.extensions.softHyphen.buttonTooltip",
|
|
25
|
+
defaultMessage: "Insert a soft hyphen"
|
|
26
|
+
}),
|
|
27
|
+
placement: "top",
|
|
28
|
+
children: /*#__PURE__*/_jsxs("span", {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(ControlButton, {
|
|
30
|
+
icon: RteSoftHyphen,
|
|
31
|
+
onButtonClick: handleClick
|
|
32
|
+
}), " "]
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FilterEditorStateBeforeUpdateFn } from "../Rte";
|
|
2
|
+
declare const composeFilterEditorFns: (fns: FilterEditorStateBeforeUpdateFn[]) => FilterEditorStateBeforeUpdateFn;
|
|
3
|
+
export default composeFilterEditorFns;
|
|
4
|
+
//# sourceMappingURL=composeFilterEditorFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeFilterEditorFns.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/composeFilterEditorFns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAE9D,QAAA,MAAM,sBAAsB,EAAE,CAAC,GAAG,EAAE,+BAA+B,EAAE,KAAK,+BAEzE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAQ9D,QAAA,MAAM,oCAAoC,EAAE,+BAe3C,CAAC;AAEF,eAAe,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import composeFilterEditorFns from "./composeFilterEditorFns";
|
|
2
|
+
import removeBlocksExceedingBlockLimit from "./removeBlocksExceedingBlockLimit";
|
|
3
|
+
import removeUnsupportedBlockTypes from "./removeUnsupportedBlockTypes";
|
|
4
|
+
import removeUnsupportedEntities from "./removeUnsupportedEntities";
|
|
5
|
+
import removeUnsupportedInlineStyles from "./removeUnsupportedInlineStyles";
|
|
6
|
+
import removeUnsupportedListLevels from "./removeUnsupportedListLevels";
|
|
7
|
+
var defaultFilterEditorStateBeforeUpdate = function defaultFilterEditorStateBeforeUpdate(newState, ctx) {
|
|
8
|
+
var fns = [removeUnsupportedEntities, removeUnsupportedBlockTypes, removeUnsupportedInlineStyles, removeBlocksExceedingBlockLimit, removeUnsupportedListLevels];
|
|
9
|
+
var shouldFilter = newState.getLastChangeType() === "insert-fragment";
|
|
10
|
+
if (shouldFilter) {
|
|
11
|
+
// apply all filters from left to right
|
|
12
|
+
return composeFilterEditorFns(fns)(newState, ctx);
|
|
13
|
+
}
|
|
14
|
+
return newState;
|
|
15
|
+
};
|
|
16
|
+
export default defaultFilterEditorStateBeforeUpdate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manageStandardBlockType.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/manageStandardBlockType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAK9D,QAAA,MAAM,uBAAuB,EAAE,+BAO9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import changeBlockType from "./utils/changeBlockType";
|
|
2
|
+
|
|
3
|
+
// when standard-block-type is not "unstyled", all non-empty blocks with block-type of "unstyled" are changed to the standard-block-type
|
|
4
|
+
//
|
|
5
|
+
var manageStandardBlockType = function manageStandardBlockType(newState, _ref) {
|
|
6
|
+
var standardBlockType = _ref.standardBlockType;
|
|
7
|
+
if (standardBlockType !== "unstyled") {
|
|
8
|
+
// only replace empty blocks
|
|
9
|
+
// unstyled blocks with content are preserved
|
|
10
|
+
return changeBlockType(["unstyled"], standardBlockType, {
|
|
11
|
+
skipNonEmptyBlocks: true
|
|
12
|
+
})(newState);
|
|
13
|
+
}
|
|
14
|
+
return newState;
|
|
15
|
+
};
|
|
16
|
+
export default manageStandardBlockType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeBlocksExceedingBlockLimit.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/removeBlocksExceedingBlockLimit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAI9D,QAAA,MAAM,+BAA+B,EAAE,+BAmBtC,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EditorState, SelectionState } from "draft-js";
|
|
2
|
+
// when a maxBlocks-limit is set, all blocks exceeding this limit are removed completely (with the content)
|
|
3
|
+
//
|
|
4
|
+
var removeBlocksExceedingBlockLimit = function removeBlocksExceedingBlockLimit(newState, _ref) {
|
|
5
|
+
var maxBlocks = _ref.maxBlocks;
|
|
6
|
+
if (maxBlocks) {
|
|
7
|
+
var content = newState.getCurrentContent();
|
|
8
|
+
var blockMap = content.getBlockMap();
|
|
9
|
+
if (blockMap.count() > maxBlocks) {
|
|
10
|
+
var limitedBlocks = blockMap.take(maxBlocks);
|
|
11
|
+
var lastKey = limitedBlocks.last().getKey();
|
|
12
|
+
return EditorState.set(newState, {
|
|
13
|
+
currentContent: content.merge({
|
|
14
|
+
blockMap: limitedBlocks
|
|
15
|
+
}),
|
|
16
|
+
selection: SelectionState.createEmpty(lastKey)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return newState;
|
|
21
|
+
};
|
|
22
|
+
export default removeBlocksExceedingBlockLimit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeUnsupportedBlockTypes.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/removeUnsupportedBlockTypes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAmB,MAAM,QAAQ,CAAC;AAG/E,QAAA,MAAM,2BAA2B,EAAE,+BA8BlC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import changeBlockType from "./utils/changeBlockType";
|
|
2
|
+
var removeUnsupportedBlockTypes = function removeUnsupportedBlockTypes(newState, _ref) {
|
|
3
|
+
var supports = _ref.supports,
|
|
4
|
+
standardBlockType = _ref.standardBlockType;
|
|
5
|
+
// unstyle all core-blocks which are not supported
|
|
6
|
+
var blackListBlocks = ["paragraph", "code-block", "atomic"]; // these are not supported at all by our rte
|
|
7
|
+
|
|
8
|
+
var supportsToBlockMap = {
|
|
9
|
+
"header-one": "header-one",
|
|
10
|
+
"header-two": "header-two",
|
|
11
|
+
"header-three": "header-three",
|
|
12
|
+
"header-four": "header-four",
|
|
13
|
+
"header-five": "header-five",
|
|
14
|
+
"header-six": "header-six",
|
|
15
|
+
blockquote: "blockquote",
|
|
16
|
+
"ordered-list": "ordered-list-item",
|
|
17
|
+
"unordered-list": "unordered-list-item"
|
|
18
|
+
};
|
|
19
|
+
var supportsToTest = Object.keys(supportsToBlockMap);
|
|
20
|
+
supportsToTest.forEach(function (support) {
|
|
21
|
+
if (!supports.includes(support) && supportsToBlockMap[support]) {
|
|
22
|
+
var blockType = supportsToBlockMap[support];
|
|
23
|
+
if (blockType) {
|
|
24
|
+
blackListBlocks.push(blockType);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// also remove unstyled block-type and set it to the standard-block-type if standardBlockType is not "unstyled"
|
|
30
|
+
if (standardBlockType !== "unstyled") {
|
|
31
|
+
blackListBlocks.push("unstyled");
|
|
32
|
+
}
|
|
33
|
+
return changeBlockType(blackListBlocks, standardBlockType)(newState);
|
|
34
|
+
};
|
|
35
|
+
export default removeUnsupportedBlockTypes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeUnsupportedEntities.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/removeUnsupportedEntities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAG9D,QAAA,MAAM,yBAAyB,EAAE,+BAehC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import removeEntities from "./utils/removeEntities";
|
|
2
|
+
var removeUnsupportedEntities = function removeUnsupportedEntities(newState, _ref) {
|
|
3
|
+
var supports = _ref.supports;
|
|
4
|
+
// remove links and images
|
|
5
|
+
return removeEntities(function (entity) {
|
|
6
|
+
var unsupportedCoreEntities = ["IMAGE", "TOKEN", "PHOTO"];
|
|
7
|
+
if (unsupportedCoreEntities.includes(entity.getType())) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (!supports.includes("link")) {
|
|
11
|
+
if (entity.getType() === "LINK") {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
})(newState);
|
|
17
|
+
};
|
|
18
|
+
export default removeUnsupportedEntities;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeUnsupportedInlineStyles.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/removeUnsupportedInlineStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAmB,MAAM,QAAQ,CAAC;AAI/E,QAAA,MAAM,6BAA6B,EAAE,+BAuBpC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import removeInlineStyles from "./utils/removeInlineStyles";
|
|
2
|
+
var removeUnsupportedInlineStyles = function removeUnsupportedInlineStyles(newState, _ref) {
|
|
3
|
+
var supports = _ref.supports;
|
|
4
|
+
// unstyle all core-blocks which are not supported
|
|
5
|
+
var blackListInlineStyles = ["CODE"]; // these are not supported at all by our rte
|
|
6
|
+
|
|
7
|
+
var supportsToInlineStyleMap = {
|
|
8
|
+
bold: "BOLD",
|
|
9
|
+
italic: "ITALIC",
|
|
10
|
+
underline: "UNDERLINE",
|
|
11
|
+
strikethrough: "STRIKETHROUGH",
|
|
12
|
+
sub: "SUB",
|
|
13
|
+
sup: "SUP"
|
|
14
|
+
};
|
|
15
|
+
var supportsToTest = Object.keys(supportsToInlineStyleMap);
|
|
16
|
+
supportsToTest.forEach(function (support) {
|
|
17
|
+
if (!supports.includes(support) && supportsToInlineStyleMap[support]) {
|
|
18
|
+
var inlineStyle = supportsToInlineStyleMap[support];
|
|
19
|
+
if (inlineStyle) {
|
|
20
|
+
blackListInlineStyles.push(inlineStyle);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return removeInlineStyles(blackListInlineStyles)(newState);
|
|
25
|
+
};
|
|
26
|
+
export default removeUnsupportedInlineStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeUnsupportedListLevels.d.ts","sourceRoot":"","sources":["../../../src/core/filterEditor/removeUnsupportedListLevels.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAE9D,QAAA,MAAM,2BAA2B,EAAE,+BASlC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EditorState } from "draft-js";
|
|
2
|
+
var removeUnsupportedListLevels = function removeUnsupportedListLevels(newState, _ref) {
|
|
3
|
+
var listLevelMax = _ref.listLevelMax;
|
|
4
|
+
var content = newState.getCurrentContent();
|
|
5
|
+
var blockMap = content.getBlockMap();
|
|
6
|
+
return EditorState.set(newState, {
|
|
7
|
+
currentContent: content.merge({
|
|
8
|
+
blockMap: blockMap.map(function (block) {
|
|
9
|
+
return block === null || block === void 0 ? void 0 : block.merge({
|
|
10
|
+
depth: Math.min(block.getDepth(), listLevelMax)
|
|
11
|
+
});
|
|
12
|
+
})
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export default removeUnsupportedListLevels;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DraftBlockType } from "draft-js";
|
|
2
|
+
import type { FilterEditorStateFn } from "../../types";
|
|
3
|
+
type BlockTypeList = DraftBlockType[];
|
|
4
|
+
interface IOptions {
|
|
5
|
+
skipNonEmptyBlocks?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const changeBlockType: (blockTypeList: BlockTypeList, blockType: DraftBlockType, options?: IOptions) => FilterEditorStateFn;
|
|
8
|
+
export default changeBlockType;
|
|
9
|
+
//# sourceMappingURL=changeBlockType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeBlockType.d.ts","sourceRoot":"","sources":["../../../../src/core/filterEditor/utils/changeBlockType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,UAAU,CAAC;AAE5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,aAAa,GAAG,cAAc,EAAE,CAAC;AAEtC,UAAU,QAAQ;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,QAAA,MAAM,eAAe,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,QAAQ,KAAK,mBAkCnG,CAAC;AAEN,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EditorState } from "draft-js";
|
|
2
|
+
// inspired by https://github.com/thibaudcolas/draftjs-filters/blob/master/src/lib/filters/blocks.js#L127
|
|
3
|
+
var changeBlockType = function changeBlockType(blockTypeList) {
|
|
4
|
+
var blockType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unstyled";
|
|
5
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6
|
+
return function (nextState) {
|
|
7
|
+
var content = nextState.getCurrentContent();
|
|
8
|
+
var blockMap = content.getBlockMap();
|
|
9
|
+
var changedBlocks = blockMap.filter(function (block) {
|
|
10
|
+
if (!block) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
// check if type of the block is in our blockTypeList
|
|
14
|
+
if (blockTypeList.includes(block.getType())) {
|
|
15
|
+
// only empty blocks are included when this options is set
|
|
16
|
+
if (options.skipNonEmptyBlocks) {
|
|
17
|
+
return block.getLength() ? false : true;
|
|
18
|
+
} else {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}).map(function (block) {
|
|
25
|
+
return block.merge({
|
|
26
|
+
type: blockType,
|
|
27
|
+
depth: 0
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return EditorState.set(nextState, {
|
|
31
|
+
currentContent: content.merge({
|
|
32
|
+
blockMap: blockMap.merge(changedBlocks)
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default changeBlockType;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EntityInstance } from "draft-js";
|
|
2
|
+
import type { FilterEditorStateFn } from "../../types";
|
|
3
|
+
type UpdateEntityDataFn = (entity: EntityInstance) => Record<string, any> | undefined;
|
|
4
|
+
declare const manipulateEntityData: (updateEntityDataFn: UpdateEntityDataFn) => FilterEditorStateFn;
|
|
5
|
+
export default manipulateEntityData;
|
|
6
|
+
//# sourceMappingURL=manipulateEntityData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manipulateEntityData.d.ts","sourceRoot":"","sources":["../../../../src/core/filterEditor/utils/manipulateEntityData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;AAGtF,QAAA,MAAM,oBAAoB,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,KAAK,mBAgCvE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import { EditorState } from "draft-js";
|
|
8
|
+
// if object is returned the entity data is updated with this object
|
|
9
|
+
|
|
10
|
+
// inspired by https://github.com/thibaudcolas/draftjs-filters/blob/31d89177090b815b968ac2d8ec95c89d975f1e44/src/lib/filters/entities.js#L179
|
|
11
|
+
var manipulateEntityData = function manipulateEntityData(updateEntityDataFn) {
|
|
12
|
+
return function (nextState) {
|
|
13
|
+
var content = nextState.getCurrentContent();
|
|
14
|
+
var entities = {};
|
|
15
|
+
content.getBlocksAsArray().forEach(function (block) {
|
|
16
|
+
if (block) {
|
|
17
|
+
block.findEntityRanges(function (_char) {
|
|
18
|
+
var entityKey = _char.getEntity();
|
|
19
|
+
if (entityKey) {
|
|
20
|
+
var _entity = content.getEntity(entityKey);
|
|
21
|
+
entities[entityKey] = _entity;
|
|
22
|
+
}
|
|
23
|
+
return false; // irrelevant
|
|
24
|
+
}, function () {
|
|
25
|
+
// no cb needed
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
Object.entries(entities).forEach(function (_ref) {
|
|
30
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
31
|
+
key = _ref2[0],
|
|
32
|
+
entity = _ref2[1];
|
|
33
|
+
var maybeNewData = updateEntityDataFn(entity);
|
|
34
|
+
if (maybeNewData) {
|
|
35
|
+
content.replaceEntityData(key, maybeNewData);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return EditorState.set(nextState, {
|
|
39
|
+
currentContent: content
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default manipulateEntityData;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EntityInstance } from "draft-js";
|
|
2
|
+
import type { FilterEditorStateFn } from "../../types";
|
|
3
|
+
type FilterFn = (entity: EntityInstance) => boolean;
|
|
4
|
+
declare const removeEntities: (filterFn: FilterFn) => FilterEditorStateFn;
|
|
5
|
+
export default removeEntities;
|
|
6
|
+
//# sourceMappingURL=removeEntities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeEntities.d.ts","sourceRoot":"","sources":["../../../../src/core/filterEditor/utils/removeEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;AAGpD,QAAA,MAAM,cAAc,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,mBA4B7C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CharacterMetadata, EditorState } from "draft-js";
|
|
2
|
+
// when function returns false the entity is removed
|
|
3
|
+
|
|
4
|
+
// inspired by https://github.com/thibaudcolas/draftjs-filters/blob/31d89177090b815b968ac2d8ec95c89d975f1e44/src/lib/filters/entities.js#L77
|
|
5
|
+
var removeEntities = function removeEntities(filterFn) {
|
|
6
|
+
return function (nextState) {
|
|
7
|
+
var content = nextState.getCurrentContent();
|
|
8
|
+
var blockMap = content.getBlockMap();
|
|
9
|
+
var blocks = blockMap.map(function (block) {
|
|
10
|
+
var altered = false;
|
|
11
|
+
var chars = block.getCharacterList().map(function (_char) {
|
|
12
|
+
if (!_char) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
var entityKey = _char.getEntity();
|
|
16
|
+
if (entityKey) {
|
|
17
|
+
var _entity = content.getEntity(entityKey);
|
|
18
|
+
if (!filterFn(_entity)) {
|
|
19
|
+
altered = true;
|
|
20
|
+
return CharacterMetadata.applyEntity(_char, null);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return _char;
|
|
24
|
+
});
|
|
25
|
+
return altered ? block.set("characterList", chars) : block;
|
|
26
|
+
});
|
|
27
|
+
return EditorState.set(nextState, {
|
|
28
|
+
currentContent: content.merge({
|
|
29
|
+
blockMap: blockMap.merge(blocks)
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export default removeEntities;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FilterEditorStateFn, InlineStyleType } from "../../types";
|
|
2
|
+
type StyleBlacklist = InlineStyleType[];
|
|
3
|
+
declare const removeInlineStyles: (blockBlacklist: StyleBlacklist) => FilterEditorStateFn;
|
|
4
|
+
export default removeInlineStyles;
|
|
5
|
+
//# sourceMappingURL=removeInlineStyles.d.ts.map
|