mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 11:08:14 +00:00
Update CM s injection zones
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
23a2e8f6e3
commit
cff2e5247e
@ -1,78 +0,0 @@
|
||||
// NOTE TO PLUGINS DEVELOPERS:
|
||||
// If you modify this file by adding new options to the plugin entry point
|
||||
// Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-field-api.md
|
||||
// Here's the file: strapi/docs/3.0.0-beta.x/guides/registering-a-field-in-admin.md
|
||||
// Also the strapi-generate-plugins/files/admin/src/index.js needs to be updated
|
||||
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
||||
// import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
||||
// import pluginPkg from '../../package.json';
|
||||
// import {
|
||||
// INJECT_COLUMN_IN_TABLE,
|
||||
// MUTATE_COLLECTION_TYPES_LINKS,
|
||||
// MUTATE_EDIT_VIEW_LAYOUT,
|
||||
// MUTATE_SINGLE_TYPES_LINKS,
|
||||
// } from '../exposedHooks';
|
||||
// import pluginId from './pluginId';
|
||||
// import pluginLogo from './assets/images/logo.svg';
|
||||
// import reducers from './reducers';
|
||||
// import pluginPermissions from './permissions';
|
||||
|
||||
// const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
||||
// const icon = pluginPkg.strapi.icon;
|
||||
// const name = pluginPkg.strapi.name;
|
||||
|
||||
export default {
|
||||
register() {
|
||||
// app.addCorePluginMenuLink({
|
||||
// to: `/plugins/${pluginId}`,
|
||||
// icon: 'book-open',
|
||||
// intlLabel: {
|
||||
// id: `${pluginId}.plugin.name`,
|
||||
// defaultMessage: 'Content manager',
|
||||
// },
|
||||
// permissions: pluginPermissions.main,
|
||||
// });
|
||||
// app.addReducers(reducers);
|
||||
// app.createHook(INJECT_COLUMN_IN_TABLE);
|
||||
// app.createHook(MUTATE_COLLECTION_TYPES_LINKS);
|
||||
// app.createHook(MUTATE_SINGLE_TYPES_LINKS);
|
||||
// app.createHook(MUTATE_EDIT_VIEW_LAYOUT);
|
||||
// app.registerPlugin({
|
||||
// description: pluginDescription,
|
||||
// icon,
|
||||
// id: pluginId,
|
||||
// injectionZones: {
|
||||
// editView: { informations: [], 'right-links': [] },
|
||||
// listView: { actions: [], deleteModalAdditionalInfos: [] },
|
||||
// },
|
||||
// isReady: true,
|
||||
// isRequired: pluginPkg.strapi.required || false,
|
||||
// name,
|
||||
// pluginLogo,
|
||||
// });
|
||||
},
|
||||
boot() {},
|
||||
// async registerTrads({ locales }) {
|
||||
// const importedTrads = await Promise.all(
|
||||
// locales.map(locale => {
|
||||
// return import(
|
||||
// /* webpackChunkName: "content-manager-translation-[request]" */ `./translations/${locale}.json`
|
||||
// )
|
||||
// .then(({ default: data }) => {
|
||||
// return {
|
||||
// data: prefixPluginTranslations(data, pluginId),
|
||||
// locale,
|
||||
// };
|
||||
// })
|
||||
// .catch(() => {
|
||||
// return {
|
||||
// data: {},
|
||||
// locale,
|
||||
// };
|
||||
// });
|
||||
// })
|
||||
// );
|
||||
|
||||
// return Promise.resolve(importedTrads);
|
||||
// },
|
||||
};
|
@ -4,9 +4,9 @@ import { get, isEmpty } from 'lodash';
|
||||
import moment from 'moment';
|
||||
import styled from 'styled-components';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { InjectionZone, useContentManagerEditViewDataManager } from '@strapi/helper-plugin';
|
||||
import { useContentManagerEditViewDataManager } from '@strapi/helper-plugin';
|
||||
import { InjectionZone } from '../../../shared/components';
|
||||
import { SubWrapper, StatusWrapper } from './components';
|
||||
import pluginId from '../../pluginId';
|
||||
import { getTrad } from '../../utils';
|
||||
|
||||
const BaselineAlignment = styled.div`
|
||||
@ -64,7 +64,7 @@ const InformationCard = () => {
|
||||
</Flex>
|
||||
</Padded>
|
||||
</Padded>
|
||||
<InjectionZone area={`${pluginId}.editView.informations`} />
|
||||
<InjectionZone area="contentManager.editView.informations" />
|
||||
</SubWrapper>
|
||||
<Padded top size="sm" />
|
||||
{hasDraftAndPublish && (
|
||||
|
@ -1,14 +1,9 @@
|
||||
import React, { memo, useCallback, useMemo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { get } from 'lodash';
|
||||
import {
|
||||
BaselineAlignment,
|
||||
InjectionZone,
|
||||
LiLink,
|
||||
CheckPermissions,
|
||||
useTracking,
|
||||
} from '@strapi/helper-plugin';
|
||||
import { BaselineAlignment, LiLink, CheckPermissions, useTracking } from '@strapi/helper-plugin';
|
||||
import { Padded } from '@buffetjs/core';
|
||||
import { InjectionZone } from '../../../shared/components';
|
||||
import pluginId from '../../pluginId';
|
||||
import pluginPermissions from '../../permissions';
|
||||
import Container from '../../components/Container';
|
||||
@ -252,7 +247,7 @@ const EditView = ({
|
||||
</CheckPermissions>
|
||||
)}
|
||||
{/* TODO add DOCUMENTATION */}
|
||||
<InjectionZone area={`${pluginId}.editView.right-links`} slug={slug} />
|
||||
<InjectionZone area="contentManager.editView.right-links" slug={slug} />
|
||||
|
||||
{allowedActions.canDelete && (
|
||||
<DeleteLink
|
||||
|
@ -1,57 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled from 'styled-components';
|
||||
import useInjectionZone from './useInjectionZone';
|
||||
|
||||
const List = styled.ul`
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
`;
|
||||
|
||||
const ListItem = styled.li`
|
||||
font-size: ${p => p.theme.main.sizes.fonts.md};
|
||||
|
||||
&:before {
|
||||
background: ${p => p.theme.main.colors.grey};
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
margin-left: -${p => p.theme.main.sizes.margins.sm};
|
||||
margin-top: 8px;
|
||||
}
|
||||
`;
|
||||
|
||||
const InjectionZoneList = ({ area, ...props }) => {
|
||||
const compos = useInjectionZone(area);
|
||||
|
||||
if (!compos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<List>
|
||||
{compos.map(compo => {
|
||||
const component = compo.Component(props);
|
||||
|
||||
if (component) {
|
||||
return (
|
||||
<ListItem key={compo.name}>
|
||||
<compo.Component {...props} />
|
||||
</ListItem>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
})}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
|
||||
InjectionZoneList.propTypes = {
|
||||
area: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default InjectionZoneList;
|
@ -1,2 +1 @@
|
||||
export { default as InjectionZone } from './InjectionZone';
|
||||
export { default as InjectionZoneList } from './InjectionZoneList';
|
||||
|
@ -85,24 +85,6 @@ export default {
|
||||
|
||||
const ctbPlugin = app.getPlugin('content-type-builder');
|
||||
|
||||
// FIXME
|
||||
const cmPlugin = app.getPlugin('content-manager');
|
||||
|
||||
if (cmPlugin) {
|
||||
// cmPlugin.injectComponent('editView', 'informations', {
|
||||
// name: 'i18n-locale-filter-edit-view',
|
||||
// Component: CMEditViewInjectedComponents,
|
||||
// });
|
||||
// cmPlugin.injectComponent('listView', 'actions', {
|
||||
// name: 'i18n-locale-filter',
|
||||
// Component: LocalePicker,
|
||||
// });
|
||||
// cmPlugin.injectComponent('listView', 'deleteModalAdditionalInfos', {
|
||||
// name: 'i18n-delete-bullets-in-modal',
|
||||
// Component: DeleteModalAdditionalInfos,
|
||||
// });
|
||||
}
|
||||
|
||||
if (ctbPlugin) {
|
||||
const ctbFormsAPI = ctbPlugin.apis.forms;
|
||||
ctbFormsAPI.addContentTypeSchemaMutation(mutateCTBContentTypeSchema);
|
||||
|
Loading…
x
Reference in New Issue
Block a user