@elliemae/ds-wysiwygeditor 3.3.0-next.3 → 3.3.0-next.6
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/dist/cjs/DSWYSIWYGEditor.js +16 -51
- package/dist/cjs/DSWYSIWYGEditor.js.map +1 -1
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js +18 -55
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +1 -1
- package/dist/cjs/components/ImageLibraryModal.js +3 -19
- package/dist/cjs/components/ImageLibraryModal.js.map +1 -1
- package/dist/cjs/components/InsertFieldModal.js +8 -35
- package/dist/cjs/components/InsertFieldModal.js.map +1 -1
- package/dist/cjs/components/TippedButton.js +22 -55
- package/dist/cjs/components/TippedButton.js.map +1 -1
- package/dist/esm/DSWYSIWYGEditor.js +16 -53
- package/dist/esm/DSWYSIWYGEditor.js.map +1 -1
- package/dist/esm/components/DSWYSIWYGEditorImpl.js +18 -57
- package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +1 -1
- package/dist/esm/components/ImageLibraryModal.js +3 -21
- package/dist/esm/components/ImageLibraryModal.js.map +1 -1
- package/dist/esm/components/InsertFieldModal.js +8 -37
- package/dist/esm/components/InsertFieldModal.js.map +1 -1
- package/dist/esm/components/TippedButton.js +22 -57
- package/dist/esm/components/TippedButton.js.map +1 -1
- package/package.json +10 -10
|
@@ -3,34 +3,8 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
8
|
var __export = (target, all) => {
|
|
35
9
|
for (var name in all)
|
|
36
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -56,33 +30,23 @@ var React = __toESM(require("react"));
|
|
|
56
30
|
var import_react = __toESM(require("react"));
|
|
57
31
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
58
32
|
var import_DSWYSIWYGEditorImpl = __toESM(require("./components/DSWYSIWYGEditorImpl"));
|
|
59
|
-
const DSWYSIWYGEditor = (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"value",
|
|
72
|
-
"onChange",
|
|
73
|
-
"getQuillRef",
|
|
74
|
-
"quillModules",
|
|
75
|
-
"customToolbar",
|
|
76
|
-
"toolbarHandlers",
|
|
77
|
-
"showRawHTML",
|
|
78
|
-
"height",
|
|
79
|
-
"hideItems"
|
|
80
|
-
]);
|
|
33
|
+
const DSWYSIWYGEditor = ({
|
|
34
|
+
value = "",
|
|
35
|
+
onChange = () => null,
|
|
36
|
+
getQuillRef = () => null,
|
|
37
|
+
quillModules = {},
|
|
38
|
+
customToolbar,
|
|
39
|
+
toolbarHandlers,
|
|
40
|
+
showRawHTML = false,
|
|
41
|
+
height,
|
|
42
|
+
hideItems,
|
|
43
|
+
...rest
|
|
44
|
+
}) => {
|
|
81
45
|
const emptyAction = () => {
|
|
82
46
|
};
|
|
83
47
|
const [showHTML, setShowHTML] = (0, import_react.useState)(showRawHTML);
|
|
84
48
|
(0, import_react.useEffect)(() => setShowHTML(showRawHTML), [showRawHTML]);
|
|
85
|
-
return /* @__PURE__ */ import_react.default.createElement(import_DSWYSIWYGEditorImpl.default,
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(import_DSWYSIWYGEditorImpl.default, {
|
|
86
50
|
forceHttpLink: true,
|
|
87
51
|
handleCustomFieldClick: emptyAction,
|
|
88
52
|
handleImageClick: emptyAction,
|
|
@@ -96,8 +60,9 @@ const DSWYSIWYGEditor = (_a) => {
|
|
|
96
60
|
showRawHTML: showHTML,
|
|
97
61
|
onShowHTML: () => setShowHTML(!showHTML),
|
|
98
62
|
height,
|
|
99
|
-
hideItems
|
|
100
|
-
|
|
63
|
+
hideItems,
|
|
64
|
+
...rest
|
|
65
|
+
});
|
|
101
66
|
};
|
|
102
67
|
const wysiwygEditorProps = {
|
|
103
68
|
value: import_ds_utilities.PropTypes.string.description("editors value").isRequired,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSWYSIWYGEditor.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\nDSWYSIWYGEditor.displayName = 'DSWYSIWYGEditor';\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2C;AAC3C,0BAAoC;AACpC,iCAAgC;AAEhC,MAAM,kBAAkB,CAAC;AAAA,EACvB,QAAQ;AAAA,EACR,WAAW,MAAM;AAAA,EACjB,cAAc,MAAM;AAAA,EACpB,eAAe,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,KACG;AAAA,MACC;AACJ,QAAM,cAAc,MAAM;AAAA,EAAC;AAC3B,QAAM,CAAC,UAAU,eAAe,2BAAS,WAAW;AAEpD,8BAAU,MAAM,YAAY,WAAW,GAAG,CAAC,WAAW,CAAC;AAEvD,SACE,mDAAC;AAAA,IACC,eAAa;AAAA,IACb,wBAAwB;AAAA,IACxB,kBAAkB;AAAA,IAClB,gBAAgB,CAAC;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,YAAY,MAAM,YAAY,CAAC,QAAQ;AAAA,IACvC;AAAA,IACA;AAAA,IACC,GAAG;AAAA,GACN;AAEJ;AAEA,MAAM,qBAAqB;AAAA,EACzB,OAAO,8BAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACrD,UAAU,8BAAU,KAAK,YACvB;AAAA;AAAA;AAAA;AAAA,8DAKF,EAAE;AAAA,EACF,aAAa,8BAAU,KAAK,YAAY,8BAA8B;AAAA,EACtE,cAAc,8BAAU,OAAO,YAAY,kCAAkC;AAAA,EAC7E,eAAe,8BAAU,QAAQ,YAAY,gBAAgB;AAAA,EAC7D,iBAAiB,8BAAU,OAAO,YAAY,8BAA8B;AAAA,EAC5E,aAAa,8BAAU,KAAK,YAAY,qCAAqC,EAAE,aAAa,KAAK;AAAA,EACjG,QAAQ,8BAAU,OAAO,YAAY,iCAAiC;AAAA,EACtE,UAAU,8BAAU,OAAO,YACzB,qFACF;AAAA,EACA,WAAW,8BAAU,OAAO,YAAY,mDAAmD,EAAE,aAAa,CAAC,CAAC;AAAA,EAC5G,QAAQ,8BAAU,OAAO,YACvB,mFACF;AACF;AAEA,gBAAgB,YAAY;AAC5B,gBAAgB,cAAc;AAC9B,MAAM,mBAAmB,kCAAS,eAAe;AACjD,iBAAiB,YAAY;AAG7B,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -95,16 +66,19 @@ import_react_quill.Quill.register(import_Image.default, true);
|
|
|
95
66
|
class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
96
67
|
constructor(props) {
|
|
97
68
|
super(props);
|
|
98
|
-
this.quillModules =
|
|
69
|
+
this.quillModules = {
|
|
99
70
|
toolbar: {
|
|
100
71
|
container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : "#toolbar",
|
|
101
|
-
handlers:
|
|
72
|
+
handlers: {
|
|
73
|
+
...this.props.toolbarHandlers
|
|
74
|
+
}
|
|
102
75
|
},
|
|
103
76
|
clipboard: {
|
|
104
77
|
matchVisual: false
|
|
105
78
|
},
|
|
106
|
-
blotFormatter: {}
|
|
107
|
-
|
|
79
|
+
blotFormatter: {},
|
|
80
|
+
...this.props.quillModules
|
|
81
|
+
};
|
|
108
82
|
this.getEditor = () => this.quill?.getEditor();
|
|
109
83
|
this.onChangeQuill = (html, delta, source, editor) => {
|
|
110
84
|
console.log("quill detected a change");
|
|
@@ -179,7 +153,7 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
179
153
|
}
|
|
180
154
|
render() {
|
|
181
155
|
const { isFieldModalOpen, isImageModalOpen } = this.state;
|
|
182
|
-
const
|
|
156
|
+
const {
|
|
183
157
|
containerProps = {},
|
|
184
158
|
customFields,
|
|
185
159
|
imagesData,
|
|
@@ -191,29 +165,18 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
191
165
|
showRawHTML,
|
|
192
166
|
onShowHTML,
|
|
193
167
|
onChange,
|
|
194
|
-
hideItems
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"customToolbar",
|
|
200
|
-
"handleImageClick",
|
|
201
|
-
"handleCustomFieldClick",
|
|
202
|
-
"height",
|
|
203
|
-
"value",
|
|
204
|
-
"showRawHTML",
|
|
205
|
-
"onShowHTML",
|
|
206
|
-
"onChange",
|
|
207
|
-
"hideItems"
|
|
208
|
-
]);
|
|
209
|
-
return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({}, containerProps), {
|
|
168
|
+
hideItems,
|
|
169
|
+
...editorProps
|
|
170
|
+
} = this.props;
|
|
171
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
172
|
+
...containerProps,
|
|
210
173
|
className: `quill-wysiwyg-editor ${showRawHTML ? "show-raw" : ""}`
|
|
211
|
-
}
|
|
174
|
+
}, customToolbar || /* @__PURE__ */ import_react.default.createElement(import_CustomToolbar.CustomToolbar, {
|
|
212
175
|
customFields,
|
|
213
176
|
onShowHTML,
|
|
214
177
|
hideItems,
|
|
215
178
|
userProps: this.props
|
|
216
|
-
}), /* @__PURE__ */ import_react.default.createElement(import_react_quill.default,
|
|
179
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_react_quill.default, {
|
|
217
180
|
ref: this.quillRef,
|
|
218
181
|
modules: this.quillModules,
|
|
219
182
|
onChange: this.onChangeQuill,
|
|
@@ -221,10 +184,10 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
221
184
|
style: {
|
|
222
185
|
height,
|
|
223
186
|
borderBottom: "1px solid #ccc"
|
|
224
|
-
}
|
|
225
|
-
|
|
187
|
+
},
|
|
188
|
+
...editorProps,
|
|
226
189
|
id: "wysiwyg-text-container"
|
|
227
|
-
})
|
|
190
|
+
}), /* @__PURE__ */ import_react.default.createElement("textarea", {
|
|
228
191
|
className: "raw-editor ql-container ql-snow ql-editor",
|
|
229
192
|
style: {
|
|
230
193
|
width: "100%",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DSWYSIWYGEditorImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport ReactQuill, { Quill } from 'react-quill';\nimport BlotFormatter from 'quill-blot-formatter';\n\nimport ImageLibraryModal from './ImageLibraryModal';\nimport InsertFieldModal from './InsertFieldModal';\nimport { CustomToolbar } from './CustomToolbar';\nimport IndentStyle from '../quillOverrides/IndentStyle';\nimport LinkFormat from '../quillOverrides/LinkFormat';\nimport Image from '../quillOverrides/Image';\nimport { formatHTML } from '../utils';\nimport { clipboardLinkWithTagMatcher } from '../quillMatchers/clipboardLinkWithTagMatcher';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\n// Fix block styled formats ----------------\nconst AlignStyle = Quill.import('attributors/style/align');\nconst FontStyle = Quill.import('attributors/style/font');\nFontStyle.whitelist = [\n // allow ONLY these fonts and the default\n 'serif',\n 'monospace',\n 'arial',\n 'comic-sans',\n 'courier-new',\n 'georgia',\n 'helvetica',\n 'lucida',\n];\nconst SizeStyle = Quill.import('attributors/style/size');\nSizeStyle.whitelist = [\n // allow ONLY these sizes and the default\n 'x-small',\n 'large',\n 'x-large',\n];\n\n// Fix Doc Viewer p tags extra margin issue ---------\nconst Block = Quill.import('blots/block');\nBlock.tagName = 'p';\nQuill.register(Block);\n\nQuill.register(AlignStyle, true);\nQuill.register(IndentStyle, true);\nQuill.register(FontStyle, true);\nQuill.register(SizeStyle, true);\n// -----------------------------------------\nQuill.register(Image, true);\n\nexport default class DSWYSIWYGEditorImpl extends React.PureComponent {\n quillModules = {\n toolbar: {\n container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',\n handlers: {\n ...this.props.toolbarHandlers,\n },\n },\n clipboard: {\n // toggle to add extra line breaks when pasting HTML:\n matchVisual: false,\n },\n blotFormatter: {\n // options... https://github.com/Fandom-OSS/quill-blot-formatter\n },\n ...this.props.quillModules,\n };\n\n constructor(props) {\n super(props);\n Quill.register(LinkFormat, true);\n if (props.quillOverrides.length) {\n props.quillOverrides.map((override) => Quill.register(override, true));\n }\n this.state = {\n isImageModalOpen: false,\n isFieldModalOpen: false,\n };\n const { toolbar } = this.quillModules;\n if (props.imagesData) {\n toolbar.handlers.image = (value) => {\n const { imagesData, handleImageClick } = this.props;\n if (!imagesData.length) {\n return;\n }\n this.setState({ isImageModalOpen: !!value });\n handleImageClick(value);\n };\n }\n if (props.customFields) {\n toolbar.handlers.customFields = (value) => {\n const { customFields, handleCustomFieldClick } = this.props;\n if (!customFields.length) {\n return;\n }\n this.setState({ isFieldModalOpen: !!value });\n handleCustomFieldClick(value);\n };\n }\n }\n\n componentDidMount() {\n // this.quill doesn't exist untill the full call-stack execute\n // we need to \"setTimeout\" so this componentDidMount work as expected\n setTimeout(() => {\n const quillDomRef = this.quill;\n this.props.getQuillRef(quillDomRef);\n\n const editor = quillDomRef?.getEditor();\n // https://github.com/quilljs/quill/issues/2677\n editor?.clipboard.addMatcher('a', clipboardLinkWithTagMatcher);\n });\n }\n\n getEditor = () => this.quill?.getEditor();\n\n // eslint-disable-next-line max-params\n onChangeQuill = (html, delta, source, editor) => {\n console.log('quill detected a change')\n const { showRawHTML, onChange } = this.props;\n if (!showRawHTML) onChange(html, delta, source, editor);\n };\n\n onChangeTextArea = (e) => {\n const { showRawHTML, onChange } = this.props;\n if (showRawHTML) onChange(e.target.value);\n };\n\n onInserFieldConfirm = (fieldCode) => {\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertText(range.index, fieldCode);\n };\n\n onImageConfirm = (image) => {\n if (!image) {\n return;\n }\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertEmbed(range.index, 'image', image.url);\n };\n\n onFieldModalClose = () => {\n this.setState({ isFieldModalOpen: false });\n };\n\n onImageModalClose = () => {\n this.setState({ isImageModalOpen: false });\n };\n\n quillRef = (ref) => {\n this.quill = ref;\n };\n\n render() {\n const { isFieldModalOpen, isImageModalOpen } = this.state;\n const {\n containerProps = {},\n customFields,\n imagesData,\n customToolbar,\n handleImageClick,\n handleCustomFieldClick,\n height,\n value,\n showRawHTML,\n onShowHTML,\n onChange,\n hideItems,\n ...editorProps\n } = this.props;\n\n return (\n <div\n // data-testid=\"wysiwyg-text-container\"\n {...containerProps}\n className={`quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`}\n >\n {customToolbar || (\n <CustomToolbar\n customFields={customFields}\n onShowHTML={onShowHTML}\n hideItems={hideItems}\n userProps={this.props}\n />\n )}\n <ReactQuill\n ref={this.quillRef}\n modules={this.quillModules}\n onChange={this.onChangeQuill}\n value={value}\n style={{\n height,\n borderBottom: '1px solid #ccc',\n }}\n {...editorProps}\n id=\"wysiwyg-text-container\"\n />\n <textarea\n className=\"raw-editor ql-container ql-snow ql-editor\"\n style={{\n width: '100%',\n resize: 'none',\n height,\n minHeight: '200px',\n }}\n onChange={this.onChangeTextArea}\n value={formatHTML(value)}\n />\n {imagesData && imagesData.length && (\n <ImageLibraryModal\n imagesData={imagesData}\n isOpen={isImageModalOpen}\n onClose={this.onImageModalClose}\n onConfirm={this.onImageConfirm}\n />\n )}\n {customFields && customFields.length && (\n <InsertFieldModal\n customFields={customFields}\n isOpen={isFieldModalOpen}\n onClose={this.onFieldModalClose}\n onConfirm={this.onInserFieldConfirm}\n />\n )}\n </div>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAClB,yBAAkC;AAClC,kCAA0B;AAE1B,+BAA8B;AAC9B,8BAA6B;AAC7B,2BAA8B;AAC9B,yBAAwB;AACxB,wBAAuB;AACvB,mBAAkB;AAClB,mBAA2B;AAC3B,yCAA4C;AAE5C,yBAAM,SAAS,yBAAyB,mCAAa;AAGrD,MAAM,aAAa,yBAAM,OAAO,yBAAyB;AACzD,MAAM,YAAY,yBAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,YAAY,yBAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,QAAQ,yBAAM,OAAO,aAAa;AACxC,MAAM,UAAU;AAChB,yBAAM,SAAS,KAAK;AAEpB,yBAAM,SAAS,YAAY,IAAI;AAC/B,yBAAM,SAAS,4BAAa,IAAI;AAChC,yBAAM,SAAS,WAAW,IAAI;AAC9B,yBAAM,SAAS,WAAW,IAAI;AAE9B,yBAAM,SAAS,sBAAO,IAAI;AAE1B,MAAO,4BAA0C,qBAAM,cAAc;AAAA,EAkBnE,YAAY,OAAO;AACjB,UAAM,KAAK;AAlBb,wBAAe;AAAA,MACb,SAAS;AAAA,QACP,WAAW,KAAK,MAAM,mBAAmB,IAAI,KAAK,MAAM,qBAAqB;AAAA,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A,MACV,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,MACf;AAAA,MACA,OAAO;AAAA,QACL;AAAA,QACA,cAAc;AAAA,MAChB;AAAA,MACC,GAAG;AAAA,MACJ,IAAG;AAAA,KACL,GACA,mDAAC;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR;AAAA,QACA,WAAW;AAAA,MACb;AAAA,MACA,UAAU,KAAK;AAAA,MACf,OAAO,6BAAW,KAAK;AAAA,KACzB,GACC,cAAc,WAAW,UACxB,mDAAC;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,KAClB,GAED,gBAAgB,aAAa,UAC5B,mDAAC;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,KAClB,CAEJ;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -62,10 +45,11 @@ class ImageLibraryModal extends import_react.default.PureComponent {
|
|
|
62
45
|
};
|
|
63
46
|
}
|
|
64
47
|
render() {
|
|
65
|
-
return /* @__PURE__ */ import_react.default.createElement(import_ds_imagelibrarymodal.default,
|
|
48
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_imagelibrarymodal.default, {
|
|
49
|
+
...this.props,
|
|
66
50
|
onConfirm: this.onConfirm,
|
|
67
51
|
onSelect: this.onSelect
|
|
68
|
-
})
|
|
52
|
+
});
|
|
69
53
|
}
|
|
70
54
|
}
|
|
71
55
|
ImageLibraryModal.propTypes = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ImageLibraryModal.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal';\nimport PropTypes from 'prop-types';\n\nexport default class ImageLibraryModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n onReject: PropTypes.func,\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n description: PropTypes.string,\n createdBy: PropTypes.string.isRequired,\n createdDate: PropTypes.string.isRequired,\n }),\n ),\n isOpen: PropTypes.bool.isRequired,\n };\n\n static defaultProps = {\n onReject: undefined,\n imagesData: [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n {\n url:\n 'https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e',\n name: 'no image 2',\n createdBy: 'user:Jane Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedImage: undefined,\n };\n }\n\n onSelect = selectedImage => {\n this.setState({ selectedImage });\n };\n\n onConfirm = () => {\n const { selectedImage } = this.state;\n const { onConfirm, onClose } = this.props;\n onConfirm(selectedImage);\n onClose();\n };\n\n render() {\n return (\n <DSImageLibraryModal\n {...this.props}\n onConfirm={this.onConfirm}\n onSelect={this.onSelect}\n />\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,kCAAgC;AAChC,wBAAsB;AAEtB,MAAO,0BAAwC,qBAAM,cAAc;AAAA,EAqCjE,YAAY,OAAO;AACjB,UAAM,KAAK;AAMb,oBAAW,mBAAiB;AAC1B,WAAK,SAAS,EAAE,cAAc,CAAC;AAAA,IACjC;AAEA,qBAAY,MAAM;AAChB,YAAM,EAAE,kBAAkB,KAAK;AAC/B,YAAM,EAAE,WAAW,YAAY,KAAK;AACpC,gBAAU,aAAa;AACvB,cAAQ;AAAA,IACV;AAdE,SAAK,QAAQ;AAAA,MACX,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EAaA,SAAS;AACP,WACE,mDAAC;AAAA,MACE,GAAG,KAAK;AAAA,MACT,WAAW,KAAK;AAAA,MAChB,UAAU,KAAK;AAAA,KACjB;AAAA,EAEJ;AACF;AA/DE,AADmB,kBACZ,YAAY;AAAA,EACjB,WAAW,0BAAU,KAAK;AAAA,EAC1B,SAAS,0BAAU,KAAK;AAAA,EACxB,UAAU,0BAAU;AAAA,EACpB,YAAY,0BAAU,QACpB,0BAAU,MAAM;AAAA,IACd,IAAI,0BAAU;AAAA,IACd,KAAK,0BAAU,OAAO;AAAA,IACtB,MAAM,0BAAU,OAAO;AAAA,IACvB,aAAa,0BAAU;AAAA,IACvB,WAAW,0BAAU,OAAO;AAAA,IAC5B,aAAa,0BAAU,OAAO;AAAA,EAChC,CAAC,CACH;AAAA,EACA,QAAQ,0BAAU,KAAK;AACzB;AAEA,AAlBmB,kBAkBZ,eAAe;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,IACV;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,KACE;AAAA,MACF,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -136,14 +107,15 @@ class InsertFieldModal extends import_react.default.PureComponent {
|
|
|
136
107
|
} else if (fieldCode === selectedFieldCode) {
|
|
137
108
|
extras.ref = (element) => element && element.focus();
|
|
138
109
|
}
|
|
139
|
-
return /* @__PURE__ */ import_react.default.createElement("div",
|
|
110
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
140
111
|
key: fieldCode,
|
|
141
112
|
className: elementClassName,
|
|
142
113
|
onClick: (e) => this.handleElementClick(e, fieldCode),
|
|
143
114
|
onKeyUp: (e) => this.handleElementClick(e, fieldCode),
|
|
144
115
|
role: "button",
|
|
145
|
-
tabIndex: 0
|
|
146
|
-
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
...extras
|
|
118
|
+
}, this.drawLabel("content", (0, import_customFields.getFieldName)(customField), fieldCode));
|
|
147
119
|
});
|
|
148
120
|
};
|
|
149
121
|
this.state = {
|
|
@@ -165,12 +137,13 @@ class InsertFieldModal extends import_react.default.PureComponent {
|
|
|
165
137
|
}
|
|
166
138
|
}
|
|
167
139
|
render() {
|
|
168
|
-
const
|
|
169
|
-
return /* @__PURE__ */ import_react.default.createElement(import_ds_modal.default,
|
|
140
|
+
const { customFields, onSelect, ...modalProps } = this.props;
|
|
141
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_modal.default, {
|
|
142
|
+
...modalProps,
|
|
170
143
|
className: "insert-field-modal",
|
|
171
144
|
onConfirm: this.onConfirm,
|
|
172
145
|
onReject: this.onReject
|
|
173
|
-
}
|
|
146
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
174
147
|
className: "wrapper"
|
|
175
148
|
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
176
149
|
className: "col-1"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/InsertFieldModal.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable react/static-property-placement */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared';\nimport { includes } from 'lodash';\nimport { fields, getFieldName, getFieldCode } from './customFields';\n\nconst modalTypes = Object.values(MODAL_TYPE);\nconst elementClassName = 'insertfieldmodal-element';\n\nexport default class InsertFieldModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n confirmLabel: PropTypes.string,\n customFields: PropTypes.arrayOf(PropTypes.string),\n disableDoubleClick: PropTypes.bool,\n isOpen: PropTypes.bool,\n modalTitle: PropTypes.string,\n modalType: PropTypes.string,\n rejectLabel: PropTypes.string,\n shouldCloseOnOverlayClick: PropTypes.bool,\n size: PropTypes.string,\n onSelect: PropTypes.func,\n };\n\n static defaultProps = {\n confirmLabel: 'Add',\n customFields: fields,\n disableDoubleClick: false,\n isOpen: true,\n modalTitle: 'Add Field',\n modalType: modalTypes[1],\n rejectLabel: 'Cancel',\n shouldCloseOnOverlayClick: true,\n size: sizeOptions[1],\n onSelect: undefined,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedFieldCode: getFieldCode(fields[0]),\n };\n this.preventSpacebarScroll();\n }\n\n componentDidMount() {\n const { customFields } = this.props;\n if (customFields) {\n this.handleElementClick({}, customFields[0]);\n this.focusFirst = true;\n }\n }\n\n getDerivedStateFromProps(nextProps) {\n const { customFields } = this.props;\n if (!customFields && nextProps.customFields) {\n this.setState({ selectedFieldCode: customFields[0] });\n }\n }\n\n onConfirm = () => {\n const { onConfirm, onClose } = this.props;\n const { selectedFieldCode } = this.state;\n onConfirm(selectedFieldCode);\n onClose();\n };\n\n onReject = () => {\n const { onReject, onClose } = this.props;\n if (onReject) {\n onReject();\n } else {\n onClose();\n }\n };\n\n drawDiv = (className, content, content2) => (\n <div className={className}>\n <span>{content}</span>\n <span>{content2}</span>\n </div>\n );\n\n drawLabel = (className, label, value) => (\n <div className={className}>\n <span className=\"label\">{label}</span>\n <span className=\"value\">{value}</span>\n </div>\n );\n\n handleElementClick = (e, selectedFieldCode) => {\n if (e.key && e.key !== ' ') {\n return;\n }\n const { selectedFieldCode: fCode } = this.state;\n const { disableDoubleClick } = this.props;\n if (selectedFieldCode === fCode && !disableDoubleClick) {\n this.onConfirm();\n return;\n }\n this.setState({\n selectedFieldCode,\n });\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(selectedFieldCode);\n }\n };\n\n preventSpacebarScroll = () => {\n document.onkeypress = function (e) {\n if (!includes(e.target.className, elementClassName)) {\n return true;\n }\n e = e || window.event;\n const charCode = e.keyCode || e.which;\n if (charCode === 32) {\n e.preventDefault();\n return false;\n }\n return true;\n };\n };\n\n renderElements = () => {\n const { customFields } = this.props;\n if (!customFields) {\n return 'Empty';\n }\n const { selectedFieldCode } = this.state;\n return customFields.map((customField, idx) => {\n const extras = {};\n const fieldCode = getFieldCode(customField);\n if (this.focusFirst && idx === 0) {\n extras.ref = (element) => element && element.focus();\n this.focusFirst = undefined;\n } else if (fieldCode === selectedFieldCode) {\n extras.ref = (element) => element && element.focus();\n }\n return (\n <div\n key={fieldCode}\n className={elementClassName}\n onClick={(e) => this.handleElementClick(e, fieldCode)}\n onKeyUp={(e) => this.handleElementClick(e, fieldCode)}\n role=\"button\"\n tabIndex={0}\n {...extras}\n >\n {this.drawLabel('content', getFieldName(customField), fieldCode)}\n </div>\n );\n });\n };\n\n render() {\n const { customFields, onSelect, ...modalProps } = this.props;\n return (\n <DSModal {...modalProps} className=\"insert-field-modal\" onConfirm={this.onConfirm} onReject={this.onReject}>\n <div className=\"wrapper\">\n <div className=\"col-1\">\n {this.drawDiv('title', 'Field Name', '\u00AB Field ID \u00BB')}\n {this.renderElements()}\n </div>\n </div>\n </DSModal>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAkB;AAClB,wBAAsB;AACtB,sBAAoC;AACpC,uBAA4B;AAC5B,oBAAyB;AACzB,0BAAmD;AAEnD,MAAM,aAAa,OAAO,OAAO,0BAAU;AAC3C,MAAM,mBAAmB;AAEzB,MAAO,yBAAuC,qBAAM,cAAc;AAAA,EA6BhE,YAAY,OAAO;AACjB,UAAM,KAAK;AAsBb,qBAAY,MAA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E,mDAAC;AAAA,MAAS,GAAG;AAAA,MAAY,WAAU;AAAA,MAAqB,WAAW,KAAK;AAAA,MAAW,UAAU,KAAK;AAAA,OAChG,mDAAC;AAAA,MAAI,WAAU;AAAA,OACb,mDAAC;AAAA,MAAI,WAAU;AAAA,OACZ,KAAK,QAAQ,SAAS,cAAc,oBAAc,GAClD,KAAK,eAAe,CACvB,CACF,CACF;AAAA,EAEJ;AACF;AA/JE,AADmB,iBACZ,YAAY;AAAA,EACjB,WAAW,0BAAU,KAAK;AAAA,EAC1B,SAAS,0BAAU,KAAK;AAAA,EACxB,cAAc,0BAAU;AAAA,EACxB,cAAc,0BAAU,QAAQ,0BAAU,MAAM;AAAA,EAChD,oBAAoB,0BAAU;AAAA,EAC9B,QAAQ,0BAAU;AAAA,EAClB,YAAY,0BAAU;AAAA,EACtB,WAAW,0BAAU;AAAA,EACrB,aAAa,0BAAU;AAAA,EACvB,2BAA2B,0BAAU;AAAA,EACrC,MAAM,0BAAU;AAAA,EAChB,UAAU,0BAAU;AACtB;AAEA,AAhBmB,iBAgBZ,eAAe;AAAA,EACpB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,MAAM,6BAAY;AAAA,EAClB,UAAU;AACZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,34 +3,8 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
8
|
var __export = (target, all) => {
|
|
35
9
|
for (var name in all)
|
|
36
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -53,33 +27,26 @@ module.exports = __toCommonJS(TippedButton_exports);
|
|
|
53
27
|
var React = __toESM(require("react"));
|
|
54
28
|
var import_react = __toESM(require("react"));
|
|
55
29
|
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
|
56
|
-
const TippedButton = (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
className,
|
|
79
|
-
onClick: (e) => {
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
onClick(e);
|
|
82
|
-
}
|
|
83
|
-
}, rest), children)));
|
|
84
|
-
};
|
|
30
|
+
const TippedButton = ({
|
|
31
|
+
className,
|
|
32
|
+
tip,
|
|
33
|
+
children,
|
|
34
|
+
onClick = () => null,
|
|
35
|
+
zIndex = 1,
|
|
36
|
+
...rest
|
|
37
|
+
}) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
38
|
+
className: "tooltip"
|
|
39
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, {
|
|
40
|
+
text: tip,
|
|
41
|
+
zIndex,
|
|
42
|
+
withoutPortal: false
|
|
43
|
+
}, /* @__PURE__ */ import_react.default.createElement("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
className,
|
|
46
|
+
onClick: (e) => {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
onClick(e);
|
|
49
|
+
},
|
|
50
|
+
...rest
|
|
51
|
+
}, children)));
|
|
85
52
|
//# sourceMappingURL=TippedButton.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/TippedButton.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\ninterface TippedButtonPropsT {\n tip: string;\n zIndex: number;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n value?: string;\n}\n\nexport const TippedButton = ({\n className,\n tip,\n children,\n onClick = () => null,\n zIndex = 1,\n ...rest\n}: TippedButtonPropsT): JSX.Element => (\n <div className=\"tooltip\">\n <DSTooltipV3 text={tip} zIndex={zIndex} withoutPortal={false}>\n <button\n type=\"button\"\n className={className}\n onClick={(e) => {\n e.preventDefault();\n onClick(e);\n }}\n {...rest}\n >\n {children}\n </button>\n </DSTooltipV3>\n </div>\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAA4B;AAYrB,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAChB,SAAS;AAAA,KACN;AAAA,MAEH,mDAAC;AAAA,EAAI,WAAU;AAAA,GACb,mDAAC;AAAA,EAAY,MAAM;AAAA,EAAK;AAAA,EAAgB,eAAe;AAAA,GACrD,mDAAC;AAAA,EACC,MAAK;AAAA,EACL;AAAA,EACA,SAAS,CAAC,MAAM;AACd,MAAE,eAAe;AACjB,YAAQ,CAAC;AAAA,EACX;AAAA,EACC,GAAG;AAAA,GAEH,QACH,CACF,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,63 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import React2, { useState, useEffect } from "react";
|
|
32
4
|
import { describe, PropTypes } from "@elliemae/ds-utilities";
|
|
33
5
|
import DSWYSIWYGEditorImpl from "./components/DSWYSIWYGEditorImpl";
|
|
34
|
-
const DSWYSIWYGEditor = (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"value",
|
|
47
|
-
"onChange",
|
|
48
|
-
"getQuillRef",
|
|
49
|
-
"quillModules",
|
|
50
|
-
"customToolbar",
|
|
51
|
-
"toolbarHandlers",
|
|
52
|
-
"showRawHTML",
|
|
53
|
-
"height",
|
|
54
|
-
"hideItems"
|
|
55
|
-
]);
|
|
6
|
+
const DSWYSIWYGEditor = ({
|
|
7
|
+
value = "",
|
|
8
|
+
onChange = () => null,
|
|
9
|
+
getQuillRef = () => null,
|
|
10
|
+
quillModules = {},
|
|
11
|
+
customToolbar,
|
|
12
|
+
toolbarHandlers,
|
|
13
|
+
showRawHTML = false,
|
|
14
|
+
height,
|
|
15
|
+
hideItems,
|
|
16
|
+
...rest
|
|
17
|
+
}) => {
|
|
56
18
|
const emptyAction = () => {
|
|
57
19
|
};
|
|
58
20
|
const [showHTML, setShowHTML] = useState(showRawHTML);
|
|
59
21
|
useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);
|
|
60
|
-
return /* @__PURE__ */ React2.createElement(DSWYSIWYGEditorImpl,
|
|
22
|
+
return /* @__PURE__ */ React2.createElement(DSWYSIWYGEditorImpl, {
|
|
61
23
|
forceHttpLink: true,
|
|
62
24
|
handleCustomFieldClick: emptyAction,
|
|
63
25
|
handleImageClick: emptyAction,
|
|
@@ -71,8 +33,9 @@ const DSWYSIWYGEditor = (_a) => {
|
|
|
71
33
|
showRawHTML: showHTML,
|
|
72
34
|
onShowHTML: () => setShowHTML(!showHTML),
|
|
73
35
|
height,
|
|
74
|
-
hideItems
|
|
75
|
-
|
|
36
|
+
hideItems,
|
|
37
|
+
...rest
|
|
38
|
+
});
|
|
76
39
|
};
|
|
77
40
|
const wysiwygEditorProps = {
|
|
78
41
|
value: PropTypes.string.description("editors value").isRequired,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSWYSIWYGEditor.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\nDSWYSIWYGEditor.displayName = 'DSWYSIWYGEditor';\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEA,MAAM,kBAAkB,CAAC;AAAA,EACvB,QAAQ;AAAA,EACR,WAAW,MAAM;AAAA,EACjB,cAAc,MAA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0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2 from "react";
|
|
35
4
|
import ReactQuill, { Quill } from "react-quill";
|
|
@@ -72,16 +41,19 @@ Quill.register(Image, true);
|
|
|
72
41
|
class DSWYSIWYGEditorImpl extends React2.PureComponent {
|
|
73
42
|
constructor(props) {
|
|
74
43
|
super(props);
|
|
75
|
-
this.quillModules =
|
|
44
|
+
this.quillModules = {
|
|
76
45
|
toolbar: {
|
|
77
46
|
container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : "#toolbar",
|
|
78
|
-
handlers:
|
|
47
|
+
handlers: {
|
|
48
|
+
...this.props.toolbarHandlers
|
|
49
|
+
}
|
|
79
50
|
},
|
|
80
51
|
clipboard: {
|
|
81
52
|
matchVisual: false
|
|
82
53
|
},
|
|
83
|
-
blotFormatter: {}
|
|
84
|
-
|
|
54
|
+
blotFormatter: {},
|
|
55
|
+
...this.props.quillModules
|
|
56
|
+
};
|
|
85
57
|
this.getEditor = () => this.quill?.getEditor();
|
|
86
58
|
this.onChangeQuill = (html, delta, source, editor) => {
|
|
87
59
|
console.log("quill detected a change");
|
|
@@ -156,7 +128,7 @@ class DSWYSIWYGEditorImpl extends React2.PureComponent {
|
|
|
156
128
|
}
|
|
157
129
|
render() {
|
|
158
130
|
const { isFieldModalOpen, isImageModalOpen } = this.state;
|
|
159
|
-
const
|
|
131
|
+
const {
|
|
160
132
|
containerProps = {},
|
|
161
133
|
customFields,
|
|
162
134
|
imagesData,
|
|
@@ -168,29 +140,18 @@ class DSWYSIWYGEditorImpl extends React2.PureComponent {
|
|
|
168
140
|
showRawHTML,
|
|
169
141
|
onShowHTML,
|
|
170
142
|
onChange,
|
|
171
|
-
hideItems
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"customToolbar",
|
|
177
|
-
"handleImageClick",
|
|
178
|
-
"handleCustomFieldClick",
|
|
179
|
-
"height",
|
|
180
|
-
"value",
|
|
181
|
-
"showRawHTML",
|
|
182
|
-
"onShowHTML",
|
|
183
|
-
"onChange",
|
|
184
|
-
"hideItems"
|
|
185
|
-
]);
|
|
186
|
-
return /* @__PURE__ */ React2.createElement("div", __spreadProps(__spreadValues({}, containerProps), {
|
|
143
|
+
hideItems,
|
|
144
|
+
...editorProps
|
|
145
|
+
} = this.props;
|
|
146
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
147
|
+
...containerProps,
|
|
187
148
|
className: `quill-wysiwyg-editor ${showRawHTML ? "show-raw" : ""}`
|
|
188
|
-
}
|
|
149
|
+
}, customToolbar || /* @__PURE__ */ React2.createElement(CustomToolbar, {
|
|
189
150
|
customFields,
|
|
190
151
|
onShowHTML,
|
|
191
152
|
hideItems,
|
|
192
153
|
userProps: this.props
|
|
193
|
-
}), /* @__PURE__ */ React2.createElement(ReactQuill,
|
|
154
|
+
}), /* @__PURE__ */ React2.createElement(ReactQuill, {
|
|
194
155
|
ref: this.quillRef,
|
|
195
156
|
modules: this.quillModules,
|
|
196
157
|
onChange: this.onChangeQuill,
|
|
@@ -198,10 +159,10 @@ class DSWYSIWYGEditorImpl extends React2.PureComponent {
|
|
|
198
159
|
style: {
|
|
199
160
|
height,
|
|
200
161
|
borderBottom: "1px solid #ccc"
|
|
201
|
-
}
|
|
202
|
-
|
|
162
|
+
},
|
|
163
|
+
...editorProps,
|
|
203
164
|
id: "wysiwyg-text-container"
|
|
204
|
-
})
|
|
165
|
+
}), /* @__PURE__ */ React2.createElement("textarea", {
|
|
205
166
|
className: "raw-editor ql-container ql-snow ql-editor",
|
|
206
167
|
style: {
|
|
207
168
|
width: "100%",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DSWYSIWYGEditorImpl.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport ReactQuill, { Quill } from 'react-quill';\nimport BlotFormatter from 'quill-blot-formatter';\n\nimport ImageLibraryModal from './ImageLibraryModal';\nimport InsertFieldModal from './InsertFieldModal';\nimport { CustomToolbar } from './CustomToolbar';\nimport IndentStyle from '../quillOverrides/IndentStyle';\nimport LinkFormat from '../quillOverrides/LinkFormat';\nimport Image from '../quillOverrides/Image';\nimport { formatHTML } from '../utils';\nimport { clipboardLinkWithTagMatcher } from '../quillMatchers/clipboardLinkWithTagMatcher';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\n// Fix block styled formats ----------------\nconst AlignStyle = Quill.import('attributors/style/align');\nconst FontStyle = Quill.import('attributors/style/font');\nFontStyle.whitelist = [\n // allow ONLY these fonts and the default\n 'serif',\n 'monospace',\n 'arial',\n 'comic-sans',\n 'courier-new',\n 'georgia',\n 'helvetica',\n 'lucida',\n];\nconst SizeStyle = Quill.import('attributors/style/size');\nSizeStyle.whitelist = [\n // allow ONLY these sizes and the default\n 'x-small',\n 'large',\n 'x-large',\n];\n\n// Fix Doc Viewer p tags extra margin issue ---------\nconst Block = Quill.import('blots/block');\nBlock.tagName = 'p';\nQuill.register(Block);\n\nQuill.register(AlignStyle, true);\nQuill.register(IndentStyle, true);\nQuill.register(FontStyle, true);\nQuill.register(SizeStyle, true);\n// -----------------------------------------\nQuill.register(Image, true);\n\nexport default class DSWYSIWYGEditorImpl extends React.PureComponent {\n quillModules = {\n toolbar: {\n container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',\n handlers: {\n ...this.props.toolbarHandlers,\n },\n },\n clipboard: {\n // toggle to add extra line breaks when pasting HTML:\n matchVisual: false,\n },\n blotFormatter: {\n // options... https://github.com/Fandom-OSS/quill-blot-formatter\n },\n ...this.props.quillModules,\n };\n\n constructor(props) {\n super(props);\n Quill.register(LinkFormat, true);\n if (props.quillOverrides.length) {\n props.quillOverrides.map((override) => Quill.register(override, true));\n }\n this.state = {\n isImageModalOpen: false,\n isFieldModalOpen: false,\n };\n const { toolbar } = this.quillModules;\n if (props.imagesData) {\n toolbar.handlers.image = (value) => {\n const { imagesData, handleImageClick } = this.props;\n if (!imagesData.length) {\n return;\n }\n this.setState({ isImageModalOpen: !!value });\n handleImageClick(value);\n };\n }\n if (props.customFields) {\n toolbar.handlers.customFields = (value) => {\n const { customFields, handleCustomFieldClick } = this.props;\n if (!customFields.length) {\n return;\n }\n this.setState({ isFieldModalOpen: !!value });\n handleCustomFieldClick(value);\n };\n }\n }\n\n componentDidMount() {\n // this.quill doesn't exist untill the full call-stack execute\n // we need to \"setTimeout\" so this componentDidMount work as expected\n setTimeout(() => {\n const quillDomRef = this.quill;\n this.props.getQuillRef(quillDomRef);\n\n const editor = quillDomRef?.getEditor();\n // https://github.com/quilljs/quill/issues/2677\n editor?.clipboard.addMatcher('a', clipboardLinkWithTagMatcher);\n });\n }\n\n getEditor = () => this.quill?.getEditor();\n\n // eslint-disable-next-line max-params\n onChangeQuill = (html, delta, source, editor) => {\n console.log('quill detected a change')\n const { showRawHTML, onChange } = this.props;\n if (!showRawHTML) onChange(html, delta, source, editor);\n };\n\n onChangeTextArea = (e) => {\n const { showRawHTML, onChange } = this.props;\n if (showRawHTML) onChange(e.target.value);\n };\n\n onInserFieldConfirm = (fieldCode) => {\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertText(range.index, fieldCode);\n };\n\n onImageConfirm = (image) => {\n if (!image) {\n return;\n }\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertEmbed(range.index, 'image', image.url);\n };\n\n onFieldModalClose = () => {\n this.setState({ isFieldModalOpen: false });\n };\n\n onImageModalClose = () => {\n this.setState({ isImageModalOpen: false });\n };\n\n quillRef = (ref) => {\n this.quill = ref;\n };\n\n render() {\n const { isFieldModalOpen, isImageModalOpen } = this.state;\n const {\n containerProps = {},\n customFields,\n imagesData,\n customToolbar,\n handleImageClick,\n handleCustomFieldClick,\n height,\n value,\n showRawHTML,\n onShowHTML,\n onChange,\n hideItems,\n ...editorProps\n } = this.props;\n\n return (\n <div\n // data-testid=\"wysiwyg-text-container\"\n {...containerProps}\n className={`quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`}\n >\n {customToolbar || (\n <CustomToolbar\n customFields={customFields}\n onShowHTML={onShowHTML}\n hideItems={hideItems}\n userProps={this.props}\n />\n )}\n <ReactQuill\n ref={this.quillRef}\n modules={this.quillModules}\n onChange={this.onChangeQuill}\n value={value}\n style={{\n height,\n borderBottom: '1px solid #ccc',\n }}\n {...editorProps}\n id=\"wysiwyg-text-container\"\n />\n <textarea\n className=\"raw-editor ql-container ql-snow ql-editor\"\n style={{\n width: '100%',\n resize: 'none',\n height,\n minHeight: '200px',\n }}\n onChange={this.onChangeTextArea}\n value={formatHTML(value)}\n />\n {imagesData && imagesData.length && (\n <ImageLibraryModal\n imagesData={imagesData}\n isOpen={isImageModalOpen}\n onClose={this.onImageModalClose}\n onConfirm={this.onImageConfirm}\n />\n )}\n {customFields && customFields.length && (\n <InsertFieldModal\n customFields={customFields}\n isOpen={isFieldModalOpen}\n onClose={this.onFieldModalClose}\n onConfirm={this.onInserFieldConfirm}\n />\n )}\n </div>\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,SAAS,yBAAyB,aAAa;AAGrD,MAAM,aAAa,MAAM,OAAO,yBAAyB;AACzD,MAAM,YAAY,MAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,YAAY,MAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,QAAQ,MAAM,OAAO,aAAa;AACxC,MAAM,UAAU;AAChB,MAAM,SAAS,KAAK;AAEpB,MAAM,SAAS,YAAY,IAAI;AAC/B,MAAM,SAAS,aAAa,IAAI;AAChC,MAAM,SAAS,W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ACA;AAAA,MACA;AAAA,SACG;AAAA,QACD,KAAK;AAET,WACE,qCAAC;AAAA,MAEE,GAAG;AAAA,MACJ,WAAW,wBAAwB,cAAc,aAAa;AAAA,OAE7D,iBACC,qCAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,KAAK;AAAA,KAClB,GAEF,qCAAC;AAAA,MACC,KAAK,KAAK;AAAA,MACV,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,MACf;AAAA,MACA,OAAO;AAAA,QACL;AAAA,QACA,cAAc;AAAA,MAChB;AAAA,MACC,GAAG;AAAA,MACJ,IAAG;AAAA,KACL,GACA,qCAAC;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR;AAAA,QACA,WAAW;AAAA,MACb;AAAA,MACA,UAAU,KAAK;AAAA,MACf,OAAO,WAAW,KAAK;AAAA,KACzB,GACC,cAAc,WAAW,UACxB,qCAAC;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,KAClB,GAED,gBAAgB,aAAa,UAC5B,qCAAC;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,KAClB,CAEJ;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2 from "react";
|
|
23
4
|
import DSImageLibraryModal from "@elliemae/ds-imagelibrarymodal";
|
|
@@ -39,10 +20,11 @@ class ImageLibraryModal extends React2.PureComponent {
|
|
|
39
20
|
};
|
|
40
21
|
}
|
|
41
22
|
render() {
|
|
42
|
-
return /* @__PURE__ */ React2.createElement(DSImageLibraryModal,
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(DSImageLibraryModal, {
|
|
24
|
+
...this.props,
|
|
43
25
|
onConfirm: this.onConfirm,
|
|
44
26
|
onSelect: this.onSelect
|
|
45
|
-
})
|
|
27
|
+
});
|
|
46
28
|
}
|
|
47
29
|
}
|
|
48
30
|
ImageLibraryModal.propTypes = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ImageLibraryModal.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal';\nimport PropTypes from 'prop-types';\n\nexport default class ImageLibraryModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n onReject: PropTypes.func,\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n description: PropTypes.string,\n createdBy: PropTypes.string.isRequired,\n createdDate: PropTypes.string.isRequired,\n }),\n ),\n isOpen: PropTypes.bool.isRequired,\n };\n\n static defaultProps = {\n onReject: undefined,\n imagesData: [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n {\n url:\n 'https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e',\n name: 'no image 2',\n createdBy: 'user:Jane Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedImage: undefined,\n };\n }\n\n onSelect = selectedImage => {\n this.setState({ selectedImage });\n };\n\n onConfirm = () => {\n const { selectedImage } = this.state;\n const { onConfirm, onClose } = this.props;\n onConfirm(selectedImage);\n onClose();\n };\n\n render() {\n return (\n <DSImageLibraryModal\n {...this.props}\n onConfirm={this.onConfirm}\n onSelect={this.onSelect}\n />\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEA,MAAO,0BAAwC,OAAM,cAAc;AAAA,EAqCjE,YAAY,OAAO;AACjB,UAAM,KAAK;AAMb,oBAAW,mBAAiB;AAC1B,WAAK,SAAS,EAAE,cAAc,CAAC;AAAA,IACjC;AAEA,qBAAY,MAAM;AAChB,YAAM,EAAE,kBAAkB,KAAK;AAC/B,YAAM,EAAE,WAAW,YAAY,KAAK;AACpC,gBAAU,aAAa;AACvB,cAAQ;AAAA,IACV;AAdE,SAAK,QAAQ;AAAA,MACX,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EAaA,SAAS;AACP,WACE,qCAAC;AAAA,MACE,GAAG,KAAK;AAAA,MACT,WAAW,KAAK;AAAA,MAChB,UAAU,KAAK;AAAA,KACjB;AAAA,EAEJ;AACF;AA/DE,AADmB,kBACZ,YAAY;AAAA,EACjB,WAAW,UAAU,KAAK;AAAA,EAC1B,SAAS,UAAU,KAAK;AAAA,EACxB,UAAU,UAAU;AAAA,EACpB,YAAY,UAAU,QACpB,UAAU,MAAM;AAAA,IACd,IAAI,UAAU;AAAA,IACd,KAAK,UAAU,OAAO;AAAA,IACtB,MAAM,UAAU,OAAO;AAAA,IACvB,aAAa,UAAU;AAAA,IACvB,WAAW,UAAU,OAAO;AAAA,IAC5B,aAAa,UAAU,OAAO;AAAA,EAChC,CAAC,CACH;AAAA,EACA,QAAQ,UAAU,KAAK;AACzB;AAEA,AAlBmB,kBAkBZ,eAAe;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,IACV;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,KACE;AAAA,MACF,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2 from "react";
|
|
35
4
|
import PropTypes from "prop-types";
|
|
@@ -113,14 +82,15 @@ class InsertFieldModal extends React2.PureComponent {
|
|
|
113
82
|
} else if (fieldCode === selectedFieldCode) {
|
|
114
83
|
extras.ref = (element) => element && element.focus();
|
|
115
84
|
}
|
|
116
|
-
return /* @__PURE__ */ React2.createElement("div",
|
|
85
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
117
86
|
key: fieldCode,
|
|
118
87
|
className: elementClassName,
|
|
119
88
|
onClick: (e) => this.handleElementClick(e, fieldCode),
|
|
120
89
|
onKeyUp: (e) => this.handleElementClick(e, fieldCode),
|
|
121
90
|
role: "button",
|
|
122
|
-
tabIndex: 0
|
|
123
|
-
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
...extras
|
|
93
|
+
}, this.drawLabel("content", getFieldName(customField), fieldCode));
|
|
124
94
|
});
|
|
125
95
|
};
|
|
126
96
|
this.state = {
|
|
@@ -142,12 +112,13 @@ class InsertFieldModal extends React2.PureComponent {
|
|
|
142
112
|
}
|
|
143
113
|
}
|
|
144
114
|
render() {
|
|
145
|
-
const
|
|
146
|
-
return /* @__PURE__ */ React2.createElement(DSModal,
|
|
115
|
+
const { customFields, onSelect, ...modalProps } = this.props;
|
|
116
|
+
return /* @__PURE__ */ React2.createElement(DSModal, {
|
|
117
|
+
...modalProps,
|
|
147
118
|
className: "insert-field-modal",
|
|
148
119
|
onConfirm: this.onConfirm,
|
|
149
120
|
onReject: this.onReject
|
|
150
|
-
}
|
|
121
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
151
122
|
className: "wrapper"
|
|
152
123
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
153
124
|
className: "col-1"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/InsertFieldModal.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable react/static-property-placement */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared';\nimport { includes } from 'lodash';\nimport { fields, getFieldName, getFieldCode } from './customFields';\n\nconst modalTypes = Object.values(MODAL_TYPE);\nconst elementClassName = 'insertfieldmodal-element';\n\nexport default class InsertFieldModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n confirmLabel: PropTypes.string,\n customFields: PropTypes.arrayOf(PropTypes.string),\n disableDoubleClick: PropTypes.bool,\n isOpen: PropTypes.bool,\n modalTitle: PropTypes.string,\n modalType: PropTypes.string,\n rejectLabel: PropTypes.string,\n shouldCloseOnOverlayClick: PropTypes.bool,\n size: PropTypes.string,\n onSelect: PropTypes.func,\n };\n\n static defaultProps = {\n confirmLabel: 'Add',\n customFields: fields,\n disableDoubleClick: false,\n isOpen: true,\n modalTitle: 'Add Field',\n modalType: modalTypes[1],\n rejectLabel: 'Cancel',\n shouldCloseOnOverlayClick: true,\n size: sizeOptions[1],\n onSelect: undefined,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedFieldCode: getFieldCode(fields[0]),\n };\n this.preventSpacebarScroll();\n }\n\n componentDidMount() {\n const { customFields } = this.props;\n if (customFields) {\n this.handleElementClick({}, customFields[0]);\n this.focusFirst = true;\n }\n }\n\n getDerivedStateFromProps(nextProps) {\n const { customFields } = this.props;\n if (!customFields && nextProps.customFields) {\n this.setState({ selectedFieldCode: customFields[0] });\n }\n }\n\n onConfirm = () => {\n const { onConfirm, onClose } = this.props;\n const { selectedFieldCode } = this.state;\n onConfirm(selectedFieldCode);\n onClose();\n };\n\n onReject = () => {\n const { onReject, onClose } = this.props;\n if (onReject) {\n onReject();\n } else {\n onClose();\n }\n };\n\n drawDiv = (className, content, content2) => (\n <div className={className}>\n <span>{content}</span>\n <span>{content2}</span>\n </div>\n );\n\n drawLabel = (className, label, value) => (\n <div className={className}>\n <span className=\"label\">{label}</span>\n <span className=\"value\">{value}</span>\n </div>\n );\n\n handleElementClick = (e, selectedFieldCode) => {\n if (e.key && e.key !== ' ') {\n return;\n }\n const { selectedFieldCode: fCode } = this.state;\n const { disableDoubleClick } = this.props;\n if (selectedFieldCode === fCode && !disableDoubleClick) {\n this.onConfirm();\n return;\n }\n this.setState({\n selectedFieldCode,\n });\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(selectedFieldCode);\n }\n };\n\n preventSpacebarScroll = () => {\n document.onkeypress = function (e) {\n if (!includes(e.target.className, elementClassName)) {\n return true;\n }\n e = e || window.event;\n const charCode = e.keyCode || e.which;\n if (charCode === 32) {\n e.preventDefault();\n return false;\n }\n return true;\n };\n };\n\n renderElements = () => {\n const { customFields } = this.props;\n if (!customFields) {\n return 'Empty';\n }\n const { selectedFieldCode } = this.state;\n return customFields.map((customField, idx) => {\n const extras = {};\n const fieldCode = getFieldCode(customField);\n if (this.focusFirst && idx === 0) {\n extras.ref = (element) => element && element.focus();\n this.focusFirst = undefined;\n } else if (fieldCode === selectedFieldCode) {\n extras.ref = (element) => element && element.focus();\n }\n return (\n <div\n key={fieldCode}\n className={elementClassName}\n onClick={(e) => this.handleElementClick(e, fieldCode)}\n onKeyUp={(e) => this.handleElementClick(e, fieldCode)}\n role=\"button\"\n tabIndex={0}\n {...extras}\n >\n {this.drawLabel('content', getFieldName(customField), fieldCode)}\n </div>\n );\n });\n };\n\n render() {\n const { customFields, onSelect, ...modalProps } = this.props;\n return (\n <DSModal {...modalProps} className=\"insert-field-modal\" onConfirm={this.onConfirm} onReject={this.onReject}>\n <div className=\"wrapper\">\n <div className=\"col-1\">\n {this.drawDiv('title', 'Field Name', '\u00AB Field ID \u00BB')}\n {this.renderElements()}\n </div>\n </div>\n </DSModal>\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACGA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,aAAa,OAAO,OAAO,UAAU;AAC3C,MAAM,mBAAmB;AAEzB,MAAO,yBAAuC,OAAM,cAAc;AAAA,EA6BhE,YAAY,OAAO;AACjB,UAAM,KAAK;AAsBb,qBAAY,MAAM;AAChB,YAAM,EAAE,WAAW,YAAY,KAAK;AACpC,YAAM,EAAE,sBAAsB,KAAK;AACnC,gBAAU,iBAAiB;AAC3B,cAAQ;AAAA,IACV;AAEA,oBAAW,MAAM;AACf,YAAM,EAAE,UAAU,YAAY,KAAK;AACnC,UAAI,UAAU;AACZ,iBAAS;AAAA,MACX,OAAO;AACL,gBAAQ;AAAA,MACV;AAAA,IACF;AAEA,mBAAU,CAAC,WAAW,SAAS,aAC7B,qCAAC;AAAA,MAAI;AAAA,OACH,qCAAC,cAAM,OAAQ,GACf,qCAAC,cAAM,QAAS,CAClB;A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,EACxB,cAAc,UAAU,QAAQ,UAAU,MAAM;AAAA,EAChD,oBAAoB,UAAU;AAAA,EAC9B,QAAQ,UAAU;AAAA,EAClB,YAAY,UAAU;AAAA,EACtB,WAAW,UAAU;AAAA,EACrB,aAAa,UAAU;AAAA,EACvB,2BAA2B,UAAU;AAAA,EACrC,MAAM,UAAU;AAAA,EAChB,UAAU,UAAU;AACtB;AAEA,AAhBmB,iBAgBZ,eAAe;AAAA,EACpB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,MAAM,YAAY;AAAA,EAClB,UAAU;AACZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,64 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import React2 from "react";
|
|
32
4
|
import { DSTooltipV3 } from "@elliemae/ds-tooltip";
|
|
33
|
-
const TippedButton = (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
className,
|
|
56
|
-
onClick: (e) => {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
onClick(e);
|
|
59
|
-
}
|
|
60
|
-
}, rest), children)));
|
|
61
|
-
};
|
|
5
|
+
const TippedButton = ({
|
|
6
|
+
className,
|
|
7
|
+
tip,
|
|
8
|
+
children,
|
|
9
|
+
onClick = () => null,
|
|
10
|
+
zIndex = 1,
|
|
11
|
+
...rest
|
|
12
|
+
}) => /* @__PURE__ */ React2.createElement("div", {
|
|
13
|
+
className: "tooltip"
|
|
14
|
+
}, /* @__PURE__ */ React2.createElement(DSTooltipV3, {
|
|
15
|
+
text: tip,
|
|
16
|
+
zIndex,
|
|
17
|
+
withoutPortal: false
|
|
18
|
+
}, /* @__PURE__ */ React2.createElement("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
className,
|
|
21
|
+
onClick: (e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
onClick(e);
|
|
24
|
+
},
|
|
25
|
+
...rest
|
|
26
|
+
}, children)));
|
|
62
27
|
export {
|
|
63
28
|
TippedButton
|
|
64
29
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/TippedButton.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\ninterface TippedButtonPropsT {\n tip: string;\n zIndex: number;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n value?: string;\n}\n\nexport const TippedButton = ({\n className,\n tip,\n children,\n onClick = () => null,\n zIndex = 1,\n ...rest\n}: TippedButtonPropsT): JSX.Element => (\n <div className=\"tooltip\">\n <DSTooltipV3 text={tip} zIndex={zIndex} withoutPortal={false}>\n <button\n type=\"button\"\n className={className}\n onClick={(e) => {\n e.preventDefault();\n onClick(e);\n }}\n {...rest}\n >\n {children}\n </button>\n </DSTooltipV3>\n </div>\n);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAYO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAChB,SAAS;AAAA,KACN;AAAA,MAEH,qCAAC;AAAA,EAAI,WAAU;AAAA,GACb,qCAAC;AAAA,EAAY,MAAM;AAAA,EAAK;AAAA,EAAgB,eAAe;AAAA,GACrD,qCAAC;AAAA,EACC,MAAK;AAAA,EACL;AAAA,EACA,SAAS,CAAC,MAAM;AACd,MAAE,eAAe;AACjB,YAAQ,CAAC;AAAA,EACX;AAAA,EACC,GAAG;AAAA,GAEH,QACH,CACF,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wysiwygeditor",
|
|
3
|
-
"version": "3.3.0-next.
|
|
3
|
+
"version": "3.3.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - WYSIWYG Editor",
|
|
6
6
|
"files": [
|
|
@@ -99,15 +99,15 @@
|
|
|
99
99
|
"indent": 4
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@elliemae/ds-button": "3.3.0-next.
|
|
103
|
-
"@elliemae/ds-dropdownmenu": "3.3.0-next.
|
|
104
|
-
"@elliemae/ds-icons": "3.3.0-next.
|
|
105
|
-
"@elliemae/ds-imagelibrarymodal": "3.3.0-next.
|
|
106
|
-
"@elliemae/ds-modal": "3.3.0-next.
|
|
107
|
-
"@elliemae/ds-shared": "3.3.0-next.
|
|
108
|
-
"@elliemae/ds-tooltip": "3.3.0-next.
|
|
109
|
-
"@elliemae/ds-uploader": "3.3.0-next.
|
|
110
|
-
"@elliemae/ds-utilities": "3.3.0-next.
|
|
102
|
+
"@elliemae/ds-button": "3.3.0-next.6",
|
|
103
|
+
"@elliemae/ds-dropdownmenu": "3.3.0-next.6",
|
|
104
|
+
"@elliemae/ds-icons": "3.3.0-next.6",
|
|
105
|
+
"@elliemae/ds-imagelibrarymodal": "3.3.0-next.6",
|
|
106
|
+
"@elliemae/ds-modal": "3.3.0-next.6",
|
|
107
|
+
"@elliemae/ds-shared": "3.3.0-next.6",
|
|
108
|
+
"@elliemae/ds-tooltip": "3.3.0-next.6",
|
|
109
|
+
"@elliemae/ds-uploader": "3.3.0-next.6",
|
|
110
|
+
"@elliemae/ds-utilities": "3.3.0-next.6",
|
|
111
111
|
"prop-types": "~15.8.1",
|
|
112
112
|
"quill-blot-formatter": "~1.0.5",
|
|
113
113
|
"react-quill": "2.0.0-beta.2"
|