@zohodesk/dot 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/PropLessFiles.html +1 -1
- package/.cli/propValidation_report.html +1 -1
- package/README.md +15 -0
- package/coverage/ExternalLink/ExternalLink.js.html +1 -1
- package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
- package/coverage/ExternalLink/index.html +1 -1
- package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
- package/coverage/ExternalLink/props/index.html +1 -1
- package/coverage/ExternalLink/props/propTypes.js.html +1 -1
- package/coverage/Image/Image.js.html +1 -1
- package/coverage/Image/Image.module.css.html +1 -1
- package/coverage/Image/index.html +1 -1
- package/coverage/Image/props/defaultProps.js.html +1 -1
- package/coverage/Image/props/index.html +1 -1
- package/coverage/Image/props/propTypes.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
- package/coverage/avatar/AvatarWithTeam/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/es/Attachment/Attachment.js +2 -1
- package/es/Attachment/Attachment.module.css +10 -6
- package/es/Link/Link.js +2 -1
- package/es/TagWithIcon/props/propTypes.js +1 -1
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +5 -2
- package/es/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
- package/es/layout/SubtabLayout/props/propTypes.js +1 -1
- package/es/list/Icons/AddNewIcon.js +3 -2
- package/es/list/Icons/CompleteIcon.js +3 -2
- package/es/list/Icons/DeleteIcon.js +4 -3
- package/es/list/Icons/EditIcon.js +5 -3
- package/es/list/Icons/ReadUnreadIcon.js +5 -3
- package/es/list/Icons/SmartIcon.js +5 -3
- package/es/list/ListLayout/ListLayout.module.css +24 -8
- package/es/list/listCommon.module.css +23 -5
- package/es/list/status/StatusDropdown/StatusDropdown.js +16 -3
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -1
- package/es/lookup/Lookup/Lookup.js +2 -0
- package/es/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
- package/es/setup/helptips/ListGroup/ListGroup.js +1 -1
- package/es/v1/Attachment/Attachment.js +88 -0
- package/es/v1/AttachmentViewer/AttachmentImage.js +79 -0
- package/es/v1/AttachmentViewer/AttachmentViewer.js +541 -0
- package/es/v1/ChannelIcon/ChannelIcon.js +1 -1
- package/es/v1/Drawer/Drawer.js +1 -1
- package/es/v1/FlipCard/FlipCard.js +3 -3
- package/es/v1/FreezeLayer/FreezeLayer.js +74 -0
- package/es/v1/Image/Image.js +39 -0
- package/es/v1/Link/Link.js +2 -1
- package/es/v1/Loader/Loader.js +21 -0
- package/es/v1/Message/Message.js +118 -0
- package/es/v1/MessageBanner/MessageBanner.js +1 -1
- package/es/v1/PlusIcon/PlusIcon.js +44 -0
- package/es/v1/Separator/Separator.js +60 -0
- package/es/v1/ToastMessage/ToastMessage.js +203 -0
- package/es/v1/Upload/Upload.js +76 -0
- package/es/v1/actions/AutoClose.js +43 -0
- package/es/v1/alert/index.js +2 -0
- package/es/v1/avatar/AvatarClose/AvatarClose.js +53 -0
- package/es/v1/avatar/AvatarCollision/AvatarCollision.js +62 -0
- package/es/v1/avatar/AvatarIcon/AvatarIcon.js +54 -0
- package/es/v1/avatar/AvatarStatus/AvatarStatus.js +72 -0
- package/es/v1/avatar/AvatarThread/AvatarThread.js +79 -0
- package/es/v1/avatar/AvatarUser/AvatarUser.js +116 -0
- package/es/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +98 -0
- package/es/v1/avatar/index.js +7 -0
- package/es/v1/dropdown/ToggleDropDown/ToggleDropDown.js +861 -0
- package/es/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/es/v1/errorstate/Inconvenience/Inconvenience.js +86 -0
- package/es/v1/errorstate/LinkText/LinkText.js +29 -0
- package/es/v1/errorstate/NoRequestFound/NoRequestFound.js +84 -0
- package/es/v1/errorstate/PermissionPlay/PermissionPlay.js +83 -0
- package/es/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +84 -0
- package/es/v1/errorstate/UnableToProcess/UnableToProcess.js +86 -0
- package/es/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +84 -0
- package/es/v1/errorstate/WillBack/WillBack.js +75 -0
- package/es/v1/errorstate/index.js +8 -0
- package/es/v1/form/fields/CheckBoxField/CheckBoxField.js +141 -0
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +183 -0
- package/es/v1/form/fields/DateField/DateField.js +195 -0
- package/es/v1/form/fields/FieldContainer/FieldContainer.js +71 -0
- package/es/v1/form/fields/MultiSelectField/MultiSelectField.js +213 -0
- package/es/v1/form/fields/PhoneField/PhoneField.js +189 -0
- package/es/v1/form/fields/RadioField/RadioField.js +116 -0
- package/es/v1/form/fields/SelectField/SelectField.js +183 -0
- package/es/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +292 -0
- package/es/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +258 -0
- package/es/v1/form/fields/TextBoxField/TextBoxField.js +164 -0
- package/es/v1/form/fields/TextEditor/TextEditor.js +418 -0
- package/es/v1/form/fields/TextEditorField/TextEditorField.js +178 -0
- package/es/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +203 -0
- package/es/v1/form/fields/TextareaField/TextareaField.js +161 -0
- package/es/v1/form/fields/ValidationMessage/ValidationMessage.js +58 -0
- package/es/v1/form/fields/index.js +16 -0
- package/es/v1/form/layout/Field/Field.js +33 -0
- package/es/v1/form/layout/Section/Section.js +37 -0
- package/es/v1/form/layout/index.js +2 -0
- package/es/v1/layout/SetupDetailLayout/SetupDetailLayout.js +217 -0
- package/es/v1/layout/SetupDetailLayout/index.js +4 -0
- package/es/v1/layout/SubtabLayout/SubtabLayout.js +144 -0
- package/es/v1/layout/SubtabLayout/index.js +4 -0
- package/es/v1/list/AvatarFlip/AvatarFlip.js +76 -0
- package/es/v1/list/BluePrintStatus/BluePrintStatus.js +28 -0
- package/es/v1/list/Comment/Comment.js +45 -0
- package/es/v1/list/DepartmentDropDown/DepartmentDropDown.js +100 -0
- package/es/v1/list/Dot/Dot.js +22 -0
- package/es/v1/list/DotNew/DotNew.js +29 -0
- package/es/v1/list/GridStencils/GridStencils.js +34 -0
- package/es/v1/list/Icons/AddNewIcon.js +28 -0
- package/es/v1/list/Icons/CompleteIcon.js +30 -0
- package/es/v1/list/Icons/DeleteIcon.js +31 -0
- package/es/v1/list/Icons/EditIcon.js +31 -0
- package/es/v1/list/Icons/FloatingIcons.js +30 -0
- package/es/v1/list/Icons/ReadUnreadIcon.js +35 -0
- package/es/v1/list/Icons/SmartIcon.js +28 -0
- package/es/v1/list/Icons/index.js +7 -0
- package/es/v1/list/ListLayout/ListLayout.js +83 -0
- package/es/v1/list/ListStencils/ListStencils.js +47 -0
- package/es/v1/list/SecondaryText/AccountName.js +85 -0
- package/es/v1/list/SecondaryText/ContactName.js +85 -0
- package/es/v1/list/SecondaryText/DepartmentText.js +30 -0
- package/es/v1/list/SecondaryText/Email.js +55 -0
- package/es/v1/list/SecondaryText/HappinessRating.js +31 -0
- package/es/v1/list/SecondaryText/PhoneNumber.js +59 -0
- package/es/v1/list/SecondaryText/PriorityText.js +33 -0
- package/es/v1/list/SecondaryText/SecondaryText.js +40 -0
- package/es/v1/list/SecondaryText/StatusText.js +34 -0
- package/es/v1/list/SecondaryText/TicketId.js +53 -0
- package/es/v1/list/SecondaryText/Website.js +43 -0
- package/es/v1/list/SecondaryText/index.js +11 -0
- package/es/v1/list/SecondryPanel/SecondryPanel.js +105 -0
- package/es/v1/list/SentimentStatus/SentimentStatus.js +34 -0
- package/es/v1/list/Subject/Subject.js +57 -0
- package/es/v1/list/TagNew/TagNew.js +33 -0
- package/es/v1/list/Thread/Thread.js +43 -0
- package/es/v1/list/UserTime/UserTime.js +83 -0
- package/es/v1/list/index.js +17 -0
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +465 -0
- package/es/v1/list/status/StatusListItem/StatusListItem.js +122 -0
- package/es/v1/list/status/index.js +2 -0
- package/es/v1/lookup/EmptyPage/EmptyPage.js +65 -0
- package/es/v1/lookup/Lookup/Lookup.js +2 -0
- package/es/v1/lookup/Section/Section.js +25 -0
- package/es/v1/lookup/header/ViewDropDown/ViewDropDown.js +176 -0
- package/es/v1/lookup/header/index.js +5 -0
- package/es/v1/setup/header/Button/Button.js +36 -0
- package/es/v1/setup/header/Link/Link.js +44 -0
- package/es/v1/setup/header/Search/Search.js +81 -0
- package/es/v1/setup/header/Views/Views.js +46 -0
- package/es/v1/setup/header/index.js +4 -0
- package/es/v1/setup/helptips/Description/Description.js +24 -0
- package/es/v1/setup/helptips/Link/Link.js +41 -0
- package/es/v1/setup/helptips/ListGroup/ListGroup.js +39 -0
- package/es/v1/setup/helptips/Title/Title.js +24 -0
- package/es/v1/setup/helptips/index.js +4 -0
- package/es/v1/setup/index.js +6 -0
- package/es/v1/setup/table/index.js +5 -0
- package/es/v1/svg/PlusIcon.js +32 -0
- package/es/v1/svg/SnippetIcon.js +34 -0
- package/es/v1/svg/TemplateIcon.js +35 -0
- package/es/v1/svg/index.js +3 -0
- package/es/v1/version2/alertIcons/index.js +8 -0
- package/es/v1/version2/index.js +12 -0
- package/es/v1/version2/lookup/AlertHeader/AlertHeader.js +79 -0
- package/es/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
- package/es/v1/version2/notification/DesktopNotification/DesktopNotification.js +164 -0
- package/es/version2/lookup/AlertLookup/AlertLookup.js +14 -2
- package/lib/Attachment/Attachment.js +2 -1
- package/lib/Attachment/Attachment.module.css +10 -6
- package/lib/Link/Link.js +2 -1
- package/lib/TagWithIcon/props/propTypes.js +1 -1
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +5 -3
- package/lib/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -5
- package/lib/layout/SubtabLayout/props/propTypes.js +1 -1
- package/lib/list/Icons/AddNewIcon.js +4 -2
- package/lib/list/Icons/CompleteIcon.js +4 -2
- package/lib/list/Icons/DeleteIcon.js +5 -3
- package/lib/list/Icons/EditIcon.js +6 -3
- package/lib/list/Icons/ReadUnreadIcon.js +6 -3
- package/lib/list/Icons/SmartIcon.js +6 -3
- package/lib/list/ListLayout/ListLayout.module.css +24 -8
- package/lib/list/listCommon.module.css +23 -5
- package/lib/list/status/StatusDropdown/StatusDropdown.js +16 -5
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/Lookup/Lookup.js +2 -0
- package/lib/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
- package/lib/setup/helptips/ListGroup/ListGroup.js +1 -1
- package/lib/v1/Attachment/Attachment.js +140 -0
- package/lib/v1/AttachmentViewer/AttachmentImage.js +124 -0
- package/lib/v1/AttachmentViewer/AttachmentViewer.js +625 -0
- package/lib/v1/ChannelIcon/ChannelIcon.js +1 -1
- package/lib/v1/Drawer/Drawer.js +1 -1
- package/lib/v1/FlipCard/FlipCard.js +3 -3
- package/lib/v1/FreezeLayer/FreezeLayer.js +94 -0
- package/lib/v1/Image/Image.js +89 -0
- package/lib/v1/Link/Link.js +2 -1
- package/lib/v1/Loader/Loader.js +70 -0
- package/lib/v1/Message/Message.js +170 -0
- package/lib/v1/MessageBanner/MessageBanner.js +1 -1
- package/lib/v1/PlusIcon/PlusIcon.js +91 -0
- package/lib/v1/Separator/Separator.js +107 -0
- package/lib/v1/ToastMessage/ToastMessage.js +246 -0
- package/lib/v1/Upload/Upload.js +128 -0
- package/lib/v1/actions/AutoClose.js +75 -0
- package/lib/v1/alert/index.js +23 -0
- package/lib/v1/avatar/AvatarClose/AvatarClose.js +101 -0
- package/lib/v1/avatar/AvatarCollision/AvatarCollision.js +110 -0
- package/lib/v1/avatar/AvatarIcon/AvatarIcon.js +106 -0
- package/lib/v1/avatar/AvatarStatus/AvatarStatus.js +119 -0
- package/lib/v1/avatar/AvatarThread/AvatarThread.js +130 -0
- package/lib/v1/avatar/AvatarUser/AvatarUser.js +167 -0
- package/lib/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +154 -0
- package/lib/v1/avatar/index.js +63 -0
- package/lib/v1/dropdown/ToggleDropDown/ToggleDropDown.js +932 -0
- package/lib/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/lib/v1/errorstate/Inconvenience/Inconvenience.js +137 -0
- package/lib/v1/errorstate/LinkText/LinkText.js +80 -0
- package/lib/v1/errorstate/NoRequestFound/NoRequestFound.js +135 -0
- package/lib/v1/errorstate/PermissionPlay/PermissionPlay.js +134 -0
- package/lib/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +135 -0
- package/lib/v1/errorstate/UnableToProcess/UnableToProcess.js +137 -0
- package/lib/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +135 -0
- package/lib/v1/errorstate/WillBack/WillBack.js +125 -0
- package/lib/v1/errorstate/index.js +71 -0
- package/lib/v1/form/fields/CheckBoxField/CheckBoxField.js +197 -0
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +234 -0
- package/lib/v1/form/fields/DateField/DateField.js +249 -0
- package/lib/v1/form/fields/FieldContainer/FieldContainer.js +118 -0
- package/lib/v1/form/fields/MultiSelectField/MultiSelectField.js +268 -0
- package/lib/v1/form/fields/PhoneField/PhoneField.js +236 -0
- package/lib/v1/form/fields/RadioField/RadioField.js +169 -0
- package/lib/v1/form/fields/SelectField/SelectField.js +236 -0
- package/lib/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +346 -0
- package/lib/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +299 -0
- package/lib/v1/form/fields/TextBoxField/TextBoxField.js +219 -0
- package/lib/v1/form/fields/TextEditor/TextEditor.js +463 -0
- package/lib/v1/form/fields/TextEditorField/TextEditorField.js +230 -0
- package/lib/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +256 -0
- package/lib/v1/form/fields/TextareaField/TextareaField.js +215 -0
- package/lib/v1/form/fields/ValidationMessage/ValidationMessage.js +110 -0
- package/lib/{docs/formDocs.js → v1/form/fields/index.js} +33 -25
- package/lib/v1/form/layout/Field/Field.js +87 -0
- package/lib/v1/form/layout/Section/Section.js +86 -0
- package/lib/v1/form/layout/index.js +23 -0
- package/lib/v1/layout/SetupDetailLayout/SetupDetailLayout.js +305 -0
- package/lib/v1/layout/SetupDetailLayout/index.js +37 -0
- package/lib/v1/layout/SubtabLayout/SubtabLayout.js +245 -0
- package/lib/v1/layout/SubtabLayout/index.js +37 -0
- package/lib/v1/list/AvatarFlip/AvatarFlip.js +131 -0
- package/lib/v1/list/BluePrintStatus/BluePrintStatus.js +73 -0
- package/lib/v1/list/Comment/Comment.js +98 -0
- package/lib/v1/list/DepartmentDropDown/DepartmentDropDown.js +157 -0
- package/lib/v1/list/Dot/Dot.js +72 -0
- package/lib/v1/list/DotNew/DotNew.js +79 -0
- package/lib/v1/list/GridStencils/GridStencils.js +83 -0
- package/lib/v1/list/Icons/AddNewIcon.js +79 -0
- package/lib/v1/list/Icons/CompleteIcon.js +81 -0
- package/lib/v1/list/Icons/DeleteIcon.js +82 -0
- package/lib/v1/list/Icons/EditIcon.js +82 -0
- package/lib/v1/list/Icons/FloatingIcons.js +87 -0
- package/lib/v1/list/Icons/ReadUnreadIcon.js +87 -0
- package/lib/v1/list/Icons/SmartIcon.js +83 -0
- package/lib/v1/list/Icons/index.js +63 -0
- package/lib/v1/list/ListLayout/ListLayout.js +145 -0
- package/lib/v1/list/ListStencils/ListStencils.js +96 -0
- package/lib/v1/list/SecondaryText/AccountName.js +136 -0
- package/lib/v1/list/SecondaryText/ContactName.js +144 -0
- package/lib/v1/list/SecondaryText/DepartmentText.js +79 -0
- package/lib/v1/list/SecondaryText/Email.js +103 -0
- package/lib/v1/list/SecondaryText/HappinessRating.js +81 -0
- package/lib/v1/list/SecondaryText/PhoneNumber.js +107 -0
- package/lib/v1/list/SecondaryText/PriorityText.js +83 -0
- package/lib/v1/list/SecondaryText/SecondaryText.js +88 -0
- package/lib/v1/list/SecondaryText/StatusText.js +84 -0
- package/lib/v1/list/SecondaryText/TicketId.js +104 -0
- package/lib/v1/list/SecondaryText/Website.js +91 -0
- package/lib/v1/list/SecondaryText/index.js +95 -0
- package/lib/v1/list/SecondryPanel/SecondryPanel.js +205 -0
- package/lib/v1/list/SentimentStatus/SentimentStatus.js +80 -0
- package/lib/v1/list/Subject/Subject.js +108 -0
- package/lib/v1/list/TagNew/TagNew.js +83 -0
- package/lib/v1/list/Thread/Thread.js +95 -0
- package/lib/v1/list/UserTime/UserTime.js +136 -0
- package/lib/v1/list/index.js +173 -0
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +541 -0
- package/lib/v1/list/status/StatusListItem/StatusListItem.js +168 -0
- package/lib/v1/list/status/index.js +23 -0
- package/lib/v1/lookup/EmptyPage/EmptyPage.js +120 -0
- package/lib/v1/lookup/Lookup/Lookup.js +2 -0
- package/lib/v1/lookup/Section/Section.js +75 -0
- package/lib/v1/lookup/header/ViewDropDown/ViewDropDown.js +221 -0
- package/lib/v1/lookup/header/index.js +47 -0
- package/lib/v1/setup/header/Button/Button.js +83 -0
- package/lib/v1/setup/header/Link/Link.js +93 -0
- package/lib/v1/setup/header/Search/Search.js +126 -0
- package/lib/v1/setup/header/Views/Views.js +93 -0
- package/lib/v1/setup/header/index.js +39 -0
- package/lib/v1/setup/helptips/Description/Description.js +68 -0
- package/lib/v1/setup/helptips/Link/Link.js +88 -0
- package/lib/v1/setup/helptips/ListGroup/ListGroup.js +88 -0
- package/lib/v1/setup/helptips/Title/Title.js +68 -0
- package/lib/v1/setup/helptips/index.js +39 -0
- package/lib/v1/setup/index.js +24 -0
- package/lib/v1/setup/table/index.js +47 -0
- package/lib/v1/svg/PlusIcon.js +82 -0
- package/lib/v1/svg/SnippetIcon.js +84 -0
- package/lib/v1/svg/TemplateIcon.js +85 -0
- package/lib/v1/svg/index.js +31 -0
- package/lib/v1/version2/alertIcons/index.js +71 -0
- package/lib/v1/version2/index.js +58 -0
- package/lib/v1/version2/lookup/AlertHeader/AlertHeader.js +104 -0
- package/lib/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
- package/lib/v1/version2/notification/DesktopNotification/DesktopNotification.js +193 -0
- package/lib/version2/lookup/AlertLookup/AlertLookup.js +14 -2
- package/package.json +9 -9
- package/result.json +1 -1
- package/es/docs/formDocs.js +0 -15
- package/es/docs/generalDocs.js +0 -63
- package/es/docs/lookupDocs.js +0 -17
- package/es/docs/setupDocs.js +0 -11
- package/lib/docs/generalDocs.js +0 -479
- package/lib/docs/lookupDocs.js +0 -135
- package/lib/docs/setupDocs.js +0 -95
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = require("../../../../form/fields/TextEditor/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../../../form/fields/TextEditor/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _selectn = _interopRequireDefault(require("selectn"));
|
|
17
|
+
|
|
18
|
+
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
19
|
+
|
|
20
|
+
var _editorUtils = require("../../../../utils/editorUtils");
|
|
21
|
+
|
|
22
|
+
var _TextEditorModule = _interopRequireDefault(require("../../../../form/fields/TextEditor/TextEditor.module.css"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
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
|
+
|
|
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
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
|
|
34
|
+
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); } }
|
|
35
|
+
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
|
+
|
|
38
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
+
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
+
|
|
42
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
43
|
+
|
|
44
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
45
|
+
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
+
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
|
+
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
+
|
|
52
|
+
/* eslint-disable camelcase */
|
|
53
|
+
|
|
54
|
+
/* eslint-disable no-undef */
|
|
55
|
+
|
|
56
|
+
/* eslint-disable react/no-deprecated */
|
|
57
|
+
var TextEditor = /*#__PURE__*/function (_Component) {
|
|
58
|
+
_inherits(TextEditor, _Component);
|
|
59
|
+
|
|
60
|
+
var _super = _createSuper(TextEditor);
|
|
61
|
+
|
|
62
|
+
function TextEditor(props) {
|
|
63
|
+
var _this;
|
|
64
|
+
|
|
65
|
+
_classCallCheck(this, TextEditor);
|
|
66
|
+
|
|
67
|
+
_this = _super.call(this, props);
|
|
68
|
+
_this.state = {
|
|
69
|
+
isEditorLoad: false,
|
|
70
|
+
isResourceLoaded: false,
|
|
71
|
+
isEditorShow: false
|
|
72
|
+
};
|
|
73
|
+
var methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', 'handleDropUpload', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
|
|
74
|
+
|
|
75
|
+
_editorUtils.bind.apply(_assertThisInitialized(_this), methods);
|
|
76
|
+
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_createClass(TextEditor, [{
|
|
81
|
+
key: "componentDidMount",
|
|
82
|
+
value: function componentDidMount() {
|
|
83
|
+
var _this2 = this;
|
|
84
|
+
|
|
85
|
+
this.mount = true;
|
|
86
|
+
|
|
87
|
+
if (typeof global.ZohoDeskEditor === 'undefined') {
|
|
88
|
+
(0, _editorUtils.loadResource)(this.props.EDITORURL, 'js', 'ZohoDeskEditor').then(function () {
|
|
89
|
+
_this2.setState({
|
|
90
|
+
isResourceLoaded: true
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
this.setState({
|
|
95
|
+
isResourceLoaded: true
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
window.addEventListener('click', this.onWindowClick);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "initializeEditor",
|
|
103
|
+
value: function initializeEditor(id, mode) {
|
|
104
|
+
var _this$props = this.props,
|
|
105
|
+
value = _this$props.value,
|
|
106
|
+
_this$props$editorMod = _this$props.editorMode,
|
|
107
|
+
editorMode = _this$props$editorMod === void 0 ? '' : _this$props$editorMod,
|
|
108
|
+
_this$props$editorOpt = _this$props.editorOptions,
|
|
109
|
+
editorOptions = _this$props$editorOpt === void 0 ? {} : _this$props$editorOpt,
|
|
110
|
+
_this$props$needEdito = _this$props.needEditorFocus,
|
|
111
|
+
needEditorFocus = _this$props$needEdito === void 0 ? true : _this$props$needEdito,
|
|
112
|
+
handleDropUpload = _this$props.handleDropUpload,
|
|
113
|
+
fontFamily = _this$props.fontFamily,
|
|
114
|
+
fontSize = _this$props.fontSize,
|
|
115
|
+
initCallback = _this$props.initCallback,
|
|
116
|
+
handleAlertMessage = _this$props.handleAlertMessage,
|
|
117
|
+
needInlineAttachment = _this$props.needInlineAttachment;
|
|
118
|
+
|
|
119
|
+
if (id && global.ZohoDeskEditor) {
|
|
120
|
+
var _defaultObj;
|
|
121
|
+
|
|
122
|
+
var defaultObj = (_defaultObj = {
|
|
123
|
+
id: id,
|
|
124
|
+
content: (0, _editorUtils.fixEncoding)(value),
|
|
125
|
+
callback: this.editorCallback,
|
|
126
|
+
imageuploadcallback: this.handleInlineUpload,
|
|
127
|
+
handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
|
|
128
|
+
contentChanged: this.handleChange,
|
|
129
|
+
focusCallback: this.focusCallback,
|
|
130
|
+
lineHeight: 'Normal',
|
|
131
|
+
backgroundColor: 'transparent',
|
|
132
|
+
defaultfontsize: '14px',
|
|
133
|
+
allowTagsInsertHTML: ['iframe'],
|
|
134
|
+
allowAttrsInsertHTML: ['frameborder', 'allowfullscreen'],
|
|
135
|
+
needEditorFocus: needEditorFocus,
|
|
136
|
+
blurCallback: this.blurCallback,
|
|
137
|
+
mode: mode,
|
|
138
|
+
handleAlertMessage: handleAlertMessage,
|
|
139
|
+
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);
|
|
144
|
+
|
|
145
|
+
if (!ZohoDeskEditor_Init.init) {
|
|
146
|
+
global.editorInitialize && global.editorInitialize();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
defaultObj = Object.assign(defaultObj, editorOptions);
|
|
150
|
+
ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
|
|
151
|
+
ZohoDeskEditor.create && ZohoDeskEditor.create(defaultObj);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "plainTextSwitchCallback",
|
|
156
|
+
value: function plainTextSwitchCallback() {
|
|
157
|
+
var _this$props2 = this.props,
|
|
158
|
+
plainTextSwitchCallback = _this$props2.plainTextSwitchCallback,
|
|
159
|
+
id = _this$props2.id;
|
|
160
|
+
var content = this.handleGetContent();
|
|
161
|
+
plainTextSwitchCallback && plainTextSwitchCallback(content, id);
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "clearEditorData",
|
|
165
|
+
value: function clearEditorData(id) {
|
|
166
|
+
var getRef = this.props.getRef;
|
|
167
|
+
|
|
168
|
+
if (global.editor && global.editor[id]) {
|
|
169
|
+
delete global.editor[id];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getRef && getRef(null);
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "componentWillReceiveProps",
|
|
176
|
+
value: function componentWillReceiveProps(np) {
|
|
177
|
+
var changeEditorContent = this.props.changeEditorContent;
|
|
178
|
+
var id = np.id;
|
|
179
|
+
var editorObj = global.editor ? global.editor[id] ? global.editor[id] : {} : {};
|
|
180
|
+
|
|
181
|
+
if (np.isEmptyContent && editorObj) {
|
|
182
|
+
editorObj.setContent('');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (typeof changeEditorContent !== 'undefined' && np.changeEditorContent != changeEditorContent && np.changeEditorContent) {
|
|
186
|
+
(0, _editorUtils.changeContent)(id, np.value);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "componentDidUpdate",
|
|
191
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
192
|
+
var _this$props3 = this.props,
|
|
193
|
+
id = _this$props3.id,
|
|
194
|
+
value = _this$props3.value,
|
|
195
|
+
shouldUpdateContent = _this$props3.shouldUpdateContent,
|
|
196
|
+
mode = _this$props3.mode;
|
|
197
|
+
var isResourceLoaded = this.state.isResourceLoaded;
|
|
198
|
+
|
|
199
|
+
if (prevProps.id !== id) {
|
|
200
|
+
global.editor[id] = global.editor[prevProps.id];
|
|
201
|
+
delete global.editor[prevProps.id];
|
|
202
|
+
shouldUpdateContent && (0, _editorUtils.changeContent)(id, value);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (prevState.isResourceLoaded !== isResourceLoaded && isResourceLoaded) {
|
|
206
|
+
this.initializeEditor(id, mode);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: "componentWillUnmount",
|
|
211
|
+
value: function componentWillUnmount() {
|
|
212
|
+
this.mount = false;
|
|
213
|
+
this.clearEditorData(this.props.id);
|
|
214
|
+
window.removeEventListener('click', this.onWindowClick);
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "focusCallback",
|
|
218
|
+
value: function focusCallback() {
|
|
219
|
+
var onFocus = this.props.onFocus;
|
|
220
|
+
onFocus && onFocus();
|
|
221
|
+
}
|
|
222
|
+
}, {
|
|
223
|
+
key: "handleGetContent",
|
|
224
|
+
value: function handleGetContent() {
|
|
225
|
+
var id = this.props.id;
|
|
226
|
+
var editorObj = global.editor[id] ? global.editor[id] : {};
|
|
227
|
+
var content = (0, _editorUtils.getRichEditorContent)(id);
|
|
228
|
+
|
|
229
|
+
if (!(0, _editorUtils.editorContentValidate)(editorObj)) {
|
|
230
|
+
content = '';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
content = content.trim();
|
|
234
|
+
return content;
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
237
|
+
key: "handleChange",
|
|
238
|
+
value: function handleChange() {
|
|
239
|
+
var _this$props4 = this.props,
|
|
240
|
+
onChange = _this$props4.onChange,
|
|
241
|
+
id = _this$props4.id;
|
|
242
|
+
|
|
243
|
+
if (onChange) {
|
|
244
|
+
var content = this.handleGetContent();
|
|
245
|
+
onChange(content, id);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "editorCallback",
|
|
250
|
+
value: function editorCallback(editorObj) {
|
|
251
|
+
var _this$props5 = this.props,
|
|
252
|
+
editorCallback = _this$props5.editorCallback,
|
|
253
|
+
getRef = _this$props5.getRef,
|
|
254
|
+
isCustomScroll = _this$props5.isCustomScroll;
|
|
255
|
+
this.setState({
|
|
256
|
+
isEditorLoad: true,
|
|
257
|
+
isEditorShow: true
|
|
258
|
+
});
|
|
259
|
+
var id = this.props.id;
|
|
260
|
+
global.editor = global.editor || {};
|
|
261
|
+
|
|
262
|
+
if (!global.editor[id]) {
|
|
263
|
+
global.editor[id] = editorObj;
|
|
264
|
+
}
|
|
265
|
+
|
|
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
|
+
editorCallback && editorCallback(editorObj);
|
|
279
|
+
var iframe = (0, _selectn["default"])('iframe.contentDocument.body', editorObj) || null;
|
|
280
|
+
var iframeHead = (0, _selectn["default"])('iframe.contentDocument.head', editorObj) || null;
|
|
281
|
+
getRef && getRef(iframe);
|
|
282
|
+
|
|
283
|
+
if (iframe) {
|
|
284
|
+
iframe.addEventListener('click', function () {
|
|
285
|
+
return editorObj.iframe.click();
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
if (isCustomScroll) {
|
|
289
|
+
var link = document.createElement('style');
|
|
290
|
+
link.innerText = "body{font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 0}.scroll{--zd-scroll-width:12px;--zd-scroll-height:12px;--zd-scroll-bg:rgba(255,255,255,0.1);--zd-scroll-corner-bg:transparent;--zd-scroll-thump:rgba(44,51,77,0.2);--zd-scroll-thump-hoverbg:rgba(44,51,77,0.3);--zd-scroll-border:rgba(44,51,77,0.1)}.scroll[data-scroll-palette='dark'],.scroll [data-scroll-palette='dark']{--zd-scroll-thump:rgba(255,255,255,0.2);--zd-scroll-thump-hoverbg:rgba(255,255,255,0.4);--zd-scroll-border:rgba(255,255,255,0.07)}.scroll,.scroll *{scrollbar-color:var(--zd-scroll-thump) var(--zd-scroll-bg);scrollbar-width:thin;-ms-scrollbar-highlight-color:var(--zd-scroll-bg);-ms-scrollbar-face-color:var(--zd-scroll-thump)}.scroll::-webkit-scrollbar,.scroll ::-webkit-scrollbar{background:var(--zd-scroll-corner-bg)}.scroll::-webkit-scrollbar:hover,.scroll ::-webkit-scrollbar:hover{background:var(--zd-scroll-bg)}.scroll::-webkit-scrollbar:horizontal,.scroll ::-webkit-scrollbar:horizontal{height:var(--zd-scroll-height)}.scroll::-webkit-scrollbar:vertical,.scroll ::-webkit-scrollbar:vertical{width:var(--zd-scroll-width)}.scroll::-webkit-scrollbar-button,.scroll ::-webkit-scrollbar-button{display:none;width:0;height:0}.scroll::-webkit-scrollbar-track:vertical,.scroll ::-webkit-scrollbar-track:vertical{border-left:1px solid transparent;border-right:1px solid transparent}.scroll::-webkit-scrollbar-track:vertical:hover,.scroll ::-webkit-scrollbar-track:vertical:hover{border-color:var(--zd-scroll-border)}.scroll::-webkit-scrollbar-track:horizontal,.scroll ::-webkit-scrollbar-track:horizontal{border-top:1px solid transparent;border-bottom:1px solid transparent}.scroll::-webkit-scrollbar-track:horizontal:hover,.scroll ::-webkit-scrollbar-track:horizontal:hover{border-color:var(--zd-scroll-border)}.scroll::-webkit-scrollbar-track-piece,.scroll ::-webkit-scrollbar-track-piece{background:inherit}.scroll::-webkit-scrollbar-thumb,.scroll ::-webkit-scrollbar-thumb{border-radius:10px;background:var(--zd-scroll-thump);background-clip:padding-box;border:3px solid transparent}.scroll::-webkit-scrollbar-thumb:hover,.scroll ::-webkit-scrollbar-thumb:hover{background:var(--zd-scroll-thump-hoverbg);background-clip:padding-box;border:3px solid transparent}.scroll::-webkit-scrollbar-corner,.scroll ::-webkit-scrollbar-corner{background:var(--zd-scroll-corner-bg)}.scroll::-webkit-resizer,.scroll::-webkit-resizer{background:inherit}";
|
|
291
|
+
iframeHead.appendChild(link);
|
|
292
|
+
iframe.classList.add('scroll');
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
var customFonts = document.createElement('style');
|
|
296
|
+
customFonts.innerText = "@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')}";
|
|
297
|
+
iframeHead.appendChild(customFonts);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}, {
|
|
301
|
+
key: "handleInlineUpload",
|
|
302
|
+
value: function handleInlineUpload(file, successCallback, failureCallback, mode, editorObj) {
|
|
303
|
+
var _this$props6 = this.props,
|
|
304
|
+
id = _this$props6.id,
|
|
305
|
+
progress = _this$props6.setInlineAttachmentInProgress,
|
|
306
|
+
i18nKeys = _this$props6.i18nKeys;
|
|
307
|
+
|
|
308
|
+
if (!(0, _editorUtils.isFileNameSizeInvalid)(file.name)) {
|
|
309
|
+
if (file.size != 0) {
|
|
310
|
+
if (file.size <= 3 * 1024 * 1024) {
|
|
311
|
+
if ((0, _editorUtils.isImageFormat)(file.name)) {
|
|
312
|
+
progress && progress(true);
|
|
313
|
+
this.handleUpload(file).then(function (res) {
|
|
314
|
+
successCallback(res);
|
|
315
|
+
progress && progress(false);
|
|
316
|
+
|
|
317
|
+
if (id && editorObj) {
|
|
318
|
+
(0, _editorUtils.triggerKeyup)(editorObj.doc);
|
|
319
|
+
}
|
|
320
|
+
}, function () {
|
|
321
|
+
failureCallback(i18nKeys.fileUploadError);
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
failureCallback(i18nKeys.fileNotSupported);
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
failureCallback(i18nKeys.fileSizeLimitExceed);
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
failureCallback(i18nKeys.fileEmptyError);
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
failureCallback(i18nKeys.fileNameLimitExceed);
|
|
334
|
+
}
|
|
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
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
key: "blurCallback",
|
|
353
|
+
value: function blurCallback() {
|
|
354
|
+
var blurCallback = this.props.blurCallback;
|
|
355
|
+
var content = this.handleGetContent();
|
|
356
|
+
blurCallback && blurCallback(content);
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
key: "handleUpload",
|
|
360
|
+
value: function handleUpload(file) {
|
|
361
|
+
var _this$props7 = this.props,
|
|
362
|
+
onUpload = _this$props7.onUpload,
|
|
363
|
+
editorMode = _this$props7.editorMode,
|
|
364
|
+
getCSRFCookieName = _this$props7.getCSRFCookieName,
|
|
365
|
+
getCSRFCookie = _this$props7.getCSRFCookie;
|
|
366
|
+
|
|
367
|
+
try {
|
|
368
|
+
var formData = new FormData();
|
|
369
|
+
formData.append('img_file', file, file.name);
|
|
370
|
+
|
|
371
|
+
if (getCSRFCookieName && getCSRFCookie) {
|
|
372
|
+
formData.append(getCSRFCookieName(), getCSRFCookie());
|
|
373
|
+
}
|
|
374
|
+
|
|
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
|
+
});
|
|
384
|
+
} catch (err) {
|
|
385
|
+
return Promise.reject();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, {
|
|
389
|
+
key: "onWindowClick",
|
|
390
|
+
value: function onWindowClick(e) {
|
|
391
|
+
var isEditorDefaultOpen = this.props.isEditorDefaultOpen;
|
|
392
|
+
var element = e.target;
|
|
393
|
+
|
|
394
|
+
if (!element.closest('[data-isEditor]') && !element.closest("[id='KB_Editor_UploadImage_Popup']") && !element.closest("[id='KB_Editor_Overlay']") && !element.closest('.zdeskEditor_popup') && element && typeof element.className === 'string' && !element.className.startsWith('KB') && !element.hasAttribute('data-insertoptions') && !element.closest('.KB_Editor_common_DropDown')) {
|
|
395
|
+
var _this$props8 = this.props,
|
|
396
|
+
_this$props8$value = _this$props8.value,
|
|
397
|
+
value = _this$props8$value === void 0 ? '' : _this$props8$value,
|
|
398
|
+
id = _this$props8.id;
|
|
399
|
+
var cont = value;
|
|
400
|
+
|
|
401
|
+
if (typeof editor !== 'undefined') {
|
|
402
|
+
// eslint-disable-next-line
|
|
403
|
+
cont = editor['addFormEditor'] && editor['addFormEditor'].getContent();
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (!isEditorDefaultOpen) {
|
|
407
|
+
if ((cont == '' || cont == '<div><br></div>') && this.mount) {
|
|
408
|
+
this.toggleEditor(false);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}, {
|
|
414
|
+
key: "toggleEditor",
|
|
415
|
+
value: function toggleEditor(value) {
|
|
416
|
+
var toggleEdit = this.props.toggleEdit;
|
|
417
|
+
toggleEdit && toggleEdit(value);
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "render",
|
|
421
|
+
value: function render() {
|
|
422
|
+
var _this$props9 = this.props,
|
|
423
|
+
id = _this$props9.id,
|
|
424
|
+
dataId = _this$props9.dataId,
|
|
425
|
+
type = _this$props9.type,
|
|
426
|
+
border = _this$props9.border,
|
|
427
|
+
ImgLazyLoad = _this$props9.ImgLazyLoad,
|
|
428
|
+
loadingComponent = _this$props9.loadingComponent,
|
|
429
|
+
isNightMode = _this$props9.isNightMode,
|
|
430
|
+
isReadOnly = _this$props9.isReadOnly,
|
|
431
|
+
dataSelectorId = _this$props9.dataSelectorId;
|
|
432
|
+
var _this$state = this.state,
|
|
433
|
+
isEditorLoad = _this$state.isEditorLoad,
|
|
434
|
+
isEditorShow = _this$state.isEditorShow;
|
|
435
|
+
var editorDoc = ImgLazyLoad && global.editor && global.editor[id] ? global.editor[id].doc : null;
|
|
436
|
+
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 : ''),
|
|
438
|
+
dataId: dataId,
|
|
439
|
+
"data-isEditor": true,
|
|
440
|
+
dataSelectorId: dataSelectorId
|
|
441
|
+
}, loadingComponent && !isEditorLoad ? loadingComponent : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
442
|
+
flexible: true,
|
|
443
|
+
id: id,
|
|
444
|
+
dataId: dataId
|
|
445
|
+
}), editorDoc && ImgLazyLoad ? /*#__PURE__*/_react["default"].createElement(ImgLazyLoad, {
|
|
446
|
+
node: editorDoc
|
|
447
|
+
}) : null, isReadOnly ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
448
|
+
className: _TextEditorModule["default"].readOnlyMask
|
|
449
|
+
}) : null);
|
|
450
|
+
}
|
|
451
|
+
}]);
|
|
452
|
+
|
|
453
|
+
return TextEditor;
|
|
454
|
+
}(_react.Component);
|
|
455
|
+
|
|
456
|
+
exports["default"] = TextEditor;
|
|
457
|
+
TextEditor.defaultProps = _defaultProps.defaultProps;
|
|
458
|
+
TextEditor.propTypes = _propTypes.propTypes; // if (__DOCS__) {
|
|
459
|
+
// TextEditor.docs = {
|
|
460
|
+
// componentGroup: 'Fields',
|
|
461
|
+
// folderName: 'TextEditor'
|
|
462
|
+
// };
|
|
463
|
+
// }
|