@strapi/admin 4.14.5 → 4.15.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/StrapiApp.js +13 -12
- package/admin/src/components/AuthenticatedApp.tsx +187 -0
- package/admin/src/components/ConfigurationProvider.tsx +2 -1
- package/admin/src/components/GuidedTour/Homepage.tsx +111 -0
- package/admin/src/components/GuidedTour/Modal.tsx +303 -0
- package/admin/src/components/GuidedTour/Ornaments.tsx +74 -0
- package/admin/src/components/GuidedTour/Provider.tsx +253 -0
- package/admin/src/components/GuidedTour/{layout.js → constants.ts} +13 -3
- package/admin/src/components/LanguageProvider.tsx +1 -0
- package/admin/src/components/Providers.tsx +125 -0
- package/admin/src/components/RBACProvider.tsx +124 -0
- package/admin/src/components/Theme.tsx +4 -2
- package/admin/src/components/ThemeToggleProvider.tsx +23 -9
- package/admin/src/components/__mocks__/{LanguageProvider.js → LanguageProvider.ts} +2 -0
- package/admin/src/{constants.js → constants.ts} +48 -0
- package/admin/src/content-manager/components/BlocksEditor/Toolbar/index.js +75 -51
- package/admin/src/content-manager/components/BlocksEditor/hooks/useBlocksStore.js +72 -14
- package/admin/src/content-manager/pages/App/selectors.js +1 -1
- package/admin/src/content-manager/pages/App/useContentManagerInitData.js +3 -1
- package/admin/src/content-manager/pages/EditView/selectors.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/index.js +3 -1
- package/admin/src/content-manager/pages/ListView/components/Body/index.js +53 -56
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +5 -3
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +33 -50
- package/admin/src/content-manager/pages/ListView/selectors.js +1 -1
- package/admin/src/contexts/admin.ts +1 -0
- package/admin/src/contexts/apiTokenPermissions.tsx +64 -0
- package/admin/src/contexts/themeToggle.ts +3 -1
- package/admin/src/core/store/configure.ts +91 -0
- package/admin/src/core/store/hooks.ts +15 -0
- package/admin/src/hooks/index.js +0 -1
- package/admin/src/hooks/{useContentTypes/useContentTypes.js → useContentTypes.ts} +39 -16
- package/admin/src/hooks/useSettingsForm/index.js +14 -2
- package/admin/src/hooks/useSettingsMenu/constants.js +39 -0
- package/admin/src/index.js +2 -4
- package/admin/src/layouts/{AppLayout/index.js → AppLayout.tsx} +7 -10
- package/admin/src/layouts/UnauthenticatedLayout.tsx +77 -0
- package/admin/src/pages/Admin/index.js +11 -5
- package/admin/src/pages/App/index.js +7 -4
- package/admin/src/pages/App/selectors.js +1 -1
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +2 -1
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +2 -1
- package/admin/src/pages/AuthPage/components/Login/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Oops/index.js +2 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +2 -1
- package/admin/src/pages/AuthPage/index.js +2 -3
- package/admin/src/pages/HomePage/index.js +6 -3
- package/admin/src/pages/{InternalErrorPage/index.js → InternalErrorPage.tsx} +10 -6
- package/admin/src/pages/{NotFoundPage/index.js → NotFoundPage.tsx} +9 -7
- package/admin/src/pages/ProfilePage/components/Preferences/index.js +23 -9
- package/admin/src/pages/ProfilePage/index.js +1 -1
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +20 -0
- package/admin/src/pages/SettingsPage/constants.js +33 -0
- package/admin/src/pages/SettingsPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ActionBoundRoutes/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Permissions/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/AuditLogs/SalesPage.js +50 -0
- package/admin/src/pages/SettingsPage/pages/ReviewWorkflows/SalesPage.js +53 -0
- package/admin/src/pages/SettingsPage/pages/SingleSignOn/SalesPage.js +53 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/{UseCasePage/index.js → UseCasePage.tsx} +10 -12
- package/admin/src/translations/en.json +5 -0
- package/admin/src/utils/createRoute.tsx +54 -0
- package/admin/src/utils/formatAPIErrors.ts +18 -0
- package/admin/src/utils/getFullName.ts +3 -0
- package/admin/src/utils/{uniqueAdminHash.js → hashAdminUserEmail.ts} +6 -3
- package/admin/src/utils/makeUniqueRoutes.ts +11 -0
- package/build/{1049.9236e785.chunk.js → 1049.ecc10c97.chunk.js} +1 -1
- package/build/1217.96155682.chunk.js +35 -0
- package/build/{1227.e0f7447b.chunk.js → 1227.947ceaf9.chunk.js} +1 -1
- package/build/1306.2699df52.chunk.js +79 -0
- package/build/{1386.07f2bbb3.chunk.js → 1386.eabd8a1e.chunk.js} +1 -1
- package/build/{2379.b0bc4013.chunk.js → 2379.7ce8e110.chunk.js} +1 -1
- package/build/{2395.d37b1025.chunk.js → 2395.acb961a8.chunk.js} +3 -3
- package/build/{2801.12522720.chunk.js → 2801.4711ea5a.chunk.js} +1 -1
- package/build/{3019.0d74d080.chunk.js → 3019.fde2e1be.chunk.js} +2 -2
- package/build/3460.8644e608.chunk.js +146 -0
- package/build/{3483.8f1b25f8.chunk.js → 3483.db8c1520.chunk.js} +1 -1
- package/build/{4174.2c4f958e.chunk.js → 4174.49cedb6a.chunk.js} +1 -1
- package/build/4732.149f5f8f.chunk.js +1 -0
- package/build/{502.b845473a.chunk.js → 502.f536f78b.chunk.js} +1 -1
- package/build/{7464.91341b4f.chunk.js → 7464.579564ac.chunk.js} +1 -1
- package/build/7811.fdbe09af.chunk.js +103 -0
- package/build/{7897.dffa5ad5.chunk.js → 7897.63ba0a00.chunk.js} +1 -1
- package/build/{8276.e9698944.chunk.js → 8276.9abe4679.chunk.js} +3 -3
- package/build/8773.ee67141c.chunk.js +48 -0
- package/build/9077.2cc01ac8.chunk.js +105 -0
- package/build/{9218.306ad178.chunk.js → 9218.b2d367f8.chunk.js} +1 -1
- package/build/Admin-authenticatedApp.059dc48f.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.06eeef20.chunk.js +1 -0
- package/build/Admin_homePage.56b9eb3f.chunk.js +81 -0
- package/build/{Admin_marketplace.0db78604.chunk.js → Admin_marketplace.d693a435.chunk.js} +1 -1
- package/build/{Admin_pluginsPage.1083f7f0.chunk.js → Admin_pluginsPage.ae2c872a.chunk.js} +1 -1
- package/build/Admin_profilePage.89099d5b.chunk.js +13 -0
- package/build/Admin_settingsPage.88c45586.chunk.js +12 -0
- package/build/{Upload_ConfigureTheView.3cfeb108.chunk.js → Upload_ConfigureTheView.44f28145.chunk.js} +1 -1
- package/build/admin-app.990e112f.chunk.js +69 -0
- package/build/{admin-edit-roles-page.556fac52.chunk.js → admin-edit-roles-page.4e1eb4a9.chunk.js} +3 -3
- package/build/admin-edit-users.5b91404e.chunk.js +10 -0
- package/build/{admin-roles-list.15918328.chunk.js → admin-roles-list.89dd94fe.chunk.js} +1 -1
- package/build/{admin-users.74fddc87.chunk.js → admin-users.7be4fc5f.chunk.js} +2 -2
- package/build/{api-tokens-create-page.c08ae118.chunk.js → api-tokens-create-page.571920e5.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.ce18efdc.chunk.js → api-tokens-edit-page.cbdc81b1.chunk.js} +1 -1
- package/build/{api-tokens-list-page.783b7569.chunk.js → api-tokens-list-page.de0c49e8.chunk.js} +2 -2
- package/build/audit-logs-sales-page.2955db88.chunk.js +1 -0
- package/build/{audit-logs-settings-page.12aeea8c.chunk.js → audit-logs-settings-page.b0cb5164.chunk.js} +1 -1
- package/build/content-manager.de7ae330.chunk.js +1241 -0
- package/build/{content-type-builder-list-view.38ed3935.chunk.js → content-type-builder-list-view.6c8d3213.chunk.js} +1 -1
- package/build/{content-type-builder-translation-en-json.43f9d7bc.chunk.js → content-type-builder-translation-en-json.74d80f18.chunk.js} +1 -1
- package/build/{content-type-builder.758a9d23.chunk.js → content-type-builder.0bc97051.chunk.js} +13 -23
- package/build/{email-settings-page.e08a587e.chunk.js → email-settings-page.07712efc.chunk.js} +1 -1
- package/build/en-json.5b907f67.chunk.js +1 -0
- package/build/{i18n-settings-page.3186e3e9.chunk.js → i18n-settings-page.5c34f012.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.f84563f1.js +2665 -0
- package/build/review-workflows-sales-page.f46a8f00.chunk.js +1 -0
- package/build/{review-workflows-settings-create-view.5cdc4d64.chunk.js → review-workflows-settings-create-view.d0544fb0.chunk.js} +1 -1
- package/build/{review-workflows-settings-edit-view.53bf7865.chunk.js → review-workflows-settings-edit-view.aabf49ef.chunk.js} +1 -1
- package/build/review-workflows-settings-list-view.8b0525ab.chunk.js +56 -0
- package/build/runtime~main.270fd45f.js +2 -0
- package/build/sso-sales-page.ef22e469.chunk.js +1 -0
- package/build/sso-settings-page.21e16ae4.chunk.js +1 -0
- package/build/{transfer-tokens-create-page.2662d519.chunk.js → transfer-tokens-create-page.3366204d.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.f64d8d8c.chunk.js → transfer-tokens-edit-page.15cf0f73.chunk.js} +1 -1
- package/build/{transfer-tokens-list-page.e6fd5f87.chunk.js → transfer-tokens-list-page.0bc0e682.chunk.js} +2 -2
- package/build/{upload-settings.450a1de0.chunk.js → upload-settings.1319dca0.chunk.js} +1 -1
- package/build/{upload.0d53e7a3.chunk.js → upload.1ced11be.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.4a1f1f6d.chunk.js → users-advanced-settings-page.8e657084.chunk.js} +1 -1
- package/build/{users-email-settings-page.ea81fe82.chunk.js → users-email-settings-page.e57745e5.chunk.js} +1 -1
- package/build/{users-providers-settings-page.10280cdb.chunk.js → users-providers-settings-page.55796d13.chunk.js} +1 -1
- package/build/{users-roles-settings-page.4a7158be.chunk.js → users-roles-settings-page.57079245.chunk.js} +1 -1
- package/build/webhook-edit-page.3a28b2e7.chunk.js +33 -0
- package/build/{webhook-list-page.f57285ca.chunk.js → webhook-list-page.ee80767b.chunk.js} +1 -1
- package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/index.js +2 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/selectors.js +1 -1
- package/ee/server/bootstrap.js +1 -1
- package/ee/server/controllers/admin.js +1 -1
- package/ee/server/controllers/user.js +1 -1
- package/ee/server/destroy.js +1 -1
- package/ee/server/register.js +1 -1
- package/ee/server/routes/utils.js +1 -1
- package/ee/server/services/audit-logs.js +1 -1
- package/ee/server/services/passport/sso.js +1 -1
- package/ee/server/services/passport.js +1 -1
- package/ee/server/services/seat-enforcement.js +1 -1
- package/ee/server/utils/sso-lock.js +1 -1
- package/ee/server/validation/role.js +1 -1
- package/ee/server/validation/user.js +1 -1
- package/package.json +15 -16
- package/server/controllers/admin.js +1 -1
- package/shared/entities.ts +1 -1
- package/shared/permissions.ts +35 -35
- package/shared/schema.ts +9 -0
- package/admin/src/components/AuthenticatedApp/index.js +0 -116
- package/admin/src/components/AuthenticatedApp/utils/api.js +0 -47
- package/admin/src/components/AuthenticatedApp/utils/checkLatestStrapiVersion.ts +0 -13
- package/admin/src/components/AuthenticatedApp/utils/fetchStrapiLatestRelease.ts +0 -19
- package/admin/src/components/GuidedTour/Homepage/components/Step.js +0 -61
- package/admin/src/components/GuidedTour/Homepage/components/Stepper.js +0 -61
- package/admin/src/components/GuidedTour/Homepage/index.js +0 -71
- package/admin/src/components/GuidedTour/Modal/components/Content.js +0 -66
- package/admin/src/components/GuidedTour/Modal/components/Modal.js +0 -72
- package/admin/src/components/GuidedTour/Modal/components/StepNumberWithPadding.js +0 -26
- package/admin/src/components/GuidedTour/Modal/components/Stepper.js +0 -118
- package/admin/src/components/GuidedTour/Modal/index.js +0 -94
- package/admin/src/components/GuidedTour/Modal/reducer.js +0 -29
- package/admin/src/components/GuidedTour/Stepper/StepLine.js +0 -29
- package/admin/src/components/GuidedTour/Stepper/StepNumber.js +0 -71
- package/admin/src/components/GuidedTour/constants.js +0 -3
- package/admin/src/components/GuidedTour/index.js +0 -102
- package/admin/src/components/GuidedTour/init.js +0 -37
- package/admin/src/components/GuidedTour/reducer.js +0 -50
- package/admin/src/components/GuidedTour/utils/arePreviousSectionsDone.js +0 -13
- package/admin/src/components/GuidedTour/utils/arePreviousStepsDone.js +0 -12
- package/admin/src/components/GuidedTour/utils/isGuidedTourCompleted.js +0 -6
- package/admin/src/components/GuidedTour/utils/persistStateToLocaleStorage.js +0 -34
- package/admin/src/components/Providers/index.js +0 -156
- package/admin/src/components/RBACProvider/actions.js +0 -10
- package/admin/src/components/RBACProvider/constants.js +0 -2
- package/admin/src/components/RBACProvider/index.js +0 -39
- package/admin/src/components/RBACProvider/reducer.js +0 -51
- package/admin/src/contexts/ApiTokenPermissions/index.js +0 -25
- package/admin/src/core/store/configureStore.js +0 -47
- package/admin/src/exposedHooks.js +0 -27
- package/admin/src/hooks/useContentTypes/index.js +0 -1
- package/admin/src/injectionZones.js +0 -25
- package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +0 -29
- package/admin/src/layouts/UnauthenticatedLayout/index.js +0 -55
- package/admin/src/reducers.js +0 -23
- package/admin/src/utils/checkFormValidity.js +0 -15
- package/admin/src/utils/createRoute.js +0 -50
- package/admin/src/utils/formatAPIErrors.js +0 -17
- package/admin/src/utils/getAttributesToDisplay.js +0 -19
- package/admin/src/utils/getExistingActions.js +0 -32
- package/admin/src/utils/getFullName.js +0 -9
- package/admin/src/utils/index.js +0 -9
- package/admin/src/utils/makeUniqueRoutes.js +0 -6
- package/admin/src/utils/sortLinks.js +0 -5
- package/build/1222.fe92c653.chunk.js +0 -35
- package/build/2225.a2147b8f.chunk.js +0 -79
- package/build/3021.33ad47fb.chunk.js +0 -103
- package/build/6373.1a21d665.chunk.js +0 -105
- package/build/8894.5ca4852a.chunk.js +0 -26
- package/build/9302.550cf5b7.chunk.js +0 -146
- package/build/Admin-authenticatedApp.e897fccb.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.e2431a95.chunk.js +0 -1
- package/build/Admin_homePage.71ef8d06.chunk.js +0 -81
- package/build/Admin_profilePage.61704b7d.chunk.js +0 -13
- package/build/Admin_settingsPage.39cb9fca.chunk.js +0 -111
- package/build/admin-app.06f5e70a.chunk.js +0 -69
- package/build/admin-edit-users.64fd1318.chunk.js +0 -10
- package/build/content-manager.2e3f660b.chunk.js +0 -1220
- package/build/en-json.bd611a8e.chunk.js +0 -1
- package/build/main.00ea6f5a.js +0 -2665
- package/build/review-workflows-settings-list-view.b4a8aefb.chunk.js +0 -56
- package/build/runtime~main.e3bf3980.js +0 -2
- package/build/sso-settings-page.6a35d473.chunk.js +0 -1
- package/build/webhook-edit-page.65ac30ee.chunk.js +0 -33
- /package/admin/src/hooks/{useContentTypes/__mocks__/index.js → __mocks__/useContentTypes.ts} +0 -0
|
@@ -88,3 +88,51 @@ export const ADMIN_PERMISSIONS_CE = {
|
|
|
88
88
|
},
|
|
89
89
|
},
|
|
90
90
|
};
|
|
91
|
+
|
|
92
|
+
export const HOOKS = {
|
|
93
|
+
/**
|
|
94
|
+
* Hook that allows to mutate the displayed headers of the list view table
|
|
95
|
+
* @constant
|
|
96
|
+
* @type {string}
|
|
97
|
+
*/
|
|
98
|
+
INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Hook that allows to mutate the CM's collection types links pre-set filters
|
|
102
|
+
* @constant
|
|
103
|
+
* @type {string}
|
|
104
|
+
*/
|
|
105
|
+
MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Hook that allows to mutate the CM's edit view layout
|
|
109
|
+
* @constant
|
|
110
|
+
* @type {string}
|
|
111
|
+
*/
|
|
112
|
+
MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Hook that allows to mutate the CM's single types links pre-set filters
|
|
116
|
+
* @constant
|
|
117
|
+
* @type {string}
|
|
118
|
+
*/
|
|
119
|
+
MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const INJECTION_ZONES = {
|
|
123
|
+
admin: {
|
|
124
|
+
// Temporary injection zone, support for the react-tour plugin in foodadvisor
|
|
125
|
+
tutorials: {
|
|
126
|
+
links: [],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
contentManager: {
|
|
130
|
+
editView: { informations: [], 'right-links': [] },
|
|
131
|
+
listView: {
|
|
132
|
+
actions: [],
|
|
133
|
+
deleteModalAdditionalInfos: [],
|
|
134
|
+
publishModalAdditionalInfos: [],
|
|
135
|
+
unpublishModalAdditionalInfos: [],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import * as Toolbar from '@radix-ui/react-toolbar';
|
|
4
|
-
import { Flex, Icon, Tooltip,
|
|
4
|
+
import { Flex, Icon, Tooltip, SingleSelect, SingleSelectOption, Box } from '@strapi/design-system';
|
|
5
5
|
import { pxToRem, prefixFileUrlWithBackendUrl, useLibrary } from '@strapi/helper-plugin';
|
|
6
6
|
import { Link } from '@strapi/icons';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -42,6 +42,29 @@ const FlexButton = styled(Flex).attrs({ as: 'button' })`
|
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
|
+
const SelectWrapper = styled(Box)`
|
|
46
|
+
// Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect
|
|
47
|
+
div[role='combobox'] {
|
|
48
|
+
border: none;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
&[aria-disabled='false']:hover {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
background: ${({ theme }) => theme.colors.primary100};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[aria-disabled] {
|
|
57
|
+
background: transparent;
|
|
58
|
+
cursor: inherit;
|
|
59
|
+
|
|
60
|
+
// Select text and icons should also have disabled color
|
|
61
|
+
span {
|
|
62
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
45
68
|
const ToolbarButton = ({ icon, name, label, isActive, disabled, handleClick }) => {
|
|
46
69
|
const editor = useSlate();
|
|
47
70
|
const { formatMessage } = useIntl();
|
|
@@ -152,8 +175,6 @@ const toggleBlock = (editor, value) => {
|
|
|
152
175
|
ReactEditor.focus(editor);
|
|
153
176
|
};
|
|
154
177
|
|
|
155
|
-
const ALLOWED_MEDIA_TYPE = 'images';
|
|
156
|
-
|
|
157
178
|
const IMAGE_SCHEMA_FIELDS = [
|
|
158
179
|
'name',
|
|
159
180
|
'alternativeText',
|
|
@@ -189,12 +210,30 @@ const ImageDialog = ({ handleClose }) => {
|
|
|
189
210
|
const MediaLibraryDialog = components['media-library'];
|
|
190
211
|
|
|
191
212
|
const insertImages = (images) => {
|
|
192
|
-
//
|
|
213
|
+
// If the selection is inside a list, split the list so that the modified block is outside of it
|
|
214
|
+
Transforms.unwrapNodes(editor, {
|
|
215
|
+
match: (node) => node.type === 'list',
|
|
216
|
+
split: true,
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Save the path of the node that is being replaced by an image to insert the images there later
|
|
220
|
+
// It's the closest full block node above the selection
|
|
221
|
+
const [, pathToInsert] = Editor.above(editor, {
|
|
222
|
+
match(node) {
|
|
223
|
+
const isInlineNode = ['text', 'link'].includes(node.type);
|
|
224
|
+
|
|
225
|
+
return !isInlineNode;
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Remove the previous node that is being replaced by an image
|
|
193
230
|
Transforms.removeNodes(editor);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
231
|
+
|
|
232
|
+
// Convert images to nodes and insert them
|
|
233
|
+
const nodesToInsert = images.map((image) => {
|
|
234
|
+
return { type: 'image', image, children: [{ type: 'text', text: '' }] };
|
|
197
235
|
});
|
|
236
|
+
Transforms.insertNodes(editor, nodesToInsert, { at: pathToInsert });
|
|
198
237
|
};
|
|
199
238
|
|
|
200
239
|
const handleSelectAssets = (images) => {
|
|
@@ -221,7 +260,7 @@ const ImageDialog = ({ handleClose }) => {
|
|
|
221
260
|
|
|
222
261
|
return (
|
|
223
262
|
<MediaLibraryDialog
|
|
224
|
-
allowedTypes={[
|
|
263
|
+
allowedTypes={['images']}
|
|
225
264
|
onClose={handleClose}
|
|
226
265
|
onSelectAssets={handleSelectAssets}
|
|
227
266
|
/>
|
|
@@ -340,28 +379,30 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
340
379
|
|
|
341
380
|
return (
|
|
342
381
|
<>
|
|
343
|
-
<
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
382
|
+
<SelectWrapper>
|
|
383
|
+
<SingleSelect
|
|
384
|
+
startIcon={<Icon as={blocks[blockSelected].icon} />}
|
|
385
|
+
onChange={selectOption}
|
|
386
|
+
placeholder={blocks[blockSelected].label}
|
|
387
|
+
value={blockSelected}
|
|
388
|
+
onCloseAutoFocus={preventSelectFocus}
|
|
389
|
+
aria-label={formatMessage({
|
|
390
|
+
id: 'components.Blocks.blocks.selectBlock',
|
|
391
|
+
defaultMessage: 'Select a block',
|
|
392
|
+
})}
|
|
393
|
+
disabled={disabled}
|
|
394
|
+
>
|
|
395
|
+
{blockKeysToInclude.map((key) => (
|
|
396
|
+
<BlockOption
|
|
397
|
+
key={key}
|
|
398
|
+
value={key}
|
|
399
|
+
label={blocks[key].label}
|
|
400
|
+
icon={blocks[key].icon}
|
|
401
|
+
blockSelected={blockSelected}
|
|
402
|
+
/>
|
|
403
|
+
))}
|
|
404
|
+
</SingleSelect>
|
|
405
|
+
</SelectWrapper>
|
|
365
406
|
{isMediaLibraryVisible && <ImageDialog handleClose={() => setIsMediaLibraryVisible(false)} />}
|
|
366
407
|
</>
|
|
367
408
|
);
|
|
@@ -377,12 +418,12 @@ const BlockOption = ({ value, icon, label, blockSelected }) => {
|
|
|
377
418
|
const isSelected = value === blockSelected;
|
|
378
419
|
|
|
379
420
|
return (
|
|
380
|
-
<
|
|
421
|
+
<SingleSelectOption
|
|
381
422
|
startIcon={<Icon as={icon} color={isSelected ? 'primary600' : 'neutral600'} />}
|
|
382
423
|
value={value}
|
|
383
424
|
>
|
|
384
425
|
{formatMessage(label)}
|
|
385
|
-
</
|
|
426
|
+
</SingleSelectOption>
|
|
386
427
|
);
|
|
387
428
|
};
|
|
388
429
|
|
|
@@ -583,15 +624,6 @@ LinkButton.propTypes = {
|
|
|
583
624
|
disabled: PropTypes.bool.isRequired,
|
|
584
625
|
};
|
|
585
626
|
|
|
586
|
-
// TODO: Remove after the RTE Blocks Beta release
|
|
587
|
-
const BetaTag = styled(Box)`
|
|
588
|
-
background-color: ${({ theme }) => theme.colors.secondary100};
|
|
589
|
-
border: ${({ theme }) => `1px solid ${theme.colors.secondary200}`};
|
|
590
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
591
|
-
font-size: ${({ theme }) => theme.fontSizes[0]};
|
|
592
|
-
padding: ${({ theme }) => `${2 / 16}rem ${theme.spaces[1]}`};
|
|
593
|
-
`;
|
|
594
|
-
|
|
595
627
|
const BlocksToolbar = ({ disabled }) => {
|
|
596
628
|
const modifiers = useModifiersStore();
|
|
597
629
|
const blocks = useBlocksStore();
|
|
@@ -624,9 +656,9 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
624
656
|
|
|
625
657
|
return (
|
|
626
658
|
<Toolbar.Root aria-disabled={disabled} asChild>
|
|
627
|
-
{
|
|
628
|
-
<ToolbarWrapper gap={2} padding={2} paddingRight={4} width="100%">
|
|
659
|
+
<ToolbarWrapper gap={2} padding={2}>
|
|
629
660
|
<BlocksDropdown disabled={disabled} />
|
|
661
|
+
<Separator />
|
|
630
662
|
<Toolbar.ToggleGroup type="multiple" asChild>
|
|
631
663
|
<Flex gap={1} marginLeft={1}>
|
|
632
664
|
{Object.entries(modifiers).map(([name, modifier]) => (
|
|
@@ -650,14 +682,6 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
650
682
|
<ListButton block={blocks['list-ordered']} disabled={disabled} />
|
|
651
683
|
</Flex>
|
|
652
684
|
</Toolbar.ToggleGroup>
|
|
653
|
-
{/* TODO: Remove after the RTE Blocks Beta release */}
|
|
654
|
-
<Flex grow={1} justifyContent="flex-end">
|
|
655
|
-
<BetaTag>
|
|
656
|
-
<Typography textColor="secondary600" variant="sigma">
|
|
657
|
-
BETA
|
|
658
|
-
</Typography>
|
|
659
|
-
</BetaTag>
|
|
660
|
-
</Flex>
|
|
661
685
|
</ToolbarWrapper>
|
|
662
686
|
</Toolbar.Root>
|
|
663
687
|
);
|
|
@@ -2,15 +2,16 @@ import * as React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
5
|
+
Icon,
|
|
5
6
|
Typography,
|
|
6
7
|
BaseLink,
|
|
7
8
|
Popover,
|
|
8
|
-
IconButton,
|
|
9
9
|
Field,
|
|
10
10
|
FieldLabel,
|
|
11
11
|
FieldInput,
|
|
12
12
|
Flex,
|
|
13
13
|
Button,
|
|
14
|
+
Tooltip,
|
|
14
15
|
} from '@strapi/design-system';
|
|
15
16
|
import {
|
|
16
17
|
Code,
|
|
@@ -164,10 +165,31 @@ const handleBackspaceKeyOnList = (editor, event) => {
|
|
|
164
165
|
const [currentListItem, currentListItemPath] = Editor.parent(editor, editor.selection.anchor);
|
|
165
166
|
const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);
|
|
166
167
|
const isListEmpty = currentList.children.length === 1 && currentListItem.children[0].text === '';
|
|
168
|
+
const isNodeStart = Editor.isStart(editor, editor.selection.anchor, currentListItemPath);
|
|
169
|
+
const isFocusAtTheBeginningOfAChild =
|
|
170
|
+
editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;
|
|
167
171
|
|
|
168
172
|
if (isListEmpty) {
|
|
169
173
|
event.preventDefault();
|
|
170
174
|
replaceListWithEmptyBlock(editor, currentListPath);
|
|
175
|
+
} else if (isNodeStart) {
|
|
176
|
+
Transforms.liftNodes(editor, {
|
|
177
|
+
match: (n) => n.type === 'list-item',
|
|
178
|
+
});
|
|
179
|
+
// Transforms the list item into a paragraph
|
|
180
|
+
Transforms.setNodes(
|
|
181
|
+
editor,
|
|
182
|
+
{ type: 'paragraph' },
|
|
183
|
+
{
|
|
184
|
+
hanging: true,
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
} else if (isFocusAtTheBeginningOfAChild) {
|
|
188
|
+
Transforms.liftNodes(editor, {
|
|
189
|
+
match: (n) => n.type === 'list-item',
|
|
190
|
+
});
|
|
191
|
+
// If the focus is at the beginning of a child node we need to replace it with a paragraph
|
|
192
|
+
Transforms.setNodes(editor, { type: 'paragraph' });
|
|
171
193
|
}
|
|
172
194
|
};
|
|
173
195
|
|
|
@@ -255,6 +277,18 @@ Image.propTypes = {
|
|
|
255
277
|
}).isRequired,
|
|
256
278
|
};
|
|
257
279
|
|
|
280
|
+
// Make sure the tooltip is above the popover
|
|
281
|
+
const TooltipCustom = styled(Tooltip)`
|
|
282
|
+
z-index: 6;
|
|
283
|
+
`;
|
|
284
|
+
|
|
285
|
+
// Used for the Edit and Cancel buttons in the link popover
|
|
286
|
+
const CustomButton = styled(Button)`
|
|
287
|
+
& > span {
|
|
288
|
+
line-height: normal;
|
|
289
|
+
}
|
|
290
|
+
`;
|
|
291
|
+
|
|
258
292
|
const Link = React.forwardRef(({ element, children, ...attributes }, forwardedRef) => {
|
|
259
293
|
const { formatMessage } = useIntl();
|
|
260
294
|
const editor = useSlate();
|
|
@@ -376,25 +410,49 @@ const Link = React.forwardRef(({ element, children, ...attributes }, forwardedRe
|
|
|
376
410
|
</StyledBaseLink>
|
|
377
411
|
</Typography>
|
|
378
412
|
<Flex justifyContent="end" width="100%" gap={2}>
|
|
379
|
-
<
|
|
380
|
-
|
|
381
|
-
size="L"
|
|
382
|
-
variant="danger"
|
|
383
|
-
onClick={() => removeLink(editor)}
|
|
384
|
-
label={formatMessage({
|
|
413
|
+
<TooltipCustom
|
|
414
|
+
description={formatMessage({
|
|
385
415
|
id: 'components.Blocks.popover.delete',
|
|
386
416
|
defaultMessage: 'Delete',
|
|
387
417
|
})}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
418
|
+
>
|
|
419
|
+
<CustomButton
|
|
420
|
+
size="S"
|
|
421
|
+
width="2rem"
|
|
422
|
+
variant="danger-light"
|
|
423
|
+
onClick={() => removeLink(editor)}
|
|
424
|
+
aria-label={formatMessage({
|
|
425
|
+
id: 'components.Blocks.popover.delete',
|
|
426
|
+
defaultMessage: 'Delete',
|
|
427
|
+
})}
|
|
428
|
+
type="button"
|
|
429
|
+
justifyContent="center"
|
|
430
|
+
>
|
|
431
|
+
<Icon width={3} height={3} as={Trash} />
|
|
432
|
+
</CustomButton>
|
|
433
|
+
</TooltipCustom>
|
|
434
|
+
|
|
435
|
+
<TooltipCustom
|
|
436
|
+
description={formatMessage({
|
|
394
437
|
id: 'components.Blocks.popover.edit',
|
|
395
438
|
defaultMessage: 'Edit',
|
|
396
439
|
})}
|
|
397
|
-
|
|
440
|
+
>
|
|
441
|
+
<CustomButton
|
|
442
|
+
size="S"
|
|
443
|
+
width="2rem"
|
|
444
|
+
variant="tertiary"
|
|
445
|
+
onClick={() => setIsEditing(true)}
|
|
446
|
+
aria-label={formatMessage({
|
|
447
|
+
id: 'components.Blocks.popover.edit',
|
|
448
|
+
defaultMessage: 'Edit',
|
|
449
|
+
})}
|
|
450
|
+
type="button"
|
|
451
|
+
justifyContent="center"
|
|
452
|
+
>
|
|
453
|
+
<Icon width={3} height={3} as={Pencil} />
|
|
454
|
+
</CustomButton>
|
|
455
|
+
</TooltipCustom>
|
|
398
456
|
</Flex>
|
|
399
457
|
</Flex>
|
|
400
458
|
)}
|
|
@@ -11,13 +11,15 @@ import axios from 'axios';
|
|
|
11
11
|
import { useIntl } from 'react-intl';
|
|
12
12
|
import { useDispatch, useSelector } from 'react-redux';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { HOOKS } from '../../../constants';
|
|
15
15
|
import { getTrad } from '../../utils';
|
|
16
16
|
|
|
17
17
|
import { getInitData, resetInitData, setInitData } from './actions';
|
|
18
18
|
import { selectAppDomain } from './selectors';
|
|
19
19
|
import getContentTypeLinks from './utils/getContentTypeLinks';
|
|
20
20
|
|
|
21
|
+
const { MUTATE_COLLECTION_TYPES_LINKS, MUTATE_SINGLE_TYPES_LINKS } = HOOKS;
|
|
22
|
+
|
|
21
23
|
const useContentManagerInitData = () => {
|
|
22
24
|
const dispatch = useDispatch();
|
|
23
25
|
const toggleNotification = useNotification();
|
|
@@ -4,13 +4,15 @@ import { LoadingIndicatorPage, useQueryParams, useStrapiApp } from '@strapi/help
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useDispatch, useSelector } from 'react-redux';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { HOOKS } from '../../../constants';
|
|
8
8
|
import { useSyncRbac } from '../../hooks';
|
|
9
9
|
|
|
10
10
|
import { resetProps, setLayout } from './actions';
|
|
11
11
|
import Permissions from './Permissions';
|
|
12
12
|
import selectLayout from './selectors';
|
|
13
13
|
|
|
14
|
+
const { MUTATE_EDIT_VIEW_LAYOUT } = HOOKS;
|
|
15
|
+
|
|
14
16
|
const EditViewLayoutManager = ({ layout, ...rest }) => {
|
|
15
17
|
const currentLayout = useSelector(selectLayout);
|
|
16
18
|
const dispatch = useDispatch();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { BaseCheckbox, IconButton,
|
|
3
|
+
import { BaseCheckbox, IconButton, Flex } from '@strapi/design-system';
|
|
4
4
|
import { useTracking, useTableContext, Table } from '@strapi/helper-plugin';
|
|
5
5
|
import { Trash, Duplicate, Pencil } from '@strapi/icons';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -29,15 +29,14 @@ const CheckboxDataCell = ({ rowId, index }) => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</Td>
|
|
32
|
+
<BaseCheckbox
|
|
33
|
+
aria-label={ariaLabel}
|
|
34
|
+
checked={isChecked}
|
|
35
|
+
onClick={stopPropagation}
|
|
36
|
+
onChange={() => {
|
|
37
|
+
onSelectRow({ name: rowId, value: !isChecked });
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
41
40
|
);
|
|
42
41
|
};
|
|
43
42
|
|
|
@@ -75,61 +74,59 @@ const EntityActionsDataCell = ({
|
|
|
75
74
|
);
|
|
76
75
|
|
|
77
76
|
return (
|
|
78
|
-
<
|
|
79
|
-
<
|
|
77
|
+
<Flex gap={1} justifyContent="end" onClick={stopPropagation}>
|
|
78
|
+
<IconButton
|
|
79
|
+
forwardedAs={Link}
|
|
80
|
+
onClick={() => {
|
|
81
|
+
trackUsage('willEditEntryFromButton');
|
|
82
|
+
}}
|
|
83
|
+
to={{
|
|
84
|
+
pathname: `${pathname}/${rowId}`,
|
|
85
|
+
state: { from: pathname },
|
|
86
|
+
search: pluginsQueryParams,
|
|
87
|
+
}}
|
|
88
|
+
label={formatMessage(
|
|
89
|
+
{ id: 'app.component.table.edit', defaultMessage: 'Edit {target}' },
|
|
90
|
+
{ target: itemLineText }
|
|
91
|
+
)}
|
|
92
|
+
noBorder
|
|
93
|
+
>
|
|
94
|
+
<Pencil />
|
|
95
|
+
</IconButton>
|
|
96
|
+
|
|
97
|
+
{canCreate && (
|
|
98
|
+
<IconButton
|
|
99
|
+
onClick={handleCloneClick(rowId)}
|
|
100
|
+
label={formatMessage(
|
|
101
|
+
{
|
|
102
|
+
id: 'app.component.table.duplicate',
|
|
103
|
+
defaultMessage: 'Duplicate {target}',
|
|
104
|
+
},
|
|
105
|
+
{ target: itemLineText }
|
|
106
|
+
)}
|
|
107
|
+
noBorder
|
|
108
|
+
>
|
|
109
|
+
<Duplicate />
|
|
110
|
+
</IconButton>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{canDelete && (
|
|
80
114
|
<IconButton
|
|
81
|
-
forwardedAs={Link}
|
|
82
115
|
onClick={() => {
|
|
83
|
-
trackUsage('
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pathname: `${pathname}/${rowId}`,
|
|
87
|
-
state: { from: pathname },
|
|
88
|
-
search: pluginsQueryParams,
|
|
116
|
+
trackUsage('willDeleteEntryFromList');
|
|
117
|
+
setSelectedEntries([rowId]);
|
|
118
|
+
setIsConfirmDeleteRowOpen(true);
|
|
89
119
|
}}
|
|
90
120
|
label={formatMessage(
|
|
91
|
-
{ id: '
|
|
121
|
+
{ id: 'global.delete-target', defaultMessage: 'Delete {target}' },
|
|
92
122
|
{ target: itemLineText }
|
|
93
123
|
)}
|
|
94
124
|
noBorder
|
|
95
125
|
>
|
|
96
|
-
<
|
|
126
|
+
<Trash />
|
|
97
127
|
</IconButton>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<IconButton
|
|
101
|
-
onClick={handleCloneClick(rowId)}
|
|
102
|
-
label={formatMessage(
|
|
103
|
-
{
|
|
104
|
-
id: 'app.component.table.duplicate',
|
|
105
|
-
defaultMessage: 'Duplicate {target}',
|
|
106
|
-
},
|
|
107
|
-
{ target: itemLineText }
|
|
108
|
-
)}
|
|
109
|
-
noBorder
|
|
110
|
-
>
|
|
111
|
-
<Duplicate />
|
|
112
|
-
</IconButton>
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
{canDelete && (
|
|
116
|
-
<IconButton
|
|
117
|
-
onClick={() => {
|
|
118
|
-
trackUsage('willDeleteEntryFromList');
|
|
119
|
-
setSelectedEntries([rowId]);
|
|
120
|
-
setIsConfirmDeleteRowOpen(true);
|
|
121
|
-
}}
|
|
122
|
-
label={formatMessage(
|
|
123
|
-
{ id: 'global.delete-target', defaultMessage: 'Delete {target}' },
|
|
124
|
-
{ target: itemLineText }
|
|
125
|
-
)}
|
|
126
|
-
noBorder
|
|
127
|
-
>
|
|
128
|
-
<Trash />
|
|
129
|
-
</IconButton>
|
|
130
|
-
)}
|
|
131
|
-
</Flex>
|
|
132
|
-
</Td>
|
|
128
|
+
)}
|
|
129
|
+
</Flex>
|
|
133
130
|
);
|
|
134
131
|
};
|
|
135
132
|
|
|
@@ -32,7 +32,7 @@ import { useSelector } from 'react-redux';
|
|
|
32
32
|
import { Link, useHistory } from 'react-router-dom';
|
|
33
33
|
import styled from 'styled-components';
|
|
34
34
|
|
|
35
|
-
import
|
|
35
|
+
import { formatAPIErrors } from '../../../../../../utils/formatAPIErrors';
|
|
36
36
|
import { getTrad, createYupSchema } from '../../../../../utils';
|
|
37
37
|
import { listViewDomain } from '../../../selectors';
|
|
38
38
|
import { Body } from '../../Body';
|
|
@@ -156,7 +156,9 @@ const SelectedEntriesTableContent = ({
|
|
|
156
156
|
<Table.Body>
|
|
157
157
|
{rowsToDisplay.map((row, index) => (
|
|
158
158
|
<Tr key={row.id}>
|
|
159
|
-
<
|
|
159
|
+
<Td>
|
|
160
|
+
<Body.CheckboxDataCell rowId={row.id} index={index} />
|
|
161
|
+
</Td>
|
|
160
162
|
<Td>
|
|
161
163
|
<Typography>{row.id}</Typography>
|
|
162
164
|
</Td>
|
|
@@ -301,7 +303,7 @@ const SelectedEntriesModalContent = ({
|
|
|
301
303
|
onError(error) {
|
|
302
304
|
toggleNotification({
|
|
303
305
|
type: 'warning',
|
|
304
|
-
message:
|
|
306
|
+
message: formatAPIErrors(error),
|
|
305
307
|
});
|
|
306
308
|
},
|
|
307
309
|
}
|
|
@@ -23,7 +23,7 @@ import { useIntl } from 'react-intl';
|
|
|
23
23
|
import { Link, useHistory } from 'react-router-dom';
|
|
24
24
|
|
|
25
25
|
import { useEnterprise } from '../../../../../hooks/useEnterprise';
|
|
26
|
-
import { getFullName } from '../../../../../utils';
|
|
26
|
+
import { getFullName } from '../../../../../utils/getFullName';
|
|
27
27
|
import { usePluginsQueryParams } from '../../../../hooks';
|
|
28
28
|
import { getTrad } from '../../../../utils';
|
|
29
29
|
import CellContent from '../CellContent';
|