@zohodesk/dot 1.0.0-temp-198.3.3 → 1.0.0-temp-199
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/.cli/propValidation_report.html +1 -1
- package/README.md +39 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -0
- package/es/ActionButton/ActionButton.module.css +192 -192
- package/es/AlphabeticList/AlphabeticList.module.css +57 -57
- package/es/AttachmentViewer/AttachmentImage.js +68 -32
- package/es/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/es/AttachmentViewer/__tests__/AttachmentImage.spec.js +63 -13
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/es/AttachmentViewer/props/defaultProps.js +5 -1
- package/es/AttachmentViewer/props/propTypes.js +7 -3
- package/es/AttachmentViewer/utils.js +49 -0
- package/es/ChannelIcon/ChannelIcon.module.css +225 -225
- package/es/FormAction/FormAction.module.css +100 -100
- package/es/IconButton/IconButton.module.css +22 -22
- package/es/Image/Image.js +6 -2
- package/es/Image/props/propTypes.js +3 -1
- package/es/TagWithIcon/TagWithIcon.module.css +66 -66
- package/es/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/form/fields/TextEditor/TextEditor.js +64 -64
- package/es/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/es/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/es/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/es/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/es/list/Comment/Comment.module.css +29 -29
- package/es/list/Dot/Dot.module.css +15 -15
- package/es/list/ListLayout/ListLayout.module.css +79 -79
- package/es/list/Subject/Subject.module.css +34 -34
- package/es/list/Thread/Thread.module.css +42 -42
- package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
- package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/lookup/header/Search/LookupSearch.module.css +26 -26
- package/es/lookup/header/Search/Search.js +55 -38
- package/es/lookup/header/Search/props/defaultProps.js +2 -1
- package/es/lookup/header/Search/props/propTypes.js +5 -1
- package/es/utils/editorUtils.js +6 -6
- package/es/v1/AttachmentViewer/AttachmentImage.js +44 -23
- package/es/v1/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/es/v1/Image/Image.js +6 -2
- package/es/v1/Image/props/propTypes.js +3 -1
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/v1/form/fields/TextEditor/TextEditor.js +63 -64
- package/es/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/v1/utils/editorUtils.js +6 -6
- package/es/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/lib/ActionButton/ActionButton.module.css +192 -192
- package/lib/AlphabeticList/AlphabeticList.module.css +57 -57
- package/lib/AttachmentViewer/AttachmentImage.js +74 -36
- package/lib/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/lib/AttachmentViewer/__tests__/AttachmentImage.spec.js +64 -13
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/lib/AttachmentViewer/props/defaultProps.js +5 -1
- package/lib/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/AttachmentViewer/utils.js +60 -1
- package/lib/ChannelIcon/ChannelIcon.module.css +225 -225
- package/lib/FormAction/FormAction.module.css +100 -100
- package/lib/IconButton/IconButton.module.css +22 -22
- package/lib/Image/Image.js +6 -2
- package/lib/Image/props/propTypes.js +3 -1
- package/lib/TagWithIcon/TagWithIcon.module.css +66 -66
- package/lib/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/form/fields/TextEditor/TextEditor.js +74 -74
- package/lib/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/lib/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/lib/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/lib/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/lib/list/Comment/Comment.module.css +29 -29
- package/lib/list/Dot/Dot.module.css +15 -15
- package/lib/list/ListLayout/ListLayout.module.css +79 -79
- package/lib/list/Subject/Subject.module.css +34 -34
- package/lib/list/Thread/Thread.module.css +42 -42
- package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
- package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
- package/lib/lookup/header/Search/Search.js +73 -64
- package/lib/lookup/header/Search/props/defaultProps.js +2 -1
- package/lib/lookup/header/Search/props/propTypes.js +9 -3
- package/lib/utils/editorUtils.js +6 -5
- package/lib/v1/AttachmentViewer/AttachmentImage.js +52 -24
- package/lib/v1/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/v1/Image/Image.js +6 -2
- package/lib/v1/Image/props/propTypes.js +3 -1
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/v1/form/fields/TextEditor/TextEditor.js +73 -74
- package/lib/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/v1/utils/editorUtils.js +6 -5
- package/lib/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +6 -2
|
@@ -27,8 +27,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
-
|
|
32
30
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
31
|
|
|
34
32
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -70,7 +68,8 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
70
68
|
isResourceLoaded: false,
|
|
71
69
|
isEditorShow: false
|
|
72
70
|
};
|
|
73
|
-
var methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', 'handleDropUpload',
|
|
71
|
+
var methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', // 'handleDropUpload',
|
|
72
|
+
'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
|
|
74
73
|
|
|
75
74
|
_editorUtils.bind.apply(_assertThisInitialized(_this), methods);
|
|
76
75
|
|
|
@@ -109,22 +108,20 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
109
108
|
editorOptions = _this$props$editorOpt === void 0 ? {} : _this$props$editorOpt,
|
|
110
109
|
_this$props$needEdito = _this$props.needEditorFocus,
|
|
111
110
|
needEditorFocus = _this$props$needEdito === void 0 ? true : _this$props$needEdito,
|
|
112
|
-
handleDropUpload = _this$props.handleDropUpload,
|
|
113
111
|
fontFamily = _this$props.fontFamily,
|
|
114
112
|
fontSize = _this$props.fontSize,
|
|
115
113
|
initCallback = _this$props.initCallback,
|
|
116
114
|
handleAlertMessage = _this$props.handleAlertMessage,
|
|
117
|
-
needInlineAttachment = _this$props.needInlineAttachment
|
|
115
|
+
needInlineAttachment = _this$props.needInlineAttachment,
|
|
116
|
+
customInitOption = _this$props.customInitOption;
|
|
118
117
|
|
|
119
118
|
if (id && global.ZohoDeskEditor) {
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
var defaultObj = (_defaultObj = {
|
|
119
|
+
var defaultObj = {
|
|
123
120
|
id: id,
|
|
124
121
|
content: (0, _editorUtils.fixEncoding)(value),
|
|
125
122
|
callback: this.editorCallback,
|
|
126
123
|
imageuploadcallback: this.handleInlineUpload,
|
|
127
|
-
handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
|
|
124
|
+
// handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
|
|
128
125
|
contentChanged: this.handleChange,
|
|
129
126
|
focusCallback: this.focusCallback,
|
|
130
127
|
lineHeight: 'Normal',
|
|
@@ -137,18 +134,27 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
137
134
|
mode: mode,
|
|
138
135
|
handleAlertMessage: handleAlertMessage,
|
|
139
136
|
plainTextSwitchCallback: this.plainTextSwitchCallback,
|
|
140
|
-
imgAspect: true
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
imgAspect: true,
|
|
138
|
+
handleInlineDropImage: needInlineAttachment ? this.handleInlineUpload : null,
|
|
139
|
+
needInlineAttachHandling: needInlineAttachment,
|
|
140
|
+
hookOnInsertHTML: _editorUtils.validateEditorContentOnInsertHtml,
|
|
141
|
+
needCustomPaste: function needCustomPaste(event, editorObj) {
|
|
142
|
+
return true; // By default reply editor needs customPaste, so returning true.
|
|
143
|
+
},
|
|
144
|
+
htmlVersion: '<!Doctype html>'
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
if (!customInitOption) {
|
|
148
|
+
if (!ZohoDeskEditor_Init.init) {
|
|
149
|
+
global.editorInitialize && global.editorInitialize();
|
|
150
|
+
}
|
|
144
151
|
|
|
145
|
-
|
|
146
|
-
global.editorInitialize && global.editorInitialize();
|
|
152
|
+
ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
defaultObj = Object.assign(defaultObj, editorOptions);
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
var globalEditor = global.ZohoDeskEditor;
|
|
157
|
+
globalEditor && typeof globalEditor.create == 'function' && globalEditor.create(defaultObj, customInitOption);
|
|
152
158
|
}
|
|
153
159
|
}
|
|
154
160
|
}, {
|
|
@@ -172,8 +178,8 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
172
178
|
getRef && getRef(null);
|
|
173
179
|
}
|
|
174
180
|
}, {
|
|
175
|
-
key: "
|
|
176
|
-
value: function
|
|
181
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
182
|
+
value: function UNSAFE_componentWillReceiveProps(np) {
|
|
177
183
|
var changeEditorContent = this.props.changeEditorContent;
|
|
178
184
|
var id = np.id;
|
|
179
185
|
var editorObj = global.editor ? global.editor[id] ? global.editor[id] : {} : {};
|
|
@@ -251,7 +257,8 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
251
257
|
var _this$props5 = this.props,
|
|
252
258
|
editorCallback = _this$props5.editorCallback,
|
|
253
259
|
getRef = _this$props5.getRef,
|
|
254
|
-
isCustomScroll = _this$props5.isCustomScroll
|
|
260
|
+
isCustomScroll = _this$props5.isCustomScroll,
|
|
261
|
+
customCSS = _this$props5.customCSS;
|
|
255
262
|
this.setState({
|
|
256
263
|
isEditorLoad: true,
|
|
257
264
|
isEditorShow: true
|
|
@@ -263,18 +270,6 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
263
270
|
global.editor[id] = editorObj;
|
|
264
271
|
}
|
|
265
272
|
|
|
266
|
-
var css = 'pre {white-space: pre-wrap}',
|
|
267
|
-
head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
|
|
268
|
-
style = document.createElement('style');
|
|
269
|
-
style.type = 'text/css';
|
|
270
|
-
|
|
271
|
-
if (style.styleSheet) {
|
|
272
|
-
style.styleSheet.cssText = css;
|
|
273
|
-
} else {
|
|
274
|
-
style.appendChild(editorObj.doc.createTextNode(css));
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
head.appendChild(style);
|
|
278
273
|
editorCallback && editorCallback(editorObj);
|
|
279
274
|
var iframe = (0, _selectn["default"])('iframe.contentDocument.body', editorObj) || null;
|
|
280
275
|
var iframeHead = (0, _selectn["default"])('iframe.contentDocument.head', editorObj) || null;
|
|
@@ -292,9 +287,12 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
292
287
|
iframe.classList.add('scroll');
|
|
293
288
|
}
|
|
294
289
|
|
|
295
|
-
var
|
|
296
|
-
|
|
297
|
-
|
|
290
|
+
var customStyleTag = document.createElement('style');
|
|
291
|
+
customStyleTag.type = 'text/css';
|
|
292
|
+
var customizedCSS = "pre {white-space: pre-wrap} ".concat(customCSS);
|
|
293
|
+
var fontCSS = "@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}";
|
|
294
|
+
customStyleTag.textContent = "".concat(customizedCSS, " ").concat(fontCSS);
|
|
295
|
+
iframeHead.appendChild(customStyleTag);
|
|
298
296
|
}
|
|
299
297
|
}
|
|
300
298
|
}, {
|
|
@@ -303,12 +301,24 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
303
301
|
var _this$props6 = this.props,
|
|
304
302
|
id = _this$props6.id,
|
|
305
303
|
progress = _this$props6.setInlineAttachmentInProgress,
|
|
306
|
-
i18nKeys = _this$props6.i18nKeys
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
i18nKeys = _this$props6.i18nKeys,
|
|
305
|
+
inlineImageProps = _this$props6.inlineImageProps;
|
|
306
|
+
var fileUploadError = i18nKeys.fileUploadError,
|
|
307
|
+
fileNotSupported = i18nKeys.fileNotSupported,
|
|
308
|
+
fileSizeLimitExceed = i18nKeys.fileSizeLimitExceed,
|
|
309
|
+
fileEmptyError = i18nKeys.fileEmptyError,
|
|
310
|
+
fileNameLimitExceed = i18nKeys.fileNameLimitExceed;
|
|
311
|
+
var _inlineImageProps$all = inlineImageProps.allowedFileExtensions,
|
|
312
|
+
allowedFileExtensions = _inlineImageProps$all === void 0 ? ["jpeg", "jpg", "png", "gif", "bmp", "ico"] : _inlineImageProps$all,
|
|
313
|
+
_inlineImageProps$fil = inlineImageProps.fileNameMaxCharacters,
|
|
314
|
+
fileNameMaxCharacters = _inlineImageProps$fil === void 0 ? 200 : _inlineImageProps$fil,
|
|
315
|
+
_inlineImageProps$fil2 = inlineImageProps.fileSizeMaxBytes,
|
|
316
|
+
fileSizeMaxBytes = _inlineImageProps$fil2 === void 0 ? 3 * 1024 * 1024 : _inlineImageProps$fil2;
|
|
317
|
+
|
|
318
|
+
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name, fileNameMaxCharacters)) {
|
|
309
319
|
if (file.size != 0) {
|
|
310
|
-
if (file.size <=
|
|
311
|
-
if ((0, _editorUtils.isImageFormat)(file.name)) {
|
|
320
|
+
if (file.size <= fileSizeMaxBytes) {
|
|
321
|
+
if ((0, _editorUtils.isImageFormat)(file.name, allowedFileExtensions)) {
|
|
312
322
|
progress && progress(true);
|
|
313
323
|
this.handleUpload(file).then(function (res) {
|
|
314
324
|
successCallback(res);
|
|
@@ -318,36 +328,33 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
318
328
|
(0, _editorUtils.triggerKeyup)(editorObj.doc);
|
|
319
329
|
}
|
|
320
330
|
}, function () {
|
|
321
|
-
failureCallback(
|
|
331
|
+
failureCallback(fileUploadError);
|
|
322
332
|
});
|
|
323
333
|
} else {
|
|
324
|
-
failureCallback(
|
|
334
|
+
failureCallback(fileNotSupported);
|
|
325
335
|
}
|
|
326
336
|
} else {
|
|
327
|
-
failureCallback(
|
|
337
|
+
failureCallback(fileSizeLimitExceed);
|
|
328
338
|
}
|
|
329
339
|
} else {
|
|
330
|
-
failureCallback(
|
|
340
|
+
failureCallback(fileEmptyError);
|
|
331
341
|
}
|
|
332
342
|
} else {
|
|
333
|
-
failureCallback(
|
|
343
|
+
failureCallback(fileNameLimitExceed);
|
|
334
344
|
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
failureCallback();
|
|
349
|
-
});
|
|
350
|
-
}
|
|
345
|
+
} // handleDropUpload(file, successCallback, failureCallback) {
|
|
346
|
+
// let e = { target: { files: [file] } };
|
|
347
|
+
// let { handleDropUpload } = this.props;
|
|
348
|
+
// handleDropUpload(e).then(
|
|
349
|
+
// (res) => {
|
|
350
|
+
// successCallback(res);
|
|
351
|
+
// },
|
|
352
|
+
// () => {
|
|
353
|
+
// failureCallback();
|
|
354
|
+
// }
|
|
355
|
+
// );
|
|
356
|
+
// }
|
|
357
|
+
|
|
351
358
|
}, {
|
|
352
359
|
key: "blurCallback",
|
|
353
360
|
value: function blurCallback() {
|
|
@@ -372,15 +379,7 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
372
379
|
formData.append(getCSRFCookieName(), getCSRFCookie());
|
|
373
380
|
}
|
|
374
381
|
|
|
375
|
-
return onUpload(formData, file)
|
|
376
|
-
if (editorMode === 'TicketReply') {
|
|
377
|
-
return "".concat(res.data, "&from=r");
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return res.data;
|
|
381
|
-
}, function (err) {
|
|
382
|
-
throw err;
|
|
383
|
-
});
|
|
382
|
+
return onUpload(formData, file);
|
|
384
383
|
} catch (err) {
|
|
385
384
|
return Promise.reject();
|
|
386
385
|
}
|
|
@@ -399,7 +398,6 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
399
398
|
var cont = value;
|
|
400
399
|
|
|
401
400
|
if (typeof editor !== 'undefined') {
|
|
402
|
-
// eslint-disable-next-line
|
|
403
401
|
cont = editor['addFormEditor'] && editor['addFormEditor'].getContent();
|
|
404
402
|
}
|
|
405
403
|
|
|
@@ -428,13 +426,14 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
428
426
|
loadingComponent = _this$props9.loadingComponent,
|
|
429
427
|
isNightMode = _this$props9.isNightMode,
|
|
430
428
|
isReadOnly = _this$props9.isReadOnly,
|
|
431
|
-
dataSelectorId = _this$props9.dataSelectorId
|
|
429
|
+
dataSelectorId = _this$props9.dataSelectorId,
|
|
430
|
+
isDisabled = _this$props9.isDisabled;
|
|
432
431
|
var _this$state = this.state,
|
|
433
432
|
isEditorLoad = _this$state.isEditorLoad,
|
|
434
433
|
isEditorShow = _this$state.isEditorShow;
|
|
435
434
|
var editorDoc = ImgLazyLoad && global.editor && global.editor[id] ? global.editor[id].doc : null;
|
|
436
435
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
437
|
-
className: "".concat(_TextEditorModule["default"].textEditor, " ").concat(_TextEditorModule["default"][type], " ").concat(_TextEditorModule["default"][border], "\n ").concat(isNightMode ? _TextEditorModule["default"].night : _TextEditorModule["default"].light, " ").concat(isReadOnly ? _TextEditorModule["default"].readOnly : '', " ").concat(!isEditorShow ? _TextEditorModule["default"].editorHide : ''),
|
|
436
|
+
className: "".concat(_TextEditorModule["default"].textEditor, " ").concat(_TextEditorModule["default"][type], " ").concat(_TextEditorModule["default"][border], "\n ").concat(isNightMode ? _TextEditorModule["default"].night : _TextEditorModule["default"].light, " ").concat(isReadOnly ? _TextEditorModule["default"].readOnly : '', " ").concat(isReadOnly || isDisabled ? _TextEditorModule["default"].disable : '', " ").concat(!isEditorShow ? _TextEditorModule["default"].editorHide : ''),
|
|
438
437
|
dataId: dataId,
|
|
439
438
|
"data-isEditor": true,
|
|
440
439
|
dataSelectorId: dataSelectorId
|
|
@@ -444,7 +443,7 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
444
443
|
dataId: dataId
|
|
445
444
|
}), editorDoc && ImgLazyLoad ? /*#__PURE__*/_react["default"].createElement(ImgLazyLoad, {
|
|
446
445
|
node: editorDoc
|
|
447
|
-
}) : null, isReadOnly ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
446
|
+
}) : null, isReadOnly || isDisabled ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
448
447
|
className: _TextEditorModule["default"].readOnlyMask
|
|
449
448
|
}) : null);
|
|
450
449
|
}
|
|
@@ -15,6 +15,9 @@ var defaultProps = {
|
|
|
15
15
|
needInlineAttachment: false,
|
|
16
16
|
isNightMode: false,
|
|
17
17
|
isReadOnly: false,
|
|
18
|
-
dataSelectorId: 'textEditor'
|
|
18
|
+
dataSelectorId: 'textEditor',
|
|
19
|
+
customCSS: '',
|
|
20
|
+
isDisabled: false,
|
|
21
|
+
inlineImageProps: {}
|
|
19
22
|
};
|
|
20
23
|
exports.defaultProps = defaultProps;
|
|
@@ -22,7 +22,6 @@ var propTypes = {
|
|
|
22
22
|
fontSize: _propTypes["default"].string,
|
|
23
23
|
getRef: _propTypes["default"].func,
|
|
24
24
|
handleAlertMessage: _propTypes["default"].func,
|
|
25
|
-
handleDropUpload: _propTypes["default"].func,
|
|
26
25
|
i18nKeys: _propTypes["default"].shape({
|
|
27
26
|
fileUploadError: _propTypes["default"].string,
|
|
28
27
|
fileNotSupported: _propTypes["default"].string,
|
|
@@ -31,7 +30,7 @@ var propTypes = {
|
|
|
31
30
|
fileSizeLimitExceed: _propTypes["default"].string
|
|
32
31
|
}),
|
|
33
32
|
id: _propTypes["default"].string,
|
|
34
|
-
initCallback: _propTypes["default"].func
|
|
33
|
+
initCallback: _propTypes["default"].func,
|
|
35
34
|
isCustomScroll: _propTypes["default"].bool,
|
|
36
35
|
loadingComponent: _propTypes["default"].node,
|
|
37
36
|
mode: _propTypes["default"].string,
|
|
@@ -52,6 +51,14 @@ var propTypes = {
|
|
|
52
51
|
getCSRFCookie: _propTypes["default"].string,
|
|
53
52
|
isEditorDefaultOpen: _propTypes["default"].bool,
|
|
54
53
|
toggleEdit: _propTypes["default"].func,
|
|
55
|
-
dataSelectorId: _propTypes["default"].string
|
|
54
|
+
dataSelectorId: _propTypes["default"].string,
|
|
55
|
+
customInitOption: _propTypes["default"].object,
|
|
56
|
+
customCSS: _propTypes["default"].string,
|
|
57
|
+
isDisabled: _propTypes["default"].bool,
|
|
58
|
+
inlineImageProps: _propTypes["default"].shape({
|
|
59
|
+
allowedFileExtensions: _propTypes["default"].array,
|
|
60
|
+
fileNameMaxCharacters: _propTypes["default"].number,
|
|
61
|
+
fileSizeMaxBytes: _propTypes["default"].number
|
|
62
|
+
})
|
|
56
63
|
};
|
|
57
64
|
exports.propTypes = propTypes;
|
|
@@ -120,6 +120,8 @@ function StatusDropdown(props) {
|
|
|
120
120
|
isRestrictScroll = props.isRestrictScroll,
|
|
121
121
|
positionsOffset = props.positionsOffset,
|
|
122
122
|
targetOffset = props.targetOffset,
|
|
123
|
+
renderTargetElement = props.renderTargetElement,
|
|
124
|
+
renderFooterElement = props.renderFooterElement,
|
|
123
125
|
_props$a11y = props.a11y,
|
|
124
126
|
a11y = _props$a11y === void 0 ? {} : _props$a11y;
|
|
125
127
|
|
|
@@ -204,7 +206,11 @@ function StatusDropdown(props) {
|
|
|
204
206
|
className: _StatusDropdownModule["default"].posRel,
|
|
205
207
|
onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? handleTogglePopup : undefined,
|
|
206
208
|
onMouseLeave: showOnHover && !isDisabled && !isReadOnly && isEditable ? handleTogglePopup : undefined
|
|
207
|
-
},
|
|
209
|
+
}, renderTargetElement ? renderTargetElement({
|
|
210
|
+
handleTogglePopup: handleTogglePopup,
|
|
211
|
+
isPopupOpen: isPopupOpen,
|
|
212
|
+
getTargetRef: getTargetRef
|
|
213
|
+
}) : /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
208
214
|
tagName: "button",
|
|
209
215
|
alignBox: "row",
|
|
210
216
|
className: "".concat(_StatusDropdownModule["default"].container, " ").concat(containerClass, " ").concat(_semanticButtonModule["default"].buttonReset),
|
|
@@ -344,7 +350,7 @@ function StatusDropdown(props) {
|
|
|
344
350
|
getEmptyState: emptySearchSVG
|
|
345
351
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
346
352
|
className: _StatusDropdownModule["default"].loader
|
|
347
|
-
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null)))));
|
|
353
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), renderFooterElement ? renderFooterElement : null));
|
|
348
354
|
}) : null);
|
|
349
355
|
}
|
|
350
356
|
|
|
@@ -30,5 +30,5 @@ var propTypes = (_propTypes = {
|
|
|
30
30
|
idName: _propTypes2["default"].string,
|
|
31
31
|
isArrow: _propTypes2["default"].bool,
|
|
32
32
|
isDataLoaded: _propTypes2["default"].bool
|
|
33
|
-
}, _defineProperty(_propTypes, "isDataLoaded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isDisabled", _propTypes2["default"].bool), _defineProperty(_propTypes, "isEditable", _propTypes2["default"].bool), _defineProperty(_propTypes, "isFetchingOptions", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupActive", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupOpen", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupReady", _propTypes2["default"].bool), _defineProperty(_propTypes, "isReadOnly", _propTypes2["default"].bool), _defineProperty(_propTypes, "isSearch", _propTypes2["default"].bool), _defineProperty(_propTypes, "keyName", _propTypes2["default"].string), _defineProperty(_propTypes, "left", _propTypes2["default"].number), _defineProperty(_propTypes, "needExternalPopupState", _propTypes2["default"].bool), _defineProperty(_propTypes, "needResponsive", _propTypes2["default"].bool), _defineProperty(_propTypes, "needTick", _propTypes2["default"].bool), _defineProperty(_propTypes, "onClick", _propTypes2["default"].func), _defineProperty(_propTypes, "onTogglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "options", _propTypes2["default"].array.isRequired), _defineProperty(_propTypes, "placeHolderText", _propTypes2["default"].string), _defineProperty(_propTypes, "position", _propTypes2["default"].string), _defineProperty(_propTypes, "removeClose", _propTypes2["default"].func), _defineProperty(_propTypes, "right", _propTypes2["default"].number), _defineProperty(_propTypes, "searchBoxSize", _propTypes2["default"].oneOf(['small', 'medium', 'xmedium'])), _defineProperty(_propTypes, "searchEmptyHint", _propTypes2["default"].string), _defineProperty(_propTypes, "searchErrorText", _propTypes2["default"].string), _defineProperty(_propTypes, "showIconOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "showOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "statusColor", _propTypes2["default"].string), _defineProperty(_propTypes, "targetAlign", _propTypes2["default"].oneOf(['vertical', 'horizontal', 'both', 'top', 'right', 'bottom', 'left', 'between', 'around'])), _defineProperty(_propTypes, "title", _propTypes2["default"].string), _defineProperty(_propTypes, "togglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "value", _propTypes2["default"].node), _defineProperty(_propTypes, "needMultiLineText", _propTypes2["default"].bool), _defineProperty(_propTypes, "onSelectLabel", _propTypes2["default"].func), _defineProperty(_propTypes, "top", _propTypes2["default"].number), _defineProperty(_propTypes, "isAbsolutePositioningNeeded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isRestrictScroll", _propTypes2["default"].bool), _defineProperty(_propTypes, "positionsOffset", _propTypes2["default"].object), _defineProperty(_propTypes, "targetOffset", _propTypes2["default"].object), _defineProperty(_propTypes, "a11y", _propTypes2["default"].object), _propTypes);
|
|
33
|
+
}, _defineProperty(_propTypes, "isDataLoaded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isDisabled", _propTypes2["default"].bool), _defineProperty(_propTypes, "isEditable", _propTypes2["default"].bool), _defineProperty(_propTypes, "isFetchingOptions", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupActive", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupOpen", _propTypes2["default"].bool), _defineProperty(_propTypes, "isPopupReady", _propTypes2["default"].bool), _defineProperty(_propTypes, "isReadOnly", _propTypes2["default"].bool), _defineProperty(_propTypes, "isSearch", _propTypes2["default"].bool), _defineProperty(_propTypes, "keyName", _propTypes2["default"].string), _defineProperty(_propTypes, "left", _propTypes2["default"].number), _defineProperty(_propTypes, "needExternalPopupState", _propTypes2["default"].bool), _defineProperty(_propTypes, "needResponsive", _propTypes2["default"].bool), _defineProperty(_propTypes, "needTick", _propTypes2["default"].bool), _defineProperty(_propTypes, "onClick", _propTypes2["default"].func), _defineProperty(_propTypes, "onTogglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "options", _propTypes2["default"].array.isRequired), _defineProperty(_propTypes, "placeHolderText", _propTypes2["default"].string), _defineProperty(_propTypes, "position", _propTypes2["default"].string), _defineProperty(_propTypes, "removeClose", _propTypes2["default"].func), _defineProperty(_propTypes, "right", _propTypes2["default"].number), _defineProperty(_propTypes, "searchBoxSize", _propTypes2["default"].oneOf(['small', 'medium', 'xmedium'])), _defineProperty(_propTypes, "searchEmptyHint", _propTypes2["default"].string), _defineProperty(_propTypes, "searchErrorText", _propTypes2["default"].string), _defineProperty(_propTypes, "showIconOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "showOnHover", _propTypes2["default"].bool), _defineProperty(_propTypes, "statusColor", _propTypes2["default"].string), _defineProperty(_propTypes, "targetAlign", _propTypes2["default"].oneOf(['vertical', 'horizontal', 'both', 'top', 'right', 'bottom', 'left', 'between', 'around'])), _defineProperty(_propTypes, "title", _propTypes2["default"].string), _defineProperty(_propTypes, "togglePopup", _propTypes2["default"].func), _defineProperty(_propTypes, "value", _propTypes2["default"].node), _defineProperty(_propTypes, "needMultiLineText", _propTypes2["default"].bool), _defineProperty(_propTypes, "onSelectLabel", _propTypes2["default"].func), _defineProperty(_propTypes, "top", _propTypes2["default"].number), _defineProperty(_propTypes, "isAbsolutePositioningNeeded", _propTypes2["default"].bool), _defineProperty(_propTypes, "isRestrictScroll", _propTypes2["default"].bool), _defineProperty(_propTypes, "positionsOffset", _propTypes2["default"].object), _defineProperty(_propTypes, "targetOffset", _propTypes2["default"].object), _defineProperty(_propTypes, "renderTargetElement", _propTypes2["default"].func), _defineProperty(_propTypes, "renderFooterElement", _propTypes2["default"].node), _defineProperty(_propTypes, "a11y", _propTypes2["default"].object), _propTypes);
|
|
34
34
|
exports.propTypes = propTypes;
|
|
@@ -15,8 +15,8 @@ exports.isImageFormat = isImageFormat;
|
|
|
15
15
|
exports.loadResource = loadResource;
|
|
16
16
|
exports.triggerKeyup = triggerKeyup;
|
|
17
17
|
exports.validateEditorContentOnInsertHtml = validateEditorContentOnInsertHtml;
|
|
18
|
-
var ATTACHMENT_FILE_NAME_SIZE_LIMIT = 200; // editorUtils
|
|
19
18
|
|
|
19
|
+
// editorUtils
|
|
20
20
|
function editorContentValidate(editorObj) {
|
|
21
21
|
var content = editorObj && editorObj.getContent && editorObj.getContent() || '';
|
|
22
22
|
|
|
@@ -67,13 +67,14 @@ function encodeForHtml(str) {
|
|
|
67
67
|
} // attachment
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
function isFileNameSizeInvalid(fileName) {
|
|
71
|
-
return fileName.length >
|
|
70
|
+
function isFileNameSizeInvalid(fileName, fileNameMaxCharacters) {
|
|
71
|
+
return fileName.length > fileNameMaxCharacters;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function isImageFormat(fileName) {
|
|
74
|
+
function isImageFormat(fileName, allowedFileExtensions) {
|
|
75
75
|
var extension = getExtensionFromFileName(fileName);
|
|
76
|
-
|
|
76
|
+
var isValidExtension = allowedFileExtensions.includes(extension);
|
|
77
|
+
return isValidExtension;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
function getExtensionFromFileName(fileName) {
|