@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
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Vivid Planet Software GmbH
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ThemedComponentBaseProps } from "@dextinity/admin";
|
|
2
|
+
import { type ComponentsOverrides, type Theme, Typography, type TypographyProps } from "@mui/material";
|
|
3
|
+
import type { ElementType } from "react";
|
|
4
|
+
import type { SupportedThings } from "./Rte";
|
|
5
|
+
type StylableBlockTypes = Extract<SupportedThings, "header-one" | "header-two" | "header-three" | "header-four" | "header-five" | "header-six" | "blockquote" | "unordered-list" | "ordered-list">;
|
|
6
|
+
export type RteBlockElementClassKey = StylableBlockTypes | "root";
|
|
7
|
+
export interface RteBlockElementProps extends ThemedComponentBaseProps<{
|
|
8
|
+
root: typeof Typography;
|
|
9
|
+
}>, TypographyProps {
|
|
10
|
+
type?: StylableBlockTypes;
|
|
11
|
+
component?: ElementType;
|
|
12
|
+
}
|
|
13
|
+
export declare function BlockElement(inProps: RteBlockElementProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare module "@mui/material/styles" {
|
|
15
|
+
interface ComponentNameToClassKey {
|
|
16
|
+
CometAdminRteBlockElement: RteBlockElementClassKey;
|
|
17
|
+
}
|
|
18
|
+
interface ComponentsPropsList {
|
|
19
|
+
CometAdminRteBlockElement: RteBlockElementProps;
|
|
20
|
+
}
|
|
21
|
+
interface Components {
|
|
22
|
+
CometAdminRteBlockElement?: {
|
|
23
|
+
defaultProps?: Partial<ComponentsPropsList["CometAdminRteBlockElement"]>;
|
|
24
|
+
styleOverrides?: ComponentsOverrides<Theme>["CometAdminRteBlockElement"];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=BlockElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockElement.d.ts","sourceRoot":"","sources":["../../src/core/BlockElement.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,KAAK,mBAAmB,EAAO,KAAK,KAAK,EAAE,UAAU,EAAE,KAAK,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC3H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAG7C,KAAK,kBAAkB,GAAG,OAAO,CAC7B,eAAe,EACf,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,gBAAgB,GAAG,cAAc,CACjJ,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG,MAAM,CAAC;AA4FlE,MAAM,WAAW,oBACb,SAAQ,wBAAwB,CAAC;IACzB,IAAI,EAAE,OAAO,UAAU,CAAC;CAC3B,CAAC,EACF,eAAe;IACnB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,oBAAoB,2CAMzD;AAED,OAAO,QAAQ,sBAAsB,CAAC;IAClC,UAAU,uBAAuB;QAC7B,yBAAyB,EAAE,uBAAuB,CAAC;KACtD;IAED,UAAU,mBAAmB;QACzB,yBAAyB,EAAE,oBAAoB,CAAC;KACnD;IAED,UAAU,UAAU;QAChB,yBAAyB,CAAC,EAAE;YACxB,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,CAAC,CAAC;YACzE,cAAc,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,2BAA2B,CAAC,CAAC;SAC5E,CAAC;KACL;CACJ"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["type", "slotProps"];
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0;
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
12
|
+
import { createComponentSlot } from "@dextinity/admin";
|
|
13
|
+
import { css, Typography, useThemeProps } from "@mui/material";
|
|
14
|
+
|
|
15
|
+
// Only block-types used in block-type-map should be styled
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
var Root = createComponentSlot(Typography)({
|
|
18
|
+
componentName: "RteBlockElement",
|
|
19
|
+
slotName: "root",
|
|
20
|
+
classesResolver: function classesResolver(ownerState) {
|
|
21
|
+
return [Boolean(ownerState.type) && ownerState.type];
|
|
22
|
+
}
|
|
23
|
+
})(function (_ref) {
|
|
24
|
+
var theme = _ref.theme,
|
|
25
|
+
ownerState = _ref.ownerState;
|
|
26
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 16px;\n line-height: 20px;\n font-weight: 300;\n color: ", ";\n margin-bottom: 10px;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n "])), theme.palette.grey[800], ownerState.type === "header-one" && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 30px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "header-two" && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 28px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "header-three" && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 26px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "header-four" && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 22px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "header-five" && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 20px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "header-six" && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 18px;\n line-height: 1.2;\n font-weight: 500;\n "]))), ownerState.type === "ordered-list" && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding-left: 0;\n "]))), ownerState.type === "unordered-list" && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding-left: 0;\n "]))), ownerState.type === "blockquote" && css(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["\n display: block;\n position: relative;\n padding-left: 20px;\n padding-top: 5px;\n padding-bottom: 5px;\n\n &:before {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: 2px;\n width: 4px;\n background-color: ", ";\n border-radius: 2px;\n }\n "])), theme.palette.grey[200]));
|
|
27
|
+
});
|
|
28
|
+
export function BlockElement(inProps) {
|
|
29
|
+
var _useThemeProps = useThemeProps({
|
|
30
|
+
props: inProps,
|
|
31
|
+
name: "CometAdminRteBlockElement"
|
|
32
|
+
}),
|
|
33
|
+
type = _useThemeProps.type,
|
|
34
|
+
slotProps = _useThemeProps.slotProps,
|
|
35
|
+
restProps = _objectWithoutProperties(_useThemeProps, _excluded);
|
|
36
|
+
var ownerState = {
|
|
37
|
+
type: type
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsx(Root, _objectSpread(_objectSpread({
|
|
40
|
+
component: "div",
|
|
41
|
+
ownerState: ownerState
|
|
42
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root), restProps));
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ComponentsOverrides, type Theme } from "@mui/material";
|
|
2
|
+
import type { IControlProps } from "../types";
|
|
3
|
+
export type RteBlockTypeControlsClassKey = "root" | "select";
|
|
4
|
+
declare const _default: (p: IControlProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export default _default;
|
|
6
|
+
declare module "@mui/material/styles" {
|
|
7
|
+
interface ComponentNameToClassKey {
|
|
8
|
+
CometAdminRteBlockTypeControls: RteBlockTypeControlsClassKey;
|
|
9
|
+
}
|
|
10
|
+
interface Components {
|
|
11
|
+
CometAdminRteBlockTypeControls?: {
|
|
12
|
+
styleOverrides?: ComponentsOverrides<Theme>["CometAdminRteBlockTypeControls"];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=BlockTypesControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockTypesControls.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/BlockTypesControls.tsx"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,mBAAmB,EAOxB,KAAK,KAAK,EAEb,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAa9C,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,QAAQ,CAAC;yBAoE7C,GAAG,aAAa;AAAhC,wBASE;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IAClC,UAAU,uBAAuB;QAC7B,8BAA8B,EAAE,4BAA4B,CAAC;KAChE;IAED,UAAU,UAAU;QAChB,8BAA8B,CAAC,EAAE;YAC7B,cAAc,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,gCAAgC,CAAC,CAAC;SACjF,CAAC;KACL;CACJ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["disabled", "blockTypes", "slotProps"];
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
12
|
+
import { createComponentSlot } from "@dextinity/admin";
|
|
13
|
+
import { css, FormControl, inputBaseClasses, MenuItem, Select as MuiSelect, selectClasses, useThemeProps } from "@mui/material";
|
|
14
|
+
import getRteTheme from "../utils/getRteTheme";
|
|
15
|
+
import useBlockTypes from "./useBlockTypes";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
var Root = createComponentSlot(FormControl)({
|
|
18
|
+
componentName: "RteBlockTypeControls",
|
|
19
|
+
slotName: "root"
|
|
20
|
+
})(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n background-color: transparent;\n height: auto;\n border: none;\n &,\n &:hover {\n &:before,\n &:after {\n border-bottom-width: 0;\n }\n }\n }\n .", " {\n top: auto;\n color: inherit;\n }\n"])), inputBaseClasses.root, selectClasses.icon));
|
|
21
|
+
var Select = createComponentSlot(MuiSelect)({
|
|
22
|
+
componentName: "RteBlockTypeControls",
|
|
23
|
+
slotName: "select"
|
|
24
|
+
})(function (_ref) {
|
|
25
|
+
var _theme$components;
|
|
26
|
+
var theme = _ref.theme;
|
|
27
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", ".", " {\n min-height: 0;\n color: ", ";\n min-width: 180px;\n line-height: 24px;\n font-size: 14px;\n padding: 0;\n }\n "])), selectClasses.select, inputBaseClasses.input, getRteTheme((_theme$components = theme.components) === null || _theme$components === void 0 || (_theme$components = _theme$components.CometAdminRte) === null || _theme$components === void 0 ? void 0 : _theme$components.defaultProps).colors.buttonIcon);
|
|
28
|
+
});
|
|
29
|
+
function StyledBlockTypesControls(inProps) {
|
|
30
|
+
var _useThemeProps = useThemeProps({
|
|
31
|
+
props: inProps,
|
|
32
|
+
name: "CometAdminRteBlockTypeControls"
|
|
33
|
+
}),
|
|
34
|
+
disabled = _useThemeProps.disabled,
|
|
35
|
+
blockTypes = _useThemeProps.blockTypes,
|
|
36
|
+
slotProps = _useThemeProps.slotProps,
|
|
37
|
+
restProps = _objectWithoutProperties(_useThemeProps, _excluded);
|
|
38
|
+
var dropdownFeatures = blockTypes.dropdownFeatures,
|
|
39
|
+
activeDropdownBlockType = blockTypes.activeDropdownBlockType,
|
|
40
|
+
handleBlockTypeChange = blockTypes.handleBlockTypeChange;
|
|
41
|
+
var blockTypesListItems = dropdownFeatures.map(function (c) {
|
|
42
|
+
return {
|
|
43
|
+
name: c.name,
|
|
44
|
+
label: c.label
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/_jsx(Root, _objectSpread(_objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root), restProps), {}, {
|
|
48
|
+
children: /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.select), {}, {
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
value: activeDropdownBlockType,
|
|
51
|
+
displayEmpty: true,
|
|
52
|
+
variant: "filled",
|
|
53
|
+
MenuProps: {
|
|
54
|
+
elevation: 1
|
|
55
|
+
},
|
|
56
|
+
onChange: handleBlockTypeChange,
|
|
57
|
+
children: blockTypesListItems.map(function (c) {
|
|
58
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
|
59
|
+
value: c.name,
|
|
60
|
+
dense: true,
|
|
61
|
+
children: c.label
|
|
62
|
+
}, c.name);
|
|
63
|
+
})
|
|
64
|
+
}))
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If there are no dropdown-features, this must return null not just an empty component, to prevent an empty item from being rendered in Toolbar
|
|
69
|
+
export default (function (p) {
|
|
70
|
+
var editorState = p.editorState,
|
|
71
|
+
setEditorState = p.setEditorState,
|
|
72
|
+
editorRef = p.editorRef,
|
|
73
|
+
options = p.options;
|
|
74
|
+
var supportedThings = options.supports,
|
|
75
|
+
blocktypeMap = options.blocktypeMap,
|
|
76
|
+
standardBlockType = options.standardBlockType;
|
|
77
|
+
var blockTypes = useBlockTypes({
|
|
78
|
+
editorState: editorState,
|
|
79
|
+
setEditorState: setEditorState,
|
|
80
|
+
supportedThings: supportedThings,
|
|
81
|
+
blocktypeMap: blocktypeMap,
|
|
82
|
+
editorRef: editorRef,
|
|
83
|
+
standardBlockType: standardBlockType
|
|
84
|
+
});
|
|
85
|
+
if (!blockTypes.dropdownFeatures.length) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return /*#__PURE__*/_jsx(StyledBlockTypesControls, _objectSpread(_objectSpread({}, p), {}, {
|
|
89
|
+
blockTypes: blockTypes
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ThemedComponentBaseProps } from "@dextinity/admin";
|
|
2
|
+
import type { ComponentsOverrides } from "@mui/material";
|
|
3
|
+
import { type Theme } from "@mui/material/styles";
|
|
4
|
+
import type { SvgIconProps } from "@mui/material/SvgIcon";
|
|
5
|
+
import type { ForwardRefExoticComponent, MouseEvent, PropsWithChildren, RefAttributes } from "react";
|
|
6
|
+
export type RteControlButtonClassKey = "root" | "selected" | "renderAsIcon";
|
|
7
|
+
export interface IProps extends ThemedComponentBaseProps<{
|
|
8
|
+
root: "button";
|
|
9
|
+
}> {
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
onButtonClick?: (e: MouseEvent) => void;
|
|
13
|
+
icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
|
|
14
|
+
/** @deprecated use icon instead */
|
|
15
|
+
Icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
|
|
16
|
+
}
|
|
17
|
+
export declare function ControlButton(inProps: PropsWithChildren<IProps>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare module "@mui/material/styles" {
|
|
19
|
+
interface ComponentNameToClassKey {
|
|
20
|
+
CometAdminRteControlButton: RteControlButtonClassKey;
|
|
21
|
+
}
|
|
22
|
+
interface Components {
|
|
23
|
+
CometAdminRteControlButton?: {
|
|
24
|
+
styleOverrides?: ComponentsOverrides<Theme>["CometAdminRteControlButton"];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ControlButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlButton.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/ControlButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAO,KAAK,KAAK,EAAiB,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIrG,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;AA4D5E,MAAM,WAAW,MACb,SAAQ,wBAAwB,CAAC;IAC7B,IAAI,EAAE,QAAQ,CAAC;CAClB,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;IAE3F,mCAAmC;IACnC,IAAI,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;CAC9F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,2CAyB/D;AAED,OAAO,QAAQ,sBAAsB,CAAC;IAClC,UAAU,uBAAuB;QAC7B,0BAA0B,EAAE,wBAAwB,CAAC;KACxD;IAED,UAAU,UAAU;QAChB,0BAA0B,CAAC,EAAE;YACzB,cAAc,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,4BAA4B,CAAC,CAAC;SAC7E,CAAC;KACL;CACJ"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["disabled", "selected", "onButtonClick", "icon", "children", "Icon", "slotProps"];
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
12
|
+
import { createComponentSlot } from "@dextinity/admin";
|
|
13
|
+
import { css, useThemeProps } from "@mui/material/styles";
|
|
14
|
+
import getRteTheme from "../utils/getRteTheme";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
var Root = createComponentSlot("button")({
|
|
17
|
+
componentName: "RteControlButton",
|
|
18
|
+
slotName: "root",
|
|
19
|
+
classesResolver: function classesResolver(ownerState) {
|
|
20
|
+
return [ownerState.selected && "selected", Boolean(ownerState.Icon) && "renderAsIcon"];
|
|
21
|
+
}
|
|
22
|
+
})(function (_ref) {
|
|
23
|
+
var _theme$components, _rteTheme$colors, _rteTheme$colors2, _rteTheme$colors3, _rteTheme$colors4, _rteTheme$colors5;
|
|
24
|
+
var ownerState = _ref.ownerState,
|
|
25
|
+
theme = _ref.theme;
|
|
26
|
+
var rteTheme = getRteTheme((_theme$components = theme.components) === null || _theme$components === void 0 || (_theme$components = _theme$components.CometAdminRte) === null || _theme$components === void 0 ? void 0 : _theme$components.defaultProps);
|
|
27
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n height: 24px;\n background-color: transparent;\n border: 1px solid transparent;\n box-sizing: border-box;\n transition:\n background-color 200ms,\n border-color 200ms,\n color 200ms;\n font-size: 20px;\n color: ", ";\n\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n\n &:disabled {\n cursor: not-allowed;\n\n &,\n &:hover {\n background-color: transparent;\n border-color: transparent;\n color: ", ";\n }\n }\n\n ", "\n\n ", "\n "])), (_rteTheme$colors = rteTheme.colors) === null || _rteTheme$colors === void 0 ? void 0 : _rteTheme$colors.buttonIcon, (_rteTheme$colors2 = rteTheme.colors) === null || _rteTheme$colors2 === void 0 ? void 0 : _rteTheme$colors2.buttonBackgroundHover, (_rteTheme$colors3 = rteTheme.colors) === null || _rteTheme$colors3 === void 0 ? void 0 : _rteTheme$colors3.buttonBorderHover, (_rteTheme$colors4 = rteTheme.colors) === null || _rteTheme$colors4 === void 0 ? void 0 : _rteTheme$colors4.buttonIconDisabled, ownerState.selected && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:not(:disabled),\n &:not(:disabled):hover {\n border-color: ", ";\n background-color: white;\n }\n "])), (_rteTheme$colors5 = rteTheme.colors) === null || _rteTheme$colors5 === void 0 ? void 0 : _rteTheme$colors5.buttonBorderHover), Boolean(ownerState.Icon) && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 24px;\n "]))));
|
|
28
|
+
});
|
|
29
|
+
export function ControlButton(inProps) {
|
|
30
|
+
var _useThemeProps = useThemeProps({
|
|
31
|
+
props: inProps,
|
|
32
|
+
name: "CometAdminRteControlButton"
|
|
33
|
+
}),
|
|
34
|
+
_useThemeProps$disabl = _useThemeProps.disabled,
|
|
35
|
+
disabled = _useThemeProps$disabl === void 0 ? false : _useThemeProps$disabl,
|
|
36
|
+
_useThemeProps$select = _useThemeProps.selected,
|
|
37
|
+
selected = _useThemeProps$select === void 0 ? false : _useThemeProps$select,
|
|
38
|
+
onButtonClick = _useThemeProps.onButtonClick,
|
|
39
|
+
icon = _useThemeProps.icon,
|
|
40
|
+
children = _useThemeProps.children,
|
|
41
|
+
deprecatedIcon = _useThemeProps.Icon,
|
|
42
|
+
slotProps = _useThemeProps.slotProps,
|
|
43
|
+
restProps = _objectWithoutProperties(_useThemeProps, _excluded);
|
|
44
|
+
var Icon = icon || deprecatedIcon;
|
|
45
|
+
var ownerState = {
|
|
46
|
+
selected: selected,
|
|
47
|
+
Icon: Icon
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/_jsxs(Root, _objectSpread(_objectSpread(_objectSpread({
|
|
50
|
+
type: "button",
|
|
51
|
+
disabled: disabled,
|
|
52
|
+
onMouseDown: onButtonClick,
|
|
53
|
+
ownerState: ownerState
|
|
54
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root), restProps), {}, {
|
|
55
|
+
children: [!!Icon && /*#__PURE__*/_jsx(Icon, {
|
|
56
|
+
sx: {
|
|
57
|
+
fontSize: 15
|
|
58
|
+
},
|
|
59
|
+
color: "inherit"
|
|
60
|
+
}), children]
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Controls.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/Controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAY9C,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,aAAa,2CAoBhD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
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; } }
|
|
10
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
+
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; }
|
|
13
|
+
import BlockTypesControls from "./BlockTypesControls";
|
|
14
|
+
import CustomControls from "./CustomControls";
|
|
15
|
+
import HistoryControls from "./HistoryContols";
|
|
16
|
+
import InlineStyleTypeControls from "./InlineStyleTypeControls";
|
|
17
|
+
import LinkControls from "./LinkControls";
|
|
18
|
+
import ListsControls from "./ListsControls";
|
|
19
|
+
import ListsIndentControls from "./ListsIndentControls";
|
|
20
|
+
import SpecialCharactersControls from "./SpecialCharactersControls";
|
|
21
|
+
import { Toolbar } from "./Toolbar/Toolbar";
|
|
22
|
+
import TranslationControls from "./TranslationControls";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
export default function Controls(p) {
|
|
25
|
+
var customToolbarButtons = p.options.customToolbarButtons;
|
|
26
|
+
var hasCustomButtons = customToolbarButtons && customToolbarButtons.length > 0;
|
|
27
|
+
return /*#__PURE__*/_jsx(Toolbar, _objectSpread(_objectSpread({}, p), {}, {
|
|
28
|
+
children: [HistoryControls, BlockTypesControls, TranslationControls, InlineStyleTypeControls, ListsControls, ListsIndentControls, LinkControls, SpecialCharactersControls].concat(_toConsumableArray(hasCustomButtons ? [CustomControls] : []))
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomControls.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/CustomControls.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,CAAC,EAAE,aAAa,kDAiB1D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export default function BlockTypesControls(p) {
|
|
10
|
+
var customToolbarButtons = p.options.customToolbarButtons;
|
|
11
|
+
if (!customToolbarButtons || customToolbarButtons.length < 1) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return /*#__PURE__*/_jsx(ButtonGroup, {
|
|
15
|
+
children: customToolbarButtons.map(function (comp, idx) {
|
|
16
|
+
var Comp = comp;
|
|
17
|
+
return /*#__PURE__*/_jsx(Comp, _objectSpread({}, p), idx);
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ThemedComponentBaseProps } from "@dextinity/admin";
|
|
2
|
+
import { type ComponentsOverrides, ListItemIcon as MuiListItemIcon, MenuItem, type Theme } from "@mui/material";
|
|
3
|
+
import type { Editor } from "draft-js";
|
|
4
|
+
import { type RefObject } from "react";
|
|
5
|
+
import type { IFeatureConfig } from "../types";
|
|
6
|
+
interface IProps extends ThemedComponentBaseProps<{
|
|
7
|
+
root: "div";
|
|
8
|
+
buttonWrapper: "div";
|
|
9
|
+
listItem: typeof MenuItem;
|
|
10
|
+
listItemIcon: typeof MuiListItemIcon;
|
|
11
|
+
}> {
|
|
12
|
+
features: IFeatureConfig[];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
editorRef: RefObject<Editor | null>;
|
|
15
|
+
maxVisible?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function FeaturesButtonGroup(inProps: IProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export type RteFeaturesButtonGroupClassKey = "root" | "buttonWrapper" | "listItem" | "listItemIcon";
|
|
19
|
+
declare module "@mui/material/styles" {
|
|
20
|
+
interface ComponentNameToClassKey {
|
|
21
|
+
CometAdminRteFeaturesButtonGroup: RteFeaturesButtonGroupClassKey;
|
|
22
|
+
}
|
|
23
|
+
interface Components {
|
|
24
|
+
CometAdminRteFeaturesButtonGroup?: {
|
|
25
|
+
styleOverrides?: ComponentsOverrides<Theme>["CometAdminRteFeaturesButtonGroup"];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=FeaturesButtonGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeaturesButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/FeaturesButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,wBAAwB,EAAW,MAAM,kBAAkB,CAAC;AAE/F,OAAO,EAAE,KAAK,mBAAmB,EAAO,YAAY,IAAI,eAAe,EAAQ,QAAQ,EAAE,KAAK,KAAK,EAAiB,MAAM,eAAe,CAAC;AAC1I,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAmB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,UAAU,MACN,SAAQ,wBAAwB,CAAC;IAC7B,IAAI,EAAE,KAAK,CAAC;IACZ,aAAa,EAAE,KAAK,CAAC;IACrB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,YAAY,EAAE,OAAO,eAAe,CAAC;CACxC,CAAC;IACF,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,kDA4FlD;AAED,MAAM,MAAM,8BAA8B,GAAG,MAAM,GAAG,eAAe,GAAG,UAAU,GAAG,cAAc,CAAC;AAkCpG,OAAO,QAAQ,sBAAsB,CAAC;IAClC,UAAU,uBAAuB;QAC7B,gCAAgC,EAAE,8BAA8B,CAAC;KACpE;IAED,UAAU,UAAU;QAChB,gCAAgC,CAAC,EAAE;YAC/B,cAAc,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,kCAAkC,CAAC,CAAC;SACnF,CAAC;KACL;CACJ"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
var _excluded = ["features", "disabled", "editorRef", "maxVisible", "slotProps"],
|
|
4
|
+
_excluded2 = ["name", "onButtonClick", "tooltipText", "disabled"];
|
|
5
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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; } }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
19
|
+
import { createComponentSlot, Tooltip } from "@dextinity/admin";
|
|
20
|
+
import { MoreHorizontal } from "@dextinity/admin-icons";
|
|
21
|
+
import { css, ListItemIcon as MuiListItemIcon, Menu, MenuItem, useThemeProps } from "@mui/material";
|
|
22
|
+
import { useState, createElement as _createElement } from "react";
|
|
23
|
+
import { FormattedMessage } from "react-intl";
|
|
24
|
+
import { ControlButton } from "./ControlButton";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
export function FeaturesButtonGroup(inProps) {
|
|
27
|
+
var _useThemeProps = useThemeProps({
|
|
28
|
+
props: inProps,
|
|
29
|
+
name: "CometAdminRteFeaturesButtonGroup"
|
|
30
|
+
}),
|
|
31
|
+
features = _useThemeProps.features,
|
|
32
|
+
globallyDisabled = _useThemeProps.disabled,
|
|
33
|
+
editorRef = _useThemeProps.editorRef,
|
|
34
|
+
maxVisible = _useThemeProps.maxVisible,
|
|
35
|
+
slotProps = _useThemeProps.slotProps,
|
|
36
|
+
restProps = _objectWithoutProperties(_useThemeProps, _excluded);
|
|
37
|
+
var _useState = useState(null),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
anchorEl = _useState2[0],
|
|
40
|
+
setAnchorEl = _useState2[1];
|
|
41
|
+
var handleMoreOptionsClick = function handleMoreOptionsClick(event) {
|
|
42
|
+
setAnchorEl(event.currentTarget);
|
|
43
|
+
};
|
|
44
|
+
var handleMenuClose = function handleMenuClose() {
|
|
45
|
+
setAnchorEl(null);
|
|
46
|
+
setTimeout(function () {
|
|
47
|
+
if (editorRef.current) {
|
|
48
|
+
editorRef.current.focus();
|
|
49
|
+
}
|
|
50
|
+
}, 0);
|
|
51
|
+
};
|
|
52
|
+
if (!features.length) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Ensures that the dropdown never contains only one feature and that maximum {maxVisible} buttons are shown
|
|
57
|
+
// If maxVisible = 4 and there are four features -> all four features (and no dropdown) are shown
|
|
58
|
+
// If maxVisible = 4 and there are five features -> three features and the dropdown (containing two features) are shown
|
|
59
|
+
var visibleFeatures = maxVisible !== undefined && features.length > maxVisible ? features.slice(0, maxVisible - 1) : features;
|
|
60
|
+
var additionalFeatures = maxVisible !== undefined && features.length > maxVisible ? features.slice(maxVisible - 1) : [];
|
|
61
|
+
return /*#__PURE__*/_jsxs(Root, _objectSpread(_objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root), restProps), {}, {
|
|
62
|
+
children: [visibleFeatures.map(function (_ref) {
|
|
63
|
+
var name = _ref.name,
|
|
64
|
+
onButtonClick = _ref.onButtonClick,
|
|
65
|
+
tooltipText = _ref.tooltipText,
|
|
66
|
+
disabled = _ref.disabled,
|
|
67
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
68
|
+
return /*#__PURE__*/_createElement(ButtonWrapper, _objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.buttonWrapper), {}, {
|
|
69
|
+
key: name
|
|
70
|
+
}), tooltipText ? /*#__PURE__*/_jsx(Tooltip, {
|
|
71
|
+
title: tooltipText,
|
|
72
|
+
placement: "top",
|
|
73
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
74
|
+
children: /*#__PURE__*/_jsx(ControlButton, _objectSpread({
|
|
75
|
+
onButtonClick: onButtonClick,
|
|
76
|
+
disabled: globallyDisabled || disabled
|
|
77
|
+
}, rest))
|
|
78
|
+
})
|
|
79
|
+
}) : /*#__PURE__*/_jsx(ControlButton, _objectSpread({
|
|
80
|
+
onButtonClick: onButtonClick,
|
|
81
|
+
disabled: globallyDisabled || disabled
|
|
82
|
+
}, rest)));
|
|
83
|
+
}), additionalFeatures.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
84
|
+
children: [/*#__PURE__*/_jsx(ButtonWrapper, _objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.buttonWrapper), {}, {
|
|
85
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
86
|
+
title: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
87
|
+
id: "comet.rte.controls.moreOptionsTooltip",
|
|
88
|
+
defaultMessage: "More options"
|
|
89
|
+
}),
|
|
90
|
+
placement: "top",
|
|
91
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
92
|
+
children: /*#__PURE__*/_jsx(ControlButton, {
|
|
93
|
+
onButtonClick: handleMoreOptionsClick,
|
|
94
|
+
disabled: globallyDisabled,
|
|
95
|
+
icon: MoreHorizontal
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})), /*#__PURE__*/_jsx(Menu, {
|
|
100
|
+
open: Boolean(anchorEl),
|
|
101
|
+
anchorEl: anchorEl,
|
|
102
|
+
onClose: handleMenuClose,
|
|
103
|
+
children: additionalFeatures.map(function (_ref2) {
|
|
104
|
+
var name = _ref2.name,
|
|
105
|
+
onButtonClick = _ref2.onButtonClick,
|
|
106
|
+
disabled = _ref2.disabled,
|
|
107
|
+
selected = _ref2.selected,
|
|
108
|
+
label = _ref2.label,
|
|
109
|
+
Icon = _ref2.icon;
|
|
110
|
+
return /*#__PURE__*/_jsxs(ListItem, _objectSpread(_objectSpread({
|
|
111
|
+
onMouseDown: function onMouseDown(event) {
|
|
112
|
+
handleMenuClose();
|
|
113
|
+
|
|
114
|
+
// See https://reactjs.org/docs/legacy-event-pooling.html for more information.
|
|
115
|
+
event.persist();
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
onButtonClick === null || onButtonClick === void 0 || onButtonClick(event);
|
|
118
|
+
}, 0);
|
|
119
|
+
},
|
|
120
|
+
disabled: globallyDisabled || disabled,
|
|
121
|
+
selected: selected
|
|
122
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.listItem), {}, {
|
|
123
|
+
children: [label, Icon && /*#__PURE__*/_jsx(ListItemIcon, _objectSpread(_objectSpread({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.listItemIcon), {}, {
|
|
124
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
|
125
|
+
}))]
|
|
126
|
+
}), name);
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
})]
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
var Root = createComponentSlot("div")({
|
|
133
|
+
componentName: "RteFeaturesButtonGroup",
|
|
134
|
+
slotName: "root"
|
|
135
|
+
})(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n justify-content: flex-start;\n"]))));
|
|
136
|
+
var ButtonWrapper = createComponentSlot("div")({
|
|
137
|
+
componentName: "RteFeaturesButtonGroup",
|
|
138
|
+
slotName: "buttonWrapper"
|
|
139
|
+
})(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: 1px;\n &:last-child {\n margin-right: 0;\n }\n"]))));
|
|
140
|
+
var ListItem = createComponentSlot(MenuItem)({
|
|
141
|
+
componentName: "RteFeaturesButtonGroup",
|
|
142
|
+
slotName: "listItem"
|
|
143
|
+
})(css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: space-between;\n"]))));
|
|
144
|
+
var ListItemIcon = createComponentSlot(MuiListItemIcon)({
|
|
145
|
+
componentName: "RteFeaturesButtonGroup",
|
|
146
|
+
slotName: "listItemIcon"
|
|
147
|
+
})(css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n justify-content: flex-end;\n"]))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryContols.d.ts","sourceRoot":"","sources":["../../../src/core/Controls/HistoryContols.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,aAAa,kDAMnH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FeaturesButtonGroup } from "./FeaturesButtonGroup";
|
|
2
|
+
import useHistory from "./useHistory";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function HistoryControls(_ref) {
|
|
5
|
+
var editorState = _ref.editorState,
|
|
6
|
+
setEditorState = _ref.setEditorState,
|
|
7
|
+
options = _ref.options,
|
|
8
|
+
disabled = _ref.disabled,
|
|
9
|
+
editorRef = _ref.editorRef;
|
|
10
|
+
var _useHistory = useHistory({
|
|
11
|
+
editorState: editorState,
|
|
12
|
+
setEditorState: setEditorState,
|
|
13
|
+
supportedThings: options.supports
|
|
14
|
+
}),
|
|
15
|
+
features = _useHistory.features;
|
|
16
|
+
if (features.length < 1) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/_jsx(FeaturesButtonGroup, {
|
|
20
|
+
features: features,
|
|
21
|
+
disabled: disabled,
|
|
22
|
+
editorRef: editorRef
|
|
23
|
+
});
|
|
24
|
+
}
|