@strapi/admin 4.6.0-beta.2 → 4.6.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/admin/src/components/ConfigurationsProvider/index.js +21 -18
- package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
- package/admin/src/components/LeftMenu/index.js +53 -50
- package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
- package/admin/src/content-manager/components/Hint/index.js +4 -17
- package/admin/src/content-manager/components/InputUID/index.js +3 -14
- package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
- package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
- package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +3 -8
- package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
- package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
- package/admin/src/content-manager/pages/EditView/{Informations → Information}/index.js +55 -39
- package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
- package/admin/src/content-manager/pages/EditView/index.js +3 -3
- package/admin/src/core/store/configureStore.js +22 -4
- package/admin/src/core/utils/axiosInstance.js +4 -2
- package/admin/src/hooks/useSettingsMenu/init.js +2 -25
- package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
- package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
- package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
- package/admin/src/index.js +3 -3
- package/admin/src/pages/App/index.js +6 -2
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +142 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +5 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
- package/admin/src/permissions/defaultPermissions.js +4 -0
- package/admin/src/translations/en.json +22 -16
- package/build/2607.ce06608e.chunk.js +66 -0
- package/build/{2743.692b1f21.chunk.js → 2743.dea372fb.chunk.js} +14 -14
- package/build/3075.03ebe93d.chunk.js +115 -0
- package/build/3632.963ac97d.chunk.js +138 -0
- package/build/{4318.87affaf2.chunk.js → 4318.8cb388a5.chunk.js} +1 -1
- package/build/4656.a0d43cca.chunk.js +159 -0
- package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
- package/build/{3557.e7115160.chunk.js → 5910.a5374848.chunk.js} +130 -90
- package/build/{8633.6f546066.chunk.js → 8633.4af74a50.chunk.js} +1 -1
- package/build/9641.a311b612.chunk.js +276 -0
- package/build/9707.62831b4d.chunk.js +101 -0
- package/build/Admin-authenticatedApp.50dc27f9.chunk.js +75 -0
- package/build/Admin_homePage.79ab880c.chunk.js +77 -0
- package/build/Admin_marketplace.eabf21b2.chunk.js +26 -0
- package/build/{Admin_pluginsPage.d2a9a619.chunk.js → Admin_pluginsPage.953e796b.chunk.js} +1 -1
- package/build/{Admin_profilePage.5e830ceb.chunk.js → Admin_profilePage.5c2efda5.chunk.js} +1 -1
- package/build/Admin_settingsPage.19cfb9ca.chunk.js +178 -0
- package/build/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
- package/build/admin-app.34295b50.chunk.js +112 -0
- package/build/{admin-edit-roles-page.32bfe5ea.chunk.js → admin-edit-roles-page.d50d9654.chunk.js} +1 -1
- package/build/admin-edit-users.912b856d.chunk.js +10 -0
- package/build/admin-users.e36e7111.chunk.js +11 -0
- package/build/{api-tokens-list-page.a55e427c.chunk.js → api-tokens-list-page.1cd86136.chunk.js} +1 -1
- package/build/audit-logs-settings-page.308a6250.chunk.js +1 -0
- package/build/{content-manager.ad929a94.chunk.js → content-manager.851f40ce.chunk.js} +128 -132
- package/build/content-type-builder-list-view.4243b2b1.chunk.js +198 -0
- package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
- package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
- package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
- package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
- package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
- package/build/content-type-builder.365b6bf4.chunk.js +125 -0
- package/build/email-settings-page.379552b1.chunk.js +15 -0
- package/build/en-json.38d182e5.chunk.js +1 -0
- package/build/i18n-settings-page.3ab28b1a.chunk.js +65 -0
- package/build/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
- package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
- package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
- package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
- package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
- package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
- package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
- package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.9f31732e.js +4454 -0
- package/build/runtime~main.2b8e2318.js +2 -0
- package/build/sso-settings-page.b64a44e8.chunk.js +41 -0
- package/build/upload-settings.6c26ff37.chunk.js +89 -0
- package/build/upload.2c69d238.chunk.js +38 -0
- package/build/users-advanced-settings-page.c4270682.chunk.js +13 -0
- package/build/users-email-settings-page.60422a2f.chunk.js +28 -0
- package/build/users-providers-settings-page.e1834060.chunk.js +104 -0
- package/build/{users-roles-settings-page.ad28ab42.chunk.js → users-roles-settings-page.3ef35132.chunk.js} +1 -1
- package/build/webhook-edit-page.c0080dc1.chunk.js +75 -0
- package/build/webhook-list-page.f75ba3f2.chunk.js +42 -0
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +7 -7
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +3 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
- package/ee/server/bootstrap.js +2 -0
- package/ee/server/routes/index.js +94 -10
- package/ee/server/services/audit-logs.js +19 -1
- package/ee/server/services/passport/sso.js +13 -1
- package/ee/server/services/passport.js +1 -4
- package/package.json +11 -16
- package/server/controllers/admin.js +3 -2
- package/server/register.js +7 -7
- package/server/services/project-settings.js +10 -6
- package/server/services/user.js +3 -1
- package/server/validation/project-settings.js +19 -10
- package/strapi-server.js +1 -1
- package/admin/src/core/store/createReducer.js +0 -5
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/build/2235.746d3cf7.chunk.js +0 -106
- package/build/2598.01c96bd5.chunk.js +0 -159
- package/build/4958.1979bbf5.chunk.js +0 -276
- package/build/5052.c2eacff2.chunk.js +0 -65
- package/build/7295.4e2dfbbb.chunk.js +0 -114
- package/build/805.da20168c.chunk.js +0 -138
- package/build/874.be41e4b3.chunk.js +0 -104
- package/build/9707.a07db355.chunk.js +0 -101
- package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
- package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
- package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
- package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
- package/build/admin-app.8ed108ca.chunk.js +0 -112
- package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
- package/build/admin-edit-users.795f155c.chunk.js +0 -10
- package/build/admin-users.cbd9bcf7.chunk.js +0 -11
- package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
- package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
- package/build/content-type-builder.4edd1c22.chunk.js +0 -127
- package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
- package/build/en-json.d65a13ef.chunk.js +0 -1
- package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
- package/build/main.6bbf9950.js +0 -4417
- package/build/runtime~main.c2bf62af.js +0 -2
- package/build/sso-settings-page.4031de9e.chunk.js +0 -41
- package/build/upload-settings.657790fd.chunk.js +0 -89
- package/build/upload.608a9856.chunk.js +0 -38
- package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
- package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
- package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
- package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
- package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
- package/ee/server/routes/features-routes.js +0 -66
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
import React, { useMemo, useReducer
|
|
1
|
+
import React, { useCallback, useMemo, useReducer } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ConfigurationsContext } from '../../contexts';
|
|
4
4
|
import reducer, { initialState } from './reducer';
|
|
5
5
|
|
|
6
6
|
const ConfigurationsProvider = ({
|
|
7
7
|
children,
|
|
8
|
-
authLogo,
|
|
8
|
+
authLogo: defaultAuthLogo,
|
|
9
9
|
menuLogo: defaultMenuLogo,
|
|
10
10
|
showReleaseNotification,
|
|
11
11
|
showTutorials,
|
|
12
12
|
}) => {
|
|
13
|
-
const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
|
|
13
|
+
const [{ menuLogo, authLogo }, dispatch] = useReducer(reducer, initialState);
|
|
14
14
|
|
|
15
|
-
const updateProjectSettings = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const updateProjectSettings = useCallback(
|
|
16
|
+
({ menuLogo, authLogo }) => {
|
|
17
|
+
return dispatch({
|
|
18
|
+
type: 'UPDATE_PROJECT_SETTINGS',
|
|
19
|
+
values: {
|
|
20
|
+
menuLogo: menuLogo || defaultMenuLogo,
|
|
21
|
+
authLogo: authLogo || defaultAuthLogo,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
[defaultAuthLogo, defaultMenuLogo]
|
|
26
|
+
);
|
|
25
27
|
|
|
26
28
|
const configurationValue = useMemo(() => {
|
|
27
29
|
return {
|
|
28
30
|
logos: {
|
|
29
31
|
menu: { custom: menuLogo, default: defaultMenuLogo },
|
|
30
|
-
auth: { custom:
|
|
32
|
+
auth: { custom: authLogo, default: defaultAuthLogo },
|
|
31
33
|
},
|
|
32
|
-
updateProjectSettings
|
|
34
|
+
updateProjectSettings,
|
|
33
35
|
showReleaseNotification,
|
|
34
36
|
showTutorials,
|
|
35
37
|
};
|
|
36
38
|
}, [
|
|
37
|
-
authLogo,
|
|
38
39
|
menuLogo,
|
|
40
|
+
defaultMenuLogo,
|
|
41
|
+
authLogo,
|
|
42
|
+
defaultAuthLogo,
|
|
43
|
+
updateProjectSettings,
|
|
39
44
|
showReleaseNotification,
|
|
40
45
|
showTutorials,
|
|
41
|
-
updateProjectSettingsRef,
|
|
42
|
-
defaultMenuLogo,
|
|
43
46
|
]);
|
|
44
47
|
|
|
45
48
|
return (
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
NavSection,
|
|
13
13
|
NavUser,
|
|
14
14
|
NavCondense,
|
|
15
|
+
NavFooter,
|
|
15
16
|
} from '@strapi/design-system/v2/MainNav';
|
|
16
17
|
import { FocusTrap } from '@strapi/design-system/FocusTrap';
|
|
17
18
|
import { Box } from '@strapi/design-system/Box';
|
|
@@ -183,57 +184,59 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
183
184
|
) : null}
|
|
184
185
|
</NavSections>
|
|
185
186
|
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{userDisplayName}
|
|
193
|
-
</NavUser>
|
|
194
|
-
{userLinksVisible && (
|
|
195
|
-
<LinkUserWrapper
|
|
196
|
-
onBlur={handleBlur}
|
|
197
|
-
padding={1}
|
|
198
|
-
shadow="tableShadow"
|
|
199
|
-
background="neutral0"
|
|
200
|
-
hasRadius
|
|
187
|
+
<NavFooter>
|
|
188
|
+
<NavUser
|
|
189
|
+
id="main-nav-user-button"
|
|
190
|
+
ref={buttonRef}
|
|
191
|
+
onClick={handleToggleUserLinks}
|
|
192
|
+
initials={initials}
|
|
201
193
|
>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
194
|
+
{userDisplayName}
|
|
195
|
+
</NavUser>
|
|
196
|
+
{userLinksVisible && (
|
|
197
|
+
<LinkUserWrapper
|
|
198
|
+
onBlur={handleBlur}
|
|
199
|
+
padding={1}
|
|
200
|
+
shadow="tableShadow"
|
|
201
|
+
background="neutral0"
|
|
202
|
+
hasRadius
|
|
203
|
+
>
|
|
204
|
+
<FocusTrap onEscape={handleToggleUserLinks}>
|
|
205
|
+
<Stack spacing={0}>
|
|
206
|
+
<LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
|
|
207
|
+
<Typography>
|
|
208
|
+
{formatMessage({
|
|
209
|
+
id: 'global.profile',
|
|
210
|
+
defaultMessage: 'Profile',
|
|
211
|
+
})}
|
|
212
|
+
</Typography>
|
|
213
|
+
</LinkUser>
|
|
214
|
+
<LinkUser tabIndex={0} onClick={handleLogout} logout="logout" to="/auth/login">
|
|
215
|
+
<Typography textColor="danger600">
|
|
216
|
+
{formatMessage({
|
|
217
|
+
id: 'app.components.LeftMenu.logout',
|
|
218
|
+
defaultMessage: 'Logout',
|
|
219
|
+
})}
|
|
220
|
+
</Typography>
|
|
221
|
+
<Exit />
|
|
222
|
+
</LinkUser>
|
|
223
|
+
</Stack>
|
|
224
|
+
</FocusTrap>
|
|
225
|
+
</LinkUserWrapper>
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
<NavCondense onClick={() => setCondensed((s) => !s)}>
|
|
229
|
+
{condensed
|
|
230
|
+
? formatMessage({
|
|
231
|
+
id: 'app.components.LeftMenu.expand',
|
|
232
|
+
defaultMessage: 'Expand the navbar',
|
|
233
|
+
})
|
|
234
|
+
: formatMessage({
|
|
235
|
+
id: 'app.components.LeftMenu.collapse',
|
|
236
|
+
defaultMessage: 'Collapse the navbar',
|
|
237
|
+
})}
|
|
238
|
+
</NavCondense>
|
|
239
|
+
</NavFooter>
|
|
237
240
|
</MainNav>
|
|
238
241
|
);
|
|
239
242
|
};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
3
|
import { Typography } from '@strapi/design-system/Typography';
|
|
5
4
|
|
|
6
|
-
export const Hint = ({ id, error, name,
|
|
7
|
-
|
|
8
|
-
const hint = description
|
|
9
|
-
? formatMessage(
|
|
10
|
-
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
11
|
-
{ ...description.values }
|
|
12
|
-
)
|
|
13
|
-
: '';
|
|
14
|
-
|
|
15
|
-
if (!hint || error) {
|
|
5
|
+
export const Hint = ({ id, error, name, hint }) => {
|
|
6
|
+
if (hint.length === 0 || error) {
|
|
16
7
|
return null;
|
|
17
8
|
}
|
|
18
9
|
|
|
@@ -25,16 +16,12 @@ export const Hint = ({ id, error, name, description }) => {
|
|
|
25
16
|
|
|
26
17
|
Hint.defaultProps = {
|
|
27
18
|
id: undefined,
|
|
28
|
-
description: undefined,
|
|
29
19
|
error: undefined,
|
|
20
|
+
hint: '',
|
|
30
21
|
};
|
|
31
22
|
|
|
32
23
|
Hint.propTypes = {
|
|
33
|
-
|
|
34
|
-
id: PropTypes.string.isRequired,
|
|
35
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
36
|
-
values: PropTypes.object,
|
|
37
|
-
}),
|
|
24
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
38
25
|
error: PropTypes.string,
|
|
39
26
|
id: PropTypes.string,
|
|
40
27
|
name: PropTypes.string.isRequired,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
const InputUID = ({
|
|
24
24
|
attribute,
|
|
25
25
|
contentTypeUID,
|
|
26
|
-
|
|
26
|
+
hint,
|
|
27
27
|
disabled,
|
|
28
28
|
error,
|
|
29
29
|
intlLabel,
|
|
@@ -54,13 +54,6 @@ const InputUID = ({
|
|
|
54
54
|
)
|
|
55
55
|
: name;
|
|
56
56
|
|
|
57
|
-
const hint = description
|
|
58
|
-
? formatMessage(
|
|
59
|
-
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
60
|
-
{ ...description.values }
|
|
61
|
-
)
|
|
62
|
-
: '';
|
|
63
|
-
|
|
64
57
|
const formattedPlaceholder = placeholder
|
|
65
58
|
? formatMessage(
|
|
66
59
|
{ id: placeholder.id, defaultMessage: placeholder.defaultMessage },
|
|
@@ -251,11 +244,6 @@ InputUID.propTypes = {
|
|
|
251
244
|
required: PropTypes.bool,
|
|
252
245
|
}).isRequired,
|
|
253
246
|
contentTypeUID: PropTypes.string.isRequired,
|
|
254
|
-
description: PropTypes.shape({
|
|
255
|
-
id: PropTypes.string.isRequired,
|
|
256
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
257
|
-
values: PropTypes.object,
|
|
258
|
-
}),
|
|
259
247
|
disabled: PropTypes.bool,
|
|
260
248
|
error: PropTypes.string,
|
|
261
249
|
intlLabel: PropTypes.shape({
|
|
@@ -273,16 +261,17 @@ InputUID.propTypes = {
|
|
|
273
261
|
values: PropTypes.object,
|
|
274
262
|
}),
|
|
275
263
|
required: PropTypes.bool,
|
|
264
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
276
265
|
};
|
|
277
266
|
|
|
278
267
|
InputUID.defaultProps = {
|
|
279
|
-
description: undefined,
|
|
280
268
|
disabled: false,
|
|
281
269
|
error: undefined,
|
|
282
270
|
labelAction: undefined,
|
|
283
271
|
placeholder: undefined,
|
|
284
272
|
value: '',
|
|
285
273
|
required: false,
|
|
274
|
+
hint: '',
|
|
286
275
|
};
|
|
287
276
|
|
|
288
277
|
export default InputUID;
|
|
@@ -9,9 +9,8 @@ const Wrapper = styled.div`
|
|
|
9
9
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
|
10
10
|
font-size: ${14 / 16}rem;
|
|
11
11
|
background-color: ${({ theme }) => theme.colors.neutral0};
|
|
12
|
-
z-index: 2;
|
|
13
|
-
cursor: not-allowed;
|
|
14
12
|
color: ${({ theme }) => theme.colors.neutral800};
|
|
13
|
+
line-height: ${({ theme }) => theme.lineHeights[6]};
|
|
15
14
|
|
|
16
15
|
h1,
|
|
17
16
|
h2,
|
|
@@ -19,12 +18,12 @@ const Wrapper = styled.div`
|
|
|
19
18
|
h4,
|
|
20
19
|
h5,
|
|
21
20
|
h6 {
|
|
22
|
-
margin-block-start:
|
|
23
|
-
margin-block-end:
|
|
21
|
+
margin-block-start: ${({ theme }) => theme.spaces[2]};
|
|
22
|
+
margin-block-end: ${({ theme }) => theme.spaces[2]};
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
p {
|
|
27
|
-
margin-bottom:
|
|
26
|
+
margin-bottom: ${({ theme }) => theme.spaces[2]};
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
h1 {
|
|
@@ -56,13 +55,13 @@ const Wrapper = styled.div`
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
blockquote {
|
|
59
|
-
margin-top:
|
|
60
|
-
margin-bottom:
|
|
58
|
+
margin-top: ${({ theme }) => theme.spaces[8]};
|
|
59
|
+
margin-bottom: ${({ theme }) => theme.spaces[7]};
|
|
61
60
|
font-size: ${14 / 16}rem;
|
|
62
61
|
font-weight: 400;
|
|
63
|
-
border-left:
|
|
62
|
+
border-left: 4px solid ${({ theme }) => theme.colors.neutral150};
|
|
64
63
|
font-style: italic;
|
|
65
|
-
padding:
|
|
64
|
+
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
img {
|
|
@@ -91,9 +90,18 @@ const Wrapper = styled.div`
|
|
|
91
90
|
|
|
92
91
|
pre,
|
|
93
92
|
code {
|
|
94
|
-
font-size:
|
|
95
|
-
border-radius:
|
|
96
|
-
|
|
93
|
+
font-size: ${14 / 16}rem;
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
/*
|
|
96
|
+
Hard coded since the color is the same between themes,
|
|
97
|
+
theme.colors.neutral800 changes between themes.
|
|
98
|
+
|
|
99
|
+
Matches the color of the JSON Input component.
|
|
100
|
+
*/
|
|
101
|
+
background-color: #32324d;
|
|
102
|
+
max-width: 100%;
|
|
103
|
+
overflow: auto;
|
|
104
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
/* Inline code */
|
|
@@ -105,21 +113,6 @@ const Wrapper = styled.div`
|
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
.warning {
|
|
109
|
-
background-color: #faa684;
|
|
110
|
-
padding: 30px;
|
|
111
|
-
border-radius: 3px;
|
|
112
|
-
}
|
|
113
|
-
.tip {
|
|
114
|
-
padding: 30px;
|
|
115
|
-
border-radius: 3px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.footnote-ref,
|
|
119
|
-
.footnote-backref {
|
|
120
|
-
color: #007bff;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
116
|
ol {
|
|
124
117
|
list-style-type: decimal;
|
|
125
118
|
margin-block-start: ${({ theme }) => theme.spaces[4]};
|
|
@@ -127,6 +120,7 @@ const Wrapper = styled.div`
|
|
|
127
120
|
margin-inline-start: 0px;
|
|
128
121
|
margin-inline-end: 0px;
|
|
129
122
|
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
123
|
+
|
|
130
124
|
ol,
|
|
131
125
|
ul {
|
|
132
126
|
margin-block-start: 0px;
|
|
@@ -141,6 +135,7 @@ const Wrapper = styled.div`
|
|
|
141
135
|
margin-inline-start: 0px;
|
|
142
136
|
margin-inline-end: 0px;
|
|
143
137
|
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
138
|
+
|
|
144
139
|
ul,
|
|
145
140
|
ol {
|
|
146
141
|
margin-block-start: 0px;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
|
-
import { Flex } from '@strapi/design-system
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { BaseButton } from '@strapi/design-system/BaseButton';
|
|
9
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
10
|
-
import { pxToRem } from '@strapi/helper-plugin';
|
|
11
|
-
import Collapse from '@strapi/icons/Collapse';
|
|
12
|
-
import { useIntl } from 'react-intl';
|
|
5
|
+
import { BaseButton, Box, Flex, FocusTrap, Portal, Typography } from '@strapi/design-system';
|
|
6
|
+
import { Collapse } from '@strapi/icons';
|
|
7
|
+
import { pxToRem, useLockScroll } from '@strapi/helper-plugin';
|
|
8
|
+
|
|
13
9
|
import PreviewWysiwyg from '../PreviewWysiwyg';
|
|
14
10
|
|
|
15
11
|
const setOpacity = (hex, alpha) =>
|
|
@@ -32,6 +28,7 @@ export const ExpandButton = styled(BaseButton)`
|
|
|
32
28
|
|
|
33
29
|
svg {
|
|
34
30
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
|
31
|
+
|
|
35
32
|
path {
|
|
36
33
|
fill: ${({ theme }) => theme.colors.neutral700};
|
|
37
34
|
width: ${12 / 16}rem;
|
|
@@ -42,19 +39,8 @@ export const ExpandButton = styled(BaseButton)`
|
|
|
42
39
|
|
|
43
40
|
export const EditorLayout = ({ children, isExpandMode, error, previewContent, onCollapse }) => {
|
|
44
41
|
const { formatMessage } = useIntl();
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
const body = document.body;
|
|
47
|
-
|
|
48
|
-
if (isExpandMode) {
|
|
49
|
-
body.classList.add('lock-body-scroll');
|
|
50
|
-
}
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
if (isExpandMode) {
|
|
54
|
-
body.classList.remove('lock-body-scroll');
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}, [isExpandMode]);
|
|
43
|
+
useLockScroll(isExpandMode);
|
|
58
44
|
|
|
59
45
|
if (isExpandMode) {
|
|
60
46
|
return (
|
|
@@ -71,7 +57,6 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
71
57
|
onClick={onCollapse}
|
|
72
58
|
>
|
|
73
59
|
<Box
|
|
74
|
-
id="wysiwyg-expand"
|
|
75
60
|
background="neutral0"
|
|
76
61
|
hasRadius
|
|
77
62
|
shadow="popupShadow"
|
|
@@ -84,9 +69,15 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
84
69
|
<BoxWithBorder flex="1" height="100%">
|
|
85
70
|
{children}
|
|
86
71
|
</BoxWithBorder>
|
|
87
|
-
<
|
|
88
|
-
<Flex
|
|
89
|
-
|
|
72
|
+
<Flex alignItems="start" direction="column" flex={1} height="100%" width="100%">
|
|
73
|
+
<Flex
|
|
74
|
+
height={pxToRem(48)}
|
|
75
|
+
background="neutral100"
|
|
76
|
+
justifyContent="flex-end"
|
|
77
|
+
shrink={0}
|
|
78
|
+
width="100%"
|
|
79
|
+
>
|
|
80
|
+
<ExpandButton onClick={onCollapse}>
|
|
90
81
|
<Typography>
|
|
91
82
|
{formatMessage({
|
|
92
83
|
id: 'components.Wysiwyg.collapse',
|
|
@@ -97,10 +88,10 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
97
88
|
</ExpandButton>
|
|
98
89
|
</Flex>
|
|
99
90
|
|
|
100
|
-
<Box position="relative" height="100%">
|
|
91
|
+
<Box position="relative" height="100%" width="100%">
|
|
101
92
|
<PreviewWysiwyg data={previewContent} />
|
|
102
93
|
</Box>
|
|
103
|
-
</
|
|
94
|
+
</Flex>
|
|
104
95
|
</Flex>
|
|
105
96
|
</Box>
|
|
106
97
|
</ExpandWrapper>
|
|
@@ -31,7 +31,7 @@ const TypographyAsterisk = styled(Typography)`
|
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
33
|
const Wysiwyg = ({
|
|
34
|
-
|
|
34
|
+
hint,
|
|
35
35
|
disabled,
|
|
36
36
|
error,
|
|
37
37
|
intlLabel,
|
|
@@ -167,7 +167,7 @@ const Wysiwyg = ({
|
|
|
167
167
|
|
|
168
168
|
{!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
|
|
169
169
|
</EditorLayout>
|
|
170
|
-
<Hint
|
|
170
|
+
<Hint hint={hint} name={name} error={error} />
|
|
171
171
|
</Stack>
|
|
172
172
|
|
|
173
173
|
{error && (
|
|
@@ -186,21 +186,17 @@ const Wysiwyg = ({
|
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
Wysiwyg.defaultProps = {
|
|
189
|
-
description: null,
|
|
190
189
|
disabled: false,
|
|
191
190
|
error: '',
|
|
192
191
|
labelAction: undefined,
|
|
193
192
|
placeholder: null,
|
|
194
193
|
required: false,
|
|
195
194
|
value: '',
|
|
195
|
+
hint: '',
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
Wysiwyg.propTypes = {
|
|
199
|
-
|
|
200
|
-
id: PropTypes.string.isRequired,
|
|
201
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
202
|
-
values: PropTypes.object,
|
|
203
|
-
}),
|
|
199
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
204
200
|
disabled: PropTypes.bool,
|
|
205
201
|
error: PropTypes.string,
|
|
206
202
|
intlLabel: PropTypes.shape({
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
import React, { useMemo, useState } from 'react';
|
|
8
8
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
9
9
|
import { useIntl } from 'react-intl';
|
|
10
|
-
import matchSorter from 'match-sorter';
|
|
11
|
-
import sortBy from 'lodash/sortBy';
|
|
12
|
-
import toLower from 'lodash/toLower';
|
|
13
10
|
import { NavLink } from 'react-router-dom';
|
|
11
|
+
|
|
14
12
|
import {
|
|
15
13
|
SubNav,
|
|
16
14
|
SubNavHeader,
|
|
@@ -18,14 +16,11 @@ import {
|
|
|
18
16
|
SubNavSections,
|
|
19
17
|
SubNavLink,
|
|
20
18
|
} from '@strapi/design-system/v2/SubNav';
|
|
19
|
+
|
|
20
|
+
import { matchByTitle } from './utils';
|
|
21
21
|
import getTrad from '../../../utils/getTrad';
|
|
22
22
|
import { makeSelectModelLinks } from '../selectors';
|
|
23
23
|
|
|
24
|
-
const matchByTitle = (links, search) =>
|
|
25
|
-
search
|
|
26
|
-
? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] })
|
|
27
|
-
: sortBy(links, (object) => object.title.toLowerCase());
|
|
28
|
-
|
|
29
24
|
const LeftMenu = () => {
|
|
30
25
|
const [search, setSearch] = useState('');
|
|
31
26
|
const { formatMessage } = useIntl();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as matchByTitle } from './matchByTitle';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import matchSorter from 'match-sorter';
|
|
2
|
+
import camelCase from 'lodash/camelCase';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @type {(links: array, search? : string) => array }
|
|
6
|
+
*/
|
|
7
|
+
const matchByTitle = (links, search) =>
|
|
8
|
+
search
|
|
9
|
+
? matchSorter(links, search.toLowerCase(), { keys: [(item) => item.title.toLowerCase()] })
|
|
10
|
+
: links.sort((link, nextLink) => {
|
|
11
|
+
const title = camelCase(link.title);
|
|
12
|
+
const nextTitle = camelCase(nextLink.title);
|
|
13
|
+
|
|
14
|
+
if (title < nextTitle) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
if (title > nextTitle) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return 0;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default matchByTitle;
|