@uxf/wysiwyg 11.74.0 → 11.74.1
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/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,89 @@
|
|
|
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.InsertImageModalContent = void 0;
|
|
27
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
28
|
+
const file_input_1 = require("@uxf/ui/file-input");
|
|
29
|
+
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
30
|
+
const text_input_1 = require("@uxf/ui/text-input");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const use_image_handlers_1 = require("../../plugins/image/hooks/use-image-handlers");
|
|
33
|
+
const insert_image_1 = require("../../plugins/image/transforms/insert-image");
|
|
34
|
+
const update_image_1 = require("../../plugins/image/transforms/update-image");
|
|
35
|
+
const modal_buttons_1 = require("../components/modal/modal-buttons");
|
|
36
|
+
const modal_content_1 = require("../components/modal/modal-content");
|
|
37
|
+
const utils_1 = require("../utils");
|
|
38
|
+
const CLASS_NAME = "uxf-wysiwyg__insert-modal";
|
|
39
|
+
const InsertImageModalContent = (props) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
42
|
+
const imageHandlers = (0, use_image_handlers_1.useImageHandlers)(props.editor);
|
|
43
|
+
const [selectedFile, setSelectedFile] = (0, react_1.useState)((_b = (_a = props.imageToEdit) === null || _a === void 0 ? void 0 : _a.file) !== null && _b !== void 0 ? _b : null);
|
|
44
|
+
const [alt, setAlt] = (0, react_1.useState)((_d = (_c = props.imageToEdit) === null || _c === void 0 ? void 0 : _c.alt) !== null && _d !== void 0 ? _d : "");
|
|
45
|
+
const [caption, setCaption] = (0, react_1.useState)((_f = (_e = props.imageToEdit) === null || _e === void 0 ? void 0 : _e.caption) !== null && _f !== void 0 ? _f : "");
|
|
46
|
+
const [source, setSource] = (0, react_1.useState)((_h = (_g = props.imageToEdit) === null || _g === void 0 ? void 0 : _g.source) !== null && _h !== void 0 ? _h : "");
|
|
47
|
+
const title = props.imageToEdit
|
|
48
|
+
? t("uxf-wysiwyg:plugins.image.button-edit")
|
|
49
|
+
: t("uxf-wysiwyg:plugins.image.button-insert");
|
|
50
|
+
const fileUploadHandler = (0, react_1.useCallback)(async (file) => {
|
|
51
|
+
const fileResponse = await imageHandlers.uploadImage(file);
|
|
52
|
+
setSelectedFile(fileResponse);
|
|
53
|
+
return fileResponse;
|
|
54
|
+
}, [imageHandlers]);
|
|
55
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
56
|
+
setSelectedFile(null);
|
|
57
|
+
setAlt("");
|
|
58
|
+
setCaption("");
|
|
59
|
+
setSource("");
|
|
60
|
+
}, []);
|
|
61
|
+
const onCloseHandler = (0, react_1.useCallback)(() => {
|
|
62
|
+
reset();
|
|
63
|
+
(0, utils_1.closeModalWithFocus)(props.editor);
|
|
64
|
+
}, [props.editor, reset]);
|
|
65
|
+
const onAddHandler = (0, react_1.useCallback)((event) => {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
if (selectedFile && !props.imageToEdit) {
|
|
68
|
+
(0, insert_image_1.insertImage)(props.editor, selectedFile, alt !== "" ? alt : undefined, caption !== "" ? caption : undefined, source !== "" ? source : undefined, imageHandlers.getImageUrl(selectedFile));
|
|
69
|
+
reset();
|
|
70
|
+
(0, modal_service_1.closeModal)();
|
|
71
|
+
}
|
|
72
|
+
else if (selectedFile && props.imageToEdit) {
|
|
73
|
+
(0, update_image_1.updateImage)(props.editor, selectedFile, alt !== "" ? alt : undefined, caption !== "" ? caption : undefined, source !== "" ? source : undefined, imageHandlers.getImageUrl(selectedFile));
|
|
74
|
+
reset();
|
|
75
|
+
(0, modal_service_1.closeModal)();
|
|
76
|
+
}
|
|
77
|
+
}, [alt, caption, imageHandlers, props.editor, props.imageToEdit, reset, selectedFile, source]);
|
|
78
|
+
return (react_1.default.createElement(modal_content_1.ModalContent, { title: title },
|
|
79
|
+
react_1.default.createElement("form", { className: `${CLASS_NAME}-image__form`, id: "insert-image-form", onSubmit: onAddHandler },
|
|
80
|
+
react_1.default.createElement("div", { className: `${CLASS_NAME}-image__form-inputs` },
|
|
81
|
+
react_1.default.createElement(file_input_1.FileInput, { label: t("uxf-wysiwyg:plugins.image.file-upload.label"), name: "image", onChange: setSelectedFile, onUploadFile: fileUploadHandler, value: selectedFile }),
|
|
82
|
+
react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t("uxf-wysiwyg:plugins.image.alt.label"), name: "alt", onChange: setAlt, placeholder: t("uxf-wysiwyg:plugins.image.alt.placeholder"), type: "text", value: alt }),
|
|
83
|
+
react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t("uxf-wysiwyg:plugins.image.caption.label"), name: "caption", onChange: setCaption, placeholder: t("uxf-wysiwyg:plugins.image.caption.placeholder"), type: "text", value: caption }),
|
|
84
|
+
react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t("uxf-wysiwyg:plugins.image.source.label"), name: "source", onChange: setSource, placeholder: t("uxf-wysiwyg:plugins.image.source.placeholder"), type: "text", value: source })),
|
|
85
|
+
selectedFile && (react_1.default.createElement("img", { alt: alt, className: `${CLASS_NAME}-image__selected-img`, src: imageHandlers.getImageUrl(selectedFile) })),
|
|
86
|
+
react_1.default.createElement(modal_buttons_1.ModalButtons, { className: `${CLASS_NAME}__form-buttons`, editor: props.editor, onCancel: onCloseHandler, submitText: title }),
|
|
87
|
+
react_1.default.createElement("button", { hidden: true, type: "submit" }))));
|
|
88
|
+
};
|
|
89
|
+
exports.InsertImageModalContent = InsertImageModalContent;
|
|
@@ -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.ItalicMark = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const ItalicMark = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("i", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-italic ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.ItalicMark = ItalicMark;
|
|
@@ -0,0 +1,14 @@
|
|
|
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.LinkElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const LinkElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("span", null,
|
|
12
|
+
react_1.default.createElement("a", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-link ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, ...props.nodeProps }, props.children)));
|
|
13
|
+
};
|
|
14
|
+
exports.LinkElement = LinkElement;
|
|
@@ -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.ListItemElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const ListItemElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("li", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-list-item ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.ListItemElement = ListItemElement;
|
|
@@ -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.ListOrderedElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const ListOrderedElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("ol", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-list-ordered ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.ListOrderedElement = ListOrderedElement;
|
|
@@ -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 {};
|