@elliemae/ds-wysiwygeditor 3.5.0-rc.9 → 3.6.0-next.0
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 +3 -2
- package/dist/cjs/DSWYSIWYGEditor.js.map +2 -2
- package/dist/cjs/components/CustomImageUploader.js +47 -34
- package/dist/cjs/components/CustomImageUploader.js.map +2 -2
- package/dist/cjs/components/CustomToolbar.js +229 -142
- package/dist/cjs/components/CustomToolbar.js.map +2 -2
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js +47 -39
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +1 -1
- package/dist/cjs/components/ImageLibraryModal.js +2 -1
- package/dist/cjs/components/ImageLibraryModal.js.map +1 -1
- package/dist/cjs/components/InsertFieldModal.js +42 -21
- package/dist/cjs/components/InsertFieldModal.js.map +1 -1
- package/dist/cjs/components/TippedButton.js +19 -16
- package/dist/cjs/components/TippedButton.js.map +2 -2
- package/dist/cjs/components/TippedSelect.js +24 -19
- package/dist/cjs/components/TippedSelect.js.map +2 -2
- package/dist/esm/DSWYSIWYGEditor.js +3 -2
- package/dist/esm/DSWYSIWYGEditor.js.map +2 -2
- package/dist/esm/components/CustomImageUploader.js +47 -34
- package/dist/esm/components/CustomImageUploader.js.map +2 -2
- package/dist/esm/components/CustomToolbar.js +229 -142
- package/dist/esm/components/CustomToolbar.js.map +2 -2
- package/dist/esm/components/DSWYSIWYGEditorImpl.js +47 -39
- package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +1 -1
- package/dist/esm/components/ImageLibraryModal.js +2 -1
- package/dist/esm/components/ImageLibraryModal.js.map +1 -1
- package/dist/esm/components/InsertFieldModal.js +42 -21
- package/dist/esm/components/InsertFieldModal.js.map +1 -1
- package/dist/esm/components/TippedButton.js +19 -16
- package/dist/esm/components/TippedButton.js.map +2 -2
- package/dist/esm/components/TippedSelect.js +24 -19
- package/dist/esm/components/TippedSelect.js.map +2 -2
- package/package.json +10 -10
|
@@ -30,7 +30,8 @@ __export(DSWYSIWYGEditor_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(DSWYSIWYGEditor_exports);
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
|
-
var
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_react = require("react");
|
|
34
35
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
36
|
var import_DSWYSIWYGEditorImpl = __toESM(require("./components/DSWYSIWYGEditorImpl"));
|
|
36
37
|
const DSWYSIWYGEditor = ({
|
|
@@ -49,7 +50,7 @@ const DSWYSIWYGEditor = ({
|
|
|
49
50
|
};
|
|
50
51
|
const [showHTML, setShowHTML] = (0, import_react.useState)(showRawHTML);
|
|
51
52
|
(0, import_react.useEffect)(() => setShowHTML(showRawHTML), [showRawHTML]);
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSWYSIWYGEditorImpl.default, {
|
|
53
54
|
forceHttpLink: true,
|
|
54
55
|
handleCustomFieldClick: emptyAction,
|
|
55
56
|
handleImageClick: emptyAction,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSWYSIWYGEditor.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\nDSWYSIWYGEditor.displayName = 'DSWYSIWYGEditor';\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;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;AAAA,IACvC;AAAA,IACA;AAAA,IACC,GAAG;AAAA,GACN;AAEJ;AAEA,MAAM,qBAAqB;AAAA,EACzB,OAAO,8BAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACrD,UAAU,8BAAU,KAAK;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EAAE;AAAA,EACF,aAAa,8BAAU,KAAK,YAAY,8BAA8B;AAAA,EACtE,cAAc,8BAAU,OAAO,YAAY,kCAAkC;AAAA,EAC7E,eAAe,8BAAU,QAAQ,YAAY,gBAAgB;AAAA,EAC7D,iBAAiB,8BAAU,OAAO,YAAY,8BAA8B;AAAA,EAC5E,aAAa,8BAAU,KAAK,YAAY,qCAAqC,EAAE,aAAa,KAAK;AAAA,EACjG,QAAQ,8BAAU,OAAO,YAAY,iCAAiC;AAAA,EACtE,UAAU,8BAAU,OAAO;AAAA,IACzB;AAAA,EACF;AAAA,EACA,WAAW,8BAAU,OAAO,YAAY,mDAAmD,EAAE,aAAa,CAAC,CAAC;AAAA,EAC5G,QAAQ,8BAAU,OAAO;AAAA,IACvB;AAAA,EACF;AACF;AAEA,gBAAgB,YAAY;AAC5B,gBAAgB,cAAc;AAC9B,MAAM,uBAAmB,8BAAS,eAAe;AACjD,iBAAiB,YAAY;AAG7B,IAAO,0BAAQ;",
|
|
6
|
+
"names": ["DSWYSIWYGEditorImpl"]
|
|
7
7
|
}
|
|
@@ -28,7 +28,8 @@ __export(CustomImageUploader_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(CustomImageUploader_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
32
33
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
33
34
|
var import_ds_uploader = __toESM(require("@elliemae/ds-uploader"));
|
|
34
35
|
var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
|
|
@@ -83,38 +84,50 @@ const CustomImageUploader = ({
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
90
|
+
zIndex,
|
|
91
|
+
tip: "Insert Image",
|
|
92
|
+
onClick: () => {
|
|
93
|
+
setLastSelection(quillRef?.getEditor().getSelection());
|
|
94
|
+
setIsOpen(true);
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Image, {
|
|
97
|
+
color: ["neutral", 500],
|
|
98
|
+
size: "s"
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_modal.default, {
|
|
102
|
+
isOpen,
|
|
103
|
+
title: "",
|
|
104
|
+
onConfirm: () => {
|
|
105
|
+
setIsOpen(false);
|
|
106
|
+
},
|
|
107
|
+
onClose: () => {
|
|
108
|
+
setIsOpen(false);
|
|
109
|
+
},
|
|
110
|
+
showClose: true,
|
|
111
|
+
version: 2,
|
|
112
|
+
size: "xsmall",
|
|
113
|
+
modalType: import_ds_modal.MODAL_TYPE_V2.DECISION,
|
|
114
|
+
confirmLabel: "Cancel",
|
|
115
|
+
message: "",
|
|
116
|
+
children: [
|
|
117
|
+
!inProgress && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_uploader.default, {
|
|
118
|
+
containerProps: { id: elementId },
|
|
119
|
+
showAltAction: false,
|
|
120
|
+
acceptedTypesText: allowedImageTypes,
|
|
121
|
+
onDrop: handleFileChange
|
|
122
|
+
}),
|
|
123
|
+
inProgress && "Upload in progress...",
|
|
124
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
125
|
+
style: { color: "red", marginTop: "10px" },
|
|
126
|
+
children: error
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
});
|
|
119
132
|
};
|
|
120
133
|
//# sourceMappingURL=CustomImageUploader.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/CustomImageUploader.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\nimport { Image } from '@elliemae/ds-icons';\nimport DSUploader from '@elliemae/ds-uploader';\nimport DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';\nimport { TippedButton } from './TippedButton';\n\nconst ALLOWED_TYPES_TEXT = 'JPG, JPEG, PNG, GIF, BMP, TIFF';\nconst ALLOWED_TYPES = /image\\/(jpeg|jpg|png|gif|bmp|tiff)/;\nconst DEFAULT_MAX_SIZE = 1024 * 1024; // 1 MB\n\nexport const CustomImageUploader = ({\n quillRef,\n editorFieldName,\n allowedImageTypes = ALLOWED_TYPES_TEXT,\n uploadAsset = () => null,\n zIndex = 1,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [error, setError] = useState(null);\n const [inProgress, setInProgress] = useState(false);\n const [lastSelection, setLastSelection] = useState({ index: 0, length: 0 });\n\n const elementId = `uploadImage${editorFieldName}`;\n\n // eslint-disable-next-line consistent-return\n const handleFileChange = async (files) => {\n if (!inProgress) {\n setError(null);\n const selectedFile = files[0];\n if (!selectedFile) {\n setError('Please select a file.');\n return false;\n }\n if (!selectedFile.type.match(ALLOWED_TYPES)) {\n setError('File must be an image.');\n } else if (selectedFile.size > DEFAULT_MAX_SIZE) {\n setError('File is too large.');\n } else {\n const fr = new FileReader();\n fr.onload = async () => {\n setInProgress(true);\n try {\n const url = await uploadAsset({\n name: selectedFile.name,\n type: selectedFile.type,\n description: selectedFile.name,\n isSystemAsset: false,\n file: fr.result,\n });\n setIsOpen(false);\n quillRef?.getEditor().insertEmbed(lastSelection?.index || 0, 'image', url);\n } catch (e) {\n setError('An error has occurred, try again');\n }\n setInProgress(false);\n };\n fr.readAsArrayBuffer(selectedFile);\n }\n }\n };\n return (\n <>\n <TippedButton\n zIndex={zIndex}\n tip=\"Insert Image\"\n onClick={() => {\n setLastSelection(quillRef?.getEditor().getSelection());\n setIsOpen(true);\n }}\n >\n <Image color={['neutral', 500]} size=\"s\" />\n </TippedButton>\n <DSModal\n isOpen={isOpen}\n title=\"\"\n onConfirm={() => {\n setIsOpen(false);\n }}\n onClose={() => {\n setIsOpen(false);\n }}\n showClose\n version={2}\n size=\"xsmall\"\n modalType={MODAL_TYPE_V2.DECISION}\n confirmLabel=\"Cancel\"\n message=\"\"\n >\n {!inProgress && (\n <DSUploader\n containerProps={{ id: elementId }}\n showAltAction={false}\n acceptedTypesText={allowedImageTypes}\n onDrop={handleFileChange}\n />\n )}\n {inProgress && 'Upload in progress...'}\n {error && <div style={{ color: 'red', marginTop: '10px' }}>{error}</div>}\n </DSModal>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;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|
module.exports = __toCommonJS(CustomToolbar_exports);
|
|
31
31
|
var React = __toESM(require("react"));
|
|
32
|
-
var
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var import_react = require("react");
|
|
33
34
|
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
34
35
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
35
36
|
var import_ds_dropdownmenu = __toESM(require("@elliemae/ds-dropdownmenu"));
|
|
@@ -37,18 +38,20 @@ var import_constants = require("../constants");
|
|
|
37
38
|
var import_TippedButton = require("./TippedButton");
|
|
38
39
|
var import_TippedSelect = require("./TippedSelect");
|
|
39
40
|
const optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(" ", "-"));
|
|
40
|
-
const CustomFields = () => /* @__PURE__ */
|
|
41
|
-
|
|
41
|
+
const CustomFields = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
42
|
+
children: "\u1438\u1433"
|
|
43
|
+
});
|
|
44
|
+
const Color = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
42
45
|
value: color
|
|
43
46
|
});
|
|
44
|
-
const Colors = ({ className, tip, zIndex }) => /* @__PURE__ */
|
|
47
|
+
const Colors = ({ className, tip, zIndex }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedSelect.TippedSelect, {
|
|
45
48
|
className,
|
|
46
49
|
tip,
|
|
47
|
-
zIndex
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
color
|
|
51
|
-
})
|
|
50
|
+
zIndex,
|
|
51
|
+
children: import_constants.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Color, {
|
|
52
|
+
color
|
|
53
|
+
}, color))
|
|
54
|
+
});
|
|
52
55
|
const CustomDropdown = ({
|
|
53
56
|
options,
|
|
54
57
|
label,
|
|
@@ -60,7 +63,7 @@ const CustomDropdown = ({
|
|
|
60
63
|
minWidth,
|
|
61
64
|
maxWidth,
|
|
62
65
|
zIndex = 10
|
|
63
|
-
}) => /* @__PURE__ */
|
|
66
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dropdownmenu.default, {
|
|
64
67
|
onClickOutsideMenu,
|
|
65
68
|
options,
|
|
66
69
|
onSelectMenuItem,
|
|
@@ -71,13 +74,13 @@ const CustomDropdown = ({
|
|
|
71
74
|
maxWidth,
|
|
72
75
|
zIndex,
|
|
73
76
|
preventOverflow: "scrollParent",
|
|
74
|
-
triggerComponent: /* @__PURE__ */
|
|
77
|
+
triggerComponent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.default, {
|
|
75
78
|
labelText: label,
|
|
76
79
|
buttonType: "text",
|
|
77
|
-
icon: /* @__PURE__ */
|
|
80
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadDown, {})
|
|
78
81
|
})
|
|
79
82
|
});
|
|
80
|
-
const Divider = () => /* @__PURE__ */
|
|
83
|
+
const Divider = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
81
84
|
style: {
|
|
82
85
|
height: "21px",
|
|
83
86
|
width: "1px",
|
|
@@ -124,135 +127,219 @@ const CustomToolbar = ({
|
|
|
124
127
|
setShowHTML(!showHTML);
|
|
125
128
|
onShowHTML();
|
|
126
129
|
};
|
|
127
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
128
131
|
id,
|
|
129
|
-
className: "ds-ql-custom-toolbar"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
132
|
+
className: "ds-ql-custom-toolbar",
|
|
133
|
+
children: [
|
|
134
|
+
(!HEADER || !FONT || !FONT_SIZE) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
135
|
+
className: "ql-formats",
|
|
136
|
+
children: [
|
|
137
|
+
!HEADER && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedSelect.TippedSelect, {
|
|
140
|
+
className: "ql-header",
|
|
141
|
+
tip: "Header",
|
|
142
|
+
values: ["", "1", "2", "3", "4", "5", "6"],
|
|
143
|
+
zIndex: userProps?.zIndex || 1
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
!FONT && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedSelect.TippedSelect, {
|
|
151
|
+
className: "ql-font",
|
|
152
|
+
defaultValue: "sans-serif",
|
|
153
|
+
options: import_constants.fonts,
|
|
154
|
+
tip: "Font",
|
|
155
|
+
values: optionsToValues(import_constants.fonts),
|
|
156
|
+
zIndex: userProps?.zIndex || 1
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
!FONT_SIZE && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedSelect.TippedSelect, {
|
|
164
|
+
className: "ql-size",
|
|
165
|
+
options: import_constants.sizes,
|
|
166
|
+
tip: "Font Size",
|
|
167
|
+
values: optionsToValues(import_constants.sizesReal),
|
|
168
|
+
zIndex: userProps?.zIndex || 1
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
171
|
+
]
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
(!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
176
|
+
className: "ql-formats",
|
|
177
|
+
children: [
|
|
178
|
+
!BOLD && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
179
|
+
zIndex: userProps?.zIndex || 1,
|
|
180
|
+
className: "ql-bold",
|
|
181
|
+
tip: "Bold"
|
|
182
|
+
}),
|
|
183
|
+
!ITALIC && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
184
|
+
zIndex: userProps?.zIndex || 1,
|
|
185
|
+
className: "ql-italic",
|
|
186
|
+
tip: "Italic"
|
|
187
|
+
}),
|
|
188
|
+
!UNDERLINE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
189
|
+
zIndex: userProps?.zIndex || 1,
|
|
190
|
+
className: "ql-underline",
|
|
191
|
+
tip: "Underline"
|
|
192
|
+
}),
|
|
193
|
+
!STRIKE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
194
|
+
zIndex: userProps?.zIndex || 1,
|
|
195
|
+
className: "ql-strike",
|
|
196
|
+
tip: "Strike"
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
}),
|
|
200
|
+
(!SUB || !SUPER) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
201
|
+
className: "ql-formats",
|
|
202
|
+
children: [
|
|
203
|
+
!SUB && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
204
|
+
zIndex: userProps?.zIndex || 1,
|
|
205
|
+
className: "ql-script",
|
|
206
|
+
tip: "Sub",
|
|
207
|
+
value: "sub"
|
|
208
|
+
}),
|
|
209
|
+
!SUPER && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
210
|
+
zIndex: userProps?.zIndex || 1,
|
|
211
|
+
className: "ql-script",
|
|
212
|
+
tip: "Super",
|
|
213
|
+
value: "super"
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
216
|
+
]
|
|
217
|
+
}),
|
|
218
|
+
(!ORDERED_LIST || !BULLET_LIST) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
219
|
+
className: "ql-formats",
|
|
220
|
+
children: [
|
|
221
|
+
!ORDERED_LIST && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
222
|
+
zIndex: userProps?.zIndex || 1,
|
|
223
|
+
className: "ql-list",
|
|
224
|
+
tip: "Ordered List",
|
|
225
|
+
value: "ordered"
|
|
226
|
+
}),
|
|
227
|
+
!BULLET_LIST && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
228
|
+
zIndex: userProps?.zIndex || 1,
|
|
229
|
+
className: "ql-list",
|
|
230
|
+
tip: "Bullet List",
|
|
231
|
+
value: "bullet"
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
}),
|
|
235
|
+
(!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
236
|
+
className: "ql-formats",
|
|
237
|
+
children: [
|
|
238
|
+
!INDENT_MINUS_ONE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
239
|
+
zIndex: userProps?.zIndex || 1,
|
|
240
|
+
className: "ql-indent",
|
|
241
|
+
tip: "Indent -1",
|
|
242
|
+
value: "-1"
|
|
243
|
+
}),
|
|
244
|
+
!INDENT_PLUS_ONE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
245
|
+
zIndex: userProps?.zIndex || 1,
|
|
246
|
+
className: "ql-indent",
|
|
247
|
+
tip: "Indent +1",
|
|
248
|
+
value: "+1"
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
}),
|
|
252
|
+
!ALIGN && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
253
|
+
className: "ql-formats",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedSelect.TippedSelect, {
|
|
256
|
+
zIndex: userProps?.zIndex || 1,
|
|
257
|
+
className: "ql-align",
|
|
258
|
+
tip: "Align"
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
261
|
+
]
|
|
262
|
+
}),
|
|
263
|
+
(!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
264
|
+
className: "ql-formats",
|
|
265
|
+
children: [
|
|
266
|
+
!FONT_COLOR && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Colors, {
|
|
267
|
+
zIndex: userProps?.zIndex || 1,
|
|
268
|
+
className: "ql-color",
|
|
269
|
+
tip: "Font Color"
|
|
270
|
+
}),
|
|
271
|
+
!FONT_BACKGROUND_COLOR && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Colors, {
|
|
272
|
+
zIndex: userProps?.zIndex || 1,
|
|
273
|
+
className: "ql-background",
|
|
274
|
+
tip: "Font Background Color"
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
277
|
+
]
|
|
278
|
+
}),
|
|
279
|
+
(!HYPERLINK || !IMAGE) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
280
|
+
className: "ql-formats",
|
|
281
|
+
children: [
|
|
282
|
+
!HYPERLINK && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
283
|
+
zIndex: userProps?.zIndex || 1,
|
|
284
|
+
className: "ql-link",
|
|
285
|
+
tip: "Hyperlink: Select Text First"
|
|
286
|
+
}),
|
|
287
|
+
!IMAGE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
288
|
+
zIndex: userProps?.zIndex || 1,
|
|
289
|
+
className: "ql-image",
|
|
290
|
+
tip: "Insert Image"
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {})
|
|
293
|
+
]
|
|
294
|
+
}),
|
|
295
|
+
!CLEAR_FORMAT && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
296
|
+
className: "ql-formats",
|
|
297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
298
|
+
zIndex: userProps?.zIndex || 1,
|
|
299
|
+
className: "ql-clean",
|
|
300
|
+
tip: "Clear Format (Select Text)"
|
|
301
|
+
})
|
|
302
|
+
}),
|
|
303
|
+
!SHOW_HTML && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
304
|
+
className: "ql-formats",
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {}),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
308
|
+
zIndex: userProps?.zIndex || 1,
|
|
309
|
+
style: {
|
|
310
|
+
width: "fit-content",
|
|
311
|
+
color: "#1e79c2",
|
|
312
|
+
fontWeight: "500"
|
|
313
|
+
},
|
|
314
|
+
onClick: handleShowHTML,
|
|
315
|
+
tip: showHTML ? "SHOW TEXT" : "SHOW HTML",
|
|
316
|
+
className: "ql-customFields-html",
|
|
317
|
+
children: showHTML ? "SHOW TEXT" : "SHOW HTML"
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
}),
|
|
321
|
+
customFields && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
322
|
+
className: "ql-formats",
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {}),
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TippedButton.TippedButton, {
|
|
326
|
+
zIndex: userProps?.zIndex || 1,
|
|
327
|
+
className: "ql-customFields",
|
|
328
|
+
tip: "Insert Custom Field",
|
|
329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomFields, {})
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
}),
|
|
333
|
+
customItems && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
334
|
+
style: { display: "inline-flex" },
|
|
335
|
+
children: customItems.map((Item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, {}),
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Item, {})
|
|
339
|
+
]
|
|
340
|
+
}))
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
});
|
|
257
344
|
};
|
|
258
345
|
//# sourceMappingURL=CustomToolbar.js.map
|