@elliemae/ds-wysiwygeditor 2.0.0-alpha.1 → 2.0.0-alpha.13
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 +12 -9
- package/cjs/components/CustomImageUploader.js +18 -15
- package/cjs/components/CustomToolbar.js +130 -159
- package/cjs/components/DSWYSIWYGEditorImpl.js +46 -31
- package/cjs/components/ImageLibraryModal.js +14 -10
- package/cjs/components/InsertFieldModal.js +34 -28
- package/cjs/components/TippedButton.js +55 -0
- package/cjs/components/TippedSelect.js +45 -0
- package/cjs/components/colors.js +7 -3
- package/cjs/components/customFields.js +15 -8
- package/cjs/constants.js +1 -0
- package/cjs/index.js +1 -3
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +33 -0
- package/cjs/quillOverrides/IndentStyle.js +2 -2
- package/cjs/quillOverrides/LinkFormat.js +17 -20
- package/cjs/quillOverrides/PlainClipboard.js +3 -1
- package/cjs/utils.js +5 -1
- package/esm/DSWYSIWYGEditor.js +9 -6
- package/esm/components/CustomImageUploader.js +13 -9
- package/esm/components/CustomToolbar.js +119 -142
- package/esm/components/DSWYSIWYGEditorImpl.js +37 -22
- package/esm/components/ImageLibraryModal.js +11 -7
- package/esm/components/InsertFieldModal.js +25 -19
- package/esm/components/TippedButton.js +45 -0
- package/esm/components/TippedSelect.js +37 -0
- package/esm/components/colors.js +7 -3
- package/esm/components/customFields.js +14 -7
- package/esm/constants.js +1 -0
- package/esm/index.js +1 -1
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +29 -0
- package/esm/quillOverrides/IndentStyle.js +2 -2
- package/esm/quillOverrides/LinkFormat.js +17 -16
- package/esm/quillOverrides/PlainClipboard.js +3 -1
- package/esm/utils.js +5 -1
- package/package.json +25 -8
- package/types/DSWYSIWYGEditor.d.ts +65 -8
- package/types/components/CustomImageUploader.d.ts +3 -1
- package/types/components/CustomToolbar.d.ts +3 -17
- package/types/components/TippedButton.d.ts +12 -0
- package/types/components/TippedSelect.d.ts +13 -0
- package/types/quillMatchers/clipboardLinkWithTagMatcher.d.ts +2 -0
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
var React = require('react');
|
|
7
14
|
var ReactQuill = require('react-quill');
|
|
8
15
|
var BlotFormatter = require('quill-blot-formatter');
|
|
@@ -12,6 +19,7 @@ var CustomToolbar = require('./CustomToolbar.js');
|
|
|
12
19
|
var IndentStyle = require('../quillOverrides/IndentStyle.js');
|
|
13
20
|
var LinkFormat = require('../quillOverrides/LinkFormat.js');
|
|
14
21
|
var utils = require('../utils.js');
|
|
22
|
+
var clipboardLinkWithTagMatcher = require('../quillMatchers/clipboardLinkWithTagMatcher.js');
|
|
15
23
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
24
|
|
|
17
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -27,8 +35,8 @@ const _excluded = ["containerProps", "customFields", "imagesData", "customToolba
|
|
|
27
35
|
|
|
28
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
37
|
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
-
ReactQuill.Quill.register('modules/blotFormatter', BlotFormatter__default[
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
39
|
+
ReactQuill.Quill.register('modules/blotFormatter', BlotFormatter__default["default"]); // Fix block styled formats ----------------
|
|
32
40
|
|
|
33
41
|
const AlignStyle = ReactQuill.Quill.import('attributors/style/align');
|
|
34
42
|
const FontStyle = ReactQuill.Quill.import('attributors/style/font');
|
|
@@ -46,13 +54,12 @@ ReactQuill.Quill.register(IndentStyle, true);
|
|
|
46
54
|
ReactQuill.Quill.register(FontStyle, true);
|
|
47
55
|
ReactQuill.Quill.register(SizeStyle, true); // -----------------------------------------
|
|
48
56
|
|
|
49
|
-
class DSWYSIWYGEditorImpl extends React__default[
|
|
57
|
+
class DSWYSIWYGEditorImpl extends React__default["default"].PureComponent {
|
|
50
58
|
constructor(props) {
|
|
51
59
|
super(props);
|
|
52
|
-
|
|
53
|
-
_defineProperty__default['default'](this, "quillModules", _objectSpread({
|
|
60
|
+
this.quillModules = _objectSpread({
|
|
54
61
|
toolbar: {
|
|
55
|
-
container: this.props.toolbarContainer ?
|
|
62
|
+
container: this.props.toolbarContainer ? "#".concat(this.props.toolbarContainer) : '#toolbar',
|
|
56
63
|
handlers: _objectSpread({}, this.props.toolbarHandlers)
|
|
57
64
|
},
|
|
58
65
|
clipboard: {
|
|
@@ -61,31 +68,31 @@ class DSWYSIWYGEditorImpl extends React__default['default'].PureComponent {
|
|
|
61
68
|
},
|
|
62
69
|
blotFormatter: {// options... https://github.com/Fandom-OSS/quill-blot-formatter
|
|
63
70
|
}
|
|
64
|
-
}, this.props.quillModules)
|
|
71
|
+
}, this.props.quillModules);
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
this.onChangeQuill = (html, delta, source, editor) => {
|
|
67
74
|
const {
|
|
68
75
|
showRawHTML,
|
|
69
76
|
onChange
|
|
70
77
|
} = this.props;
|
|
71
78
|
if (!showRawHTML) onChange(html, delta, source, editor);
|
|
72
|
-
}
|
|
79
|
+
};
|
|
73
80
|
|
|
74
|
-
|
|
81
|
+
this.onChangeTextArea = e => {
|
|
75
82
|
const {
|
|
76
83
|
showRawHTML,
|
|
77
84
|
onChange
|
|
78
85
|
} = this.props;
|
|
79
86
|
if (showRawHTML) onChange(e.target.value);
|
|
80
|
-
}
|
|
87
|
+
};
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
this.onInserFieldConfirm = fieldCode => {
|
|
83
90
|
const editor = this.getEditor();
|
|
84
91
|
const range = editor.getSelection(true);
|
|
85
92
|
editor.insertText(range.index, fieldCode);
|
|
86
|
-
}
|
|
93
|
+
};
|
|
87
94
|
|
|
88
|
-
|
|
95
|
+
this.onImageConfirm = image => {
|
|
89
96
|
if (!image) {
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
@@ -93,23 +100,23 @@ class DSWYSIWYGEditorImpl extends React__default['default'].PureComponent {
|
|
|
93
100
|
const editor = this.getEditor();
|
|
94
101
|
const range = editor.getSelection(true);
|
|
95
102
|
editor.insertEmbed(range.index, 'image', image.url);
|
|
96
|
-
}
|
|
103
|
+
};
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
this.onFieldModalClose = () => {
|
|
99
106
|
this.setState({
|
|
100
107
|
isFieldModalOpen: false
|
|
101
108
|
});
|
|
102
|
-
}
|
|
109
|
+
};
|
|
103
110
|
|
|
104
|
-
|
|
111
|
+
this.onImageModalClose = () => {
|
|
105
112
|
this.setState({
|
|
106
113
|
isImageModalOpen: false
|
|
107
114
|
});
|
|
108
|
-
}
|
|
115
|
+
};
|
|
109
116
|
|
|
110
|
-
|
|
117
|
+
this.quillRef = ref => {
|
|
111
118
|
this.quill = ref;
|
|
112
|
-
}
|
|
119
|
+
};
|
|
113
120
|
|
|
114
121
|
ReactQuill.Quill.register(LinkFormat, true);
|
|
115
122
|
|
|
@@ -163,7 +170,15 @@ class DSWYSIWYGEditorImpl extends React__default['default'].PureComponent {
|
|
|
163
170
|
}
|
|
164
171
|
|
|
165
172
|
componentDidMount() {
|
|
166
|
-
this.
|
|
173
|
+
// this.quill doesn't exist untill the full call-stack execute
|
|
174
|
+
// we need to "setTimeout" so this componentDidMount work as expected
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
const quillDomRef = this.quill;
|
|
177
|
+
const editor = quillDomRef.getEditor();
|
|
178
|
+
this.props.getQuillRef(quillDomRef); // https://github.com/quilljs/quill/issues/2677
|
|
179
|
+
|
|
180
|
+
editor.clipboard.addMatcher('a', clipboardLinkWithTagMatcher.clipboardLinkWithTagMatcher);
|
|
181
|
+
});
|
|
167
182
|
} // eslint-disable-next-line max-params
|
|
168
183
|
|
|
169
184
|
|
|
@@ -192,27 +207,27 @@ class DSWYSIWYGEditorImpl extends React__default['default'].PureComponent {
|
|
|
192
207
|
onChange,
|
|
193
208
|
hideItems
|
|
194
209
|
} = _this$props,
|
|
195
|
-
editorProps = _objectWithoutProperties__default[
|
|
210
|
+
editorProps = _objectWithoutProperties__default["default"](_this$props, _excluded);
|
|
196
211
|
|
|
197
212
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
198
|
-
className:
|
|
199
|
-
children: [customToolbar || /*#__PURE__*/_jsx__default[
|
|
213
|
+
className: "quill-wysiwyg-editor ".concat(showRawHTML ? 'show-raw' : ''),
|
|
214
|
+
children: [customToolbar || /*#__PURE__*/_jsx__default["default"](CustomToolbar.CustomToolbar, {
|
|
200
215
|
customFields: customFields,
|
|
201
216
|
onShowHTML: onShowHTML,
|
|
202
|
-
hideItems: hideItems
|
|
203
|
-
|
|
217
|
+
hideItems: hideItems,
|
|
218
|
+
userProps: this.props
|
|
219
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ReactQuill__default["default"], _objectSpread(_objectSpread({
|
|
204
220
|
ref: this.quillRef,
|
|
205
221
|
modules: this.quillModules,
|
|
206
222
|
onChange: this.onChangeQuill,
|
|
207
223
|
value: value,
|
|
208
224
|
style: {
|
|
209
225
|
height,
|
|
210
|
-
overflow: 'scroll',
|
|
211
226
|
borderBottom: '1px solid #ccc'
|
|
212
227
|
}
|
|
213
228
|
}, editorProps), {}, {
|
|
214
229
|
id: "wysiwyg-text-container"
|
|
215
|
-
})), /*#__PURE__*/_jsx__default[
|
|
230
|
+
})), /*#__PURE__*/_jsx__default["default"]("textarea", {
|
|
216
231
|
className: "raw-editor ql-container ql-snow ql-editor",
|
|
217
232
|
style: {
|
|
218
233
|
width: '100%',
|
|
@@ -222,12 +237,12 @@ class DSWYSIWYGEditorImpl extends React__default['default'].PureComponent {
|
|
|
222
237
|
},
|
|
223
238
|
onChange: this.onChangeTextArea,
|
|
224
239
|
value: utils.formatHTML(value)
|
|
225
|
-
}), imagesData && imagesData.length && /*#__PURE__*/_jsx__default[
|
|
240
|
+
}), imagesData && imagesData.length && /*#__PURE__*/_jsx__default["default"](ImageLibraryModal, {
|
|
226
241
|
imagesData: imagesData,
|
|
227
242
|
isOpen: isImageModalOpen,
|
|
228
243
|
onClose: this.onImageModalClose,
|
|
229
244
|
onConfirm: this.onImageConfirm
|
|
230
|
-
}), customFields && customFields.length && /*#__PURE__*/_jsx__default[
|
|
245
|
+
}), customFields && customFields.length && /*#__PURE__*/_jsx__default["default"](InsertFieldModal, {
|
|
231
246
|
customFields: customFields,
|
|
232
247
|
isOpen: isFieldModalOpen,
|
|
233
248
|
onClose: this.onFieldModalClose,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
3
8
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
9
|
var React = require('react');
|
|
5
10
|
var DSImageLibraryModal = require('@elliemae/ds-imagelibrarymodal');
|
|
@@ -13,18 +18,18 @@ var DSImageLibraryModal__default = /*#__PURE__*/_interopDefaultLegacy(DSImageLib
|
|
|
13
18
|
|
|
14
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
20
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
17
|
-
class ImageLibraryModal extends React__default[
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
+
class ImageLibraryModal extends React__default["default"].PureComponent {
|
|
18
23
|
constructor(props) {
|
|
19
24
|
super(props);
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
this.onSelect = selectedImage => {
|
|
22
27
|
this.setState({
|
|
23
28
|
selectedImage
|
|
24
29
|
});
|
|
25
|
-
}
|
|
30
|
+
};
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
this.onConfirm = () => {
|
|
28
33
|
const {
|
|
29
34
|
selectedImage
|
|
30
35
|
} = this.state;
|
|
@@ -34,7 +39,7 @@ class ImageLibraryModal extends React__default['default'].PureComponent {
|
|
|
34
39
|
} = this.props;
|
|
35
40
|
onConfirm(selectedImage);
|
|
36
41
|
onClose();
|
|
37
|
-
}
|
|
42
|
+
};
|
|
38
43
|
|
|
39
44
|
this.state = {
|
|
40
45
|
selectedImage: undefined
|
|
@@ -42,15 +47,14 @@ class ImageLibraryModal extends React__default['default'].PureComponent {
|
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
render() {
|
|
45
|
-
return /*#__PURE__*/jsxRuntime.jsx(DSImageLibraryModal__default[
|
|
50
|
+
return /*#__PURE__*/jsxRuntime.jsx(DSImageLibraryModal__default["default"], _objectSpread(_objectSpread({}, this.props), {}, {
|
|
46
51
|
onConfirm: this.onConfirm,
|
|
47
52
|
onSelect: this.onSelect
|
|
48
53
|
}));
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
_defineProperty__default['default'](ImageLibraryModal, "defaultProps", {
|
|
57
|
+
ImageLibraryModal.defaultProps = {
|
|
54
58
|
onReject: undefined,
|
|
55
59
|
imagesData: [{
|
|
56
60
|
url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',
|
|
@@ -63,6 +67,6 @@ _defineProperty__default['default'](ImageLibraryModal, "defaultProps", {
|
|
|
63
67
|
createdBy: 'user:Jane Doe',
|
|
64
68
|
createdDate: '0000-01-01 00:00 AM UTC'
|
|
65
69
|
}]
|
|
66
|
-
}
|
|
70
|
+
};
|
|
67
71
|
|
|
68
72
|
module.exports = ImageLibraryModal;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
4
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
var React = require('react');
|
|
7
14
|
var DSModal = require('@elliemae/ds-modal');
|
|
8
|
-
var lodash = require('lodash');
|
|
9
15
|
var constants = require('@elliemae/ds-shared/constants');
|
|
16
|
+
var lodash = require('lodash');
|
|
10
17
|
var customFields = require('./customFields.js');
|
|
11
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
19
|
|
|
13
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
21
|
|
|
15
22
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
16
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
24
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
26
|
var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
|
|
20
27
|
|
|
@@ -22,14 +29,14 @@ const _excluded = ["customFields", "onSelect"];
|
|
|
22
29
|
|
|
23
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
24
31
|
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
26
33
|
const modalTypes = Object.values(DSModal.MODAL_TYPE);
|
|
27
34
|
const elementClassName = 'insertfieldmodal-element';
|
|
28
|
-
class InsertFieldModal extends React__default[
|
|
35
|
+
class InsertFieldModal extends React__default["default"].PureComponent {
|
|
29
36
|
constructor(props) {
|
|
30
37
|
super(props);
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
this.onConfirm = () => {
|
|
33
40
|
const {
|
|
34
41
|
onConfirm,
|
|
35
42
|
onClose
|
|
@@ -39,9 +46,9 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
39
46
|
} = this.state;
|
|
40
47
|
onConfirm(selectedFieldCode);
|
|
41
48
|
onClose();
|
|
42
|
-
}
|
|
49
|
+
};
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
this.onReject = () => {
|
|
45
52
|
const {
|
|
46
53
|
onReject,
|
|
47
54
|
onClose
|
|
@@ -52,21 +59,21 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
52
59
|
} else {
|
|
53
60
|
onClose();
|
|
54
61
|
}
|
|
55
|
-
}
|
|
62
|
+
};
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
this.drawDiv = (className, content, content2) => /*#__PURE__*/_jsx__default["default"]("div", {
|
|
58
65
|
className: className
|
|
59
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, content), /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, content2));
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
this.drawLabel = (className, label, value) => /*#__PURE__*/_jsx__default["default"]("div", {
|
|
62
69
|
className: className
|
|
63
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
70
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
|
|
64
71
|
className: "label"
|
|
65
|
-
}, void 0, label), /*#__PURE__*/_jsx__default[
|
|
72
|
+
}, void 0, label), /*#__PURE__*/_jsx__default["default"]("span", {
|
|
66
73
|
className: "value"
|
|
67
|
-
}, void 0, value))
|
|
74
|
+
}, void 0, value));
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
this.handleElementClick = (e, selectedFieldCode) => {
|
|
70
77
|
if (e.key && e.key !== ' ') {
|
|
71
78
|
return;
|
|
72
79
|
}
|
|
@@ -93,9 +100,9 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
93
100
|
if (onSelect) {
|
|
94
101
|
onSelect(selectedFieldCode);
|
|
95
102
|
}
|
|
96
|
-
}
|
|
103
|
+
};
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
this.preventSpacebarScroll = () => {
|
|
99
106
|
document.onkeypress = function (e) {
|
|
100
107
|
if (!lodash.includes(e.target.className, elementClassName)) {
|
|
101
108
|
return true;
|
|
@@ -111,9 +118,9 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
111
118
|
|
|
112
119
|
return true;
|
|
113
120
|
};
|
|
114
|
-
}
|
|
121
|
+
};
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
this.renderElements = () => {
|
|
117
124
|
const {
|
|
118
125
|
customFields: customFields$1
|
|
119
126
|
} = this.props;
|
|
@@ -147,7 +154,7 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
147
154
|
children: this.drawLabel('content', customFields.getFieldName(customField), fieldCode)
|
|
148
155
|
}), fieldCode);
|
|
149
156
|
});
|
|
150
|
-
}
|
|
157
|
+
};
|
|
151
158
|
|
|
152
159
|
this.state = {
|
|
153
160
|
selectedFieldCode: customFields.getFieldCode(customFields.fields[0])
|
|
@@ -180,23 +187,22 @@ class InsertFieldModal extends React__default['default'].PureComponent {
|
|
|
180
187
|
|
|
181
188
|
render() {
|
|
182
189
|
const _this$props = this.props,
|
|
183
|
-
modalProps = _objectWithoutProperties__default[
|
|
190
|
+
modalProps = _objectWithoutProperties__default["default"](_this$props, _excluded);
|
|
184
191
|
|
|
185
|
-
return /*#__PURE__*/jsxRuntime.jsx(DSModal__default[
|
|
192
|
+
return /*#__PURE__*/jsxRuntime.jsx(DSModal__default["default"], _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
186
193
|
className: "insert-field-modal",
|
|
187
194
|
onConfirm: this.onConfirm,
|
|
188
195
|
onReject: this.onReject,
|
|
189
|
-
children: /*#__PURE__*/_jsx__default[
|
|
196
|
+
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
190
197
|
className: "wrapper"
|
|
191
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
198
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
192
199
|
className: "col-1"
|
|
193
200
|
}, void 0, this.drawDiv('title', 'Field Name', '« Field ID »'), this.renderElements()))
|
|
194
201
|
}));
|
|
195
202
|
}
|
|
196
203
|
|
|
197
204
|
}
|
|
198
|
-
|
|
199
|
-
_defineProperty__default['default'](InsertFieldModal, "defaultProps", {
|
|
205
|
+
InsertFieldModal.defaultProps = {
|
|
200
206
|
confirmLabel: 'Add',
|
|
201
207
|
customFields: customFields.fields,
|
|
202
208
|
disableDoubleClick: false,
|
|
@@ -207,6 +213,6 @@ _defineProperty__default['default'](InsertFieldModal, "defaultProps", {
|
|
|
207
213
|
shouldCloseOnOverlayClick: true,
|
|
208
214
|
size: constants.sizeOptions[1],
|
|
209
215
|
onSelect: undefined
|
|
210
|
-
}
|
|
216
|
+
};
|
|
211
217
|
|
|
212
218
|
module.exports = InsertFieldModal;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
13
|
+
require('react');
|
|
14
|
+
var dsTooltip = require('@elliemae/ds-tooltip');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
20
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
21
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
+
|
|
23
|
+
const _excluded = ["className", "tip", "children", "onClick", "zIndex"];
|
|
24
|
+
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
28
|
+
const TippedButton = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
className,
|
|
31
|
+
tip,
|
|
32
|
+
children,
|
|
33
|
+
onClick = () => null,
|
|
34
|
+
zIndex = 1
|
|
35
|
+
} = _ref,
|
|
36
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
37
|
+
|
|
38
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
39
|
+
className: "tooltip"
|
|
40
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTooltip.DSTooltipV3, {
|
|
41
|
+
text: tip,
|
|
42
|
+
zIndex: zIndex
|
|
43
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsx("button", _objectSpread(_objectSpread({
|
|
44
|
+
type: "button",
|
|
45
|
+
className: className,
|
|
46
|
+
onClick: e => {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
onClick(e);
|
|
49
|
+
}
|
|
50
|
+
}, rest), {}, {
|
|
51
|
+
children: children
|
|
52
|
+
}))));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.TippedButton = TippedButton;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('react');
|
|
10
|
+
var dsTooltip = require('@elliemae/ds-tooltip');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
+
|
|
16
|
+
const TippedSelect = props => {
|
|
17
|
+
const {
|
|
18
|
+
tip,
|
|
19
|
+
onChange = () => null,
|
|
20
|
+
className,
|
|
21
|
+
options,
|
|
22
|
+
defaultValue = '',
|
|
23
|
+
values,
|
|
24
|
+
zIndex,
|
|
25
|
+
children
|
|
26
|
+
} = props;
|
|
27
|
+
const fallBackChildren = values && values.map((value, index) => /*#__PURE__*/_jsx__default["default"]("option", {
|
|
28
|
+
value: value === 'normal' ? '' : value
|
|
29
|
+
}, value, options ? options[index] : null));
|
|
30
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
31
|
+
className: "tooltip"
|
|
32
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTooltip.DSTooltipV3, {
|
|
33
|
+
text: tip,
|
|
34
|
+
zIndex: zIndex
|
|
35
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/_jsx__default["default"]("select", {
|
|
36
|
+
className: className,
|
|
37
|
+
defaultValue: defaultValue,
|
|
38
|
+
onChange: e => {
|
|
39
|
+
e.persist();
|
|
40
|
+
onChange(e);
|
|
41
|
+
}
|
|
42
|
+
}, void 0, children || fallBackChildren))));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.TippedSelect = TippedSelect;
|
package/cjs/components/colors.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
|
|
5
8
|
function sinToHex(i, size, phase) {
|
|
6
9
|
const sin = Math.sin(Math.PI / size * 2 * i + phase);
|
|
7
10
|
const int = Math.floor(sin * 127) + 128;
|
|
8
11
|
const hex = int.toString(16);
|
|
9
|
-
return hex.length === 1 ?
|
|
12
|
+
return hex.length === 1 ? "0".concat(hex) : hex;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
function getRainbowColors(
|
|
15
|
+
function getRainbowColors() {
|
|
16
|
+
let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 28;
|
|
13
17
|
const colors = new Array(size).fill(undefined);
|
|
14
18
|
return colors.map((color, idx) => {
|
|
15
19
|
const red = sinToHex(idx, size, 0 * Math.PI * 2 / 3); // 0 deg
|
|
@@ -18,7 +22,7 @@ function getRainbowColors(size = 28) {
|
|
|
18
22
|
|
|
19
23
|
const green = sinToHex(idx, size, 2 * Math.PI * 2 / 3); // 240 deg
|
|
20
24
|
|
|
21
|
-
color =
|
|
25
|
+
color = "#".concat(red).concat(green).concat(blue);
|
|
22
26
|
return color;
|
|
23
27
|
});
|
|
24
28
|
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
|
|
8
|
+
var _this = undefined;
|
|
5
9
|
const fields = ['Lender Name «315»', 'Lender Address «319»', 'Lender City «313»', 'Lender State «321»', 'Lender Zip «323»', 'Borrower First Name «4000»', 'Borrower Last Name «4002»', 'Total Loan Amount «2»', 'Loan Term «4»', 'Loan to Value «976»', 'Monthly Payment «912»', 'Interest Rate «3»', 'Loan Originator Name «1612»', 'Loan Originator Email «3968»', 'Loan Originator Phone «1823»', 'NMLS Loan Originator ID «3238»'];
|
|
6
10
|
/**
|
|
7
11
|
* Returns the fields names
|
|
@@ -9,13 +13,16 @@ const fields = ['Lender Name «315»', 'Lender Address «319»', 'Lender C
|
|
|
9
13
|
* @param customFields
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
|
-
const getFields =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const getFields = function () {
|
|
17
|
+
let customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fields;
|
|
18
|
+
return customFields.map((opt, index) => ({
|
|
19
|
+
id: "".concat(opt, "_").concat(index),
|
|
20
|
+
// icon: 'ADD',
|
|
21
|
+
label: "".concat(opt),
|
|
22
|
+
onClick: opt.indexOf('«') !== -1 ? () => _this.onOptionClick(_this.getFieldCode(opt)) : null,
|
|
23
|
+
type: opt === '' ? 'separator' : null
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
19
26
|
/**
|
|
20
27
|
* Returns a field's name
|
|
21
28
|
*
|
|
@@ -43,7 +50,7 @@ var customFields = {
|
|
|
43
50
|
getFieldCode
|
|
44
51
|
};
|
|
45
52
|
|
|
46
|
-
exports[
|
|
53
|
+
exports["default"] = customFields;
|
|
47
54
|
exports.fields = fields;
|
|
48
55
|
exports.getFieldCode = getFieldCode;
|
|
49
56
|
exports.getFieldName = getFieldName;
|
package/cjs/constants.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var colors$1 = require('./components/colors.js');
|
|
6
7
|
|
|
7
8
|
const colors = ['#000000', '#e60000', '#ff9900', '#ffff00', '#008A00', '#0066cc', '#9933ff', '#ffffff', '#facccc', '#ffebcc', '#ffffcc', '#cce8cc', '#cce0f5', '#ebd6ff', '#bbbbbb', '#f06666', '#ffc266', '#ffff66', '#66b966', '#66a3e0', '#c285ff', '#888888', '#a10000', '#b26b00', '#b2b200', '#006100', '#0047b2', '#6b24b2', '#444444', '#5c0000', '#663d00', '#666600', '#003700', '#002966', '#3d1466', ...colors$1.getRainbowColors(28)];
|
package/cjs/index.js
CHANGED
|
@@ -10,11 +10,9 @@ var constants = require('./constants.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
exports.WYSIWYWithSchema = DSWYSIWYGEditor.WYSIWYWithSchema;
|
|
13
|
-
exports
|
|
13
|
+
exports["default"] = DSWYSIWYGEditor["default"];
|
|
14
14
|
exports.CustomDropdown = CustomToolbar.CustomDropdown;
|
|
15
15
|
exports.CustomToolbar = CustomToolbar.CustomToolbar;
|
|
16
|
-
exports.TippedButton = CustomToolbar.TippedButton;
|
|
17
|
-
exports.TippedSelect = CustomToolbar.TippedSelect;
|
|
18
16
|
exports.CustomImageUploader = CustomImageUploader.CustomImageUploader;
|
|
19
17
|
exports.colors = constants.colors;
|
|
20
18
|
exports.defaultItems = constants.defaultItems;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
9
|
+
require('core-js/modules/es.string.replace.js');
|
|
10
|
+
|
|
11
|
+
const hrefTagRegexp = /%7B%7B.+%7D%7D/gm;
|
|
12
|
+
const clipboardLinkWithTagMatcher = (node, delta) => {
|
|
13
|
+
if (node.origin === window.location.origin) {
|
|
14
|
+
const nodeHref = node.href;
|
|
15
|
+
const tagMatch = nodeHref.match(hrefTagRegexp);
|
|
16
|
+
|
|
17
|
+
if (tagMatch) {
|
|
18
|
+
var _delta$ops;
|
|
19
|
+
|
|
20
|
+
const [overWrittenHrefValue] = tagMatch;
|
|
21
|
+
const insertLinkOperation = delta === null || delta === void 0 ? void 0 : (_delta$ops = delta.ops) === null || _delta$ops === void 0 ? void 0 : _delta$ops.find(operation => {
|
|
22
|
+
var _operation$attributes, _operation$attributes2, _operation$attributes3;
|
|
23
|
+
|
|
24
|
+
return operation === null || operation === void 0 ? void 0 : (_operation$attributes = operation.attributes) === null || _operation$attributes === void 0 ? void 0 : (_operation$attributes2 = _operation$attributes.link) === null || _operation$attributes2 === void 0 ? void 0 : (_operation$attributes3 = _operation$attributes2.match) === null || _operation$attributes3 === void 0 ? void 0 : _operation$attributes3.call(_operation$attributes2, hrefTagRegexp);
|
|
25
|
+
});
|
|
26
|
+
if (insertLinkOperation) insertLinkOperation.attributes.link = overWrittenHrefValue.replace(/%7B%7B/gm, '{{').replace(/%7D%7D/gm, '}}');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return delta;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.clipboardLinkWithTagMatcher = clipboardLinkWithTagMatcher;
|