@strapi/admin 4.13.0-beta.0 → 4.13.1
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/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
- package/admin/src/components/NpsSurvey/index.js +365 -0
- package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +7 -9
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +6 -0
- package/admin/src/content-manager/components/Filter/Filter.js +21 -23
- package/admin/src/content-manager/components/InputUID/index.js +222 -216
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
- package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +7 -30
- package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
- package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
- package/admin/src/content-manager/constants/attributes.js +3 -0
- package/admin/src/content-manager/hooks/useAllowedAttributes.js +3 -7
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +16 -41
- package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +7 -1
- package/admin/src/content-manager/pages/ListView/index.js +14 -5
- package/admin/src/pages/Admin/index.js +3 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
- package/admin/src/pages/MarketplacePage/index.js +0 -1
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
- package/admin/src/pages/SettingsPage/index.js +16 -26
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +24 -31
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -0
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -0
- package/admin/src/plugins.js +7 -8
- package/admin/src/translations/en.json +7 -0
- package/build/{1049.f76cb14b.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
- package/build/1227.9f37e1dc.chunk.js +1 -0
- package/build/{1386.879bcd90.chunk.js → 1386.ea73b677.chunk.js} +1 -1
- package/build/1504.eff012f7.chunk.js +95 -0
- package/build/{2225.c6244756.chunk.js → 2225.649fb7bc.chunk.js} +11 -11
- package/build/2237.b832ae6e.chunk.js +114 -0
- package/build/2379.1f98a31a.chunk.js +1 -0
- package/build/2395.0e5e8ded.chunk.js +26 -0
- package/build/2801.8e1aa82a.chunk.js +1 -0
- package/build/{3483.03c24f96.chunk.js → 3483.19381b40.chunk.js} +1 -1
- package/build/{4174.fa8f9954.chunk.js → 4174.f1f39e40.chunk.js} +1 -1
- package/build/{4546.ff09eeda.chunk.js → 4546.a5946d22.chunk.js} +1 -1
- package/build/4724.aea5c8c1.chunk.js +6 -0
- package/build/502.7bba43b1.chunk.js +1 -0
- package/build/7464.eb057bec.chunk.js +1 -0
- package/build/8276.be3ed581.chunk.js +26 -0
- package/build/{Admin-authenticatedApp.53a24d28.chunk.js → Admin-authenticatedApp.baece4ac.chunk.js} +2 -2
- package/build/{Admin_InternalErrorPage.f45f2462.chunk.js → Admin_InternalErrorPage.38155af3.chunk.js} +1 -1
- package/build/{Admin_homePage.ac9dfb86.chunk.js → Admin_homePage.6f128523.chunk.js} +1 -1
- package/build/{Admin_marketplace.dde9c148.chunk.js → Admin_marketplace.061a6e5a.chunk.js} +2 -2
- package/build/{Admin_pluginsPage.bbe79434.chunk.js → Admin_pluginsPage.16f837b8.chunk.js} +1 -1
- package/build/{Admin_profilePage.192edc52.chunk.js → Admin_profilePage.678bce24.chunk.js} +2 -2
- package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
- package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
- package/build/admin-app.d63bd229.chunk.js +36 -0
- package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
- package/build/admin-edit-users.545fc882.chunk.js +10 -0
- package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
- package/build/{admin-users.123aa08e.chunk.js → admin-users.b8ea5677.chunk.js} +2 -2
- package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
- package/build/api-tokens-list-page.d747051c.chunk.js +16 -0
- package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
- package/build/content-manager.2d676432.chunk.js +1097 -0
- package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
- package/build/{content-type-builder.cd999f6e.chunk.js → content-type-builder.e5669749.chunk.js} +2 -2
- package/build/email-settings-page.2809f0bf.chunk.js +11 -0
- package/build/en-json.e12fd5fc.chunk.js +1 -0
- package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.c6c9e04c.js +2859 -0
- package/build/review-workflows-settings-create-view.4a156a19.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.ce984d1f.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.419b8deb.chunk.js +56 -0
- package/build/{runtime~main.b16af570.js → runtime~main.a883e1c1.js} +2 -2
- package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
- package/build/transfer-tokens-list-page.cfe1736c.chunk.js +16 -0
- package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
- package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
- package/build/users-advanced-settings-page.818d84eb.chunk.js +9 -0
- package/build/users-email-settings-page.c1967c09.chunk.js +9 -0
- package/build/users-providers-settings-page.11893e08.chunk.js +14 -0
- package/build/users-roles-settings-page.2b051e6a.chunk.js +55 -0
- package/build/{webhook-edit-page.6cb479ff.chunk.js → webhook-edit-page.de45c635.chunk.js} +2 -2
- package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +69 -71
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +3 -1
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +8 -38
- package/ee/admin/hooks/useAuthProviders.js +25 -0
- package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
- package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
- package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
- package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
- package/ee/admin/pages/HomePage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/index.js +2 -6
- package/package.json +9 -9
- package/scripts/build.js +15 -15
- package/scripts/create-dev-plugins-file.js +5 -38
- package/server/controllers/role.js +2 -0
- package/server/controllers/user.js +2 -0
- package/server/services/permission/permissions-manager/index.js +3 -1
- package/server/services/permission/permissions-manager/sanitize.js +7 -7
- package/server/services/permission/permissions-manager/validate.js +218 -0
- package/utils/create-cache-dir.js +62 -16
- package/utils/create-plugins-exclude-path.js +3 -23
- package/utils/get-plugins.js +110 -0
- package/utils/index.js +1 -1
- package/webpack.config.js +10 -13
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
- package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
- package/admin/src/pages/SettingsPage/utils/index.js +0 -2
- package/build/1227.32fe57ce.chunk.js +0 -1
- package/build/2379.f1641312.chunk.js +0 -1
- package/build/2395.46f8d0c1.chunk.js +0 -26
- package/build/2801.5cef5ec8.chunk.js +0 -1
- package/build/3929.5632f24d.chunk.js +0 -114
- package/build/4724.baf7c5b1.chunk.js +0 -6
- package/build/502.8ae8ef60.chunk.js +0 -1
- package/build/5542.2415a393.chunk.js +0 -63
- package/build/7464.3e64a1d5.chunk.js +0 -1
- package/build/8276.10a3f883.chunk.js +0 -26
- package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
- package/build/admin-app.91898385.chunk.js +0 -36
- package/build/admin-edit-users.79eeb125.chunk.js +0 -10
- package/build/api-tokens-list-page.505bf7e0.chunk.js +0 -16
- package/build/content-manager.7f96a2f1.chunk.js +0 -1097
- package/build/email-settings-page.d494d1eb.chunk.js +0 -11
- package/build/en-json.4f06fe03.chunk.js +0 -1
- package/build/main.40b94779.js +0 -2859
- package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
- package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
- package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
- package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
- package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
- package/build/users-roles-settings-page.9d9a1eff.chunk.js +0 -30
- package/ee/admin/hooks/index.js +0 -4
- package/ee/admin/hooks/useAuthProviders/index.js +0 -50
- package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
- package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
- package/scripts/create-plugins-file.js +0 -92
- package/utils/get-plugins-path.js +0 -41
- /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
- /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import React, { forwardRef, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Box, Flex, Typography } from '@strapi/design-system';
|
|
4
4
|
import { prefixFileUrlWithBackendUrl, useLibrary } from '@strapi/helper-plugin';
|
|
@@ -30,160 +30,155 @@ const TypographyAsterisk = styled(Typography)`
|
|
|
30
30
|
line-height: 0;
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
|
-
const Wysiwyg = (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
33
|
+
const Wysiwyg = forwardRef(
|
|
34
|
+
(
|
|
35
|
+
{ hint, disabled, error, intlLabel, labelAction, name, onChange, placeholder, value, required },
|
|
36
|
+
forwardedRef
|
|
37
|
+
) => {
|
|
38
|
+
const { formatMessage } = useIntl();
|
|
39
|
+
const textareaRef = useRef(null);
|
|
40
|
+
const editorRef = useRef(null);
|
|
41
|
+
const [isPreviewMode, setIsPreviewMode] = useState(false);
|
|
42
|
+
const [mediaLibVisible, setMediaLibVisible] = useState(false);
|
|
43
|
+
const [isExpandMode, setIsExpandMode] = useState(false);
|
|
44
|
+
const { components } = useLibrary();
|
|
45
|
+
|
|
46
|
+
const MediaLibraryDialog = components['media-library'];
|
|
47
|
+
|
|
48
|
+
const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);
|
|
49
|
+
const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);
|
|
50
|
+
const handleToggleExpand = () => {
|
|
51
|
+
setIsPreviewMode(false);
|
|
52
|
+
setIsExpandMode((prev) => !prev);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleActionClick = (value, currentEditorRef, togglePopover) => {
|
|
56
|
+
switch (value) {
|
|
57
|
+
case 'Link':
|
|
58
|
+
case 'Strikethrough': {
|
|
59
|
+
markdownHandler(currentEditorRef, value);
|
|
60
|
+
togglePopover();
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case 'Code':
|
|
64
|
+
case 'Quote': {
|
|
65
|
+
quoteAndCodeHandler(currentEditorRef, value);
|
|
66
|
+
togglePopover();
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'Bold':
|
|
70
|
+
case 'Italic':
|
|
71
|
+
case 'Underline': {
|
|
72
|
+
markdownHandler(currentEditorRef, value);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case 'BulletList':
|
|
76
|
+
case 'NumberList': {
|
|
77
|
+
listHandler(currentEditorRef, value);
|
|
78
|
+
togglePopover();
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 'h1':
|
|
82
|
+
case 'h2':
|
|
83
|
+
case 'h3':
|
|
84
|
+
case 'h4':
|
|
85
|
+
case 'h5':
|
|
86
|
+
case 'h6': {
|
|
87
|
+
titleHandler(currentEditorRef, value);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
default: {
|
|
91
|
+
// Nothing
|
|
92
|
+
}
|
|
69
93
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
insertFile(editorRef, formattedFiles);
|
|
111
|
-
setMediaLibVisible(false);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const formattedPlaceholder = placeholder
|
|
115
|
-
? formatMessage(
|
|
116
|
-
{ id: placeholder.id, defaultMessage: placeholder.defaultMessage },
|
|
117
|
-
{ ...placeholder.values }
|
|
118
|
-
)
|
|
119
|
-
: '';
|
|
120
|
-
|
|
121
|
-
const label = intlLabel.id
|
|
122
|
-
? formatMessage(
|
|
123
|
-
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
124
|
-
{ ...intlLabel.values }
|
|
125
|
-
)
|
|
126
|
-
: name;
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<>
|
|
130
|
-
<Flex direction="column" alignItems="stretch" gap={1}>
|
|
131
|
-
<Flex gap={1}>
|
|
132
|
-
<Typography variant="pi" fontWeight="bold" textColor="neutral800">
|
|
133
|
-
{label}
|
|
134
|
-
{required && <TypographyAsterisk textColor="danger600">*</TypographyAsterisk>}
|
|
135
|
-
</Typography>
|
|
136
|
-
{labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
|
|
137
|
-
</Flex>
|
|
138
|
-
|
|
139
|
-
<EditorLayout
|
|
140
|
-
isExpandMode={isExpandMode}
|
|
141
|
-
error={error}
|
|
142
|
-
previewContent={value}
|
|
143
|
-
onCollapse={handleToggleExpand}
|
|
144
|
-
>
|
|
145
|
-
<WysiwygNav
|
|
146
|
-
isExpandMode={isExpandMode}
|
|
147
|
-
editorRef={editorRef}
|
|
148
|
-
isPreviewMode={isPreviewMode}
|
|
149
|
-
onActionClick={handleActionClick}
|
|
150
|
-
onToggleMediaLib={handleToggleMediaLib}
|
|
151
|
-
onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}
|
|
152
|
-
disabled={disabled}
|
|
153
|
-
/>
|
|
154
|
-
|
|
155
|
-
<Editor
|
|
156
|
-
disabled={disabled}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleSelectAssets = (files) => {
|
|
97
|
+
const formattedFiles = files.map((f) => ({
|
|
98
|
+
alt: f.alternativeText || f.name,
|
|
99
|
+
url: prefixFileUrlWithBackendUrl(f.url),
|
|
100
|
+
mime: f.mime,
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
insertFile(editorRef, formattedFiles);
|
|
104
|
+
setMediaLibVisible(false);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const formattedPlaceholder = placeholder
|
|
108
|
+
? formatMessage(
|
|
109
|
+
{ id: placeholder.id, defaultMessage: placeholder.defaultMessage },
|
|
110
|
+
{ ...placeholder.values }
|
|
111
|
+
)
|
|
112
|
+
: '';
|
|
113
|
+
|
|
114
|
+
const label = intlLabel.id
|
|
115
|
+
? formatMessage(
|
|
116
|
+
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
117
|
+
{ ...intlLabel.values }
|
|
118
|
+
)
|
|
119
|
+
: name;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<Flex direction="column" alignItems="stretch" gap={1}>
|
|
124
|
+
<Flex gap={1}>
|
|
125
|
+
<Typography variant="pi" fontWeight="bold" textColor="neutral800">
|
|
126
|
+
{label}
|
|
127
|
+
{required && <TypographyAsterisk textColor="danger600">*</TypographyAsterisk>}
|
|
128
|
+
</Typography>
|
|
129
|
+
{labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
|
|
130
|
+
</Flex>
|
|
131
|
+
|
|
132
|
+
<EditorLayout
|
|
157
133
|
isExpandMode={isExpandMode}
|
|
158
|
-
editorRef={editorRef}
|
|
159
134
|
error={error}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
135
|
+
previewContent={value}
|
|
136
|
+
onCollapse={handleToggleExpand}
|
|
137
|
+
>
|
|
138
|
+
<WysiwygNav
|
|
139
|
+
isExpandMode={isExpandMode}
|
|
140
|
+
editorRef={editorRef}
|
|
141
|
+
isPreviewMode={isPreviewMode}
|
|
142
|
+
onActionClick={handleActionClick}
|
|
143
|
+
onToggleMediaLib={handleToggleMediaLib}
|
|
144
|
+
onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}
|
|
145
|
+
disabled={disabled}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<Editor
|
|
149
|
+
disabled={disabled}
|
|
150
|
+
isExpandMode={isExpandMode}
|
|
151
|
+
editorRef={editorRef}
|
|
152
|
+
error={error}
|
|
153
|
+
isPreviewMode={isPreviewMode}
|
|
154
|
+
name={name}
|
|
155
|
+
onChange={onChange}
|
|
156
|
+
placeholder={formattedPlaceholder}
|
|
157
|
+
textareaRef={textareaRef}
|
|
158
|
+
value={value}
|
|
159
|
+
ref={forwardedRef}
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
{!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
|
|
163
|
+
</EditorLayout>
|
|
164
|
+
<Hint hint={hint} name={name} error={error} />
|
|
165
|
+
</Flex>
|
|
166
|
+
|
|
167
|
+
{error && (
|
|
168
|
+
<Box paddingTop={1}>
|
|
169
|
+
<Typography variant="pi" textColor="danger600" data-strapi-field-error>
|
|
170
|
+
{error}
|
|
171
|
+
</Typography>
|
|
172
|
+
</Box>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{mediaLibVisible && (
|
|
176
|
+
<MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />
|
|
177
|
+
)}
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
);
|
|
187
182
|
|
|
188
183
|
Wysiwyg.defaultProps = {
|
|
189
184
|
disabled: false,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useRBACProvider, findMatchingPermissions } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
|
+
import { CREATOR_FIELDS } from '../constants/attributes';
|
|
4
|
+
|
|
3
5
|
const NOT_ALLOWED_FILTERS = ['json', 'component', 'media', 'richtext', 'dynamiczone', 'password'];
|
|
4
6
|
const TIMESTAMPS = ['createdAt', 'updatedAt'];
|
|
5
|
-
const CREATOR_ATTRIBUTES = ['createdBy', 'updatedBy'];
|
|
6
7
|
|
|
7
8
|
export const useAllowedAttributes = (contentType, slug) => {
|
|
8
9
|
const { allPermissions } = useRBACProvider();
|
|
@@ -38,10 +39,5 @@ export const useAllowedAttributes = (contentType, slug) => {
|
|
|
38
39
|
return true;
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
return [
|
|
42
|
-
'id',
|
|
43
|
-
...allowedAttributes,
|
|
44
|
-
...TIMESTAMPS,
|
|
45
|
-
...(canReadAdminUsers ? CREATOR_ATTRIBUTES : []),
|
|
46
|
-
];
|
|
42
|
+
return ['id', ...allowedAttributes, ...TIMESTAMPS, ...(canReadAdminUsers ? CREATOR_FIELDS : [])];
|
|
47
43
|
};
|
|
@@ -12,7 +12,7 @@ import { useFetchContentTypeLayout } from '../../hooks';
|
|
|
12
12
|
import { formatLayoutToApi } from '../../utils';
|
|
13
13
|
import EditSettingsView from '../EditSettingsView';
|
|
14
14
|
import EditViewLayoutManager from '../EditViewLayoutManager';
|
|
15
|
-
import ListSettingsView from '../ListSettingsView';
|
|
15
|
+
import { ListSettingsView } from '../ListSettingsView';
|
|
16
16
|
import ListViewLayout from '../ListViewLayoutManager';
|
|
17
17
|
|
|
18
18
|
import ErrorFallback from './components/ErrorFallback';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -9,13 +9,7 @@ import {
|
|
|
9
9
|
Layout,
|
|
10
10
|
Main,
|
|
11
11
|
} from '@strapi/design-system';
|
|
12
|
-
import {
|
|
13
|
-
ConfirmDialog,
|
|
14
|
-
Link,
|
|
15
|
-
useFetchClient,
|
|
16
|
-
useNotification,
|
|
17
|
-
useTracking,
|
|
18
|
-
} from '@strapi/helper-plugin';
|
|
12
|
+
import { Link, useFetchClient, useNotification, useTracking } from '@strapi/helper-plugin';
|
|
19
13
|
import { ArrowLeft, Check } from '@strapi/icons';
|
|
20
14
|
import isEqual from 'lodash/isEqual';
|
|
21
15
|
import upperFirst from 'lodash/upperFirst';
|
|
@@ -34,16 +28,14 @@ import { SortDisplayedFields } from './components/SortDisplayedFields';
|
|
|
34
28
|
import { EXCLUDED_SORT_ATTRIBUTE_TYPES } from './constants';
|
|
35
29
|
import reducer, { initialState } from './reducer';
|
|
36
30
|
|
|
37
|
-
const ListSettingsView = ({ layout, slug }) => {
|
|
31
|
+
export const ListSettingsView = ({ layout, slug }) => {
|
|
38
32
|
const { put } = useFetchClient();
|
|
39
33
|
const { formatMessage } = useIntl();
|
|
40
34
|
const { trackUsage } = useTracking();
|
|
41
35
|
const pluginsQueryParams = usePluginsQueryParams();
|
|
42
36
|
const toggleNotification = useNotification();
|
|
43
|
-
const { refetchData } = useContext(ModelsContext);
|
|
44
|
-
const [
|
|
45
|
-
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
46
|
-
const [{ fieldToEdit, fieldForm, initialData, modifiedData }, dispatch] = useReducer(
|
|
37
|
+
const { refetchData } = React.useContext(ModelsContext);
|
|
38
|
+
const [{ fieldToEdit, fieldForm, initialData, modifiedData }, dispatch] = React.useReducer(
|
|
47
39
|
reducer,
|
|
48
40
|
initialState,
|
|
49
41
|
() => ({
|
|
@@ -101,16 +93,6 @@ const ListSettingsView = ({ layout, slug }) => {
|
|
|
101
93
|
}
|
|
102
94
|
);
|
|
103
95
|
|
|
104
|
-
const handleConfirm = async () => {
|
|
105
|
-
const { layouts, settings, metadatas } = modifiedData;
|
|
106
|
-
|
|
107
|
-
mutate({
|
|
108
|
-
layouts,
|
|
109
|
-
settings,
|
|
110
|
-
metadatas,
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
96
|
const handleAddField = (item) => {
|
|
115
97
|
dispatch({
|
|
116
98
|
type: 'ADD_FIELD',
|
|
@@ -134,9 +116,17 @@ const ListSettingsView = ({ layout, slug }) => {
|
|
|
134
116
|
}
|
|
135
117
|
};
|
|
136
118
|
|
|
137
|
-
const handleSubmit = (
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
const handleSubmit = (event) => {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
|
|
122
|
+
const { layouts, settings, metadatas } = modifiedData;
|
|
123
|
+
|
|
124
|
+
mutate({
|
|
125
|
+
layouts,
|
|
126
|
+
settings,
|
|
127
|
+
metadatas,
|
|
128
|
+
});
|
|
129
|
+
|
|
140
130
|
trackUsage('willSaveContentTypeLayout');
|
|
141
131
|
};
|
|
142
132
|
|
|
@@ -257,19 +247,6 @@ const ListSettingsView = ({ layout, slug }) => {
|
|
|
257
247
|
/>
|
|
258
248
|
</Flex>
|
|
259
249
|
</ContentLayout>
|
|
260
|
-
|
|
261
|
-
<ConfirmDialog
|
|
262
|
-
bodyText={{
|
|
263
|
-
id: getTrad('popUpWarning.warning.updateAllSettings'),
|
|
264
|
-
defaultMessage: 'This will modify all your settings',
|
|
265
|
-
}}
|
|
266
|
-
iconRightButton={<Check />}
|
|
267
|
-
isConfirmButtonLoading={isSubmittingForm}
|
|
268
|
-
isOpen={showWarningSubmit}
|
|
269
|
-
onToggleDialog={toggleWarningSubmit}
|
|
270
|
-
onConfirm={handleConfirm}
|
|
271
|
-
variantRightButton="success-light"
|
|
272
|
-
/>
|
|
273
250
|
</form>
|
|
274
251
|
|
|
275
252
|
{isModalFormOpen && (
|
|
@@ -309,5 +286,3 @@ ListSettingsView.propTypes = {
|
|
|
309
286
|
}).isRequired,
|
|
310
287
|
slug: PropTypes.string.isRequired,
|
|
311
288
|
};
|
|
312
|
-
|
|
313
|
-
export default ListSettingsView;
|
|
@@ -32,7 +32,13 @@ export const ViewSettingsMenu = ({ slug, layout }) => {
|
|
|
32
32
|
onClick={handleToggle}
|
|
33
33
|
/>
|
|
34
34
|
{isVisible && (
|
|
35
|
-
<Popover
|
|
35
|
+
<Popover
|
|
36
|
+
placement="bottom-end"
|
|
37
|
+
source={cogButtonRef}
|
|
38
|
+
onDismiss={handleToggle}
|
|
39
|
+
spacing={4}
|
|
40
|
+
padding={3}
|
|
41
|
+
>
|
|
36
42
|
<Flex alignItems="stretch" direction="column" gap={3}>
|
|
37
43
|
<CheckPermissions
|
|
38
44
|
permissions={permissions.contentManager.collectionTypesConfigurations}
|
|
@@ -49,6 +49,7 @@ import { useEnterprise } from '../../../hooks/useEnterprise';
|
|
|
49
49
|
import { InjectionZone } from '../../../shared/components';
|
|
50
50
|
import { Filter } from '../../components/Filter';
|
|
51
51
|
import { AdminUsersFilter } from '../../components/Filter/CustomInputs/AdminUsersFilter';
|
|
52
|
+
import { CREATOR_FIELDS } from '../../constants/attributes';
|
|
52
53
|
import { useAllowedAttributes } from '../../hooks/useAllowedAttributes';
|
|
53
54
|
import { getTrad, getDisplayName } from '../../utils';
|
|
54
55
|
|
|
@@ -63,8 +64,7 @@ import { buildValidGetParams } from './utils';
|
|
|
63
64
|
const REVIEW_WORKFLOW_COLUMNS_CE = null;
|
|
64
65
|
const REVIEW_WORKFLOW_COLUMNS_CELL_CE = () => null;
|
|
65
66
|
const REVIEW_WORKFLOW_FILTER_CE = [];
|
|
66
|
-
const
|
|
67
|
-
const USER_FILTER_ATTRIBUTES = [...CREATOR_ATTRIBUTES, 'strapi_assignee'];
|
|
67
|
+
const USER_FILTER_ATTRIBUTES = [...CREATOR_FIELDS, 'strapi_assignee'];
|
|
68
68
|
|
|
69
69
|
function ListView({
|
|
70
70
|
canCreate,
|
|
@@ -785,9 +785,7 @@ function ListView({
|
|
|
785
785
|
<Td key={key}>
|
|
786
786
|
{rowData.strapi_assignee ? (
|
|
787
787
|
<ReviewWorkflowsColumns.ReviewWorkflowsAssigneeEE
|
|
788
|
-
|
|
789
|
-
lastname={rowData?.strapi_assignee?.lastname}
|
|
790
|
-
displayname={rowData?.strapi_assignee?.username}
|
|
788
|
+
user={rowData.strapi_assignee}
|
|
791
789
|
/>
|
|
792
790
|
) : (
|
|
793
791
|
<Typography textColor="neutral800">-</Typography>
|
|
@@ -808,6 +806,17 @@ function ListView({
|
|
|
808
806
|
);
|
|
809
807
|
}
|
|
810
808
|
|
|
809
|
+
if (['createdBy', 'updatedBy'].includes(name.split('.')[0])) {
|
|
810
|
+
// Display the users full name
|
|
811
|
+
return (
|
|
812
|
+
<Td key={key}>
|
|
813
|
+
<Typography textColor="neutral800">
|
|
814
|
+
{getDisplayName(rowData[name.split('.')[0]], formatMessage)}
|
|
815
|
+
</Typography>
|
|
816
|
+
</Td>
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
|
|
811
820
|
if (typeof cellFormatter === 'function') {
|
|
812
821
|
return (
|
|
813
822
|
<Td key={key}>{cellFormatter(rowData, { key, name, ...rest })}</Td>
|
|
@@ -42,7 +42,9 @@ const ProfilePage = lazy(() =>
|
|
|
42
42
|
import(/* webpackChunkName: "Admin_profilePage" */ '../ProfilePage')
|
|
43
43
|
);
|
|
44
44
|
const SettingsPage = lazy(() =>
|
|
45
|
-
import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage')
|
|
45
|
+
import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage').then((module) => ({
|
|
46
|
+
default: module.SettingsPage,
|
|
47
|
+
}))
|
|
46
48
|
);
|
|
47
49
|
|
|
48
50
|
// Simple hook easier for testing
|
|
@@ -29,6 +29,7 @@ import { useIntl } from 'react-intl';
|
|
|
29
29
|
import { useHistory } from 'react-router-dom';
|
|
30
30
|
import styled from 'styled-components';
|
|
31
31
|
|
|
32
|
+
import { useNpsSurveySettings } from '../../../../components/NpsSurvey/hooks/useNpsSurveySettings';
|
|
32
33
|
import Logo from '../../../../components/UnauthenticatedLogo';
|
|
33
34
|
import UnauthenticatedLayout, { LayoutContent } from '../../../../layouts/UnauthenticatedLayout';
|
|
34
35
|
import FieldActionWrapper from '../FieldActionWrapper';
|
|
@@ -55,6 +56,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
55
56
|
const query = useQuery();
|
|
56
57
|
const { formatAPIError } = useAPIErrorHandler();
|
|
57
58
|
const { get } = useFetchClient();
|
|
59
|
+
const { setNpsSurveySettings } = useNpsSurveySettings();
|
|
58
60
|
|
|
59
61
|
const registrationToken = query.get('registrationToken');
|
|
60
62
|
|
|
@@ -143,6 +145,9 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
143
145
|
} else {
|
|
144
146
|
onSubmit(normalizedData, formik);
|
|
145
147
|
}
|
|
148
|
+
|
|
149
|
+
// Only enable EE survey if user accepted the newsletter
|
|
150
|
+
setNpsSurveySettings({ enabled: data.news });
|
|
146
151
|
} catch (err) {
|
|
147
152
|
const errors = getYupInnerErrors(err);
|
|
148
153
|
setSubmitCount(submitCount + 1);
|
|
@@ -12,14 +12,14 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import { useIntl } from 'react-intl';
|
|
13
13
|
import { NavLink, useLocation } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
-
import { getSectionsToDisplay } from '../../utils';
|
|
16
|
-
|
|
17
15
|
const SettingsNav = ({ menu }) => {
|
|
18
16
|
const { formatMessage } = useIntl();
|
|
19
17
|
const { trackUsage } = useTracking();
|
|
20
18
|
const { pathname } = useLocation();
|
|
21
19
|
|
|
22
|
-
const filteredMenu =
|
|
20
|
+
const filteredMenu = menu.filter(
|
|
21
|
+
(section) => !section.links.every((link) => link.isDisplayed === false)
|
|
22
|
+
);
|
|
23
23
|
|
|
24
24
|
const sections = filteredMenu.map((section) => {
|
|
25
25
|
return {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* SettingsPage
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// NOTE TO PLUGINS DEVELOPERS:
|
|
8
|
-
// If you modify this file you also need to update the documentation accordingly
|
|
9
|
-
// Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-settings-api.md
|
|
10
|
-
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
|
11
|
-
|
|
12
|
-
import React, { memo, useMemo } from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
13
2
|
|
|
14
3
|
import { Layout } from '@strapi/design-system';
|
|
15
4
|
import { LoadingIndicatorPage, useStrapiApp } from '@strapi/helper-plugin';
|
|
@@ -19,14 +8,14 @@ import { Redirect, Route, Switch, useParams } from 'react-router-dom';
|
|
|
19
8
|
|
|
20
9
|
import { useSettingsMenu } from '../../hooks';
|
|
21
10
|
import { useEnterprise } from '../../hooks/useEnterprise';
|
|
22
|
-
import
|
|
11
|
+
import createRoute from '../../utils/createRoute';
|
|
12
|
+
import makeUniqueRoutes from '../../utils/makeUniqueRoutes';
|
|
23
13
|
|
|
24
14
|
import SettingsNav from './components/SettingsNav';
|
|
25
15
|
import { ROUTES_CE } from './constants';
|
|
26
16
|
import ApplicationInfosPage from './pages/ApplicationInfosPage';
|
|
27
|
-
import { createSectionsRoutes } from './utils';
|
|
28
17
|
|
|
29
|
-
function SettingsPage() {
|
|
18
|
+
export function SettingsPage() {
|
|
30
19
|
const { settingId } = useParams();
|
|
31
20
|
const { settings } = useStrapiApp();
|
|
32
21
|
const { formatMessage } = useIntl();
|
|
@@ -43,13 +32,17 @@ function SettingsPage() {
|
|
|
43
32
|
);
|
|
44
33
|
|
|
45
34
|
// Creates the admin routes
|
|
46
|
-
const adminRoutes = useMemo(() => {
|
|
35
|
+
const adminRoutes = React.useMemo(() => {
|
|
47
36
|
return makeUniqueRoutes(
|
|
48
37
|
routes.map(({ to, Component, exact }) => createRoute(Component, to, exact))
|
|
49
38
|
);
|
|
50
39
|
}, [routes]);
|
|
51
40
|
|
|
52
|
-
const pluginsRoutes =
|
|
41
|
+
const pluginsRoutes = Object.values(settings).flatMap((section) => {
|
|
42
|
+
const { links } = section;
|
|
43
|
+
|
|
44
|
+
return links.map((link) => createRoute(link.Component, link.to, link.exact || false));
|
|
45
|
+
});
|
|
53
46
|
|
|
54
47
|
// Since the useSettingsMenu hook can make API calls in order to check the links permissions
|
|
55
48
|
// We need to add a loading state to prevent redirecting the user while permissions are being checked
|
|
@@ -61,14 +54,14 @@ function SettingsPage() {
|
|
|
61
54
|
return <Redirect to="/settings/application-infos" />;
|
|
62
55
|
}
|
|
63
56
|
|
|
64
|
-
const settingTitle = formatMessage({
|
|
65
|
-
id: 'global.settings',
|
|
66
|
-
defaultMessage: 'Settings',
|
|
67
|
-
});
|
|
68
|
-
|
|
69
57
|
return (
|
|
70
58
|
<Layout sideNav={<SettingsNav menu={menu} />}>
|
|
71
|
-
<Helmet
|
|
59
|
+
<Helmet
|
|
60
|
+
title={formatMessage({
|
|
61
|
+
id: 'global.settings',
|
|
62
|
+
defaultMessage: 'Settings',
|
|
63
|
+
})}
|
|
64
|
+
/>
|
|
72
65
|
|
|
73
66
|
<Switch>
|
|
74
67
|
<Route path="/settings/application-infos" component={ApplicationInfosPage} exact />
|
|
@@ -78,6 +71,3 @@ function SettingsPage() {
|
|
|
78
71
|
</Layout>
|
|
79
72
|
);
|
|
80
73
|
}
|
|
81
|
-
|
|
82
|
-
export default memo(SettingsPage);
|
|
83
|
-
export { SettingsPage };
|