@elliemae/ds-wysiwygeditor 2.2.0-alpha.2 → 2.2.0-beta.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/cjs/DSWYSIWYGEditor.js +72 -83
- package/cjs/components/CustomImageUploader.js +94 -92
- package/cjs/components/CustomToolbar.js +193 -172
- package/cjs/components/DSWYSIWYGEditorImpl.js +185 -147
- package/cjs/components/ImageLibraryModal.js +55 -75
- package/cjs/components/InsertFieldModal.js +142 -109
- package/cjs/components/TippedButton.js +54 -56
- package/cjs/components/TippedSelect.js +39 -50
- package/cjs/components/colors.js +21 -41
- package/cjs/components/customFields.js +47 -66
- package/cjs/constants.js +38 -112
- package/cjs/index.js +21 -39
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +22 -37
- package/cjs/quillOverrides/IndentStyle.js +19 -41
- package/cjs/quillOverrides/LinkFormat.js +39 -57
- package/cjs/quillOverrides/PlainClipboard.js +21 -41
- package/cjs/utils.js +18 -41
- package/esm/DSWYSIWYGEditor.js +58 -50
- package/esm/components/CustomImageUploader.js +81 -60
- package/esm/components/CustomToolbar.js +184 -145
- package/esm/components/DSWYSIWYGEditorImpl.js +169 -113
- package/esm/components/ImageLibraryModal.js +47 -46
- package/esm/components/InsertFieldModal.js +124 -72
- package/esm/components/TippedButton.js +44 -27
- package/esm/components/TippedSelect.js +31 -21
- package/esm/components/colors.js +17 -12
- package/esm/components/customFields.js +40 -38
- package/esm/constants.js +30 -83
- package/esm/index.js +4 -10
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +18 -8
- package/esm/quillOverrides/IndentStyle.js +17 -12
- package/esm/quillOverrides/LinkFormat.js +37 -28
- package/esm/quillOverrides/PlainClipboard.js +19 -12
- package/esm/utils.js +14 -12
- package/package.json +9 -9
- package/types/DSWYSIWYGEditor.d.ts +1 -12
- package/cjs/DSWYSIWYGEditor.js.map +0 -7
- package/cjs/components/CustomImageUploader.js.map +0 -7
- package/cjs/components/CustomToolbar.js.map +0 -7
- package/cjs/components/DSWYSIWYGEditorImpl.js.map +0 -7
- package/cjs/components/ImageLibraryModal.js.map +0 -7
- package/cjs/components/InsertFieldModal.js.map +0 -7
- package/cjs/components/TippedButton.js.map +0 -7
- package/cjs/components/TippedSelect.js.map +0 -7
- package/cjs/components/colors.js.map +0 -7
- package/cjs/components/customFields.js.map +0 -7
- package/cjs/constants.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +0 -7
- package/cjs/quillOverrides/IndentStyle.js.map +0 -7
- package/cjs/quillOverrides/LinkFormat.js.map +0 -7
- package/cjs/quillOverrides/PlainClipboard.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/DSWYSIWYGEditor.js.map +0 -7
- package/esm/components/CustomImageUploader.js.map +0 -7
- package/esm/components/CustomToolbar.js.map +0 -7
- package/esm/components/DSWYSIWYGEditorImpl.js.map +0 -7
- package/esm/components/ImageLibraryModal.js.map +0 -7
- package/esm/components/InsertFieldModal.js.map +0 -7
- package/esm/components/TippedButton.js.map +0 -7
- package/esm/components/TippedSelect.js.map +0 -7
- package/esm/components/colors.js.map +0 -7
- package/esm/components/customFields.js.map +0 -7
- package/esm/constants.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js.map +0 -7
- package/esm/quillOverrides/IndentStyle.js.map +0 -7
- package/esm/quillOverrides/LinkFormat.js.map +0 -7
- package/esm/quillOverrides/PlainClipboard.js.map +0 -7
- package/esm/utils.js.map +0 -7
|
@@ -1,47 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var PlainClipboard_exports = {};
|
|
29
|
-
__export(PlainClipboard_exports, {
|
|
30
|
-
default: () => PlainClipboard
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react_quill = __toESM(require("react-quill"));
|
|
34
|
-
const Clipboard = import_react_quill.Quill.import("modules/clipboard");
|
|
35
|
-
const Delta = import_react_quill.Quill.import("delta");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ReactQuill = require('react-quill');
|
|
4
|
+
|
|
5
|
+
const Clipboard = ReactQuill.Quill.import('modules/clipboard');
|
|
6
|
+
const Delta = ReactQuill.Quill.import('delta');
|
|
7
|
+
/**
|
|
8
|
+
* Just for the sake of an example. https://quilljs.com/docs/modules/
|
|
9
|
+
*/
|
|
10
|
+
|
|
36
11
|
class PlainClipboard extends Clipboard {
|
|
37
|
-
convert(
|
|
38
|
-
|
|
12
|
+
convert() {
|
|
13
|
+
let html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
14
|
+
|
|
15
|
+
if (typeof html === 'string') {
|
|
39
16
|
this.container.innerHTML = html;
|
|
40
17
|
}
|
|
18
|
+
|
|
41
19
|
const text = this.container.innerText;
|
|
42
|
-
this.container.innerHTML =
|
|
20
|
+
this.container.innerHTML = '';
|
|
43
21
|
return new Delta().insert(text);
|
|
44
22
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
|
|
24
|
+
} // Uncomment if adding custom clipboard, or add in the file you are importing this to
|
|
25
|
+
// Quill.register('modules/clipboard', PlainClipboard)
|
|
26
|
+
|
|
27
|
+
module.exports = PlainClipboard;
|
package/cjs/utils.js
CHANGED
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
formatHTML: () => formatHTML
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
const formatHTML = (html) => {
|
|
34
|
-
const tab = " ";
|
|
35
|
-
let result = "";
|
|
36
|
-
let indent = "";
|
|
37
|
-
html.split(/>\s*</).forEach((element) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
|
|
9
|
+
const formatHTML = html => {
|
|
10
|
+
const tab = '\t';
|
|
11
|
+
let result = '';
|
|
12
|
+
let indent = '';
|
|
13
|
+
html.split(/>\s*</).forEach(element => {
|
|
38
14
|
if (element.match(/^\/\w/)) {
|
|
39
15
|
indent = indent.substring(tab.length);
|
|
40
16
|
}
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
|
|
18
|
+
result += "".concat(indent, "<").concat(element, ">\r\n");
|
|
19
|
+
|
|
43
20
|
if (element.match(/^<?\w[^>]*[^/]$/)) {
|
|
44
21
|
indent += tab;
|
|
45
22
|
}
|
|
46
23
|
});
|
|
47
24
|
return result.substring(1, result.length - 3);
|
|
48
25
|
};
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
|
|
27
|
+
exports.formatHTML = formatHTML;
|
package/esm/DSWYSIWYGEditor.js
CHANGED
|
@@ -1,64 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
+
import { useState, useEffect } from 'react';
|
|
10
|
+
import { PropTypes, describe } from 'react-desc';
|
|
11
|
+
import DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
const _excluded = ["value", "onChange", "getQuillRef", "quillModules", "customToolbar", "toolbarHandlers", "showRawHTML", "height", "hideItems"];
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
const DSWYSIWYGEditor = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
value = '',
|
|
23
|
+
onChange = () => null,
|
|
24
|
+
getQuillRef = () => null,
|
|
25
|
+
quillModules = {},
|
|
26
|
+
customToolbar,
|
|
27
|
+
toolbarHandlers,
|
|
28
|
+
showRawHTML = false,
|
|
29
|
+
height,
|
|
30
|
+
hideItems
|
|
31
|
+
} = _ref,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
|
|
34
|
+
const emptyAction = () => {};
|
|
35
|
+
|
|
19
36
|
const [showHTML, setShowHTML] = useState(showRawHTML);
|
|
20
37
|
useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);
|
|
21
|
-
return
|
|
38
|
+
return /*#__PURE__*/jsx(DSWYSIWYGEditorImpl, _objectSpread({
|
|
22
39
|
forceHttpLink: true,
|
|
23
40
|
handleCustomFieldClick: emptyAction,
|
|
24
41
|
handleImageClick: emptyAction,
|
|
25
42
|
quillOverrides: [],
|
|
26
|
-
value,
|
|
27
|
-
onChange,
|
|
28
|
-
getQuillRef,
|
|
29
|
-
quillModules,
|
|
30
|
-
customToolbar,
|
|
31
|
-
toolbarHandlers,
|
|
43
|
+
value: value,
|
|
44
|
+
onChange: onChange,
|
|
45
|
+
getQuillRef: getQuillRef,
|
|
46
|
+
quillModules: quillModules,
|
|
47
|
+
customToolbar: customToolbar,
|
|
48
|
+
toolbarHandlers: toolbarHandlers,
|
|
32
49
|
showRawHTML: showHTML,
|
|
33
50
|
onShowHTML: () => setShowHTML(!showHTML),
|
|
34
|
-
height,
|
|
35
|
-
hideItems
|
|
36
|
-
|
|
37
|
-
});
|
|
51
|
+
height: height,
|
|
52
|
+
hideItems: hideItems
|
|
53
|
+
}, rest));
|
|
38
54
|
};
|
|
55
|
+
|
|
39
56
|
const wysiwygEditorProps = {
|
|
40
|
-
value: PropTypes.string.description(
|
|
41
|
-
onChange: PropTypes.func.description(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
customToolbar: PropTypes.element.description("custom toolbar"),
|
|
49
|
-
toolbarHandlers: PropTypes.object.description("object with toolbar handlers"),
|
|
50
|
-
showRawHTML: PropTypes.bool.description("whether to display html view or not").defaultValue(false),
|
|
51
|
-
height: PropTypes.string.description("heigth of the editors text area"),
|
|
57
|
+
value: PropTypes.string.description('editors value').isRequired,
|
|
58
|
+
onChange: PropTypes.func.description("(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props").isRequired,
|
|
59
|
+
getQuillRef: PropTypes.func.description('function to use quill.js ref'),
|
|
60
|
+
quillModules: PropTypes.object.description('object to override quill modules'),
|
|
61
|
+
customToolbar: PropTypes.element.description('custom toolbar'),
|
|
62
|
+
toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),
|
|
63
|
+
showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),
|
|
64
|
+
height: PropTypes.string.description('heigth of the editors text area'),
|
|
52
65
|
readOnly: PropTypes.string.description("If true, the editor won't allow changing its contents. Wraps the Quill disable API."),
|
|
53
|
-
hideItems: PropTypes.object.description(
|
|
54
|
-
zIndex: PropTypes.number.description(
|
|
66
|
+
hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),
|
|
67
|
+
zIndex: PropTypes.number.description('zIndex to be used (required when used in a modal for correct tooltips displaying)')
|
|
55
68
|
};
|
|
56
|
-
DSWYSIWYGEditor.propTypes = wysiwygEditorProps;
|
|
57
69
|
const WYSIWYWithSchema = describe(DSWYSIWYGEditor);
|
|
58
70
|
WYSIWYWithSchema.propTypes = wysiwygEditorProps;
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
WYSIWYWithSchema,
|
|
62
|
-
DSWYSIWYGEditor_default as default
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=DSWYSIWYGEditor.js.map
|
|
71
|
+
|
|
72
|
+
export { WYSIWYWithSchema, DSWYSIWYGEditor as default };
|
|
@@ -1,40 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Image } from '@elliemae/ds-icons';
|
|
5
|
+
import DSUploader from '@elliemae/ds-uploader';
|
|
6
|
+
import DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';
|
|
7
|
+
import { TippedButton } from './TippedButton.js';
|
|
8
|
+
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
const ALLOWED_TYPES_TEXT = 'JPG, JPEG, PNG, GIF, BMP, TIFF';
|
|
8
11
|
const ALLOWED_TYPES = /image\/(jpeg|jpg|png|gif|bmp|tiff)/;
|
|
9
|
-
const DEFAULT_MAX_SIZE = 1024 * 1024;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const DEFAULT_MAX_SIZE = 1024 * 1024; // 1 MB
|
|
13
|
+
|
|
14
|
+
const CustomImageUploader = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
quillRef,
|
|
17
|
+
editorFieldName,
|
|
18
|
+
allowedImageTypes = ALLOWED_TYPES_TEXT,
|
|
19
|
+
uploadAsset = () => null,
|
|
20
|
+
zIndex = 1
|
|
21
|
+
} = _ref;
|
|
17
22
|
const [isOpen, setIsOpen] = useState(false);
|
|
18
23
|
const [error, setError] = useState(null);
|
|
19
24
|
const [inProgress, setInProgress] = useState(false);
|
|
20
|
-
const [lastSelection, setLastSelection] = useState({
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
const [lastSelection, setLastSelection] = useState({
|
|
26
|
+
index: 0,
|
|
27
|
+
length: 0
|
|
28
|
+
});
|
|
29
|
+
const elementId = "uploadImage".concat(editorFieldName); // eslint-disable-next-line consistent-return
|
|
30
|
+
|
|
31
|
+
const handleFileChange = async files => {
|
|
23
32
|
if (!inProgress) {
|
|
24
33
|
setError(null);
|
|
25
34
|
const selectedFile = files[0];
|
|
35
|
+
|
|
26
36
|
if (!selectedFile) {
|
|
27
|
-
setError(
|
|
37
|
+
setError('Please select a file.');
|
|
28
38
|
return false;
|
|
29
39
|
}
|
|
40
|
+
|
|
30
41
|
if (!selectedFile.type.match(ALLOWED_TYPES)) {
|
|
31
|
-
setError(
|
|
42
|
+
setError('File must be an image.');
|
|
32
43
|
} else if (selectedFile.size > DEFAULT_MAX_SIZE) {
|
|
33
|
-
setError(
|
|
44
|
+
setError('File is too large.');
|
|
34
45
|
} else {
|
|
35
46
|
const fr = new FileReader();
|
|
47
|
+
|
|
36
48
|
fr.onload = async () => {
|
|
37
49
|
setInProgress(true);
|
|
50
|
+
|
|
38
51
|
try {
|
|
39
52
|
const url = await uploadAsset({
|
|
40
53
|
name: selectedFile.name,
|
|
@@ -44,51 +57,59 @@ const CustomImageUploader = ({
|
|
|
44
57
|
file: fr.result
|
|
45
58
|
});
|
|
46
59
|
setIsOpen(false);
|
|
47
|
-
quillRef
|
|
60
|
+
quillRef === null || quillRef === void 0 ? void 0 : quillRef.getEditor().insertEmbed((lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.index) || 0, 'image', url);
|
|
48
61
|
} catch (e) {
|
|
49
|
-
setError(
|
|
62
|
+
setError('An error has occurred, try again');
|
|
50
63
|
}
|
|
64
|
+
|
|
51
65
|
setInProgress(false);
|
|
52
66
|
};
|
|
67
|
+
|
|
53
68
|
fr.readAsArrayBuffer(selectedFile);
|
|
54
69
|
}
|
|
55
70
|
}
|
|
56
71
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
74
|
+
children: [/*#__PURE__*/_jsx(TippedButton, {
|
|
75
|
+
zIndex: zIndex,
|
|
76
|
+
tip: "Insert Image",
|
|
77
|
+
onClick: () => {
|
|
78
|
+
setLastSelection(quillRef === null || quillRef === void 0 ? void 0 : quillRef.getEditor().getSelection());
|
|
79
|
+
setIsOpen(true);
|
|
80
|
+
}
|
|
81
|
+
}, void 0, /*#__PURE__*/_jsx(Image, {
|
|
82
|
+
color: ['neutral', 500],
|
|
83
|
+
size: "s"
|
|
84
|
+
})), /*#__PURE__*/_jsx(DSModal, {
|
|
85
|
+
isOpen: isOpen,
|
|
86
|
+
title: "",
|
|
87
|
+
onConfirm: () => {
|
|
88
|
+
setIsOpen(false);
|
|
89
|
+
},
|
|
90
|
+
onClose: () => {
|
|
91
|
+
setIsOpen(false);
|
|
92
|
+
},
|
|
93
|
+
showClose: true,
|
|
94
|
+
version: 2,
|
|
95
|
+
size: "xsmall",
|
|
96
|
+
modalType: MODAL_TYPE_V2.DECISION,
|
|
97
|
+
confirmLabel: "Cancel",
|
|
98
|
+
message: ""
|
|
99
|
+
}, void 0, !inProgress && /*#__PURE__*/_jsx(DSUploader, {
|
|
100
|
+
containerProps: {
|
|
101
|
+
id: elementId
|
|
102
|
+
},
|
|
103
|
+
showAltAction: false,
|
|
104
|
+
acceptedTypesText: allowedImageTypes,
|
|
105
|
+
onDrop: handleFileChange
|
|
106
|
+
}), inProgress && 'Upload in progress...', error && /*#__PURE__*/_jsx("div", {
|
|
107
|
+
style: {
|
|
108
|
+
color: 'red',
|
|
109
|
+
marginTop: '10px'
|
|
110
|
+
}
|
|
111
|
+
}, void 0, error))]
|
|
112
|
+
});
|
|
93
113
|
};
|
|
94
|
-
|
|
114
|
+
|
|
115
|
+
export { CustomImageUploader };
|