@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.
- package/dist/cjs/DSWYSIWYGEditor.js +128 -0
- package/dist/cjs/DSWYSIWYGEditor.js.map +7 -0
- package/dist/cjs/components/CustomImageUploader.js +123 -0
- package/dist/cjs/components/CustomImageUploader.js.map +7 -0
- package/dist/cjs/components/CustomToolbar.js +261 -0
- package/dist/cjs/components/CustomToolbar.js.map +7 -0
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js +255 -0
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +7 -0
- package/dist/cjs/components/ImageLibraryModal.js +108 -0
- package/dist/cjs/components/ImageLibraryModal.js.map +7 -0
- package/dist/cjs/components/InsertFieldModal.js +212 -0
- package/dist/cjs/components/InsertFieldModal.js.map +7 -0
- package/dist/cjs/components/TippedButton.js +91 -0
- package/dist/cjs/components/TippedButton.js.map +7 -0
- package/dist/cjs/components/TippedSelect.js +57 -0
- package/dist/cjs/components/TippedSelect.js.map +7 -0
- package/dist/cjs/components/colors.js +50 -0
- package/dist/cjs/components/colors.js.map +7 -0
- package/dist/cjs/components/customFields.js +76 -0
- package/dist/cjs/components/customFields.js.map +7 -0
- package/dist/cjs/constants.js +114 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +48 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
- package/dist/cjs/quillOverrides/IndentStyle.js +51 -0
- package/dist/cjs/quillOverrides/IndentStyle.js.map +7 -0
- package/dist/cjs/quillOverrides/LinkFormat.js +86 -0
- package/dist/cjs/quillOverrides/LinkFormat.js.map +7 -0
- package/dist/cjs/quillOverrides/PlainClipboard.js +47 -0
- package/dist/cjs/quillOverrides/PlainClipboard.js.map +7 -0
- package/dist/cjs/utils.js +50 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/DSWYSIWYGEditor.js +101 -0
- package/dist/esm/DSWYSIWYGEditor.js.map +7 -0
- package/dist/esm/components/CustomImageUploader.js +94 -0
- package/dist/esm/components/CustomImageUploader.js.map +7 -0
- package/dist/esm/components/CustomToolbar.js +232 -0
- package/dist/esm/components/CustomToolbar.js.map +7 -0
- package/dist/esm/components/DSWYSIWYGEditorImpl.js +228 -0
- package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +7 -0
- package/dist/esm/components/ImageLibraryModal.js +81 -0
- package/dist/esm/components/ImageLibraryModal.js.map +7 -0
- package/dist/esm/components/InsertFieldModal.js +185 -0
- package/dist/esm/components/InsertFieldModal.js.map +7 -0
- package/dist/esm/components/TippedButton.js +64 -0
- package/dist/esm/components/TippedButton.js.map +7 -0
- package/dist/esm/components/TippedSelect.js +28 -0
- package/dist/esm/components/TippedSelect.js.map +7 -0
- package/dist/esm/components/colors.js +21 -0
- package/dist/esm/components/colors.js.map +7 -0
- package/dist/esm/components/customFields.js +47 -0
- package/dist/esm/components/customFields.js.map +7 -0
- package/dist/esm/constants.js +85 -0
- package/dist/esm/constants.js.map +7 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js +19 -0
- package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
- package/dist/esm/quillOverrides/IndentStyle.js +22 -0
- package/dist/esm/quillOverrides/IndentStyle.js.map +7 -0
- package/dist/esm/quillOverrides/LinkFormat.js +57 -0
- package/dist/esm/quillOverrides/LinkFormat.js.map +7 -0
- package/dist/esm/quillOverrides/PlainClipboard.js +18 -0
- package/dist/esm/quillOverrides/PlainClipboard.js.map +7 -0
- package/dist/esm/utils.js +21 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +64 -55
- package/cjs/DSWYSIWYGEditor.js +0 -82
- package/cjs/components/CustomImageUploader.js +0 -125
- package/cjs/components/CustomToolbar.js +0 -282
- package/cjs/components/DSWYSIWYGEditorImpl.js +0 -256
- package/cjs/components/ImageLibraryModal.js +0 -72
- package/cjs/components/InsertFieldModal.js +0 -218
- package/cjs/components/TippedButton.js +0 -56
- package/cjs/components/TippedSelect.js +0 -46
- package/cjs/components/colors.js +0 -30
- package/cjs/components/customFields.js +0 -57
- package/cjs/constants.js +0 -40
- package/cjs/index.js +0 -21
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +0 -33
- package/cjs/quillOverrides/IndentStyle.js +0 -29
- package/cjs/quillOverrides/LinkFormat.js +0 -68
- package/cjs/quillOverrides/PlainClipboard.js +0 -27
- package/cjs/utils.js +0 -27
- package/esm/DSWYSIWYGEditor.js +0 -72
- package/esm/components/CustomImageUploader.js +0 -115
- package/esm/components/CustomToolbar.js +0 -271
- package/esm/components/DSWYSIWYGEditorImpl.js +0 -245
- package/esm/components/ImageLibraryModal.js +0 -64
- package/esm/components/InsertFieldModal.js +0 -208
- package/esm/components/TippedButton.js +0 -46
- package/esm/components/TippedSelect.js +0 -38
- package/esm/components/colors.js +0 -26
- package/esm/components/customFields.js +0 -49
- package/esm/constants.js +0 -32
- package/esm/index.js +0 -4
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +0 -29
- package/esm/quillOverrides/IndentStyle.js +0 -27
- package/esm/quillOverrides/LinkFormat.js +0 -66
- package/esm/quillOverrides/PlainClipboard.js +0 -25
- package/esm/utils.js +0 -23
- package/types/DSWYSIWYGEditor.d.ts +0 -75
- package/types/components/CustomImageUploader.d.ts +0 -8
- package/types/components/CustomToolbar.d.ts +0 -21
- package/types/components/DSWYSIWYGEditorImpl.d.ts +0 -15
- package/types/components/ImageLibraryModal.d.ts +0 -31
- package/types/components/InsertFieldModal.d.ts +0 -41
- package/types/components/TippedButton.d.ts +0 -12
- package/types/components/TippedSelect.d.ts +0 -13
- package/types/components/colors.d.ts +0 -1
- package/types/components/customFields.d.ts +0 -36
- package/types/constants.d.ts +0 -26
- package/types/index.d.ts +0 -4
- package/types/quillMatchers/clipboardLinkWithTagMatcher.d.ts +0 -2
- package/types/quillOverrides/IndentStyle.d.ts +0 -10
- package/types/quillOverrides/LinkFormat.d.ts +0 -12
- package/types/quillOverrides/PlainClipboard.d.ts +0 -8
- package/types/utils.d.ts +0 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useState } from "react";
|
|
3
|
+
import DSButton from "@elliemae/ds-button";
|
|
4
|
+
import { ArrowheadDown } from "@elliemae/ds-icons";
|
|
5
|
+
import DSDropdownMenu from "@elliemae/ds-dropdownmenu";
|
|
6
|
+
import { colors, fonts, sizes, sizesReal } from "../constants";
|
|
7
|
+
import { TippedButton } from "./TippedButton";
|
|
8
|
+
import { TippedSelect } from "./TippedSelect";
|
|
9
|
+
const optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(" ", "-"));
|
|
10
|
+
const CustomFields = () => /* @__PURE__ */ React2.createElement("span", null, "\u1438\u1433");
|
|
11
|
+
const Color = ({ color }) => /* @__PURE__ */ React2.createElement("option", {
|
|
12
|
+
value: color
|
|
13
|
+
});
|
|
14
|
+
const Colors = ({ className, tip, zIndex }) => /* @__PURE__ */ React2.createElement(TippedSelect, {
|
|
15
|
+
className,
|
|
16
|
+
tip,
|
|
17
|
+
zIndex
|
|
18
|
+
}, colors.map((color) => /* @__PURE__ */ React2.createElement(Color, {
|
|
19
|
+
key: color,
|
|
20
|
+
color
|
|
21
|
+
})));
|
|
22
|
+
const CustomDropdown = ({
|
|
23
|
+
options,
|
|
24
|
+
label,
|
|
25
|
+
onSelectMenuItem = () => null,
|
|
26
|
+
onClickOutsideMenu = () => null,
|
|
27
|
+
onClose = () => null,
|
|
28
|
+
closeMenuOnItemSelection,
|
|
29
|
+
isOpen,
|
|
30
|
+
minWidth,
|
|
31
|
+
maxWidth,
|
|
32
|
+
zIndex = 10
|
|
33
|
+
}) => /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
|
|
34
|
+
onClickOutsideMenu,
|
|
35
|
+
options,
|
|
36
|
+
onSelectMenuItem,
|
|
37
|
+
onClose,
|
|
38
|
+
closeMenuOnItemSelection,
|
|
39
|
+
isOpen,
|
|
40
|
+
minWidth,
|
|
41
|
+
maxWidth,
|
|
42
|
+
zIndex,
|
|
43
|
+
preventOverflow: "scrollParent",
|
|
44
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(DSButton, {
|
|
45
|
+
labelText: label,
|
|
46
|
+
buttonType: "text",
|
|
47
|
+
icon: /* @__PURE__ */ React2.createElement(ArrowheadDown, null)
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
const Divider = () => /* @__PURE__ */ React2.createElement("div", {
|
|
51
|
+
style: {
|
|
52
|
+
height: "21px",
|
|
53
|
+
width: "1px",
|
|
54
|
+
margin: "0 10px",
|
|
55
|
+
padding: "0",
|
|
56
|
+
borderLeft: "1px solid #bbb",
|
|
57
|
+
display: "inline-block"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const CustomToolbar = ({
|
|
61
|
+
customFields,
|
|
62
|
+
customItems = [],
|
|
63
|
+
hideItems = {},
|
|
64
|
+
onShowHTML = () => {
|
|
65
|
+
},
|
|
66
|
+
id = "toolbar",
|
|
67
|
+
userProps
|
|
68
|
+
}) => {
|
|
69
|
+
const {
|
|
70
|
+
HEADER,
|
|
71
|
+
FONT,
|
|
72
|
+
FONT_SIZE,
|
|
73
|
+
BOLD,
|
|
74
|
+
ITALIC,
|
|
75
|
+
UNDERLINE,
|
|
76
|
+
STRIKE,
|
|
77
|
+
SUB,
|
|
78
|
+
SUPER,
|
|
79
|
+
ORDERED_LIST,
|
|
80
|
+
BULLET_LIST,
|
|
81
|
+
INDENT_MINUS_ONE,
|
|
82
|
+
INDENT_PLUS_ONE,
|
|
83
|
+
ALIGN,
|
|
84
|
+
FONT_COLOR,
|
|
85
|
+
FONT_BACKGROUND_COLOR,
|
|
86
|
+
HYPERLINK,
|
|
87
|
+
IMAGE,
|
|
88
|
+
CLEAR_FORMAT,
|
|
89
|
+
SHOW_HTML
|
|
90
|
+
} = hideItems;
|
|
91
|
+
const [showHTML, setShowHTML] = useState(false);
|
|
92
|
+
const handleShowHTML = (e) => {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
setShowHTML(!showHTML);
|
|
95
|
+
onShowHTML();
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
98
|
+
id,
|
|
99
|
+
className: "ds-ql-custom-toolbar"
|
|
100
|
+
}, (!HEADER || !FONT || !FONT_SIZE) && /* @__PURE__ */ React2.createElement("span", {
|
|
101
|
+
className: "ql-formats"
|
|
102
|
+
}, !HEADER && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
|
|
103
|
+
className: "ql-header",
|
|
104
|
+
tip: "Header",
|
|
105
|
+
values: ["", "1", "2", "3", "4", "5", "6"],
|
|
106
|
+
zIndex: userProps?.zIndex || 1
|
|
107
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), !FONT && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
|
|
108
|
+
className: "ql-font",
|
|
109
|
+
defaultValue: "sans-serif",
|
|
110
|
+
options: fonts,
|
|
111
|
+
tip: "Font",
|
|
112
|
+
values: optionsToValues(fonts),
|
|
113
|
+
zIndex: userProps?.zIndex || 1
|
|
114
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), !FONT_SIZE && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
|
|
115
|
+
className: "ql-size",
|
|
116
|
+
options: sizes,
|
|
117
|
+
tip: "Font Size",
|
|
118
|
+
values: optionsToValues(sizesReal),
|
|
119
|
+
zIndex: userProps?.zIndex || 1
|
|
120
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null))), (!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /* @__PURE__ */ React2.createElement("span", {
|
|
121
|
+
className: "ql-formats"
|
|
122
|
+
}, !BOLD && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
123
|
+
zIndex: userProps?.zIndex || 1,
|
|
124
|
+
className: "ql-bold",
|
|
125
|
+
tip: "Bold"
|
|
126
|
+
}), !ITALIC && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
127
|
+
zIndex: userProps?.zIndex || 1,
|
|
128
|
+
className: "ql-italic",
|
|
129
|
+
tip: "Italic"
|
|
130
|
+
}), !UNDERLINE && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
131
|
+
zIndex: userProps?.zIndex || 1,
|
|
132
|
+
className: "ql-underline",
|
|
133
|
+
tip: "Underline"
|
|
134
|
+
}), !STRIKE && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
135
|
+
zIndex: userProps?.zIndex || 1,
|
|
136
|
+
className: "ql-strike",
|
|
137
|
+
tip: "Strike"
|
|
138
|
+
})), (!SUB || !SUPER) && /* @__PURE__ */ React2.createElement("span", {
|
|
139
|
+
className: "ql-formats"
|
|
140
|
+
}, !SUB && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
141
|
+
zIndex: userProps?.zIndex || 1,
|
|
142
|
+
className: "ql-script",
|
|
143
|
+
tip: "Sub",
|
|
144
|
+
value: "sub"
|
|
145
|
+
}), !SUPER && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
146
|
+
zIndex: userProps?.zIndex || 1,
|
|
147
|
+
className: "ql-script",
|
|
148
|
+
tip: "Super",
|
|
149
|
+
value: "super"
|
|
150
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), (!ORDERED_LIST || !BULLET_LIST) && /* @__PURE__ */ React2.createElement("span", {
|
|
151
|
+
className: "ql-formats"
|
|
152
|
+
}, !ORDERED_LIST && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
153
|
+
zIndex: userProps?.zIndex || 1,
|
|
154
|
+
className: "ql-list",
|
|
155
|
+
tip: "Ordered List",
|
|
156
|
+
value: "ordered"
|
|
157
|
+
}), !BULLET_LIST && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
158
|
+
zIndex: userProps?.zIndex || 1,
|
|
159
|
+
className: "ql-list",
|
|
160
|
+
tip: "Bullet List",
|
|
161
|
+
value: "bullet"
|
|
162
|
+
})), (!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /* @__PURE__ */ React2.createElement("span", {
|
|
163
|
+
className: "ql-formats"
|
|
164
|
+
}, !INDENT_MINUS_ONE && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
165
|
+
zIndex: userProps?.zIndex || 1,
|
|
166
|
+
className: "ql-indent",
|
|
167
|
+
tip: "Indent -1",
|
|
168
|
+
value: "-1"
|
|
169
|
+
}), !INDENT_PLUS_ONE && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
170
|
+
zIndex: userProps?.zIndex || 1,
|
|
171
|
+
className: "ql-indent",
|
|
172
|
+
tip: "Indent +1",
|
|
173
|
+
value: "+1"
|
|
174
|
+
})), !ALIGN && /* @__PURE__ */ React2.createElement("span", {
|
|
175
|
+
className: "ql-formats"
|
|
176
|
+
}, /* @__PURE__ */ React2.createElement(TippedSelect, {
|
|
177
|
+
zIndex: userProps?.zIndex || 1,
|
|
178
|
+
className: "ql-align",
|
|
179
|
+
tip: "Align"
|
|
180
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), (!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /* @__PURE__ */ React2.createElement("span", {
|
|
181
|
+
className: "ql-formats"
|
|
182
|
+
}, !FONT_COLOR && /* @__PURE__ */ React2.createElement(Colors, {
|
|
183
|
+
zIndex: userProps?.zIndex || 1,
|
|
184
|
+
className: "ql-color",
|
|
185
|
+
tip: "Font Color"
|
|
186
|
+
}), !FONT_BACKGROUND_COLOR && /* @__PURE__ */ React2.createElement(Colors, {
|
|
187
|
+
zIndex: userProps?.zIndex || 1,
|
|
188
|
+
className: "ql-background",
|
|
189
|
+
tip: "Font Background Color"
|
|
190
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), (!HYPERLINK || !IMAGE) && /* @__PURE__ */ React2.createElement("span", {
|
|
191
|
+
className: "ql-formats"
|
|
192
|
+
}, !HYPERLINK && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
193
|
+
zIndex: userProps?.zIndex || 1,
|
|
194
|
+
className: "ql-link",
|
|
195
|
+
tip: "Hyperlink: Select Text First"
|
|
196
|
+
}), !IMAGE && /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
197
|
+
zIndex: userProps?.zIndex || 1,
|
|
198
|
+
className: "ql-image",
|
|
199
|
+
tip: "Insert Image"
|
|
200
|
+
}), /* @__PURE__ */ React2.createElement(Divider, null)), !CLEAR_FORMAT && /* @__PURE__ */ React2.createElement("span", {
|
|
201
|
+
className: "ql-formats"
|
|
202
|
+
}, /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
203
|
+
zIndex: userProps?.zIndex || 1,
|
|
204
|
+
className: "ql-clean",
|
|
205
|
+
tip: "Clear Format (Select Text)"
|
|
206
|
+
})), !SHOW_HTML && /* @__PURE__ */ React2.createElement("span", {
|
|
207
|
+
className: "ql-formats"
|
|
208
|
+
}, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
209
|
+
zIndex: userProps?.zIndex || 1,
|
|
210
|
+
style: {
|
|
211
|
+
width: "fit-content",
|
|
212
|
+
color: "#1e79c2",
|
|
213
|
+
fontWeight: "500"
|
|
214
|
+
},
|
|
215
|
+
onClick: handleShowHTML,
|
|
216
|
+
tip: showHTML ? "SHOW TEXT" : "SHOW HTML",
|
|
217
|
+
className: "ql-customFields-html"
|
|
218
|
+
}, showHTML ? "SHOW TEXT" : "SHOW HTML")), customFields && /* @__PURE__ */ React2.createElement("span", {
|
|
219
|
+
className: "ql-formats"
|
|
220
|
+
}, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(TippedButton, {
|
|
221
|
+
zIndex: userProps?.zIndex || 1,
|
|
222
|
+
className: "ql-customFields",
|
|
223
|
+
tip: "Insert Custom Field"
|
|
224
|
+
}, /* @__PURE__ */ React2.createElement(CustomFields, null))), customItems && /* @__PURE__ */ React2.createElement("span", {
|
|
225
|
+
style: { display: "inline-flex" }
|
|
226
|
+
}, customItems.map((Item) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(Item, null)))));
|
|
227
|
+
};
|
|
228
|
+
export {
|
|
229
|
+
CustomDropdown,
|
|
230
|
+
CustomToolbar
|
|
231
|
+
};
|
|
232
|
+
//# sourceMappingURL=CustomToolbar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/CustomToolbar.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/control-has-associated-label */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable react/button-has-type */\nimport React, { useState } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { ArrowheadDown } from '@elliemae/ds-icons';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { colors, fonts, sizes, sizesReal } from '../constants';\nimport { TippedButton } from './TippedButton';\nimport { TippedSelect } from './TippedSelect';\n\n// Functions -----------------------------------------\nconst optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(' ', '-'));\n\n// Stateless Components -----------------------------------------\n\nconst CustomFields = () => <span>\u1438\u1433</span>; // eslint-disable-line react/jsx-one-expression-per-line\nconst Color = ({ color }) => <option value={color} />;\nconst Colors = ({ className, tip, zIndex }) => (\n <TippedSelect className={className} tip={tip} zIndex={zIndex}>\n {colors.map((color) => (\n <Color key={color} color={color} />\n ))}\n </TippedSelect>\n);\n\nexport const CustomDropdown = ({\n options,\n label,\n onSelectMenuItem = () => null,\n onClickOutsideMenu = () => null,\n onClose = () => null,\n closeMenuOnItemSelection,\n isOpen,\n minWidth,\n maxWidth,\n zIndex = 10,\n}) => (\n <DSDropdownMenu\n onClickOutsideMenu={onClickOutsideMenu}\n options={options}\n onSelectMenuItem={onSelectMenuItem}\n onClose={onClose}\n closeMenuOnItemSelection={closeMenuOnItemSelection}\n isOpen={isOpen}\n minWidth={minWidth}\n maxWidth={maxWidth}\n zIndex={zIndex}\n preventOverflow=\"scrollParent\"\n triggerComponent={<DSButton labelText={label} buttonType=\"text\" icon={<ArrowheadDown />} />}\n />\n);\n\nconst Divider = () => (\n <div\n style={{\n height: '21px',\n width: '1px',\n margin: '0 10px',\n padding: '0',\n borderLeft: '1px solid #bbb',\n display: 'inline-block',\n }}\n ></div>\n);\n\nexport const CustomToolbar = ({\n customFields,\n customItems = [],\n hideItems = {},\n onShowHTML = () => {},\n id = 'toolbar',\n userProps,\n}) => {\n const {\n HEADER,\n FONT,\n FONT_SIZE,\n BOLD,\n ITALIC,\n UNDERLINE,\n STRIKE,\n SUB,\n SUPER,\n ORDERED_LIST,\n BULLET_LIST,\n INDENT_MINUS_ONE,\n INDENT_PLUS_ONE,\n ALIGN,\n FONT_COLOR,\n FONT_BACKGROUND_COLOR,\n HYPERLINK,\n IMAGE,\n CLEAR_FORMAT,\n SHOW_HTML,\n } = hideItems;\n const [showHTML, setShowHTML] = useState(false);\n\n const handleShowHTML = (e) => {\n e.preventDefault();\n setShowHTML(!showHTML);\n onShowHTML();\n };\n\n return (\n <div id={id} className=\"ds-ql-custom-toolbar\">\n {(!HEADER || !FONT || !FONT_SIZE) && (\n <span className=\"ql-formats\">\n {!HEADER && (\n <>\n <TippedSelect\n className=\"ql-header\"\n tip=\"Header\"\n values={['', '1', '2', '3', '4', '5', '6']}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT && (\n <>\n <TippedSelect\n className=\"ql-font\"\n defaultValue=\"sans-serif\"\n options={fonts}\n tip=\"Font\"\n values={optionsToValues(fonts)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT_SIZE && (\n <>\n <TippedSelect\n className=\"ql-size\"\n options={sizes}\n tip=\"Font Size\"\n values={optionsToValues(sizesReal)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n </span>\n )}\n {(!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && (\n <span className=\"ql-formats\">\n {!BOLD && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-bold\" tip=\"Bold\" />}\n {!ITALIC && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-italic\" tip=\"Italic\" />}\n {!UNDERLINE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-underline\" tip=\"Underline\" />}\n {!STRIKE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-strike\" tip=\"Strike\" />}\n </span>\n )}\n {(!SUB || !SUPER) && (\n <span className=\"ql-formats\">\n {!SUB && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Sub\" value=\"sub\" />}\n {!SUPER && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Super\" value=\"super\" />}\n <Divider />\n </span>\n )}\n {(!ORDERED_LIST || !BULLET_LIST) && (\n <span className=\"ql-formats\">\n {!ORDERED_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Ordered List\" value=\"ordered\" />\n )}\n {!BULLET_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Bullet List\" value=\"bullet\" />\n )}\n </span>\n )}\n {(!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && (\n <span className=\"ql-formats\">\n {!INDENT_MINUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent -1\" value=\"-1\" />\n )}\n {!INDENT_PLUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent +1\" value=\"+1\" />\n )}\n </span>\n )}\n {!ALIGN && (\n <span className=\"ql-formats\">\n <TippedSelect zIndex={userProps?.zIndex || 1} className=\"ql-align\" tip=\"Align\" />\n <Divider />\n </span>\n )}\n {(!FONT_COLOR || !FONT_BACKGROUND_COLOR) && (\n <span className=\"ql-formats\">\n {!FONT_COLOR && <Colors zIndex={userProps?.zIndex || 1} className=\"ql-color\" tip=\"Font Color\" />}\n {!FONT_BACKGROUND_COLOR && (\n <Colors zIndex={userProps?.zIndex || 1} className=\"ql-background\" tip=\"Font Background Color\" />\n )}\n <Divider />\n </span>\n )}\n {(!HYPERLINK || !IMAGE) && (\n <span className=\"ql-formats\">\n {!HYPERLINK && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-link\" tip=\"Hyperlink: Select Text First\" />\n )}\n {!IMAGE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-image\" tip=\"Insert Image\" />}\n <Divider />\n </span>\n )}\n {!CLEAR_FORMAT && (\n <span className=\"ql-formats\">\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-clean\" tip=\"Clear Format (Select Text)\" />\n </span>\n )}\n {!SHOW_HTML && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton\n zIndex={userProps?.zIndex || 1}\n style={{\n width: 'fit-content',\n color: '#1e79c2',\n fontWeight: '500',\n }}\n onClick={handleShowHTML}\n tip={showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n className=\"ql-customFields-html\"\n >\n {showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n </TippedButton>\n </span>\n )}\n {customFields && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-customFields\" tip=\"Insert Custom Field\">\n <CustomFields />\n </TippedButton>\n </span>\n )}\n {customItems && (\n <span style={{ display: 'inline-flex' }}>\n {customItems.map((Item) => (\n <>\n <Divider />\n <Item />\n </>\n ))}\n </span>\n )}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACMA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,kBAAkB,CAAC,YAAY,QAAQ,IAAI,CAAC,QAAQ,IAAI,cAAc,QAAQ,KAAK;AAIzF,MAAM,eAAe,MAAM,qCAAC,QAAD,MAAM;AACjC,MAAM,QAAQ,CAAC,EAAE,YAAY,qCAAC,UAAD;AAAA,EAAQ,OAAO;AAAA;AAC5C,MAAM,SAAS,CAAC,EAAE,WAAW,KAAK,aAChC,qCAAC,cAAD;AAAA,EAAc;AAAA,EAAsB;AAAA,EAAU;AAAA,GAC3C,OAAO,IAAI,CAAC,UACX,qCAAC,OAAD;AAAA,EAAO,KAAK;AAAA,EAAO;AAAA;AAKlB,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,mBAAmB,MAAM;AAAA,EACzB,qBAAqB,MAAM;AAAA,EAC3B,UAAU,MAAM;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,MAET,qCAAC,gBAAD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAgB;AAAA,EAChB,kBAAkB,qCAAC,UAAD;AAAA,IAAU,WAAW;AAAA,IAAO,YAAW;AAAA,IAAO,MAAM,qCAAC,eAAD;AAAA;AAAA;AAI1E,MAAM,UAAU,MACd,qCAAC,OAAD;AAAA,EACE,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,SAAS;AAAA;AAAA;AAKR,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7B,OAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,MACP,YAAY;AAAA;AAAA,IAEd,SAAS;AAAA,IACT,KAAK,WAAW,cAAc;AAAA,IAC9B,WAAU;AAAA,KAET,WAAW,cAAc,eAI/B,gBACC,qCAAC,QAAD;AAAA,IAAM,WAAU;AAAA,KACd,qCAAC,SAAD,OACA,qCAAC,cAAD;AAAA,IAAc,QAAQ,WAAW,UAAU;AAAA,IAAG,WAAU;AAAA,IAAkB,KAAI;AAAA,KAC5E,qCAAC,cAAD,SAIL,eACC,qCAAC,QAAD;AAAA,IAAM,OAAO,EAAE,SAAS;AAAA,KACrB,YAAY,IAAI,CAAC,SAChB,4DACE,qCAAC,SAAD,OACA,qCAAC,MAAD;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import React2 from "react";
|
|
34
|
+
import ReactQuill, { Quill } from "react-quill";
|
|
35
|
+
import BlotFormatter from "quill-blot-formatter";
|
|
36
|
+
import ImageLibraryModal from "./ImageLibraryModal";
|
|
37
|
+
import InsertFieldModal from "./InsertFieldModal";
|
|
38
|
+
import { CustomToolbar } from "./CustomToolbar";
|
|
39
|
+
import IndentStyle from "../quillOverrides/IndentStyle";
|
|
40
|
+
import LinkFormat from "../quillOverrides/LinkFormat";
|
|
41
|
+
import { formatHTML } from "../utils";
|
|
42
|
+
import { clipboardLinkWithTagMatcher } from "../quillMatchers/clipboardLinkWithTagMatcher";
|
|
43
|
+
Quill.register("modules/blotFormatter", BlotFormatter);
|
|
44
|
+
const AlignStyle = Quill.import("attributors/style/align");
|
|
45
|
+
const FontStyle = Quill.import("attributors/style/font");
|
|
46
|
+
FontStyle.whitelist = [
|
|
47
|
+
"serif",
|
|
48
|
+
"monospace",
|
|
49
|
+
"arial",
|
|
50
|
+
"comic-sans",
|
|
51
|
+
"courier-new",
|
|
52
|
+
"georgia",
|
|
53
|
+
"helvetica",
|
|
54
|
+
"lucida"
|
|
55
|
+
];
|
|
56
|
+
const SizeStyle = Quill.import("attributors/style/size");
|
|
57
|
+
SizeStyle.whitelist = [
|
|
58
|
+
"x-small",
|
|
59
|
+
"large",
|
|
60
|
+
"x-large"
|
|
61
|
+
];
|
|
62
|
+
const Block = Quill.import("blots/block");
|
|
63
|
+
Block.tagName = "p";
|
|
64
|
+
Quill.register(Block);
|
|
65
|
+
Quill.register(AlignStyle, true);
|
|
66
|
+
Quill.register(IndentStyle, true);
|
|
67
|
+
Quill.register(FontStyle, true);
|
|
68
|
+
Quill.register(SizeStyle, true);
|
|
69
|
+
class DSWYSIWYGEditorImpl extends React2.PureComponent {
|
|
70
|
+
constructor(props) {
|
|
71
|
+
super(props);
|
|
72
|
+
this.quillModules = __spreadValues({
|
|
73
|
+
toolbar: {
|
|
74
|
+
container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : "#toolbar",
|
|
75
|
+
handlers: __spreadValues({}, this.props.toolbarHandlers)
|
|
76
|
+
},
|
|
77
|
+
clipboard: {
|
|
78
|
+
matchVisual: false
|
|
79
|
+
},
|
|
80
|
+
blotFormatter: {}
|
|
81
|
+
}, this.props.quillModules);
|
|
82
|
+
this.onChangeQuill = (html, delta, source, editor) => {
|
|
83
|
+
const { showRawHTML, onChange } = this.props;
|
|
84
|
+
if (!showRawHTML)
|
|
85
|
+
onChange(html, delta, source, editor);
|
|
86
|
+
};
|
|
87
|
+
this.onChangeTextArea = (e) => {
|
|
88
|
+
const { showRawHTML, onChange } = this.props;
|
|
89
|
+
if (showRawHTML)
|
|
90
|
+
onChange(e.target.value);
|
|
91
|
+
};
|
|
92
|
+
this.onInserFieldConfirm = (fieldCode) => {
|
|
93
|
+
const editor = this.getEditor();
|
|
94
|
+
const range = editor.getSelection(true);
|
|
95
|
+
editor.insertText(range.index, fieldCode);
|
|
96
|
+
};
|
|
97
|
+
this.onImageConfirm = (image) => {
|
|
98
|
+
if (!image) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const editor = this.getEditor();
|
|
102
|
+
const range = editor.getSelection(true);
|
|
103
|
+
editor.insertEmbed(range.index, "image", image.url);
|
|
104
|
+
};
|
|
105
|
+
this.onFieldModalClose = () => {
|
|
106
|
+
this.setState({ isFieldModalOpen: false });
|
|
107
|
+
};
|
|
108
|
+
this.onImageModalClose = () => {
|
|
109
|
+
this.setState({ isImageModalOpen: false });
|
|
110
|
+
};
|
|
111
|
+
this.quillRef = (ref) => {
|
|
112
|
+
this.quill = ref;
|
|
113
|
+
};
|
|
114
|
+
Quill.register(LinkFormat, true);
|
|
115
|
+
if (props.quillOverrides.length) {
|
|
116
|
+
props.quillOverrides.map((override) => Quill.register(override, true));
|
|
117
|
+
}
|
|
118
|
+
this.state = {
|
|
119
|
+
isImageModalOpen: false,
|
|
120
|
+
isFieldModalOpen: false
|
|
121
|
+
};
|
|
122
|
+
const { toolbar } = this.quillModules;
|
|
123
|
+
if (props.imagesData) {
|
|
124
|
+
toolbar.handlers.image = (value) => {
|
|
125
|
+
const { imagesData, handleImageClick } = this.props;
|
|
126
|
+
if (!imagesData.length) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.setState({ isImageModalOpen: !!value });
|
|
130
|
+
handleImageClick(value);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (props.customFields) {
|
|
134
|
+
toolbar.handlers.customFields = (value) => {
|
|
135
|
+
const { customFields, handleCustomFieldClick } = this.props;
|
|
136
|
+
if (!customFields.length) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.setState({ isFieldModalOpen: !!value });
|
|
140
|
+
handleCustomFieldClick(value);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
componentDidMount() {
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
const quillDomRef = this.quill;
|
|
147
|
+
const editor = quillDomRef.getEditor();
|
|
148
|
+
this.props.getQuillRef(quillDomRef);
|
|
149
|
+
editor.clipboard.addMatcher("a", clipboardLinkWithTagMatcher);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
getEditor() {
|
|
153
|
+
return this.quill.getEditor();
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
const { isFieldModalOpen, isImageModalOpen } = this.state;
|
|
157
|
+
const _a = this.props, {
|
|
158
|
+
containerProps = {},
|
|
159
|
+
customFields,
|
|
160
|
+
imagesData,
|
|
161
|
+
customToolbar,
|
|
162
|
+
handleImageClick,
|
|
163
|
+
handleCustomFieldClick,
|
|
164
|
+
height,
|
|
165
|
+
value,
|
|
166
|
+
showRawHTML,
|
|
167
|
+
onShowHTML,
|
|
168
|
+
onChange,
|
|
169
|
+
hideItems
|
|
170
|
+
} = _a, editorProps = __objRest(_a, [
|
|
171
|
+
"containerProps",
|
|
172
|
+
"customFields",
|
|
173
|
+
"imagesData",
|
|
174
|
+
"customToolbar",
|
|
175
|
+
"handleImageClick",
|
|
176
|
+
"handleCustomFieldClick",
|
|
177
|
+
"height",
|
|
178
|
+
"value",
|
|
179
|
+
"showRawHTML",
|
|
180
|
+
"onShowHTML",
|
|
181
|
+
"onChange",
|
|
182
|
+
"hideItems"
|
|
183
|
+
]);
|
|
184
|
+
return /* @__PURE__ */ React2.createElement("div", __spreadProps(__spreadValues({}, containerProps), {
|
|
185
|
+
className: `quill-wysiwyg-editor ${showRawHTML ? "show-raw" : ""}`
|
|
186
|
+
}), customToolbar || /* @__PURE__ */ React2.createElement(CustomToolbar, {
|
|
187
|
+
customFields,
|
|
188
|
+
onShowHTML,
|
|
189
|
+
hideItems,
|
|
190
|
+
userProps: this.props
|
|
191
|
+
}), /* @__PURE__ */ React2.createElement(ReactQuill, __spreadProps(__spreadValues({
|
|
192
|
+
ref: this.quillRef,
|
|
193
|
+
modules: this.quillModules,
|
|
194
|
+
onChange: this.onChangeQuill,
|
|
195
|
+
value,
|
|
196
|
+
style: {
|
|
197
|
+
height,
|
|
198
|
+
borderBottom: "1px solid #ccc"
|
|
199
|
+
}
|
|
200
|
+
}, editorProps), {
|
|
201
|
+
id: "wysiwyg-text-container"
|
|
202
|
+
})), /* @__PURE__ */ React2.createElement("textarea", {
|
|
203
|
+
className: "raw-editor ql-container ql-snow ql-editor",
|
|
204
|
+
style: {
|
|
205
|
+
width: "100%",
|
|
206
|
+
resize: "none",
|
|
207
|
+
height,
|
|
208
|
+
minHeight: "200px"
|
|
209
|
+
},
|
|
210
|
+
onChange: this.onChangeTextArea,
|
|
211
|
+
value: formatHTML(value)
|
|
212
|
+
}), imagesData && imagesData.length && /* @__PURE__ */ React2.createElement(ImageLibraryModal, {
|
|
213
|
+
imagesData,
|
|
214
|
+
isOpen: isImageModalOpen,
|
|
215
|
+
onClose: this.onImageModalClose,
|
|
216
|
+
onConfirm: this.onImageConfirm
|
|
217
|
+
}), customFields && customFields.length && /* @__PURE__ */ React2.createElement(InsertFieldModal, {
|
|
218
|
+
customFields,
|
|
219
|
+
isOpen: isFieldModalOpen,
|
|
220
|
+
onClose: this.onFieldModalClose,
|
|
221
|
+
onConfirm: this.onInserFieldConfirm
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
export {
|
|
226
|
+
DSWYSIWYGEditorImpl as default
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=DSWYSIWYGEditorImpl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DSWYSIWYGEditorImpl.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport ReactQuill, { Quill } from 'react-quill';\nimport BlotFormatter from 'quill-blot-formatter';\n\nimport ImageLibraryModal from './ImageLibraryModal';\nimport InsertFieldModal from './InsertFieldModal';\nimport { CustomToolbar } from './CustomToolbar';\nimport IndentStyle from '../quillOverrides/IndentStyle';\nimport LinkFormat from '../quillOverrides/LinkFormat';\nimport { formatHTML } from '../utils';\nimport { clipboardLinkWithTagMatcher } from '../quillMatchers/clipboardLinkWithTagMatcher';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\n// Fix block styled formats ----------------\nconst AlignStyle = Quill.import('attributors/style/align');\nconst FontStyle = Quill.import('attributors/style/font');\nFontStyle.whitelist = [\n // allow ONLY these fonts and the default\n 'serif',\n 'monospace',\n 'arial',\n 'comic-sans',\n 'courier-new',\n 'georgia',\n 'helvetica',\n 'lucida',\n];\nconst SizeStyle = Quill.import('attributors/style/size');\nSizeStyle.whitelist = [\n // allow ONLY these sizes and the default\n 'x-small',\n 'large',\n 'x-large',\n];\n\n// Fix Doc Viewer p tags extra margin issue ---------\nconst Block = Quill.import('blots/block');\nBlock.tagName = 'p';\nQuill.register(Block);\n\nQuill.register(AlignStyle, true);\nQuill.register(IndentStyle, true);\nQuill.register(FontStyle, true);\nQuill.register(SizeStyle, true);\n// -----------------------------------------\n\nexport default class DSWYSIWYGEditorImpl extends React.PureComponent {\n quillModules = {\n toolbar: {\n container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',\n handlers: {\n ...this.props.toolbarHandlers,\n },\n },\n clipboard: {\n // toggle to add extra line breaks when pasting HTML:\n matchVisual: false,\n },\n blotFormatter: {\n // options... https://github.com/Fandom-OSS/quill-blot-formatter\n },\n ...this.props.quillModules,\n };\n\n constructor(props) {\n super(props);\n Quill.register(LinkFormat, true);\n if (props.quillOverrides.length) {\n props.quillOverrides.map((override) => Quill.register(override, true));\n }\n this.state = {\n isImageModalOpen: false,\n isFieldModalOpen: false,\n };\n const { toolbar } = this.quillModules;\n if (props.imagesData) {\n toolbar.handlers.image = (value) => {\n const { imagesData, handleImageClick } = this.props;\n if (!imagesData.length) {\n return;\n }\n this.setState({ isImageModalOpen: !!value });\n handleImageClick(value);\n };\n }\n if (props.customFields) {\n toolbar.handlers.customFields = (value) => {\n const { customFields, handleCustomFieldClick } = this.props;\n if (!customFields.length) {\n return;\n }\n this.setState({ isFieldModalOpen: !!value });\n handleCustomFieldClick(value);\n };\n }\n }\n\n componentDidMount() {\n // this.quill doesn't exist untill the full call-stack execute\n // we need to \"setTimeout\" so this componentDidMount work as expected\n setTimeout(() => {\n const quillDomRef = this.quill;\n const editor = quillDomRef.getEditor();\n this.props.getQuillRef(quillDomRef);\n // https://github.com/quilljs/quill/issues/2677\n editor.clipboard.addMatcher('a', clipboardLinkWithTagMatcher);\n });\n }\n\n // eslint-disable-next-line max-params\n onChangeQuill = (html, delta, source, editor) => {\n const { showRawHTML, onChange } = this.props;\n if (!showRawHTML) onChange(html, delta, source, editor);\n };\n\n onChangeTextArea = (e) => {\n const { showRawHTML, onChange } = this.props;\n if (showRawHTML) onChange(e.target.value);\n };\n\n onInserFieldConfirm = (fieldCode) => {\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertText(range.index, fieldCode);\n };\n\n onImageConfirm = (image) => {\n if (!image) {\n return;\n }\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertEmbed(range.index, 'image', image.url);\n };\n\n onFieldModalClose = () => {\n this.setState({ isFieldModalOpen: false });\n };\n\n onImageModalClose = () => {\n this.setState({ isImageModalOpen: false });\n };\n\n getEditor() {\n return this.quill.getEditor();\n }\n\n quillRef = (ref) => {\n this.quill = ref;\n };\n\n render() {\n const { isFieldModalOpen, isImageModalOpen } = this.state;\n const {\n containerProps = {},\n customFields,\n imagesData,\n customToolbar,\n handleImageClick,\n handleCustomFieldClick,\n height,\n value,\n showRawHTML,\n onShowHTML,\n onChange,\n hideItems,\n ...editorProps\n } = this.props;\n\n return (\n <div\n // data-testid=\"wysiwyg-text-container\"\n {...containerProps}\n className={`quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`}\n >\n {customToolbar || (\n <CustomToolbar\n customFields={customFields}\n onShowHTML={onShowHTML}\n hideItems={hideItems}\n userProps={this.props}\n />\n )}\n <ReactQuill\n ref={this.quillRef}\n modules={this.quillModules}\n onChange={this.onChangeQuill}\n value={value}\n style={{\n height,\n borderBottom: '1px solid #ccc',\n }}\n {...editorProps}\n id=\"wysiwyg-text-container\"\n />\n <textarea\n className=\"raw-editor ql-container ql-snow ql-editor\"\n style={{\n width: '100%',\n resize: 'none',\n height,\n minHeight: '200px',\n }}\n onChange={this.onChangeTextArea}\n value={formatHTML(value)}\n />\n {imagesData && imagesData.length && (\n <ImageLibraryModal\n imagesData={imagesData}\n isOpen={isImageModalOpen}\n onClose={this.onImageModalClose}\n onConfirm={this.onImageConfirm}\n />\n )}\n {customFields && customFields.length && (\n <InsertFieldModal\n customFields={customFields}\n isOpen={isFieldModalOpen}\n onClose={this.onFieldModalClose}\n onConfirm={this.onInserFieldConfirm}\n />\n )}\n </div>\n );\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,SAAS,yBAAyB;AAGxC,MAAM,aAAa,MAAM,OAAO;AAChC,MAAM,YAAY,MAAM,OAAO;AAC/B,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAEF,MAAM,YAAY,MAAM,OAAO;AAC/B,UAAU,YAAY;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA;AAIF,MAAM,QAAQ,MAAM,OAAO;AAC3B,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,MAAM,SAAS,YAAY;AAC3B,MAAM,SAAS,aAAa;AAC5B,MAAM,SAAS,WAAW;AAC1B,MAAM,SAAS,WAAW;AAG1B,kCAAiD,OAAM,cAAc;AAAA,EAkBnE,YAAY,OAAO;AACjB,UAAM;AAlBR,wBAAe;AAAA,MACb,SAAS;AAAA,QACP,WAAW,KAAK,MAAM,mBAAmB,IAAI,KAAK,MAAM,qBAAqB;AAAA,QAC7E,UAAU,mBACL,KAAK,MAAM;AAAA;AAAA,MAGlB,WAAW;AAAA,QAET,aAAa;AAAA;AAAA,MAEf,eAAe;AAAA,OAGZ,KAAK,MAAM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A,MACf,OAAO,WAAW;AAAA,QAEnB,cAAc,WAAW,UACxB,qCAAC,mBAAD;AAAA,MACE;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,QAGnB,gBAAgB,aAAa,UAC5B,qCAAC,kBAAD;AAAA,MACE;AAAA,MACA,QAAQ;AAAA,MACR,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import React2 from "react";
|
|
22
|
+
import DSImageLibraryModal from "@elliemae/ds-imagelibrarymodal";
|
|
23
|
+
import PropTypes from "prop-types";
|
|
24
|
+
class ImageLibraryModal extends React2.PureComponent {
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
this.onSelect = (selectedImage) => {
|
|
28
|
+
this.setState({ selectedImage });
|
|
29
|
+
};
|
|
30
|
+
this.onConfirm = () => {
|
|
31
|
+
const { selectedImage } = this.state;
|
|
32
|
+
const { onConfirm, onClose } = this.props;
|
|
33
|
+
onConfirm(selectedImage);
|
|
34
|
+
onClose();
|
|
35
|
+
};
|
|
36
|
+
this.state = {
|
|
37
|
+
selectedImage: void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return /* @__PURE__ */ React2.createElement(DSImageLibraryModal, __spreadProps(__spreadValues({}, this.props), {
|
|
42
|
+
onConfirm: this.onConfirm,
|
|
43
|
+
onSelect: this.onSelect
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
ImageLibraryModal.propTypes = {
|
|
48
|
+
onConfirm: PropTypes.func.isRequired,
|
|
49
|
+
onClose: PropTypes.func.isRequired,
|
|
50
|
+
onReject: PropTypes.func,
|
|
51
|
+
imagesData: PropTypes.arrayOf(PropTypes.shape({
|
|
52
|
+
id: PropTypes.string,
|
|
53
|
+
url: PropTypes.string.isRequired,
|
|
54
|
+
name: PropTypes.string.isRequired,
|
|
55
|
+
description: PropTypes.string,
|
|
56
|
+
createdBy: PropTypes.string.isRequired,
|
|
57
|
+
createdDate: PropTypes.string.isRequired
|
|
58
|
+
})),
|
|
59
|
+
isOpen: PropTypes.bool.isRequired
|
|
60
|
+
};
|
|
61
|
+
ImageLibraryModal.defaultProps = {
|
|
62
|
+
onReject: void 0,
|
|
63
|
+
imagesData: [
|
|
64
|
+
{
|
|
65
|
+
url: "https://www.freeiconspng.com/minicovers/no-image-icon-6.png",
|
|
66
|
+
name: "no image",
|
|
67
|
+
createdBy: "user:John Doe",
|
|
68
|
+
createdDate: "0000-01-01 00:00 AM UTC"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
url: "https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e",
|
|
72
|
+
name: "no image 2",
|
|
73
|
+
createdBy: "user:Jane Doe",
|
|
74
|
+
createdDate: "0000-01-01 00:00 AM UTC"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
ImageLibraryModal as default
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=ImageLibraryModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ImageLibraryModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal';\nimport PropTypes from 'prop-types';\n\nexport default class ImageLibraryModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n onReject: PropTypes.func,\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n description: PropTypes.string,\n createdBy: PropTypes.string.isRequired,\n createdDate: PropTypes.string.isRequired,\n }),\n ),\n isOpen: PropTypes.bool.isRequired,\n };\n\n static defaultProps = {\n onReject: undefined,\n imagesData: [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n {\n url:\n 'https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e',\n name: 'no image 2',\n createdBy: 'user:Jane Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedImage: undefined,\n };\n }\n\n onSelect = selectedImage => {\n this.setState({ selectedImage });\n };\n\n onConfirm = () => {\n const { selectedImage } = this.state;\n const { onConfirm, onClose } = this.props;\n onConfirm(selectedImage);\n onClose();\n };\n\n render() {\n return (\n <DSImageLibraryModal\n {...this.props}\n onConfirm={this.onConfirm}\n onSelect={this.onSelect}\n />\n );\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEA,gCAA+C,OAAM,cAAc;AAAA,EAqCjE,YAAY,OAAO;AACjB,UAAM;AAMR,oBAAW,mBAAiB;AAC1B,WAAK,SAAS,EAAE;AAAA;AAGlB,qBAAY,MAAM;AAChB,YAAM,EAAE,kBAAkB,KAAK;AAC/B,YAAM,EAAE,WAAW,YAAY,KAAK;AACpC,gBAAU;AACV;AAAA;AAbA,SAAK,QAAQ;AAAA,MACX,eAAe;AAAA;AAAA;AAAA,EAenB,SAAS;AACP,WACE,qCAAC,qBAAD,iCACM,KAAK,QADX;AAAA,MAEE,WAAW,KAAK;AAAA,MAChB,UAAU,KAAK;AAAA;AAAA;AAAA;AA3Dd,AADT,kBACS,YAAY;AAAA,EACjB,WAAW,UAAU,KAAK;AAAA,EAC1B,SAAS,UAAU,KAAK;AAAA,EACxB,UAAU,UAAU;AAAA,EACpB,YAAY,UAAU,QACpB,UAAU,MAAM;AAAA,IACd,IAAI,UAAU;AAAA,IACd,KAAK,UAAU,OAAO;AAAA,IACtB,MAAM,UAAU,OAAO;AAAA,IACvB,aAAa,UAAU;AAAA,IACvB,WAAW,UAAU,OAAO;AAAA,IAC5B,aAAa,UAAU,OAAO;AAAA;AAAA,EAGlC,QAAQ,UAAU,KAAK;AAAA;AAGlB,AAlBT,kBAkBS,eAAe;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,IACV;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA;AAAA,IAEf;AAAA,MACE,KACE;AAAA,MACF,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|