@webbio/strapi-plugin-page-builder 0.12.2-platform → 0.12.4-platform
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/README.md +166 -166
- package/admin/src/api/collection-type.ts +111 -111
- package/admin/src/api/entity-relation.ts +42 -42
- package/admin/src/api/has-page-relation.ts +37 -37
- package/admin/src/api/has-platform-relation.ts +40 -40
- package/admin/src/api/page-type-relation.ts +41 -41
- package/admin/src/api/platform-page-types.ts +45 -45
- package/admin/src/api/platform-relation.ts +42 -42
- package/admin/src/api/platform.ts +35 -35
- package/admin/src/api/search-filtered-entity.ts +114 -114
- package/admin/src/api/template.ts +39 -39
- package/admin/src/components/Combobox/index.tsx +83 -83
- package/admin/src/components/Combobox/react-select-custom-styles.tsx +121 -121
- package/admin/src/components/Combobox/styles.ts +46 -46
- package/admin/src/components/ConfirmModal/index.tsx +90 -90
- package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +127 -127
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +149 -149
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/styles.ts +19 -19
- package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +82 -82
- package/admin/src/components/EditView/Details/index.tsx +48 -48
- package/admin/src/components/EditView/Details/styles.ts +51 -51
- package/admin/src/components/EditView/PageSettings/index.tsx +124 -124
- package/admin/src/components/EditView/Platform/platform-select.tsx +30 -30
- package/admin/src/components/EditView/Template/TemplateConfirmModal/index.tsx +36 -36
- package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +70 -70
- package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +41 -41
- package/admin/src/components/EditView/index.tsx +35 -35
- package/admin/src/components/EditView/page-type-select.tsx +32 -32
- package/admin/src/components/EditView/wrapper.tsx +41 -41
- package/admin/src/components/GlobalPlatformSelect/index.tsx +40 -40
- package/admin/src/components/GlobalPlatformSelect/styles.ts +27 -27
- package/admin/src/components/Initializer/index.tsx +24 -24
- package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +39 -39
- package/admin/src/components/PageFilters/PlatformFilter/index.tsx +32 -32
- package/admin/src/components/PageFilters/filters.tsx +189 -189
- package/admin/src/components/PageFilters/index.tsx +35 -35
- package/admin/src/components/PageTypeEditView/TemplatePlatformSelect/index.tsx +76 -76
- package/admin/src/components/PageTypeEditView/index.tsx +53 -53
- package/admin/src/components/PlatformFilteredSelectField/InputIcon/index.tsx +23 -23
- package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +210 -210
- package/admin/src/components/PlatformFilteredSelectField/Single/index.tsx +197 -197
- package/admin/src/components/PlatformFilteredSelectField/hooks/useRelationLoad.tsx +128 -128
- package/admin/src/components/PlatformFilteredSelectField/index.tsx +85 -85
- package/admin/src/components/PlatformFilteredSelectField/styles.tsx +77 -77
- package/admin/src/components/PlatformFilteredSelectField/utils/get-translations.ts +3 -3
- package/admin/src/components/PlatformFilteredSelectField/utils/relation-helper.ts +147 -147
- package/admin/src/components/PluginIcon/index.tsx +94 -94
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInput.tsx +689 -689
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInputDataManager.tsx +6 -6
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/useRelation.ts +170 -170
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/getRelationLink.ts +5 -5
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/normalizeRelations.ts +52 -52
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/constants/attributes.ts +3 -3
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useDragAndDrop.ts +253 -253
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useKeyboardDragAndDrop.ts +96 -96
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/usePrev.ts +11 -11
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/dragAndDrop.ts +8 -8
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/paths.ts +29 -29
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/refs.ts +19 -19
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/translations.ts +3 -3
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/collection-types.ts +300 -300
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/components.ts +72 -72
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/content-types.ts +116 -116
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/index.ts +8 -8
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/init.ts +22 -22
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/relations.ts +80 -80
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/review-workflows.ts +88 -88
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/single-types.ts +112 -112
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/uid.ts +48 -48
- package/admin/src/components/StrapiCore/content-manager/shared/index.ts +1 -1
- package/admin/src/constants.ts +3 -3
- package/admin/src/index.tsx +101 -101
- package/admin/src/middlewares/index.tsx +37 -37
- package/admin/src/pages/app/index.tsx +14 -14
- package/admin/src/pluginId.ts +5 -5
- package/admin/src/translations/en.json +9 -9
- package/admin/src/translations/nl.json +9 -9
- package/admin/src/utils/findDomElement.ts +6 -6
- package/admin/src/utils/findElementParent.ts +20 -20
- package/admin/src/utils/getObjectFromFormName.ts +42 -42
- package/admin/src/utils/getRequestUrl.ts +11 -11
- package/admin/src/utils/getTrad.ts +5 -5
- package/admin/src/utils/hooks/useDebounce.ts +17 -17
- package/admin/src/utils/hooks/useDefaultPlatformFromLocalStorage.ts +61 -61
- package/admin/src/utils/hooks/useGetLocaleFromUrl.ts +9 -9
- package/admin/src/utils/hooks/useHideOverviewFilterTags.ts +34 -34
- package/admin/src/utils/hooks/usePlatformFormData.ts +64 -64
- package/admin/src/utils/hooks/usePrevious.ts +12 -12
- package/admin/src/utils/sanitizeModules.ts +93 -93
- package/custom.d.ts +6 -6
- package/dist/package.json +1 -1
- package/dist/server/bootstrap/collection-type-lifecycles.js +1 -1
- package/dist/server/bootstrap.js +1 -1
- package/dist/server/graphql/page-by-path.js +20 -17
- package/dist/server/graphql/page-by-slug.js +9 -9
- package/dist/server/graphql/pages-by-uid.js +5 -5
- package/dist/server/services/private-content/graphql/index.js +27 -27
- package/dist/server/services/private-content/graphql/types/index.js +74 -74
- package/dist/server/utils/graphql.js +18 -18
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +78 -78
- package/server/bootstrap/collection-type-lifecycles.ts +47 -47
- package/server/bootstrap/permissions.ts +161 -161
- package/server/bootstrap.ts +261 -261
- package/server/config/index.ts +4 -4
- package/server/content-types/index.ts +7 -7
- package/server/content-types/user-category/schema.json +23 -23
- package/server/controllers/collection-types.ts +32 -32
- package/server/controllers/index.ts +19 -19
- package/server/controllers/page-type.ts +18 -18
- package/server/controllers/page.ts +9 -9
- package/server/controllers/platform.ts +21 -21
- package/server/controllers/private-content.ts +17 -17
- package/server/controllers/sitemap.ts +32 -32
- package/server/controllers/template.ts +16 -16
- package/server/controllers/user-category.ts +3 -3
- package/server/destroy.ts +5 -5
- package/server/graphql/index.ts +9 -9
- package/server/graphql/page-by-path.ts +135 -132
- package/server/graphql/page-type.ts +67 -67
- package/server/graphql/pages-by-uid.ts +89 -89
- package/server/index.ts +23 -23
- package/server/middlewares/index.ts +1 -1
- package/server/policies/index.ts +5 -5
- package/server/policies/isAuthorizedPage.ts +11 -11
- package/server/register.ts +22 -22
- package/server/routes/index.ts +115 -115
- package/server/routes/user-category.ts +3 -3
- package/server/schema/page-end.json +96 -96
- package/server/schema/page-start.json +87 -87
- package/server/schema/page-type-end.json +53 -53
- package/server/schema/page-type-start.json +38 -38
- package/server/schema/platform-start.json +21 -21
- package/server/schema/template-end.json +40 -40
- package/server/schema/template-start.json +35 -35
- package/server/services/builder.ts +232 -232
- package/server/services/collection-types.ts +95 -95
- package/server/services/email.ts +127 -127
- package/server/services/index.ts +23 -23
- package/server/services/page-type.ts +30 -30
- package/server/services/page.ts +24 -24
- package/server/services/platform.ts +30 -30
- package/server/services/private-content/components/admin-email.json +22 -22
- package/server/services/private-content/components/email.json +22 -22
- package/server/services/private-content/components/platform-email.json +30 -30
- package/server/services/private-content/constants/index.ts +13 -13
- package/server/services/private-content/graphql/index.ts +88 -88
- package/server/services/private-content/graphql/resolvers/findOnePage.ts +40 -40
- package/server/services/private-content/graphql/resolvers/findPage.ts +45 -45
- package/server/services/private-content/graphql/resolvers/forgot-password.ts +34 -34
- package/server/services/private-content/graphql/resolvers/login.ts +56 -56
- package/server/services/private-content/graphql/resolvers/register.ts +78 -78
- package/server/services/private-content/graphql/resolvers/reset-password.ts +44 -44
- package/server/services/private-content/graphql/types/index.ts +96 -96
- package/server/services/private-content/index.ts +95 -95
- package/server/services/private-content/mail-template/txtMail.email.template.text.ts +6 -6
- package/server/services/private-content/page.ts +20 -20
- package/server/services/private-content/platform.ts +19 -19
- package/server/services/private-content/schemas/index.ts +28 -28
- package/server/services/private-content/user.ts +197 -197
- package/server/services/sitemap.ts +83 -83
- package/server/services/template.ts +13 -13
- package/server/services/user-category.ts +3 -3
- package/server/utils/filter-underscore-arguments.ts +12 -12
- package/server/utils/reload-strapi-on-load.ts +13 -13
- package/server/utils/strapi.ts +50 -50
- package/shared/utils/constants.ts +8 -8
- package/shared/utils/sleep.ts +1 -1
- package/strapi-admin.js +3 -3
- package/strapi-server.js +3 -3
- package/tsconfig.json +20 -20
- package/tsconfig.server.json +25 -25
package/admin/src/index.tsx
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
2
|
-
|
|
3
|
-
import pluginPkg from '../../package.json';
|
|
4
|
-
import pluginId from './pluginId';
|
|
5
|
-
import Initializer from './components/Initializer';
|
|
6
|
-
import PageFiltersContainer from './components/PageFilters';
|
|
7
|
-
import { EditView } from './components/EditView';
|
|
8
|
-
import PageTypeEditViewWrapper from './components/PageTypeEditView';
|
|
9
|
-
import middlewares from './middlewares';
|
|
10
|
-
import PluginIcon from './components/PluginIcon';
|
|
11
|
-
import getTrad from './utils/getTrad';
|
|
12
|
-
import PlatformFilteredSelectFieldIcon from './components/PlatformFilteredSelectField/InputIcon';
|
|
13
|
-
|
|
14
|
-
const name = pluginPkg.strapi.name;
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
register(app: any) {
|
|
18
|
-
app.addMiddlewares(middlewares);
|
|
19
|
-
const plugin = {
|
|
20
|
-
id: pluginId,
|
|
21
|
-
initializer: Initializer,
|
|
22
|
-
isReady: false,
|
|
23
|
-
name
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
app.customFields.register({
|
|
27
|
-
name: 'filtered-select',
|
|
28
|
-
pluginId,
|
|
29
|
-
type: 'string',
|
|
30
|
-
icon: PlatformFilteredSelectFieldIcon,
|
|
31
|
-
intlLabel: {
|
|
32
|
-
id: getTrad('platformFilteredSelect.builder.label'),
|
|
33
|
-
defaultMessage: name
|
|
34
|
-
},
|
|
35
|
-
intlDescription: {
|
|
36
|
-
id: getTrad('platformFilteredSelect.builder.description'),
|
|
37
|
-
defaultMessage: 'Add a filtered select to a page'
|
|
38
|
-
},
|
|
39
|
-
components: {
|
|
40
|
-
Input: async () =>
|
|
41
|
-
import(/* webpackChunkName: "filtered-select-component" */ './components/PlatformFilteredSelectField')
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
app.addMenuLink({
|
|
46
|
-
to: '/plugins/strapi-plugin-page-builder',
|
|
47
|
-
icon: PluginIcon, // This really is a plugin icon, I promise!
|
|
48
|
-
intlLabel: {
|
|
49
|
-
id: pluginId,
|
|
50
|
-
defaultMessage: ' '
|
|
51
|
-
},
|
|
52
|
-
Component: async () => {
|
|
53
|
-
const component = await import(/* webpackChunkName: "[request]" */ './pages/app');
|
|
54
|
-
|
|
55
|
-
return component;
|
|
56
|
-
},
|
|
57
|
-
permissions: [] // permissions to apply to the link
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
app.registerPlugin(plugin);
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
bootstrap(app: any) {
|
|
64
|
-
app.injectContentManagerComponent('editView', 'right-links', {
|
|
65
|
-
name: 'collection-type-picker',
|
|
66
|
-
Component: EditView
|
|
67
|
-
});
|
|
68
|
-
app.injectContentManagerComponent('editView', 'right-links', {
|
|
69
|
-
name: 'page-type-edit-view',
|
|
70
|
-
Component: PageTypeEditViewWrapper
|
|
71
|
-
});
|
|
72
|
-
app.injectContentManagerComponent('listView', 'actions', {
|
|
73
|
-
name: 'page-filters',
|
|
74
|
-
Component: PageFiltersContainer
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
async registerTrads(app: any) {
|
|
79
|
-
const { locales } = app;
|
|
80
|
-
|
|
81
|
-
const importedTrads = await Promise.all(
|
|
82
|
-
(locales as string[]).map((locale) => {
|
|
83
|
-
return import(`./translations/${locale}.json`)
|
|
84
|
-
.then(({ default: data }) => {
|
|
85
|
-
return {
|
|
86
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
87
|
-
locale
|
|
88
|
-
};
|
|
89
|
-
})
|
|
90
|
-
.catch(() => {
|
|
91
|
-
return {
|
|
92
|
-
data: {},
|
|
93
|
-
locale
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
return Promise.resolve(importedTrads);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
1
|
+
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
2
|
+
|
|
3
|
+
import pluginPkg from '../../package.json';
|
|
4
|
+
import pluginId from './pluginId';
|
|
5
|
+
import Initializer from './components/Initializer';
|
|
6
|
+
import PageFiltersContainer from './components/PageFilters';
|
|
7
|
+
import { EditView } from './components/EditView';
|
|
8
|
+
import PageTypeEditViewWrapper from './components/PageTypeEditView';
|
|
9
|
+
import middlewares from './middlewares';
|
|
10
|
+
import PluginIcon from './components/PluginIcon';
|
|
11
|
+
import getTrad from './utils/getTrad';
|
|
12
|
+
import PlatformFilteredSelectFieldIcon from './components/PlatformFilteredSelectField/InputIcon';
|
|
13
|
+
|
|
14
|
+
const name = pluginPkg.strapi.name;
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
register(app: any) {
|
|
18
|
+
app.addMiddlewares(middlewares);
|
|
19
|
+
const plugin = {
|
|
20
|
+
id: pluginId,
|
|
21
|
+
initializer: Initializer,
|
|
22
|
+
isReady: false,
|
|
23
|
+
name
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
app.customFields.register({
|
|
27
|
+
name: 'filtered-select',
|
|
28
|
+
pluginId,
|
|
29
|
+
type: 'string',
|
|
30
|
+
icon: PlatformFilteredSelectFieldIcon,
|
|
31
|
+
intlLabel: {
|
|
32
|
+
id: getTrad('platformFilteredSelect.builder.label'),
|
|
33
|
+
defaultMessage: name
|
|
34
|
+
},
|
|
35
|
+
intlDescription: {
|
|
36
|
+
id: getTrad('platformFilteredSelect.builder.description'),
|
|
37
|
+
defaultMessage: 'Add a filtered select to a page'
|
|
38
|
+
},
|
|
39
|
+
components: {
|
|
40
|
+
Input: async () =>
|
|
41
|
+
import(/* webpackChunkName: "filtered-select-component" */ './components/PlatformFilteredSelectField')
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
app.addMenuLink({
|
|
46
|
+
to: '/plugins/strapi-plugin-page-builder',
|
|
47
|
+
icon: PluginIcon, // This really is a plugin icon, I promise!
|
|
48
|
+
intlLabel: {
|
|
49
|
+
id: pluginId,
|
|
50
|
+
defaultMessage: ' '
|
|
51
|
+
},
|
|
52
|
+
Component: async () => {
|
|
53
|
+
const component = await import(/* webpackChunkName: "[request]" */ './pages/app');
|
|
54
|
+
|
|
55
|
+
return component;
|
|
56
|
+
},
|
|
57
|
+
permissions: [] // permissions to apply to the link
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
app.registerPlugin(plugin);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
bootstrap(app: any) {
|
|
64
|
+
app.injectContentManagerComponent('editView', 'right-links', {
|
|
65
|
+
name: 'collection-type-picker',
|
|
66
|
+
Component: EditView
|
|
67
|
+
});
|
|
68
|
+
app.injectContentManagerComponent('editView', 'right-links', {
|
|
69
|
+
name: 'page-type-edit-view',
|
|
70
|
+
Component: PageTypeEditViewWrapper
|
|
71
|
+
});
|
|
72
|
+
app.injectContentManagerComponent('listView', 'actions', {
|
|
73
|
+
name: 'page-filters',
|
|
74
|
+
Component: PageFiltersContainer
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
async registerTrads(app: any) {
|
|
79
|
+
const { locales } = app;
|
|
80
|
+
|
|
81
|
+
const importedTrads = await Promise.all(
|
|
82
|
+
(locales as string[]).map((locale) => {
|
|
83
|
+
return import(`./translations/${locale}.json`)
|
|
84
|
+
.then(({ default: data }) => {
|
|
85
|
+
return {
|
|
86
|
+
data: prefixPluginTranslations(data, pluginId),
|
|
87
|
+
locale
|
|
88
|
+
};
|
|
89
|
+
})
|
|
90
|
+
.catch(() => {
|
|
91
|
+
return {
|
|
92
|
+
data: {},
|
|
93
|
+
locale
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return Promise.resolve(importedTrads);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
|
-
|
|
3
|
-
import { PAGE_UID } from '../../../shared/utils/constants';
|
|
4
|
-
import getRequestUrl from '../utils/getRequestUrl';
|
|
5
|
-
|
|
6
|
-
const middleware =
|
|
7
|
-
() =>
|
|
8
|
-
({ getState }: any) =>
|
|
9
|
-
(next: any) =>
|
|
10
|
-
async (action: any) => {
|
|
11
|
-
// If data is being fetched or after a save
|
|
12
|
-
if (
|
|
13
|
-
action.type === 'ContentManager/CrudReducer/GET_DATA_SUCCEEDED' ||
|
|
14
|
-
action.type === 'ContentManager/CrudReducer/SUBMIT_SUCCEEDED'
|
|
15
|
-
) {
|
|
16
|
-
const store = getState();
|
|
17
|
-
const layoutSlice = store['content-manager_editViewLayoutManager'];
|
|
18
|
-
const uid = layoutSlice.currentLayout.contentType.uid;
|
|
19
|
-
|
|
20
|
-
if (uid !== PAGE_UID) {
|
|
21
|
-
return next(action);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const { get } = await getFetchClient();
|
|
25
|
-
const { data: pageData } = await get(`${getRequestUrl('page')}/${action.data.id}`);
|
|
26
|
-
|
|
27
|
-
action.data.collectionTypeTitle = pageData?.collectionTypeData?.title;
|
|
28
|
-
action.data.collectionTypeId = pageData?.collectionTypeData?.id;
|
|
29
|
-
action.data.initialPageType = pageData?.pageType ? pageData.pageType : undefined;
|
|
30
|
-
|
|
31
|
-
return next(action);
|
|
32
|
-
}
|
|
33
|
-
return next(action);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const middlewares = [middleware];
|
|
37
|
-
export default middlewares;
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
|
+
|
|
3
|
+
import { PAGE_UID } from '../../../shared/utils/constants';
|
|
4
|
+
import getRequestUrl from '../utils/getRequestUrl';
|
|
5
|
+
|
|
6
|
+
const middleware =
|
|
7
|
+
() =>
|
|
8
|
+
({ getState }: any) =>
|
|
9
|
+
(next: any) =>
|
|
10
|
+
async (action: any) => {
|
|
11
|
+
// If data is being fetched or after a save
|
|
12
|
+
if (
|
|
13
|
+
action.type === 'ContentManager/CrudReducer/GET_DATA_SUCCEEDED' ||
|
|
14
|
+
action.type === 'ContentManager/CrudReducer/SUBMIT_SUCCEEDED'
|
|
15
|
+
) {
|
|
16
|
+
const store = getState();
|
|
17
|
+
const layoutSlice = store['content-manager_editViewLayoutManager'];
|
|
18
|
+
const uid = layoutSlice.currentLayout.contentType.uid;
|
|
19
|
+
|
|
20
|
+
if (uid !== PAGE_UID) {
|
|
21
|
+
return next(action);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { get } = await getFetchClient();
|
|
25
|
+
const { data: pageData } = await get(`${getRequestUrl('page')}/${action.data.id}`);
|
|
26
|
+
|
|
27
|
+
action.data.collectionTypeTitle = pageData?.collectionTypeData?.title;
|
|
28
|
+
action.data.collectionTypeId = pageData?.collectionTypeData?.id;
|
|
29
|
+
action.data.initialPageType = pageData?.pageType ? pageData.pageType : undefined;
|
|
30
|
+
|
|
31
|
+
return next(action);
|
|
32
|
+
}
|
|
33
|
+
return next(action);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const middlewares = [middleware];
|
|
37
|
+
export default middlewares;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { useHistory } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
const App = () => {
|
|
5
|
-
const { push } = useHistory();
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
push('/');
|
|
9
|
-
}, []);
|
|
10
|
-
|
|
11
|
-
return <></>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default App;
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useHistory } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const App = () => {
|
|
5
|
+
const { push } = useHistory();
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
push('/');
|
|
9
|
+
}, []);
|
|
10
|
+
|
|
11
|
+
return <></>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default App;
|
package/admin/src/pluginId.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import pluginPkg from '../../package.json';
|
|
2
|
-
|
|
3
|
-
const pluginId = pluginPkg.strapi.name;
|
|
4
|
-
|
|
5
|
-
export default pluginId;
|
|
1
|
+
import pluginPkg from '../../package.json';
|
|
2
|
+
|
|
3
|
+
const pluginId = pluginPkg.strapi.name;
|
|
4
|
+
|
|
5
|
+
export default pluginId;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"template.confirmModal.title": "Replace all page modules",
|
|
3
|
-
"template.confirmModal.body": "You are about to replace all modules on this page. Are you sure you want to continue?",
|
|
4
|
-
"template.confirmModal.buttons.cancel": "No, cancel",
|
|
5
|
-
"template.confirmModal.buttons.submit": "Yes, replace all",
|
|
6
|
-
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
-
"platformFilteredSelect.builder.description": "Enables filtering relations by platform",
|
|
8
|
-
"platformFilteredSelect.linkToEntity.label": "Go to page"
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"template.confirmModal.title": "Replace all page modules",
|
|
3
|
+
"template.confirmModal.body": "You are about to replace all modules on this page. Are you sure you want to continue?",
|
|
4
|
+
"template.confirmModal.buttons.cancel": "No, cancel",
|
|
5
|
+
"template.confirmModal.buttons.submit": "Yes, replace all",
|
|
6
|
+
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
+
"platformFilteredSelect.builder.description": "Enables filtering relations by platform",
|
|
8
|
+
"platformFilteredSelect.linkToEntity.label": "Go to page"
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"template.confirmModal.title": "Pagina modules vervangen",
|
|
3
|
-
"template.confirmModal.body": "Weet je zeker dat je alle modules op deze pagina wilt vervangen?",
|
|
4
|
-
"template.confirmModal.buttons.cancel": "Nee, annuleer",
|
|
5
|
-
"template.confirmModal.buttons.submit": "Ja, vervang modules",
|
|
6
|
-
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
-
"platformFilteredSelect.builder.description": "Filtert relaties op basis van een platform",
|
|
8
|
-
"platformFilteredSelect.linkToEntity.label": "Ga naar pagina"
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"template.confirmModal.title": "Pagina modules vervangen",
|
|
3
|
+
"template.confirmModal.body": "Weet je zeker dat je alle modules op deze pagina wilt vervangen?",
|
|
4
|
+
"template.confirmModal.buttons.cancel": "Nee, annuleer",
|
|
5
|
+
"template.confirmModal.buttons.submit": "Ja, vervang modules",
|
|
6
|
+
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
+
"platformFilteredSelect.builder.description": "Filtert relaties op basis van een platform",
|
|
8
|
+
"platformFilteredSelect.linkToEntity.label": "Ga naar pagina"
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const findDomElement = (expression: string): HTMLElement => {
|
|
2
|
-
const xPathResult = document.evaluate(expression, document, null, XPathResult.ANY_TYPE, null);
|
|
3
|
-
const element = xPathResult.iterateNext();
|
|
4
|
-
|
|
5
|
-
return element as HTMLElement;
|
|
6
|
-
};
|
|
1
|
+
export const findDomElement = (expression: string): HTMLElement => {
|
|
2
|
+
const xPathResult = document.evaluate(expression, document, null, XPathResult.ANY_TYPE, null);
|
|
3
|
+
const element = xPathResult.iterateNext();
|
|
4
|
+
|
|
5
|
+
return element as HTMLElement;
|
|
6
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export const findElementParent = (rootEl: HTMLElement, element?: string, maxDepth = 10): HTMLElement | undefined => {
|
|
2
|
-
let found = false;
|
|
3
|
-
let el = rootEl;
|
|
4
|
-
let depth = 0;
|
|
5
|
-
|
|
6
|
-
while (!found && depth <= maxDepth) {
|
|
7
|
-
if (el?.tagName === element) {
|
|
8
|
-
found = true;
|
|
9
|
-
} else {
|
|
10
|
-
el = el?.parentElement as HTMLElement;
|
|
11
|
-
depth++;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!found) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return el;
|
|
20
|
-
};
|
|
1
|
+
export const findElementParent = (rootEl: HTMLElement, element?: string, maxDepth = 10): HTMLElement | undefined => {
|
|
2
|
+
let found = false;
|
|
3
|
+
let el = rootEl;
|
|
4
|
+
let depth = 0;
|
|
5
|
+
|
|
6
|
+
while (!found && depth <= maxDepth) {
|
|
7
|
+
if (el?.tagName === element) {
|
|
8
|
+
found = true;
|
|
9
|
+
} else {
|
|
10
|
+
el = el?.parentElement as HTMLElement;
|
|
11
|
+
depth++;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!found) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return el;
|
|
20
|
+
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
|
|
3
|
-
const getObjectFromFormName = (modifiedData?: Record<string, any>, name?: string, keepLast?: boolean) => {
|
|
4
|
-
const path = keepLast ? name : removeLastFromPath(name);
|
|
5
|
-
const newPath = pointPathToGetPath(path);
|
|
6
|
-
|
|
7
|
-
return get(modifiedData, newPath);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const removeLastFromPath = (path?: string): string => {
|
|
11
|
-
const split = (path || '')?.split('.');
|
|
12
|
-
|
|
13
|
-
split.pop();
|
|
14
|
-
|
|
15
|
-
return split.join('.');
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const pointPathToGetPath = (path?: string): string => {
|
|
19
|
-
const split = (path || '')?.split('.');
|
|
20
|
-
let newPath = '';
|
|
21
|
-
|
|
22
|
-
for (let index = 0; index < split.length; index++) {
|
|
23
|
-
let value = split?.[index];
|
|
24
|
-
|
|
25
|
-
if (index === 0) {
|
|
26
|
-
newPath += value;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!isNaN(Number(value))) {
|
|
31
|
-
value = `[${value}]`;
|
|
32
|
-
newPath += value;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
newPath += `.${value}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return newPath;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { getObjectFromFormName, pointPathToGetPath };
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
|
|
3
|
+
const getObjectFromFormName = (modifiedData?: Record<string, any>, name?: string, keepLast?: boolean) => {
|
|
4
|
+
const path = keepLast ? name : removeLastFromPath(name);
|
|
5
|
+
const newPath = pointPathToGetPath(path);
|
|
6
|
+
|
|
7
|
+
return get(modifiedData, newPath);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const removeLastFromPath = (path?: string): string => {
|
|
11
|
+
const split = (path || '')?.split('.');
|
|
12
|
+
|
|
13
|
+
split.pop();
|
|
14
|
+
|
|
15
|
+
return split.join('.');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const pointPathToGetPath = (path?: string): string => {
|
|
19
|
+
const split = (path || '')?.split('.');
|
|
20
|
+
let newPath = '';
|
|
21
|
+
|
|
22
|
+
for (let index = 0; index < split.length; index++) {
|
|
23
|
+
let value = split?.[index];
|
|
24
|
+
|
|
25
|
+
if (index === 0) {
|
|
26
|
+
newPath += value;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!isNaN(Number(value))) {
|
|
31
|
+
value = `[${value}]`;
|
|
32
|
+
newPath += value;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
newPath += `.${value}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return newPath;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { getObjectFromFormName, pointPathToGetPath };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import pluginId from '../pluginId';
|
|
2
|
-
|
|
3
|
-
const getRequestUrl = (path: string) => {
|
|
4
|
-
if (path.startsWith('/')) {
|
|
5
|
-
return `/${pluginId}${path}`;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
return `/${pluginId}/${path}`;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default getRequestUrl;
|
|
1
|
+
import pluginId from '../pluginId';
|
|
2
|
+
|
|
3
|
+
const getRequestUrl = (path: string) => {
|
|
4
|
+
if (path.startsWith('/')) {
|
|
5
|
+
return `/${pluginId}${path}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return `/${pluginId}/${path}`;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default getRequestUrl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import pluginId from '../pluginId';
|
|
2
|
-
|
|
3
|
-
const getTrad = (id: string) => `${pluginId}.${id}`;
|
|
4
|
-
|
|
5
|
-
export default getTrad;
|
|
1
|
+
import pluginId from '../pluginId';
|
|
2
|
+
|
|
3
|
+
const getTrad = (id: string) => `${pluginId}.${id}`;
|
|
4
|
+
|
|
5
|
+
export default getTrad;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export function useDebounce<T>(value: T, delay: number): T {
|
|
4
|
-
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
|
5
|
-
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
const handler = setTimeout(() => {
|
|
8
|
-
setDebouncedValue(value);
|
|
9
|
-
}, delay);
|
|
10
|
-
|
|
11
|
-
return () => {
|
|
12
|
-
clearTimeout(handler);
|
|
13
|
-
};
|
|
14
|
-
}, [value, delay]);
|
|
15
|
-
|
|
16
|
-
return debouncedValue;
|
|
17
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export function useDebounce<T>(value: T, delay: number): T {
|
|
4
|
+
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
|
5
|
+
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
const handler = setTimeout(() => {
|
|
8
|
+
setDebouncedValue(value);
|
|
9
|
+
}, delay);
|
|
10
|
+
|
|
11
|
+
return () => {
|
|
12
|
+
clearTimeout(handler);
|
|
13
|
+
};
|
|
14
|
+
}, [value, delay]);
|
|
15
|
+
|
|
16
|
+
return debouncedValue;
|
|
17
|
+
}
|