@elliemae/ds-wysiwygeditor 2.4.2-rc.9 → 2.4.3-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSWYSIWYGEditor.js +7 -4
- package/cjs/components/CustomImageUploader.js +3 -4
- package/cjs/components/CustomToolbar.js +21 -23
- package/cjs/components/DSWYSIWYGEditorImpl.js +2 -2
- package/cjs/components/TippedSelect.js +0 -1
- package/cjs/components/colors.js +2 -2
- package/cjs/components/customFields.js +2 -2
- package/cjs/constants.js +1 -1
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +1 -13
- package/cjs/quillOverrides/IndentStyle.js +2 -2
- package/cjs/quillOverrides/LinkFormat.js +5 -6
- package/cjs/utils.js +1 -1
- package/esm/DSWYSIWYGEditor.js +7 -4
- package/esm/components/CustomImageUploader.js +3 -4
- package/esm/components/CustomToolbar.js +21 -23
- package/esm/components/DSWYSIWYGEditorImpl.js +2 -2
- package/esm/components/TippedSelect.js +0 -1
- package/esm/components/colors.js +2 -2
- package/esm/components/customFields.js +2 -2
- package/esm/constants.js +1 -1
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +1 -13
- package/esm/quillOverrides/IndentStyle.js +2 -2
- package/esm/quillOverrides/LinkFormat.js +5 -6
- package/esm/utils.js +1 -1
- package/package.json +9 -9
package/cjs/DSWYSIWYGEditor.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
13
12
|
var React = require('react');
|
|
14
13
|
var reactDesc = require('react-desc');
|
|
15
14
|
var DSWYSIWYGEditorImpl = require('./components/DSWYSIWYGEditorImpl.js');
|
|
@@ -64,7 +63,11 @@ const DSWYSIWYGEditor = _ref => {
|
|
|
64
63
|
|
|
65
64
|
const wysiwygEditorProps = {
|
|
66
65
|
value: reactDesc.PropTypes.string.description('editors value').isRequired,
|
|
67
|
-
onChange: reactDesc.PropTypes.func.description(
|
|
66
|
+
onChange: reactDesc.PropTypes.func.description(`(content, delta, source, editor) : Called back with the new contents of the editor after change.
|
|
67
|
+
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().
|
|
68
|
+
⚠️ Do not use this delta object as value, as it will cause a loop.
|
|
69
|
+
Use editor.getContents() instead. See Using Deltas for details.
|
|
70
|
+
Read more: https://github.com/zenoamaro/react-quill#props`).isRequired,
|
|
68
71
|
getQuillRef: reactDesc.PropTypes.func.description('function to use quill.js ref'),
|
|
69
72
|
quillModules: reactDesc.PropTypes.object.description('object to override quill modules'),
|
|
70
73
|
customToolbar: reactDesc.PropTypes.element.description('custom toolbar'),
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var dsIcons = require('@elliemae/ds-icons');
|
|
9
8
|
var DSUploader = require('@elliemae/ds-uploader');
|
|
@@ -36,7 +35,7 @@ const CustomImageUploader = _ref => {
|
|
|
36
35
|
index: 0,
|
|
37
36
|
length: 0
|
|
38
37
|
});
|
|
39
|
-
const elementId =
|
|
38
|
+
const elementId = `uploadImage${editorFieldName}`; // eslint-disable-next-line consistent-return
|
|
40
39
|
|
|
41
40
|
const handleFileChange = async files => {
|
|
42
41
|
if (!inProgress) {
|
|
@@ -67,7 +66,7 @@ const CustomImageUploader = _ref => {
|
|
|
67
66
|
file: fr.result
|
|
68
67
|
});
|
|
69
68
|
setIsOpen(false);
|
|
70
|
-
quillRef
|
|
69
|
+
quillRef?.getEditor().insertEmbed(lastSelection?.index || 0, 'image', url);
|
|
71
70
|
} catch (e) {
|
|
72
71
|
setError('An error has occurred, try again');
|
|
73
72
|
}
|
|
@@ -85,7 +84,7 @@ const CustomImageUploader = _ref => {
|
|
|
85
84
|
zIndex: zIndex,
|
|
86
85
|
tip: "Insert Image",
|
|
87
86
|
onClick: () => {
|
|
88
|
-
setLastSelection(quillRef
|
|
87
|
+
setLastSelection(quillRef?.getEditor().getSelection());
|
|
89
88
|
setIsOpen(true);
|
|
90
89
|
}
|
|
91
90
|
}, void 0, /*#__PURE__*/_jsx__default["default"](dsIcons.Image, {
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
-
require('core-js/modules/es.string.replace.js');
|
|
9
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
10
8
|
var React = require('react');
|
|
11
9
|
var DSButton = require('@elliemae/ds-button');
|
|
12
10
|
var dsIcons = require('@elliemae/ds-icons');
|
|
@@ -146,7 +144,7 @@ const CustomToolbar = _ref4 => {
|
|
|
146
144
|
className: "ql-header",
|
|
147
145
|
tip: "Header",
|
|
148
146
|
values: ['', '1', '2', '3', '4', '5', '6'],
|
|
149
|
-
zIndex:
|
|
147
|
+
zIndex: userProps?.zIndex || 1
|
|
150
148
|
}), _Divider || (_Divider = /*#__PURE__*/_jsx__default["default"](Divider, {}))]
|
|
151
149
|
}), !FONT && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
152
150
|
children: [/*#__PURE__*/_jsx__default["default"](TippedSelect.TippedSelect, {
|
|
@@ -155,7 +153,7 @@ const CustomToolbar = _ref4 => {
|
|
|
155
153
|
options: constants.fonts,
|
|
156
154
|
tip: "Font",
|
|
157
155
|
values: optionsToValues(constants.fonts),
|
|
158
|
-
zIndex:
|
|
156
|
+
zIndex: userProps?.zIndex || 1
|
|
159
157
|
}), _Divider2 || (_Divider2 = /*#__PURE__*/_jsx__default["default"](Divider, {}))]
|
|
160
158
|
}), !FONT_SIZE && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
161
159
|
children: [/*#__PURE__*/_jsx__default["default"](TippedSelect.TippedSelect, {
|
|
@@ -163,98 +161,98 @@ const CustomToolbar = _ref4 => {
|
|
|
163
161
|
options: constants.sizes,
|
|
164
162
|
tip: "Font Size",
|
|
165
163
|
values: optionsToValues(constants.sizesReal),
|
|
166
|
-
zIndex:
|
|
164
|
+
zIndex: userProps?.zIndex || 1
|
|
167
165
|
}), _Divider3 || (_Divider3 = /*#__PURE__*/_jsx__default["default"](Divider, {}))]
|
|
168
166
|
})), (!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
169
167
|
className: "ql-formats"
|
|
170
168
|
}, void 0, !BOLD && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
171
|
-
zIndex:
|
|
169
|
+
zIndex: userProps?.zIndex || 1,
|
|
172
170
|
className: "ql-bold",
|
|
173
171
|
tip: "Bold"
|
|
174
172
|
}), !ITALIC && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
175
|
-
zIndex:
|
|
173
|
+
zIndex: userProps?.zIndex || 1,
|
|
176
174
|
className: "ql-italic",
|
|
177
175
|
tip: "Italic"
|
|
178
176
|
}), !UNDERLINE && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
179
|
-
zIndex:
|
|
177
|
+
zIndex: userProps?.zIndex || 1,
|
|
180
178
|
className: "ql-underline",
|
|
181
179
|
tip: "Underline"
|
|
182
180
|
}), !STRIKE && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
183
|
-
zIndex:
|
|
181
|
+
zIndex: userProps?.zIndex || 1,
|
|
184
182
|
className: "ql-strike",
|
|
185
183
|
tip: "Strike"
|
|
186
184
|
})), (!SUB || !SUPER) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
187
185
|
className: "ql-formats"
|
|
188
186
|
}, void 0, !SUB && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
189
|
-
zIndex:
|
|
187
|
+
zIndex: userProps?.zIndex || 1,
|
|
190
188
|
className: "ql-script",
|
|
191
189
|
tip: "Sub",
|
|
192
190
|
value: "sub"
|
|
193
191
|
}), !SUPER && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
194
|
-
zIndex:
|
|
192
|
+
zIndex: userProps?.zIndex || 1,
|
|
195
193
|
className: "ql-script",
|
|
196
194
|
tip: "Super",
|
|
197
195
|
value: "super"
|
|
198
196
|
}), _Divider4 || (_Divider4 = /*#__PURE__*/_jsx__default["default"](Divider, {}))), (!ORDERED_LIST || !BULLET_LIST) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
199
197
|
className: "ql-formats"
|
|
200
198
|
}, void 0, !ORDERED_LIST && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
201
|
-
zIndex:
|
|
199
|
+
zIndex: userProps?.zIndex || 1,
|
|
202
200
|
className: "ql-list",
|
|
203
201
|
tip: "Ordered List",
|
|
204
202
|
value: "ordered"
|
|
205
203
|
}), !BULLET_LIST && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
206
|
-
zIndex:
|
|
204
|
+
zIndex: userProps?.zIndex || 1,
|
|
207
205
|
className: "ql-list",
|
|
208
206
|
tip: "Bullet List",
|
|
209
207
|
value: "bullet"
|
|
210
208
|
})), (!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
211
209
|
className: "ql-formats"
|
|
212
210
|
}, void 0, !INDENT_MINUS_ONE && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
213
|
-
zIndex:
|
|
211
|
+
zIndex: userProps?.zIndex || 1,
|
|
214
212
|
className: "ql-indent",
|
|
215
213
|
tip: "Indent -1",
|
|
216
214
|
value: "-1"
|
|
217
215
|
}), !INDENT_PLUS_ONE && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
218
|
-
zIndex:
|
|
216
|
+
zIndex: userProps?.zIndex || 1,
|
|
219
217
|
className: "ql-indent",
|
|
220
218
|
tip: "Indent +1",
|
|
221
219
|
value: "+1"
|
|
222
220
|
})), !ALIGN && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
223
221
|
className: "ql-formats"
|
|
224
222
|
}, void 0, /*#__PURE__*/_jsx__default["default"](TippedSelect.TippedSelect, {
|
|
225
|
-
zIndex:
|
|
223
|
+
zIndex: userProps?.zIndex || 1,
|
|
226
224
|
className: "ql-align",
|
|
227
225
|
tip: "Align"
|
|
228
226
|
}), _Divider5 || (_Divider5 = /*#__PURE__*/_jsx__default["default"](Divider, {}))), (!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
229
227
|
className: "ql-formats"
|
|
230
228
|
}, void 0, !FONT_COLOR && /*#__PURE__*/_jsx__default["default"](Colors, {
|
|
231
|
-
zIndex:
|
|
229
|
+
zIndex: userProps?.zIndex || 1,
|
|
232
230
|
className: "ql-color",
|
|
233
231
|
tip: "Font Color"
|
|
234
232
|
}), !FONT_BACKGROUND_COLOR && /*#__PURE__*/_jsx__default["default"](Colors, {
|
|
235
|
-
zIndex:
|
|
233
|
+
zIndex: userProps?.zIndex || 1,
|
|
236
234
|
className: "ql-background",
|
|
237
235
|
tip: "Font Background Color"
|
|
238
236
|
}), _Divider6 || (_Divider6 = /*#__PURE__*/_jsx__default["default"](Divider, {}))), (!HYPERLINK || !IMAGE) && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
239
237
|
className: "ql-formats"
|
|
240
238
|
}, void 0, !HYPERLINK && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
241
|
-
zIndex:
|
|
239
|
+
zIndex: userProps?.zIndex || 1,
|
|
242
240
|
className: "ql-link",
|
|
243
241
|
tip: "Hyperlink: Select Text First"
|
|
244
242
|
}), !IMAGE && /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
245
|
-
zIndex:
|
|
243
|
+
zIndex: userProps?.zIndex || 1,
|
|
246
244
|
className: "ql-image",
|
|
247
245
|
tip: "Insert Image"
|
|
248
246
|
}), _Divider7 || (_Divider7 = /*#__PURE__*/_jsx__default["default"](Divider, {}))), !CLEAR_FORMAT && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
249
247
|
className: "ql-formats"
|
|
250
248
|
}, void 0, /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
251
|
-
zIndex:
|
|
249
|
+
zIndex: userProps?.zIndex || 1,
|
|
252
250
|
className: "ql-clean",
|
|
253
251
|
tip: "Clear Format (Select Text)"
|
|
254
252
|
})), !SHOW_HTML && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
255
253
|
className: "ql-formats"
|
|
256
254
|
}, void 0, _Divider8 || (_Divider8 = /*#__PURE__*/_jsx__default["default"](Divider, {})), /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
257
|
-
zIndex:
|
|
255
|
+
zIndex: userProps?.zIndex || 1,
|
|
258
256
|
style: {
|
|
259
257
|
width: 'fit-content',
|
|
260
258
|
color: '#1e79c2',
|
|
@@ -266,7 +264,7 @@ const CustomToolbar = _ref4 => {
|
|
|
266
264
|
}, void 0, showHTML ? 'SHOW TEXT' : 'SHOW HTML')), customFields && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
267
265
|
className: "ql-formats"
|
|
268
266
|
}, void 0, _Divider9 || (_Divider9 = /*#__PURE__*/_jsx__default["default"](Divider, {})), /*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
269
|
-
zIndex:
|
|
267
|
+
zIndex: userProps?.zIndex || 1,
|
|
270
268
|
className: "ql-customFields",
|
|
271
269
|
tip: "Insert Custom Field"
|
|
272
270
|
}, void 0, _CustomFields || (_CustomFields = /*#__PURE__*/_jsx__default["default"](CustomFields, {})))), customItems && /*#__PURE__*/_jsx__default["default"]("span", {
|
|
@@ -59,7 +59,7 @@ class DSWYSIWYGEditorImpl extends React__default["default"].PureComponent {
|
|
|
59
59
|
super(props);
|
|
60
60
|
this.quillModules = _objectSpread({
|
|
61
61
|
toolbar: {
|
|
62
|
-
container: this.props.toolbarContainer ?
|
|
62
|
+
container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',
|
|
63
63
|
handlers: _objectSpread({}, this.props.toolbarHandlers)
|
|
64
64
|
},
|
|
65
65
|
clipboard: {
|
|
@@ -210,7 +210,7 @@ class DSWYSIWYGEditorImpl extends React__default["default"].PureComponent {
|
|
|
210
210
|
editorProps = _objectWithoutProperties__default["default"](_this$props, _excluded);
|
|
211
211
|
|
|
212
212
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
213
|
-
className:
|
|
213
|
+
className: `quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`,
|
|
214
214
|
children: [customToolbar || /*#__PURE__*/_jsx__default["default"](CustomToolbar.CustomToolbar, {
|
|
215
215
|
customFields: customFields,
|
|
216
216
|
onShowHTML: onShowHTML,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
6
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
7
|
require('core-js/modules/esnext.iterator.map.js');
|
|
9
8
|
require('react');
|
package/cjs/components/colors.js
CHANGED
|
@@ -9,7 +9,7 @@ function sinToHex(i, size, phase) {
|
|
|
9
9
|
const sin = Math.sin(Math.PI / size * 2 * i + phase);
|
|
10
10
|
const int = Math.floor(sin * 127) + 128;
|
|
11
11
|
const hex = int.toString(16);
|
|
12
|
-
return hex.length === 1 ?
|
|
12
|
+
return hex.length === 1 ? `0${hex}` : hex;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function getRainbowColors() {
|
|
@@ -22,7 +22,7 @@ function getRainbowColors() {
|
|
|
22
22
|
|
|
23
23
|
const green = sinToHex(idx, size, 2 * Math.PI * 2 / 3); // 240 deg
|
|
24
24
|
|
|
25
|
-
color =
|
|
25
|
+
color = `#${red}${green}${blue}`;
|
|
26
26
|
return color;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -16,9 +16,9 @@ const fields = ['Lender Name «315»', 'Lender Address «319»', 'Lender C
|
|
|
16
16
|
const getFields = function () {
|
|
17
17
|
let customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fields;
|
|
18
18
|
return customFields.map((opt, index) => ({
|
|
19
|
-
id:
|
|
19
|
+
id: `${opt}_${index}`,
|
|
20
20
|
// icon: 'ADD',
|
|
21
|
-
label:
|
|
21
|
+
label: `${opt}`,
|
|
22
22
|
onClick: opt.indexOf('«') !== -1 ? () => _this.onOptionClick(_this.getFieldCode(opt)) : null,
|
|
23
23
|
type: opt === '' ? 'separator' : null
|
|
24
24
|
}));
|
package/cjs/constants.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var colors$1 = require('./components/colors.js');
|
|
7
6
|
|
|
7
|
+
/* eslint-disable prettier/prettier */
|
|
8
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)];
|
|
9
9
|
const fonts = ['Sans Serif', 'Serif', 'Monospace', 'Arial', 'Georgia', 'Helvetica'];
|
|
10
10
|
const sizes = ['Small', 'Normal', 'Large', 'Huge'];
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
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
5
|
const hrefTagRegexp = /%7B%7B.+%7D%7D/gm;
|
|
12
6
|
const clipboardLinkWithTagMatcher = (node, delta) => {
|
|
13
7
|
if (node.origin === window.location.origin) {
|
|
@@ -15,14 +9,8 @@ const clipboardLinkWithTagMatcher = (node, delta) => {
|
|
|
15
9
|
const tagMatch = nodeHref.match(hrefTagRegexp);
|
|
16
10
|
|
|
17
11
|
if (tagMatch) {
|
|
18
|
-
var _delta$ops;
|
|
19
|
-
|
|
20
12
|
const [overWrittenHrefValue] = tagMatch;
|
|
21
|
-
const insertLinkOperation = delta
|
|
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
|
-
});
|
|
13
|
+
const insertLinkOperation = delta?.ops?.find(operation => operation?.attributes?.link?.match?.(hrefTagRegexp));
|
|
26
14
|
if (insertLinkOperation) insertLinkOperation.attributes.link = overWrittenHrefValue.replace(/%7B%7B/gm, '{{').replace(/%7D%7D/gm, '}}');
|
|
27
15
|
}
|
|
28
16
|
}
|
|
@@ -8,7 +8,7 @@ const multiplier = 2;
|
|
|
8
8
|
|
|
9
9
|
class IndentAttributor extends Parchment.Attributor.Style {
|
|
10
10
|
add(node, value) {
|
|
11
|
-
return super.add(node,
|
|
11
|
+
return super.add(node, `${value * multiplier}em`);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
value(node) {
|
|
@@ -23,7 +23,7 @@ class IndentAttributor extends Parchment.Attributor.Style {
|
|
|
23
23
|
|
|
24
24
|
const IndentStyle = new IndentAttributor('indent', 'margin-left', {
|
|
25
25
|
scope: Parchment.Scope.BLOCK,
|
|
26
|
-
whitelist: levels.map(value =>
|
|
26
|
+
whitelist: levels.map(value => `${value * multiplier}em`)
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
module.exports = IndentStyle;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
4
3
|
var ReactQuill = require('react-quill');
|
|
5
4
|
|
|
5
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
6
|
+
|
|
6
7
|
const sanitizeProtocol = value => {
|
|
7
8
|
if (typeof value === 'boolean' || value === null) return value;
|
|
8
9
|
let newVal = value;
|
|
9
10
|
|
|
10
11
|
if (!value.startsWith('http') && !value.startsWith('ftp') && !value.startsWith('mailto:') && !value.startsWith('{{')) {
|
|
11
12
|
if (!value.startsWith('www')) {
|
|
12
|
-
newVal =
|
|
13
|
-
} else newVal =
|
|
13
|
+
newVal = `https://www.${value}`;
|
|
14
|
+
} else newVal = `https://${value}`;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
return newVal;
|
|
@@ -42,9 +43,7 @@ class LinkFormat extends Link {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
static formats(domNode) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return domNode === null || domNode === void 0 ? void 0 : (_domNode$getAttribute = domNode.getAttribute) === null || _domNode$getAttribute === void 0 ? void 0 : _domNode$getAttribute.call(domNode, 'href');
|
|
46
|
+
return domNode?.getAttribute?.('href');
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
static sanitize(url) {
|
package/cjs/utils.js
CHANGED
package/esm/DSWYSIWYGEditor.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
8
|
import { useState, useEffect } from 'react';
|
|
10
9
|
import { PropTypes, describe } from 'react-desc';
|
|
11
10
|
import DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl.js';
|
|
@@ -55,7 +54,11 @@ const DSWYSIWYGEditor = _ref => {
|
|
|
55
54
|
|
|
56
55
|
const wysiwygEditorProps = {
|
|
57
56
|
value: PropTypes.string.description('editors value').isRequired,
|
|
58
|
-
onChange: PropTypes.func.description(
|
|
57
|
+
onChange: PropTypes.func.description(`(content, delta, source, editor) : Called back with the new contents of the editor after change.
|
|
58
|
+
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().
|
|
59
|
+
⚠️ Do not use this delta object as value, as it will cause a loop.
|
|
60
|
+
Use editor.getContents() instead. See Using Deltas for details.
|
|
61
|
+
Read more: https://github.com/zenoamaro/react-quill#props`).isRequired,
|
|
59
62
|
getQuillRef: PropTypes.func.description('function to use quill.js ref'),
|
|
60
63
|
quillModules: PropTypes.object.description('object to override quill modules'),
|
|
61
64
|
customToolbar: PropTypes.element.description('custom toolbar'),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
import { Image } from '@elliemae/ds-icons';
|
|
5
4
|
import DSUploader from '@elliemae/ds-uploader';
|
|
@@ -26,7 +25,7 @@ const CustomImageUploader = _ref => {
|
|
|
26
25
|
index: 0,
|
|
27
26
|
length: 0
|
|
28
27
|
});
|
|
29
|
-
const elementId =
|
|
28
|
+
const elementId = `uploadImage${editorFieldName}`; // eslint-disable-next-line consistent-return
|
|
30
29
|
|
|
31
30
|
const handleFileChange = async files => {
|
|
32
31
|
if (!inProgress) {
|
|
@@ -57,7 +56,7 @@ const CustomImageUploader = _ref => {
|
|
|
57
56
|
file: fr.result
|
|
58
57
|
});
|
|
59
58
|
setIsOpen(false);
|
|
60
|
-
quillRef
|
|
59
|
+
quillRef?.getEditor().insertEmbed(lastSelection?.index || 0, 'image', url);
|
|
61
60
|
} catch (e) {
|
|
62
61
|
setError('An error has occurred, try again');
|
|
63
62
|
}
|
|
@@ -75,7 +74,7 @@ const CustomImageUploader = _ref => {
|
|
|
75
74
|
zIndex: zIndex,
|
|
76
75
|
tip: "Insert Image",
|
|
77
76
|
onClick: () => {
|
|
78
|
-
setLastSelection(quillRef
|
|
77
|
+
setLastSelection(quillRef?.getEditor().getSelection());
|
|
79
78
|
setIsOpen(true);
|
|
80
79
|
}
|
|
81
80
|
}, void 0, /*#__PURE__*/_jsx(Image, {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
3
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
-
import 'core-js/modules/es.string.replace.js';
|
|
5
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
4
|
import { useState } from 'react';
|
|
7
5
|
import DSButton from '@elliemae/ds-button';
|
|
8
6
|
import { ArrowheadDown } from '@elliemae/ds-icons';
|
|
@@ -136,7 +134,7 @@ const CustomToolbar = _ref4 => {
|
|
|
136
134
|
className: "ql-header",
|
|
137
135
|
tip: "Header",
|
|
138
136
|
values: ['', '1', '2', '3', '4', '5', '6'],
|
|
139
|
-
zIndex:
|
|
137
|
+
zIndex: userProps?.zIndex || 1
|
|
140
138
|
}), _Divider || (_Divider = /*#__PURE__*/_jsx(Divider, {}))]
|
|
141
139
|
}), !FONT && /*#__PURE__*/jsxs(Fragment, {
|
|
142
140
|
children: [/*#__PURE__*/_jsx(TippedSelect, {
|
|
@@ -145,7 +143,7 @@ const CustomToolbar = _ref4 => {
|
|
|
145
143
|
options: fonts,
|
|
146
144
|
tip: "Font",
|
|
147
145
|
values: optionsToValues(fonts),
|
|
148
|
-
zIndex:
|
|
146
|
+
zIndex: userProps?.zIndex || 1
|
|
149
147
|
}), _Divider2 || (_Divider2 = /*#__PURE__*/_jsx(Divider, {}))]
|
|
150
148
|
}), !FONT_SIZE && /*#__PURE__*/jsxs(Fragment, {
|
|
151
149
|
children: [/*#__PURE__*/_jsx(TippedSelect, {
|
|
@@ -153,98 +151,98 @@ const CustomToolbar = _ref4 => {
|
|
|
153
151
|
options: sizes,
|
|
154
152
|
tip: "Font Size",
|
|
155
153
|
values: optionsToValues(sizesReal),
|
|
156
|
-
zIndex:
|
|
154
|
+
zIndex: userProps?.zIndex || 1
|
|
157
155
|
}), _Divider3 || (_Divider3 = /*#__PURE__*/_jsx(Divider, {}))]
|
|
158
156
|
})), (!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /*#__PURE__*/_jsx("span", {
|
|
159
157
|
className: "ql-formats"
|
|
160
158
|
}, void 0, !BOLD && /*#__PURE__*/_jsx(TippedButton, {
|
|
161
|
-
zIndex:
|
|
159
|
+
zIndex: userProps?.zIndex || 1,
|
|
162
160
|
className: "ql-bold",
|
|
163
161
|
tip: "Bold"
|
|
164
162
|
}), !ITALIC && /*#__PURE__*/_jsx(TippedButton, {
|
|
165
|
-
zIndex:
|
|
163
|
+
zIndex: userProps?.zIndex || 1,
|
|
166
164
|
className: "ql-italic",
|
|
167
165
|
tip: "Italic"
|
|
168
166
|
}), !UNDERLINE && /*#__PURE__*/_jsx(TippedButton, {
|
|
169
|
-
zIndex:
|
|
167
|
+
zIndex: userProps?.zIndex || 1,
|
|
170
168
|
className: "ql-underline",
|
|
171
169
|
tip: "Underline"
|
|
172
170
|
}), !STRIKE && /*#__PURE__*/_jsx(TippedButton, {
|
|
173
|
-
zIndex:
|
|
171
|
+
zIndex: userProps?.zIndex || 1,
|
|
174
172
|
className: "ql-strike",
|
|
175
173
|
tip: "Strike"
|
|
176
174
|
})), (!SUB || !SUPER) && /*#__PURE__*/_jsx("span", {
|
|
177
175
|
className: "ql-formats"
|
|
178
176
|
}, void 0, !SUB && /*#__PURE__*/_jsx(TippedButton, {
|
|
179
|
-
zIndex:
|
|
177
|
+
zIndex: userProps?.zIndex || 1,
|
|
180
178
|
className: "ql-script",
|
|
181
179
|
tip: "Sub",
|
|
182
180
|
value: "sub"
|
|
183
181
|
}), !SUPER && /*#__PURE__*/_jsx(TippedButton, {
|
|
184
|
-
zIndex:
|
|
182
|
+
zIndex: userProps?.zIndex || 1,
|
|
185
183
|
className: "ql-script",
|
|
186
184
|
tip: "Super",
|
|
187
185
|
value: "super"
|
|
188
186
|
}), _Divider4 || (_Divider4 = /*#__PURE__*/_jsx(Divider, {}))), (!ORDERED_LIST || !BULLET_LIST) && /*#__PURE__*/_jsx("span", {
|
|
189
187
|
className: "ql-formats"
|
|
190
188
|
}, void 0, !ORDERED_LIST && /*#__PURE__*/_jsx(TippedButton, {
|
|
191
|
-
zIndex:
|
|
189
|
+
zIndex: userProps?.zIndex || 1,
|
|
192
190
|
className: "ql-list",
|
|
193
191
|
tip: "Ordered List",
|
|
194
192
|
value: "ordered"
|
|
195
193
|
}), !BULLET_LIST && /*#__PURE__*/_jsx(TippedButton, {
|
|
196
|
-
zIndex:
|
|
194
|
+
zIndex: userProps?.zIndex || 1,
|
|
197
195
|
className: "ql-list",
|
|
198
196
|
tip: "Bullet List",
|
|
199
197
|
value: "bullet"
|
|
200
198
|
})), (!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /*#__PURE__*/_jsx("span", {
|
|
201
199
|
className: "ql-formats"
|
|
202
200
|
}, void 0, !INDENT_MINUS_ONE && /*#__PURE__*/_jsx(TippedButton, {
|
|
203
|
-
zIndex:
|
|
201
|
+
zIndex: userProps?.zIndex || 1,
|
|
204
202
|
className: "ql-indent",
|
|
205
203
|
tip: "Indent -1",
|
|
206
204
|
value: "-1"
|
|
207
205
|
}), !INDENT_PLUS_ONE && /*#__PURE__*/_jsx(TippedButton, {
|
|
208
|
-
zIndex:
|
|
206
|
+
zIndex: userProps?.zIndex || 1,
|
|
209
207
|
className: "ql-indent",
|
|
210
208
|
tip: "Indent +1",
|
|
211
209
|
value: "+1"
|
|
212
210
|
})), !ALIGN && /*#__PURE__*/_jsx("span", {
|
|
213
211
|
className: "ql-formats"
|
|
214
212
|
}, void 0, /*#__PURE__*/_jsx(TippedSelect, {
|
|
215
|
-
zIndex:
|
|
213
|
+
zIndex: userProps?.zIndex || 1,
|
|
216
214
|
className: "ql-align",
|
|
217
215
|
tip: "Align"
|
|
218
216
|
}), _Divider5 || (_Divider5 = /*#__PURE__*/_jsx(Divider, {}))), (!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /*#__PURE__*/_jsx("span", {
|
|
219
217
|
className: "ql-formats"
|
|
220
218
|
}, void 0, !FONT_COLOR && /*#__PURE__*/_jsx(Colors, {
|
|
221
|
-
zIndex:
|
|
219
|
+
zIndex: userProps?.zIndex || 1,
|
|
222
220
|
className: "ql-color",
|
|
223
221
|
tip: "Font Color"
|
|
224
222
|
}), !FONT_BACKGROUND_COLOR && /*#__PURE__*/_jsx(Colors, {
|
|
225
|
-
zIndex:
|
|
223
|
+
zIndex: userProps?.zIndex || 1,
|
|
226
224
|
className: "ql-background",
|
|
227
225
|
tip: "Font Background Color"
|
|
228
226
|
}), _Divider6 || (_Divider6 = /*#__PURE__*/_jsx(Divider, {}))), (!HYPERLINK || !IMAGE) && /*#__PURE__*/_jsx("span", {
|
|
229
227
|
className: "ql-formats"
|
|
230
228
|
}, void 0, !HYPERLINK && /*#__PURE__*/_jsx(TippedButton, {
|
|
231
|
-
zIndex:
|
|
229
|
+
zIndex: userProps?.zIndex || 1,
|
|
232
230
|
className: "ql-link",
|
|
233
231
|
tip: "Hyperlink: Select Text First"
|
|
234
232
|
}), !IMAGE && /*#__PURE__*/_jsx(TippedButton, {
|
|
235
|
-
zIndex:
|
|
233
|
+
zIndex: userProps?.zIndex || 1,
|
|
236
234
|
className: "ql-image",
|
|
237
235
|
tip: "Insert Image"
|
|
238
236
|
}), _Divider7 || (_Divider7 = /*#__PURE__*/_jsx(Divider, {}))), !CLEAR_FORMAT && /*#__PURE__*/_jsx("span", {
|
|
239
237
|
className: "ql-formats"
|
|
240
238
|
}, void 0, /*#__PURE__*/_jsx(TippedButton, {
|
|
241
|
-
zIndex:
|
|
239
|
+
zIndex: userProps?.zIndex || 1,
|
|
242
240
|
className: "ql-clean",
|
|
243
241
|
tip: "Clear Format (Select Text)"
|
|
244
242
|
})), !SHOW_HTML && /*#__PURE__*/_jsx("span", {
|
|
245
243
|
className: "ql-formats"
|
|
246
244
|
}, void 0, _Divider8 || (_Divider8 = /*#__PURE__*/_jsx(Divider, {})), /*#__PURE__*/_jsx(TippedButton, {
|
|
247
|
-
zIndex:
|
|
245
|
+
zIndex: userProps?.zIndex || 1,
|
|
248
246
|
style: {
|
|
249
247
|
width: 'fit-content',
|
|
250
248
|
color: '#1e79c2',
|
|
@@ -256,7 +254,7 @@ const CustomToolbar = _ref4 => {
|
|
|
256
254
|
}, void 0, showHTML ? 'SHOW TEXT' : 'SHOW HTML')), customFields && /*#__PURE__*/_jsx("span", {
|
|
257
255
|
className: "ql-formats"
|
|
258
256
|
}, void 0, _Divider9 || (_Divider9 = /*#__PURE__*/_jsx(Divider, {})), /*#__PURE__*/_jsx(TippedButton, {
|
|
259
|
-
zIndex:
|
|
257
|
+
zIndex: userProps?.zIndex || 1,
|
|
260
258
|
className: "ql-customFields",
|
|
261
259
|
tip: "Insert Custom Field"
|
|
262
260
|
}, void 0, _CustomFields || (_CustomFields = /*#__PURE__*/_jsx(CustomFields, {})))), customItems && /*#__PURE__*/_jsx("span", {
|
|
@@ -48,7 +48,7 @@ class DSWYSIWYGEditorImpl extends React.PureComponent {
|
|
|
48
48
|
super(props);
|
|
49
49
|
this.quillModules = _objectSpread({
|
|
50
50
|
toolbar: {
|
|
51
|
-
container: this.props.toolbarContainer ?
|
|
51
|
+
container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',
|
|
52
52
|
handlers: _objectSpread({}, this.props.toolbarHandlers)
|
|
53
53
|
},
|
|
54
54
|
clipboard: {
|
|
@@ -199,7 +199,7 @@ class DSWYSIWYGEditorImpl extends React.PureComponent {
|
|
|
199
199
|
editorProps = _objectWithoutProperties(_this$props, _excluded);
|
|
200
200
|
|
|
201
201
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
202
|
-
className:
|
|
202
|
+
className: `quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`,
|
|
203
203
|
children: [customToolbar || /*#__PURE__*/_jsx(CustomToolbar, {
|
|
204
204
|
customFields: customFields,
|
|
205
205
|
onShowHTML: onShowHTML,
|
package/esm/components/colors.js
CHANGED
|
@@ -5,7 +5,7 @@ function sinToHex(i, size, phase) {
|
|
|
5
5
|
const sin = Math.sin(Math.PI / size * 2 * i + phase);
|
|
6
6
|
const int = Math.floor(sin * 127) + 128;
|
|
7
7
|
const hex = int.toString(16);
|
|
8
|
-
return hex.length === 1 ?
|
|
8
|
+
return hex.length === 1 ? `0${hex}` : hex;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function getRainbowColors() {
|
|
@@ -18,7 +18,7 @@ function getRainbowColors() {
|
|
|
18
18
|
|
|
19
19
|
const green = sinToHex(idx, size, 2 * Math.PI * 2 / 3); // 240 deg
|
|
20
20
|
|
|
21
|
-
color =
|
|
21
|
+
color = `#${red}${green}${blue}`;
|
|
22
22
|
return color;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -12,9 +12,9 @@ const fields = ['Lender Name «315»', 'Lender Address «319»', 'Lender C
|
|
|
12
12
|
const getFields = function () {
|
|
13
13
|
let customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fields;
|
|
14
14
|
return customFields.map((opt, index) => ({
|
|
15
|
-
id:
|
|
15
|
+
id: `${opt}_${index}`,
|
|
16
16
|
// icon: 'ADD',
|
|
17
|
-
label:
|
|
17
|
+
label: `${opt}`,
|
|
18
18
|
onClick: opt.indexOf('«') !== -1 ? () => _this.onOptionClick(_this.getFieldCode(opt)) : null,
|
|
19
19
|
type: opt === '' ? 'separator' : null
|
|
20
20
|
}));
|
package/esm/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { getRainbowColors } from './components/colors.js';
|
|
3
2
|
|
|
3
|
+
/* eslint-disable prettier/prettier */
|
|
4
4
|
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', ...getRainbowColors(28)];
|
|
5
5
|
const fonts = ['Sans Serif', 'Serif', 'Monospace', 'Arial', 'Georgia', 'Helvetica'];
|
|
6
6
|
const sizes = ['Small', 'Normal', 'Large', 'Huge'];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
-
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.find.js';
|
|
5
|
-
import 'core-js/modules/es.string.replace.js';
|
|
6
|
-
|
|
7
1
|
const hrefTagRegexp = /%7B%7B.+%7D%7D/gm;
|
|
8
2
|
const clipboardLinkWithTagMatcher = (node, delta) => {
|
|
9
3
|
if (node.origin === window.location.origin) {
|
|
@@ -11,14 +5,8 @@ const clipboardLinkWithTagMatcher = (node, delta) => {
|
|
|
11
5
|
const tagMatch = nodeHref.match(hrefTagRegexp);
|
|
12
6
|
|
|
13
7
|
if (tagMatch) {
|
|
14
|
-
var _delta$ops;
|
|
15
|
-
|
|
16
8
|
const [overWrittenHrefValue] = tagMatch;
|
|
17
|
-
const insertLinkOperation = delta
|
|
18
|
-
var _operation$attributes, _operation$attributes2, _operation$attributes3;
|
|
19
|
-
|
|
20
|
-
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);
|
|
21
|
-
});
|
|
9
|
+
const insertLinkOperation = delta?.ops?.find(operation => operation?.attributes?.link?.match?.(hrefTagRegexp));
|
|
22
10
|
if (insertLinkOperation) insertLinkOperation.attributes.link = overWrittenHrefValue.replace(/%7B%7B/gm, '{{').replace(/%7D%7D/gm, '}}');
|
|
23
11
|
}
|
|
24
12
|
}
|
|
@@ -6,7 +6,7 @@ const multiplier = 2;
|
|
|
6
6
|
|
|
7
7
|
class IndentAttributor extends Parchment.Attributor.Style {
|
|
8
8
|
add(node, value) {
|
|
9
|
-
return super.add(node,
|
|
9
|
+
return super.add(node, `${value * multiplier}em`);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
value(node) {
|
|
@@ -21,7 +21,7 @@ class IndentAttributor extends Parchment.Attributor.Style {
|
|
|
21
21
|
|
|
22
22
|
const IndentStyle = new IndentAttributor('indent', 'margin-left', {
|
|
23
23
|
scope: Parchment.Scope.BLOCK,
|
|
24
|
-
whitelist: levels.map(value =>
|
|
24
|
+
whitelist: levels.map(value => `${value * multiplier}em`)
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
export { IndentStyle as default };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import { Quill } from 'react-quill';
|
|
3
2
|
|
|
3
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
4
|
+
|
|
4
5
|
const sanitizeProtocol = value => {
|
|
5
6
|
if (typeof value === 'boolean' || value === null) return value;
|
|
6
7
|
let newVal = value;
|
|
7
8
|
|
|
8
9
|
if (!value.startsWith('http') && !value.startsWith('ftp') && !value.startsWith('mailto:') && !value.startsWith('{{')) {
|
|
9
10
|
if (!value.startsWith('www')) {
|
|
10
|
-
newVal =
|
|
11
|
-
} else newVal =
|
|
11
|
+
newVal = `https://www.${value}`;
|
|
12
|
+
} else newVal = `https://${value}`;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
return newVal;
|
|
@@ -40,9 +41,7 @@ class LinkFormat extends Link {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
static formats(domNode) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return domNode === null || domNode === void 0 ? void 0 : (_domNode$getAttribute = domNode.getAttribute) === null || _domNode$getAttribute === void 0 ? void 0 : _domNode$getAttribute.call(domNode, 'href');
|
|
44
|
+
return domNode?.getAttribute?.('href');
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
static sanitize(url) {
|
package/esm/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wysiwygeditor",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3-rc.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - WYSIWYG Editor",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -96,14 +96,14 @@
|
|
|
96
96
|
"build": "node ../../scripts/build/build.js"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@elliemae/ds-button": "2.4.
|
|
100
|
-
"@elliemae/ds-dropdownmenu": "2.4.
|
|
101
|
-
"@elliemae/ds-icons": "2.4.
|
|
102
|
-
"@elliemae/ds-imagelibrarymodal": "2.4.
|
|
103
|
-
"@elliemae/ds-modal": "2.4.
|
|
104
|
-
"@elliemae/ds-shared": "2.4.
|
|
105
|
-
"@elliemae/ds-tooltip": "2.4.
|
|
106
|
-
"@elliemae/ds-uploader": "2.4.
|
|
99
|
+
"@elliemae/ds-button": "2.4.3-rc.2",
|
|
100
|
+
"@elliemae/ds-dropdownmenu": "2.4.3-rc.2",
|
|
101
|
+
"@elliemae/ds-icons": "2.4.3-rc.2",
|
|
102
|
+
"@elliemae/ds-imagelibrarymodal": "2.4.3-rc.2",
|
|
103
|
+
"@elliemae/ds-modal": "2.4.3-rc.2",
|
|
104
|
+
"@elliemae/ds-shared": "2.4.3-rc.2",
|
|
105
|
+
"@elliemae/ds-tooltip": "2.4.3-rc.2",
|
|
106
|
+
"@elliemae/ds-uploader": "2.4.3-rc.2",
|
|
107
107
|
"prop-types": "~15.7.2",
|
|
108
108
|
"quill-blot-formatter": "~1.0.5",
|
|
109
109
|
"quill-delta": "4.2.2",
|