@zohodesk/dot 1.0.0-temp-197.1 → 1.0.0-temp-197.2
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 +11 -0
- package/es/form/fields/TextEditor/TextEditor.js +6 -6
- package/es/form/fields/TextEditor/props/defaultProps.js +3 -3
- package/es/form/fields/TextEditor/props/propTypes.js +3 -3
- package/es/utils/editorUtils.js +4 -4
- package/es/v1/form/fields/TextEditor/TextEditor.js +6 -6
- package/es/v1/form/fields/TextEditor/props/defaultProps.js +3 -3
- package/es/v1/form/fields/TextEditor/props/propTypes.js +3 -3
- package/es/v1/utils/editorUtils.js +4 -4
- package/lib/form/fields/TextEditor/TextEditor.js +6 -6
- package/lib/form/fields/TextEditor/props/defaultProps.js +3 -3
- package/lib/form/fields/TextEditor/props/propTypes.js +3 -3
- package/lib/utils/editorUtils.js +4 -4
- package/lib/v1/form/fields/TextEditor/TextEditor.js +6 -6
- package/lib/v1/form/fields/TextEditor/props/defaultProps.js +3 -3
- package/lib/v1/form/fields/TextEditor/props/propTypes.js +3 -3
- package/lib/v1/utils/editorUtils.js +4 -4
- package/package.json +1 -1
- package/result.json +1 -1
- package/unittest/index.html +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.5.5
|
|
6
|
+
- **TextEditor (v0&v1)**
|
|
7
|
+
- `inlineImageProps={allowedFileExtensions, fileNameMaxCharacters, fileSizeMax}` props added.
|
|
8
|
+
- default props,
|
|
9
|
+
- `allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"]`
|
|
10
|
+
- `fileNameMaxCharacters: 200,`
|
|
11
|
+
- `fileSizeMax: 3 * 1024 * 1024`
|
|
12
|
+
- `customInitOptions` prop added, using this can initialize the editor details.
|
|
13
|
+
- `customCSS` prop suppported to customize the style to apply for editor, it adds css in style tag.
|
|
14
|
+
- In `handleUpload` method reverted the `TicketReply` editor specific case handle.
|
|
15
|
+
|
|
5
16
|
# 1.5.4
|
|
6
17
|
- **CheckBoxField (v0&v1)**
|
|
7
18
|
- children prop added.
|
|
@@ -272,15 +272,15 @@ export default class TextEditor extends Component {
|
|
|
272
272
|
fileNameLimitExceed
|
|
273
273
|
} = i18nKeys;
|
|
274
274
|
const {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
allowedFileExtensions,
|
|
276
|
+
fileNameMaxCharacters,
|
|
277
|
+
fileSizeMax
|
|
278
278
|
} = inlineImageProps;
|
|
279
279
|
|
|
280
|
-
if (!isFileNameSizeInvalid(file.name,
|
|
280
|
+
if (!isFileNameSizeInvalid(file.name, fileNameMaxCharacters)) {
|
|
281
281
|
if (file.size != 0) {
|
|
282
|
-
if (file.size <=
|
|
283
|
-
if (isImageFormat(file.name,
|
|
282
|
+
if (file.size <= fileSizeMax) {
|
|
283
|
+
if (isImageFormat(file.name, allowedFileExtensions)) {
|
|
284
284
|
progress && progress(true);
|
|
285
285
|
this.handleUpload(file).then(res => {
|
|
286
286
|
successCallback(res);
|
|
@@ -11,8 +11,8 @@ export const defaultProps = {
|
|
|
11
11
|
isReadOnly: false,
|
|
12
12
|
dataSelectorId: 'textEditor',
|
|
13
13
|
inlineImageProps: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
|
|
15
|
+
fileNameMaxCharacters: 200,
|
|
16
|
+
fileSizeMax: 3 * 1024 * 1024
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -46,8 +46,8 @@ export const propTypes = {
|
|
|
46
46
|
customInitOptions: PropTypes.object,
|
|
47
47
|
customCSS: PropTypes.string,
|
|
48
48
|
inlineImageProps: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
allowedFileExtensions: PropTypes.array,
|
|
50
|
+
fileNameMaxCharacters: PropTypes.number,
|
|
51
|
+
fileSizeMax: PropTypes.number
|
|
52
52
|
}
|
|
53
53
|
};
|
package/es/utils/editorUtils.js
CHANGED
|
@@ -47,12 +47,12 @@ export function encodeForHtml(str) {
|
|
|
47
47
|
return str;
|
|
48
48
|
} // attachment
|
|
49
49
|
|
|
50
|
-
export function isFileNameSizeInvalid(fileName,
|
|
51
|
-
return fileName.length >
|
|
50
|
+
export function isFileNameSizeInvalid(fileName, fileNameMaxCharacters) {
|
|
51
|
+
return fileName.length > fileNameMaxCharacters;
|
|
52
52
|
}
|
|
53
|
-
export function isImageFormat(fileName,
|
|
53
|
+
export function isImageFormat(fileName, allowedFileExtensions) {
|
|
54
54
|
let extension = getExtensionFromFileName(fileName);
|
|
55
|
-
const isValidExtension =
|
|
55
|
+
const isValidExtension = allowedFileExtensions.includes(extension);
|
|
56
56
|
return isValidExtension;
|
|
57
57
|
}
|
|
58
58
|
export function getExtensionFromFileName(fileName) {
|
|
@@ -266,15 +266,15 @@ export default class TextEditor extends Component {
|
|
|
266
266
|
fileNameLimitExceed
|
|
267
267
|
} = i18nKeys;
|
|
268
268
|
const {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
allowedFileExtensions,
|
|
270
|
+
fileNameMaxCharacters,
|
|
271
|
+
fileSizeMax
|
|
272
272
|
} = inlineImageProps;
|
|
273
273
|
|
|
274
|
-
if (!isFileNameSizeInvalid(file.name,
|
|
274
|
+
if (!isFileNameSizeInvalid(file.name, fileNameMaxCharacters)) {
|
|
275
275
|
if (file.size != 0) {
|
|
276
|
-
if (file.size <=
|
|
277
|
-
if (isImageFormat(file.name,
|
|
276
|
+
if (file.size <= fileSizeMax) {
|
|
277
|
+
if (isImageFormat(file.name, allowedFileExtensions)) {
|
|
278
278
|
progress && progress(true);
|
|
279
279
|
this.handleUpload(file).then(res => {
|
|
280
280
|
successCallback(res);
|
|
@@ -11,8 +11,8 @@ export const defaultProps = {
|
|
|
11
11
|
isReadOnly: false,
|
|
12
12
|
dataSelectorId: 'textEditor',
|
|
13
13
|
inlineImageProps: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
|
|
15
|
+
fileNameMaxCharacters: 200,
|
|
16
|
+
fileSizeMax: 3 * 1024 * 1024
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -44,8 +44,8 @@ export const propTypes = {
|
|
|
44
44
|
toggleEdit: PropTypes.func,
|
|
45
45
|
dataSelectorId: PropTypes.string,
|
|
46
46
|
inlineImageProps: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
allowedFileExtensions: PropTypes.array,
|
|
48
|
+
fileNameMaxCharacters: PropTypes.number,
|
|
49
|
+
fileSizeMax: PropTypes.number
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -47,12 +47,12 @@ export function encodeForHtml(str) {
|
|
|
47
47
|
return str;
|
|
48
48
|
} // attachment
|
|
49
49
|
|
|
50
|
-
export function isFileNameSizeInvalid(fileName,
|
|
51
|
-
return fileName.length >
|
|
50
|
+
export function isFileNameSizeInvalid(fileName, fileNameMaxCharacters) {
|
|
51
|
+
return fileName.length > fileNameMaxCharacters;
|
|
52
52
|
}
|
|
53
|
-
export function isImageFormat(fileName,
|
|
53
|
+
export function isImageFormat(fileName, allowedFileExtensions) {
|
|
54
54
|
let extension = getExtensionFromFileName(fileName);
|
|
55
|
-
const isValidExtension =
|
|
55
|
+
const isValidExtension = allowedFileExtensions.includes(extension);
|
|
56
56
|
return isValidExtension;
|
|
57
57
|
}
|
|
58
58
|
export function getExtensionFromFileName(fileName) {
|
|
@@ -316,14 +316,14 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
316
316
|
fileSizeLimitExceed = i18nKeys.fileSizeLimitExceed,
|
|
317
317
|
fileEmptyError = i18nKeys.fileEmptyError,
|
|
318
318
|
fileNameLimitExceed = i18nKeys.fileNameLimitExceed;
|
|
319
|
-
var
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
var allowedFileExtensions = inlineImageProps.allowedFileExtensions,
|
|
320
|
+
fileNameMaxCharacters = inlineImageProps.fileNameMaxCharacters,
|
|
321
|
+
fileSizeMax = inlineImageProps.fileSizeMax;
|
|
322
322
|
|
|
323
|
-
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name,
|
|
323
|
+
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name, fileNameMaxCharacters)) {
|
|
324
324
|
if (file.size != 0) {
|
|
325
|
-
if (file.size <=
|
|
326
|
-
if ((0, _editorUtils.isImageFormat)(file.name,
|
|
325
|
+
if (file.size <= fileSizeMax) {
|
|
326
|
+
if ((0, _editorUtils.isImageFormat)(file.name, allowedFileExtensions)) {
|
|
327
327
|
progress && progress(true);
|
|
328
328
|
this.handleUpload(file).then(function (res) {
|
|
329
329
|
successCallback(res);
|
|
@@ -17,9 +17,9 @@ var defaultProps = {
|
|
|
17
17
|
isReadOnly: false,
|
|
18
18
|
dataSelectorId: 'textEditor',
|
|
19
19
|
inlineImageProps: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
|
|
21
|
+
fileNameMaxCharacters: 200,
|
|
22
|
+
fileSizeMax: 3 * 1024 * 1024
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
exports.defaultProps = defaultProps;
|
|
@@ -56,9 +56,9 @@ var propTypes = {
|
|
|
56
56
|
customInitOptions: _propTypes["default"].object,
|
|
57
57
|
customCSS: _propTypes["default"].string,
|
|
58
58
|
inlineImageProps: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
allowedFileExtensions: _propTypes["default"].array,
|
|
60
|
+
fileNameMaxCharacters: _propTypes["default"].number,
|
|
61
|
+
fileSizeMax: _propTypes["default"].number
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
exports.propTypes = propTypes;
|
package/lib/utils/editorUtils.js
CHANGED
|
@@ -67,13 +67,13 @@ 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
|
-
var isValidExtension =
|
|
76
|
+
var isValidExtension = allowedFileExtensions.includes(extension);
|
|
77
77
|
return isValidExtension;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -310,14 +310,14 @@ var TextEditor = /*#__PURE__*/function (_Component) {
|
|
|
310
310
|
fileSizeLimitExceed = i18nKeys.fileSizeLimitExceed,
|
|
311
311
|
fileEmptyError = i18nKeys.fileEmptyError,
|
|
312
312
|
fileNameLimitExceed = i18nKeys.fileNameLimitExceed;
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
var allowedFileExtensions = inlineImageProps.allowedFileExtensions,
|
|
314
|
+
fileNameMaxCharacters = inlineImageProps.fileNameMaxCharacters,
|
|
315
|
+
fileSizeMax = inlineImageProps.fileSizeMax;
|
|
316
316
|
|
|
317
|
-
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name,
|
|
317
|
+
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name, fileNameMaxCharacters)) {
|
|
318
318
|
if (file.size != 0) {
|
|
319
|
-
if (file.size <=
|
|
320
|
-
if ((0, _editorUtils.isImageFormat)(file.name,
|
|
319
|
+
if (file.size <= fileSizeMax) {
|
|
320
|
+
if ((0, _editorUtils.isImageFormat)(file.name, allowedFileExtensions)) {
|
|
321
321
|
progress && progress(true);
|
|
322
322
|
this.handleUpload(file).then(function (res) {
|
|
323
323
|
successCallback(res);
|
|
@@ -17,9 +17,9 @@ var defaultProps = {
|
|
|
17
17
|
isReadOnly: false,
|
|
18
18
|
dataSelectorId: 'textEditor',
|
|
19
19
|
inlineImageProps: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
|
|
21
|
+
fileNameMaxCharacters: 200,
|
|
22
|
+
fileSizeMax: 3 * 1024 * 1024
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
exports.defaultProps = defaultProps;
|
|
@@ -54,9 +54,9 @@ var propTypes = {
|
|
|
54
54
|
toggleEdit: _propTypes["default"].func,
|
|
55
55
|
dataSelectorId: _propTypes["default"].string,
|
|
56
56
|
inlineImageProps: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
allowedFileExtensions: _propTypes["default"].array,
|
|
58
|
+
fileNameMaxCharacters: _propTypes["default"].number,
|
|
59
|
+
fileSizeMax: _propTypes["default"].number
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
exports.propTypes = propTypes;
|
|
@@ -67,13 +67,13 @@ 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
|
-
var isValidExtension =
|
|
76
|
+
var isValidExtension = allowedFileExtensions.includes(extension);
|
|
77
77
|
return isValidExtension;
|
|
78
78
|
}
|
|
79
79
|
|