@akemona-org/strapi-plugin-content-manager 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +27 -0
- package/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +78 -0
- package/admin/src/assets/images/background_input.svg +1 -0
- package/admin/src/assets/images/icon-cross-blue.svg +1 -0
- package/admin/src/assets/images/icon_remove.svg +19 -0
- package/admin/src/assets/images/logo.svg +1 -0
- package/admin/src/components/AddDropdown/components.js +113 -0
- package/admin/src/components/AddDropdown/index.js +76 -0
- package/admin/src/components/Block/components.js +28 -0
- package/admin/src/components/Block/index.js +45 -0
- package/admin/src/components/ComponentInitializer/P.js +9 -0
- package/admin/src/components/ComponentInitializer/index.js +43 -0
- package/admin/src/components/Container/index.js +7 -0
- package/admin/src/components/CustomInputCheckbox/components.js +77 -0
- package/admin/src/components/CustomInputCheckbox/index.js +53 -0
- package/admin/src/components/CustomTable/ActionCollapse/Delete.js +14 -0
- package/admin/src/components/CustomTable/ActionCollapse/DeleteAll.js +18 -0
- package/admin/src/components/CustomTable/ActionCollapse/Wrapper.js +20 -0
- package/admin/src/components/CustomTable/ActionCollapse/index.js +38 -0
- package/admin/src/components/CustomTable/Headers/Header.js +59 -0
- package/admin/src/components/CustomTable/Headers/Thead.js +35 -0
- package/admin/src/components/CustomTable/Headers/index.js +46 -0
- package/admin/src/components/CustomTable/Row/ActionContainer.js +19 -0
- package/admin/src/components/CustomTable/Row/Cell.js +55 -0
- package/admin/src/components/CustomTable/Row/index.js +112 -0
- package/admin/src/components/CustomTable/index.js +162 -0
- package/admin/src/components/CustomTable/styledComponents.js +85 -0
- package/admin/src/components/DragLayer/index.js +102 -0
- package/admin/src/components/DraggedField/Close/index.js +10 -0
- package/admin/src/components/DraggedField/GrabWrapper.js +38 -0
- package/admin/src/components/DraggedField/Link.js +17 -0
- package/admin/src/components/DraggedField/NameWrapper.js +29 -0
- package/admin/src/components/DraggedField/RemoveWrapper.js +32 -0
- package/admin/src/components/DraggedField/SubWrapper.js +36 -0
- package/admin/src/components/DraggedField/Wrapper.js +134 -0
- package/admin/src/components/DraggedField/index.js +196 -0
- package/admin/src/components/DraggedField/utils/getColor.js +12 -0
- package/admin/src/components/DraggedField/utils/getHeight.js +3 -0
- package/admin/src/components/DraggedFieldWithPreview/Carret.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +70 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicZoneWrapper.js +10 -0
- package/admin/src/components/DraggedFieldWithPreview/Tooltip.js +19 -0
- package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/index.js +194 -0
- package/admin/src/components/DynamicComponentCard/Wrapper.js +63 -0
- package/admin/src/components/DynamicComponentCard/index.js +49 -0
- package/admin/src/components/DynamicZone/BaselineAlignement.js +11 -0
- package/admin/src/components/DynamicZone/Button.js +31 -0
- package/admin/src/components/DynamicZone/Component/RoundCTA.js +45 -0
- package/admin/src/components/DynamicZone/Component/index.js +79 -0
- package/admin/src/components/DynamicZone/ComponentWrapper.js +44 -0
- package/admin/src/components/DynamicZone/DynamicZoneWrapper.js +12 -0
- package/admin/src/components/DynamicZone/Label.js +42 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/Wrapper.js +78 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/index.js +33 -0
- package/admin/src/components/DynamicZone/Picker/Category/index.js +53 -0
- package/admin/src/components/DynamicZone/Picker/Wrapper.js +32 -0
- package/admin/src/components/DynamicZone/Picker/index.js +88 -0
- package/admin/src/components/DynamicZone/Wrapper.js +34 -0
- package/admin/src/components/DynamicZone/index.js +238 -0
- package/admin/src/components/DynamicZone/utils/connect.js +12 -0
- package/admin/src/components/DynamicZone/utils/select.js +49 -0
- package/admin/src/components/FieldComponent/ComponentIcon.js +44 -0
- package/admin/src/components/FieldComponent/EmptyComponent.js +19 -0
- package/admin/src/components/FieldComponent/Label.js +10 -0
- package/admin/src/components/FieldComponent/ResetComponent.js +41 -0
- package/admin/src/components/FieldComponent/Wrapper.js +18 -0
- package/admin/src/components/FieldComponent/index.js +171 -0
- package/admin/src/components/FieldComponent/utils/connect.js +12 -0
- package/admin/src/components/FieldComponent/utils/select.js +123 -0
- package/admin/src/components/FieldsReorder/Item.js +249 -0
- package/admin/src/components/FieldsReorder/components.js +8 -0
- package/admin/src/components/FieldsReorder/index.js +102 -0
- package/admin/src/components/FilterOptionsCTA/index.js +14 -0
- package/admin/src/components/FilterPicker/components.js +56 -0
- package/admin/src/components/FilterPicker/index.js +258 -0
- package/admin/src/components/FilterPicker/init.js +25 -0
- package/admin/src/components/FilterPicker/reducer.js +58 -0
- package/admin/src/components/FilterPickerOption/Input.js +58 -0
- package/admin/src/components/FilterPickerOption/Option.js +18 -0
- package/admin/src/components/FilterPickerOption/components.js +60 -0
- package/admin/src/components/FilterPickerOption/index.js +101 -0
- package/admin/src/components/FormTitle/index.js +26 -0
- package/admin/src/components/FormWrapper/index.js +20 -0
- package/admin/src/components/InputJSON/components.js +30 -0
- package/admin/src/components/InputJSON/index.js +184 -0
- package/admin/src/components/InputJSON/jsonlint.js +424 -0
- package/admin/src/components/InputJSONWithErrors/Wrapper.js +32 -0
- package/admin/src/components/InputJSONWithErrors/index.js +168 -0
- package/admin/src/components/InputUID/InputUID.js +26 -0
- package/admin/src/components/InputUID/Options/Option.js +22 -0
- package/admin/src/components/InputUID/Options/OptionsTitle.js +12 -0
- package/admin/src/components/InputUID/Options/RightOptionLabel.js +10 -0
- package/admin/src/components/InputUID/Options/index.js +34 -0
- package/admin/src/components/InputUID/Options/wrapper.js +13 -0
- package/admin/src/components/InputUID/RegenerateButton.js +18 -0
- package/admin/src/components/InputUID/RightContent.js +14 -0
- package/admin/src/components/InputUID/RightContentLabel.js +10 -0
- package/admin/src/components/InputUID/RightLabel.js +42 -0
- package/admin/src/components/InputUID/SubLabel.js +9 -0
- package/admin/src/components/InputUID/Wrapper.js +8 -0
- package/admin/src/components/InputUID/index.js +325 -0
- package/admin/src/components/InputUID/regex.js +3 -0
- package/admin/src/components/Inputs/index.js +283 -0
- package/admin/src/components/Inputs/utils/VALIDATIONS_TO_OMIT.js +12 -0
- package/admin/src/components/Inputs/utils/connect.js +12 -0
- package/admin/src/components/Inputs/utils/generateOptions.js +19 -0
- package/admin/src/components/Inputs/utils/getInputType.js +44 -0
- package/admin/src/components/Inputs/utils/getStep.js +15 -0
- package/admin/src/components/Inputs/utils/index.js +6 -0
- package/admin/src/components/Inputs/utils/select.js +38 -0
- package/admin/src/components/LayoutTitle/index.js +19 -0
- package/admin/src/components/MediaPreviewList/StyledMediaPreviewList.js +171 -0
- package/admin/src/components/MediaPreviewList/index.js +110 -0
- package/admin/src/components/NonRepeatableComponent/index.js +73 -0
- package/admin/src/components/NonRepeatableWrapper/index.js +73 -0
- package/admin/src/components/PlusButton/index.js +52 -0
- package/admin/src/components/PopupForm/index.js +93 -0
- package/admin/src/components/PreviewCarret/components.js +27 -0
- package/admin/src/components/PreviewCarret/index.js +22 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +133 -0
- package/admin/src/components/PreviewWysiwyg/index.js +34 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +72 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +16 -0
- package/admin/src/components/RelationPreviewList/CountWrapper.js +7 -0
- package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +117 -0
- package/admin/src/components/RelationPreviewList/index.js +111 -0
- package/admin/src/components/RepeatableComponent/AddFieldButton.js +64 -0
- package/admin/src/components/RepeatableComponent/Banner.js +112 -0
- package/admin/src/components/RepeatableComponent/BannerWrapper.js +194 -0
- package/admin/src/components/RepeatableComponent/CarretTop.js +14 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/index.js +245 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/index.js +2 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/select.js +30 -0
- package/admin/src/components/RepeatableComponent/EmptyComponent.js +27 -0
- package/admin/src/components/RepeatableComponent/FormWrapper.js +27 -0
- package/admin/src/components/RepeatableComponent/index.js +187 -0
- package/admin/src/components/RepeatableComponent/reducer.js +73 -0
- package/admin/src/components/RepeatableComponent/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/utils/select.js +12 -0
- package/admin/src/components/Search/index.js +88 -0
- package/admin/src/components/SectionTitle/Title.js +11 -0
- package/admin/src/components/SectionTitle/index.js +29 -0
- package/admin/src/components/SelectMany/ListItem.js +107 -0
- package/admin/src/components/SelectMany/Relation.js +106 -0
- package/admin/src/components/SelectMany/components.js +153 -0
- package/admin/src/components/SelectMany/index.js +159 -0
- package/admin/src/components/SelectOne/SingleValue.js +58 -0
- package/admin/src/components/SelectOne/index.js +71 -0
- package/admin/src/components/SelectWrapper/ClearIndicator.js +15 -0
- package/admin/src/components/SelectWrapper/IndicatorSeparator.js +3 -0
- package/admin/src/components/SelectWrapper/Option.js +76 -0
- package/admin/src/components/SelectWrapper/components.js +14 -0
- package/admin/src/components/SelectWrapper/index.js +393 -0
- package/admin/src/components/SelectWrapper/utils/connect.js +12 -0
- package/admin/src/components/SelectWrapper/utils/index.js +3 -0
- package/admin/src/components/SelectWrapper/utils/select.js +45 -0
- package/admin/src/components/SelectWrapper/utils/styles.js +105 -0
- package/admin/src/components/Separator/index.js +9 -0
- package/admin/src/components/SettingFormWrapper/index.js +9 -0
- package/admin/src/components/SettingsViewWrapper/index.js +283 -0
- package/admin/src/components/SortWrapper/index.js +9 -0
- package/admin/src/components/SortableList/Item.js +126 -0
- package/admin/src/components/SortableList/index.js +60 -0
- package/admin/src/components/State/Wrapper.js +30 -0
- package/admin/src/components/State/index.js +26 -0
- package/admin/src/components/Truncate/index.js +5 -0
- package/admin/src/components/Truncated/index.js +10 -0
- package/admin/src/components/Wysiwyg/EditorWrapper.js +122 -0
- package/admin/src/components/Wysiwyg/MediaLib.js +71 -0
- package/admin/src/components/Wysiwyg/PreviewControlWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/SelectWrapper.js +24 -0
- package/admin/src/components/Wysiwyg/ToggleModeWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/constants.js +98 -0
- package/admin/src/components/Wysiwyg/customSelect.js +39 -0
- package/admin/src/components/Wysiwyg/helpers.js +116 -0
- package/admin/src/components/Wysiwyg/index.js +819 -0
- package/admin/src/components/Wysiwyg/previewControl.js +29 -0
- package/admin/src/components/Wysiwyg/toggleMode.js +44 -0
- package/admin/src/components/Wysiwyg/utils.js +70 -0
- package/admin/src/components/WysiwygBottomControls/components.js +44 -0
- package/admin/src/components/WysiwygBottomControls/index.js +33 -0
- package/admin/src/components/WysiwygDropUpload/Label.js +16 -0
- package/admin/src/components/WysiwygDropUpload/index.js +18 -0
- package/admin/src/components/WysiwygEditor/index.js +26 -0
- package/admin/src/components/WysiwygInlineControls/Button.js +77 -0
- package/admin/src/components/WysiwygInlineControls/StyledButton.js +54 -0
- package/admin/src/components/WysiwygInlineControls/Wrapper.js +25 -0
- package/admin/src/components/WysiwygInlineControls/index.js +66 -0
- package/admin/src/components/WysiwygWithErrors/Wrapper.js +38 -0
- package/admin/src/components/WysiwygWithErrors/index.js +158 -0
- package/admin/src/containers/CollectionTypeFormWrapper/index.js +376 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/CollectionTypeRecursivePath/index.js +125 -0
- package/admin/src/containers/ComponentSetttingsView/index.js +55 -0
- package/admin/src/containers/EditSettingsView/index.js +408 -0
- package/admin/src/containers/EditSettingsView/init.js +18 -0
- package/admin/src/containers/EditSettingsView/reducer.js +126 -0
- package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +26 -0
- package/admin/src/containers/EditSettingsView/utils/getInputProps.js +30 -0
- package/admin/src/containers/EditSettingsView/utils/index.js +2 -0
- package/admin/src/containers/EditSettingsView/utils/layout.js +98 -0
- package/admin/src/containers/EditView/DeleteLink/index.js +94 -0
- package/admin/src/containers/EditView/DeleteLink/utils/connect.js +12 -0
- package/admin/src/containers/EditView/DeleteLink/utils/index.js +2 -0
- package/admin/src/containers/EditView/DeleteLink/utils/select.js +21 -0
- package/admin/src/containers/EditView/Header/index.js +258 -0
- package/admin/src/containers/EditView/Header/utils/connect.js +12 -0
- package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +62 -0
- package/admin/src/containers/EditView/Header/utils/index.js +3 -0
- package/admin/src/containers/EditView/Header/utils/select.js +31 -0
- package/admin/src/containers/EditView/InformationCard.js +100 -0
- package/admin/src/containers/EditView/components.js +74 -0
- package/admin/src/containers/EditView/index.js +297 -0
- package/admin/src/containers/EditView/utils/createAttributesLayout.js +39 -0
- package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +23 -0
- package/admin/src/containers/EditView/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/index.js +519 -0
- package/admin/src/containers/EditViewDataManagerProvider/reducer.js +218 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +88 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +17 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +368 -0
- package/admin/src/containers/EditViewLayoutManager/Permissions.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/actions.js +9 -0
- package/admin/src/containers/EditViewLayoutManager/constants.js +2 -0
- package/admin/src/containers/EditViewLayoutManager/index.js +44 -0
- package/admin/src/containers/EditViewLayoutManager/reducer.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/selectors.js +5 -0
- package/admin/src/containers/LayoutDndProvider/index.js +75 -0
- package/admin/src/containers/ListSettingsView/DragWrapper.js +21 -0
- package/admin/src/containers/ListSettingsView/DropdownButton.js +8 -0
- package/admin/src/containers/ListSettingsView/Label.js +91 -0
- package/admin/src/containers/ListSettingsView/MenuDropdown.js +41 -0
- package/admin/src/containers/ListSettingsView/Toggle.js +51 -0
- package/admin/src/containers/ListSettingsView/forms.json +64 -0
- package/admin/src/containers/ListSettingsView/index.js +298 -0
- package/admin/src/containers/ListSettingsView/init.js +11 -0
- package/admin/src/containers/ListSettingsView/reducer.js +77 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/StyledLink.js +28 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/Wrapper.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/index.js +29 -0
- package/admin/src/containers/ListView/FieldPicker/Field/Wrapper.js +15 -0
- package/admin/src/containers/ListView/FieldPicker/Field/index.js +24 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +18 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/index.js +27 -0
- package/admin/src/containers/ListView/FieldPicker/Header/Reset.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/Header/index.js +42 -0
- package/admin/src/containers/ListView/FieldPicker/Wrapper.js +9 -0
- package/admin/src/containers/ListView/FieldPicker/index.js +46 -0
- package/admin/src/containers/ListView/Filter.js +83 -0
- package/admin/src/containers/ListView/Footer.js +60 -0
- package/admin/src/containers/ListView/actions.js +91 -0
- package/admin/src/containers/ListView/components.js +138 -0
- package/admin/src/containers/ListView/constants.js +16 -0
- package/admin/src/containers/ListView/index.js +573 -0
- package/admin/src/containers/ListView/reducer.js +182 -0
- package/admin/src/containers/ListView/selectors.js +24 -0
- package/admin/src/containers/ListView/utils/buildQueryString.js +26 -0
- package/admin/src/containers/ListView/utils/createPluginsFilter.js +13 -0
- package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +17 -0
- package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +14 -0
- package/admin/src/containers/ListView/utils/index.js +3 -0
- package/admin/src/containers/ListViewLayoutManager/Permissions.js +29 -0
- package/admin/src/containers/ListViewLayoutManager/index.js +60 -0
- package/admin/src/containers/ListViewProvider/index.js +16 -0
- package/admin/src/containers/Main/actions.js +13 -0
- package/admin/src/containers/Main/constants.js +3 -0
- package/admin/src/containers/Main/index.js +100 -0
- package/admin/src/containers/Main/reducer.js +37 -0
- package/admin/src/containers/Main/selectors.js +20 -0
- package/admin/src/containers/RBACManager/actions.js +14 -0
- package/admin/src/containers/RBACManager/constants.js +2 -0
- package/admin/src/containers/RBACManager/reducer.js +32 -0
- package/admin/src/containers/RBACManager/useSyncRbac.js +28 -0
- package/admin/src/containers/SingleTypeFormWrapper/index.js +317 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/SingleTypeRecursivePath/index.js +84 -0
- package/admin/src/containers/WysiwygProvider/index.js +16 -0
- package/admin/src/contexts/ContentTypeLayout.js +5 -0
- package/admin/src/contexts/LayoutDnd.js +5 -0
- package/admin/src/contexts/ListView.js +5 -0
- package/admin/src/contexts/Wysiwyg.js +5 -0
- package/admin/src/contexts/index.js +4 -0
- package/admin/src/hooks/index.js +6 -0
- package/admin/src/hooks/useContentTypeLayout/index.js +19 -0
- package/admin/src/hooks/useFetchContentTypeLayout/index.js +83 -0
- package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +56 -0
- package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +235 -0
- package/admin/src/hooks/useFindRedirectionLink/index.js +14 -0
- package/admin/src/hooks/useFindRedirectionLink/selectors.js +7 -0
- package/admin/src/hooks/useFindRedirectionLink/utils/getRedirectionLink.js +45 -0
- package/admin/src/hooks/useLayoutDnd.js +6 -0
- package/admin/src/hooks/useListView.js +6 -0
- package/admin/src/hooks/useWysiwyg.js +6 -0
- package/admin/src/icons/Bold/index.js +22 -0
- package/admin/src/icons/Code/index.js +13 -0
- package/admin/src/icons/Cross/index.js +33 -0
- package/admin/src/icons/Italic/index.js +23 -0
- package/admin/src/icons/Link/index.js +21 -0
- package/admin/src/icons/Media/index.js +14 -0
- package/admin/src/icons/Na/index.js +58 -0
- package/admin/src/icons/Ol/index.js +13 -0
- package/admin/src/icons/Quote/index.js +13 -0
- package/admin/src/icons/Striked/index.js +24 -0
- package/admin/src/icons/Ul/index.js +15 -0
- package/admin/src/icons/Underline/index.js +22 -0
- package/admin/src/index.js +52 -0
- package/admin/src/lifecycles.js +19 -0
- package/admin/src/permissions.js +27 -0
- package/admin/src/pluginId.js +5 -0
- package/admin/src/reducers.js +16 -0
- package/admin/src/selectors.js +6 -0
- package/admin/src/sharedReducers/crudReducer/actions.js +44 -0
- package/admin/src/sharedReducers/crudReducer/constants.js +7 -0
- package/admin/src/sharedReducers/crudReducer/reducer.js +75 -0
- package/admin/src/sharedReducers/crudReducer/selectors.js +5 -0
- package/admin/src/testUtils/data.js +305 -0
- package/admin/src/testUtils/index.js +4 -0
- package/admin/src/translations/ar.json +94 -0
- package/admin/src/translations/cs.json +130 -0
- package/admin/src/translations/de.json +177 -0
- package/admin/src/translations/dk.json +180 -0
- package/admin/src/translations/en.json +177 -0
- package/admin/src/translations/es.json +177 -0
- package/admin/src/translations/fr.json +162 -0
- package/admin/src/translations/id.json +175 -0
- package/admin/src/translations/index.js +53 -0
- package/admin/src/translations/it.json +177 -0
- package/admin/src/translations/ja.json +94 -0
- package/admin/src/translations/ko.json +110 -0
- package/admin/src/translations/ms.json +148 -0
- package/admin/src/translations/nl.json +94 -0
- package/admin/src/translations/pl.json +142 -0
- package/admin/src/translations/pt-BR.json +94 -0
- package/admin/src/translations/pt.json +94 -0
- package/admin/src/translations/ru.json +177 -0
- package/admin/src/translations/sk.json +172 -0
- package/admin/src/translations/th.json +155 -0
- package/admin/src/translations/tr.json +177 -0
- package/admin/src/translations/uk.json +148 -0
- package/admin/src/translations/vi.json +110 -0
- package/admin/src/translations/zh-Hans.json +177 -0
- package/admin/src/translations/zh.json +94 -0
- package/admin/src/utils/ItemTypes.js +7 -0
- package/admin/src/utils/checkIfAttributeIsDisplayable.js +13 -0
- package/admin/src/utils/createDefaultForm.js +50 -0
- package/admin/src/utils/dateFormats.js +18 -0
- package/admin/src/utils/formatFiltersFromQuery.js +55 -0
- package/admin/src/utils/formatFiltersToQuery.js +27 -0
- package/admin/src/utils/formatLayoutToApi.js +44 -0
- package/admin/src/utils/generatePermissionsObject.js +20 -0
- package/admin/src/utils/getComponents.js +50 -0
- package/admin/src/utils/getDisplayedValue.js +61 -0
- package/admin/src/utils/getFieldName.js +6 -0
- package/admin/src/utils/getMaxTempKey.js +12 -0
- package/admin/src/utils/getRequestUrl.js +5 -0
- package/admin/src/utils/getTrad.js +5 -0
- package/admin/src/utils/index.js +17 -0
- package/admin/src/utils/mergeMetasWithSchema.js +20 -0
- package/admin/src/utils/removeKeyInObject.js +45 -0
- package/admin/src/utils/removePasswordFieldsFromData.js +54 -0
- package/config/admin.json +5 -0
- package/config/functions/bootstrap.js +9 -0
- package/config/policies/has-draft-and-publish.js +19 -0
- package/config/policies/hasPermissions.js +34 -0
- package/config/policies/routing.js +27 -0
- package/config/routes.json +275 -0
- package/controllers/collection-types.js +282 -0
- package/controllers/components.js +66 -0
- package/controllers/content-types.js +112 -0
- package/controllers/relations.js +63 -0
- package/controllers/single-types.js +170 -0
- package/controllers/uid.js +41 -0
- package/controllers/validation/index.js +104 -0
- package/controllers/validation/model-configuration.js +114 -0
- package/oas.yml +757 -0
- package/package.json +77 -0
- package/services/components.js +92 -0
- package/services/configuration.js +79 -0
- package/services/content-types.js +73 -0
- package/services/data-mapper.js +98 -0
- package/services/entity-manager.js +140 -0
- package/services/metrics.js +34 -0
- package/services/permission-checker.js +69 -0
- package/services/permission.js +95 -0
- package/services/uid.js +63 -0
- package/services/utils/configuration/attributes.js +175 -0
- package/services/utils/configuration/index.js +43 -0
- package/services/utils/configuration/layouts.js +185 -0
- package/services/utils/configuration/metadatas.js +142 -0
- package/services/utils/configuration/settings.js +52 -0
- package/services/utils/store.js +93 -0
- package/utils/index.js +16 -0
- package/utils/pick-writable-attributes.js +6 -0
- package/utils/wrap-bad-request.js +15 -0
- package/validation/policies/hasPermissions.js +17 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
* PreviewControl
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { FormattedMessage } from 'react-intl';
|
|
10
|
+
import PreviewControlWrapper from './PreviewControlWrapper';
|
|
11
|
+
|
|
12
|
+
const PreviewControl = ({ onClick }) => (
|
|
13
|
+
<PreviewControlWrapper onClick={onClick}>
|
|
14
|
+
<div />
|
|
15
|
+
<div className="wysiwygCollapse">
|
|
16
|
+
<FormattedMessage id="components.Wysiwyg.collapse" />
|
|
17
|
+
</div>
|
|
18
|
+
</PreviewControlWrapper>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
PreviewControl.defaultProps = {
|
|
22
|
+
onClick: () => {},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
PreviewControl.propTypes = {
|
|
26
|
+
onClick: PropTypes.func,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default PreviewControl;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
* ToggleMode
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import ToggleModeWrapper from './ToggleModeWrapper';
|
|
11
|
+
|
|
12
|
+
const ToggleMode = props => {
|
|
13
|
+
const label = props.isPreviewMode
|
|
14
|
+
? 'components.Wysiwyg.ToggleMode.markdown'
|
|
15
|
+
: 'components.Wysiwyg.ToggleMode.preview';
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ToggleModeWrapper>
|
|
19
|
+
<FormattedMessage id={label}>
|
|
20
|
+
{msg => (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
className="toggleModeButton"
|
|
24
|
+
onClick={props.onClick}
|
|
25
|
+
>
|
|
26
|
+
{msg}
|
|
27
|
+
</button>
|
|
28
|
+
)}
|
|
29
|
+
</FormattedMessage>
|
|
30
|
+
</ToggleModeWrapper>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ToggleMode.defaultProps = {
|
|
35
|
+
isPreviewMode: false,
|
|
36
|
+
onClick: () => {},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
ToggleMode.propTypes = {
|
|
40
|
+
isPreviewMode: PropTypes.bool,
|
|
41
|
+
onClick: PropTypes.func,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ToggleMode;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Utils
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ContentBlock, EditorState, genKey, Modifier } from 'draft-js';
|
|
8
|
+
import { List } from 'immutable';
|
|
9
|
+
import { DEFAULT_INDENTATION } from './constants';
|
|
10
|
+
|
|
11
|
+
export function createNewBlock(text = '', type = 'unstyled', key = genKey()) {
|
|
12
|
+
return new ContentBlock({ key, type, text, charaterList: List([]) });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getNextBlocksList(editorState, startKey) {
|
|
16
|
+
return editorState
|
|
17
|
+
.getCurrentContent()
|
|
18
|
+
.getBlockMap()
|
|
19
|
+
.toSeq()
|
|
20
|
+
.skipUntil((_, k) => k === startKey)
|
|
21
|
+
.toList()
|
|
22
|
+
.shift()
|
|
23
|
+
.concat([createNewBlock()]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function updateSelection(selection, blocks, offset) {
|
|
27
|
+
return selection.merge({
|
|
28
|
+
anchorKey: blocks.get(0).getKey(),
|
|
29
|
+
focusKey: blocks.get(0).getKey(),
|
|
30
|
+
anchorOffset: offset,
|
|
31
|
+
focusOffset: offset,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getSelectedBlocksList(editorState) {
|
|
36
|
+
const selectionState = editorState.getSelection();
|
|
37
|
+
const contentState = editorState.getCurrentContent();
|
|
38
|
+
const startKey = selectionState.getStartKey();
|
|
39
|
+
const endKey = selectionState.getEndKey();
|
|
40
|
+
const blockMap = contentState.getBlockMap();
|
|
41
|
+
|
|
42
|
+
return blockMap
|
|
43
|
+
.toSeq()
|
|
44
|
+
.skipUntil((_, k) => k === startKey)
|
|
45
|
+
.takeUntil((_, k) => k === endKey)
|
|
46
|
+
.concat([[endKey, blockMap.get(endKey)]])
|
|
47
|
+
.toList();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function onTab(editorState) {
|
|
51
|
+
const contentState = editorState.getCurrentContent();
|
|
52
|
+
const selection = editorState.getSelection();
|
|
53
|
+
let newContentState;
|
|
54
|
+
|
|
55
|
+
if (selection.isCollapsed()) {
|
|
56
|
+
newContentState = Modifier.insertText(
|
|
57
|
+
contentState,
|
|
58
|
+
selection,
|
|
59
|
+
DEFAULT_INDENTATION
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
newContentState = Modifier.replaceText(
|
|
63
|
+
contentState,
|
|
64
|
+
selection,
|
|
65
|
+
DEFAULT_INDENTATION
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return EditorState.push(editorState, newContentState, 'insert-characters');
|
|
70
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const Span = styled.span`
|
|
4
|
+
color: #1c5de7;
|
|
5
|
+
text-decoration: underline;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
const Wrapper = styled.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
height: 30px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
padding: 0 15px;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
background-color: #fafafb;
|
|
16
|
+
line-height: 30px;
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
font-family: Lato;
|
|
19
|
+
border-top: 1px dashed #e3e4e4;
|
|
20
|
+
|
|
21
|
+
> div:first-child {
|
|
22
|
+
> span:last-child {
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.fullScreenWrapper {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
&:after {
|
|
30
|
+
content: '\f065';
|
|
31
|
+
margin-left: 8px;
|
|
32
|
+
font-family: FontAwesome;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dropLabel {
|
|
38
|
+
> input {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export { Span, Wrapper };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
2
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* WysiwygBottomControls
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import { FormattedMessage } from 'react-intl';
|
|
12
|
+
import { Wrapper } from './components';
|
|
13
|
+
|
|
14
|
+
const WysiwygBottomControls = ({ onClick }) => {
|
|
15
|
+
return (
|
|
16
|
+
<Wrapper>
|
|
17
|
+
<div />
|
|
18
|
+
<div className="fullScreenWrapper" onClick={onClick}>
|
|
19
|
+
<FormattedMessage id="components.WysiwygBottomControls.fullscreen" />
|
|
20
|
+
</div>
|
|
21
|
+
</Wrapper>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
WysiwygBottomControls.defaultProps = {
|
|
26
|
+
onClick: () => {},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
WysiwygBottomControls.propTypes = {
|
|
30
|
+
onClick: PropTypes.func,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default WysiwygBottomControls;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const Label = styled.label`
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
background-color: rgba(28, 93, 231, 0.01);
|
|
10
|
+
|
|
11
|
+
> input {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export default Label;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WysiwygDropUpload
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import Label from './Label';
|
|
9
|
+
|
|
10
|
+
const WysiwygDropUpload = props => {
|
|
11
|
+
return (
|
|
12
|
+
<Label {...props}>
|
|
13
|
+
<input onChange={() => {}} type="file" tabIndex="-1" />
|
|
14
|
+
</Label>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default WysiwygDropUpload;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WysiwygEditor
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Editor } from 'draft-js';
|
|
9
|
+
import 'draft-js/dist/Draft.css';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
|
|
12
|
+
class WysiwygEditor extends React.Component {
|
|
13
|
+
render() {
|
|
14
|
+
return <Editor {...this.props} ref={this.props.setRef} />;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
WysiwygEditor.defaultProps = {
|
|
19
|
+
setRef: () => {},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
WysiwygEditor.propTypes = {
|
|
23
|
+
setRef: PropTypes.func,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default WysiwygEditor;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Bold from '../../icons/Bold';
|
|
4
|
+
import Code from '../../icons/Code';
|
|
5
|
+
import Media from '../../icons/Media';
|
|
6
|
+
import Italic from '../../icons/Italic';
|
|
7
|
+
import Link from '../../icons/Link';
|
|
8
|
+
import Ol from '../../icons/Ol';
|
|
9
|
+
import Quote from '../../icons/Quote';
|
|
10
|
+
import Striked from '../../icons/Striked';
|
|
11
|
+
import Ul from '../../icons/Ul';
|
|
12
|
+
import Underline from '../../icons/Underline';
|
|
13
|
+
import StyledButton from './StyledButton';
|
|
14
|
+
|
|
15
|
+
const icons = {
|
|
16
|
+
bold: Bold,
|
|
17
|
+
italic: Italic,
|
|
18
|
+
underline: Underline,
|
|
19
|
+
ul: Ul,
|
|
20
|
+
ol: Ol,
|
|
21
|
+
link: Link,
|
|
22
|
+
quote: Quote,
|
|
23
|
+
code: Code,
|
|
24
|
+
striked: Striked,
|
|
25
|
+
img: Media,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Button = ({
|
|
29
|
+
active,
|
|
30
|
+
disabled,
|
|
31
|
+
className: type,
|
|
32
|
+
handler,
|
|
33
|
+
handlers,
|
|
34
|
+
hideLabel,
|
|
35
|
+
label,
|
|
36
|
+
style,
|
|
37
|
+
text,
|
|
38
|
+
}) => {
|
|
39
|
+
const handleClick = e => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
|
|
42
|
+
handlers[handler](text, style);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const Icon = icons[type];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<StyledButton active={active} disabled={disabled} onClick={handleClick} type={type}>
|
|
49
|
+
{icons[type] && <Icon />}
|
|
50
|
+
{!hideLabel && label}
|
|
51
|
+
</StyledButton>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
Button.defaultProps = {
|
|
56
|
+
active: false,
|
|
57
|
+
className: '',
|
|
58
|
+
disabled: false,
|
|
59
|
+
hideLabel: false,
|
|
60
|
+
label: '',
|
|
61
|
+
style: '',
|
|
62
|
+
text: '',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Button.propTypes = {
|
|
66
|
+
active: PropTypes.bool,
|
|
67
|
+
className: PropTypes.string,
|
|
68
|
+
disabled: PropTypes.bool,
|
|
69
|
+
handler: PropTypes.string.isRequired,
|
|
70
|
+
handlers: PropTypes.object.isRequired,
|
|
71
|
+
hideLabel: PropTypes.bool,
|
|
72
|
+
label: PropTypes.string,
|
|
73
|
+
style: PropTypes.string,
|
|
74
|
+
text: PropTypes.string,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default Button;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable indent */
|
|
4
|
+
const Button = styled.button`
|
|
5
|
+
display: flex;
|
|
6
|
+
height: 32px;
|
|
7
|
+
min-width: 32px;
|
|
8
|
+
background-color: #ffffff;
|
|
9
|
+
border: 1px solid rgba(16, 22, 34, 0.1);
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
line-height: 32px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
background-color: #f3f4f4;
|
|
18
|
+
}
|
|
19
|
+
&:active,
|
|
20
|
+
&:focus {
|
|
21
|
+
outline: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
${({ active, disabled }) => {
|
|
25
|
+
if (active) {
|
|
26
|
+
return css`
|
|
27
|
+
border: 0;
|
|
28
|
+
background: rgba(16, 22, 34, 0);
|
|
29
|
+
box-shadow: inset 0 -1px 0 0 rgba(16, 22, 34, 0.04), inset 0 1px 0 0 rgba(16, 22, 34, 0.04);
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (disabled) {
|
|
34
|
+
return css`
|
|
35
|
+
opacity: 0.7;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return '';
|
|
41
|
+
}}
|
|
42
|
+
|
|
43
|
+
> svg {
|
|
44
|
+
margin: auto;
|
|
45
|
+
> text {
|
|
46
|
+
font-family: Baskerville-SemiBoldItalic, Baskerville;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
background-position: center;
|
|
51
|
+
background-repeat: no-repeat;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export default Button;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const Wrapper = styled.div`
|
|
4
|
+
height: 49px;
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 8px 3px 0 10px;
|
|
7
|
+
background-color: #f3f4f4;
|
|
8
|
+
user-select: none;
|
|
9
|
+
overflow-x: auto;
|
|
10
|
+
> button:nth-child(even) {
|
|
11
|
+
border-left: 0;
|
|
12
|
+
border-right: 0;
|
|
13
|
+
}
|
|
14
|
+
> button:first-child {
|
|
15
|
+
border-top-left-radius: 3px;
|
|
16
|
+
border-bottom-left-radius: 3px;
|
|
17
|
+
}
|
|
18
|
+
> button:last-child {
|
|
19
|
+
border-top-right-radius: 3px;
|
|
20
|
+
border-bottom-right-radius: 3px;
|
|
21
|
+
border-right: 1px solid rgba(16, 22, 34, 0.1);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export default Wrapper;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WysiwygInlineControls
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import Button from './Button';
|
|
10
|
+
import Wrapper from './Wrapper';
|
|
11
|
+
|
|
12
|
+
const WysiwygInlineControls = ({
|
|
13
|
+
buttons,
|
|
14
|
+
disabled,
|
|
15
|
+
editorState,
|
|
16
|
+
handlers,
|
|
17
|
+
onToggle,
|
|
18
|
+
onToggleBlock,
|
|
19
|
+
}) => {
|
|
20
|
+
const selection = editorState.getSelection();
|
|
21
|
+
const blockType = editorState
|
|
22
|
+
.getCurrentContent()
|
|
23
|
+
.getBlockForKey(selection.getStartKey())
|
|
24
|
+
.getType();
|
|
25
|
+
|
|
26
|
+
const currentStyle = editorState.getCurrentInlineStyle();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Wrapper>
|
|
30
|
+
{buttons.map(type => (
|
|
31
|
+
<Button
|
|
32
|
+
key={type.label}
|
|
33
|
+
active={type.style === blockType || currentStyle.has(type.style)}
|
|
34
|
+
className={type.className}
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
handler={type.handler}
|
|
37
|
+
handlers={handlers}
|
|
38
|
+
hideLabel={type.hideLabel || false}
|
|
39
|
+
label={type.label}
|
|
40
|
+
onToggle={onToggle}
|
|
41
|
+
onToggleBlock={onToggleBlock}
|
|
42
|
+
style={type.style}
|
|
43
|
+
text={type.text}
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</Wrapper>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
WysiwygInlineControls.defaultProps = {
|
|
51
|
+
buttons: [],
|
|
52
|
+
disabled: false,
|
|
53
|
+
onToggle: () => {},
|
|
54
|
+
onToggleBlock: () => {},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
WysiwygInlineControls.propTypes = {
|
|
58
|
+
buttons: PropTypes.array,
|
|
59
|
+
disabled: PropTypes.bool,
|
|
60
|
+
editorState: PropTypes.object.isRequired,
|
|
61
|
+
handlers: PropTypes.object.isRequired,
|
|
62
|
+
onToggle: PropTypes.func,
|
|
63
|
+
onToggleBlock: PropTypes.func,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default WysiwygInlineControls;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const Wrapper = styled.div`
|
|
4
|
+
padding-bottom: 2.8rem;
|
|
5
|
+
font-size: 1.3rem;
|
|
6
|
+
font-family: 'Lato';
|
|
7
|
+
label {
|
|
8
|
+
display: block;
|
|
9
|
+
margin-bottom: 1rem;
|
|
10
|
+
}
|
|
11
|
+
&.bordered {
|
|
12
|
+
.editorWrapper {
|
|
13
|
+
border-color: red;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
> div + p {
|
|
17
|
+
width: 100%;
|
|
18
|
+
padding-top: 12px;
|
|
19
|
+
font-size: 1.2rem;
|
|
20
|
+
line-height: normal;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
margin-bottom: -9px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div,
|
|
28
|
+
pre,
|
|
29
|
+
code {
|
|
30
|
+
::-webkit-scrollbar {
|
|
31
|
+
height: 5px;
|
|
32
|
+
width: 5px;
|
|
33
|
+
cursor: default;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export default Wrapper;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WysiwygWithErrors
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { isEmpty, isFunction } from 'lodash';
|
|
10
|
+
import cn from 'classnames';
|
|
11
|
+
import { Description, ErrorMessage, Label } from '@buffetjs/styles';
|
|
12
|
+
import { Error } from '@buffetjs/core';
|
|
13
|
+
import { LabelIconWrapper } from 'strapi-helper-plugin';
|
|
14
|
+
import Wysiwyg from '../Wysiwyg';
|
|
15
|
+
import Wrapper from './Wrapper';
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line react/prefer-stateless-function
|
|
18
|
+
class WysiwygWithErrors extends React.Component {
|
|
19
|
+
render() {
|
|
20
|
+
const {
|
|
21
|
+
autoFocus,
|
|
22
|
+
className,
|
|
23
|
+
deactivateErrorHighlight,
|
|
24
|
+
disabled,
|
|
25
|
+
error: inputError,
|
|
26
|
+
inputClassName,
|
|
27
|
+
inputDescription,
|
|
28
|
+
inputStyle,
|
|
29
|
+
label,
|
|
30
|
+
labelIcon,
|
|
31
|
+
name,
|
|
32
|
+
onBlur: handleBlur,
|
|
33
|
+
onChange,
|
|
34
|
+
placeholder,
|
|
35
|
+
resetProps,
|
|
36
|
+
style,
|
|
37
|
+
tabIndex,
|
|
38
|
+
validations,
|
|
39
|
+
value,
|
|
40
|
+
...rest
|
|
41
|
+
} = this.props;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Error inputError={inputError} name={name} type="text" validations={validations}>
|
|
45
|
+
{({ canCheck, onBlur, error, dispatch }) => {
|
|
46
|
+
const hasError = Boolean(error);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Wrapper
|
|
50
|
+
className={`${cn(!isEmpty(className) && className)} ${hasError ? 'bordered' : ''}`}
|
|
51
|
+
style={style}
|
|
52
|
+
>
|
|
53
|
+
<Label htmlFor={name}>
|
|
54
|
+
<span>{label}</span>
|
|
55
|
+
{labelIcon && (
|
|
56
|
+
<LabelIconWrapper title={labelIcon.title}>{labelIcon.icon}</LabelIconWrapper>
|
|
57
|
+
)}
|
|
58
|
+
</Label>
|
|
59
|
+
<Wysiwyg
|
|
60
|
+
{...rest}
|
|
61
|
+
autoFocus={autoFocus}
|
|
62
|
+
className={inputClassName}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
deactivateErrorHighlight={deactivateErrorHighlight}
|
|
65
|
+
error={hasError}
|
|
66
|
+
name={name}
|
|
67
|
+
onBlur={isFunction(handleBlur) ? handleBlur : onBlur}
|
|
68
|
+
onChange={e => {
|
|
69
|
+
if (!canCheck) {
|
|
70
|
+
dispatch({
|
|
71
|
+
type: 'SET_CHECK',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
dispatch({
|
|
76
|
+
type: 'SET_ERROR',
|
|
77
|
+
error: null,
|
|
78
|
+
});
|
|
79
|
+
onChange(e);
|
|
80
|
+
}}
|
|
81
|
+
placeholder={placeholder}
|
|
82
|
+
resetProps={resetProps}
|
|
83
|
+
style={inputStyle}
|
|
84
|
+
tabIndex={tabIndex}
|
|
85
|
+
value={value}
|
|
86
|
+
/>
|
|
87
|
+
{!hasError && inputDescription && <Description>{inputDescription}</Description>}
|
|
88
|
+
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
|
89
|
+
</Wrapper>
|
|
90
|
+
);
|
|
91
|
+
}}
|
|
92
|
+
</Error>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
WysiwygWithErrors.defaultProps = {
|
|
98
|
+
autoFocus: false,
|
|
99
|
+
className: '',
|
|
100
|
+
deactivateErrorHighlight: false,
|
|
101
|
+
didCheckErrors: false,
|
|
102
|
+
disabled: false,
|
|
103
|
+
error: null,
|
|
104
|
+
inputClassName: '',
|
|
105
|
+
inputDescription: '',
|
|
106
|
+
inputStyle: {},
|
|
107
|
+
label: '',
|
|
108
|
+
labelIcon: null,
|
|
109
|
+
onBlur: false,
|
|
110
|
+
placeholder: '',
|
|
111
|
+
resetProps: false,
|
|
112
|
+
style: {},
|
|
113
|
+
tabIndex: '0',
|
|
114
|
+
validations: {},
|
|
115
|
+
value: null,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
WysiwygWithErrors.propTypes = {
|
|
119
|
+
autoFocus: PropTypes.bool,
|
|
120
|
+
className: PropTypes.string,
|
|
121
|
+
deactivateErrorHighlight: PropTypes.bool,
|
|
122
|
+
didCheckErrors: PropTypes.bool,
|
|
123
|
+
disabled: PropTypes.bool,
|
|
124
|
+
error: PropTypes.string,
|
|
125
|
+
inputClassName: PropTypes.string,
|
|
126
|
+
inputDescription: PropTypes.oneOfType([
|
|
127
|
+
PropTypes.string,
|
|
128
|
+
PropTypes.func,
|
|
129
|
+
PropTypes.shape({
|
|
130
|
+
id: PropTypes.string,
|
|
131
|
+
params: PropTypes.object,
|
|
132
|
+
}),
|
|
133
|
+
]),
|
|
134
|
+
inputStyle: PropTypes.object,
|
|
135
|
+
label: PropTypes.oneOfType([
|
|
136
|
+
PropTypes.string,
|
|
137
|
+
PropTypes.func,
|
|
138
|
+
PropTypes.shape({
|
|
139
|
+
id: PropTypes.string,
|
|
140
|
+
params: PropTypes.object,
|
|
141
|
+
}),
|
|
142
|
+
]),
|
|
143
|
+
labelIcon: PropTypes.shape({
|
|
144
|
+
icon: PropTypes.node.isRequired,
|
|
145
|
+
title: PropTypes.string,
|
|
146
|
+
}),
|
|
147
|
+
name: PropTypes.string.isRequired,
|
|
148
|
+
onBlur: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
|
149
|
+
onChange: PropTypes.func.isRequired,
|
|
150
|
+
placeholder: PropTypes.string,
|
|
151
|
+
resetProps: PropTypes.bool,
|
|
152
|
+
style: PropTypes.object,
|
|
153
|
+
tabIndex: PropTypes.string,
|
|
154
|
+
validations: PropTypes.object,
|
|
155
|
+
value: PropTypes.string,
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export default WysiwygWithErrors;
|