@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.
Files changed (241) hide show
  1. package/components.d.ts +7 -0
  2. package/components.js +34 -0
  3. package/config/icons-config.d.ts +2 -0
  4. package/config/icons-config.js +5 -0
  5. package/config/icons.d.ts +183 -0
  6. package/config/icons.js +51 -0
  7. package/create-all-plugins-with-ui.d.ts +64 -0
  8. package/create-all-plugins-with-ui.js +127 -0
  9. package/create-plugins-with-ui.d.ts +4 -0
  10. package/create-plugins-with-ui.js +47 -0
  11. package/hooks.d.ts +9 -0
  12. package/hooks.js +20 -0
  13. package/index.d.ts +6 -0
  14. package/index.js +38 -0
  15. package/package.json +3 -3
  16. package/plugins/blockquote/create-blockquote-plugin.d.ts +3 -0
  17. package/plugins/blockquote/create-blockquote-plugin.js +9 -0
  18. package/plugins/blockquote/types.d.ts +2 -0
  19. package/plugins/blockquote/types.js +6 -0
  20. package/plugins/button/constants.d.ts +2 -0
  21. package/plugins/button/constants.js +5 -0
  22. package/plugins/button/create-button-plugin.d.ts +2 -0
  23. package/plugins/button/create-button-plugin.js +11 -0
  24. package/plugins/button/index.d.ts +3 -0
  25. package/plugins/button/index.js +23 -0
  26. package/plugins/button/transforms/get-active-button.d.ts +2 -0
  27. package/plugins/button/transforms/get-active-button.js +9 -0
  28. package/plugins/button/transforms/index.d.ts +4 -0
  29. package/plugins/button/transforms/index.js +11 -0
  30. package/plugins/button/transforms/insert-button.d.ts +2 -0
  31. package/plugins/button/transforms/insert-button.js +16 -0
  32. package/plugins/button/transforms/is-button-active.d.ts +2 -0
  33. package/plugins/button/transforms/is-button-active.js +7 -0
  34. package/plugins/button/transforms/remove-selected-button.d.ts +2 -0
  35. package/plugins/button/transforms/remove-selected-button.js +13 -0
  36. package/plugins/button/transforms/update-button.d.ts +2 -0
  37. package/plugins/button/transforms/update-button.js +9 -0
  38. package/plugins/embedded/utils.d.ts +1 -0
  39. package/plugins/embedded/utils.js +7 -0
  40. package/plugins/embedded/video/create-video-plugin.d.ts +4 -0
  41. package/plugins/embedded/video/create-video-plugin.js +19 -0
  42. package/plugins/embedded/video/get-active-video.d.ts +2 -0
  43. package/plugins/embedded/video/get-active-video.js +9 -0
  44. package/plugins/embedded/video/insert-video.d.ts +2 -0
  45. package/plugins/embedded/video/insert-video.js +19 -0
  46. package/plugins/embedded/video/update-video.d.ts +2 -0
  47. package/plugins/embedded/video/update-video.js +12 -0
  48. package/plugins/exit-break/create-exit-break-plugin.d.ts +3 -0
  49. package/plugins/exit-break/create-exit-break-plugin.js +30 -0
  50. package/plugins/heading/constants.d.ts +8 -0
  51. package/plugins/heading/constants.js +11 -0
  52. package/plugins/heading/create-headings-plugin.d.ts +8 -0
  53. package/plugins/heading/create-headings-plugin.js +40 -0
  54. package/plugins/highlight/createHighlightPlugin.d.ts +3 -0
  55. package/plugins/highlight/createHighlightPlugin.js +27 -0
  56. package/plugins/highlight/types.d.ts +10 -0
  57. package/plugins/highlight/types.js +4 -0
  58. package/plugins/image/create-image-plugin.d.ts +6 -0
  59. package/plugins/image/create-image-plugin.js +105 -0
  60. package/plugins/image/hooks/use-image-handlers.d.ts +5 -0
  61. package/plugins/image/hooks/use-image-handlers.js +19 -0
  62. package/plugins/image/transforms/get-active-image.d.ts +2 -0
  63. package/plugins/image/transforms/get-active-image.js +9 -0
  64. package/plugins/image/transforms/insert-image.d.ts +3 -0
  65. package/plugins/image/transforms/insert-image.js +19 -0
  66. package/plugins/image/transforms/is-image-active.d.ts +2 -0
  67. package/plugins/image/transforms/is-image-active.js +7 -0
  68. package/plugins/image/transforms/remove-selected-image.d.ts +2 -0
  69. package/plugins/image/transforms/remove-selected-image.js +13 -0
  70. package/plugins/image/transforms/update-image.d.ts +3 -0
  71. package/plugins/image/transforms/update-image.js +12 -0
  72. package/plugins/image/types.d.ts +12 -0
  73. package/plugins/image/types.js +6 -0
  74. package/plugins/image/utils/is-image-url.d.ts +2 -0
  75. package/plugins/image/utils/is-image-url.js +135 -0
  76. package/plugins/image/with-image.d.ts +7 -0
  77. package/plugins/image/with-image.js +19 -0
  78. package/plugins/image/with-paste-image-url.d.ts +7 -0
  79. package/plugins/image/with-paste-image-url.js +36 -0
  80. package/plugins/image/with-paste-image.d.ts +7 -0
  81. package/plugins/image/with-paste-image.js +49 -0
  82. package/plugins/link/constants.d.ts +2 -0
  83. package/plugins/link/constants.js +6 -0
  84. package/plugins/link/create-link-plugin.d.ts +3 -0
  85. package/plugins/link/create-link-plugin.js +15 -0
  86. package/plugins/link/floating-link-wrapper.d.ts +11 -0
  87. package/plugins/link/floating-link-wrapper.js +26 -0
  88. package/plugins/link/hooks/index.d.ts +4 -0
  89. package/plugins/link/hooks/index.js +11 -0
  90. package/plugins/link/hooks/use-link-actions.d.ts +12 -0
  91. package/plugins/link/hooks/use-link-actions.js +48 -0
  92. package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +1 -0
  93. package/plugins/link/hooks/use-link-cancel-on-escape.js +5 -0
  94. package/plugins/link/hooks/use-link-submit-on-enter.d.ts +1 -0
  95. package/plugins/link/hooks/use-link-submit-on-enter.js +23 -0
  96. package/plugins/link/transforms/get-active-link.d.ts +3 -0
  97. package/plugins/link/transforms/get-active-link.js +17 -0
  98. package/plugins/link/transforms/insert-link.d.ts +2 -0
  99. package/plugins/link/transforms/insert-link.js +27 -0
  100. package/plugins/link/transforms/is-link-selected.d.ts +2 -0
  101. package/plugins/link/transforms/is-link-selected.js +15 -0
  102. package/plugins/link/transforms/submit-link.d.ts +8 -0
  103. package/plugins/link/transforms/submit-link.js +36 -0
  104. package/plugins/link/transforms/trigger-link-insert-or-edit.d.ts +2 -0
  105. package/plugins/link/transforms/trigger-link-insert-or-edit.js +6 -0
  106. package/plugins/link/transforms/unwrap-link.d.ts +2 -0
  107. package/plugins/link/transforms/unwrap-link.js +10 -0
  108. package/plugins/link/types.d.ts +5 -0
  109. package/plugins/link/types.js +2 -0
  110. package/plugins/list/constants.d.ts +4 -0
  111. package/plugins/list/constants.js +14 -0
  112. package/plugins/list/create-list-plugin.d.ts +4 -0
  113. package/plugins/list/create-list-plugin.js +16 -0
  114. package/plugins/mark-bold/create-bold-plugin.d.ts +3 -0
  115. package/plugins/mark-bold/create-bold-plugin.js +6 -0
  116. package/plugins/mark-bold/types.d.ts +2 -0
  117. package/plugins/mark-bold/types.js +6 -0
  118. package/plugins/mark-code/create-code-plugin.d.ts +3 -0
  119. package/plugins/mark-code/create-code-plugin.js +6 -0
  120. package/plugins/mark-code/types.d.ts +2 -0
  121. package/plugins/mark-code/types.js +6 -0
  122. package/plugins/mark-italic/create-italic-plugin.d.ts +3 -0
  123. package/plugins/mark-italic/create-italic-plugin.js +6 -0
  124. package/plugins/mark-italic/types.d.ts +2 -0
  125. package/plugins/mark-italic/types.js +6 -0
  126. package/plugins/mark-underline/create-underline-plugin.d.ts +3 -0
  127. package/plugins/mark-underline/create-underline-plugin.js +6 -0
  128. package/plugins/mark-underline/types.d.ts +2 -0
  129. package/plugins/mark-underline/types.js +6 -0
  130. package/plugins/node-id/add-ids-to-nodes.d.ts +2 -0
  131. package/plugins/node-id/add-ids-to-nodes.js +22 -0
  132. package/plugins/node-id/create-node-id-plugin.d.ts +3 -0
  133. package/plugins/node-id/create-node-id-plugin.js +6 -0
  134. package/plugins/paragraph/create-paragraph-plugin.d.ts +3 -0
  135. package/plugins/paragraph/create-paragraph-plugin.js +9 -0
  136. package/plugins/paragraph/types.d.ts +2 -0
  137. package/plugins/paragraph/types.js +6 -0
  138. package/plugins/reset-node/create-reset-node.d.ts +3 -0
  139. package/plugins/reset-node/create-reset-node.js +28 -0
  140. package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +3 -0
  141. package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +14 -0
  142. package/plugins/soft-break/create-soft-break-plugin.d.ts +3 -0
  143. package/plugins/soft-break/create-soft-break-plugin.js +22 -0
  144. package/plugins/trailing-block/create-trailing-block-plugin.d.ts +3 -0
  145. package/plugins/trailing-block/create-trailing-block-plugin.js +6 -0
  146. package/serializers/serialize-to-plaintext.d.ts +2 -0
  147. package/serializers/serialize-to-plaintext.js +8 -0
  148. package/types.d.ts +118 -0
  149. package/types.js +2 -0
  150. package/ui/blockquote-element.d.ts +2 -0
  151. package/ui/blockquote-element.js +13 -0
  152. package/ui/bold-mark.d.ts +2 -0
  153. package/ui/bold-mark.js +13 -0
  154. package/ui/button/button-element.d.ts +2 -0
  155. package/ui/button/button-element.js +54 -0
  156. package/ui/button/index.d.ts +1 -0
  157. package/ui/button/index.js +5 -0
  158. package/ui/button/insert-button-modal-content.d.ts +8 -0
  159. package/ui/button/insert-button-modal-content.js +81 -0
  160. package/ui/code-mark.d.ts +2 -0
  161. package/ui/code-mark.js +13 -0
  162. package/ui/components/element/element-action-buttons.d.ts +9 -0
  163. package/ui/components/element/element-action-buttons.js +22 -0
  164. package/ui/components/element/element-with-action-buttons.d.ts +10 -0
  165. package/ui/components/element/element-with-action-buttons.js +17 -0
  166. package/ui/components/modal/modal-button-cancel.d.ts +9 -0
  167. package/ui/components/modal/modal-button-cancel.js +45 -0
  168. package/ui/components/modal/modal-button-submit.d.ts +6 -0
  169. package/ui/components/modal/modal-button-submit.js +12 -0
  170. package/ui/components/modal/modal-buttons.d.ts +11 -0
  171. package/ui/components/modal/modal-buttons.js +16 -0
  172. package/ui/components/modal/modal-content.d.ts +6 -0
  173. package/ui/components/modal/modal-content.js +14 -0
  174. package/ui/create-uxf-ui.d.ts +21 -0
  175. package/ui/create-uxf-ui.js +51 -0
  176. package/ui/floating-link.d.ts +2 -0
  177. package/ui/floating-link.js +110 -0
  178. package/ui/heading-elements.d.ts +7 -0
  179. package/ui/heading-elements.js +38 -0
  180. package/ui/highlight-mark.d.ts +3 -0
  181. package/ui/highlight-mark.js +13 -0
  182. package/ui/image/image-element.d.ts +2 -0
  183. package/ui/image/image-element.js +53 -0
  184. package/ui/image/insert-image-modal-content.d.ts +8 -0
  185. package/ui/image/insert-image-modal-content.js +89 -0
  186. package/ui/italic-mark.d.ts +2 -0
  187. package/ui/italic-mark.js +13 -0
  188. package/ui/link-element.d.ts +3 -0
  189. package/ui/link-element.js +14 -0
  190. package/ui/list-item-element.d.ts +2 -0
  191. package/ui/list-item-element.js +13 -0
  192. package/ui/list-ordered-element.d.ts +2 -0
  193. package/ui/list-ordered-element.js +13 -0
  194. package/ui/list-unordered-element.d.ts +2 -0
  195. package/ui/list-unordered-element.js +13 -0
  196. package/ui/paragraph-element.d.ts +2 -0
  197. package/ui/paragraph-element.js +13 -0
  198. package/ui/toolbar/buttons/button-toolbar-button.d.ts +10 -0
  199. package/ui/toolbar/buttons/button-toolbar-button.js +20 -0
  200. package/ui/toolbar/buttons/element-toolbar-button.d.ts +12 -0
  201. package/ui/toolbar/buttons/element-toolbar-button.js +25 -0
  202. package/ui/toolbar/buttons/image-toolbar-button.d.ts +10 -0
  203. package/ui/toolbar/buttons/image-toolbar-button.js +20 -0
  204. package/ui/toolbar/buttons/link-toolbar-button.d.ts +10 -0
  205. package/ui/toolbar/buttons/link-toolbar-button.js +29 -0
  206. package/ui/toolbar/buttons/list-toolbar-button.d.ts +13 -0
  207. package/ui/toolbar/buttons/list-toolbar-button.js +27 -0
  208. package/ui/toolbar/buttons/mark-toolbar-button.d.ts +13 -0
  209. package/ui/toolbar/buttons/mark-toolbar-button.js +25 -0
  210. package/ui/toolbar/buttons/modal-toolbar-button.d.ts +15 -0
  211. package/ui/toolbar/buttons/modal-toolbar-button.js +22 -0
  212. package/ui/toolbar/buttons/toolbar-button.d.ts +15 -0
  213. package/ui/toolbar/buttons/toolbar-button.js +35 -0
  214. package/ui/toolbar/buttons/undo-redo-button-group.d.ts +8 -0
  215. package/ui/toolbar/buttons/undo-redo-button-group.js +64 -0
  216. package/ui/toolbar/buttons/video-toolbar-button.d.ts +10 -0
  217. package/ui/toolbar/buttons/video-toolbar-button.js +20 -0
  218. package/ui/toolbar/toolbar.d.ts +3 -0
  219. package/ui/toolbar/toolbar.js +77 -0
  220. package/ui/toolbar/types.d.ts +8 -0
  221. package/ui/toolbar/types.js +2 -0
  222. package/ui/underline-mark.d.ts +2 -0
  223. package/ui/underline-mark.js +13 -0
  224. package/ui/utils.d.ts +2 -0
  225. package/ui/utils.js +13 -0
  226. package/ui/video/insert-video-modal-content.d.ts +8 -0
  227. package/ui/video/insert-video-modal-content.js +80 -0
  228. package/ui/video/video-element.d.ts +2 -0
  229. package/ui/video/video-element.js +55 -0
  230. package/utils/get-video-meta-data.d.ts +2 -0
  231. package/utils/get-video-meta-data.js +41 -0
  232. package/utils/url-helper.d.ts +7 -0
  233. package/utils/url-helper.js +15 -0
  234. package/utils/url-helper.test.d.ts +1 -0
  235. package/utils/url-helper.test.js +37 -0
  236. package/utils.d.ts +30 -0
  237. package/utils.js +88 -0
  238. package/wysiwyg-editor.d.ts +15 -0
  239. package/wysiwyg-editor.js +42 -0
  240. package/wysiwyg-editor.stories.d.ts +5 -0
  241. 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,2 @@
1
+ import { ElementUiComponent } from "../types";
2
+ export declare const ItalicMark: ElementUiComponent;
@@ -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,3 @@
1
+ import { TLinkElement } from "../plugins/link/types";
2
+ import { ElementUiComponent } from "../types";
3
+ export declare const LinkElement: ElementUiComponent<TLinkElement>;
@@ -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,2 @@
1
+ import { ElementUiComponent } from "../types";
2
+ export declare const ListItemElement: ElementUiComponent;
@@ -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,2 @@
1
+ import { ElementUiComponent } from "../types";
2
+ export declare const ListOrderedElement: ElementUiComponent;
@@ -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,2 @@
1
+ import { ElementUiComponent } from "../types";
2
+ export declare const ListUnorderedElement: ElementUiComponent;
@@ -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,2 @@
1
+ import { ElementUiComponent } from "../types";
2
+ export declare const ParagraphElement: ElementUiComponent;
@@ -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,8 @@
1
+ import { PlateId } from "@udecode/plate-core";
2
+ import { FC } from "react";
3
+ interface Props {
4
+ className?: string;
5
+ plateId: PlateId;
6
+ }
7
+ export declare const UndoRedoButtonGroup: FC<Props>;
8
+ export {};
@@ -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 {};