2020-03-06 13:33:07 +01:00
|
|
|
// 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
|
2020-06-15 12:36:57 +02:00
|
|
|
import React from 'react';
|
2021-04-29 13:51:12 +02:00
|
|
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
2019-04-16 18:23:26 +02:00
|
|
|
import pluginPkg from '../../package.json';
|
2020-02-11 17:15:53 +01:00
|
|
|
import pluginLogo from './assets/images/logo.svg';
|
2020-06-10 14:52:09 +02:00
|
|
|
import pluginPermissions from './permissions';
|
2020-06-18 17:29:45 +02:00
|
|
|
import App from './containers/App';
|
2020-04-02 09:10:10 +02:00
|
|
|
import Initializer from './containers/Initializer';
|
2020-02-27 09:53:50 +01:00
|
|
|
import SettingsPage from './containers/SettingsPage';
|
2020-03-03 16:40:02 +01:00
|
|
|
import InputMedia from './components/InputMedia';
|
2020-04-09 15:06:27 +02:00
|
|
|
import InputModalStepper from './containers/InputModalStepper';
|
2021-05-11 11:21:13 +02:00
|
|
|
import reducers from './reducers';
|
2020-02-13 07:44:57 +01:00
|
|
|
import trads from './translations';
|
2019-04-18 01:10:38 +02:00
|
|
|
import pluginId from './pluginId';
|
2020-03-16 13:37:10 +01:00
|
|
|
import { getTrad } from './utils';
|
2019-04-16 18:23:26 +02:00
|
|
|
|
2021-05-11 09:59:14 +02:00
|
|
|
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
|
|
|
const icon = pluginPkg.strapi.icon;
|
|
|
|
const name = pluginPkg.strapi.name;
|
2020-06-09 15:01:35 +02:00
|
|
|
|
2021-05-11 09:59:14 +02:00
|
|
|
export default {
|
|
|
|
register(app) {
|
|
|
|
app.componentApi.registerComponent({ name: 'media-library', Component: InputModalStepper });
|
|
|
|
app.fieldApi.registerField({ type: 'media', Component: InputMedia });
|
2021-05-11 15:53:54 +02:00
|
|
|
app.reducers.add(reducers);
|
2021-05-11 09:59:14 +02:00
|
|
|
|
|
|
|
app.registerPlugin({
|
|
|
|
description: pluginDescription,
|
|
|
|
icon,
|
|
|
|
id: pluginId,
|
|
|
|
initializer: Initializer,
|
|
|
|
|
|
|
|
isReady: false,
|
|
|
|
isRequired: pluginPkg.strapi.required || false,
|
|
|
|
|
|
|
|
mainComponent: App,
|
|
|
|
name,
|
|
|
|
pluginLogo,
|
|
|
|
preventComponentRendering: false,
|
|
|
|
settings: {
|
|
|
|
global: {
|
|
|
|
links: [
|
|
|
|
{
|
|
|
|
title: {
|
|
|
|
id: getTrad('plugin.name'),
|
|
|
|
defaultMessage: 'Media Library',
|
|
|
|
},
|
|
|
|
name: 'media-library',
|
|
|
|
to: '/settings/media-library',
|
|
|
|
Component: () => (
|
|
|
|
<CheckPagePermissions permissions={pluginPermissions.settings}>
|
|
|
|
<SettingsPage />
|
|
|
|
</CheckPagePermissions>
|
|
|
|
),
|
|
|
|
permissions: pluginPermissions.settings,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
trads,
|
|
|
|
menu: {
|
|
|
|
pluginsSectionLinks: [
|
2020-06-09 15:01:35 +02:00
|
|
|
{
|
2021-05-11 09:59:14 +02:00
|
|
|
destination: `/plugins/${pluginId}`,
|
|
|
|
icon,
|
|
|
|
label: {
|
|
|
|
id: `${pluginId}.plugin.name`,
|
2020-06-09 15:01:35 +02:00
|
|
|
defaultMessage: 'Media Library',
|
|
|
|
},
|
2021-05-11 09:59:14 +02:00
|
|
|
name,
|
|
|
|
permissions: pluginPermissions.main,
|
2020-02-19 16:37:35 +01:00
|
|
|
},
|
2020-06-09 15:01:35 +02:00
|
|
|
],
|
|
|
|
},
|
2021-05-11 09:59:14 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
boot() {},
|
|
|
|
};
|