@elliemae/ds-wysiwygeditor 2.3.1 → 3.0.0-alpha.3

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.
Files changed (120) hide show
  1. package/dist/cjs/DSWYSIWYGEditor.js +128 -0
  2. package/dist/cjs/DSWYSIWYGEditor.js.map +7 -0
  3. package/dist/cjs/components/CustomImageUploader.js +123 -0
  4. package/dist/cjs/components/CustomImageUploader.js.map +7 -0
  5. package/dist/cjs/components/CustomToolbar.js +261 -0
  6. package/dist/cjs/components/CustomToolbar.js.map +7 -0
  7. package/dist/cjs/components/DSWYSIWYGEditorImpl.js +255 -0
  8. package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +7 -0
  9. package/dist/cjs/components/ImageLibraryModal.js +108 -0
  10. package/dist/cjs/components/ImageLibraryModal.js.map +7 -0
  11. package/dist/cjs/components/InsertFieldModal.js +212 -0
  12. package/dist/cjs/components/InsertFieldModal.js.map +7 -0
  13. package/dist/cjs/components/TippedButton.js +91 -0
  14. package/dist/cjs/components/TippedButton.js.map +7 -0
  15. package/dist/cjs/components/TippedSelect.js +57 -0
  16. package/dist/cjs/components/TippedSelect.js.map +7 -0
  17. package/dist/cjs/components/colors.js +50 -0
  18. package/dist/cjs/components/colors.js.map +7 -0
  19. package/dist/cjs/components/customFields.js +76 -0
  20. package/dist/cjs/components/customFields.js.map +7 -0
  21. package/dist/cjs/constants.js +114 -0
  22. package/dist/cjs/constants.js.map +7 -0
  23. package/dist/cjs/index.js +39 -0
  24. package/dist/cjs/index.js.map +7 -0
  25. package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +48 -0
  26. package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
  27. package/dist/cjs/quillOverrides/IndentStyle.js +51 -0
  28. package/dist/cjs/quillOverrides/IndentStyle.js.map +7 -0
  29. package/dist/cjs/quillOverrides/LinkFormat.js +86 -0
  30. package/dist/cjs/quillOverrides/LinkFormat.js.map +7 -0
  31. package/dist/cjs/quillOverrides/PlainClipboard.js +47 -0
  32. package/dist/cjs/quillOverrides/PlainClipboard.js.map +7 -0
  33. package/dist/cjs/utils.js +50 -0
  34. package/dist/cjs/utils.js.map +7 -0
  35. package/dist/esm/DSWYSIWYGEditor.js +101 -0
  36. package/dist/esm/DSWYSIWYGEditor.js.map +7 -0
  37. package/dist/esm/components/CustomImageUploader.js +94 -0
  38. package/dist/esm/components/CustomImageUploader.js.map +7 -0
  39. package/dist/esm/components/CustomToolbar.js +232 -0
  40. package/dist/esm/components/CustomToolbar.js.map +7 -0
  41. package/dist/esm/components/DSWYSIWYGEditorImpl.js +228 -0
  42. package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +7 -0
  43. package/dist/esm/components/ImageLibraryModal.js +81 -0
  44. package/dist/esm/components/ImageLibraryModal.js.map +7 -0
  45. package/dist/esm/components/InsertFieldModal.js +185 -0
  46. package/dist/esm/components/InsertFieldModal.js.map +7 -0
  47. package/dist/esm/components/TippedButton.js +64 -0
  48. package/dist/esm/components/TippedButton.js.map +7 -0
  49. package/dist/esm/components/TippedSelect.js +28 -0
  50. package/dist/esm/components/TippedSelect.js.map +7 -0
  51. package/dist/esm/components/colors.js +21 -0
  52. package/dist/esm/components/colors.js.map +7 -0
  53. package/dist/esm/components/customFields.js +47 -0
  54. package/dist/esm/components/customFields.js.map +7 -0
  55. package/dist/esm/constants.js +85 -0
  56. package/dist/esm/constants.js.map +7 -0
  57. package/dist/esm/index.js +10 -0
  58. package/dist/esm/index.js.map +7 -0
  59. package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js +19 -0
  60. package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
  61. package/dist/esm/quillOverrides/IndentStyle.js +22 -0
  62. package/dist/esm/quillOverrides/IndentStyle.js.map +7 -0
  63. package/dist/esm/quillOverrides/LinkFormat.js +57 -0
  64. package/dist/esm/quillOverrides/LinkFormat.js.map +7 -0
  65. package/dist/esm/quillOverrides/PlainClipboard.js +18 -0
  66. package/dist/esm/quillOverrides/PlainClipboard.js.map +7 -0
  67. package/dist/esm/utils.js +21 -0
  68. package/dist/esm/utils.js.map +7 -0
  69. package/package.json +64 -55
  70. package/cjs/DSWYSIWYGEditor.js +0 -82
  71. package/cjs/components/CustomImageUploader.js +0 -125
  72. package/cjs/components/CustomToolbar.js +0 -282
  73. package/cjs/components/DSWYSIWYGEditorImpl.js +0 -256
  74. package/cjs/components/ImageLibraryModal.js +0 -72
  75. package/cjs/components/InsertFieldModal.js +0 -218
  76. package/cjs/components/TippedButton.js +0 -56
  77. package/cjs/components/TippedSelect.js +0 -46
  78. package/cjs/components/colors.js +0 -30
  79. package/cjs/components/customFields.js +0 -57
  80. package/cjs/constants.js +0 -40
  81. package/cjs/index.js +0 -21
  82. package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +0 -33
  83. package/cjs/quillOverrides/IndentStyle.js +0 -29
  84. package/cjs/quillOverrides/LinkFormat.js +0 -68
  85. package/cjs/quillOverrides/PlainClipboard.js +0 -27
  86. package/cjs/utils.js +0 -27
  87. package/esm/DSWYSIWYGEditor.js +0 -72
  88. package/esm/components/CustomImageUploader.js +0 -115
  89. package/esm/components/CustomToolbar.js +0 -271
  90. package/esm/components/DSWYSIWYGEditorImpl.js +0 -245
  91. package/esm/components/ImageLibraryModal.js +0 -64
  92. package/esm/components/InsertFieldModal.js +0 -208
  93. package/esm/components/TippedButton.js +0 -46
  94. package/esm/components/TippedSelect.js +0 -38
  95. package/esm/components/colors.js +0 -26
  96. package/esm/components/customFields.js +0 -49
  97. package/esm/constants.js +0 -32
  98. package/esm/index.js +0 -4
  99. package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +0 -29
  100. package/esm/quillOverrides/IndentStyle.js +0 -27
  101. package/esm/quillOverrides/LinkFormat.js +0 -66
  102. package/esm/quillOverrides/PlainClipboard.js +0 -25
  103. package/esm/utils.js +0 -23
  104. package/types/DSWYSIWYGEditor.d.ts +0 -75
  105. package/types/components/CustomImageUploader.d.ts +0 -8
  106. package/types/components/CustomToolbar.d.ts +0 -21
  107. package/types/components/DSWYSIWYGEditorImpl.d.ts +0 -15
  108. package/types/components/ImageLibraryModal.d.ts +0 -31
  109. package/types/components/InsertFieldModal.d.ts +0 -41
  110. package/types/components/TippedButton.d.ts +0 -12
  111. package/types/components/TippedSelect.d.ts +0 -13
  112. package/types/components/colors.d.ts +0 -1
  113. package/types/components/customFields.d.ts +0 -36
  114. package/types/constants.d.ts +0 -26
  115. package/types/index.d.ts +0 -4
  116. package/types/quillMatchers/clipboardLinkWithTagMatcher.d.ts +0 -2
  117. package/types/quillOverrides/IndentStyle.d.ts +0 -10
  118. package/types/quillOverrides/LinkFormat.d.ts +0 -12
  119. package/types/quillOverrides/PlainClipboard.d.ts +0 -8
  120. package/types/utils.d.ts +0 -1
@@ -1,218 +0,0 @@
1
- 'use strict';
2
-
3
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
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');
13
- var React = require('react');
14
- var DSModal = require('@elliemae/ds-modal');
15
- var constants = require('@elliemae/ds-shared/constants');
16
- var lodash = require('lodash');
17
- var customFields = require('./customFields.js');
18
- var jsxRuntime = require('react/jsx-runtime');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
-
22
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
23
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
24
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
25
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
- var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
27
-
28
- const _excluded = ["customFields", "onSelect"];
29
-
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
- const modalTypes = Object.values(DSModal.MODAL_TYPE);
34
- const elementClassName = 'insertfieldmodal-element';
35
- class InsertFieldModal extends React__default["default"].PureComponent {
36
- constructor(props) {
37
- super(props);
38
-
39
- this.onConfirm = () => {
40
- const {
41
- onConfirm,
42
- onClose
43
- } = this.props;
44
- const {
45
- selectedFieldCode
46
- } = this.state;
47
- onConfirm(selectedFieldCode);
48
- onClose();
49
- };
50
-
51
- this.onReject = () => {
52
- const {
53
- onReject,
54
- onClose
55
- } = this.props;
56
-
57
- if (onReject) {
58
- onReject();
59
- } else {
60
- onClose();
61
- }
62
- };
63
-
64
- this.drawDiv = (className, content, content2) => /*#__PURE__*/_jsx__default["default"]("div", {
65
- className: className
66
- }, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, content), /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, content2));
67
-
68
- this.drawLabel = (className, label, value) => /*#__PURE__*/_jsx__default["default"]("div", {
69
- className: className
70
- }, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
71
- className: "label"
72
- }, void 0, label), /*#__PURE__*/_jsx__default["default"]("span", {
73
- className: "value"
74
- }, void 0, value));
75
-
76
- this.handleElementClick = (e, selectedFieldCode) => {
77
- if (e.key && e.key !== ' ') {
78
- return;
79
- }
80
-
81
- const {
82
- selectedFieldCode: fCode
83
- } = this.state;
84
- const {
85
- disableDoubleClick
86
- } = this.props;
87
-
88
- if (selectedFieldCode === fCode && !disableDoubleClick) {
89
- this.onConfirm();
90
- return;
91
- }
92
-
93
- this.setState({
94
- selectedFieldCode
95
- });
96
- const {
97
- onSelect
98
- } = this.props;
99
-
100
- if (onSelect) {
101
- onSelect(selectedFieldCode);
102
- }
103
- };
104
-
105
- this.preventSpacebarScroll = () => {
106
- document.onkeypress = function (e) {
107
- if (!lodash.includes(e.target.className, elementClassName)) {
108
- return true;
109
- }
110
-
111
- e = e || window.event;
112
- const charCode = e.keyCode || e.which;
113
-
114
- if (charCode === 32) {
115
- e.preventDefault();
116
- return false;
117
- }
118
-
119
- return true;
120
- };
121
- };
122
-
123
- this.renderElements = () => {
124
- const {
125
- customFields: customFields$1
126
- } = this.props;
127
-
128
- if (!customFields$1) {
129
- return 'Empty';
130
- }
131
-
132
- const {
133
- selectedFieldCode
134
- } = this.state;
135
- return customFields$1.map((customField, idx) => {
136
- const extras = {};
137
- const fieldCode = customFields.getFieldCode(customField);
138
-
139
- if (this.focusFirst && idx === 0) {
140
- extras.ref = element => element && element.focus();
141
-
142
- this.focusFirst = undefined;
143
- } else if (fieldCode === selectedFieldCode) {
144
- extras.ref = element => element && element.focus();
145
- }
146
-
147
- return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
148
- className: elementClassName,
149
- onClick: e => this.handleElementClick(e, fieldCode),
150
- onKeyUp: e => this.handleElementClick(e, fieldCode),
151
- role: "button",
152
- tabIndex: 0
153
- }, extras), {}, {
154
- children: this.drawLabel('content', customFields.getFieldName(customField), fieldCode)
155
- }), fieldCode);
156
- });
157
- };
158
-
159
- this.state = {
160
- selectedFieldCode: customFields.getFieldCode(customFields.fields[0])
161
- };
162
- this.preventSpacebarScroll();
163
- }
164
-
165
- componentDidMount() {
166
- const {
167
- customFields
168
- } = this.props;
169
-
170
- if (customFields) {
171
- this.handleElementClick({}, customFields[0]);
172
- this.focusFirst = true;
173
- }
174
- }
175
-
176
- getDerivedStateFromProps(nextProps) {
177
- const {
178
- customFields
179
- } = this.props;
180
-
181
- if (!customFields && nextProps.customFields) {
182
- this.setState({
183
- selectedFieldCode: customFields[0]
184
- });
185
- }
186
- }
187
-
188
- render() {
189
- const _this$props = this.props,
190
- modalProps = _objectWithoutProperties__default["default"](_this$props, _excluded);
191
-
192
- return /*#__PURE__*/jsxRuntime.jsx(DSModal__default["default"], _objectSpread(_objectSpread({}, modalProps), {}, {
193
- className: "insert-field-modal",
194
- onConfirm: this.onConfirm,
195
- onReject: this.onReject,
196
- children: /*#__PURE__*/_jsx__default["default"]("div", {
197
- className: "wrapper"
198
- }, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
199
- className: "col-1"
200
- }, void 0, this.drawDiv('title', 'Field Name', '« Field ID »'), this.renderElements()))
201
- }));
202
- }
203
-
204
- }
205
- InsertFieldModal.defaultProps = {
206
- confirmLabel: 'Add',
207
- customFields: customFields.fields,
208
- disableDoubleClick: false,
209
- isOpen: true,
210
- modalTitle: 'Add Field',
211
- modalType: modalTypes[1],
212
- rejectLabel: 'Cancel',
213
- shouldCloseOnOverlayClick: true,
214
- size: constants.sizeOptions[1],
215
- onSelect: undefined
216
- };
217
-
218
- module.exports = InsertFieldModal;
@@ -1,56 +0,0 @@
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); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
- withoutPortal: false
44
- }, void 0, /*#__PURE__*/jsxRuntime.jsx("button", _objectSpread(_objectSpread({
45
- type: "button",
46
- className: className,
47
- onClick: e => {
48
- e.preventDefault();
49
- onClick(e);
50
- }
51
- }, rest), {}, {
52
- children: children
53
- }))));
54
- };
55
-
56
- exports.TippedButton = TippedButton;
@@ -1,46 +0,0 @@
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
- withoutPortal: false
36
- }, void 0, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/_jsx__default["default"]("select", {
37
- className: className,
38
- defaultValue: defaultValue,
39
- onChange: e => {
40
- e.persist();
41
- onChange(e);
42
- }
43
- }, void 0, children || fallBackChildren))));
44
- };
45
-
46
- exports.TippedSelect = TippedSelect;
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.map.js');
6
- require('core-js/modules/esnext.iterator.map.js');
7
-
8
- function sinToHex(i, size, phase) {
9
- const sin = Math.sin(Math.PI / size * 2 * i + phase);
10
- const int = Math.floor(sin * 127) + 128;
11
- const hex = int.toString(16);
12
- return hex.length === 1 ? "0".concat(hex) : hex;
13
- }
14
-
15
- function getRainbowColors() {
16
- let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 28;
17
- const colors = new Array(size).fill(undefined);
18
- return colors.map((color, idx) => {
19
- const red = sinToHex(idx, size, 0 * Math.PI * 2 / 3); // 0 deg
20
-
21
- const blue = sinToHex(idx, size, 1 * Math.PI * 2 / 3); // 120 deg
22
-
23
- const green = sinToHex(idx, size, 2 * Math.PI * 2 / 3); // 240 deg
24
-
25
- color = "#".concat(red).concat(green).concat(blue);
26
- return color;
27
- });
28
- }
29
-
30
- exports.getRainbowColors = getRainbowColors;
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
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;
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»'];
10
- /**
11
- * Returns the fields names
12
- *
13
- * @param customFields
14
- */
15
-
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
- };
26
- /**
27
- * Returns a field's name
28
- *
29
- * @param field
30
- */
31
-
32
- const getFieldName = field => {
33
- const codeIndex = field.indexOf('«');
34
- return field.substring(0, codeIndex);
35
- };
36
- /**
37
- * Returns a field's id. E.g: «456»
38
- *
39
- * @param field
40
- */
41
-
42
- const getFieldCode = field => {
43
- const codeIndex = field.indexOf('«');
44
- return field.substring(codeIndex);
45
- };
46
- var customFields = {
47
- fields,
48
- getFields,
49
- getFieldName,
50
- getFieldCode
51
- };
52
-
53
- exports["default"] = customFields;
54
- exports.fields = fields;
55
- exports.getFieldCode = getFieldCode;
56
- exports.getFieldName = getFieldName;
57
- exports.getFields = getFields;
package/cjs/constants.js DELETED
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
- var colors$1 = require('./components/colors.js');
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)];
9
- const fonts = ['Sans Serif', 'Serif', 'Monospace', 'Arial', 'Georgia', 'Helvetica'];
10
- const sizes = ['Small', 'Normal', 'Large', 'Huge'];
11
- const sizesReal = [// https://www.w3schools.com/cssref/pr_font_font-size.asp
12
- 'X-Small', 'Normal', 'Large', 'X-Large'];
13
- const defaultItems = {
14
- HEADER: 'header',
15
- FONT: 'font',
16
- FONT_SIZE: 'size',
17
- BOLD: 'bold',
18
- ITALIC: 'italic',
19
- UNDERLINE: 'underline',
20
- STRIKE: 'strike',
21
- SUB: 'sub',
22
- SUPER: 'super',
23
- ORDERED_LIST: 'ordered list',
24
- BULLET_LIST: 'bullet list',
25
- INDENT_MINUS_ONE: 'indent -1',
26
- INDENT_PLUS_ONE: 'indent +1',
27
- ALIGN: 'align',
28
- FONT_COLOR: 'font color',
29
- FONT_BACKGROUND_COLOR: 'font background color',
30
- HYPERLINK: 'hyperlink',
31
- IMAGE: 'image',
32
- CLEAR_FORMAT: 'clear format',
33
- SHOW_HTML: 'show html'
34
- };
35
-
36
- exports.colors = colors;
37
- exports.defaultItems = defaultItems;
38
- exports.fonts = fonts;
39
- exports.sizes = sizes;
40
- exports.sizesReal = sizesReal;
package/cjs/index.js DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSWYSIWYGEditor = require('./DSWYSIWYGEditor.js');
6
- var CustomToolbar = require('./components/CustomToolbar.js');
7
- var CustomImageUploader = require('./components/CustomImageUploader.js');
8
- var constants = require('./constants.js');
9
-
10
-
11
-
12
- exports.WYSIWYWithSchema = DSWYSIWYGEditor.WYSIWYWithSchema;
13
- exports["default"] = DSWYSIWYGEditor["default"];
14
- exports.CustomDropdown = CustomToolbar.CustomDropdown;
15
- exports.CustomToolbar = CustomToolbar.CustomToolbar;
16
- exports.CustomImageUploader = CustomImageUploader.CustomImageUploader;
17
- exports.colors = constants.colors;
18
- exports.defaultItems = constants.defaultItems;
19
- exports.fonts = constants.fonts;
20
- exports.sizes = constants.sizes;
21
- exports.sizesReal = constants.sizesReal;
@@ -1,33 +0,0 @@
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;
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- var ReactQuill = require('react-quill');
4
-
5
- const Parchment = ReactQuill.Quill.import('parchment');
6
- const levels = [1, 2, 3, 4, 5];
7
- const multiplier = 2;
8
-
9
- class IndentAttributor extends Parchment.Attributor.Style {
10
- add(node, value) {
11
- return super.add(node, "".concat(value * multiplier, "em"));
12
- }
13
-
14
- value(node) {
15
- return parseFloat(super.value(node)) / multiplier || undefined; // Don't return NaN
16
- }
17
-
18
- }
19
- /**
20
- * Meant to override quill's indent format's style and add the indentation inline instead of applying a class
21
- */
22
-
23
-
24
- const IndentStyle = new IndentAttributor('indent', 'margin-left', {
25
- scope: Parchment.Scope.BLOCK,
26
- whitelist: levels.map(value => "".concat(value * multiplier, "em"))
27
- });
28
-
29
- module.exports = IndentStyle;
@@ -1,68 +0,0 @@
1
- 'use strict';
2
-
3
- require('core-js/modules/web.dom-collections.iterator.js');
4
- var ReactQuill = require('react-quill');
5
-
6
- const sanitizeProtocol = value => {
7
- if (typeof value === 'boolean') return value;
8
- let newVal = value;
9
-
10
- if (!value.startsWith('http') && !value.startsWith('ftp') && !value.startsWith('mailto:') && !value.startsWith('{{')) {
11
- if (!value.startsWith('www')) {
12
- newVal = "https://www.".concat(value);
13
- } else newVal = "https://".concat(value);
14
- }
15
-
16
- return newVal;
17
- };
18
-
19
- function getIsValidProtocol(url, protocols) {
20
- const anchor = document.createElement('a');
21
- anchor.href = url;
22
- const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
23
- return protocols.indexOf(protocol) > -1;
24
- }
25
-
26
- const Link = ReactQuill.Quill.import('formats/link');
27
-
28
- class LinkFormat extends Link {
29
- constructor() {
30
- super(...arguments);
31
- this.blotName = 'link';
32
- this.tagName = 'A';
33
- this.SANITIZED_URL = 'about:blank';
34
- this.PROTOCOL_WHITELIST = ['http', 'ftp', 'https', 'mailto', 'tel'];
35
- }
36
-
37
- static create(value) {
38
- const newVal = sanitizeProtocol(value);
39
- const node = super.create(newVal);
40
- node.setAttribute('href', newVal);
41
- return node;
42
- }
43
-
44
- static formats(domNode) {
45
- var _domNode$getAttribute;
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');
48
- }
49
-
50
- static sanitize(url) {
51
- return getIsValidProtocol(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
52
- }
53
-
54
- format(name, value) {
55
- const newVal = sanitizeProtocol(value); // Remove link case
56
-
57
- if (name === 'link' && value === false) {
58
- this.domNode.removeAttribute('href');
59
- } else if (name !== this.statics.blotName || !newVal) {
60
- super.format(name, newVal);
61
- } else {
62
- this.domNode.setAttribute('href', this.constructor.sanitize(newVal));
63
- }
64
- }
65
-
66
- }
67
-
68
- module.exports = LinkFormat;
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var ReactQuill = require('react-quill');
4
-
5
- const Clipboard = ReactQuill.Quill.import('modules/clipboard');
6
- const Delta = ReactQuill.Quill.import('delta');
7
- /**
8
- * Just for the sake of an example. https://quilljs.com/docs/modules/
9
- */
10
-
11
- class PlainClipboard extends Clipboard {
12
- convert() {
13
- let html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
14
-
15
- if (typeof html === 'string') {
16
- this.container.innerHTML = html;
17
- }
18
-
19
- const text = this.container.innerText;
20
- this.container.innerHTML = '';
21
- return new Delta().insert(text);
22
- }
23
-
24
- } // Uncomment if adding custom clipboard, or add in the file you are importing this to
25
- // Quill.register('modules/clipboard', PlainClipboard)
26
-
27
- module.exports = PlainClipboard;
package/cjs/utils.js DELETED
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.for-each.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.for-each.js');
8
-
9
- const formatHTML = html => {
10
- const tab = '\t';
11
- let result = '';
12
- let indent = '';
13
- html.split(/>\s*</).forEach(element => {
14
- if (element.match(/^\/\w/)) {
15
- indent = indent.substring(tab.length);
16
- }
17
-
18
- result += "".concat(indent, "<").concat(element, ">\r\n");
19
-
20
- if (element.match(/^<?\w[^>]*[^/]$/)) {
21
- indent += tab;
22
- }
23
- });
24
- return result.substring(1, result.length - 3);
25
- };
26
-
27
- exports.formatHTML = formatHTML;