@zohodesk/dot 1.0.0-temp-197.3 → 1.0.0-temp-197.4

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/README.md CHANGED
@@ -4,11 +4,11 @@ In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
5
  # 1.5.5
6
6
  - **TextEditor (v0&v1)**
7
- - `inlineImageProps={allowedFileExtensions, fileNameMaxCharacters, fileSizeMax}` props added.
7
+ - `inlineImageProps={allowedFileExtensions, fileNameMaxCharacters, fileSizeMaxBytes}` props added.
8
8
  - default props,
9
9
  - `allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"]`
10
10
  - `fileNameMaxCharacters: 200,`
11
- - `fileSizeMax: 3 * 1024 * 1024`
11
+ - `fileSizeMaxBytes: 3 * 1024 * 1024`
12
12
  - `customInitOptions` prop added, using this can initialize the editor details.
13
13
  - `customCSS` prop suppported to customize the style to apply for editor, it adds css in style tag.
14
14
  - In `handleUpload` method reverted the `TicketReply` editor specific case handle.
@@ -25,7 +25,8 @@ export default class TextEditor extends Component {
25
25
  isResourceLoaded: false,
26
26
  isEditorShow: false
27
27
  };
28
- let methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', 'handleDropUpload', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
28
+ let methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', // 'handleDropUpload',
29
+ 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
29
30
  bind.apply(this, methods);
30
31
  }
31
32
 
@@ -53,7 +54,7 @@ export default class TextEditor extends Component {
53
54
  editorMode = '',
54
55
  editorOptions = {},
55
56
  needEditorFocus = true,
56
- handleDropUpload,
57
+ // handleDropUpload,
57
58
  fontFamily,
58
59
  fontSize,
59
60
  initCallback,
@@ -68,7 +69,7 @@ export default class TextEditor extends Component {
68
69
  content: fixEncoding(value),
69
70
  callback: this.editorCallback,
70
71
  imageuploadcallback: this.handleInlineUpload,
71
- handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
72
+ // handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
72
73
  contentChanged: this.handleChange,
73
74
  focusCallback: this.focusCallback,
74
75
  lineHeight: 'Normal',
@@ -126,7 +127,7 @@ export default class TextEditor extends Component {
126
127
  getRef && getRef(null);
127
128
  }
128
129
 
129
- componentWillReceiveProps(np) {
130
+ UNSAFE_componentWillReceiveProps(np) {
130
131
  let {
131
132
  changeEditorContent
132
133
  } = this.props;
@@ -264,12 +265,12 @@ export default class TextEditor extends Component {
264
265
  const {
265
266
  allowedFileExtensions,
266
267
  fileNameMaxCharacters,
267
- fileSizeMax
268
+ fileSizeMaxBytes
268
269
  } = inlineImageProps;
269
270
 
270
271
  if (!isFileNameSizeInvalid(file.name, fileNameMaxCharacters)) {
271
272
  if (file.size != 0) {
272
- if (file.size <= fileSizeMax) {
273
+ if (file.size <= fileSizeMaxBytes) {
273
274
  if (isImageFormat(file.name, allowedFileExtensions)) {
274
275
  progress && progress(true);
275
276
  this.handleUpload(file).then(res => {
@@ -294,23 +295,19 @@ export default class TextEditor extends Component {
294
295
  } else {
295
296
  failureCallback(fileNameLimitExceed);
296
297
  }
297
- }
298
+ } // handleDropUpload(file, successCallback, failureCallback) {
299
+ // let e = { target: { files: [file] } };
300
+ // let { handleDropUpload } = this.props;
301
+ // handleDropUpload(e).then(
302
+ // (res) => {
303
+ // successCallback(res);
304
+ // },
305
+ // () => {
306
+ // failureCallback();
307
+ // }
308
+ // );
309
+ // }
298
310
 
299
- handleDropUpload(file, successCallback, failureCallback) {
300
- let e = {
301
- target: {
302
- files: [file]
303
- }
304
- };
305
- let {
306
- handleDropUpload
307
- } = this.props;
308
- handleDropUpload(e).then(res => {
309
- successCallback(res);
310
- }, () => {
311
- failureCallback();
312
- });
313
- }
314
311
 
315
312
  blurCallback() {
316
313
  let {
@@ -404,7 +401,7 @@ export default class TextEditor extends Component {
404
401
  }), editorDoc && ImgLazyLoad ? /*#__PURE__*/React.createElement(ImgLazyLoad, {
405
402
  node: editorDoc
406
403
  }) : null, isReadOnly ? /*#__PURE__*/React.createElement("div", {
407
- class: styles.readOnlyMask
404
+ className: styles.readOnlyMask
408
405
  }) : null);
409
406
  }
410
407
 
@@ -14,6 +14,6 @@ export const defaultProps = {
14
14
  inlineImageProps: {
15
15
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
16
16
  fileNameMaxCharacters: 200,
17
- fileSizeMax: 3 * 1024 * 1024
17
+ fileSizeMaxBytes: 3 * 1024 * 1024
18
18
  }
19
19
  };
@@ -21,7 +21,7 @@ export const propTypes = {
21
21
  fileSizeLimitExceed: PropTypes.string
22
22
  }),
23
23
  id: PropTypes.string,
24
- initCallback: PropTypes.func.isRequired,
24
+ initCallback: PropTypes.func,
25
25
  isCustomScroll: PropTypes.bool,
26
26
  loadingComponent: PropTypes.node,
27
27
  mode: PropTypes.string,
@@ -45,9 +45,9 @@ export const propTypes = {
45
45
  dataSelectorId: PropTypes.string,
46
46
  customInitOptions: PropTypes.object,
47
47
  customCSS: PropTypes.string,
48
- inlineImageProps: {
48
+ inlineImageProps: PropTypes.shape({
49
49
  allowedFileExtensions: PropTypes.array,
50
50
  fileNameMaxCharacters: PropTypes.number,
51
- fileSizeMax: PropTypes.number
52
- }
51
+ fileSizeMaxBytes: PropTypes.number
52
+ })
53
53
  };
@@ -25,7 +25,8 @@ export default class TextEditor extends Component {
25
25
  isResourceLoaded: false,
26
26
  isEditorShow: false
27
27
  };
28
- let methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', 'handleDropUpload', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
28
+ let methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', // 'handleDropUpload',
29
+ 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
29
30
  bind.apply(this, methods);
30
31
  }
31
32
 
@@ -53,12 +54,13 @@ export default class TextEditor extends Component {
53
54
  editorMode = '',
54
55
  editorOptions = {},
55
56
  needEditorFocus = true,
56
- handleDropUpload,
57
+ // handleDropUpload,
57
58
  fontFamily,
58
59
  fontSize,
59
60
  initCallback,
60
61
  handleAlertMessage,
61
- needInlineAttachment
62
+ needInlineAttachment,
63
+ customInitOptions
62
64
  } = this.props;
63
65
 
64
66
  if (id && global.ZohoDeskEditor) {
@@ -67,7 +69,7 @@ export default class TextEditor extends Component {
67
69
  content: fixEncoding(value),
68
70
  callback: this.editorCallback,
69
71
  imageuploadcallback: this.handleInlineUpload,
70
- handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
72
+ // handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
71
73
  contentChanged: this.handleChange,
72
74
  focusCallback: this.focusCallback,
73
75
  lineHeight: 'Normal',
@@ -90,13 +92,17 @@ export default class TextEditor extends Component {
90
92
  htmlVersion: '<!Doctype html>'
91
93
  };
92
94
 
93
- if (!ZohoDeskEditor_Init.init) {
94
- global.editorInitialize && global.editorInitialize();
95
+ if (!customInitOptions) {
96
+ if (!ZohoDeskEditor_Init.init) {
97
+ global.editorInitialize && global.editorInitialize();
98
+ }
99
+
100
+ ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
95
101
  }
96
102
 
97
103
  defaultObj = Object.assign(defaultObj, editorOptions);
98
- ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
99
- ZohoDeskEditor.create && ZohoDeskEditor.create(defaultObj);
104
+ const globalEditor = global.ZohoDeskEditor;
105
+ globalEditor && typeof globalEditor.create == 'function' && globalEditor.create(defaultObj, customInitOptions);
100
106
  }
101
107
  }
102
108
 
@@ -121,7 +127,7 @@ export default class TextEditor extends Component {
121
127
  getRef && getRef(null);
122
128
  }
123
129
 
124
- componentWillReceiveProps(np) {
130
+ UNSAFE_componentWillReceiveProps(np) {
125
131
  let {
126
132
  changeEditorContent
127
133
  } = this.props;
@@ -259,12 +265,12 @@ export default class TextEditor extends Component {
259
265
  const {
260
266
  allowedFileExtensions,
261
267
  fileNameMaxCharacters,
262
- fileSizeMax
268
+ fileSizeMaxBytes
263
269
  } = inlineImageProps;
264
270
 
265
271
  if (!isFileNameSizeInvalid(file.name, fileNameMaxCharacters)) {
266
272
  if (file.size != 0) {
267
- if (file.size <= fileSizeMax) {
273
+ if (file.size <= fileSizeMaxBytes) {
268
274
  if (isImageFormat(file.name, allowedFileExtensions)) {
269
275
  progress && progress(true);
270
276
  this.handleUpload(file).then(res => {
@@ -289,23 +295,19 @@ export default class TextEditor extends Component {
289
295
  } else {
290
296
  failureCallback(fileNameLimitExceed);
291
297
  }
292
- }
298
+ } // handleDropUpload(file, successCallback, failureCallback) {
299
+ // let e = { target: { files: [file] } };
300
+ // let { handleDropUpload } = this.props;
301
+ // handleDropUpload(e).then(
302
+ // (res) => {
303
+ // successCallback(res);
304
+ // },
305
+ // () => {
306
+ // failureCallback();
307
+ // }
308
+ // );
309
+ // }
293
310
 
294
- handleDropUpload(file, successCallback, failureCallback) {
295
- let e = {
296
- target: {
297
- files: [file]
298
- }
299
- };
300
- let {
301
- handleDropUpload
302
- } = this.props;
303
- handleDropUpload(e).then(res => {
304
- successCallback(res);
305
- }, () => {
306
- failureCallback();
307
- });
308
- }
309
311
 
310
312
  blurCallback() {
311
313
  let {
@@ -331,15 +333,7 @@ export default class TextEditor extends Component {
331
333
  formData.append(getCSRFCookieName(), getCSRFCookie());
332
334
  }
333
335
 
334
- return onUpload(formData, file).then(res => {
335
- if (editorMode === 'TicketReply') {
336
- return `${res.data}&from=r`;
337
- }
338
-
339
- return res.data;
340
- }, err => {
341
- throw err;
342
- });
336
+ return onUpload(formData, file);
343
337
  } catch (err) {
344
338
  return Promise.reject();
345
339
  }
@@ -359,7 +353,6 @@ export default class TextEditor extends Component {
359
353
  let cont = value;
360
354
 
361
355
  if (typeof editor !== 'undefined') {
362
- // eslint-disable-next-line
363
356
  cont = editor['addFormEditor'] && editor['addFormEditor'].getContent();
364
357
  }
365
358
 
@@ -14,6 +14,6 @@ export const defaultProps = {
14
14
  inlineImageProps: {
15
15
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
16
16
  fileNameMaxCharacters: 200,
17
- fileSizeMax: 3 * 1024 * 1024
17
+ fileSizeMaxBytes: 3 * 1024 * 1024
18
18
  }
19
19
  };
@@ -21,7 +21,7 @@ export const propTypes = {
21
21
  fileSizeLimitExceed: PropTypes.string
22
22
  }),
23
23
  id: PropTypes.string,
24
- initCallback: PropTypes.func.isRequired,
24
+ initCallback: PropTypes.func,
25
25
  isCustomScroll: PropTypes.bool,
26
26
  loadingComponent: PropTypes.node,
27
27
  mode: PropTypes.string,
@@ -43,9 +43,9 @@ export const propTypes = {
43
43
  isEditorDefaultOpen: PropTypes.bool,
44
44
  toggleEdit: PropTypes.func,
45
45
  dataSelectorId: PropTypes.string,
46
- inlineImageProps: {
46
+ inlineImageProps: PropTypes.shape({
47
47
  allowedFileExtensions: PropTypes.array,
48
48
  fileNameMaxCharacters: PropTypes.number,
49
- fileSizeMax: PropTypes.number
50
- }
49
+ fileSizeMaxBytes: PropTypes.number
50
+ })
51
51
  };
@@ -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', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
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,7 +108,6 @@ 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,
@@ -118,14 +116,12 @@ var TextEditor = /*#__PURE__*/function (_Component) {
118
116
  customInitOptions = _this$props.customInitOptions;
119
117
 
120
118
  if (id && global.ZohoDeskEditor) {
121
- var _defaultObj;
122
-
123
- var defaultObj = (_defaultObj = {
119
+ var defaultObj = {
124
120
  id: id,
125
121
  content: (0, _editorUtils.fixEncoding)(value),
126
122
  callback: this.editorCallback,
127
123
  imageuploadcallback: this.handleInlineUpload,
128
- handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
124
+ // handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
129
125
  contentChanged: this.handleChange,
130
126
  focusCallback: this.focusCallback,
131
127
  lineHeight: 'Normal',
@@ -138,10 +134,15 @@ var TextEditor = /*#__PURE__*/function (_Component) {
138
134
  mode: mode,
139
135
  handleAlertMessage: handleAlertMessage,
140
136
  plainTextSwitchCallback: this.plainTextSwitchCallback,
141
- imgAspect: true
142
- }, _defineProperty(_defaultObj, "handleInlineDropImage", needInlineAttachment ? this.handleInlineUpload : null), _defineProperty(_defaultObj, "needInlineAttachHandling", needInlineAttachment), _defineProperty(_defaultObj, "hookOnInsertHTML", _editorUtils.validateEditorContentOnInsertHtml), _defineProperty(_defaultObj, "needCustomPaste", function needCustomPaste(event, editorObj) {
143
- return true; // By default reply editor needs customPaste, so returning true.
144
- }), _defineProperty(_defaultObj, "htmlVersion", '<!Doctype html>'), _defaultObj);
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
+ };
145
146
 
146
147
  if (!customInitOptions) {
147
148
  if (!ZohoDeskEditor_Init.init) {
@@ -177,8 +178,8 @@ var TextEditor = /*#__PURE__*/function (_Component) {
177
178
  getRef && getRef(null);
178
179
  }
179
180
  }, {
180
- key: "componentWillReceiveProps",
181
- value: function componentWillReceiveProps(np) {
181
+ key: "UNSAFE_componentWillReceiveProps",
182
+ value: function UNSAFE_componentWillReceiveProps(np) {
182
183
  var changeEditorContent = this.props.changeEditorContent;
183
184
  var id = np.id;
184
185
  var editorObj = global.editor ? global.editor[id] ? global.editor[id] : {} : {};
@@ -308,11 +309,11 @@ var TextEditor = /*#__PURE__*/function (_Component) {
308
309
  fileNameLimitExceed = i18nKeys.fileNameLimitExceed;
309
310
  var allowedFileExtensions = inlineImageProps.allowedFileExtensions,
310
311
  fileNameMaxCharacters = inlineImageProps.fileNameMaxCharacters,
311
- fileSizeMax = inlineImageProps.fileSizeMax;
312
+ fileSizeMaxBytes = inlineImageProps.fileSizeMaxBytes;
312
313
 
313
314
  if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name, fileNameMaxCharacters)) {
314
315
  if (file.size != 0) {
315
- if (file.size <= fileSizeMax) {
316
+ if (file.size <= fileSizeMaxBytes) {
316
317
  if ((0, _editorUtils.isImageFormat)(file.name, allowedFileExtensions)) {
317
318
  progress && progress(true);
318
319
  this.handleUpload(file).then(function (res) {
@@ -337,22 +338,19 @@ var TextEditor = /*#__PURE__*/function (_Component) {
337
338
  } else {
338
339
  failureCallback(fileNameLimitExceed);
339
340
  }
340
- }
341
- }, {
342
- key: "handleDropUpload",
343
- value: function handleDropUpload(file, successCallback, failureCallback) {
344
- var e = {
345
- target: {
346
- files: [file]
347
- }
348
- };
349
- var handleDropUpload = this.props.handleDropUpload;
350
- handleDropUpload(e).then(function (res) {
351
- successCallback(res);
352
- }, function () {
353
- failureCallback();
354
- });
355
- }
341
+ } // handleDropUpload(file, successCallback, failureCallback) {
342
+ // let e = { target: { files: [file] } };
343
+ // let { handleDropUpload } = this.props;
344
+ // handleDropUpload(e).then(
345
+ // (res) => {
346
+ // successCallback(res);
347
+ // },
348
+ // () => {
349
+ // failureCallback();
350
+ // }
351
+ // );
352
+ // }
353
+
356
354
  }, {
357
355
  key: "blurCallback",
358
356
  value: function blurCallback() {
@@ -441,7 +439,7 @@ var TextEditor = /*#__PURE__*/function (_Component) {
441
439
  }), editorDoc && ImgLazyLoad ? /*#__PURE__*/_react["default"].createElement(ImgLazyLoad, {
442
440
  node: editorDoc
443
441
  }) : null, isReadOnly ? /*#__PURE__*/_react["default"].createElement("div", {
444
- "class": _TextEditorModule["default"].readOnlyMask
442
+ className: _TextEditorModule["default"].readOnlyMask
445
443
  }) : null);
446
444
  }
447
445
  }]);
@@ -20,7 +20,7 @@ var defaultProps = {
20
20
  inlineImageProps: {
21
21
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
22
22
  fileNameMaxCharacters: 200,
23
- fileSizeMax: 3 * 1024 * 1024
23
+ fileSizeMaxBytes: 3 * 1024 * 1024
24
24
  }
25
25
  };
26
26
  exports.defaultProps = defaultProps;
@@ -31,7 +31,7 @@ var propTypes = {
31
31
  fileSizeLimitExceed: _propTypes["default"].string
32
32
  }),
33
33
  id: _propTypes["default"].string,
34
- initCallback: _propTypes["default"].func.isRequired,
34
+ initCallback: _propTypes["default"].func,
35
35
  isCustomScroll: _propTypes["default"].bool,
36
36
  loadingComponent: _propTypes["default"].node,
37
37
  mode: _propTypes["default"].string,
@@ -55,10 +55,10 @@ var propTypes = {
55
55
  dataSelectorId: _propTypes["default"].string,
56
56
  customInitOptions: _propTypes["default"].object,
57
57
  customCSS: _propTypes["default"].string,
58
- inlineImageProps: {
58
+ inlineImageProps: _propTypes["default"].shape({
59
59
  allowedFileExtensions: _propTypes["default"].array,
60
60
  fileNameMaxCharacters: _propTypes["default"].number,
61
- fileSizeMax: _propTypes["default"].number
62
- }
61
+ fileSizeMaxBytes: _propTypes["default"].number
62
+ })
63
63
  };
64
64
  exports.propTypes = propTypes;
@@ -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', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
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
+ customInitOptions = _this$props.customInitOptions;
118
117
 
119
118
  if (id && global.ZohoDeskEditor) {
120
- var _defaultObj;
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
- }, _defineProperty(_defaultObj, "handleInlineDropImage", needInlineAttachment ? this.handleInlineUpload : null), _defineProperty(_defaultObj, "needInlineAttachHandling", needInlineAttachment), _defineProperty(_defaultObj, "hookOnInsertHTML", _editorUtils.validateEditorContentOnInsertHtml), _defineProperty(_defaultObj, "needCustomPaste", function needCustomPaste(event, editorObj) {
142
- return true; // By default reply editor needs customPaste, so returning true.
143
- }), _defineProperty(_defaultObj, "htmlVersion", '<!Doctype html>'), _defaultObj);
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 (!customInitOptions) {
148
+ if (!ZohoDeskEditor_Init.init) {
149
+ global.editorInitialize && global.editorInitialize();
150
+ }
144
151
 
145
- if (!ZohoDeskEditor_Init.init) {
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
- ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
151
- ZohoDeskEditor.create && ZohoDeskEditor.create(defaultObj);
156
+ var globalEditor = global.ZohoDeskEditor;
157
+ globalEditor && typeof globalEditor.create == 'function' && globalEditor.create(defaultObj, customInitOptions);
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: "componentWillReceiveProps",
176
- value: function componentWillReceiveProps(np) {
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] : {} : {};
@@ -303,11 +309,11 @@ var TextEditor = /*#__PURE__*/function (_Component) {
303
309
  fileNameLimitExceed = i18nKeys.fileNameLimitExceed;
304
310
  var allowedFileExtensions = inlineImageProps.allowedFileExtensions,
305
311
  fileNameMaxCharacters = inlineImageProps.fileNameMaxCharacters,
306
- fileSizeMax = inlineImageProps.fileSizeMax;
312
+ fileSizeMaxBytes = inlineImageProps.fileSizeMaxBytes;
307
313
 
308
314
  if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name, fileNameMaxCharacters)) {
309
315
  if (file.size != 0) {
310
- if (file.size <= fileSizeMax) {
316
+ if (file.size <= fileSizeMaxBytes) {
311
317
  if ((0, _editorUtils.isImageFormat)(file.name, allowedFileExtensions)) {
312
318
  progress && progress(true);
313
319
  this.handleUpload(file).then(function (res) {
@@ -332,22 +338,19 @@ var TextEditor = /*#__PURE__*/function (_Component) {
332
338
  } else {
333
339
  failureCallback(fileNameLimitExceed);
334
340
  }
335
- }
336
- }, {
337
- key: "handleDropUpload",
338
- value: function handleDropUpload(file, successCallback, failureCallback) {
339
- var e = {
340
- target: {
341
- files: [file]
342
- }
343
- };
344
- var handleDropUpload = this.props.handleDropUpload;
345
- handleDropUpload(e).then(function (res) {
346
- successCallback(res);
347
- }, function () {
348
- failureCallback();
349
- });
350
- }
341
+ } // handleDropUpload(file, successCallback, failureCallback) {
342
+ // let e = { target: { files: [file] } };
343
+ // let { handleDropUpload } = this.props;
344
+ // handleDropUpload(e).then(
345
+ // (res) => {
346
+ // successCallback(res);
347
+ // },
348
+ // () => {
349
+ // failureCallback();
350
+ // }
351
+ // );
352
+ // }
353
+
351
354
  }, {
352
355
  key: "blurCallback",
353
356
  value: function blurCallback() {
@@ -372,15 +375,7 @@ var TextEditor = /*#__PURE__*/function (_Component) {
372
375
  formData.append(getCSRFCookieName(), getCSRFCookie());
373
376
  }
374
377
 
375
- return onUpload(formData, file).then(function (res) {
376
- if (editorMode === 'TicketReply') {
377
- return "".concat(res.data, "&from=r");
378
- }
379
-
380
- return res.data;
381
- }, function (err) {
382
- throw err;
383
- });
378
+ return onUpload(formData, file);
384
379
  } catch (err) {
385
380
  return Promise.reject();
386
381
  }
@@ -399,7 +394,6 @@ var TextEditor = /*#__PURE__*/function (_Component) {
399
394
  var cont = value;
400
395
 
401
396
  if (typeof editor !== 'undefined') {
402
- // eslint-disable-next-line
403
397
  cont = editor['addFormEditor'] && editor['addFormEditor'].getContent();
404
398
  }
405
399
 
@@ -20,7 +20,7 @@ var defaultProps = {
20
20
  inlineImageProps: {
21
21
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
22
22
  fileNameMaxCharacters: 200,
23
- fileSizeMax: 3 * 1024 * 1024
23
+ fileSizeMaxBytes: 3 * 1024 * 1024
24
24
  }
25
25
  };
26
26
  exports.defaultProps = defaultProps;