@uxf/wysiwyg 11.72.3 → 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.
- package/README.md +3 -1
- package/package.json +3 -3
- package/translations/translations.d.ts +405 -5
- package/translations/translations.js +404 -4
- package/components.d.ts +0 -7
- package/components.js +0 -34
- package/config/icons-config.d.ts +0 -2
- package/config/icons-config.js +0 -5
- package/config/icons.d.ts +0 -183
- package/config/icons.js +0 -51
- package/create-all-plugins-with-ui.d.ts +0 -64
- package/create-all-plugins-with-ui.js +0 -127
- package/create-plugins-with-ui.d.ts +0 -4
- package/create-plugins-with-ui.js +0 -47
- package/hooks.d.ts +0 -9
- package/hooks.js +0 -20
- package/index.d.ts +0 -6
- package/index.js +0 -38
- package/plugins/blockquote/create-blockquote-plugin.d.ts +0 -3
- package/plugins/blockquote/create-blockquote-plugin.js +0 -9
- package/plugins/blockquote/types.d.ts +0 -2
- package/plugins/blockquote/types.js +0 -6
- package/plugins/button/constants.d.ts +0 -2
- package/plugins/button/constants.js +0 -5
- package/plugins/button/create-button-plugin.d.ts +0 -2
- package/plugins/button/create-button-plugin.js +0 -11
- package/plugins/button/index.d.ts +0 -3
- package/plugins/button/index.js +0 -23
- package/plugins/button/transforms/get-active-button.d.ts +0 -2
- package/plugins/button/transforms/get-active-button.js +0 -9
- package/plugins/button/transforms/index.d.ts +0 -4
- package/plugins/button/transforms/index.js +0 -11
- package/plugins/button/transforms/insert-button.d.ts +0 -2
- package/plugins/button/transforms/insert-button.js +0 -16
- package/plugins/button/transforms/is-button-active.d.ts +0 -2
- package/plugins/button/transforms/is-button-active.js +0 -7
- package/plugins/button/transforms/remove-selected-button.d.ts +0 -2
- package/plugins/button/transforms/remove-selected-button.js +0 -13
- package/plugins/button/transforms/update-button.d.ts +0 -2
- package/plugins/button/transforms/update-button.js +0 -9
- package/plugins/embedded/utils.d.ts +0 -1
- package/plugins/embedded/utils.js +0 -7
- package/plugins/embedded/video/create-video-plugin.d.ts +0 -4
- package/plugins/embedded/video/create-video-plugin.js +0 -19
- package/plugins/embedded/video/get-active-video.d.ts +0 -2
- package/plugins/embedded/video/get-active-video.js +0 -9
- package/plugins/embedded/video/insert-video.d.ts +0 -2
- package/plugins/embedded/video/insert-video.js +0 -18
- package/plugins/embedded/video/update-video.d.ts +0 -2
- package/plugins/embedded/video/update-video.js +0 -11
- package/plugins/exit-break/create-exit-break-plugin.d.ts +0 -3
- package/plugins/exit-break/create-exit-break-plugin.js +0 -30
- package/plugins/heading/constants.d.ts +0 -8
- package/plugins/heading/constants.js +0 -11
- package/plugins/heading/create-headings-plugin.d.ts +0 -8
- package/plugins/heading/create-headings-plugin.js +0 -40
- package/plugins/highlight/createHighlightPlugin.d.ts +0 -3
- package/plugins/highlight/createHighlightPlugin.js +0 -27
- package/plugins/highlight/types.d.ts +0 -10
- package/plugins/highlight/types.js +0 -4
- package/plugins/image/create-image-plugin.d.ts +0 -6
- package/plugins/image/create-image-plugin.js +0 -105
- package/plugins/image/hooks/use-image-handlers.d.ts +0 -5
- package/plugins/image/hooks/use-image-handlers.js +0 -19
- package/plugins/image/transforms/get-active-image.d.ts +0 -2
- package/plugins/image/transforms/get-active-image.js +0 -9
- package/plugins/image/transforms/insert-image.d.ts +0 -3
- package/plugins/image/transforms/insert-image.js +0 -19
- package/plugins/image/transforms/is-image-active.d.ts +0 -2
- package/plugins/image/transforms/is-image-active.js +0 -7
- package/plugins/image/transforms/remove-selected-image.d.ts +0 -2
- package/plugins/image/transforms/remove-selected-image.js +0 -13
- package/plugins/image/transforms/update-image.d.ts +0 -3
- package/plugins/image/transforms/update-image.js +0 -12
- package/plugins/image/types.d.ts +0 -12
- package/plugins/image/types.js +0 -6
- package/plugins/image/utils/is-image-url.d.ts +0 -2
- package/plugins/image/utils/is-image-url.js +0 -135
- package/plugins/image/with-image.d.ts +0 -7
- package/plugins/image/with-image.js +0 -19
- package/plugins/image/with-paste-image-url.d.ts +0 -7
- package/plugins/image/with-paste-image-url.js +0 -36
- package/plugins/image/with-paste-image.d.ts +0 -7
- package/plugins/image/with-paste-image.js +0 -49
- package/plugins/link/constants.d.ts +0 -2
- package/plugins/link/constants.js +0 -6
- package/plugins/link/create-link-plugin.d.ts +0 -3
- package/plugins/link/create-link-plugin.js +0 -15
- package/plugins/link/floating-link-wrapper.d.ts +0 -11
- package/plugins/link/floating-link-wrapper.js +0 -26
- package/plugins/link/hooks/index.d.ts +0 -4
- package/plugins/link/hooks/index.js +0 -11
- package/plugins/link/hooks/use-link-actions.d.ts +0 -12
- package/plugins/link/hooks/use-link-actions.js +0 -48
- package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +0 -1
- package/plugins/link/hooks/use-link-cancel-on-escape.js +0 -5
- package/plugins/link/hooks/use-link-submit-on-enter.d.ts +0 -1
- package/plugins/link/hooks/use-link-submit-on-enter.js +0 -23
- package/plugins/link/transforms/get-active-link.d.ts +0 -3
- package/plugins/link/transforms/get-active-link.js +0 -17
- package/plugins/link/transforms/insert-link.d.ts +0 -2
- package/plugins/link/transforms/insert-link.js +0 -27
- package/plugins/link/transforms/is-link-selected.d.ts +0 -2
- package/plugins/link/transforms/is-link-selected.js +0 -15
- package/plugins/link/transforms/submit-link.d.ts +0 -8
- package/plugins/link/transforms/submit-link.js +0 -36
- package/plugins/link/transforms/trigger-link-insert-or-edit.d.ts +0 -2
- package/plugins/link/transforms/trigger-link-insert-or-edit.js +0 -6
- package/plugins/link/transforms/unwrap-link.d.ts +0 -2
- package/plugins/link/transforms/unwrap-link.js +0 -10
- package/plugins/link/types.d.ts +0 -5
- package/plugins/link/types.js +0 -2
- package/plugins/list/constants.d.ts +0 -4
- package/plugins/list/constants.js +0 -14
- package/plugins/list/create-list-plugin.d.ts +0 -4
- package/plugins/list/create-list-plugin.js +0 -16
- package/plugins/mark-bold/create-bold-plugin.d.ts +0 -3
- package/plugins/mark-bold/create-bold-plugin.js +0 -6
- package/plugins/mark-bold/types.d.ts +0 -2
- package/plugins/mark-bold/types.js +0 -6
- package/plugins/mark-code/create-code-plugin.d.ts +0 -3
- package/plugins/mark-code/create-code-plugin.js +0 -6
- package/plugins/mark-code/types.d.ts +0 -2
- package/plugins/mark-code/types.js +0 -6
- package/plugins/mark-italic/create-italic-plugin.d.ts +0 -3
- package/plugins/mark-italic/create-italic-plugin.js +0 -6
- package/plugins/mark-italic/types.d.ts +0 -2
- package/plugins/mark-italic/types.js +0 -6
- package/plugins/mark-underline/create-underline-plugin.d.ts +0 -3
- package/plugins/mark-underline/create-underline-plugin.js +0 -6
- package/plugins/mark-underline/types.d.ts +0 -2
- package/plugins/mark-underline/types.js +0 -6
- package/plugins/node-id/add-ids-to-nodes.d.ts +0 -2
- package/plugins/node-id/add-ids-to-nodes.js +0 -22
- package/plugins/node-id/create-node-id-plugin.d.ts +0 -3
- package/plugins/node-id/create-node-id-plugin.js +0 -6
- package/plugins/paragraph/create-paragraph-plugin.d.ts +0 -3
- package/plugins/paragraph/create-paragraph-plugin.js +0 -9
- package/plugins/paragraph/types.d.ts +0 -2
- package/plugins/paragraph/types.js +0 -6
- package/plugins/reset-node/create-reset-node.d.ts +0 -3
- package/plugins/reset-node/create-reset-node.js +0 -28
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +0 -3
- package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +0 -14
- package/plugins/soft-break/create-soft-break-plugin.d.ts +0 -3
- package/plugins/soft-break/create-soft-break-plugin.js +0 -22
- package/plugins/trailing-block/create-trailing-block-plugin.d.ts +0 -3
- package/plugins/trailing-block/create-trailing-block-plugin.js +0 -6
- package/serializers/serialize-to-plaintext.d.ts +0 -2
- package/serializers/serialize-to-plaintext.js +0 -8
- package/translations/context.d.ts +0 -2
- package/translations/context.js +0 -9
- package/translations/cs.d.ts +0 -52
- package/translations/cs.js +0 -55
- package/translations/en.d.ts +0 -2
- package/translations/en.js +0 -55
- package/translations/sk.d.ts +0 -2
- package/translations/sk.js +0 -55
- package/types.d.ts +0 -102
- package/types.js +0 -2
- package/ui/blockquote-element.d.ts +0 -2
- package/ui/blockquote-element.js +0 -13
- package/ui/bold-mark.d.ts +0 -2
- package/ui/bold-mark.js +0 -13
- package/ui/button/button-element.d.ts +0 -2
- package/ui/button/button-element.js +0 -54
- package/ui/button/index.d.ts +0 -1
- package/ui/button/index.js +0 -5
- package/ui/button/insert-button-modal-content.d.ts +0 -8
- package/ui/button/insert-button-modal-content.js +0 -81
- package/ui/code-mark.d.ts +0 -2
- package/ui/code-mark.js +0 -13
- package/ui/components/element/element-action-buttons.d.ts +0 -9
- package/ui/components/element/element-action-buttons.js +0 -22
- package/ui/components/element/element-with-action-buttons.d.ts +0 -10
- package/ui/components/element/element-with-action-buttons.js +0 -17
- package/ui/components/modal/modal-button-cancel.d.ts +0 -9
- package/ui/components/modal/modal-button-cancel.js +0 -45
- package/ui/components/modal/modal-button-submit.d.ts +0 -6
- package/ui/components/modal/modal-button-submit.js +0 -12
- package/ui/components/modal/modal-buttons.d.ts +0 -11
- package/ui/components/modal/modal-buttons.js +0 -16
- package/ui/components/modal/modal-content.d.ts +0 -6
- package/ui/components/modal/modal-content.js +0 -14
- package/ui/create-uxf-ui.d.ts +0 -21
- package/ui/create-uxf-ui.js +0 -51
- package/ui/floating-link.d.ts +0 -2
- package/ui/floating-link.js +0 -110
- package/ui/heading-elements.d.ts +0 -7
- package/ui/heading-elements.js +0 -38
- package/ui/highlight-mark.d.ts +0 -3
- package/ui/highlight-mark.js +0 -13
- package/ui/image/image-element.d.ts +0 -2
- package/ui/image/image-element.js +0 -53
- package/ui/image/insert-image-modal-content.d.ts +0 -8
- package/ui/image/insert-image-modal-content.js +0 -87
- package/ui/italic-mark.d.ts +0 -2
- package/ui/italic-mark.js +0 -13
- package/ui/link-element.d.ts +0 -3
- package/ui/link-element.js +0 -14
- package/ui/list-item-element.d.ts +0 -2
- package/ui/list-item-element.js +0 -13
- package/ui/list-ordered-element.d.ts +0 -2
- package/ui/list-ordered-element.js +0 -13
- package/ui/list-unordered-element.d.ts +0 -2
- package/ui/list-unordered-element.js +0 -13
- package/ui/paragraph-element.d.ts +0 -2
- package/ui/paragraph-element.js +0 -13
- package/ui/toolbar/buttons/button-toolbar-button.d.ts +0 -10
- package/ui/toolbar/buttons/button-toolbar-button.js +0 -20
- package/ui/toolbar/buttons/element-toolbar-button.d.ts +0 -12
- package/ui/toolbar/buttons/element-toolbar-button.js +0 -25
- package/ui/toolbar/buttons/image-toolbar-button.d.ts +0 -10
- package/ui/toolbar/buttons/image-toolbar-button.js +0 -20
- package/ui/toolbar/buttons/link-toolbar-button.d.ts +0 -10
- package/ui/toolbar/buttons/link-toolbar-button.js +0 -29
- package/ui/toolbar/buttons/list-toolbar-button.d.ts +0 -13
- package/ui/toolbar/buttons/list-toolbar-button.js +0 -27
- package/ui/toolbar/buttons/mark-toolbar-button.d.ts +0 -13
- package/ui/toolbar/buttons/mark-toolbar-button.js +0 -25
- package/ui/toolbar/buttons/modal-toolbar-button.d.ts +0 -15
- package/ui/toolbar/buttons/modal-toolbar-button.js +0 -22
- package/ui/toolbar/buttons/toolbar-button.d.ts +0 -15
- package/ui/toolbar/buttons/toolbar-button.js +0 -35
- package/ui/toolbar/buttons/undo-redo-button-group.d.ts +0 -8
- package/ui/toolbar/buttons/undo-redo-button-group.js +0 -64
- package/ui/toolbar/buttons/video-toolbar-button.d.ts +0 -10
- package/ui/toolbar/buttons/video-toolbar-button.js +0 -20
- package/ui/toolbar/toolbar.d.ts +0 -3
- package/ui/toolbar/toolbar.js +0 -77
- package/ui/toolbar/types.d.ts +0 -8
- package/ui/toolbar/types.js +0 -2
- package/ui/underline-mark.d.ts +0 -2
- package/ui/underline-mark.js +0 -13
- package/ui/utils.d.ts +0 -2
- package/ui/utils.js +0 -13
- package/ui/video/insert-video-modal-content.d.ts +0 -8
- package/ui/video/insert-video-modal-content.js +0 -76
- package/ui/video/video-element.d.ts +0 -2
- package/ui/video/video-element.js +0 -55
- package/utils/url-helper.d.ts +0 -7
- package/utils/url-helper.js +0 -15
- package/utils/url-helper.test.d.ts +0 -1
- package/utils/url-helper.test.js +0 -37
- package/utils.d.ts +0 -30
- package/utils.js +0 -88
- package/wysiwyg-editor.d.ts +0 -17
- package/wysiwyg-editor.js +0 -44
- package/wysiwyg-editor.stories.d.ts +0 -5
- package/wysiwyg-editor.stories.js +0 -193
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withPasteImage = void 0;
|
|
4
|
-
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
-
const insert_image_1 = require("./transforms/insert-image");
|
|
6
|
-
/**
|
|
7
|
-
* If image is pasted from clipboard, upload image and insert it.
|
|
8
|
-
*/
|
|
9
|
-
const withPasteImage = (editor, plugin) => {
|
|
10
|
-
const { options: { uploadImage, getImageUrl }, } = plugin;
|
|
11
|
-
const { insertData } = editor;
|
|
12
|
-
editor.insertData = async (dataTransfer) => {
|
|
13
|
-
const text = dataTransfer.getData("text/plain");
|
|
14
|
-
const { files, effectAllowed } = dataTransfer;
|
|
15
|
-
if (files.length > 0 && effectAllowed === "uninitialized") {
|
|
16
|
-
// effectAllowed prevents re-upload image on drag and drop
|
|
17
|
-
const injectedPlugins = (0, plate_core_1.getInjectedPlugins)(editor, plugin);
|
|
18
|
-
if (!(0, plate_core_1.pipeInsertDataQuery)(injectedPlugins, {
|
|
19
|
-
data: text,
|
|
20
|
-
dataTransfer,
|
|
21
|
-
})) {
|
|
22
|
-
return insertData(dataTransfer);
|
|
23
|
-
}
|
|
24
|
-
for (const file of Array.from(files)) {
|
|
25
|
-
const [mime] = file.type.split("/");
|
|
26
|
-
if (mime === "image") {
|
|
27
|
-
if (!uploadImage) {
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.log("Missing uploadImage function in image plugin options!");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line no-await-in-loop
|
|
33
|
-
const uploadedFile = await uploadImage(file);
|
|
34
|
-
if (!getImageUrl) {
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
console.log("Missing getImageUrl function in image plugin options!");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
(0, insert_image_1.insertImage)(editor, uploadedFile, undefined, undefined, undefined, getImageUrl(uploadedFile));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
insertData(dataTransfer);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
return editor;
|
|
48
|
-
};
|
|
49
|
-
exports.withPasteImage = withPasteImage;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LINK_PLUGIN_TYPE = exports.ELEMENT_LINK = void 0;
|
|
4
|
-
var plate_link_1 = require("@udecode/plate-link");
|
|
5
|
-
Object.defineProperty(exports, "ELEMENT_LINK", { enumerable: true, get: function () { return plate_link_1.ELEMENT_LINK; } });
|
|
6
|
-
exports.LINK_PLUGIN_TYPE = "link";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLinkPlugin = void 0;
|
|
4
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
5
|
-
const floating_link_1 = require("../../ui/floating-link");
|
|
6
|
-
const url_helper_1 = require("../../utils/url-helper");
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
const createLinkPlugin = () => (0, plate_link_1.createLinkPlugin)({
|
|
9
|
-
type: constants_1.LINK_PLUGIN_TYPE,
|
|
10
|
-
renderAfterEditable: floating_link_1.FloatingLink,
|
|
11
|
-
options: {
|
|
12
|
-
isUrl: url_helper_1.UrlHelper.isValid,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
exports.createLinkPlugin = createLinkPlugin;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HTMLPropsAs } from "@udecode/plate-common";
|
|
2
|
-
import { UseVirtualFloatingOptions } from "@udecode/plate-floating";
|
|
3
|
-
export type FloatingLinkProps = HTMLPropsAs<"div"> & {
|
|
4
|
-
floatingOptions?: UseVirtualFloatingOptions;
|
|
5
|
-
};
|
|
6
|
-
export declare const FloatingLinkEditRoot: import("@udecode/plate-common").Component<FloatingLinkProps>;
|
|
7
|
-
export declare const FloatingLinkInsertRoot: import("@udecode/plate-common").Component<FloatingLinkProps>;
|
|
8
|
-
export declare const FloatingLinkWrapper: {
|
|
9
|
-
EditRoot: import("@udecode/plate-common").Component<FloatingLinkProps>;
|
|
10
|
-
InsertRoot: import("@udecode/plate-common").Component<FloatingLinkProps>;
|
|
11
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FloatingLinkWrapper = exports.FloatingLinkInsertRoot = exports.FloatingLinkEditRoot = void 0;
|
|
4
|
-
const plate_common_1 = require("@udecode/plate-common");
|
|
5
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
6
|
-
const tw_z_index_1 = require("@uxf/ui/tw-tokens/tw-z-index");
|
|
7
|
-
exports.FloatingLinkEditRoot = (0, plate_common_1.createComponentAs)((props) => {
|
|
8
|
-
var _a;
|
|
9
|
-
const htmlProps = (0, plate_link_1.useFloatingLinkEdit)(props);
|
|
10
|
-
if (((_a = htmlProps.style) === null || _a === void 0 ? void 0 : _a.display) === "none") {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.modal } });
|
|
14
|
-
});
|
|
15
|
-
exports.FloatingLinkInsertRoot = (0, plate_common_1.createComponentAs)((props) => {
|
|
16
|
-
var _a;
|
|
17
|
-
const htmlProps = (0, plate_link_1.useFloatingLinkInsert)(props);
|
|
18
|
-
if (((_a = htmlProps.style) === null || _a === void 0 ? void 0 : _a.display) === "none") {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.modal } });
|
|
22
|
-
});
|
|
23
|
-
exports.FloatingLinkWrapper = {
|
|
24
|
-
EditRoot: exports.FloatingLinkEditRoot,
|
|
25
|
-
InsertRoot: exports.FloatingLinkInsertRoot,
|
|
26
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLinkSubmitOnEnter = exports.useLinkCancelOnEscape = exports.useLinkActions = exports.useFloatingLinkSelectors = void 0;
|
|
4
|
-
var plate_link_1 = require("@udecode/plate-link");
|
|
5
|
-
Object.defineProperty(exports, "useFloatingLinkSelectors", { enumerable: true, get: function () { return plate_link_1.useFloatingLinkSelectors; } });
|
|
6
|
-
var use_link_actions_1 = require("./use-link-actions");
|
|
7
|
-
Object.defineProperty(exports, "useLinkActions", { enumerable: true, get: function () { return use_link_actions_1.useLinkActions; } });
|
|
8
|
-
var use_link_cancel_on_escape_1 = require("./use-link-cancel-on-escape");
|
|
9
|
-
Object.defineProperty(exports, "useLinkCancelOnEscape", { enumerable: true, get: function () { return use_link_cancel_on_escape_1.useLinkCancelOnEscape; } });
|
|
10
|
-
var use_link_submit_on_enter_1 = require("./use-link-submit-on-enter");
|
|
11
|
-
Object.defineProperty(exports, "useLinkSubmitOnEnter", { enumerable: true, get: function () { return use_link_submit_on_enter_1.useLinkSubmitOnEnter; } });
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const useLinkActions: () => {
|
|
2
|
-
editor: unknown;
|
|
3
|
-
setUrl: (url: string) => void;
|
|
4
|
-
getUrl: string;
|
|
5
|
-
setText: (text: string) => void;
|
|
6
|
-
getText: string;
|
|
7
|
-
setTarget: (target: string | undefined) => void;
|
|
8
|
-
getTarget: string;
|
|
9
|
-
setAllValues: (url: string, text: string, target: string | undefined) => void;
|
|
10
|
-
getActiveLinkValue: () => import("@udecode/plate-link").TLinkElement | undefined;
|
|
11
|
-
isEditing: boolean;
|
|
12
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLinkActions = void 0;
|
|
4
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
5
|
-
const hooks_1 = require("../../../hooks");
|
|
6
|
-
const get_active_link_1 = require("../transforms/get-active-link");
|
|
7
|
-
const use_link_cancel_on_escape_1 = require("./use-link-cancel-on-escape");
|
|
8
|
-
const use_link_submit_on_enter_1 = require("./use-link-submit-on-enter");
|
|
9
|
-
const useLinkActions = () => {
|
|
10
|
-
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
11
|
-
(0, use_link_submit_on_enter_1.useLinkSubmitOnEnter)();
|
|
12
|
-
(0, use_link_cancel_on_escape_1.useLinkCancelOnEscape)();
|
|
13
|
-
const floatingLinkSelectors = (0, plate_link_1.useFloatingLinkSelectors)();
|
|
14
|
-
const setUrl = (url) => {
|
|
15
|
-
plate_link_1.floatingLinkActions.url(url);
|
|
16
|
-
plate_link_1.floatingLinkActions.isEditing(true);
|
|
17
|
-
};
|
|
18
|
-
const setText = (text) => {
|
|
19
|
-
plate_link_1.floatingLinkActions.text(text);
|
|
20
|
-
plate_link_1.floatingLinkActions.isEditing(true);
|
|
21
|
-
};
|
|
22
|
-
const setTarget = (target) => {
|
|
23
|
-
plate_link_1.floatingLinkActions.newTab(target === "_blank");
|
|
24
|
-
plate_link_1.floatingLinkActions.isEditing(true);
|
|
25
|
-
};
|
|
26
|
-
const setAllValues = (url, text, target) => {
|
|
27
|
-
setUrl(url);
|
|
28
|
-
setText(text);
|
|
29
|
-
setTarget(target);
|
|
30
|
-
plate_link_1.floatingLinkActions.isEditing(true);
|
|
31
|
-
// floatingLinkActions.show("edit", editor.id);
|
|
32
|
-
};
|
|
33
|
-
const getActiveLinkValue = () => (0, get_active_link_1.getActiveLink)(editor);
|
|
34
|
-
return {
|
|
35
|
-
editor: editor.current,
|
|
36
|
-
setUrl,
|
|
37
|
-
getUrl: floatingLinkSelectors.url(),
|
|
38
|
-
setText,
|
|
39
|
-
getText: floatingLinkSelectors.text(),
|
|
40
|
-
setTarget,
|
|
41
|
-
getTarget: floatingLinkSelectors.newTab() ? "_blank" : "_self",
|
|
42
|
-
setAllValues,
|
|
43
|
-
getActiveLinkValue,
|
|
44
|
-
// isLinkActive: linkActive,
|
|
45
|
-
isEditing: floatingLinkSelectors.isEditing(),
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
exports.useLinkActions = useLinkActions;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useFloatingLinkEscape as useLinkCancelOnEscape } from "@udecode/plate-link";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLinkCancelOnEscape = void 0;
|
|
4
|
-
var plate_link_1 = require("@udecode/plate-link");
|
|
5
|
-
Object.defineProperty(exports, "useLinkCancelOnEscape", { enumerable: true, get: function () { return plate_link_1.useFloatingLinkEscape; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useLinkSubmitOnEnter: () => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLinkSubmitOnEnter = void 0;
|
|
4
|
-
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
6
|
-
const hooks_1 = require("../../../hooks");
|
|
7
|
-
const submit_link_1 = require("../transforms/submit-link");
|
|
8
|
-
const useLinkSubmitOnEnter = () => {
|
|
9
|
-
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
10
|
-
const open = (0, plate_link_1.useFloatingLinkSelectors)().isEditing();
|
|
11
|
-
(0, plate_core_1.useHotkeys)("*", (e) => {
|
|
12
|
-
if (e.key !== "Enter") {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if ((0, submit_link_1.submitLink)(editor)) {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
|
-
enabled: open,
|
|
20
|
-
enableOnFormTags: ["INPUT"],
|
|
21
|
-
}, []);
|
|
22
|
-
};
|
|
23
|
-
exports.useLinkSubmitOnEnter = useLinkSubmitOnEnter;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getActiveLink = void 0;
|
|
4
|
-
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
6
|
-
const slate_1 = require("@udecode/slate");
|
|
7
|
-
const getActiveLink = (editor) => {
|
|
8
|
-
const entry = (0, slate_1.findNode)(editor, {
|
|
9
|
-
match: { type: (0, plate_core_1.getPluginType)(editor, plate_link_1.ELEMENT_LINK) },
|
|
10
|
-
});
|
|
11
|
-
if (!entry) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const [link] = entry;
|
|
15
|
-
return link;
|
|
16
|
-
};
|
|
17
|
-
exports.getActiveLink = getActiveLink;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertLink = void 0;
|
|
4
|
-
const plate_common_1 = require("@udecode/plate-common");
|
|
5
|
-
const plate_core_1 = require("@udecode/plate-core");
|
|
6
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
7
|
-
const insertLink = (editor, url, text, target) => {
|
|
8
|
-
if (!editor.selection) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const { isUrl, forceSubmit } = (0, plate_core_1.getPluginOptions)(editor, plate_link_1.ELEMENT_LINK);
|
|
12
|
-
const isValid = (isUrl === null || isUrl === void 0 ? void 0 : isUrl(url)) || forceSubmit;
|
|
13
|
-
if (!isValid) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
(0, plate_link_1.upsertLink)(editor, {
|
|
17
|
-
url,
|
|
18
|
-
text,
|
|
19
|
-
target,
|
|
20
|
-
skipValidation: true,
|
|
21
|
-
});
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
(0, plate_common_1.focusEditor)(editor, editor.selection || undefined);
|
|
24
|
-
}, 0);
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
exports.insertLink = insertLink;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLinkSelected = void 0;
|
|
4
|
-
const utils_1 = require("../../../utils");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const isLinkSelected = (editor) => {
|
|
7
|
-
if (!editor.selection) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return ((0, utils_1.isRangeInSingleText)(editor) &&
|
|
11
|
-
(0, utils_1.someNode)(editor, {
|
|
12
|
-
match: { type: (0, utils_1.getPluginType)(editor, constants_1.LINK_PLUGIN_TYPE) },
|
|
13
|
-
}));
|
|
14
|
-
};
|
|
15
|
-
exports.isLinkSelected = isLinkSelected;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PlateEditor } from "@udecode/plate-core";
|
|
2
|
-
import { Value } from "@udecode/slate";
|
|
3
|
-
/**
|
|
4
|
-
* Insert transforms if url is valid from store
|
|
5
|
-
* Text is url if empty.
|
|
6
|
-
* Focus editor.
|
|
7
|
-
*/
|
|
8
|
-
export declare const submitLink: <V extends Value>(editor: PlateEditor<V>) => true | undefined;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitLink = void 0;
|
|
4
|
-
const plate_common_1 = require("@udecode/plate-common");
|
|
5
|
-
const plate_core_1 = require("@udecode/plate-core");
|
|
6
|
-
const plate_link_1 = require("@udecode/plate-link");
|
|
7
|
-
/**
|
|
8
|
-
* Insert transforms if url is valid from store
|
|
9
|
-
* Text is url if empty.
|
|
10
|
-
* Focus editor.
|
|
11
|
-
*/
|
|
12
|
-
const submitLink = (editor) => {
|
|
13
|
-
if (!editor.selection) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const { isUrl, forceSubmit } = (0, plate_core_1.getPluginOptions)(editor, plate_link_1.ELEMENT_LINK);
|
|
17
|
-
const url = plate_link_1.floatingLinkSelectors.url();
|
|
18
|
-
const isValid = (isUrl === null || isUrl === void 0 ? void 0 : isUrl(url)) || forceSubmit;
|
|
19
|
-
if (!isValid) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const text = plate_link_1.floatingLinkSelectors.text();
|
|
23
|
-
const target = plate_link_1.floatingLinkSelectors.newTab() ? "_blank" : "_self";
|
|
24
|
-
(0, plate_link_1.upsertLink)(editor, {
|
|
25
|
-
url,
|
|
26
|
-
text,
|
|
27
|
-
target,
|
|
28
|
-
skipValidation: true,
|
|
29
|
-
});
|
|
30
|
-
plate_link_1.floatingLinkActions.reset();
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
(0, plate_common_1.focusEditor)(editor, editor.selection || undefined);
|
|
33
|
-
}, 0);
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
|
-
exports.submitLink = submitLink;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
package/plugins/link/types.d.ts
DELETED
package/plugins/link/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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";
|