@uxf/wysiwyg 11.74.0 → 11.74.2
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/components.d.ts +7 -0
- package/components.js +34 -0
- package/config/icons-config.d.ts +2 -0
- package/config/icons-config.js +5 -0
- package/config/icons.d.ts +183 -0
- package/config/icons.js +51 -0
- package/create-all-plugins-with-ui.d.ts +64 -0
- package/create-all-plugins-with-ui.js +127 -0
- package/create-plugins-with-ui.d.ts +4 -0
- package/create-plugins-with-ui.js +47 -0
- package/hooks.d.ts +9 -0
- package/hooks.js +20 -0
- package/index.d.ts +6 -0
- package/index.js +38 -0
- package/package.json +3 -3
- package/plugins/blockquote/create-blockquote-plugin.d.ts +3 -0
- package/plugins/blockquote/create-blockquote-plugin.js +9 -0
- package/plugins/blockquote/types.d.ts +2 -0
- package/plugins/blockquote/types.js +6 -0
- package/plugins/button/constants.d.ts +2 -0
- package/plugins/button/constants.js +5 -0
- package/plugins/button/create-button-plugin.d.ts +2 -0
- package/plugins/button/create-button-plugin.js +11 -0
- package/plugins/button/index.d.ts +3 -0
- package/plugins/button/index.js +23 -0
- package/plugins/button/transforms/get-active-button.d.ts +2 -0
- package/plugins/button/transforms/get-active-button.js +9 -0
- package/plugins/button/transforms/index.d.ts +4 -0
- package/plugins/button/transforms/index.js +11 -0
- package/plugins/button/transforms/insert-button.d.ts +2 -0
- package/plugins/button/transforms/insert-button.js +16 -0
- package/plugins/button/transforms/is-button-active.d.ts +2 -0
- package/plugins/button/transforms/is-button-active.js +7 -0
- package/plugins/button/transforms/remove-selected-button.d.ts +2 -0
- package/plugins/button/transforms/remove-selected-button.js +13 -0
- package/plugins/button/transforms/update-button.d.ts +2 -0
- package/plugins/button/transforms/update-button.js +9 -0
- package/plugins/embedded/utils.d.ts +1 -0
- package/plugins/embedded/utils.js +7 -0
- package/plugins/embedded/video/create-video-plugin.d.ts +4 -0
- package/plugins/embedded/video/create-video-plugin.js +19 -0
- package/plugins/embedded/video/get-active-video.d.ts +2 -0
- package/plugins/embedded/video/get-active-video.js +9 -0
- package/plugins/embedded/video/insert-video.d.ts +2 -0
- package/plugins/embedded/video/insert-video.js +19 -0
- package/plugins/embedded/video/update-video.d.ts +2 -0
- package/plugins/embedded/video/update-video.js +12 -0
- package/plugins/exit-break/create-exit-break-plugin.d.ts +3 -0
- package/plugins/exit-break/create-exit-break-plugin.js +30 -0
- package/plugins/heading/constants.d.ts +8 -0
- package/plugins/heading/constants.js +11 -0
- package/plugins/heading/create-headings-plugin.d.ts +8 -0
- package/plugins/heading/create-headings-plugin.js +40 -0
- package/plugins/highlight/createHighlightPlugin.d.ts +3 -0
- package/plugins/highlight/createHighlightPlugin.js +27 -0
- package/plugins/highlight/types.d.ts +10 -0
- package/plugins/highlight/types.js +4 -0
- package/plugins/image/create-image-plugin.d.ts +6 -0
- package/plugins/image/create-image-plugin.js +105 -0
- package/plugins/image/hooks/use-image-handlers.d.ts +5 -0
- package/plugins/image/hooks/use-image-handlers.js +19 -0
- package/plugins/image/transforms/get-active-image.d.ts +2 -0
- package/plugins/image/transforms/get-active-image.js +9 -0
- package/plugins/image/transforms/insert-image.d.ts +3 -0
- package/plugins/image/transforms/insert-image.js +19 -0
- package/plugins/image/transforms/is-image-active.d.ts +2 -0
- package/plugins/image/transforms/is-image-active.js +7 -0
- package/plugins/image/transforms/remove-selected-image.d.ts +2 -0
- package/plugins/image/transforms/remove-selected-image.js +13 -0
- package/plugins/image/transforms/update-image.d.ts +3 -0
- package/plugins/image/transforms/update-image.js +12 -0
- package/plugins/image/types.d.ts +12 -0
- package/plugins/image/types.js +6 -0
- package/plugins/image/utils/is-image-url.d.ts +2 -0
- package/plugins/image/utils/is-image-url.js +135 -0
- package/plugins/image/with-image.d.ts +7 -0
- package/plugins/image/with-image.js +19 -0
- package/plugins/image/with-paste-image-url.d.ts +7 -0
- package/plugins/image/with-paste-image-url.js +36 -0
- package/plugins/image/with-paste-image.d.ts +7 -0
- package/plugins/image/with-paste-image.js +49 -0
- package/plugins/link/constants.d.ts +2 -0
- package/plugins/link/constants.js +6 -0
- package/plugins/link/create-link-plugin.d.ts +3 -0
- package/plugins/link/create-link-plugin.js +15 -0
- package/plugins/link/floating-link-wrapper.d.ts +11 -0
- package/plugins/link/floating-link-wrapper.js +26 -0
- package/plugins/link/hooks/index.d.ts +4 -0
- package/plugins/link/hooks/index.js +11 -0
- package/plugins/link/hooks/use-link-actions.d.ts +12 -0
- package/plugins/link/hooks/use-link-actions.js +48 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +1 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.js +5 -0
- package/plugins/link/hooks/use-link-submit-on-enter.d.ts +1 -0
- package/plugins/link/hooks/use-link-submit-on-enter.js +23 -0
- package/plugins/link/transforms/get-active-link.d.ts +3 -0
- package/plugins/link/transforms/get-active-link.js +17 -0
- package/plugins/link/transforms/insert-link.d.ts +2 -0
- package/plugins/link/transforms/insert-link.js +27 -0
- package/plugins/link/transforms/is-link-selected.d.ts +2 -0
- package/plugins/link/transforms/is-link-selected.js +15 -0
- package/plugins/link/transforms/submit-link.d.ts +8 -0
- package/plugins/link/transforms/submit-link.js +36 -0
- package/plugins/link/transforms/trigger-link-insert-or-edit.d.ts +2 -0
- package/plugins/link/transforms/trigger-link-insert-or-edit.js +6 -0
- package/plugins/link/transforms/unwrap-link.d.ts +2 -0
- package/plugins/link/transforms/unwrap-link.js +10 -0
- package/plugins/link/types.d.ts +5 -0
- package/plugins/link/types.js +2 -0
- package/plugins/list/constants.d.ts +4 -0
- package/plugins/list/constants.js +14 -0
- package/plugins/list/create-list-plugin.d.ts +4 -0
- package/plugins/list/create-list-plugin.js +16 -0
- package/plugins/mark-bold/create-bold-plugin.d.ts +3 -0
- package/plugins/mark-bold/create-bold-plugin.js +6 -0
- package/plugins/mark-bold/types.d.ts +2 -0
- package/plugins/mark-bold/types.js +6 -0
- package/plugins/mark-code/create-code-plugin.d.ts +3 -0
- package/plugins/mark-code/create-code-plugin.js +6 -0
- package/plugins/mark-code/types.d.ts +2 -0
- package/plugins/mark-code/types.js +6 -0
- package/plugins/mark-italic/create-italic-plugin.d.ts +3 -0
- package/plugins/mark-italic/create-italic-plugin.js +6 -0
- package/plugins/mark-italic/types.d.ts +2 -0
- package/plugins/mark-italic/types.js +6 -0
- package/plugins/mark-underline/create-underline-plugin.d.ts +3 -0
- package/plugins/mark-underline/create-underline-plugin.js +6 -0
- package/plugins/mark-underline/types.d.ts +2 -0
- package/plugins/mark-underline/types.js +6 -0
- package/plugins/node-id/add-ids-to-nodes.d.ts +2 -0
- package/plugins/node-id/add-ids-to-nodes.js +22 -0
- package/plugins/node-id/create-node-id-plugin.d.ts +3 -0
- package/plugins/node-id/create-node-id-plugin.js +6 -0
- package/plugins/paragraph/create-paragraph-plugin.d.ts +3 -0
- package/plugins/paragraph/create-paragraph-plugin.js +9 -0
- package/plugins/paragraph/types.d.ts +2 -0
- package/plugins/paragraph/types.js +6 -0
- package/plugins/reset-node/create-reset-node.d.ts +3 -0
- package/plugins/reset-node/create-reset-node.js +28 -0
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +3 -0
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +14 -0
- package/plugins/soft-break/create-soft-break-plugin.d.ts +3 -0
- package/plugins/soft-break/create-soft-break-plugin.js +22 -0
- package/plugins/trailing-block/create-trailing-block-plugin.d.ts +3 -0
- package/plugins/trailing-block/create-trailing-block-plugin.js +6 -0
- package/serializers/serialize-to-plaintext.d.ts +2 -0
- package/serializers/serialize-to-plaintext.js +8 -0
- package/translations/cs.json +134 -0
- package/translations/de.json +134 -0
- package/translations/en.json +134 -0
- package/translations/sk.json +134 -0
- package/types.d.ts +118 -0
- package/types.js +2 -0
- package/ui/blockquote-element.d.ts +2 -0
- package/ui/blockquote-element.js +13 -0
- package/ui/bold-mark.d.ts +2 -0
- package/ui/bold-mark.js +13 -0
- package/ui/button/button-element.d.ts +2 -0
- package/ui/button/button-element.js +54 -0
- package/ui/button/index.d.ts +1 -0
- package/ui/button/index.js +5 -0
- package/ui/button/insert-button-modal-content.d.ts +8 -0
- package/ui/button/insert-button-modal-content.js +81 -0
- package/ui/code-mark.d.ts +2 -0
- package/ui/code-mark.js +13 -0
- package/ui/components/element/element-action-buttons.d.ts +9 -0
- package/ui/components/element/element-action-buttons.js +22 -0
- package/ui/components/element/element-with-action-buttons.d.ts +10 -0
- package/ui/components/element/element-with-action-buttons.js +17 -0
- package/ui/components/modal/modal-button-cancel.d.ts +9 -0
- package/ui/components/modal/modal-button-cancel.js +45 -0
- package/ui/components/modal/modal-button-submit.d.ts +6 -0
- package/ui/components/modal/modal-button-submit.js +12 -0
- package/ui/components/modal/modal-buttons.d.ts +11 -0
- package/ui/components/modal/modal-buttons.js +16 -0
- package/ui/components/modal/modal-content.d.ts +6 -0
- package/ui/components/modal/modal-content.js +14 -0
- package/ui/create-uxf-ui.d.ts +21 -0
- package/ui/create-uxf-ui.js +51 -0
- package/ui/floating-link.d.ts +2 -0
- package/ui/floating-link.js +110 -0
- package/ui/heading-elements.d.ts +7 -0
- package/ui/heading-elements.js +38 -0
- package/ui/highlight-mark.d.ts +3 -0
- package/ui/highlight-mark.js +13 -0
- package/ui/image/image-element.d.ts +2 -0
- package/ui/image/image-element.js +53 -0
- package/ui/image/insert-image-modal-content.d.ts +8 -0
- package/ui/image/insert-image-modal-content.js +89 -0
- package/ui/italic-mark.d.ts +2 -0
- package/ui/italic-mark.js +13 -0
- package/ui/link-element.d.ts +3 -0
- package/ui/link-element.js +14 -0
- package/ui/list-item-element.d.ts +2 -0
- package/ui/list-item-element.js +13 -0
- package/ui/list-ordered-element.d.ts +2 -0
- package/ui/list-ordered-element.js +13 -0
- package/ui/list-unordered-element.d.ts +2 -0
- package/ui/list-unordered-element.js +13 -0
- package/ui/paragraph-element.d.ts +2 -0
- package/ui/paragraph-element.js +13 -0
- package/ui/toolbar/buttons/button-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/button-toolbar-button.js +20 -0
- package/ui/toolbar/buttons/element-toolbar-button.d.ts +12 -0
- package/ui/toolbar/buttons/element-toolbar-button.js +25 -0
- package/ui/toolbar/buttons/image-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/image-toolbar-button.js +20 -0
- package/ui/toolbar/buttons/link-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/link-toolbar-button.js +29 -0
- package/ui/toolbar/buttons/list-toolbar-button.d.ts +13 -0
- package/ui/toolbar/buttons/list-toolbar-button.js +27 -0
- package/ui/toolbar/buttons/mark-toolbar-button.d.ts +13 -0
- package/ui/toolbar/buttons/mark-toolbar-button.js +25 -0
- package/ui/toolbar/buttons/modal-toolbar-button.d.ts +15 -0
- package/ui/toolbar/buttons/modal-toolbar-button.js +22 -0
- package/ui/toolbar/buttons/toolbar-button.d.ts +15 -0
- package/ui/toolbar/buttons/toolbar-button.js +35 -0
- package/ui/toolbar/buttons/undo-redo-button-group.d.ts +8 -0
- package/ui/toolbar/buttons/undo-redo-button-group.js +64 -0
- package/ui/toolbar/buttons/video-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/video-toolbar-button.js +20 -0
- package/ui/toolbar/toolbar.d.ts +3 -0
- package/ui/toolbar/toolbar.js +77 -0
- package/ui/toolbar/types.d.ts +8 -0
- package/ui/toolbar/types.js +2 -0
- package/ui/underline-mark.d.ts +2 -0
- package/ui/underline-mark.js +13 -0
- package/ui/utils.d.ts +2 -0
- package/ui/utils.js +13 -0
- package/ui/video/insert-video-modal-content.d.ts +8 -0
- package/ui/video/insert-video-modal-content.js +80 -0
- package/ui/video/video-element.d.ts +2 -0
- package/ui/video/video-element.js +55 -0
- package/utils/get-video-meta-data.d.ts +2 -0
- package/utils/get-video-meta-data.js +41 -0
- package/utils/url-helper.d.ts +7 -0
- package/utils/url-helper.js +15 -0
- package/utils/url-helper.test.d.ts +1 -0
- package/utils/url-helper.test.js +37 -0
- package/utils.d.ts +30 -0
- package/utils.js +88 -0
- package/wysiwyg-editor.d.ts +15 -0
- package/wysiwyg-editor.js +42 -0
- package/wysiwyg-editor.stories.d.ts +5 -0
- package/wysiwyg-editor.stories.js +193 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ListUnorderedElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const ListUnorderedElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("ul", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-list-unordered ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.ListUnorderedElement = ListUnorderedElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ParagraphElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const ParagraphElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("p", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-paragraph${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.ParagraphElement = ParagraphElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface ButtonToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName?: IconName;
|
|
7
|
+
plateId: PlateId;
|
|
8
|
+
}
|
|
9
|
+
export declare const ButtonToolbarButton: FC<ButtonToolbarButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ButtonToolbarButton = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const button_1 = require("../../../plugins/button");
|
|
11
|
+
const insert_button_modal_content_1 = require("../../button/insert-button-modal-content");
|
|
12
|
+
const modal_toolbar_button_1 = require("./modal-toolbar-button");
|
|
13
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
+
const ButtonToolbarButton = (props) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
17
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
18
|
+
return (react_1.default.createElement(modal_toolbar_button_1.ModalToolbarButton, { Modal: react_1.default.createElement(insert_button_modal_content_1.InsertButtonModalContent, { editor: editor }), className: `${CLASS_NAME} ${CLASS_NAME}-button ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: (_b = props.iconName) !== null && _b !== void 0 ? _b : "rectangle-wide", pluginKey: button_1.PLUGIN_BUTTON_KEY, tooltipText: t("uxf-wysiwyg:plugins.button.tooltip") }));
|
|
19
|
+
};
|
|
20
|
+
exports.ButtonToolbarButton = ButtonToolbarButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface ElementToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName: IconName;
|
|
7
|
+
plateId: PlateId;
|
|
8
|
+
pluginKey: string;
|
|
9
|
+
tooltipText: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const ElementToolbarButton: FC<ElementToolbarButtonProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ElementToolbarButton = void 0;
|
|
7
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const toolbar_button_1 = require("./toolbar-button");
|
|
12
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
13
|
+
const ElementToolbarButton = (props) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
16
|
+
const type = (0, utils_1.getPluginType)(editor, props.pluginKey);
|
|
17
|
+
const isActive = (0, is_not_nil_1.isNotNil)(editor.selection) && (0, utils_1.isRangeInSingleText)(editor) && (0, utils_1.someNode)(editor, { match: { type: type } });
|
|
18
|
+
const onMouseDown = () => {
|
|
19
|
+
(0, utils_1.toggleNodeType)(editor, {
|
|
20
|
+
activeType: type,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return (react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: `${CLASS_NAME} ${CLASS_NAME}-element ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: props.iconName, isActive: isActive, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText }));
|
|
24
|
+
};
|
|
25
|
+
exports.ElementToolbarButton = ElementToolbarButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface ImageToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName?: IconName;
|
|
7
|
+
plateId: PlateId;
|
|
8
|
+
}
|
|
9
|
+
export declare const ImageToolbarButton: FC<ImageToolbarButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ImageToolbarButton = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const types_1 = require("../../../plugins/image/types");
|
|
11
|
+
const insert_image_modal_content_1 = require("../../image/insert-image-modal-content");
|
|
12
|
+
const modal_toolbar_button_1 = require("./modal-toolbar-button");
|
|
13
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
+
const ImageToolbarButton = (props) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
17
|
+
const editor = (0, hooks_1.useUxfPlateEditorRef)(props.plateId);
|
|
18
|
+
return (react_1.default.createElement(modal_toolbar_button_1.ModalToolbarButton, { Modal: react_1.default.createElement(insert_image_modal_content_1.InsertImageModalContent, { editor: editor }), className: `${CLASS_NAME} ${CLASS_NAME}-image ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: (_b = props.iconName) !== null && _b !== void 0 ? _b : "image", pluginKey: types_1.IMAGE_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.image.tooltip") }));
|
|
19
|
+
};
|
|
20
|
+
exports.ImageToolbarButton = ImageToolbarButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface LinkToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName?: IconName;
|
|
7
|
+
plateId: PlateId;
|
|
8
|
+
}
|
|
9
|
+
export declare const LinkToolbarButton: FC<LinkToolbarButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LinkToolbarButton = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const constants_1 = require("../../../plugins/link/constants");
|
|
11
|
+
const is_link_selected_1 = require("../../../plugins/link/transforms/is-link-selected");
|
|
12
|
+
const trigger_link_insert_or_edit_1 = require("../../../plugins/link/transforms/trigger-link-insert-or-edit");
|
|
13
|
+
const utils_1 = require("../../../utils");
|
|
14
|
+
const toolbar_button_1 = require("./toolbar-button");
|
|
15
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
16
|
+
const LinkToolbarButton = (props) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
19
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
20
|
+
const isLink = (0, is_link_selected_1.isLinkSelected)(editor);
|
|
21
|
+
const onMouseDown = () => {
|
|
22
|
+
var _a;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
|
+
(0, utils_1.focusEditor)(editor, (_a = editor.selection) !== null && _a !== void 0 ? _a : editor.prevSelection);
|
|
25
|
+
(0, trigger_link_insert_or_edit_1.triggerLinkInsertOrEdit)(editor, true);
|
|
26
|
+
};
|
|
27
|
+
return (react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: `${CLASS_NAME} ${CLASS_NAME}-link ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: (_b = props.iconName) !== null && _b !== void 0 ? _b : "link", isActive: isLink, onMouseDown: onMouseDown, pluginKey: constants_1.ELEMENT_LINK, tooltipText: t("uxf-wysiwyg:plugins.link.tooltip") }));
|
|
28
|
+
};
|
|
29
|
+
exports.LinkToolbarButton = LinkToolbarButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import { LIST_ORDERED_TYPE, LIST_UNORDERED_TYPE } from "../../../plugins/list/constants";
|
|
5
|
+
interface ListToolbarButtonProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
iconName: IconName;
|
|
8
|
+
plateId: PlateId;
|
|
9
|
+
pluginKey: typeof LIST_UNORDERED_TYPE | typeof LIST_ORDERED_TYPE;
|
|
10
|
+
tooltipText: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ListToolbarButton: FC<ListToolbarButtonProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ListToolbarButton = void 0;
|
|
7
|
+
const plate_list_1 = require("@udecode/plate-list");
|
|
8
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const hooks_1 = require("../../../hooks");
|
|
11
|
+
const utils_1 = require("../../../utils");
|
|
12
|
+
const toolbar_button_1 = require("./toolbar-button");
|
|
13
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
+
const ListToolbarButton = (props) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
17
|
+
const type = (0, utils_1.getPluginType)(editor, props.pluginKey);
|
|
18
|
+
const res = (0, is_not_nil_1.isNotNil)(editor.selection) ? (0, plate_list_1.getListItemEntry)(editor) : undefined;
|
|
19
|
+
const isActive = (res === null || res === void 0 ? void 0 : res.list[0].type) === type;
|
|
20
|
+
const onMouseDown = () => {
|
|
21
|
+
(0, plate_list_1.toggleList)(editor, {
|
|
22
|
+
type,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return (react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: `${CLASS_NAME} ${CLASS_NAME}-list ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: props.iconName, isActive: isActive, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText }));
|
|
26
|
+
};
|
|
27
|
+
exports.ListToolbarButton = ListToolbarButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface LeafToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName: IconName;
|
|
7
|
+
iconSize?: number;
|
|
8
|
+
plateId: PlateId;
|
|
9
|
+
pluginKey: string;
|
|
10
|
+
tooltipText: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MarkToolbarButton: FC<LeafToolbarButtonProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MarkToolbarButton = void 0;
|
|
7
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const toolbar_button_1 = require("./toolbar-button");
|
|
12
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
13
|
+
const MarkToolbarButton = (props) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
16
|
+
const type = (0, utils_1.getPluginType)(editor, props.pluginKey);
|
|
17
|
+
const isActive = (0, is_not_nil_1.isNotNil)(editor.selection) && (0, utils_1.isMarkActive)(editor, type);
|
|
18
|
+
const onMouseDown = () => {
|
|
19
|
+
(0, utils_1.toggleMark)(editor, {
|
|
20
|
+
key: props.pluginKey,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return (react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: `${CLASS_NAME} ${CLASS_NAME}-mark ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: props.iconName, iconSize: (_b = props.iconSize) !== null && _b !== void 0 ? _b : 20, isActive: isActive, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText }));
|
|
24
|
+
};
|
|
25
|
+
exports.MarkToolbarButton = MarkToolbarButton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DialogPanelWidth } from "@uxf/ui/dialog";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC, ReactNode } from "react";
|
|
4
|
+
import { UxfEditor } from "../../../types";
|
|
5
|
+
interface ModalToolbarButtonProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
iconName: IconName;
|
|
8
|
+
modalWidth?: DialogPanelWidth;
|
|
9
|
+
Modal: ReactNode;
|
|
10
|
+
editor: UxfEditor;
|
|
11
|
+
pluginKey: string;
|
|
12
|
+
tooltipText: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ModalToolbarButton: FC<ModalToolbarButtonProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ModalToolbarButton = void 0;
|
|
7
|
+
const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
|
|
8
|
+
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const toolbar_button_1 = require("./toolbar-button");
|
|
11
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
12
|
+
const ModalToolbarButton = (props) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const onMouseDown = () => {
|
|
15
|
+
var _a;
|
|
16
|
+
(0, modal_service_1.openModal)({
|
|
17
|
+
children: react_1.default.createElement(dialog_panel_1.DialogPanel, { width: (_a = props.modalWidth) !== null && _a !== void 0 ? _a : "lg" }, props.Modal),
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return (react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: `${CLASS_NAME} ${CLASS_NAME}-modal ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: props.editor, iconName: props.iconName, isActive: false, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText }));
|
|
21
|
+
};
|
|
22
|
+
exports.ModalToolbarButton = ModalToolbarButton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
2
|
+
import { FC, MouseEventHandler } from "react";
|
|
3
|
+
import { UxfEditor } from "../../../types";
|
|
4
|
+
interface ToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
editor: UxfEditor;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
pluginKey: string;
|
|
9
|
+
onMouseDown: MouseEventHandler<HTMLAnchorElement>;
|
|
10
|
+
iconName: IconName;
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
tooltipText: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ToolbarButton: FC<ToolbarButtonProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ToolbarButton = void 0;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const icon_1 = require("@uxf/ui/icon");
|
|
9
|
+
const tooltip_1 = require("@uxf/ui/tooltip");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const utils_1 = require("../../../utils");
|
|
12
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
13
|
+
const ToolbarButton = (props) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const onMouseDown = props.onMouseDown;
|
|
16
|
+
/* `onPointerDown` must be used, because Editor loses focus on `onClick`. */
|
|
17
|
+
const onLeftMouseDown = (e) => {
|
|
18
|
+
if (e.button === 0) {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
onMouseDown(e);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (!(0, utils_1.isPluginEnabled)(props.editor, props.pluginKey)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const button = (react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME} ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, isIconButton: true, onPointerDown: onLeftMouseDown, variant: props.isActive ? "default" : "secondary" },
|
|
28
|
+
react_1.default.createElement(icon_1.Icon, { className: `${CLASS_NAME}__icon`, name: props.iconName, size: (_b = props.iconSize) !== null && _b !== void 0 ? _b : 20 })));
|
|
29
|
+
/* This detects touch input. */
|
|
30
|
+
if (window.matchMedia("(pointer: coarse)").matches) {
|
|
31
|
+
return button;
|
|
32
|
+
}
|
|
33
|
+
return (react_1.default.createElement(tooltip_1.Tooltip, { className: `${CLASS_NAME}__tooltip`, content: props.tooltipText }, button));
|
|
34
|
+
};
|
|
35
|
+
exports.ToolbarButton = ToolbarButton;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.UndoRedoButtonGroup = void 0;
|
|
27
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
28
|
+
const button_1 = require("@uxf/ui/button");
|
|
29
|
+
const button_group_1 = require("@uxf/ui/button-group");
|
|
30
|
+
const icon_1 = require("@uxf/ui/icon");
|
|
31
|
+
const tooltip_1 = require("@uxf/ui/tooltip");
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const hooks_1 = require("../../../hooks");
|
|
34
|
+
const utils_1 = require("../../../utils");
|
|
35
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
36
|
+
const UndoRedoButtonGroup = (props) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
39
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
40
|
+
const undoHandler = (0, react_1.useCallback)((e) => {
|
|
41
|
+
if (e.button === 0) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
editor.undo();
|
|
45
|
+
(0, utils_1.focusEditor)(editor);
|
|
46
|
+
}
|
|
47
|
+
}, [editor]);
|
|
48
|
+
const redoHandler = (0, react_1.useCallback)((e) => {
|
|
49
|
+
if (e.button === 0) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
editor.redo();
|
|
53
|
+
(0, utils_1.focusEditor)(editor);
|
|
54
|
+
}
|
|
55
|
+
}, [editor]);
|
|
56
|
+
return (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${CLASS_NAME}-group ${CLASS_NAME}-group-undo-redo ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
57
|
+
react_1.default.createElement(tooltip_1.Tooltip, { content: t("uxf-wysiwyg:plugins.actions.undo.tooltip") },
|
|
58
|
+
react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME} ${CLASS_NAME}-undo`, isDisabled: editor.history.undos.length === 0, isIconButton: true, onMouseDown: undoHandler, variant: "secondary" },
|
|
59
|
+
react_1.default.createElement(icon_1.Icon, { className: `${CLASS_NAME}__icon`, name: "arrow-turn-down-left", size: 16 }))),
|
|
60
|
+
react_1.default.createElement(tooltip_1.Tooltip, { content: t("uxf-wysiwyg:plugins.actions.redo.tooltip") },
|
|
61
|
+
react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME} ${CLASS_NAME}-redo`, isDisabled: editor.history.redos.length === 0, isIconButton: true, onMouseDown: redoHandler, variant: "secondary" },
|
|
62
|
+
react_1.default.createElement(icon_1.Icon, { className: `${CLASS_NAME}__icon`, name: "arrow-turn-down-right", size: 16 })))));
|
|
63
|
+
};
|
|
64
|
+
exports.UndoRedoButtonGroup = UndoRedoButtonGroup;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { IconName } from "@uxf/ui/icon/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
interface EmbedMediaToolbarButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
iconName?: IconName;
|
|
7
|
+
plateId: PlateId;
|
|
8
|
+
}
|
|
9
|
+
export declare const VideoToolbarButton: FC<EmbedMediaToolbarButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VideoToolbarButton = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../../hooks");
|
|
10
|
+
const create_video_plugin_1 = require("../../../plugins/embedded/video/create-video-plugin");
|
|
11
|
+
const insert_video_modal_content_1 = require("../../video/insert-video-modal-content");
|
|
12
|
+
const modal_toolbar_button_1 = require("./modal-toolbar-button");
|
|
13
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
+
const VideoToolbarButton = (props) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
17
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
18
|
+
return (react_1.default.createElement(modal_toolbar_button_1.ModalToolbarButton, { Modal: react_1.default.createElement(insert_video_modal_content_1.InsertVideoModalContent, { editor: editor }), className: `${CLASS_NAME} ${CLASS_NAME}-video ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, editor: editor, iconName: (_b = props.iconName) !== null && _b !== void 0 ? _b : "youtube", pluginKey: create_video_plugin_1.ELEMENT_VIDEO_EMBED, tooltipText: t("uxf-wysiwyg:plugins.video.tooltip") }));
|
|
19
|
+
};
|
|
20
|
+
exports.VideoToolbarButton = VideoToolbarButton;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Toolbar = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const button_group_1 = require("@uxf/ui/button-group");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
11
|
+
const types_1 = require("../../plugins/blockquote/types");
|
|
12
|
+
const button_1 = require("../../plugins/button");
|
|
13
|
+
const create_video_plugin_1 = require("../../plugins/embedded/video/create-video-plugin");
|
|
14
|
+
const constants_1 = require("../../plugins/heading/constants");
|
|
15
|
+
const types_2 = require("../../plugins/highlight/types");
|
|
16
|
+
const types_3 = require("../../plugins/image/types");
|
|
17
|
+
const constants_2 = require("../../plugins/link/constants");
|
|
18
|
+
const constants_3 = require("../../plugins/list/constants");
|
|
19
|
+
const types_4 = require("../../plugins/mark-bold/types");
|
|
20
|
+
const types_5 = require("../../plugins/mark-code/types");
|
|
21
|
+
const types_6 = require("../../plugins/mark-italic/types");
|
|
22
|
+
const types_7 = require("../../plugins/mark-underline/types");
|
|
23
|
+
const utils_1 = require("../../utils");
|
|
24
|
+
const button_toolbar_button_1 = require("./buttons/button-toolbar-button");
|
|
25
|
+
const element_toolbar_button_1 = require("./buttons/element-toolbar-button");
|
|
26
|
+
const image_toolbar_button_1 = require("./buttons/image-toolbar-button");
|
|
27
|
+
const link_toolbar_button_1 = require("./buttons/link-toolbar-button");
|
|
28
|
+
const list_toolbar_button_1 = require("./buttons/list-toolbar-button");
|
|
29
|
+
const mark_toolbar_button_1 = require("./buttons/mark-toolbar-button");
|
|
30
|
+
const undo_redo_button_group_1 = require("./buttons/undo-redo-button-group");
|
|
31
|
+
const video_toolbar_button_1 = require("./buttons/video-toolbar-button");
|
|
32
|
+
const CLASS_NAME = "uxf-wysiwyg__toolbar";
|
|
33
|
+
const BUTTON_GROUP_CLASS_NAME = `${CLASS_NAME}-button-group`;
|
|
34
|
+
const Toolbar = (props) => {
|
|
35
|
+
var _a;
|
|
36
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
37
|
+
const { customPluginsButtons, leftElement, plateId, rightElement, ...restProps } = props;
|
|
38
|
+
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
39
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
40
|
+
return (react_1.default.createElement("div", { ...restProps, className: `${CLASS_NAME} ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
41
|
+
leftElement,
|
|
42
|
+
react_1.default.createElement("div", { className: `${CLASS_NAME}-buttons` },
|
|
43
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, constants_1.KEYS_HEADING) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-headings` },
|
|
44
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h1", plateId: plateId, pluginKey: constants_1.ELEMENT_H1, tooltipText: t("uxf-wysiwyg:plugins.headings.h1.tooltip") }),
|
|
45
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h2", plateId: plateId, pluginKey: constants_1.ELEMENT_H2, tooltipText: t("uxf-wysiwyg:plugins.headings.h2.tooltip") }),
|
|
46
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h3", plateId: plateId, pluginKey: constants_1.ELEMENT_H3, tooltipText: t("uxf-wysiwyg:plugins.headings.h3.tooltip") }),
|
|
47
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h4", plateId: plateId, pluginKey: constants_1.ELEMENT_H4, tooltipText: t("uxf-wysiwyg:plugins.headings.h4.tooltip") }),
|
|
48
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h5", plateId: plateId, pluginKey: constants_1.ELEMENT_H5, tooltipText: t("uxf-wysiwyg:plugins.headings.h5.tooltip") }),
|
|
49
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "h6", plateId: plateId, pluginKey: constants_1.ELEMENT_H6, tooltipText: t("uxf-wysiwyg:plugins.headings.h6.tooltip") }))),
|
|
50
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, [
|
|
51
|
+
types_4.BOLD_PLUGIN_KEY,
|
|
52
|
+
types_6.ITALIC_PLUGIN_KEY,
|
|
53
|
+
types_7.UNDER_LINE_PLUGIN_KEY,
|
|
54
|
+
types_5.CODE_PLUGIN_KEY,
|
|
55
|
+
types_2.HIGHLIGHT_PLUGIN_KEY,
|
|
56
|
+
]) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-marks` },
|
|
57
|
+
react_1.default.createElement(mark_toolbar_button_1.MarkToolbarButton, { iconName: "bold", iconSize: 12, plateId: plateId, pluginKey: types_4.BOLD_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.formatting.bold.tooltip") }),
|
|
58
|
+
react_1.default.createElement(mark_toolbar_button_1.MarkToolbarButton, { iconName: "italic", iconSize: 12, plateId: plateId, pluginKey: types_6.ITALIC_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.formatting.italic.tooltip") }),
|
|
59
|
+
react_1.default.createElement(mark_toolbar_button_1.MarkToolbarButton, { iconName: "underline", iconSize: 14, plateId: plateId, pluginKey: types_7.UNDER_LINE_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.formatting.underline.tooltip") }),
|
|
60
|
+
react_1.default.createElement(mark_toolbar_button_1.MarkToolbarButton, { iconName: "code-simple", plateId: plateId, pluginKey: types_5.CODE_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.formatting.code.tooltip") }),
|
|
61
|
+
react_1.default.createElement(mark_toolbar_button_1.MarkToolbarButton, { iconName: "highlighter-line", iconSize: 19, plateId: plateId, pluginKey: types_2.HIGHLIGHT_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.formatting.highlight.tooltip") }))),
|
|
62
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, [types_1.BLOCKQUOTE_PLUGIN_KEY]) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-blocks` },
|
|
63
|
+
react_1.default.createElement(element_toolbar_button_1.ElementToolbarButton, { iconName: "block-quote", plateId: plateId, pluginKey: types_1.BLOCKQUOTE_PLUGIN_KEY, tooltipText: t("uxf-wysiwyg:plugins.blocks.quote.tooltip") }))),
|
|
64
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, [constants_3.LIST_UNORDERED_TYPE, constants_3.LIST_ORDERED_TYPE]) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-lists` },
|
|
65
|
+
react_1.default.createElement(list_toolbar_button_1.ListToolbarButton, { iconName: "ul", plateId: plateId, pluginKey: constants_3.LIST_UNORDERED_TYPE, tooltipText: t("uxf-wysiwyg:plugins.lists.ul.tooltip") }),
|
|
66
|
+
react_1.default.createElement(list_toolbar_button_1.ListToolbarButton, { iconName: "ol", plateId: plateId, pluginKey: constants_3.LIST_ORDERED_TYPE, tooltipText: t("uxf-wysiwyg:plugins.lists.ol.tooltip") }))),
|
|
67
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, [constants_2.ELEMENT_LINK, button_1.PLUGIN_BUTTON_KEY]) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-clickables` },
|
|
68
|
+
react_1.default.createElement(link_toolbar_button_1.LinkToolbarButton, { plateId: plateId }),
|
|
69
|
+
react_1.default.createElement(button_toolbar_button_1.ButtonToolbarButton, { plateId: plateId }))),
|
|
70
|
+
(0, utils_1.isSomeOfPluginsEnabled)(editor, [types_3.IMAGE_PLUGIN_KEY, create_video_plugin_1.ELEMENT_VIDEO_EMBED]) && (react_1.default.createElement(button_group_1.ButtonGroup, { className: `${BUTTON_GROUP_CLASS_NAME} ${BUTTON_GROUP_CLASS_NAME}-media` },
|
|
71
|
+
react_1.default.createElement(image_toolbar_button_1.ImageToolbarButton, { plateId: plateId }),
|
|
72
|
+
react_1.default.createElement(video_toolbar_button_1.VideoToolbarButton, { plateId: plateId }))),
|
|
73
|
+
customPluginsButtons,
|
|
74
|
+
react_1.default.createElement(undo_redo_button_group_1.UndoRedoButtonGroup, { plateId: plateId })),
|
|
75
|
+
rightElement));
|
|
76
|
+
};
|
|
77
|
+
exports.Toolbar = Toolbar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PlateId } from "@udecode/plate-core";
|
|
2
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
export interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
customPluginsButtons?: ReactNode;
|
|
5
|
+
leftElement?: ReactNode;
|
|
6
|
+
plateId: PlateId;
|
|
7
|
+
rightElement?: ReactNode;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UnderlineMark = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const UnderlineMark = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("u", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-underline ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.UnderlineMark = UnderlineMark;
|
package/ui/utils.d.ts
ADDED
package/ui/utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.closeModalWithFocus = void 0;
|
|
4
|
+
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const closeModalWithFocus = (editor) => {
|
|
7
|
+
var _a;
|
|
8
|
+
(0, modal_service_1.closeModal)();
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
+
const selection = (_a = editor.selection) !== null && _a !== void 0 ? _a : editor.prevSelection;
|
|
11
|
+
(0, utils_1.focusEditor)(editor, selection);
|
|
12
|
+
};
|
|
13
|
+
exports.closeModalWithFocus = closeModalWithFocus;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { UxfEditor, UxfVideoElement } from "../../types";
|
|
3
|
+
interface InsertVideoModalContentProps {
|
|
4
|
+
editor: UxfEditor;
|
|
5
|
+
editedVideo?: UxfVideoElement;
|
|
6
|
+
}
|
|
7
|
+
export declare const InsertVideoModalContent: FC<InsertVideoModalContentProps>;
|
|
8
|
+
export {};
|