@uxf/wysiwyg 11.74.0 → 11.74.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) 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/translations/cs.json +134 -0
  149. package/translations/de.json +134 -0
  150. package/translations/en.json +134 -0
  151. package/translations/sk.json +134 -0
  152. package/types.d.ts +118 -0
  153. package/types.js +2 -0
  154. package/ui/blockquote-element.d.ts +2 -0
  155. package/ui/blockquote-element.js +13 -0
  156. package/ui/bold-mark.d.ts +2 -0
  157. package/ui/bold-mark.js +13 -0
  158. package/ui/button/button-element.d.ts +2 -0
  159. package/ui/button/button-element.js +54 -0
  160. package/ui/button/index.d.ts +1 -0
  161. package/ui/button/index.js +5 -0
  162. package/ui/button/insert-button-modal-content.d.ts +8 -0
  163. package/ui/button/insert-button-modal-content.js +81 -0
  164. package/ui/code-mark.d.ts +2 -0
  165. package/ui/code-mark.js +13 -0
  166. package/ui/components/element/element-action-buttons.d.ts +9 -0
  167. package/ui/components/element/element-action-buttons.js +22 -0
  168. package/ui/components/element/element-with-action-buttons.d.ts +10 -0
  169. package/ui/components/element/element-with-action-buttons.js +17 -0
  170. package/ui/components/modal/modal-button-cancel.d.ts +9 -0
  171. package/ui/components/modal/modal-button-cancel.js +45 -0
  172. package/ui/components/modal/modal-button-submit.d.ts +6 -0
  173. package/ui/components/modal/modal-button-submit.js +12 -0
  174. package/ui/components/modal/modal-buttons.d.ts +11 -0
  175. package/ui/components/modal/modal-buttons.js +16 -0
  176. package/ui/components/modal/modal-content.d.ts +6 -0
  177. package/ui/components/modal/modal-content.js +14 -0
  178. package/ui/create-uxf-ui.d.ts +21 -0
  179. package/ui/create-uxf-ui.js +51 -0
  180. package/ui/floating-link.d.ts +2 -0
  181. package/ui/floating-link.js +110 -0
  182. package/ui/heading-elements.d.ts +7 -0
  183. package/ui/heading-elements.js +38 -0
  184. package/ui/highlight-mark.d.ts +3 -0
  185. package/ui/highlight-mark.js +13 -0
  186. package/ui/image/image-element.d.ts +2 -0
  187. package/ui/image/image-element.js +53 -0
  188. package/ui/image/insert-image-modal-content.d.ts +8 -0
  189. package/ui/image/insert-image-modal-content.js +89 -0
  190. package/ui/italic-mark.d.ts +2 -0
  191. package/ui/italic-mark.js +13 -0
  192. package/ui/link-element.d.ts +3 -0
  193. package/ui/link-element.js +14 -0
  194. package/ui/list-item-element.d.ts +2 -0
  195. package/ui/list-item-element.js +13 -0
  196. package/ui/list-ordered-element.d.ts +2 -0
  197. package/ui/list-ordered-element.js +13 -0
  198. package/ui/list-unordered-element.d.ts +2 -0
  199. package/ui/list-unordered-element.js +13 -0
  200. package/ui/paragraph-element.d.ts +2 -0
  201. package/ui/paragraph-element.js +13 -0
  202. package/ui/toolbar/buttons/button-toolbar-button.d.ts +10 -0
  203. package/ui/toolbar/buttons/button-toolbar-button.js +20 -0
  204. package/ui/toolbar/buttons/element-toolbar-button.d.ts +12 -0
  205. package/ui/toolbar/buttons/element-toolbar-button.js +25 -0
  206. package/ui/toolbar/buttons/image-toolbar-button.d.ts +10 -0
  207. package/ui/toolbar/buttons/image-toolbar-button.js +20 -0
  208. package/ui/toolbar/buttons/link-toolbar-button.d.ts +10 -0
  209. package/ui/toolbar/buttons/link-toolbar-button.js +29 -0
  210. package/ui/toolbar/buttons/list-toolbar-button.d.ts +13 -0
  211. package/ui/toolbar/buttons/list-toolbar-button.js +27 -0
  212. package/ui/toolbar/buttons/mark-toolbar-button.d.ts +13 -0
  213. package/ui/toolbar/buttons/mark-toolbar-button.js +25 -0
  214. package/ui/toolbar/buttons/modal-toolbar-button.d.ts +15 -0
  215. package/ui/toolbar/buttons/modal-toolbar-button.js +22 -0
  216. package/ui/toolbar/buttons/toolbar-button.d.ts +15 -0
  217. package/ui/toolbar/buttons/toolbar-button.js +35 -0
  218. package/ui/toolbar/buttons/undo-redo-button-group.d.ts +8 -0
  219. package/ui/toolbar/buttons/undo-redo-button-group.js +64 -0
  220. package/ui/toolbar/buttons/video-toolbar-button.d.ts +10 -0
  221. package/ui/toolbar/buttons/video-toolbar-button.js +20 -0
  222. package/ui/toolbar/toolbar.d.ts +3 -0
  223. package/ui/toolbar/toolbar.js +77 -0
  224. package/ui/toolbar/types.d.ts +8 -0
  225. package/ui/toolbar/types.js +2 -0
  226. package/ui/underline-mark.d.ts +2 -0
  227. package/ui/underline-mark.js +13 -0
  228. package/ui/utils.d.ts +2 -0
  229. package/ui/utils.js +13 -0
  230. package/ui/video/insert-video-modal-content.d.ts +8 -0
  231. package/ui/video/insert-video-modal-content.js +80 -0
  232. package/ui/video/video-element.d.ts +2 -0
  233. package/ui/video/video-element.js +55 -0
  234. package/utils/get-video-meta-data.d.ts +2 -0
  235. package/utils/get-video-meta-data.js +41 -0
  236. package/utils/url-helper.d.ts +7 -0
  237. package/utils/url-helper.js +15 -0
  238. package/utils/url-helper.test.d.ts +1 -0
  239. package/utils/url-helper.test.js +37 -0
  240. package/utils.d.ts +30 -0
  241. package/utils.js +88 -0
  242. package/wysiwyg-editor.d.ts +15 -0
  243. package/wysiwyg-editor.js +42 -0
  244. package/wysiwyg-editor.stories.d.ts +5 -0
  245. package/wysiwyg-editor.stories.js +193 -0
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BLOCKQUOTE_PLUGIN_TYPE = exports.BLOCKQUOTE_PLUGIN_KEY = void 0;
4
+ const plate_block_quote_1 = require("@udecode/plate-block-quote");
5
+ exports.BLOCKQUOTE_PLUGIN_KEY = plate_block_quote_1.ELEMENT_BLOCKQUOTE;
6
+ exports.BLOCKQUOTE_PLUGIN_TYPE = "blockquote";
@@ -0,0 +1,2 @@
1
+ export declare const PLUGIN_BUTTON_KEY = "button";
2
+ export declare const PLUGIN_BUTTON_TYPE = "button";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_BUTTON_TYPE = exports.PLUGIN_BUTTON_KEY = void 0;
4
+ exports.PLUGIN_BUTTON_KEY = "button";
5
+ exports.PLUGIN_BUTTON_TYPE = exports.PLUGIN_BUTTON_KEY;
@@ -0,0 +1,2 @@
1
+ import { WysiwygContent } from "../../types";
2
+ export declare const createButtonPlugin: <OP = import("@udecode/utils").AnyObject, OV extends import("@udecode/slate").Value = WysiwygContent, OE extends import("@udecode/plate-core").PlateEditor<OV> = import("@udecode/plate-core").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createButtonPlugin = void 0;
4
+ const plate_core_1 = require("@udecode/plate-core");
5
+ const constants_1 = require("./constants");
6
+ exports.createButtonPlugin = (0, plate_core_1.createPluginFactory)({
7
+ key: constants_1.PLUGIN_BUTTON_KEY,
8
+ type: constants_1.PLUGIN_BUTTON_TYPE,
9
+ isElement: true,
10
+ isVoid: true,
11
+ });
@@ -0,0 +1,3 @@
1
+ export { PLUGIN_BUTTON_KEY, PLUGIN_BUTTON_TYPE } from "./constants";
2
+ export { createButtonPlugin } from "./create-button-plugin";
3
+ export * from "./transforms";
@@ -0,0 +1,23 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createButtonPlugin = exports.PLUGIN_BUTTON_TYPE = exports.PLUGIN_BUTTON_KEY = void 0;
18
+ var constants_1 = require("./constants");
19
+ Object.defineProperty(exports, "PLUGIN_BUTTON_KEY", { enumerable: true, get: function () { return constants_1.PLUGIN_BUTTON_KEY; } });
20
+ Object.defineProperty(exports, "PLUGIN_BUTTON_TYPE", { enumerable: true, get: function () { return constants_1.PLUGIN_BUTTON_TYPE; } });
21
+ var create_button_plugin_1 = require("./create-button-plugin");
22
+ Object.defineProperty(exports, "createButtonPlugin", { enumerable: true, get: function () { return create_button_plugin_1.createButtonPlugin; } });
23
+ __exportStar(require("./transforms"), exports);
@@ -0,0 +1,2 @@
1
+ import { UxfButtonElement, UxfEditor } from "../../../types";
2
+ export declare const getActiveButton: (editor: UxfEditor) => UxfButtonElement | undefined;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveButton = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const constants_1 = require("../constants");
6
+ const getActiveButton = (editor) => {
7
+ return (0, utils_1.getActiveElement)(editor, constants_1.PLUGIN_BUTTON_TYPE);
8
+ };
9
+ exports.getActiveButton = getActiveButton;
@@ -0,0 +1,4 @@
1
+ export { getActiveButton } from "./get-active-button";
2
+ export { insertButton } from "./insert-button";
3
+ export { isButtonActive } from "./is-button-active";
4
+ export { updateButton } from "./update-button";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateButton = exports.isButtonActive = exports.insertButton = exports.getActiveButton = void 0;
4
+ var get_active_button_1 = require("./get-active-button");
5
+ Object.defineProperty(exports, "getActiveButton", { enumerable: true, get: function () { return get_active_button_1.getActiveButton; } });
6
+ var insert_button_1 = require("./insert-button");
7
+ Object.defineProperty(exports, "insertButton", { enumerable: true, get: function () { return insert_button_1.insertButton; } });
8
+ var is_button_active_1 = require("./is-button-active");
9
+ Object.defineProperty(exports, "isButtonActive", { enumerable: true, get: function () { return is_button_active_1.isButtonActive; } });
10
+ var update_button_1 = require("./update-button");
11
+ Object.defineProperty(exports, "updateButton", { enumerable: true, get: function () { return update_button_1.updateButton; } });
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const insertButton: (editor: UxfEditor, buttonText: string, buttonUrl: string) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertButton = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const constants_1 = require("../constants");
6
+ const insertButton = (editor, buttonText, buttonUrl) => {
7
+ const text = { text: "" };
8
+ const button = {
9
+ type: constants_1.PLUGIN_BUTTON_KEY,
10
+ buttonText,
11
+ buttonUrl,
12
+ children: [text],
13
+ };
14
+ (0, utils_1.insertVoid)(editor, button);
15
+ };
16
+ exports.insertButton = insertButton;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const isButtonActive: (editor: UxfEditor) => boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isButtonActive = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const get_active_button_1 = require("./get-active-button");
6
+ const isButtonActive = (editor) => Boolean((0, get_active_button_1.getActiveButton)(editor) && (0, plate_common_1.isRangeInSameBlock)(editor));
7
+ exports.isButtonActive = isButtonActive;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const removeSelectedButton: (editor: UxfEditor) => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeSelectedButton = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const get_active_button_1 = require("./get-active-button");
6
+ const removeSelectedButton = (editor) => {
7
+ const activeButton = (0, get_active_button_1.getActiveButton)(editor);
8
+ if (!activeButton) {
9
+ return false;
10
+ }
11
+ return (0, utils_1.removeElement)(editor, activeButton);
12
+ };
13
+ exports.removeSelectedButton = removeSelectedButton;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const updateButton: (editor: UxfEditor, buttonText: string, buttonUrl: string) => void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateButton = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const updateButton = (editor, buttonText, buttonUrl) => (0, plate_common_1.setNodes)(editor, {
6
+ buttonText,
7
+ buttonUrl,
8
+ });
9
+ exports.updateButton = updateButton;
@@ -0,0 +1 @@
1
+ export { parseIframeUrl, parseTwitterUrl, parseVideoUrl } from "@udecode/plate-media";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseVideoUrl = exports.parseTwitterUrl = exports.parseIframeUrl = void 0;
4
+ var plate_media_1 = require("@udecode/plate-media");
5
+ Object.defineProperty(exports, "parseIframeUrl", { enumerable: true, get: function () { return plate_media_1.parseIframeUrl; } });
6
+ Object.defineProperty(exports, "parseTwitterUrl", { enumerable: true, get: function () { return plate_media_1.parseTwitterUrl; } });
7
+ Object.defineProperty(exports, "parseVideoUrl", { enumerable: true, get: function () { return plate_media_1.parseVideoUrl; } });
@@ -0,0 +1,4 @@
1
+ import { MediaPlugin } from "@udecode/plate-media";
2
+ import { WysiwygContent } from "../../../types";
3
+ export declare const ELEMENT_VIDEO_EMBED = "video";
4
+ export declare const createVideoPlugin: <OP = MediaPlugin, OV extends import("@udecode/slate").Value = WysiwygContent, OE extends import("@udecode/plate-core").PlateEditor<OV> = import("@udecode/plate-core").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createVideoPlugin = exports.ELEMENT_VIDEO_EMBED = void 0;
4
+ const plate_core_1 = require("@udecode/plate-core");
5
+ const utils_1 = require("../utils");
6
+ exports.ELEMENT_VIDEO_EMBED = "video";
7
+ exports.createVideoPlugin = (0, plate_core_1.createPluginFactory)({
8
+ key: exports.ELEMENT_VIDEO_EMBED,
9
+ isElement: true,
10
+ isVoid: true,
11
+ options: {
12
+ transformUrl: utils_1.parseIframeUrl,
13
+ rules: [
14
+ {
15
+ parser: utils_1.parseVideoUrl,
16
+ },
17
+ ],
18
+ },
19
+ });
@@ -0,0 +1,2 @@
1
+ import { UxfEditor, UxfVideoElement } from "../../../types";
2
+ export declare const getActiveVideo: (editor: UxfEditor) => UxfVideoElement | undefined;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveVideo = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const create_video_plugin_1 = require("./create-video-plugin");
6
+ const getActiveVideo = (editor) => {
7
+ return (0, utils_1.getActiveElement)(editor, create_video_plugin_1.ELEMENT_VIDEO_EMBED);
8
+ };
9
+ exports.getActiveVideo = getActiveVideo;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor, type UxfVideoMetaData } from "../../../types";
2
+ export declare const insertVideo: (editor: UxfEditor, url: string, embeddedUrl: string, provider: string, videoId: string, metaData: UxfVideoMetaData | null) => void;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertVideo = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const create_video_plugin_1 = require("./create-video-plugin");
6
+ const insertVideo = (editor, url, embeddedUrl, provider, videoId, metaData) => {
7
+ const text = { text: "" };
8
+ const element = {
9
+ type: create_video_plugin_1.ELEMENT_VIDEO_EMBED,
10
+ url,
11
+ embeddedUrl,
12
+ provider,
13
+ videoId,
14
+ children: [text],
15
+ metaData,
16
+ };
17
+ (0, utils_1.insertVoid)(editor, element);
18
+ };
19
+ exports.insertVideo = insertVideo;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor, type UxfVideoMetaData } from "../../../types";
2
+ export declare const updateVideo: (editor: UxfEditor, url: string, embeddedUrl: string, provider: string, videoId: string, metaData: UxfVideoMetaData | null) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateVideo = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const updateVideo = (editor, url, embeddedUrl, provider, videoId, metaData) => (0, plate_common_1.setNodes)(editor, {
6
+ url,
7
+ embeddedUrl,
8
+ provider,
9
+ videoId,
10
+ metaData,
11
+ });
12
+ exports.updateVideo = updateVideo;
@@ -0,0 +1,3 @@
1
+ import { ExitBreakPlugin } from "@udecode/plate-break";
2
+ import { UxfEditor, WysiwygContent } from "../../types";
3
+ export declare const createExitBreakPlugin: () => import("@udecode/plate-core").PlatePlugin<ExitBreakPlugin, WysiwygContent, UxfEditor>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createExitBreakPlugin = void 0;
4
+ const plate_break_1 = require("@udecode/plate-break");
5
+ const types_1 = require("../blockquote/types");
6
+ const constants_1 = require("../heading/constants");
7
+ const createExitBreakPlugin = () => (0, plate_break_1.createExitBreakPlugin)({
8
+ options: {
9
+ rules: [
10
+ {
11
+ hotkey: "mod+enter",
12
+ },
13
+ {
14
+ hotkey: "mod+shift+enter",
15
+ before: true,
16
+ },
17
+ {
18
+ hotkey: "enter",
19
+ query: {
20
+ start: true,
21
+ end: true,
22
+ allow: [...constants_1.KEYS_HEADING, types_1.BLOCKQUOTE_PLUGIN_KEY],
23
+ },
24
+ relative: true,
25
+ level: 1,
26
+ },
27
+ ],
28
+ },
29
+ });
30
+ exports.createExitBreakPlugin = createExitBreakPlugin;
@@ -0,0 +1,8 @@
1
+ export declare const ELEMENT_H1 = "h1";
2
+ export declare const ELEMENT_H2 = "h2";
3
+ export declare const ELEMENT_H3 = "h3";
4
+ export declare const ELEMENT_H4 = "h4";
5
+ export declare const ELEMENT_H5 = "h5";
6
+ export declare const ELEMENT_H6 = "h6";
7
+ export declare const KEYS_HEADING: string[];
8
+ export declare const HEADINGS_PLUGIN_KEY = "heading";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HEADINGS_PLUGIN_KEY = exports.KEYS_HEADING = exports.ELEMENT_H6 = exports.ELEMENT_H5 = exports.ELEMENT_H4 = exports.ELEMENT_H3 = exports.ELEMENT_H2 = exports.ELEMENT_H1 = void 0;
4
+ exports.ELEMENT_H1 = "h1";
5
+ exports.ELEMENT_H2 = "h2";
6
+ exports.ELEMENT_H3 = "h3";
7
+ exports.ELEMENT_H4 = "h4";
8
+ exports.ELEMENT_H5 = "h5";
9
+ exports.ELEMENT_H6 = "h6";
10
+ exports.KEYS_HEADING = [exports.ELEMENT_H1, exports.ELEMENT_H2, exports.ELEMENT_H3, exports.ELEMENT_H4, exports.ELEMENT_H5, exports.ELEMENT_H6];
11
+ exports.HEADINGS_PLUGIN_KEY = "heading";
@@ -0,0 +1,8 @@
1
+ import { HotkeyPlugin } from "@udecode/plate-common";
2
+ import { WysiwygContent } from "../../types";
3
+ export type HeadingPlugin = HotkeyPlugin;
4
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
5
+ export interface HeadingsPluginOptions {
6
+ disabledLevels?: HeadingLevel[];
7
+ }
8
+ export declare const createHeadingsPlugin: <OP = HeadingsPluginOptions, OV extends import("@udecode/plate-common").Value = WysiwygContent, OE extends import("@udecode/plate-common").PlateEditor<OV> = import("@udecode/plate-common").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-common").PlatePlugin<import("@udecode/plate-common").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-common").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-common").PlatePlugin<import("@udecode/plate-common").NoInfer<OP>, OV, OE>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHeadingsPlugin = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const constants_1 = require("./constants");
6
+ exports.createHeadingsPlugin = (0, plate_common_1.createPluginFactory)({
7
+ key: constants_1.HEADINGS_PLUGIN_KEY,
8
+ then: (_editor, { options: { disabledLevels } = {} }) => {
9
+ var _a;
10
+ const plugins = [];
11
+ for (let level = 1; level <= 6; level++) {
12
+ if (disabledLevels === null || disabledLevels === void 0 ? void 0 : disabledLevels.find((e) => e === level)) {
13
+ continue;
14
+ }
15
+ const key = constants_1.KEYS_HEADING[level - 1];
16
+ const plugin = {
17
+ key,
18
+ isElement: true,
19
+ deserializeHtml: {
20
+ rules: [
21
+ {
22
+ validNodeName: `H${level}`,
23
+ },
24
+ ],
25
+ },
26
+ handlers: {
27
+ onKeyDown: plate_common_1.onKeyDownToggleElement,
28
+ },
29
+ options: {},
30
+ };
31
+ if (level < 4 && ((_a = plugin.options) === null || _a === void 0 ? void 0 : _a.hotkey)) {
32
+ plugin.options.hotkey = [`mod+opt+${level}`, `mod+shift+${level}`];
33
+ }
34
+ plugins.push(plugin);
35
+ }
36
+ return {
37
+ plugins,
38
+ };
39
+ },
40
+ });
@@ -0,0 +1,3 @@
1
+ import { WysiwygContent } from "../../types";
2
+ import { HighlightPluginOptions } from "./types";
3
+ export declare const createHighlightPlugin: (color?: HighlightPluginOptions["color"]) => import("@udecode/plate-common").PlatePlugin<HighlightPluginOptions, WysiwygContent, import("@udecode/plate-common").PlateEditor<WysiwygContent>>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHighlightPlugin = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const types_1 = require("./types");
6
+ const createHighlightPlugin = (color = "yellow") => (0, plate_common_1.createPluginFactory)({
7
+ key: types_1.HIGHLIGHT_PLUGIN_KEY,
8
+ isLeaf: true,
9
+ handlers: {
10
+ onKeyDown: plate_common_1.onKeyDownToggleMark,
11
+ },
12
+ deserializeHtml: {
13
+ rules: [
14
+ {
15
+ validNodeName: ["MARK"],
16
+ },
17
+ ],
18
+ },
19
+ options: {
20
+ hotkey: "mod+shift+h",
21
+ color: color,
22
+ },
23
+ props: {
24
+ color: color,
25
+ },
26
+ })();
27
+ exports.createHighlightPlugin = createHighlightPlugin;
@@ -0,0 +1,10 @@
1
+ import { ToggleMarkPlugin } from "@udecode/plate-core";
2
+ import { CSSProperties } from "react";
3
+ import { RenderLeafProps } from "../../types";
4
+ export declare const HIGHLIGHT_PLUGIN_KEY = "highlight";
5
+ export interface HighlightPluginOptions extends ToggleMarkPlugin {
6
+ color?: CSSProperties["color"];
7
+ }
8
+ export interface HighlightLeafElementProps extends RenderLeafProps {
9
+ color?: CSSProperties["color"];
10
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HIGHLIGHT_PLUGIN_KEY = void 0;
4
+ exports.HIGHLIGHT_PLUGIN_KEY = "highlight";
@@ -0,0 +1,6 @@
1
+ import { WysiwygContent } from "../../types";
2
+ import { UxfImagePluginOptions } from "./types";
3
+ /**
4
+ * Enables support for images.
5
+ */
6
+ export declare const createImagePlugin: <OP = UxfImagePluginOptions, OV extends import("@udecode/slate").Value = WysiwygContent, OE extends import("@udecode/plate-core").PlateEditor<OV> = import("@udecode/plate-core").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createImagePlugin = void 0;
4
+ const plate_core_1 = require("@udecode/plate-core");
5
+ const insert_image_1 = require("./transforms/insert-image");
6
+ const types_1 = require("./types");
7
+ const with_image_1 = require("./with-image");
8
+ /**
9
+ * Enables support for images.
10
+ */
11
+ exports.createImagePlugin = (0, plate_core_1.createPluginFactory)({
12
+ key: types_1.IMAGE_PLUGIN_KEY,
13
+ type: types_1.IMAGE_PLUGIN_TYPE,
14
+ isElement: true,
15
+ isVoid: true,
16
+ withOverrides: with_image_1.withImage,
17
+ then: (editor, { options }) => ({
18
+ deserializeHtml: {
19
+ rules: [
20
+ {
21
+ validNodeName: "IMG",
22
+ },
23
+ ],
24
+ // getNode: (el) => ({
25
+ // type,
26
+ // url: el.getAttribute("src"),
27
+ // }),
28
+ getNode: (el) => {
29
+ var _a;
30
+ const url = (_a = el.getAttribute("src")) !== null && _a !== void 0 ? _a : "";
31
+ if (url) {
32
+ const request = new XMLHttpRequest();
33
+ request.open("GET", url, true);
34
+ request.responseType = "blob";
35
+ request.onload = () => {
36
+ const blob = request.response;
37
+ const file = new File([blob], "image-from-wysiwyg", {
38
+ type: blob.type,
39
+ });
40
+ if (!options.uploadImage) {
41
+ // eslint-disable-next-line no-console
42
+ console.error("Missing uploadImage function in image plugin options!");
43
+ return;
44
+ }
45
+ options.uploadImage(file).then((response) => {
46
+ if (!options.getImageUrl) {
47
+ // eslint-disable-next-line no-console
48
+ console.error("Missing getImageUrl function in image plugin options!");
49
+ return;
50
+ }
51
+ // async hack images will be at the end of the document :(
52
+ (0, insert_image_1.insertImage)(editor, response, undefined, undefined, undefined, options.getImageUrl(response));
53
+ });
54
+ };
55
+ // eslint-disable-next-line no-console
56
+ request.onerror = () => console.error("Error receiving image.");
57
+ request.send();
58
+ // try {
59
+ // const imageResponse = await fetch(url, {
60
+ // mode: "cors",
61
+ // headers: {
62
+ // "Access-Control-Allow-Origin": "*",
63
+ // },
64
+ // });
65
+ // const blob = await imageResponse.blob();
66
+ // const file = new File([blob], "image-from-wysiwyg", {
67
+ // type: blob.type,
68
+ // });
69
+ // if (!options.uploadImage) {
70
+ // // eslint-disable-next-line no-console
71
+ // console.log("Missing uploadImage function in image plugin options!");
72
+ // return;
73
+ // }
74
+ //
75
+ // const fileResponse = await options.uploadImage(file);
76
+ //
77
+ // if (!options.getImageUrl) {
78
+ // // eslint-disable-next-line no-console
79
+ // console.log("Missing getImageUrl function in image plugin options!");
80
+ // return;
81
+ // }
82
+ // // async hack images will be at the end of the document :(
83
+ // insertImage(
84
+ // editor,
85
+ // fileResponse,
86
+ // undefined,
87
+ // undefined,
88
+ // undefined,
89
+ // options.getImageUrl(fileResponse),
90
+ // );
91
+ //
92
+ // return {
93
+ // type,
94
+ // file: fileResponse,
95
+ // url: options.getImageUrl(fileResponse),
96
+ // };
97
+ // } catch (e) {
98
+ // // eslint-disable-next-line no-console
99
+ // console.error("Image insert failed.");
100
+ // }
101
+ }
102
+ },
103
+ },
104
+ }),
105
+ });
@@ -0,0 +1,5 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const useImageHandlers: (editor: UxfEditor) => {
3
+ uploadImage: import("../types").ImageUploadHandler;
4
+ getImageUrl: import("../types").GetImageUrlHandler;
5
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImageHandlers = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const types_1 = require("../types");
6
+ const useImageHandlers = (editor) => {
7
+ const imagePluginOptions = (0, utils_1.getPluginOptions)(editor, types_1.IMAGE_PLUGIN_KEY);
8
+ if (!imagePluginOptions.uploadImage) {
9
+ throw new Error("Missing uploadImage function in image plugin options!");
10
+ }
11
+ if (!imagePluginOptions.getImageUrl) {
12
+ throw new Error("Missing getImageUrl function in image plugin options!");
13
+ }
14
+ return {
15
+ uploadImage: imagePluginOptions.uploadImage,
16
+ getImageUrl: imagePluginOptions.getImageUrl,
17
+ };
18
+ };
19
+ exports.useImageHandlers = useImageHandlers;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor, UxfImageElement } from "../../../types";
2
+ export declare const getActiveImage: (editor: UxfEditor) => UxfImageElement | undefined;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveImage = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const types_1 = require("../types");
6
+ const getActiveImage = (editor) => {
7
+ return (0, utils_1.getActiveElement)(editor, types_1.IMAGE_PLUGIN_KEY);
8
+ };
9
+ exports.getActiveImage = getActiveImage;
@@ -0,0 +1,3 @@
1
+ import { FileResponse } from "@uxf/core/types";
2
+ import { UxfEditor } from "../../../types";
3
+ export declare const insertImage: (editor: UxfEditor, file: FileResponse, alt?: string, caption?: string, source?: string, url?: string) => void;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertImage = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const types_1 = require("../types");
6
+ const insertImage = (editor, file, alt, caption, source, url) => {
7
+ const text = { text: "" };
8
+ const image = {
9
+ type: types_1.IMAGE_PLUGIN_TYPE,
10
+ children: [text],
11
+ file,
12
+ alt,
13
+ caption,
14
+ source,
15
+ url: url,
16
+ };
17
+ (0, utils_1.insertVoid)(editor, image);
18
+ };
19
+ exports.insertImage = insertImage;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const isImageActive: (editor: UxfEditor) => boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isImageActive = void 0;
4
+ const plate_common_1 = require("@udecode/plate-common");
5
+ const get_active_image_1 = require("./get-active-image");
6
+ const isImageActive = (editor) => Boolean((0, get_active_image_1.getActiveImage)(editor) && (0, plate_common_1.isRangeInSameBlock)(editor));
7
+ exports.isImageActive = isImageActive;
@@ -0,0 +1,2 @@
1
+ import { UxfEditor } from "../../../types";
2
+ export declare const removeSelectedImage: (editor: UxfEditor) => boolean;