@uxf/wysiwyg 11.73.0 → 11.74.0

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 (252) hide show
  1. package/README.md +3 -1
  2. package/package.json +3 -3
  3. package/translations/translations.d.ts +405 -5
  4. package/translations/translations.js +404 -4
  5. package/components.d.ts +0 -7
  6. package/components.js +0 -34
  7. package/config/icons-config.d.ts +0 -2
  8. package/config/icons-config.js +0 -5
  9. package/config/icons.d.ts +0 -183
  10. package/config/icons.js +0 -51
  11. package/create-all-plugins-with-ui.d.ts +0 -64
  12. package/create-all-plugins-with-ui.js +0 -127
  13. package/create-plugins-with-ui.d.ts +0 -4
  14. package/create-plugins-with-ui.js +0 -47
  15. package/hooks.d.ts +0 -9
  16. package/hooks.js +0 -20
  17. package/index.d.ts +0 -6
  18. package/index.js +0 -38
  19. package/plugins/blockquote/create-blockquote-plugin.d.ts +0 -3
  20. package/plugins/blockquote/create-blockquote-plugin.js +0 -9
  21. package/plugins/blockquote/types.d.ts +0 -2
  22. package/plugins/blockquote/types.js +0 -6
  23. package/plugins/button/constants.d.ts +0 -2
  24. package/plugins/button/constants.js +0 -5
  25. package/plugins/button/create-button-plugin.d.ts +0 -2
  26. package/plugins/button/create-button-plugin.js +0 -11
  27. package/plugins/button/index.d.ts +0 -3
  28. package/plugins/button/index.js +0 -23
  29. package/plugins/button/transforms/get-active-button.d.ts +0 -2
  30. package/plugins/button/transforms/get-active-button.js +0 -9
  31. package/plugins/button/transforms/index.d.ts +0 -4
  32. package/plugins/button/transforms/index.js +0 -11
  33. package/plugins/button/transforms/insert-button.d.ts +0 -2
  34. package/plugins/button/transforms/insert-button.js +0 -16
  35. package/plugins/button/transforms/is-button-active.d.ts +0 -2
  36. package/plugins/button/transforms/is-button-active.js +0 -7
  37. package/plugins/button/transforms/remove-selected-button.d.ts +0 -2
  38. package/plugins/button/transforms/remove-selected-button.js +0 -13
  39. package/plugins/button/transforms/update-button.d.ts +0 -2
  40. package/plugins/button/transforms/update-button.js +0 -9
  41. package/plugins/embedded/utils.d.ts +0 -1
  42. package/plugins/embedded/utils.js +0 -7
  43. package/plugins/embedded/video/create-video-plugin.d.ts +0 -4
  44. package/plugins/embedded/video/create-video-plugin.js +0 -19
  45. package/plugins/embedded/video/get-active-video.d.ts +0 -2
  46. package/plugins/embedded/video/get-active-video.js +0 -9
  47. package/plugins/embedded/video/insert-video.d.ts +0 -2
  48. package/plugins/embedded/video/insert-video.js +0 -19
  49. package/plugins/embedded/video/update-video.d.ts +0 -2
  50. package/plugins/embedded/video/update-video.js +0 -12
  51. package/plugins/exit-break/create-exit-break-plugin.d.ts +0 -3
  52. package/plugins/exit-break/create-exit-break-plugin.js +0 -30
  53. package/plugins/heading/constants.d.ts +0 -8
  54. package/plugins/heading/constants.js +0 -11
  55. package/plugins/heading/create-headings-plugin.d.ts +0 -8
  56. package/plugins/heading/create-headings-plugin.js +0 -40
  57. package/plugins/highlight/createHighlightPlugin.d.ts +0 -3
  58. package/plugins/highlight/createHighlightPlugin.js +0 -27
  59. package/plugins/highlight/types.d.ts +0 -10
  60. package/plugins/highlight/types.js +0 -4
  61. package/plugins/image/create-image-plugin.d.ts +0 -6
  62. package/plugins/image/create-image-plugin.js +0 -105
  63. package/plugins/image/hooks/use-image-handlers.d.ts +0 -5
  64. package/plugins/image/hooks/use-image-handlers.js +0 -19
  65. package/plugins/image/transforms/get-active-image.d.ts +0 -2
  66. package/plugins/image/transforms/get-active-image.js +0 -9
  67. package/plugins/image/transforms/insert-image.d.ts +0 -3
  68. package/plugins/image/transforms/insert-image.js +0 -19
  69. package/plugins/image/transforms/is-image-active.d.ts +0 -2
  70. package/plugins/image/transforms/is-image-active.js +0 -7
  71. package/plugins/image/transforms/remove-selected-image.d.ts +0 -2
  72. package/plugins/image/transforms/remove-selected-image.js +0 -13
  73. package/plugins/image/transforms/update-image.d.ts +0 -3
  74. package/plugins/image/transforms/update-image.js +0 -12
  75. package/plugins/image/types.d.ts +0 -12
  76. package/plugins/image/types.js +0 -6
  77. package/plugins/image/utils/is-image-url.d.ts +0 -2
  78. package/plugins/image/utils/is-image-url.js +0 -135
  79. package/plugins/image/with-image.d.ts +0 -7
  80. package/plugins/image/with-image.js +0 -19
  81. package/plugins/image/with-paste-image-url.d.ts +0 -7
  82. package/plugins/image/with-paste-image-url.js +0 -36
  83. package/plugins/image/with-paste-image.d.ts +0 -7
  84. package/plugins/image/with-paste-image.js +0 -49
  85. package/plugins/link/constants.d.ts +0 -2
  86. package/plugins/link/constants.js +0 -6
  87. package/plugins/link/create-link-plugin.d.ts +0 -3
  88. package/plugins/link/create-link-plugin.js +0 -15
  89. package/plugins/link/floating-link-wrapper.d.ts +0 -11
  90. package/plugins/link/floating-link-wrapper.js +0 -26
  91. package/plugins/link/hooks/index.d.ts +0 -4
  92. package/plugins/link/hooks/index.js +0 -11
  93. package/plugins/link/hooks/use-link-actions.d.ts +0 -12
  94. package/plugins/link/hooks/use-link-actions.js +0 -48
  95. package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +0 -1
  96. package/plugins/link/hooks/use-link-cancel-on-escape.js +0 -5
  97. package/plugins/link/hooks/use-link-submit-on-enter.d.ts +0 -1
  98. package/plugins/link/hooks/use-link-submit-on-enter.js +0 -23
  99. package/plugins/link/transforms/get-active-link.d.ts +0 -3
  100. package/plugins/link/transforms/get-active-link.js +0 -17
  101. package/plugins/link/transforms/insert-link.d.ts +0 -2
  102. package/plugins/link/transforms/insert-link.js +0 -27
  103. package/plugins/link/transforms/is-link-selected.d.ts +0 -2
  104. package/plugins/link/transforms/is-link-selected.js +0 -15
  105. package/plugins/link/transforms/submit-link.d.ts +0 -8
  106. package/plugins/link/transforms/submit-link.js +0 -36
  107. package/plugins/link/transforms/trigger-link-insert-or-edit.d.ts +0 -2
  108. package/plugins/link/transforms/trigger-link-insert-or-edit.js +0 -6
  109. package/plugins/link/transforms/unwrap-link.d.ts +0 -2
  110. package/plugins/link/transforms/unwrap-link.js +0 -10
  111. package/plugins/link/types.d.ts +0 -5
  112. package/plugins/link/types.js +0 -2
  113. package/plugins/list/constants.d.ts +0 -4
  114. package/plugins/list/constants.js +0 -14
  115. package/plugins/list/create-list-plugin.d.ts +0 -4
  116. package/plugins/list/create-list-plugin.js +0 -16
  117. package/plugins/mark-bold/create-bold-plugin.d.ts +0 -3
  118. package/plugins/mark-bold/create-bold-plugin.js +0 -6
  119. package/plugins/mark-bold/types.d.ts +0 -2
  120. package/plugins/mark-bold/types.js +0 -6
  121. package/plugins/mark-code/create-code-plugin.d.ts +0 -3
  122. package/plugins/mark-code/create-code-plugin.js +0 -6
  123. package/plugins/mark-code/types.d.ts +0 -2
  124. package/plugins/mark-code/types.js +0 -6
  125. package/plugins/mark-italic/create-italic-plugin.d.ts +0 -3
  126. package/plugins/mark-italic/create-italic-plugin.js +0 -6
  127. package/plugins/mark-italic/types.d.ts +0 -2
  128. package/plugins/mark-italic/types.js +0 -6
  129. package/plugins/mark-underline/create-underline-plugin.d.ts +0 -3
  130. package/plugins/mark-underline/create-underline-plugin.js +0 -6
  131. package/plugins/mark-underline/types.d.ts +0 -2
  132. package/plugins/mark-underline/types.js +0 -6
  133. package/plugins/node-id/add-ids-to-nodes.d.ts +0 -2
  134. package/plugins/node-id/add-ids-to-nodes.js +0 -22
  135. package/plugins/node-id/create-node-id-plugin.d.ts +0 -3
  136. package/plugins/node-id/create-node-id-plugin.js +0 -6
  137. package/plugins/paragraph/create-paragraph-plugin.d.ts +0 -3
  138. package/plugins/paragraph/create-paragraph-plugin.js +0 -9
  139. package/plugins/paragraph/types.d.ts +0 -2
  140. package/plugins/paragraph/types.js +0 -6
  141. package/plugins/reset-node/create-reset-node.d.ts +0 -3
  142. package/plugins/reset-node/create-reset-node.js +0 -28
  143. package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +0 -3
  144. package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +0 -14
  145. package/plugins/soft-break/create-soft-break-plugin.d.ts +0 -3
  146. package/plugins/soft-break/create-soft-break-plugin.js +0 -22
  147. package/plugins/trailing-block/create-trailing-block-plugin.d.ts +0 -3
  148. package/plugins/trailing-block/create-trailing-block-plugin.js +0 -6
  149. package/serializers/serialize-to-plaintext.d.ts +0 -2
  150. package/serializers/serialize-to-plaintext.js +0 -8
  151. package/translations/context.d.ts +0 -2
  152. package/translations/context.js +0 -9
  153. package/translations/cs.d.ts +0 -52
  154. package/translations/cs.js +0 -55
  155. package/translations/en.d.ts +0 -2
  156. package/translations/en.js +0 -55
  157. package/translations/sk.d.ts +0 -2
  158. package/translations/sk.js +0 -55
  159. package/types.d.ts +0 -118
  160. package/types.js +0 -2
  161. package/ui/blockquote-element.d.ts +0 -2
  162. package/ui/blockquote-element.js +0 -13
  163. package/ui/bold-mark.d.ts +0 -2
  164. package/ui/bold-mark.js +0 -13
  165. package/ui/button/button-element.d.ts +0 -2
  166. package/ui/button/button-element.js +0 -54
  167. package/ui/button/index.d.ts +0 -1
  168. package/ui/button/index.js +0 -5
  169. package/ui/button/insert-button-modal-content.d.ts +0 -8
  170. package/ui/button/insert-button-modal-content.js +0 -81
  171. package/ui/code-mark.d.ts +0 -2
  172. package/ui/code-mark.js +0 -13
  173. package/ui/components/element/element-action-buttons.d.ts +0 -9
  174. package/ui/components/element/element-action-buttons.js +0 -22
  175. package/ui/components/element/element-with-action-buttons.d.ts +0 -10
  176. package/ui/components/element/element-with-action-buttons.js +0 -17
  177. package/ui/components/modal/modal-button-cancel.d.ts +0 -9
  178. package/ui/components/modal/modal-button-cancel.js +0 -45
  179. package/ui/components/modal/modal-button-submit.d.ts +0 -6
  180. package/ui/components/modal/modal-button-submit.js +0 -12
  181. package/ui/components/modal/modal-buttons.d.ts +0 -11
  182. package/ui/components/modal/modal-buttons.js +0 -16
  183. package/ui/components/modal/modal-content.d.ts +0 -6
  184. package/ui/components/modal/modal-content.js +0 -14
  185. package/ui/create-uxf-ui.d.ts +0 -21
  186. package/ui/create-uxf-ui.js +0 -51
  187. package/ui/floating-link.d.ts +0 -2
  188. package/ui/floating-link.js +0 -110
  189. package/ui/heading-elements.d.ts +0 -7
  190. package/ui/heading-elements.js +0 -38
  191. package/ui/highlight-mark.d.ts +0 -3
  192. package/ui/highlight-mark.js +0 -13
  193. package/ui/image/image-element.d.ts +0 -2
  194. package/ui/image/image-element.js +0 -53
  195. package/ui/image/insert-image-modal-content.d.ts +0 -8
  196. package/ui/image/insert-image-modal-content.js +0 -87
  197. package/ui/italic-mark.d.ts +0 -2
  198. package/ui/italic-mark.js +0 -13
  199. package/ui/link-element.d.ts +0 -3
  200. package/ui/link-element.js +0 -14
  201. package/ui/list-item-element.d.ts +0 -2
  202. package/ui/list-item-element.js +0 -13
  203. package/ui/list-ordered-element.d.ts +0 -2
  204. package/ui/list-ordered-element.js +0 -13
  205. package/ui/list-unordered-element.d.ts +0 -2
  206. package/ui/list-unordered-element.js +0 -13
  207. package/ui/paragraph-element.d.ts +0 -2
  208. package/ui/paragraph-element.js +0 -13
  209. package/ui/toolbar/buttons/button-toolbar-button.d.ts +0 -10
  210. package/ui/toolbar/buttons/button-toolbar-button.js +0 -20
  211. package/ui/toolbar/buttons/element-toolbar-button.d.ts +0 -12
  212. package/ui/toolbar/buttons/element-toolbar-button.js +0 -25
  213. package/ui/toolbar/buttons/image-toolbar-button.d.ts +0 -10
  214. package/ui/toolbar/buttons/image-toolbar-button.js +0 -20
  215. package/ui/toolbar/buttons/link-toolbar-button.d.ts +0 -10
  216. package/ui/toolbar/buttons/link-toolbar-button.js +0 -29
  217. package/ui/toolbar/buttons/list-toolbar-button.d.ts +0 -13
  218. package/ui/toolbar/buttons/list-toolbar-button.js +0 -27
  219. package/ui/toolbar/buttons/mark-toolbar-button.d.ts +0 -13
  220. package/ui/toolbar/buttons/mark-toolbar-button.js +0 -25
  221. package/ui/toolbar/buttons/modal-toolbar-button.d.ts +0 -15
  222. package/ui/toolbar/buttons/modal-toolbar-button.js +0 -22
  223. package/ui/toolbar/buttons/toolbar-button.d.ts +0 -15
  224. package/ui/toolbar/buttons/toolbar-button.js +0 -35
  225. package/ui/toolbar/buttons/undo-redo-button-group.d.ts +0 -8
  226. package/ui/toolbar/buttons/undo-redo-button-group.js +0 -64
  227. package/ui/toolbar/buttons/video-toolbar-button.d.ts +0 -10
  228. package/ui/toolbar/buttons/video-toolbar-button.js +0 -20
  229. package/ui/toolbar/toolbar.d.ts +0 -3
  230. package/ui/toolbar/toolbar.js +0 -77
  231. package/ui/toolbar/types.d.ts +0 -8
  232. package/ui/toolbar/types.js +0 -2
  233. package/ui/underline-mark.d.ts +0 -2
  234. package/ui/underline-mark.js +0 -13
  235. package/ui/utils.d.ts +0 -2
  236. package/ui/utils.js +0 -13
  237. package/ui/video/insert-video-modal-content.d.ts +0 -8
  238. package/ui/video/insert-video-modal-content.js +0 -78
  239. package/ui/video/video-element.d.ts +0 -2
  240. package/ui/video/video-element.js +0 -55
  241. package/utils/get-video-meta-data.d.ts +0 -2
  242. package/utils/get-video-meta-data.js +0 -41
  243. package/utils/url-helper.d.ts +0 -7
  244. package/utils/url-helper.js +0 -15
  245. package/utils/url-helper.test.d.ts +0 -1
  246. package/utils/url-helper.test.js +0 -37
  247. package/utils.d.ts +0 -30
  248. package/utils.js +0 -88
  249. package/wysiwyg-editor.d.ts +0 -17
  250. package/wysiwyg-editor.js +0 -44
  251. package/wysiwyg-editor.stories.d.ts +0 -5
  252. package/wysiwyg-editor.stories.js +0 -193
@@ -1,81 +0,0 @@
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.InsertButtonModalContent = void 0;
27
- const text_input_1 = require("@uxf/ui/text-input");
28
- const react_1 = __importStar(require("react"));
29
- const button_1 = require("../../plugins/button");
30
- const context_1 = require("../../translations/context");
31
- const modal_buttons_1 = require("../components/modal/modal-buttons");
32
- const modal_content_1 = require("../components/modal/modal-content");
33
- const utils_1 = require("../utils");
34
- const CLASS_NAME = "uxf-wysiwyg__insert-modal-button";
35
- const InsertButtonModalContent = (props) => {
36
- var _a, _b, _c, _d;
37
- const t = (0, context_1.useTranslation)();
38
- const [buttonText, setButtonText] = (0, react_1.useState)((_b = (_a = props.buttonToEdit) === null || _a === void 0 ? void 0 : _a.buttonText) !== null && _b !== void 0 ? _b : "");
39
- const [buttonUrl, setButtonUrl] = (0, react_1.useState)((_d = (_c = props.buttonToEdit) === null || _c === void 0 ? void 0 : _c.buttonUrl) !== null && _d !== void 0 ? _d : "");
40
- const [error, setError] = (0, react_1.useState)({
41
- text: undefined,
42
- url: undefined,
43
- });
44
- const title = props.buttonToEdit
45
- ? t("wysiwyg:plugins.button.button-edit")
46
- : t("wysiwyg:plugins.button.button-insert");
47
- const onSubmit = (0, react_1.useCallback)(async (e) => {
48
- e.preventDefault();
49
- if (buttonText.length === 0) {
50
- setError((prevError) => ({
51
- ...prevError,
52
- text: "Toto pole je povinné",
53
- }));
54
- }
55
- if (buttonUrl.length === 0) {
56
- setError((prevError) => {
57
- return {
58
- ...prevError,
59
- url: "Toto pole je povinné",
60
- };
61
- });
62
- }
63
- if (buttonText.length !== 0 && buttonUrl.length !== 0) {
64
- if (props.buttonToEdit) {
65
- (0, button_1.updateButton)(props.editor, buttonText, buttonUrl);
66
- }
67
- else {
68
- (0, button_1.insertButton)(props.editor, buttonText, buttonUrl);
69
- }
70
- (0, utils_1.closeModalWithFocus)(props.editor);
71
- }
72
- }, [buttonText, buttonUrl, props.buttonToEdit, props.editor]);
73
- return (react_1.default.createElement(modal_content_1.ModalContent, { title: title },
74
- react_1.default.createElement("form", { className: `${CLASS_NAME}__form`, id: "insert-button-form", onSubmit: onSubmit },
75
- react_1.default.createElement("div", { className: `${CLASS_NAME}__form-inputs` },
76
- react_1.default.createElement(text_input_1.TextInput, { helperText: error.text, isInvalid: Boolean(error.text), isRequired: true, label: t("wysiwyg:plugins.button.button-text.label"), name: "button-text", onChange: setButtonText, placeholder: t("wysiwyg:plugins.button.button-text.placeholder"), type: "text", value: buttonText }),
77
- react_1.default.createElement(text_input_1.TextInput, { helperText: error.url, isInvalid: Boolean(error.url), isRequired: true, label: t("wysiwyg:plugins.button.url-address.label"), name: "url-address", onChange: setButtonUrl, placeholder: t("wysiwyg:plugins.button.url-address.placeholder"), type: "text", value: buttonUrl })),
78
- react_1.default.createElement(modal_buttons_1.ModalButtons, { className: `${CLASS_NAME}__form-buttons`, editor: props.editor, submitText: title }),
79
- react_1.default.createElement("button", { hidden: true, type: "submit" }))));
80
- };
81
- exports.InsertButtonModalContent = InsertButtonModalContent;
package/ui/code-mark.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { LeafUiComponent } from "../types";
2
- export declare const CodeMark: LeafUiComponent;
package/ui/code-mark.js DELETED
@@ -1,13 +0,0 @@
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.CodeMark = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const CLASS_NAME = "uxf-wysiwyg__element";
9
- const CodeMark = (props) => {
10
- var _a;
11
- return (react_1.default.createElement("code", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-code ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
12
- };
13
- exports.CodeMark = CodeMark;
@@ -1,9 +0,0 @@
1
- import { FC } from "react";
2
- interface ElementActionButtonsProps {
3
- className?: string;
4
- onEdit: () => void;
5
- onDelete: () => void;
6
- isSelected: boolean;
7
- }
8
- export declare const ElementActionButtons: FC<ElementActionButtonsProps>;
9
- export {};
@@ -1,22 +0,0 @@
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.ElementActionButtons = void 0;
7
- const button_1 = require("@uxf/ui/button");
8
- const icon_1 = require("@uxf/ui/icon");
9
- const react_1 = __importDefault(require("react"));
10
- const CLASS_NAME = "uxf-wysiwyg__element-action-buttons";
11
- const ElementActionButtons = (props) => {
12
- var _a;
13
- if (!props.isSelected) {
14
- return null;
15
- }
16
- return (react_1.default.createElement("div", { className: `${CLASS_NAME} ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, contentEditable: false, tabIndex: -1 },
17
- react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME}__edit`, isIconButton: true, onClick: props.onEdit, variant: "secondary" },
18
- react_1.default.createElement(icon_1.Icon, { name: "edit" })),
19
- react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME}__delete`, isIconButton: true, onClick: props.onDelete, variant: "secondary" },
20
- react_1.default.createElement(icon_1.Icon, { name: "delete" }))));
21
- };
22
- exports.ElementActionButtons = ElementActionButtons;
@@ -1,10 +0,0 @@
1
- import { FC, PropsWithChildren } from "react";
2
- interface Props extends PropsWithChildren {
3
- className?: string;
4
- onEdit: () => void;
5
- onDelete: () => void;
6
- isSelected: boolean;
7
- padding?: boolean;
8
- }
9
- export declare const ElementWithActionButtons: FC<Props>;
10
- export {};
@@ -1,17 +0,0 @@
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.ElementWithActionButtons = void 0;
7
- const classes_1 = require("@uxf/core/constants/classes");
8
- const cx_1 = require("@uxf/core/utils/cx");
9
- const react_1 = __importDefault(require("react"));
10
- const element_action_buttons_1 = require("./element-action-buttons");
11
- const CLASS_NAME = "uxf-wysiwyg__element-with-action-buttons";
12
- const ElementWithActionButtons = (props) => {
13
- return (react_1.default.createElement("div", { className: (0, cx_1.cx)(CLASS_NAME, props.padding && `${CLASS_NAME}--has-padding`, props.isSelected && `${CLASS_NAME}--${classes_1.CLASSES.IS_SELECTED}`, props.className), contentEditable: false },
14
- react_1.default.createElement(element_action_buttons_1.ElementActionButtons, { isSelected: props.isSelected, onDelete: props.onDelete, onEdit: props.onEdit }),
15
- props.children));
16
- };
17
- exports.ElementWithActionButtons = ElementWithActionButtons;
@@ -1,9 +0,0 @@
1
- import { FC } from "react";
2
- import { UxfEditor } from "../../../types";
3
- interface ModalButtonCancelProps {
4
- editor: UxfEditor;
5
- onCancel?: () => void;
6
- cancelText?: string;
7
- }
8
- export declare const ModalButtonCancel: FC<ModalButtonCancelProps>;
9
- export {};
@@ -1,45 +0,0 @@
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.ModalButtonCancel = void 0;
27
- const button_1 = require("@uxf/ui/button");
28
- const react_1 = __importStar(require("react"));
29
- const context_1 = require("../../../translations/context");
30
- const utils_1 = require("../../utils");
31
- const ModalButtonCancel = (props) => {
32
- var _a;
33
- const t = (0, context_1.useTranslation)();
34
- const onCancel = props.onCancel;
35
- const cancelHandler = (0, react_1.useCallback)(() => {
36
- if (onCancel) {
37
- onCancel();
38
- }
39
- else {
40
- (0, utils_1.closeModalWithFocus)(props.editor);
41
- }
42
- }, [onCancel, props.editor]);
43
- return (react_1.default.createElement(button_1.Button, { className: "uxf-wysiwyg__modal-button-cancel", color: "default", onClick: cancelHandler, variant: "secondary" }, (_a = props.cancelText) !== null && _a !== void 0 ? _a : t("wysiwyg:components.modal.button-cancel")));
44
- };
45
- exports.ModalButtonCancel = ModalButtonCancel;
@@ -1,6 +0,0 @@
1
- import { FC } from "react";
2
- interface ModalButtonSubmitProps {
3
- submitText: string;
4
- }
5
- export declare const ModalButtonSubmit: FC<ModalButtonSubmitProps>;
6
- export {};
@@ -1,12 +0,0 @@
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.ModalButtonSubmit = void 0;
7
- const button_1 = require("@uxf/ui/button");
8
- const react_1 = __importDefault(require("react"));
9
- const ModalButtonSubmit = (props) => {
10
- return (react_1.default.createElement(button_1.Button, { className: "uxf-wysiwyg__modal-button-submit", color: "default", type: "submit" }, props.submitText));
11
- };
12
- exports.ModalButtonSubmit = ModalButtonSubmit;
@@ -1,11 +0,0 @@
1
- import { FC } from "react";
2
- import { UxfEditor } from "../../../types";
3
- interface ModalButtonsProps {
4
- className?: string;
5
- editor: UxfEditor;
6
- submitText: string;
7
- onCancel?: () => void;
8
- cancelText?: string;
9
- }
10
- export declare const ModalButtons: FC<ModalButtonsProps>;
11
- export {};
@@ -1,16 +0,0 @@
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.ModalButtons = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const modal_button_cancel_1 = require("./modal-button-cancel");
9
- const modal_button_submit_1 = require("./modal-button-submit");
10
- const ModalButtons = (props) => {
11
- var _a;
12
- return (react_1.default.createElement("div", { className: `uxf-wysiwyg__modal-buttons ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
13
- react_1.default.createElement(modal_button_cancel_1.ModalButtonCancel, { cancelText: props.cancelText, editor: props.editor, onCancel: props.onCancel }),
14
- react_1.default.createElement(modal_button_submit_1.ModalButtonSubmit, { submitText: props.submitText })));
15
- };
16
- exports.ModalButtons = ModalButtons;
@@ -1,6 +0,0 @@
1
- import { FC, PropsWithChildren } from "react";
2
- interface Props extends PropsWithChildren {
3
- title: string;
4
- }
5
- export declare const ModalContent: FC<Props>;
6
- export {};
@@ -1,14 +0,0 @@
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.ModalContent = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const CLASS_NAME = "uxf-wysiwyg__modal";
9
- const ModalContent = (props) => {
10
- return (react_1.default.createElement("div", { className: CLASS_NAME },
11
- react_1.default.createElement("p", { className: `${CLASS_NAME}-title` }, props.title),
12
- props.children));
13
- };
14
- exports.ModalContent = ModalContent;
@@ -1,21 +0,0 @@
1
- export declare const createUxfUi: () => {
2
- p: import("..").ElementUiComponent;
3
- blockquote: import("..").ElementUiComponent;
4
- h1: import("..").ElementUiComponent;
5
- h2: import("..").ElementUiComponent;
6
- h3: import("..").ElementUiComponent;
7
- h4: import("..").ElementUiComponent;
8
- h5: import("..").ElementUiComponent;
9
- h6: import("..").ElementUiComponent;
10
- bold: import("..").LeafUiComponent;
11
- italic: import("..").ElementUiComponent;
12
- underline: import("..").LeafUiComponent;
13
- code: import("..").LeafUiComponent;
14
- li: import("..").ElementUiComponent;
15
- ul: import("..").ElementUiComponent;
16
- ol: import("..").ElementUiComponent;
17
- a: import("..").ElementUiComponent<import("../plugins/link/types").TLinkElement>;
18
- img: import("..").ElementUiComponent<import("..").UxfImageElement>;
19
- video: import("..").ElementUiComponent<import("..").UxfVideoElement>;
20
- button: import("..").ElementUiComponent<import("..").UxfButtonElement>;
21
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createUxfUi = void 0;
4
- const types_1 = require("../plugins/blockquote/types");
5
- const button_1 = require("../plugins/button");
6
- const create_video_plugin_1 = require("../plugins/embedded/video/create-video-plugin");
7
- const constants_1 = require("../plugins/heading/constants");
8
- const types_2 = require("../plugins/image/types");
9
- const constants_2 = require("../plugins/link/constants");
10
- const constants_3 = require("../plugins/list/constants");
11
- const types_3 = require("../plugins/mark-bold/types");
12
- const types_4 = require("../plugins/mark-code/types");
13
- const types_5 = require("../plugins/mark-italic/types");
14
- const types_6 = require("../plugins/mark-underline/types");
15
- const types_7 = require("../plugins/paragraph/types");
16
- const blockquote_element_1 = require("./blockquote-element");
17
- const bold_mark_1 = require("./bold-mark");
18
- const button_2 = require("./button");
19
- const code_mark_1 = require("./code-mark");
20
- const heading_elements_1 = require("./heading-elements");
21
- const image_element_1 = require("./image/image-element");
22
- const italic_mark_1 = require("./italic-mark");
23
- const link_element_1 = require("./link-element");
24
- const list_item_element_1 = require("./list-item-element");
25
- const list_ordered_element_1 = require("./list-ordered-element");
26
- const list_unordered_element_1 = require("./list-unordered-element");
27
- const paragraph_element_1 = require("./paragraph-element");
28
- const underline_mark_1 = require("./underline-mark");
29
- const video_element_1 = require("./video/video-element");
30
- const createUxfUi = () => ({
31
- [types_7.PARAGRAPH_PLUGIN_KEY]: paragraph_element_1.ParagraphElement,
32
- [types_1.BLOCKQUOTE_PLUGIN_KEY]: blockquote_element_1.BlockquoteElement,
33
- [constants_1.ELEMENT_H1]: heading_elements_1.H1Element,
34
- [constants_1.ELEMENT_H2]: heading_elements_1.H2Element,
35
- [constants_1.ELEMENT_H3]: heading_elements_1.H3Element,
36
- [constants_1.ELEMENT_H4]: heading_elements_1.H4Element,
37
- [constants_1.ELEMENT_H5]: heading_elements_1.H5Element,
38
- [constants_1.ELEMENT_H6]: heading_elements_1.H6Element,
39
- [types_3.BOLD_PLUGIN_KEY]: bold_mark_1.BoldMark,
40
- [types_5.ITALIC_PLUGIN_KEY]: italic_mark_1.ItalicMark,
41
- [types_6.UNDER_LINE_PLUGIN_KEY]: underline_mark_1.UnderlineMark,
42
- [types_4.CODE_PLUGIN_KEY]: code_mark_1.CodeMark,
43
- [constants_3.ELEMENT_LI]: list_item_element_1.ListItemElement,
44
- [constants_3.ELEMENT_UL]: list_unordered_element_1.ListUnorderedElement,
45
- [constants_3.ELEMENT_OL]: list_ordered_element_1.ListOrderedElement,
46
- [constants_2.ELEMENT_LINK]: link_element_1.LinkElement,
47
- [types_2.IMAGE_PLUGIN_KEY]: image_element_1.ImageElement,
48
- [create_video_plugin_1.ELEMENT_VIDEO_EMBED]: video_element_1.VideoElement,
49
- [button_1.PLUGIN_BUTTON_KEY]: button_2.ButtonElement,
50
- });
51
- exports.createUxfUi = createUxfUi;
@@ -1,2 +0,0 @@
1
- import { RenderAfterEditable } from "../types";
2
- export declare const FloatingLink: RenderAfterEditable;
@@ -1,110 +0,0 @@
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.FloatingLink = void 0;
27
- const plate_floating_1 = require("@udecode/plate-floating");
28
- const plate_link_1 = require("@udecode/plate-link");
29
- const button_1 = require("@uxf/ui/button");
30
- const button_group_1 = require("@uxf/ui/button-group");
31
- const checkbox_input_1 = require("@uxf/ui/checkbox-input");
32
- const icon_1 = require("@uxf/ui/icon");
33
- const text_input_1 = require("@uxf/ui/text-input");
34
- const react_1 = __importStar(require("react"));
35
- const hooks_1 = require("../hooks");
36
- const floating_link_wrapper_1 = require("../plugins/link/floating-link-wrapper");
37
- const hooks_2 = require("../plugins/link/hooks");
38
- const get_active_link_1 = require("../plugins/link/transforms/get-active-link");
39
- const unwrap_link_1 = require("../plugins/link/transforms/unwrap-link");
40
- const context_1 = require("../translations/context");
41
- const url_helper_1 = require("../utils/url-helper");
42
- const CLASS_NAME = "uxf-wysiwyg__floating-link";
43
- const EDIT_CLASS_NAME = `${CLASS_NAME}-edit`;
44
- const Edit = () => {
45
- var _a, _b;
46
- const editor = (0, hooks_1.useUxfEditorRef)();
47
- const url = (_b = (_a = (0, get_active_link_1.getActiveLink)(editor)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : "";
48
- return (react_1.default.createElement(button_group_1.ButtonGroup, { className: EDIT_CLASS_NAME },
49
- react_1.default.createElement(button_1.Button, { className: `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-edit`, isIconButton: true, onClick: () => (0, plate_link_1.triggerFloatingLinkEdit)(editor), variant: "secondary" },
50
- react_1.default.createElement(icon_1.Icon, { name: "edit", size: 15 })),
51
- react_1.default.createElement(button_1.Button, { className: `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-open`, href: !url_helper_1.UrlHelper.hasProtocol(url) ? `https://${url}` : url, isIconButton: true, target: "_blank", variant: "secondary" },
52
- react_1.default.createElement(icon_1.Icon, { name: "open-link-in-new-tab", size: 15 })),
53
- react_1.default.createElement(button_1.Button, { className: `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-delete`, isIconButton: true, onClick: () => (0, unwrap_link_1.removeLink)(editor), variant: "secondary" },
54
- react_1.default.createElement(icon_1.Icon, { name: "delete", size: 15 }))));
55
- };
56
- function useInsertLinkFormAutoFocus() {
57
- const id = (0, react_1.useId)();
58
- // TODO FEB-139 - native html autoFocus breaks popover placement in insert mode
59
- (0, react_1.useEffect)(() => {
60
- let timer;
61
- const firstInput = document.querySelector(`#${CSS.escape(id)}`);
62
- if (firstInput instanceof HTMLElement) {
63
- timer = window.setTimeout(() => firstInput.focus(), 0);
64
- }
65
- return () => {
66
- clearTimeout(timer);
67
- };
68
- }, [id]);
69
- return id;
70
- }
71
- const INSERT_CLASS_NAME = `${CLASS_NAME}-insert`;
72
- const Insert = () => {
73
- const t = (0, context_1.useTranslation)();
74
- const linkActions = (0, hooks_2.useLinkActions)();
75
- const editor = (0, hooks_1.useUxfEditorRef)();
76
- const [isSubmitted, setIsSubmitted] = (0, react_1.useState)(false);
77
- const firstInputId = useInsertLinkFormAutoFocus();
78
- const onSubmit = (e) => {
79
- e.preventDefault();
80
- e.stopPropagation();
81
- setIsSubmitted(true);
82
- if (!linkActions.getUrl || !url_helper_1.UrlHelper.isValid(linkActions.getUrl)) {
83
- return;
84
- }
85
- (0, plate_link_1.submitFloatingLink)(editor);
86
- };
87
- const emptyUrl = isSubmitted && !linkActions.getUrl;
88
- const invalidUrl = isSubmitted && !url_helper_1.UrlHelper.isValid(linkActions.getUrl);
89
- return (react_1.default.createElement("div", { className: INSERT_CLASS_NAME },
90
- react_1.default.createElement("form", { className: `${INSERT_CLASS_NAME}__form`, id: "insert-link-form", onSubmit: onSubmit },
91
- react_1.default.createElement("div", { className: `${INSERT_CLASS_NAME}__form-inputs` },
92
- react_1.default.createElement(text_input_1.TextInput, { helperText: emptyUrl
93
- ? t("wysiwyg:plugins.link.url-address.required")
94
- : invalidUrl
95
- ? t("wysiwyg:plugins.link.url-address.invalid")
96
- : undefined, hiddenLabel: true, id: firstInputId, isInvalid: emptyUrl || invalidUrl, isRequired: true, label: t("wysiwyg:plugins.link.url-address.label"), leftAddon: t("wysiwyg:plugins.link.url-address.label"), name: "url-address", onChange: linkActions.setUrl, placeholder: t("wysiwyg:plugins.link.url-address.placeholder"), value: linkActions.getUrl }),
97
- react_1.default.createElement(text_input_1.TextInput, { hiddenLabel: true, label: t("wysiwyg:plugins.link.link-text.label"), leftAddon: t("wysiwyg:plugins.link.link-text.label"), name: "link-text", onChange: linkActions.setText, placeholder: t("wysiwyg:plugins.link.link-text.placeholder"), value: linkActions.getText }),
98
- react_1.default.createElement(checkbox_input_1.CheckboxInput, { label: t("wysiwyg:plugins.link.open-in-new-tab"), name: "open-in-new-tab", onChange: (checked) => linkActions.setTarget(checked ? "_blank" : "_self"), value: linkActions.getTarget === "_blank" })),
99
- react_1.default.createElement("div", { className: `${INSERT_CLASS_NAME}__form-buttons` },
100
- react_1.default.createElement(button_1.Button, { className: `${INSERT_CLASS_NAME}__form-submit-button`, type: "submit" }, t("wysiwyg:plugins.link.button-save"))),
101
- react_1.default.createElement("button", { hidden: true, type: "submit" }))));
102
- };
103
- const FloatingLink = () => {
104
- const isEditing = (0, plate_link_1.useFloatingLinkSelectors)().isEditing();
105
- return (react_1.default.createElement(plate_floating_1.FloatingPortal, null,
106
- react_1.default.createElement(floating_link_wrapper_1.FloatingLinkWrapper.InsertRoot, null,
107
- react_1.default.createElement(Insert, null)),
108
- react_1.default.createElement(floating_link_wrapper_1.FloatingLinkWrapper.EditRoot, null, !isEditing ? react_1.default.createElement(Edit, null) : react_1.default.createElement(Insert, null))));
109
- };
110
- exports.FloatingLink = FloatingLink;
@@ -1,7 +0,0 @@
1
- import { ElementUiComponent } from "../types";
2
- export declare const H1Element: ElementUiComponent;
3
- export declare const H2Element: ElementUiComponent;
4
- export declare const H3Element: ElementUiComponent;
5
- export declare const H4Element: ElementUiComponent;
6
- export declare const H5Element: ElementUiComponent;
7
- export declare const H6Element: ElementUiComponent;
@@ -1,38 +0,0 @@
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.H6Element = exports.H5Element = exports.H4Element = exports.H3Element = exports.H2Element = exports.H1Element = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const CLASS_NAME = "uxf-wysiwyg__element";
9
- const H1Element = (props) => {
10
- var _a;
11
- return (react_1.default.createElement("h1", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h1 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
12
- };
13
- exports.H1Element = H1Element;
14
- const H2Element = (props) => {
15
- var _a;
16
- return (react_1.default.createElement("h2", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h2 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
17
- };
18
- exports.H2Element = H2Element;
19
- const H3Element = (props) => {
20
- var _a;
21
- return (react_1.default.createElement("h3", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h3 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
22
- };
23
- exports.H3Element = H3Element;
24
- const H4Element = (props) => {
25
- var _a;
26
- return (react_1.default.createElement("h4", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h4 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
27
- };
28
- exports.H4Element = H4Element;
29
- const H5Element = (props) => {
30
- var _a;
31
- return (react_1.default.createElement("h5", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h5 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
32
- };
33
- exports.H5Element = H5Element;
34
- const H6Element = (props) => {
35
- var _a;
36
- return (react_1.default.createElement("h6", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-heading-h6 ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
37
- };
38
- exports.H6Element = H6Element;
@@ -1,3 +0,0 @@
1
- import { FC } from "react";
2
- import { HighlightLeafElementProps } from "../plugins/highlight/types";
3
- export declare const HighlightMark: FC<HighlightLeafElementProps>;
@@ -1,13 +0,0 @@
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.HighlightMark = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const CLASS_NAME = "uxf-wysiwyg__element";
9
- const HighlightMark = (props) => {
10
- var _a;
11
- return (react_1.default.createElement("mark", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-highlight ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, style: { "--highlight-color": props.color } }, props.children));
12
- };
13
- exports.HighlightMark = HighlightMark;
@@ -1,2 +0,0 @@
1
- import { ElementUiComponent, UxfImageElement } from "../../types";
2
- export declare const ImageElement: ElementUiComponent<UxfImageElement>;
@@ -1,53 +0,0 @@
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.ImageElement = void 0;
27
- const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
28
- const modal_service_1 = require("@uxf/ui/modal/modal-service");
29
- const react_1 = __importStar(require("react"));
30
- const hooks_1 = require("../../hooks");
31
- const get_active_image_1 = require("../../plugins/image/transforms/get-active-image");
32
- const remove_selected_image_1 = require("../../plugins/image/transforms/remove-selected-image");
33
- const element_with_action_buttons_1 = require("../components/element/element-with-action-buttons");
34
- const insert_image_modal_content_1 = require("./insert-image-modal-content");
35
- const CLASS_NAME = "uxf-wysiwyg__element";
36
- const ImageElement = (props) => {
37
- var _a;
38
- const selected = (0, hooks_1.useSelected)();
39
- const onEdit = (0, react_1.useCallback)(() => {
40
- (0, modal_service_1.openModal)({
41
- children: (react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "lg" },
42
- react_1.default.createElement(insert_image_modal_content_1.InsertImageModalContent, { editor: props.editor, imageToEdit: (0, get_active_image_1.getActiveImage)(props.editor) }))),
43
- });
44
- }, [props.editor]);
45
- const onDelete = (0, react_1.useCallback)(() => {
46
- (0, remove_selected_image_1.removeSelectedImage)(props.editor);
47
- }, [props.editor]);
48
- return (react_1.default.createElement("div", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-image ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
49
- react_1.default.createElement(element_with_action_buttons_1.ElementWithActionButtons, { className: `${CLASS_NAME}-image__action-buttons`, isSelected: selected, onDelete: onDelete, onEdit: onEdit },
50
- react_1.default.createElement("img", { alt: props.element.alt, className: `${CLASS_NAME}-image__img`, src: props.element.url })),
51
- props.children));
52
- };
53
- exports.ImageElement = ImageElement;
@@ -1,8 +0,0 @@
1
- import { FC } from "react";
2
- import { UxfEditor, UxfImageElement } from "../../types";
3
- interface InsertImageModalContentProps {
4
- editor: UxfEditor;
5
- imageToEdit?: UxfImageElement;
6
- }
7
- export declare const InsertImageModalContent: FC<InsertImageModalContentProps>;
8
- export {};