@uxf/wysiwyg 11.74.0 → 11.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.d.ts +7 -0
- package/components.js +34 -0
- package/config/icons-config.d.ts +2 -0
- package/config/icons-config.js +5 -0
- package/config/icons.d.ts +183 -0
- package/config/icons.js +51 -0
- package/create-all-plugins-with-ui.d.ts +64 -0
- package/create-all-plugins-with-ui.js +127 -0
- package/create-plugins-with-ui.d.ts +4 -0
- package/create-plugins-with-ui.js +47 -0
- package/hooks.d.ts +9 -0
- package/hooks.js +20 -0
- package/index.d.ts +6 -0
- package/index.js +38 -0
- package/package.json +3 -3
- package/plugins/blockquote/create-blockquote-plugin.d.ts +3 -0
- package/plugins/blockquote/create-blockquote-plugin.js +9 -0
- package/plugins/blockquote/types.d.ts +2 -0
- package/plugins/blockquote/types.js +6 -0
- package/plugins/button/constants.d.ts +2 -0
- package/plugins/button/constants.js +5 -0
- package/plugins/button/create-button-plugin.d.ts +2 -0
- package/plugins/button/create-button-plugin.js +11 -0
- package/plugins/button/index.d.ts +3 -0
- package/plugins/button/index.js +23 -0
- package/plugins/button/transforms/get-active-button.d.ts +2 -0
- package/plugins/button/transforms/get-active-button.js +9 -0
- package/plugins/button/transforms/index.d.ts +4 -0
- package/plugins/button/transforms/index.js +11 -0
- package/plugins/button/transforms/insert-button.d.ts +2 -0
- package/plugins/button/transforms/insert-button.js +16 -0
- package/plugins/button/transforms/is-button-active.d.ts +2 -0
- package/plugins/button/transforms/is-button-active.js +7 -0
- package/plugins/button/transforms/remove-selected-button.d.ts +2 -0
- package/plugins/button/transforms/remove-selected-button.js +13 -0
- package/plugins/button/transforms/update-button.d.ts +2 -0
- package/plugins/button/transforms/update-button.js +9 -0
- package/plugins/embedded/utils.d.ts +1 -0
- package/plugins/embedded/utils.js +7 -0
- package/plugins/embedded/video/create-video-plugin.d.ts +4 -0
- package/plugins/embedded/video/create-video-plugin.js +19 -0
- package/plugins/embedded/video/get-active-video.d.ts +2 -0
- package/plugins/embedded/video/get-active-video.js +9 -0
- package/plugins/embedded/video/insert-video.d.ts +2 -0
- package/plugins/embedded/video/insert-video.js +19 -0
- package/plugins/embedded/video/update-video.d.ts +2 -0
- package/plugins/embedded/video/update-video.js +12 -0
- package/plugins/exit-break/create-exit-break-plugin.d.ts +3 -0
- package/plugins/exit-break/create-exit-break-plugin.js +30 -0
- package/plugins/heading/constants.d.ts +8 -0
- package/plugins/heading/constants.js +11 -0
- package/plugins/heading/create-headings-plugin.d.ts +8 -0
- package/plugins/heading/create-headings-plugin.js +40 -0
- package/plugins/highlight/createHighlightPlugin.d.ts +3 -0
- package/plugins/highlight/createHighlightPlugin.js +27 -0
- package/plugins/highlight/types.d.ts +10 -0
- package/plugins/highlight/types.js +4 -0
- package/plugins/image/create-image-plugin.d.ts +6 -0
- package/plugins/image/create-image-plugin.js +105 -0
- package/plugins/image/hooks/use-image-handlers.d.ts +5 -0
- package/plugins/image/hooks/use-image-handlers.js +19 -0
- package/plugins/image/transforms/get-active-image.d.ts +2 -0
- package/plugins/image/transforms/get-active-image.js +9 -0
- package/plugins/image/transforms/insert-image.d.ts +3 -0
- package/plugins/image/transforms/insert-image.js +19 -0
- package/plugins/image/transforms/is-image-active.d.ts +2 -0
- package/plugins/image/transforms/is-image-active.js +7 -0
- package/plugins/image/transforms/remove-selected-image.d.ts +2 -0
- package/plugins/image/transforms/remove-selected-image.js +13 -0
- package/plugins/image/transforms/update-image.d.ts +3 -0
- package/plugins/image/transforms/update-image.js +12 -0
- package/plugins/image/types.d.ts +12 -0
- package/plugins/image/types.js +6 -0
- package/plugins/image/utils/is-image-url.d.ts +2 -0
- package/plugins/image/utils/is-image-url.js +135 -0
- package/plugins/image/with-image.d.ts +7 -0
- package/plugins/image/with-image.js +19 -0
- package/plugins/image/with-paste-image-url.d.ts +7 -0
- package/plugins/image/with-paste-image-url.js +36 -0
- package/plugins/image/with-paste-image.d.ts +7 -0
- package/plugins/image/with-paste-image.js +49 -0
- package/plugins/link/constants.d.ts +2 -0
- package/plugins/link/constants.js +6 -0
- package/plugins/link/create-link-plugin.d.ts +3 -0
- package/plugins/link/create-link-plugin.js +15 -0
- package/plugins/link/floating-link-wrapper.d.ts +11 -0
- package/plugins/link/floating-link-wrapper.js +26 -0
- package/plugins/link/hooks/index.d.ts +4 -0
- package/plugins/link/hooks/index.js +11 -0
- package/plugins/link/hooks/use-link-actions.d.ts +12 -0
- package/plugins/link/hooks/use-link-actions.js +48 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +1 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.js +5 -0
- package/plugins/link/hooks/use-link-submit-on-enter.d.ts +1 -0
- package/plugins/link/hooks/use-link-submit-on-enter.js +23 -0
- package/plugins/link/transforms/get-active-link.d.ts +3 -0
- package/plugins/link/transforms/get-active-link.js +17 -0
- package/plugins/link/transforms/insert-link.d.ts +2 -0
- package/plugins/link/transforms/insert-link.js +27 -0
- package/plugins/link/transforms/is-link-selected.d.ts +2 -0
- package/plugins/link/transforms/is-link-selected.js +15 -0
- package/plugins/link/transforms/submit-link.d.ts +8 -0
- package/plugins/link/transforms/submit-link.js +36 -0
- package/plugins/link/transforms/trigger-link-insert-or-edit.d.ts +2 -0
- package/plugins/link/transforms/trigger-link-insert-or-edit.js +6 -0
- package/plugins/link/transforms/unwrap-link.d.ts +2 -0
- package/plugins/link/transforms/unwrap-link.js +10 -0
- package/plugins/link/types.d.ts +5 -0
- package/plugins/link/types.js +2 -0
- package/plugins/list/constants.d.ts +4 -0
- package/plugins/list/constants.js +14 -0
- package/plugins/list/create-list-plugin.d.ts +4 -0
- package/plugins/list/create-list-plugin.js +16 -0
- package/plugins/mark-bold/create-bold-plugin.d.ts +3 -0
- package/plugins/mark-bold/create-bold-plugin.js +6 -0
- package/plugins/mark-bold/types.d.ts +2 -0
- package/plugins/mark-bold/types.js +6 -0
- package/plugins/mark-code/create-code-plugin.d.ts +3 -0
- package/plugins/mark-code/create-code-plugin.js +6 -0
- package/plugins/mark-code/types.d.ts +2 -0
- package/plugins/mark-code/types.js +6 -0
- package/plugins/mark-italic/create-italic-plugin.d.ts +3 -0
- package/plugins/mark-italic/create-italic-plugin.js +6 -0
- package/plugins/mark-italic/types.d.ts +2 -0
- package/plugins/mark-italic/types.js +6 -0
- package/plugins/mark-underline/create-underline-plugin.d.ts +3 -0
- package/plugins/mark-underline/create-underline-plugin.js +6 -0
- package/plugins/mark-underline/types.d.ts +2 -0
- package/plugins/mark-underline/types.js +6 -0
- package/plugins/node-id/add-ids-to-nodes.d.ts +2 -0
- package/plugins/node-id/add-ids-to-nodes.js +22 -0
- package/plugins/node-id/create-node-id-plugin.d.ts +3 -0
- package/plugins/node-id/create-node-id-plugin.js +6 -0
- package/plugins/paragraph/create-paragraph-plugin.d.ts +3 -0
- package/plugins/paragraph/create-paragraph-plugin.js +9 -0
- package/plugins/paragraph/types.d.ts +2 -0
- package/plugins/paragraph/types.js +6 -0
- package/plugins/reset-node/create-reset-node.d.ts +3 -0
- package/plugins/reset-node/create-reset-node.js +28 -0
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +3 -0
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +14 -0
- package/plugins/soft-break/create-soft-break-plugin.d.ts +3 -0
- package/plugins/soft-break/create-soft-break-plugin.js +22 -0
- package/plugins/trailing-block/create-trailing-block-plugin.d.ts +3 -0
- package/plugins/trailing-block/create-trailing-block-plugin.js +6 -0
- package/serializers/serialize-to-plaintext.d.ts +2 -0
- package/serializers/serialize-to-plaintext.js +8 -0
- package/types.d.ts +118 -0
- package/types.js +2 -0
- package/ui/blockquote-element.d.ts +2 -0
- package/ui/blockquote-element.js +13 -0
- package/ui/bold-mark.d.ts +2 -0
- package/ui/bold-mark.js +13 -0
- package/ui/button/button-element.d.ts +2 -0
- package/ui/button/button-element.js +54 -0
- package/ui/button/index.d.ts +1 -0
- package/ui/button/index.js +5 -0
- package/ui/button/insert-button-modal-content.d.ts +8 -0
- package/ui/button/insert-button-modal-content.js +81 -0
- package/ui/code-mark.d.ts +2 -0
- package/ui/code-mark.js +13 -0
- package/ui/components/element/element-action-buttons.d.ts +9 -0
- package/ui/components/element/element-action-buttons.js +22 -0
- package/ui/components/element/element-with-action-buttons.d.ts +10 -0
- package/ui/components/element/element-with-action-buttons.js +17 -0
- package/ui/components/modal/modal-button-cancel.d.ts +9 -0
- package/ui/components/modal/modal-button-cancel.js +45 -0
- package/ui/components/modal/modal-button-submit.d.ts +6 -0
- package/ui/components/modal/modal-button-submit.js +12 -0
- package/ui/components/modal/modal-buttons.d.ts +11 -0
- package/ui/components/modal/modal-buttons.js +16 -0
- package/ui/components/modal/modal-content.d.ts +6 -0
- package/ui/components/modal/modal-content.js +14 -0
- package/ui/create-uxf-ui.d.ts +21 -0
- package/ui/create-uxf-ui.js +51 -0
- package/ui/floating-link.d.ts +2 -0
- package/ui/floating-link.js +110 -0
- package/ui/heading-elements.d.ts +7 -0
- package/ui/heading-elements.js +38 -0
- package/ui/highlight-mark.d.ts +3 -0
- package/ui/highlight-mark.js +13 -0
- package/ui/image/image-element.d.ts +2 -0
- package/ui/image/image-element.js +53 -0
- package/ui/image/insert-image-modal-content.d.ts +8 -0
- package/ui/image/insert-image-modal-content.js +89 -0
- package/ui/italic-mark.d.ts +2 -0
- package/ui/italic-mark.js +13 -0
- package/ui/link-element.d.ts +3 -0
- package/ui/link-element.js +14 -0
- package/ui/list-item-element.d.ts +2 -0
- package/ui/list-item-element.js +13 -0
- package/ui/list-ordered-element.d.ts +2 -0
- package/ui/list-ordered-element.js +13 -0
- package/ui/list-unordered-element.d.ts +2 -0
- package/ui/list-unordered-element.js +13 -0
- package/ui/paragraph-element.d.ts +2 -0
- package/ui/paragraph-element.js +13 -0
- package/ui/toolbar/buttons/button-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/button-toolbar-button.js +20 -0
- package/ui/toolbar/buttons/element-toolbar-button.d.ts +12 -0
- package/ui/toolbar/buttons/element-toolbar-button.js +25 -0
- package/ui/toolbar/buttons/image-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/image-toolbar-button.js +20 -0
- package/ui/toolbar/buttons/link-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/link-toolbar-button.js +29 -0
- package/ui/toolbar/buttons/list-toolbar-button.d.ts +13 -0
- package/ui/toolbar/buttons/list-toolbar-button.js +27 -0
- package/ui/toolbar/buttons/mark-toolbar-button.d.ts +13 -0
- package/ui/toolbar/buttons/mark-toolbar-button.js +25 -0
- package/ui/toolbar/buttons/modal-toolbar-button.d.ts +15 -0
- package/ui/toolbar/buttons/modal-toolbar-button.js +22 -0
- package/ui/toolbar/buttons/toolbar-button.d.ts +15 -0
- package/ui/toolbar/buttons/toolbar-button.js +35 -0
- package/ui/toolbar/buttons/undo-redo-button-group.d.ts +8 -0
- package/ui/toolbar/buttons/undo-redo-button-group.js +64 -0
- package/ui/toolbar/buttons/video-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/video-toolbar-button.js +20 -0
- package/ui/toolbar/toolbar.d.ts +3 -0
- package/ui/toolbar/toolbar.js +77 -0
- package/ui/toolbar/types.d.ts +8 -0
- package/ui/toolbar/types.js +2 -0
- package/ui/underline-mark.d.ts +2 -0
- package/ui/underline-mark.js +13 -0
- package/ui/utils.d.ts +2 -0
- package/ui/utils.js +13 -0
- package/ui/video/insert-video-modal-content.d.ts +8 -0
- package/ui/video/insert-video-modal-content.js +80 -0
- package/ui/video/video-element.d.ts +2 -0
- package/ui/video/video-element.js +55 -0
- package/utils/get-video-meta-data.d.ts +2 -0
- package/utils/get-video-meta-data.js +41 -0
- package/utils/url-helper.d.ts +7 -0
- package/utils/url-helper.js +15 -0
- package/utils/url-helper.test.d.ts +1 -0
- package/utils/url-helper.test.js +37 -0
- package/utils.d.ts +30 -0
- package/utils.js +88 -0
- package/wysiwyg-editor.d.ts +15 -0
- package/wysiwyg-editor.js +42 -0
- package/wysiwyg-editor.stories.d.ts +5 -0
- package/wysiwyg-editor.stories.js +193 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.triggerLinkInsertOrEdit = void 0;
|
|
4
|
+
const plate_link_1 = require("@udecode/plate-link");
|
|
5
|
+
const triggerLinkInsertOrEdit = (editor, focused = false) => (0, plate_link_1.triggerFloatingLink)(editor, { focused });
|
|
6
|
+
exports.triggerLinkInsertOrEdit = triggerLinkInsertOrEdit;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeLink = void 0;
|
|
4
|
+
const plate_link_1 = require("@udecode/plate-link");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
6
|
+
const removeLink = (editor) => {
|
|
7
|
+
(0, plate_link_1.unwrapLink)(editor);
|
|
8
|
+
(0, utils_1.focusEditor)(editor);
|
|
9
|
+
};
|
|
10
|
+
exports.removeLink = removeLink;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toggleList = exports.getListItemEntry = exports.ELEMENT_UL = exports.ELEMENT_OL = exports.ELEMENT_LIC = exports.ELEMENT_LI = exports.LIST_UNORDERED_TYPE = exports.LIST_ORDERED_TYPE = exports.LIST_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_list_1 = require("@udecode/plate-list");
|
|
5
|
+
exports.LIST_PLUGIN_KEY = "list";
|
|
6
|
+
exports.LIST_ORDERED_TYPE = plate_list_1.ELEMENT_OL;
|
|
7
|
+
exports.LIST_UNORDERED_TYPE = plate_list_1.ELEMENT_UL;
|
|
8
|
+
var plate_list_2 = require("@udecode/plate-list");
|
|
9
|
+
Object.defineProperty(exports, "ELEMENT_LI", { enumerable: true, get: function () { return plate_list_2.ELEMENT_LI; } });
|
|
10
|
+
Object.defineProperty(exports, "ELEMENT_LIC", { enumerable: true, get: function () { return plate_list_2.ELEMENT_LIC; } });
|
|
11
|
+
Object.defineProperty(exports, "ELEMENT_OL", { enumerable: true, get: function () { return plate_list_2.ELEMENT_OL; } });
|
|
12
|
+
Object.defineProperty(exports, "ELEMENT_UL", { enumerable: true, get: function () { return plate_list_2.ELEMENT_UL; } });
|
|
13
|
+
Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return plate_list_2.getListItemEntry; } });
|
|
14
|
+
Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return plate_list_2.toggleList; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createListPlugin = exports.toggleList = exports.getListItemEntry = void 0;
|
|
4
|
+
const plate_list_1 = require("@udecode/plate-list");
|
|
5
|
+
const types_1 = require("../paragraph/types");
|
|
6
|
+
var plate_list_2 = require("@udecode/plate-list");
|
|
7
|
+
Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return plate_list_2.getListItemEntry; } });
|
|
8
|
+
Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return plate_list_2.toggleList; } });
|
|
9
|
+
const createListPlugin = () => (0, plate_list_1.createListPlugin)({
|
|
10
|
+
inject: {
|
|
11
|
+
props: {
|
|
12
|
+
validTypes: [types_1.PARAGRAPH_PLUGIN_KEY],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
exports.createListPlugin = createListPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBoldPlugin = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
const createBoldPlugin = () => (0, plate_basic_marks_1.createBoldPlugin)();
|
|
6
|
+
exports.createBoldPlugin = createBoldPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BOLD_PLUGIN_TYPE = exports.BOLD_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
exports.BOLD_PLUGIN_KEY = plate_basic_marks_1.MARK_BOLD;
|
|
6
|
+
exports.BOLD_PLUGIN_TYPE = plate_basic_marks_1.MARK_BOLD;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCodePlugin = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
const createCodePlugin = () => (0, plate_basic_marks_1.createCodePlugin)();
|
|
6
|
+
exports.createCodePlugin = createCodePlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CODE_PLUGIN_TYPE = exports.CODE_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
exports.CODE_PLUGIN_KEY = plate_basic_marks_1.MARK_CODE;
|
|
6
|
+
exports.CODE_PLUGIN_TYPE = plate_basic_marks_1.MARK_CODE;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createItalicPlugin = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
const createItalicPlugin = () => (0, plate_basic_marks_1.createItalicPlugin)();
|
|
6
|
+
exports.createItalicPlugin = createItalicPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ITALIC_PLUGIN_TYPE = exports.ITALIC_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
exports.ITALIC_PLUGIN_KEY = plate_basic_marks_1.MARK_ITALIC;
|
|
6
|
+
exports.ITALIC_PLUGIN_TYPE = plate_basic_marks_1.MARK_ITALIC;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createUnderlinePlugin = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
const createUnderlinePlugin = () => (0, plate_basic_marks_1.createUnderlinePlugin)();
|
|
6
|
+
exports.createUnderlinePlugin = createUnderlinePlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNDER_LINE_PLUGIN_TYPE = exports.UNDER_LINE_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
|
|
5
|
+
exports.UNDER_LINE_PLUGIN_KEY = plate_basic_marks_1.MARK_UNDERLINE;
|
|
6
|
+
exports.UNDER_LINE_PLUGIN_TYPE = plate_basic_marks_1.MARK_UNDERLINE;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addIdsToNodes = void 0;
|
|
4
|
+
const addIdsToNodes = (nodes) => {
|
|
5
|
+
return nodes.map((node) => {
|
|
6
|
+
let id = node.id;
|
|
7
|
+
let children = node.children;
|
|
8
|
+
if (!id && !node.text) {
|
|
9
|
+
id = Math.random().toString(36).substring(2, 7);
|
|
10
|
+
}
|
|
11
|
+
if (node.children) {
|
|
12
|
+
children = (0, exports.addIdsToNodes)(node.children);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
type: node.type,
|
|
16
|
+
id: id,
|
|
17
|
+
...node,
|
|
18
|
+
children,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.addIdsToNodes = addIdsToNodes;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNodeIdPlugin = void 0;
|
|
4
|
+
const plate_node_id_1 = require("@udecode/plate-node-id");
|
|
5
|
+
const createNodeIdPlugin = () => (0, plate_node_id_1.createNodeIdPlugin)();
|
|
6
|
+
exports.createNodeIdPlugin = createNodeIdPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createParagraphPlugin = void 0;
|
|
4
|
+
const plate_paragraph_1 = require("@udecode/plate-paragraph");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const createParagraphPlugin = () => (0, plate_paragraph_1.createParagraphPlugin)({
|
|
7
|
+
type: types_1.PARAGRAPH_PLUGIN_TYPE,
|
|
8
|
+
});
|
|
9
|
+
exports.createParagraphPlugin = createParagraphPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PARAGRAPH_PLUGIN_TYPE = exports.PARAGRAPH_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_paragraph_1 = require("@udecode/plate-paragraph");
|
|
5
|
+
exports.PARAGRAPH_PLUGIN_KEY = plate_paragraph_1.ELEMENT_PARAGRAPH;
|
|
6
|
+
exports.PARAGRAPH_PLUGIN_TYPE = "paragraph";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResetNodePlugin = void 0;
|
|
4
|
+
const plate_common_1 = require("@udecode/plate-common");
|
|
5
|
+
const plate_reset_node_1 = require("@udecode/plate-reset-node");
|
|
6
|
+
const types_1 = require("../blockquote/types");
|
|
7
|
+
const types_2 = require("../paragraph/types");
|
|
8
|
+
const resetBlockTypesCommonRule = {
|
|
9
|
+
types: [types_1.BLOCKQUOTE_PLUGIN_KEY],
|
|
10
|
+
defaultType: types_2.PARAGRAPH_PLUGIN_KEY,
|
|
11
|
+
};
|
|
12
|
+
const createResetNodePlugin = () => (0, plate_reset_node_1.createResetNodePlugin)({
|
|
13
|
+
options: {
|
|
14
|
+
rules: [
|
|
15
|
+
{
|
|
16
|
+
...resetBlockTypesCommonRule,
|
|
17
|
+
hotkey: "Enter",
|
|
18
|
+
predicate: plate_common_1.isBlockAboveEmpty,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
...resetBlockTypesCommonRule,
|
|
22
|
+
hotkey: "Backspace",
|
|
23
|
+
predicate: plate_common_1.isSelectionAtBlockStart,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
exports.createResetNodePlugin = createResetNodePlugin;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSelectOnBackspacePlugin = void 0;
|
|
4
|
+
const plate_media_1 = require("@udecode/plate-media");
|
|
5
|
+
const plate_select_1 = require("@udecode/plate-select");
|
|
6
|
+
const types_1 = require("../image/types");
|
|
7
|
+
const createSelectOnBackspacePlugin = () => (0, plate_select_1.createSelectOnBackspacePlugin)({
|
|
8
|
+
options: {
|
|
9
|
+
query: {
|
|
10
|
+
allow: [types_1.IMAGE_PLUGIN_KEY, plate_media_1.ELEMENT_MEDIA_EMBED],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
exports.createSelectOnBackspacePlugin = createSelectOnBackspacePlugin;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSoftBreakPlugin = void 0;
|
|
4
|
+
const plate_break_1 = require("@udecode/plate-break");
|
|
5
|
+
const types_1 = require("../blockquote/types");
|
|
6
|
+
const types_2 = require("../paragraph/types");
|
|
7
|
+
const createSoftBreakPlugin = () => (0, plate_break_1.createSoftBreakPlugin)({
|
|
8
|
+
options: {
|
|
9
|
+
rules: [
|
|
10
|
+
{
|
|
11
|
+
hotkey: "shift+enter",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
hotkey: "enter",
|
|
15
|
+
query: {
|
|
16
|
+
allow: [types_2.PARAGRAPH_PLUGIN_KEY, types_1.BLOCKQUOTE_PLUGIN_KEY],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
exports.createSoftBreakPlugin = createSoftBreakPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTrailingBlockPlugin = void 0;
|
|
4
|
+
const plate_trailing_block_1 = require("@udecode/plate-trailing-block");
|
|
5
|
+
const createTrailingBlockPlugin = () => (0, plate_trailing_block_1.createTrailingBlockPlugin)();
|
|
6
|
+
exports.createTrailingBlockPlugin = createTrailingBlockPlugin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeToPlaintext = void 0;
|
|
4
|
+
const slate_1 = require("slate");
|
|
5
|
+
const serializeToPlaintext = (nodes, keepIndentation = true) => {
|
|
6
|
+
return nodes.map((n) => slate_1.Node.string(n)).join(keepIndentation ? "\n" : " ");
|
|
7
|
+
};
|
|
8
|
+
exports.serializeToPlaintext = serializeToPlaintext;
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { OverrideByKey, PlateEditor, PlateId, PlatePlugin, PlatePluginComponent, RenderAfterEditable as PlateRenderAfterEditable, PlateRenderElementProps, PlateRenderLeafProps, PluginOptions } from "@udecode/plate-core";
|
|
2
|
+
import { TElement, TText } from "@udecode/slate";
|
|
3
|
+
import { FileResponse } from "@uxf/core/types";
|
|
4
|
+
import { FC } from "react";
|
|
5
|
+
export type EmptyText = {
|
|
6
|
+
text: "";
|
|
7
|
+
};
|
|
8
|
+
export interface RichText extends TText {
|
|
9
|
+
id?: PlateId;
|
|
10
|
+
bold?: boolean;
|
|
11
|
+
italic?: boolean;
|
|
12
|
+
underline?: boolean;
|
|
13
|
+
code?: boolean;
|
|
14
|
+
highlight?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UxfBlockElement extends TElement {
|
|
17
|
+
id?: PlateId;
|
|
18
|
+
}
|
|
19
|
+
export interface UxfLinkElement extends UxfBlockElement {
|
|
20
|
+
type: "link";
|
|
21
|
+
url: string;
|
|
22
|
+
target: "_blank" | "_self";
|
|
23
|
+
}
|
|
24
|
+
export type UxfInlineDescendant = RichText | UxfLinkElement;
|
|
25
|
+
export type UxfInlineChildren = UxfInlineDescendant[];
|
|
26
|
+
export interface UxfParagraphElement extends UxfBlockElement {
|
|
27
|
+
type: "paragraph";
|
|
28
|
+
children: UxfInlineChildren;
|
|
29
|
+
}
|
|
30
|
+
export interface UxfBlockQuoteElement extends UxfBlockElement {
|
|
31
|
+
type: "blockquote";
|
|
32
|
+
children: UxfInlineChildren;
|
|
33
|
+
}
|
|
34
|
+
export interface UxfImageElement extends UxfBlockElement {
|
|
35
|
+
type: "image";
|
|
36
|
+
children: [EmptyText];
|
|
37
|
+
file: FileResponse;
|
|
38
|
+
source?: string;
|
|
39
|
+
caption?: string;
|
|
40
|
+
alt?: string;
|
|
41
|
+
url?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface UxfHeadingElement extends UxfBlockElement {
|
|
44
|
+
type: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
45
|
+
}
|
|
46
|
+
export interface LicElement extends UxfBlockElement {
|
|
47
|
+
type: "lic";
|
|
48
|
+
}
|
|
49
|
+
export interface LiElement extends UxfBlockElement {
|
|
50
|
+
type: "li";
|
|
51
|
+
children: LicElement[];
|
|
52
|
+
}
|
|
53
|
+
export interface UxfUnorderedListElement extends UxfBlockElement {
|
|
54
|
+
type: "ul";
|
|
55
|
+
children: LiElement[];
|
|
56
|
+
}
|
|
57
|
+
export interface UxfOrderedListElement extends UxfBlockElement {
|
|
58
|
+
type: "ol";
|
|
59
|
+
children: LiElement[];
|
|
60
|
+
}
|
|
61
|
+
export type UxfVideoMetaData = {
|
|
62
|
+
title: string;
|
|
63
|
+
description: string;
|
|
64
|
+
authorName: string;
|
|
65
|
+
authorUrl: string;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
duration: number;
|
|
69
|
+
uploadDate: string;
|
|
70
|
+
thumbnail: {
|
|
71
|
+
width: number;
|
|
72
|
+
height: number;
|
|
73
|
+
url: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export interface UxfVideoElement extends UxfBlockElement {
|
|
77
|
+
type: "video";
|
|
78
|
+
url: string;
|
|
79
|
+
embeddedUrl: string;
|
|
80
|
+
provider: string;
|
|
81
|
+
videoId: string;
|
|
82
|
+
children: [EmptyText];
|
|
83
|
+
metaData?: Partial<UxfVideoMetaData> | null;
|
|
84
|
+
}
|
|
85
|
+
export interface UxfButtonElement extends UxfBlockElement {
|
|
86
|
+
type: "button";
|
|
87
|
+
buttonUrl: string;
|
|
88
|
+
buttonText: string;
|
|
89
|
+
children: [EmptyText];
|
|
90
|
+
}
|
|
91
|
+
export type WysiwygRootBlock = UxfParagraphElement | UxfBlockQuoteElement | UxfImageElement | UxfHeadingElement | UxfLinkElement | UxfUnorderedListElement | UxfOrderedListElement | UxfVideoElement | UxfButtonElement;
|
|
92
|
+
export type UiComponents = Record<string, PlatePluginComponent>;
|
|
93
|
+
export type WysiwygContent = WysiwygRootBlock[];
|
|
94
|
+
export type RenderElementProps<E extends TElement = UxfBlockElement> = PlateRenderElementProps<WysiwygContent, E>;
|
|
95
|
+
export type ElementUiComponent<E extends TElement = UxfBlockElement> = FC<RenderElementProps<E>>;
|
|
96
|
+
export type RenderLeafProps<L extends TText = RichText> = PlateRenderLeafProps<WysiwygContent, L>;
|
|
97
|
+
export type LeafUiComponent<L extends TText = RichText> = FC<RenderLeafProps<L>>;
|
|
98
|
+
export type RenderAfterEditable = PlateRenderAfterEditable<WysiwygContent>;
|
|
99
|
+
export type UxfEditor = PlateEditor<WysiwygContent> & {
|
|
100
|
+
isDragging?: boolean;
|
|
101
|
+
};
|
|
102
|
+
export type UxfPlatePlugin<P = PluginOptions> = PlatePlugin<P, WysiwygContent, UxfEditor>;
|
|
103
|
+
export interface WysiwygPlugin<E extends UxfBlockElement = UxfBlockElement> {
|
|
104
|
+
plugin: UxfPlatePlugin;
|
|
105
|
+
component: ElementUiComponent<E> | LeafUiComponent;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* This is used when recursive plugin feature is used
|
|
109
|
+
* @see https://plate.udecode.io/docs/plugins#plugins
|
|
110
|
+
* E.g. Headings plugin
|
|
111
|
+
*/
|
|
112
|
+
export interface WysiwygRecursivePlugin<C extends string, E extends UxfBlockElement = UxfBlockElement> {
|
|
113
|
+
plugin: UxfPlatePlugin;
|
|
114
|
+
components: {
|
|
115
|
+
[key in C]: ElementUiComponent<E> | LeafUiComponent;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export type MyOverrideByKey = OverrideByKey<WysiwygContent, UxfEditor>;
|
package/types.js
ADDED
|
@@ -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.BlockquoteElement = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const BlockquoteElement = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("blockquote", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-blockquote ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.BlockquoteElement = BlockquoteElement;
|
package/ui/bold-mark.js
ADDED
|
@@ -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.BoldMark = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
9
|
+
const BoldMark = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("strong", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-bold ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children));
|
|
12
|
+
};
|
|
13
|
+
exports.BoldMark = BoldMark;
|
|
@@ -0,0 +1,54 @@
|
|
|
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.ButtonElement = void 0;
|
|
27
|
+
const button_1 = require("@uxf/ui/button");
|
|
28
|
+
const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
|
|
29
|
+
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const hooks_1 = require("../../hooks");
|
|
32
|
+
const button_2 = require("../../plugins/button");
|
|
33
|
+
const remove_selected_button_1 = require("../../plugins/button/transforms/remove-selected-button");
|
|
34
|
+
const element_with_action_buttons_1 = require("../components/element/element-with-action-buttons");
|
|
35
|
+
const insert_button_modal_content_1 = require("./insert-button-modal-content");
|
|
36
|
+
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
37
|
+
const ButtonElement = (props) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const selected = (0, hooks_1.useSelected)();
|
|
40
|
+
const onEdit = (0, react_1.useCallback)(() => {
|
|
41
|
+
(0, modal_service_1.openModal)({
|
|
42
|
+
children: (react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "lg" },
|
|
43
|
+
react_1.default.createElement(insert_button_modal_content_1.InsertButtonModalContent, { buttonToEdit: (0, button_2.getActiveButton)(props.editor), editor: props.editor }))),
|
|
44
|
+
});
|
|
45
|
+
}, [props.editor]);
|
|
46
|
+
const onRemove = (0, react_1.useCallback)(() => {
|
|
47
|
+
(0, remove_selected_button_1.removeSelectedButton)(props.editor);
|
|
48
|
+
}, [props.editor]);
|
|
49
|
+
return (react_1.default.createElement("div", { ...props.attributes, className: `${CLASS_NAME} ${CLASS_NAME}-button ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
50
|
+
react_1.default.createElement(element_with_action_buttons_1.ElementWithActionButtons, { className: `${CLASS_NAME}-button__action-buttons`, isSelected: selected, onDelete: onRemove, onEdit: onEdit, padding: selected },
|
|
51
|
+
react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME}-button__action-button`, href: props.element.buttonUrl, isDisabled: true, variant: "secondary" }, props.element.buttonText)),
|
|
52
|
+
props.children));
|
|
53
|
+
};
|
|
54
|
+
exports.ButtonElement = ButtonElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonElement } from "./button-element";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonElement = void 0;
|
|
4
|
+
var button_element_1 = require("./button-element");
|
|
5
|
+
Object.defineProperty(exports, "ButtonElement", { enumerable: true, get: function () { return button_element_1.ButtonElement; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { UxfButtonElement, UxfEditor } from "../../types";
|
|
3
|
+
interface InsertButtonModalContentProps {
|
|
4
|
+
editor: UxfEditor;
|
|
5
|
+
buttonToEdit?: UxfButtonElement;
|
|
6
|
+
}
|
|
7
|
+
export declare const InsertButtonModalContent: FC<InsertButtonModalContentProps>;
|
|
8
|
+
export {};
|