@uxf/wysiwyg 1.2.2 → 2.0.0-beta.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.
- package/README.md +6 -21
- package/WysiwygEditor.d.ts +10 -0
- package/WysiwygEditor.js +32 -0
- package/create-all-uxf-plugins.d.ts +2 -0
- package/create-all-uxf-plugins.js +33 -0
- package/hooks.d.ts +9 -0
- package/hooks.js +21 -0
- package/index.d.ts +4 -6
- package/index.js +8 -15
- package/package.json +39 -47
- package/plugins/block-quote/create-block-quote-plugin.d.ts +3 -0
- package/plugins/block-quote/create-block-quote-plugin.js +13 -0
- package/plugins/block-quote/types.d.ts +2 -0
- package/plugins/block-quote/types.js +7 -0
- package/plugins/create-uxf-plugins.d.ts +5 -0
- package/plugins/create-uxf-plugins.js +23 -0
- package/plugins/exit-break/create-exit-break-plugin.d.ts +3 -0
- package/plugins/exit-break/create-exit-break-plugin.js +31 -0
- package/plugins/heading/constants.d.ts +8 -0
- package/plugins/heading/constants.js +12 -0
- package/plugins/heading/create-headings-plugin.d.ts +7 -0
- package/plugins/heading/create-headings-plugin.js +41 -0
- package/plugins/image/create-image-plugin.d.ts +6 -0
- package/plugins/image/create-image-plugin.js +106 -0
- package/plugins/image/hooks/use-image-handlers.d.ts +5 -0
- package/plugins/image/hooks/use-image-handlers.js +20 -0
- package/plugins/image/transforms/get-active-image.d.ts +2 -0
- package/plugins/image/transforms/get-active-image.js +17 -0
- package/plugins/image/transforms/insert-image.d.ts +3 -0
- package/plugins/image/transforms/insert-image.js +20 -0
- package/plugins/image/transforms/remove-selected-image.d.ts +2 -0
- package/plugins/image/transforms/remove-selected-image.js +18 -0
- package/plugins/image/transforms/update-image.d.ts +3 -0
- package/plugins/image/transforms/update-image.js +13 -0
- package/plugins/image/types.d.ts +18 -0
- package/plugins/image/types.js +7 -0
- package/plugins/image/utils/is-image-url.d.ts +2 -0
- package/plugins/image/utils/is-image-url.js +136 -0
- package/plugins/image/with-image.d.ts +7 -0
- package/plugins/image/with-image.js +20 -0
- package/plugins/image/with-paste-image-url.d.ts +7 -0
- package/plugins/image/with-paste-image-url.js +37 -0
- package/plugins/image/with-paste-image.d.ts +7 -0
- package/plugins/image/with-paste-image.js +50 -0
- package/plugins/link/constants.d.ts +2 -0
- package/plugins/link/constants.js +7 -0
- package/plugins/link/create-link-plugin.d.ts +3 -0
- package/plugins/link/create-link-plugin.js +11 -0
- package/plugins/link/hooks/index.d.ts +4 -0
- package/plugins/link/hooks/index.js +12 -0
- package/plugins/link/hooks/use-link-actions.d.ts +13 -0
- package/plugins/link/hooks/use-link-actions.js +66 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +1 -0
- package/plugins/link/hooks/use-link-cancel-on-escape.js +6 -0
- package/plugins/link/hooks/use-link-submit-on-enter.d.ts +1 -0
- package/plugins/link/hooks/use-link-submit-on-enter.js +24 -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 +14 -0
- package/plugins/link/transforms/submit-link.d.ts +7 -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 +7 -0
- package/plugins/list/constants.d.ts +4 -0
- package/plugins/list/constants.js +15 -0
- package/plugins/list/create-list-plugin.d.ts +4 -0
- package/plugins/list/create-list-plugin.js +17 -0
- package/plugins/mark-bold/create-bold-plugin.d.ts +3 -0
- package/plugins/mark-bold/create-bold-plugin.js +7 -0
- package/plugins/mark-bold/types.d.ts +2 -0
- package/plugins/mark-bold/types.js +7 -0
- package/plugins/mark-code/create-code-plugin.d.ts +3 -0
- package/plugins/mark-code/create-code-plugin.js +7 -0
- package/plugins/mark-code/types.d.ts +2 -0
- package/plugins/mark-code/types.js +7 -0
- package/plugins/mark-italic/create-italic-plugin.d.ts +3 -0
- package/plugins/mark-italic/create-italic-plugin.js +7 -0
- package/plugins/mark-italic/types.d.ts +2 -0
- package/plugins/mark-italic/types.js +7 -0
- package/plugins/mark-underline/create-underline-plugin.d.ts +3 -0
- package/plugins/mark-underline/create-underline-plugin.js +7 -0
- package/plugins/mark-underline/types.d.ts +2 -0
- package/plugins/mark-underline/types.js +7 -0
- package/plugins/node-id/add-ids-to-nodes.d.ts +2 -0
- package/plugins/node-id/add-ids-to-nodes.js +23 -0
- package/plugins/node-id/create-node-id-plugin.d.ts +3 -0
- package/plugins/node-id/create-node-id-plugin.js +7 -0
- package/plugins/paragraph/create-paragraph-plugin.d.ts +3 -0
- package/plugins/paragraph/create-paragraph-plugin.js +13 -0
- package/plugins/paragraph/types.d.ts +2 -0
- package/plugins/paragraph/types.js +7 -0
- package/plugins/reset-node/create-reset-node.d.ts +3 -0
- package/plugins/reset-node/create-reset-node.js +29 -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 +15 -0
- package/plugins/soft-break/create-soft-break-plugin.d.ts +3 -0
- package/plugins/soft-break/create-soft-break-plugin.js +23 -0
- package/plugins/trailing-block/create-trailing-block-plugin.d.ts +3 -0
- package/plugins/trailing-block/create-trailing-block-plugin.js +7 -0
- package/serializers/serialize-to-plaintext.d.ts +2 -0
- package/serializers/serialize-to-plaintext.js +9 -0
- package/types.d.ts +65 -136
- package/ui/block-quote-element.d.ts +2 -0
- package/ui/block-quote-element.js +9 -0
- package/ui/bold-mark.d.ts +2 -0
- package/ui/bold-mark.js +9 -0
- package/ui/code-mark.d.ts +2 -0
- package/ui/code-mark.js +9 -0
- package/ui/create-uxf-ui.d.ts +19 -0
- package/ui/create-uxf-ui.js +46 -0
- package/ui/floating-link.d.ts +2 -0
- package/ui/floating-link.js +41 -0
- package/ui/heading-elements.d.ts +7 -0
- package/ui/heading-elements.js +29 -0
- package/ui/image/image-element.d.ts +2 -0
- package/ui/image/image-element.js +26 -0
- package/ui/image/image-upload-dialog.d.ts +10 -0
- package/ui/image/image-upload-dialog.js +63 -0
- package/ui/italic-mark.d.ts +2 -0
- package/ui/italic-mark.js +9 -0
- package/ui/link-element.d.ts +3 -0
- package/ui/link-element.js +9 -0
- package/ui/list-item-element.d.ts +2 -0
- package/ui/list-item-element.js +9 -0
- package/ui/list-ordered-element.d.ts +2 -0
- package/ui/list-ordered-element.js +9 -0
- package/ui/list-unordered-element.d.ts +2 -0
- package/ui/list-unordered-element.js +9 -0
- package/ui/paragraph-element.d.ts +2 -0
- package/ui/paragraph-element.js +9 -0
- package/ui/toolbar/buttons/element-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/element-toolbar-button.js +25 -0
- package/ui/toolbar/buttons/icons.d.ts +16 -0
- package/ui/toolbar/buttons/icons.js +37 -0
- package/ui/toolbar/buttons/image-toolbar-button.d.ts +9 -0
- package/ui/toolbar/buttons/image-toolbar-button.js +22 -0
- package/ui/toolbar/buttons/link-toolbar-button.d.ts +9 -0
- package/ui/toolbar/buttons/link-toolbar-button.js +27 -0
- package/ui/toolbar/buttons/list-toolbar-button.d.ts +11 -0
- package/ui/toolbar/buttons/list-toolbar-button.js +27 -0
- package/ui/toolbar/buttons/mark-toolbar-button.d.ts +10 -0
- package/ui/toolbar/buttons/mark-toolbar-button.js +25 -0
- package/ui/toolbar/toolbar.d.ts +11 -0
- package/ui/toolbar/toolbar.js +9 -0
- package/ui/underline-mark.d.ts +2 -0
- package/ui/underline-mark.js +9 -0
- package/utils.d.ts +22 -0
- package/utils.js +23 -0
- package/Content/Renderer/Components/VideoComponent/VideoComponent.d.ts +0 -6
- package/Content/Renderer/Components/VideoComponent/VideoComponent.js +0 -43
- package/Content/Renderer/Components/VideoComponent/index.d.ts +0 -1
- package/Content/Renderer/Components/VideoComponent/index.js +0 -6
- package/Content/Renderer/ContentRenderer.d.ts +0 -3
- package/Content/Renderer/ContentRenderer.js +0 -44
- package/Content/Renderer/index.d.ts +0 -3
- package/Content/Renderer/index.js +0 -23
- package/Content/Renderer/renderElement.d.ts +0 -4
- package/Content/Renderer/renderElement.js +0 -152
- package/Content/Renderer/renderLeaf.d.ts +0 -4
- package/Content/Renderer/renderLeaf.js +0 -51
- package/Content/Renderer/typeGuards.d.ts +0 -5
- package/Content/Renderer/typeGuards.js +0 -20
- package/Content/Renderer/types.d.ts +0 -83
- package/Content/Renderer/types.js +0 -3
- package/Content/index.d.ts +0 -4
- package/Content/index.js +0 -23
- package/Converter/convertToPlainText.d.ts +0 -2
- package/Converter/convertToPlainText.js +0 -10
- package/Converter/index.d.ts +0 -1
- package/Converter/index.js +0 -6
- package/Editor/Slate/Element.d.ts +0 -6
- package/Editor/Slate/Element.js +0 -36
- package/Editor/Slate/Leaf.d.ts +0 -5
- package/Editor/Slate/Leaf.js +0 -27
- package/Editor/Slate/createUxfEditor.d.ts +0 -1
- package/Editor/Slate/createUxfEditor.js +0 -12
- package/Editor/Slate/index.d.ts +0 -3
- package/Editor/Slate/index.js +0 -10
- package/Editor/Slate/utils.d.ts +0 -24
- package/Editor/Slate/utils.js +0 -220
- package/Editor/Slate/withLinks.d.ts +0 -2
- package/Editor/Slate/withLinks.js +0 -74
- package/Editor/Slate/withUxfUtils.d.ts +0 -2
- package/Editor/Slate/withUxfUtils.js +0 -31
- package/Editor/Slate/withVoids.d.ts +0 -2
- package/Editor/Slate/withVoids.js +0 -41
- package/Editor/WysiwygEditor.d.ts +0 -3
- package/Editor/WysiwygEditor.js +0 -114
- package/Editor/index.d.ts +0 -2
- package/Editor/index.js +0 -21
package/README.md
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/@uxf/wysiwyg)
|
|
5
|
-
[](https://www.npmjs.com/package/@uxf/wysiwyg)
|
|
6
|
-
|
|
7
|
-
Use Node < 17
|
|
8
|
-
|
|
9
|
-
Package depends on @uxf/storage (PHP BE)
|
|
10
|
-
|
|
11
|
-
#Installation
|
|
12
|
-
|
|
13
|
-
### Web
|
|
1
|
+
## Wysiwyg Mvp
|
|
2
|
+
`yarn add @udecode/plate`
|
|
3
|
+
### required peer deps
|
|
14
4
|
```bash
|
|
15
|
-
yarn
|
|
16
|
-
```
|
|
5
|
+
yarn install slate slate-react slate-history slate-hyperscript react react-dom react-dnd react-dnd-html5-backend styled-components @styled-icons/material
|
|
6
|
+
```
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
yarn add @uxf/wysiywg-editor
|
|
21
|
-
# Install peer dependencies if not installed
|
|
22
|
-
yarn add @material-ui/core @material-ui/icons @material-ui/lab
|
|
23
|
-
```
|
|
8
|
+
soft break & exit break: @udecode/plate-break
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TEditableProps } from "@udecode/plate-core";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import { UxfPlatePlugin, WysiwygContent } from "./types";
|
|
4
|
+
export interface WysiwygEditorProps {
|
|
5
|
+
initialValue: WysiwygContent | undefined;
|
|
6
|
+
onChange: (value: WysiwygContent) => void;
|
|
7
|
+
plugins: UxfPlatePlugin[];
|
|
8
|
+
editableProps?: TEditableProps<WysiwygContent>;
|
|
9
|
+
}
|
|
10
|
+
export declare const WysiwygEditor: FC<WysiwygEditorProps>;
|
package/WysiwygEditor.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WysiwygEditor = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const plate_core_1 = require("@udecode/plate-core");
|
|
6
|
+
const react_dnd_1 = require("react-dnd");
|
|
7
|
+
const react_dnd_html5_backend_1 = require("react-dnd-html5-backend");
|
|
8
|
+
const types_1 = require("./plugins/block-quote/types");
|
|
9
|
+
const constants_1 = require("./plugins/heading/constants");
|
|
10
|
+
const constants_2 = require("./plugins/list/constants");
|
|
11
|
+
const types_2 = require("./plugins/mark-bold/types");
|
|
12
|
+
const types_3 = require("./plugins/mark-code/types");
|
|
13
|
+
const types_4 = require("./plugins/mark-italic/types");
|
|
14
|
+
const types_5 = require("./plugins/mark-underline/types");
|
|
15
|
+
const element_toolbar_button_1 = require("./ui/toolbar/buttons/element-toolbar-button");
|
|
16
|
+
const icons_1 = require("./ui/toolbar/buttons/icons");
|
|
17
|
+
const image_toolbar_button_1 = require("./ui/toolbar/buttons/image-toolbar-button");
|
|
18
|
+
const link_toolbar_button_1 = require("./ui/toolbar/buttons/link-toolbar-button");
|
|
19
|
+
const list_toolbar_button_1 = require("./ui/toolbar/buttons/list-toolbar-button");
|
|
20
|
+
const mark_toolbar_button_1 = require("./ui/toolbar/buttons/mark-toolbar-button");
|
|
21
|
+
const toolbar_1 = require("./ui/toolbar/toolbar");
|
|
22
|
+
const defaultEditableProps = {
|
|
23
|
+
placeholder: "Napište něco hezkého...",
|
|
24
|
+
spellCheck: false,
|
|
25
|
+
autoFocus: true,
|
|
26
|
+
readOnly: false,
|
|
27
|
+
};
|
|
28
|
+
const WysiwygEditor = ({ initialValue, onChange, editableProps, plugins }) => {
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)(plate_core_1.PlateProvider, { initialValue: initialValue, plugins: plugins, onChange: onChange, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(toolbar_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H1, icon: icons_1.H1Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H2, icon: icons_1.H2Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H3, icon: icons_1.H3Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H4, icon: icons_1.H4Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H5, icon: icons_1.H5Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: constants_1.ELEMENT_H6, icon: icons_1.H6Icon }), (0, jsx_runtime_1.jsx)(element_toolbar_button_1.ElementToolbarButton, { pluginKey: types_1.BLOCK_QUOTE_PLUGIN_KEY, icon: icons_1.BlockQuoteIcon }), (0, jsx_runtime_1.jsx)(mark_toolbar_button_1.MarkToolbarButton, { pluginKey: types_2.BOLD_PLUGIN_KEY, icon: icons_1.BoldIcon }), (0, jsx_runtime_1.jsx)(mark_toolbar_button_1.MarkToolbarButton, { pluginKey: types_4.ITALIC_PLUGIN_KEY, icon: icons_1.ItalicIcon }), (0, jsx_runtime_1.jsx)(mark_toolbar_button_1.MarkToolbarButton, { pluginKey: types_5.UNDER_LINE_PLUGIN_KEY, icon: icons_1.UnderlineIcon }), (0, jsx_runtime_1.jsx)(mark_toolbar_button_1.MarkToolbarButton, { pluginKey: types_3.CODE_PLUGIN_KEY, icon: icons_1.CodeIcon }), (0, jsx_runtime_1.jsx)(list_toolbar_button_1.ListToolbarButton, { pluginKey: constants_2.LIST_UNORDERED_TYPE, icon: icons_1.UlIcon }), (0, jsx_runtime_1.jsx)(list_toolbar_button_1.ListToolbarButton, { pluginKey: constants_2.LIST_ORDERED_TYPE, icon: icons_1.OlIcon }), (0, jsx_runtime_1.jsx)(link_toolbar_button_1.LinkToolbarButton, { buttonText: "Link", icon: icons_1.LinkIcon }), (0, jsx_runtime_1.jsx)(image_toolbar_button_1.ImageToolbarButton, { buttonText: "Image", icon: icons_1.ImageIcon })] }), (0, jsx_runtime_1.jsx)(plate_core_1.Plate, { editableProps: editableProps !== null && editableProps !== void 0 ? editableProps : defaultEditableProps, normalizeInitialValue: true })] }) }) }));
|
|
30
|
+
};
|
|
31
|
+
exports.WysiwygEditor = WysiwygEditor;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV3lzaXd5Z0VkaXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9XeXNpd3lnRWRpdG9yLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsb0RBQTJFO0FBRTNFLHlDQUF3QztBQUN4QyxxRUFBdUQ7QUFDdkQsdURBQXFFO0FBQ3JFLDJEQUFxSDtBQUNySCx3REFBa0Y7QUFDbEYscURBQTREO0FBQzVELHFEQUE0RDtBQUM1RCx1REFBZ0U7QUFDaEUsMERBQXVFO0FBRXZFLHdGQUFtRjtBQUNuRixzREFnQm9DO0FBQ3BDLG9GQUErRTtBQUMvRSxrRkFBNkU7QUFDN0Usa0ZBQTZFO0FBQzdFLGtGQUE2RTtBQUM3RSxrREFBK0M7QUFTL0MsTUFBTSxvQkFBb0IsR0FBbUM7SUFDekQsV0FBVyxFQUFFLHlCQUF5QjtJQUN0QyxVQUFVLEVBQUUsS0FBSztJQUNqQixTQUFTLEVBQUUsSUFBSTtJQUNmLFFBQVEsRUFBRSxLQUFLO0NBQ2xCLENBQUM7QUFFSyxNQUFNLGFBQWEsR0FBMkIsQ0FBQyxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsYUFBYSxFQUFFLE9BQU8sRUFBRSxFQUFFLEVBQUU7SUFDeEcsT0FBTyxDQUNILHVCQUFDLHVCQUFXLElBQUMsT0FBTyxFQUFFLHNDQUFZLFlBQzlCLHVCQUFDLDBCQUFhLElBQWlCLFlBQVksRUFBRSxZQUFZLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsUUFBUSxZQUMzRiw2REFDSSx3QkFBQyxpQkFBTyxlQUNKLHVCQUFDLDZDQUFvQixJQUFDLFNBQVMsRUFBRSxzQkFBVSxFQUFFLElBQUksRUFBRSxjQUFNLEdBQUksRUFDN0QsdUJBQUMsNkNBQW9CLElBQUMsU0FBUyxFQUFFLHNCQUFVLEVBQUUsSUFBSSxFQUFFLGNBQU0sR0FBSSxFQUM3RCx1QkFBQyw2Q0FBb0IsSUFBQyxTQUFTLEVBQUUsc0JBQVUsRUFBRSxJQUFJLEVBQUUsY0FBTSxHQUFJLEVBQzdELHVCQUFDLDZDQUFvQixJQUFDLFNBQVMsRUFBRSxzQkFBVSxFQUFFLElBQUksRUFBRSxjQUFNLEdBQUksRUFDN0QsdUJBQUMsNkNBQW9CLElBQUMsU0FBUyxFQUFFLHNCQUFVLEVBQUUsSUFBSSxFQUFFLGNBQU0sR0FBSSxFQUM3RCx1QkFBQyw2Q0FBb0IsSUFBQyxTQUFTLEVBQUUsc0JBQVUsRUFBRSxJQUFJLEVBQUUsY0FBTSxHQUFJLEVBQzdELHVCQUFDLDZDQUFvQixJQUFDLFNBQVMsRUFBRSw4QkFBc0IsRUFBRSxJQUFJLEVBQUUsc0JBQWMsR0FBSSxFQUNqRix1QkFBQyx1Q0FBaUIsSUFBQyxTQUFTLEVBQUUsdUJBQWUsRUFBRSxJQUFJLEVBQUUsZ0JBQVEsR0FBSSxFQUNqRSx1QkFBQyx1Q0FBaUIsSUFBQyxTQUFTLEVBQUUseUJBQWlCLEVBQUUsSUFBSSxFQUFFLGtCQUFVLEdBQUksRUFDckUsdUJBQUMsdUNBQWlCLElBQUMsU0FBUyxFQUFFLDZCQUFxQixFQUFFLElBQUksRUFBRSxxQkFBYSxHQUFJLEVBQzVFLHVCQUFDLHVDQUFpQixJQUFDLFNBQVMsRUFBRSx1QkFBZSxFQUFFLElBQUksRUFBRSxnQkFBUSxHQUFJLEVBQ2pFLHVCQUFDLHVDQUFpQixJQUFDLFNBQVMsRUFBRSwrQkFBbUIsRUFBRSxJQUFJLEVBQUUsY0FBTSxHQUFJLEVBQ25FLHVCQUFDLHVDQUFpQixJQUFDLFNBQVMsRUFBRSw2QkFBaUIsRUFBRSxJQUFJLEVBQUUsY0FBTSxHQUFJLEVBQ2pFLHVCQUFDLHVDQUFpQixJQUFDLFVBQVUsRUFBQyxNQUFNLEVBQUMsSUFBSSxFQUFFLGdCQUFRLEdBQUksRUFDdkQsdUJBQUMseUNBQWtCLElBQUMsVUFBVSxFQUFDLE9BQU8sRUFBQyxJQUFJLEVBQUUsaUJBQVMsR0FBSSxJQUNwRCxFQUNWLHVCQUFDLGtCQUFLLElBQ0YsYUFBYSxFQUFFLGFBQWEsYUFBYixhQUFhLGNBQWIsYUFBYSxHQUFJLG9CQUFvQixFQUNwRCxxQkFBcUIsRUFBRSxJQUFJLEdBQ3RCLElBQ1YsR0FDUyxHQUNOLENBQ2pCLENBQUM7QUFDTixDQUFDLENBQUM7QUE5QlcsUUFBQSxhQUFhLGlCQThCeEIifQ==
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { GetImageUrlHandler, ImageUploadHandler } from "./plugins/image/types";
|
|
2
|
+
export declare const createAllUxfPlugins: (fileUpload: ImageUploadHandler, getImageUrl: GetImageUrlHandler) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").AnyObject, import("./types").WysiwygContent, import("./types").UxfEditor>[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAllUxfPlugins = void 0;
|
|
4
|
+
const create_block_quote_plugin_1 = require("./plugins/block-quote/create-block-quote-plugin");
|
|
5
|
+
const create_uxf_plugins_1 = require("./plugins/create-uxf-plugins");
|
|
6
|
+
const create_headings_plugin_1 = require("./plugins/heading/create-headings-plugin");
|
|
7
|
+
const create_image_plugin_1 = require("./plugins/image/create-image-plugin");
|
|
8
|
+
const create_link_plugin_1 = require("./plugins/link/create-link-plugin");
|
|
9
|
+
const create_list_plugin_1 = require("./plugins/list/create-list-plugin");
|
|
10
|
+
const create_bold_plugin_1 = require("./plugins/mark-bold/create-bold-plugin");
|
|
11
|
+
const create_code_plugin_1 = require("./plugins/mark-code/create-code-plugin");
|
|
12
|
+
const create_italic_plugin_1 = require("./plugins/mark-italic/create-italic-plugin");
|
|
13
|
+
const create_underline_plugin_1 = require("./plugins/mark-underline/create-underline-plugin");
|
|
14
|
+
const create_uxf_ui_1 = require("./ui/create-uxf-ui");
|
|
15
|
+
const floating_link_1 = require("./ui/floating-link");
|
|
16
|
+
const createAllUxfPlugins = (fileUpload, getImageUrl) => (0, create_uxf_plugins_1.createUxfPlugins)([
|
|
17
|
+
(0, create_headings_plugin_1.createHeadingsPlugin)(),
|
|
18
|
+
(0, create_block_quote_plugin_1.createBlockquotePlugin)(),
|
|
19
|
+
(0, create_bold_plugin_1.createBoldPlugin)(),
|
|
20
|
+
(0, create_italic_plugin_1.createItalicPlugin)(),
|
|
21
|
+
(0, create_underline_plugin_1.createUnderlinePlugin)(),
|
|
22
|
+
(0, create_code_plugin_1.createCodePlugin)(),
|
|
23
|
+
(0, create_list_plugin_1.createListPlugin)(),
|
|
24
|
+
(0, create_link_plugin_1.createLinkPlugin)(floating_link_1.FloatingLink),
|
|
25
|
+
(0, create_image_plugin_1.createImagePlugin)({
|
|
26
|
+
options: {
|
|
27
|
+
uploadImage: fileUpload,
|
|
28
|
+
getImageUrl,
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
], { components: (0, create_uxf_ui_1.createUxfUi)() });
|
|
32
|
+
exports.createAllUxfPlugins = createAllUxfPlugins;
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWFsbC11eGYtcGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUtYWxsLXV4Zi1wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtGQUF5RjtBQUN6RixxRUFBZ0U7QUFDaEUscUZBQWdGO0FBQ2hGLDZFQUF3RTtBQUV4RSwwRUFBcUU7QUFDckUsMEVBQXFFO0FBQ3JFLCtFQUEwRTtBQUMxRSwrRUFBMEU7QUFDMUUscUZBQWdGO0FBQ2hGLDhGQUF5RjtBQUN6RixzREFBaUQ7QUFDakQsc0RBQWtEO0FBRTNDLE1BQU0sbUJBQW1CLEdBQUcsQ0FBQyxVQUE4QixFQUFFLFdBQStCLEVBQUUsRUFBRSxDQUNuRyxJQUFBLHFDQUFnQixFQUNaO0lBQ0ksSUFBQSw2Q0FBb0IsR0FBRTtJQUN0QixJQUFBLGtEQUFzQixHQUFFO0lBQ3hCLElBQUEscUNBQWdCLEdBQUU7SUFDbEIsSUFBQSx5Q0FBa0IsR0FBRTtJQUNwQixJQUFBLCtDQUFxQixHQUFFO0lBQ3ZCLElBQUEscUNBQWdCLEdBQUU7SUFDbEIsSUFBQSxxQ0FBZ0IsR0FBRTtJQUNsQixJQUFBLHFDQUFnQixFQUFDLDRCQUFZLENBQUM7SUFDOUIsSUFBQSx1Q0FBaUIsRUFBQztRQUNkLE9BQU8sRUFBRTtZQUNMLFdBQVcsRUFBRSxVQUFVO1lBQ3ZCLFdBQVc7U0FDZDtLQUNKLENBQUM7Q0FDTCxFQUNELEVBQUUsVUFBVSxFQUFFLElBQUEsMkJBQVcsR0FBRSxFQUFFLENBQ2hDLENBQUM7QUFuQk8sUUFBQSxtQkFBbUIsdUJBbUIxQiJ9
|
package/hooks.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UxfEditor, WysiwygContent } from "./types";
|
|
2
|
+
export declare const useUxfPlateEditorRef: (id?: any) => UxfEditor;
|
|
3
|
+
export declare const useUxfEditorRef: () => UxfEditor;
|
|
4
|
+
export declare const useUxfEditorState: () => UxfEditor;
|
|
5
|
+
export declare const useUxfPlateEditorState: (id?: any) => UxfEditor;
|
|
6
|
+
export declare const useUxfPlateSelectors: (id?: any) => import("@udecode/plate-core").GetRecord<import("@udecode/plate-core").PlateStoreState<WysiwygContent, UxfEditor>>;
|
|
7
|
+
export declare const useUxfPlateActions: (id?: any) => import("@udecode/plate-core").SetRecord<import("@udecode/plate-core").PlateStoreState<WysiwygContent, UxfEditor>>;
|
|
8
|
+
export declare const useUxfPlateStates: (id?: any) => import("@udecode/plate-core").UseRecord<import("@udecode/plate-core").PlateStoreState<WysiwygContent, UxfEditor>>;
|
|
9
|
+
export { useSelected } from "slate-react";
|
package/hooks.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelected = exports.useUxfPlateStates = exports.useUxfPlateActions = exports.useUxfPlateSelectors = exports.useUxfPlateEditorState = exports.useUxfEditorState = exports.useUxfEditorRef = exports.useUxfPlateEditorRef = void 0;
|
|
4
|
+
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
+
const useUxfPlateEditorRef = (id) => (0, plate_core_1.usePlateEditorRef)(id);
|
|
6
|
+
exports.useUxfPlateEditorRef = useUxfPlateEditorRef;
|
|
7
|
+
const useUxfEditorRef = () => (0, plate_core_1.useEditorRef)();
|
|
8
|
+
exports.useUxfEditorRef = useUxfEditorRef;
|
|
9
|
+
const useUxfEditorState = () => (0, plate_core_1.useEditorState)();
|
|
10
|
+
exports.useUxfEditorState = useUxfEditorState;
|
|
11
|
+
const useUxfPlateEditorState = (id) => (0, plate_core_1.usePlateEditorState)((0, plate_core_1.useEventPlateId)(id));
|
|
12
|
+
exports.useUxfPlateEditorState = useUxfPlateEditorState;
|
|
13
|
+
const useUxfPlateSelectors = (id) => (0, plate_core_1.usePlateSelectors)(id);
|
|
14
|
+
exports.useUxfPlateSelectors = useUxfPlateSelectors;
|
|
15
|
+
const useUxfPlateActions = (id) => (0, plate_core_1.usePlateActions)(id);
|
|
16
|
+
exports.useUxfPlateActions = useUxfPlateActions;
|
|
17
|
+
const useUxfPlateStates = (id) => (0, plate_core_1.usePlateStates)(id);
|
|
18
|
+
exports.useUxfPlateStates = useUxfPlateStates;
|
|
19
|
+
var slate_react_1 = require("slate-react");
|
|
20
|
+
Object.defineProperty(exports, "useSelected", { enumerable: true, get: function () { return slate_react_1.useSelected; } });
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaG9va3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaG9va3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsb0RBVTZCO0FBR3RCLE1BQU0sb0JBQW9CLEdBQUcsQ0FBQyxFQUFZLEVBQUUsRUFBRSxDQUFDLElBQUEsOEJBQWlCLEVBQTRCLEVBQUUsQ0FBQyxDQUFDO0FBQTFGLFFBQUEsb0JBQW9CLHdCQUFzRTtBQUNoRyxNQUFNLGVBQWUsR0FBRyxHQUFHLEVBQUUsQ0FBQyxJQUFBLHlCQUFZLEdBQTZCLENBQUM7QUFBbEUsUUFBQSxlQUFlLG1CQUFtRDtBQUN4RSxNQUFNLGlCQUFpQixHQUFHLEdBQUcsRUFBRSxDQUFDLElBQUEsMkJBQWMsR0FBNkIsQ0FBQztBQUF0RSxRQUFBLGlCQUFpQixxQkFBcUQ7QUFDNUUsTUFBTSxzQkFBc0IsR0FBRyxDQUFDLEVBQVksRUFBRSxFQUFFLENBQ25ELElBQUEsZ0NBQW1CLEVBQTRCLElBQUEsNEJBQWUsRUFBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO0FBRDNELFFBQUEsc0JBQXNCLDBCQUNxQztBQUNqRSxNQUFNLG9CQUFvQixHQUFHLENBQUMsRUFBWSxFQUFFLEVBQUUsQ0FBQyxJQUFBLDhCQUFpQixFQUE0QixFQUFFLENBQUMsQ0FBQztBQUExRixRQUFBLG9CQUFvQix3QkFBc0U7QUFDaEcsTUFBTSxrQkFBa0IsR0FBRyxDQUFDLEVBQVksRUFBRSxFQUFFLENBQUMsSUFBQSw0QkFBZSxFQUE0QixFQUFFLENBQUMsQ0FBQztBQUF0RixRQUFBLGtCQUFrQixzQkFBb0U7QUFDNUYsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLEVBQVksRUFBRSxFQUFFLENBQUMsSUFBQSwyQkFBYyxFQUE0QixFQUFFLENBQUMsQ0FBQztBQUFwRixRQUFBLGlCQUFpQixxQkFBbUU7QUFFakcsMkNBQTBDO0FBQWpDLDBHQUFBLFdBQVcsT0FBQSJ9
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export { WysiwygEditor } from "./
|
|
2
|
-
export { ContentRenderer } from "./Content";
|
|
3
|
-
export { convertToPlainText } from "./Converter";
|
|
4
|
-
export * from "./Content/Renderer/typeGuards";
|
|
1
|
+
export { WysiwygEditor } from "./WysiwygEditor";
|
|
5
2
|
export * from "./types";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
export * from "./hooks";
|
|
5
|
+
export { createAllUxfPlugins } from "./create-all-uxf-plugins";
|
package/index.js
CHANGED
|
@@ -14,19 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "WysiwygEditor", { enumerable: true, get: function () { return
|
|
20
|
-
var Content_1 = require("./Content");
|
|
21
|
-
Object.defineProperty(exports, "ContentRenderer", { enumerable: true, get: function () { return Content_1.ContentRenderer; } });
|
|
22
|
-
var Converter_1 = require("./Converter");
|
|
23
|
-
Object.defineProperty(exports, "convertToPlainText", { enumerable: true, get: function () { return Converter_1.convertToPlainText; } });
|
|
24
|
-
__exportStar(require("./Content/Renderer/typeGuards"), exports);
|
|
17
|
+
exports.createAllUxfPlugins = exports.WysiwygEditor = void 0;
|
|
18
|
+
var WysiwygEditor_1 = require("./WysiwygEditor");
|
|
19
|
+
Object.defineProperty(exports, "WysiwygEditor", { enumerable: true, get: function () { return WysiwygEditor_1.WysiwygEditor; } });
|
|
25
20
|
__exportStar(require("./types"), exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(exports, "ReactEditor", { enumerable: true, get: function () { return slate_react_2.ReactEditor; } });
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxtQ0FBeUM7QUFBaEMsdUdBQUEsYUFBYSxPQUFBO0FBQ3RCLHFDQUE0QztBQUFuQywwR0FBQSxlQUFlLE9BQUE7QUFDeEIseUNBQWlEO0FBQXhDLCtHQUFBLGtCQUFrQixPQUFBO0FBQzNCLGdFQUE4QztBQUM5QywwQ0FBd0I7QUFDeEIsMkNBQXVEO0FBQTlDLDJHQUFBLFFBQVEsT0FBZ0I7QUFDakMsMkNBQXVGO0FBQTlFLHlHQUFBLFVBQVUsT0FBQTtBQUFFLDBHQUFBLFdBQVcsT0FBQTtBQUFFLDBHQUFBLFdBQVcsT0FBQSJ9
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
|
22
|
+
__exportStar(require("./hooks"), exports);
|
|
23
|
+
var create_all_uxf_plugins_1 = require("./create-all-uxf-plugins");
|
|
24
|
+
Object.defineProperty(exports, "createAllUxfPlugins", { enumerable: true, get: function () { return create_all_uxf_plugins_1.createAllUxfPlugins; } });
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxpREFBZ0Q7QUFBdkMsOEdBQUEsYUFBYSxPQUFBO0FBQ3RCLDBDQUF3QjtBQUN4QiwwQ0FBd0I7QUFDeEIsMENBQXdCO0FBQ3hCLG1FQUErRDtBQUF0RCw2SEFBQSxtQkFBbUIsT0FBQSJ9
|
package/package.json
CHANGED
|
@@ -1,65 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/wysiwyg",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "UXF Wysiwyg editor",
|
|
5
5
|
"author": "Robin Dvorak <dvorak@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/wysiwyg",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"typings": "index.d.ts",
|
|
9
|
-
"module": "index.js",
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://gitlab.com/uxf-npm/wysiwyg.git"
|
|
16
|
-
},
|
|
17
8
|
"scripts": {
|
|
18
|
-
"build": "npm run-script clean &&
|
|
19
|
-
"clean": "rm -rf ./dist",
|
|
20
|
-
"compile": "tsc -P tsconfig.build.json",
|
|
21
|
-
"test": "npm run-script typecheck",
|
|
22
|
-
"lint": "eslint -c .eslintrc.js \"./**/*.ts*\"",
|
|
9
|
+
"build": "npm run-script clean && tsc -P tsconfig.build.json",
|
|
10
|
+
"clean": "rm -rf ./dist ./example/.cache ./example/dist",
|
|
23
11
|
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"url": "https://gitlab.com/uxf/uxf-base-npm/issues"
|
|
12
|
+
"lint": "eslint -c .eslintrc.js \"./**/*.ts*\"",
|
|
13
|
+
"check": "yarn typecheck && yarn lint",
|
|
14
|
+
"dev": "parcel ./example/index.html --dist-dir example/dist --cache-dir example/.cache --port 8081"
|
|
28
15
|
},
|
|
29
16
|
"devDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
33
|
-
"@types/is-url": "^1.2.30",
|
|
34
|
-
"@types/jest": "^27.0.1",
|
|
35
|
-
"@types/node": "^16.0.0",
|
|
36
|
-
"@types/react-dom": "^17.0.9",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
17
|
+
"@types/react": "^18.0.26",
|
|
18
|
+
"@types/react-dom": "^18.0.10",
|
|
38
19
|
"@uxf/eslint-config": "^1.2.3",
|
|
39
|
-
"
|
|
40
|
-
"eslint
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"parcel": "^2.4.0",
|
|
45
|
-
"prettier": "^2.3.2",
|
|
20
|
+
"autoprefixer": "^10.4.13",
|
|
21
|
+
"eslint": "^8.31.0",
|
|
22
|
+
"parcel": "^2.8.3",
|
|
23
|
+
"postcss": "^8.4.21",
|
|
24
|
+
"prettier": "^2.8.2",
|
|
46
25
|
"process": "^0.11.10",
|
|
47
|
-
"react": "^
|
|
48
|
-
"react-dom": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"typescript": "^4.8.4"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"is-url": "^1.2.4",
|
|
55
|
-
"react-player": "^2.9.0",
|
|
56
|
-
"slate": "^0.82.1",
|
|
57
|
-
"slate-history": "^0.66.0",
|
|
58
|
-
"slate-hyperscript": "^0.77.0",
|
|
59
|
-
"slate-react": "^0.83.1"
|
|
26
|
+
"react": "^18.2.0",
|
|
27
|
+
"react-dom": "^18.2.0",
|
|
28
|
+
"tailwindcss": "^3.2.4",
|
|
29
|
+
"typescript": "^4.9.4"
|
|
60
30
|
},
|
|
61
31
|
"peerDependencies": {
|
|
62
32
|
"react": "17 - 18",
|
|
63
33
|
"react-dom": "17 - 18"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@headlessui/react": "^1.7.7",
|
|
37
|
+
"@udecode/plate-basic-marks": "^19.0.3",
|
|
38
|
+
"@udecode/plate-block-quote": "^19.0.3",
|
|
39
|
+
"@udecode/plate-break": "^19.0.3",
|
|
40
|
+
"@udecode/plate-code-block": "^19.0.3",
|
|
41
|
+
"@udecode/plate-core": "^19.0.3",
|
|
42
|
+
"@udecode/plate-link": "^19.0.3",
|
|
43
|
+
"@udecode/plate-list": "^19.4.2",
|
|
44
|
+
"@udecode/plate-media": "^19.2.0",
|
|
45
|
+
"@udecode/plate-node-id": "^19.0.3",
|
|
46
|
+
"@udecode/plate-paragraph": "^19.0.3",
|
|
47
|
+
"@udecode/plate-reset-node": "^19.4.2",
|
|
48
|
+
"@udecode/plate-select": "^19.2.0",
|
|
49
|
+
"@udecode/plate-trailing-block": "^19.2.0",
|
|
50
|
+
"react-dnd": "^16.0.1",
|
|
51
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
52
|
+
"slate": "^0.88.1",
|
|
53
|
+
"slate-history": "^0.86.0",
|
|
54
|
+
"slate-hyperscript": "^0.77.0",
|
|
55
|
+
"slate-react": "^0.88.0"
|
|
64
56
|
}
|
|
65
57
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBlockquotePlugin = void 0;
|
|
4
|
+
const plate_block_quote_1 = require("@udecode/plate-block-quote");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const createBlockquotePlugin = () => (0, plate_block_quote_1.createBlockquotePlugin)({
|
|
7
|
+
props: {
|
|
8
|
+
className: "block-quote-class-name",
|
|
9
|
+
},
|
|
10
|
+
type: types_1.BLOCK_QUOTE_PLUGIN_TYPE,
|
|
11
|
+
});
|
|
12
|
+
exports.createBlockquotePlugin = createBlockquotePlugin;
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWJsb2NrLXF1b3RlLXBsdWdpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wbHVnaW5zL2Jsb2NrLXF1b3RlL2NyZWF0ZS1ibG9jay1xdW90ZS1wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsa0VBQW1HO0FBR25HLG1DQUFrRDtBQUUzQyxNQUFNLHNCQUFzQixHQUFHLEdBQUcsRUFBRSxDQUN2QyxJQUFBLDBDQUEyQixFQUEwQztJQUNqRSxLQUFLLEVBQUU7UUFDSCxTQUFTLEVBQUUsd0JBQXdCO0tBQ3RDO0lBQ0QsSUFBSSxFQUFFLCtCQUF1QjtDQUNoQyxDQUFDLENBQUM7QUFOTSxRQUFBLHNCQUFzQiwwQkFNNUIifQ==
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BLOCK_QUOTE_PLUGIN_TYPE = exports.BLOCK_QUOTE_PLUGIN_KEY = void 0;
|
|
4
|
+
const plate_block_quote_1 = require("@udecode/plate-block-quote");
|
|
5
|
+
exports.BLOCK_QUOTE_PLUGIN_KEY = plate_block_quote_1.ELEMENT_BLOCKQUOTE;
|
|
6
|
+
exports.BLOCK_QUOTE_PLUGIN_TYPE = "block-quote";
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcGx1Z2lucy9ibG9jay1xdW90ZS90eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxrRUFBZ0U7QUFFbkQsUUFBQSxzQkFBc0IsR0FBRyxzQ0FBa0IsQ0FBQztBQUM1QyxRQUFBLHVCQUF1QixHQUFHLGFBQWEsQ0FBQyJ9
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MyOverrideByKey, UiComponents, UxfEditor, UxfPlatePlugin, WysiwygContent } from "../types";
|
|
2
|
+
export declare const createUxfPlugins: (plugins: UxfPlatePlugin[], options?: {
|
|
3
|
+
components?: UiComponents;
|
|
4
|
+
overrideByKey?: MyOverrideByKey;
|
|
5
|
+
}) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").AnyObject, WysiwygContent, UxfEditor>[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createUxfPlugins = void 0;
|
|
4
|
+
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
+
const create_exit_break_plugin_1 = require("./exit-break/create-exit-break-plugin");
|
|
6
|
+
const create_node_id_plugin_1 = require("./node-id/create-node-id-plugin");
|
|
7
|
+
const create_paragraph_plugin_1 = require("./paragraph/create-paragraph-plugin");
|
|
8
|
+
const create_reset_node_1 = require("./reset-node/create-reset-node");
|
|
9
|
+
const create_select_on_backspace_plugin_1 = require("./select-on-backspace/create-select-on-backspace-plugin");
|
|
10
|
+
const create_soft_break_plugin_1 = require("./soft-break/create-soft-break-plugin");
|
|
11
|
+
const create_trailing_block_plugin_1 = require("./trailing-block/create-trailing-block-plugin");
|
|
12
|
+
const createUxfPlugins = (plugins, options) => (0, plate_core_1.createPlugins)([
|
|
13
|
+
(0, create_paragraph_plugin_1.createParagraphPlugin)(),
|
|
14
|
+
(0, create_exit_break_plugin_1.createExitBreakPlugin)(),
|
|
15
|
+
(0, create_reset_node_1.createResetNodePlugin)(),
|
|
16
|
+
(0, create_soft_break_plugin_1.createSoftBreakPlugin)(),
|
|
17
|
+
(0, create_node_id_plugin_1.createNodeIdPlugin)(),
|
|
18
|
+
(0, create_select_on_backspace_plugin_1.createSelectOnBackspacePlugin)(),
|
|
19
|
+
(0, create_trailing_block_plugin_1.createTrailingBlockPlugin)(),
|
|
20
|
+
...plugins,
|
|
21
|
+
], options);
|
|
22
|
+
exports.createUxfPlugins = createUxfPlugins;
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLXV4Zi1wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3BsdWdpbnMvY3JlYXRlLXV4Zi1wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLG9EQUFvRDtBQUVwRCxvRkFBOEU7QUFDOUUsMkVBQXFFO0FBQ3JFLGlGQUE0RTtBQUM1RSxzRUFBdUU7QUFDdkUsK0dBQXdHO0FBQ3hHLG9GQUE4RTtBQUM5RSxnR0FBMEY7QUFFbkYsTUFBTSxnQkFBZ0IsR0FBRyxDQUM1QixPQUF5QixFQUN6QixPQUdDLEVBQ0gsRUFBRSxDQUNBLElBQUEsMEJBQWEsRUFDVDtJQUNJLElBQUEsK0NBQXFCLEdBQUU7SUFDdkIsSUFBQSxnREFBcUIsR0FBRTtJQUN2QixJQUFBLHlDQUFxQixHQUFFO0lBQ3ZCLElBQUEsZ0RBQXFCLEdBQUU7SUFDdkIsSUFBQSwwQ0FBa0IsR0FBRTtJQUNwQixJQUFBLGlFQUE2QixHQUFFO0lBQy9CLElBQUEsd0RBQXlCLEdBQUU7SUFDM0IsR0FBRyxPQUFPO0NBQ2IsRUFDRCxPQUFPLENBQ1YsQ0FBQztBQW5CTyxRQUFBLGdCQUFnQixvQkFtQnZCIn0=
|
|
@@ -0,0 +1,31 @@
|
|
|
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("../block-quote/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.BLOCK_QUOTE_PLUGIN_KEY],
|
|
23
|
+
},
|
|
24
|
+
relative: true,
|
|
25
|
+
level: 1,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
exports.createExitBreakPlugin = createExitBreakPlugin;
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWV4aXQtYnJlYWstcGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3BsdWdpbnMvZXhpdC1icmVhay9jcmVhdGUtZXhpdC1icmVhay1wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQTRHO0FBRTVHLGdEQUE4RDtBQUM5RCxvREFBb0Q7QUFFN0MsTUFBTSxxQkFBcUIsR0FBRyxHQUFHLEVBQUUsQ0FDdEMsSUFBQSxtQ0FBMEIsRUFBNkM7SUFDbkUsT0FBTyxFQUFFO1FBQ0wsS0FBSyxFQUFFO1lBQ0g7Z0JBQ0ksTUFBTSxFQUFFLFdBQVc7YUFDdEI7WUFDRDtnQkFDSSxNQUFNLEVBQUUsaUJBQWlCO2dCQUN6QixNQUFNLEVBQUUsSUFBSTthQUNmO1lBQ0Q7Z0JBQ0ksTUFBTSxFQUFFLE9BQU87Z0JBQ2YsS0FBSyxFQUFFO29CQUNILEtBQUssRUFBRSxJQUFJO29CQUNYLEdBQUcsRUFBRSxJQUFJO29CQUNULEtBQUssRUFBRSxDQUFDLEdBQUcsd0JBQVksRUFBRSw4QkFBc0IsQ0FBQztpQkFDbkQ7Z0JBQ0QsUUFBUSxFQUFFLElBQUk7Z0JBQ2QsS0FBSyxFQUFFLENBQUM7YUFDWDtTQUNKO0tBQ0o7Q0FDSixDQUFDLENBQUM7QUF2Qk0sUUFBQSxxQkFBcUIseUJBdUIzQiJ9
|
|
@@ -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,12 @@
|
|
|
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";
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3BsdWdpbnMvaGVhZGluZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxVQUFVLEdBQUcsSUFBSSxDQUFDO0FBQ2xCLFFBQUEsVUFBVSxHQUFHLElBQUksQ0FBQztBQUNsQixRQUFBLFVBQVUsR0FBRyxJQUFJLENBQUM7QUFDbEIsUUFBQSxVQUFVLEdBQUcsSUFBSSxDQUFDO0FBQ2xCLFFBQUEsVUFBVSxHQUFHLElBQUksQ0FBQztBQUNsQixRQUFBLFVBQVUsR0FBRyxJQUFJLENBQUM7QUFFbEIsUUFBQSxZQUFZLEdBQUcsQ0FBQyxrQkFBVSxFQUFFLGtCQUFVLEVBQUUsa0JBQVUsRUFBRSxrQkFBVSxFQUFFLGtCQUFVLEVBQUUsa0JBQVUsQ0FBQyxDQUFDO0FBQ3hGLFFBQUEsbUJBQW1CLEdBQUcsU0FBUyxDQUFDIn0=
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HotkeyPlugin } from "@udecode/plate-core";
|
|
2
|
+
import { WysiwygContent } from "../../types";
|
|
3
|
+
export type HeadingPlugin = HotkeyPlugin;
|
|
4
|
+
export interface HeadingsPluginOptions {
|
|
5
|
+
disabledLevels?: Array<1 | 2 | 3 | 4 | 5 | 6>;
|
|
6
|
+
}
|
|
7
|
+
export declare const createHeadingsPlugin: <OP = HeadingsPluginOptions, OV extends import("@udecode/plate-core").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,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHeadingsPlugin = void 0;
|
|
4
|
+
const plate_core_1 = require("@udecode/plate-core");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
exports.createHeadingsPlugin = (0, plate_core_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_core_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
|
+
});
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWhlYWRpbmdzLXBsdWdpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wbHVnaW5zL2hlYWRpbmcvY3JlYXRlLWhlYWRpbmdzLXBsdWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxvREFBZ0c7QUFFaEcsMkNBQWdFO0FBT25ELFFBQUEsb0JBQW9CLEdBQUcsSUFBQSxnQ0FBbUIsRUFBbUQ7SUFDdEcsR0FBRyxFQUFFLCtCQUFtQjtJQUN4QixJQUFJLEVBQUUsQ0FBQyxPQUFPLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxjQUFjLEVBQUUsR0FBRyxFQUFFLEVBQUUsRUFBRSxFQUFFOztRQUNwRCxNQUFNLE9BQU8sR0FBb0MsRUFBRSxDQUFDO1FBRXBELEtBQUssSUFBSSxLQUFLLEdBQUcsQ0FBQyxFQUFFLEtBQUssSUFBSSxDQUFDLEVBQUUsS0FBSyxFQUFFLEVBQUU7WUFDckMsSUFBSSxjQUFjLGFBQWQsY0FBYyx1QkFBZCxjQUFjLENBQUUsSUFBSSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEtBQUssS0FBSyxDQUFDLEVBQUU7Z0JBQzFDLFNBQVM7YUFDWjtZQUVELE1BQU0sR0FBRyxHQUFHLHdCQUFZLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQyxDQUFDO1lBRXBDLE1BQU0sTUFBTSxHQUFrQztnQkFDMUMsR0FBRztnQkFDSCxTQUFTLEVBQUUsSUFBSTtnQkFDZixlQUFlLEVBQUU7b0JBQ2IsS0FBSyxFQUFFO3dCQUNIOzRCQUNJLGFBQWEsRUFBRSxJQUFJLEtBQUssRUFBRTt5QkFDN0I7cUJBQ0o7aUJBQ0o7Z0JBQ0QsUUFBUSxFQUFFO29CQUNOLFNBQVMsRUFBRSxtQ0FBc0I7aUJBQ3BDO2dCQUNELE9BQU8sRUFBRSxFQUFFO2FBQ2QsQ0FBQztZQUVGLElBQUksS0FBSyxHQUFHLENBQUMsS0FBSSxNQUFBLE1BQU0sQ0FBQyxPQUFPLDBDQUFFLE1BQU0sQ0FBQSxFQUFFO2dCQUNyQyxNQUFNLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLFdBQVcsS0FBSyxFQUFFLEVBQUUsYUFBYSxLQUFLLEVBQUUsQ0FBQyxDQUFDO2FBQ3RFO1lBRUQsT0FBTyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztTQUN4QjtRQUVELE9BQU87WUFDSCxPQUFPO1NBQ1YsQ0FBQztJQUNOLENBQUM7Q0FDSixDQUFDLENBQUMifQ==
|
|
@@ -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/plate-core").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,106 @@
|
|
|
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
|
+
});
|
|
106
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWltYWdlLXBsdWdpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wbHVnaW5zL2ltYWdlL2NyZWF0ZS1pbWFnZS1wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsb0RBQTBEO0FBRTFELDREQUF3RDtBQUN4RCxtQ0FBcUY7QUFDckYsNkNBQXlDO0FBRXpDOztHQUVHO0FBQ1UsUUFBQSxpQkFBaUIsR0FBRyxJQUFBLGdDQUFtQixFQUFtRDtJQUNuRyxHQUFHLEVBQUUsd0JBQWdCO0lBQ3JCLElBQUksRUFBRSx5QkFBaUI7SUFDdkIsU0FBUyxFQUFFLElBQUk7SUFDZixNQUFNLEVBQUUsSUFBSTtJQUNaLGFBQWEsRUFBRSxzQkFBUztJQUN4QixJQUFJLEVBQUUsQ0FBQyxNQUFNLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQztRQUM1QixlQUFlLEVBQUU7WUFDYixLQUFLLEVBQUU7Z0JBQ0g7b0JBQ0ksYUFBYSxFQUFFLEtBQUs7aUJBQ3ZCO2FBQ0o7WUFDRCxzQkFBc0I7WUFDdEIsWUFBWTtZQUNaLG1DQUFtQztZQUNuQyxNQUFNO1lBQ04sT0FBTyxFQUFFLENBQUMsRUFBRSxFQUFFLEVBQUU7O2dCQUNaLE1BQU0sR0FBRyxHQUFHLE1BQUEsRUFBRSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsbUNBQUksRUFBRSxDQUFDO2dCQUN6QyxJQUFJLEdBQUcsRUFBRTtvQkFDTCxNQUFNLE9BQU8sR0FBRyxJQUFJLGNBQWMsRUFBRSxDQUFDO29CQUNyQyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxHQUFHLEVBQUUsSUFBSSxDQUFDLENBQUM7b0JBQy9CLE9BQU8sQ0FBQyxZQUFZLEdBQUcsTUFBTSxDQUFDO29CQUM5QixPQUFPLENBQUMsTUFBTSxHQUFHLEdBQUcsRUFBRTt3QkFDbEIsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQzt3QkFDOUIsTUFBTSxJQUFJLEdBQUcsSUFBSSxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsRUFBRSxvQkFBb0IsRUFBRTs0QkFDaEQsSUFBSSxFQUFFLElBQUksQ0FBQyxJQUFJO3lCQUNsQixDQUFDLENBQUM7d0JBQ0gsSUFBSSxDQUFDLE9BQU8sQ0FBQyxXQUFXLEVBQUU7NEJBQ3RCLHNDQUFzQzs0QkFDdEMsT0FBTyxDQUFDLEtBQUssQ0FBQyx1REFBdUQsQ0FBQyxDQUFDOzRCQUN2RSxPQUFPO3lCQUNWO3dCQUVELE9BQU8sQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUU7NEJBQ3hDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFO2dDQUN0QixzQ0FBc0M7Z0NBQ3RDLE9BQU8sQ0FBQyxLQUFLLENBQUMsdURBQXVELENBQUMsQ0FBQztnQ0FDdkUsT0FBTzs2QkFDVjs0QkFFRCwwREFBMEQ7NEJBQzFELElBQUEsMEJBQVcsRUFDUCxNQUFNLEVBQ04sUUFBUSxFQUNSLFNBQVMsRUFDVCxTQUFTLEVBQ1QsU0FBUyxFQUNULE9BQU8sQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQ2hDLENBQUM7d0JBQ04sQ0FBQyxDQUFDLENBQUM7b0JBQ1AsQ0FBQyxDQUFDO29CQUNGLHNDQUFzQztvQkFDdEMsT0FBTyxDQUFDLE9BQU8sR0FBRyxHQUFHLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLHdCQUF3QixDQUFDLENBQUM7b0JBQ2hFLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQztvQkFFZixRQUFRO29CQUNSLCtDQUErQztvQkFDL0Msd0JBQXdCO29CQUN4QixxQkFBcUI7b0JBQ3JCLGtEQUFrRDtvQkFDbEQsYUFBYTtvQkFDYixVQUFVO29CQUNWLCtDQUErQztvQkFDL0MsNERBQTREO29CQUM1RCwyQkFBMkI7b0JBQzNCLFVBQVU7b0JBQ1Ysa0NBQWtDO29CQUNsQyxpREFBaUQ7b0JBQ2pELGdGQUFnRjtvQkFDaEYsa0JBQWtCO29CQUNsQixRQUFRO29CQUNSLEVBQUU7b0JBQ0YsNERBQTREO29CQUM1RCxFQUFFO29CQUNGLGtDQUFrQztvQkFDbEMsaURBQWlEO29CQUNqRCxnRkFBZ0Y7b0JBQ2hGLGtCQUFrQjtvQkFDbEIsUUFBUTtvQkFDUixpRUFBaUU7b0JBQ2pFLG1CQUFtQjtvQkFDbkIsa0JBQWtCO29CQUNsQix3QkFBd0I7b0JBQ3hCLHFCQUFxQjtvQkFDckIscUJBQXFCO29CQUNyQixxQkFBcUI7b0JBQ3JCLDZDQUE2QztvQkFDN0MsU0FBUztvQkFDVCxFQUFFO29CQUNGLGVBQWU7b0JBQ2YsZ0JBQWdCO29CQUNoQiw4QkFBOEI7b0JBQzlCLGtEQUFrRDtvQkFDbEQsU0FBUztvQkFDVCxnQkFBZ0I7b0JBQ2hCLDZDQUE2QztvQkFDN0MsNkNBQTZDO29CQUM3QyxJQUFJO2lCQUNQO1lBQ0wsQ0FBQztTQUNKO0tBQ0osQ0FBQztDQUNMLENBQUMsQ0FBQyJ9
|