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
|
|
|
|
|
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-02-13 09:01:32 +01: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';
|
2020-02-24 15:45:00 +01:00
|
|
|
|
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
|
|
|
|
2020-01-23 16:46:50 +01:00
|
|
|
export default strapi => {
|
2020-03-02 15:18:08 +01:00
|
|
|
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
2020-06-09 12:05:59 +02:00
|
|
|
const icon = pluginPkg.strapi.icon;
|
|
|
|
const name = pluginPkg.strapi.name;
|
2020-01-23 16:46:50 +01:00
|
|
|
const plugin = {
|
|
|
|
blockerComponent: null,
|
|
|
|
blockerComponentProps: {},
|
|
|
|
description: pluginDescription,
|
2020-04-02 09:10:10 +02:00
|
|
|
fileModel: null,
|
2020-06-09 12:05:59 +02:00
|
|
|
icon,
|
2020-01-23 16:46:50 +01:00
|
|
|
id: pluginId,
|
2020-04-02 09:10:10 +02:00
|
|
|
initializer: Initializer,
|
2020-01-23 16:46:50 +01:00
|
|
|
injectedComponents: [],
|
2020-04-02 09:10:10 +02:00
|
|
|
isReady: false,
|
2020-02-28 11:40:55 +01:00
|
|
|
isRequired: pluginPkg.strapi.required || false,
|
2020-01-23 16:46:50 +01:00
|
|
|
layout: null,
|
2020-02-12 21:55:56 +01:00
|
|
|
lifecycles: null,
|
2020-01-23 16:46:50 +01:00
|
|
|
leftMenuLinks: [],
|
|
|
|
leftMenuSections: [],
|
2020-02-13 09:01:32 +01:00
|
|
|
mainComponent: App,
|
2020-06-09 12:05:59 +02:00
|
|
|
name,
|
2020-02-11 17:15:53 +01:00
|
|
|
pluginLogo,
|
2020-01-23 16:46:50 +01:00
|
|
|
preventComponentRendering: false,
|
2020-02-19 16:37:35 +01:00
|
|
|
settings: {
|
|
|
|
global: [
|
|
|
|
{
|
|
|
|
title: {
|
2020-02-27 09:53:50 +01:00
|
|
|
id: getTrad('plugin.name'),
|
2020-02-19 16:37:35 +01:00
|
|
|
defaultMessage: 'Media Library',
|
|
|
|
},
|
|
|
|
name: 'media-library',
|
|
|
|
to: `${strapi.settingsBaseURL}/media-library`,
|
2020-02-27 09:53:50 +01:00
|
|
|
Component: SettingsPage,
|
2020-06-09 12:58:06 +02:00
|
|
|
// TODO write documentation
|
|
|
|
permissions: [{ action: 'plugins::upload.settings.read', subject: null }],
|
2020-02-19 16:37:35 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-02-13 07:44:57 +01:00
|
|
|
trads,
|
2020-06-09 12:05:59 +02:00
|
|
|
menu: {
|
|
|
|
pluginsSectionLinks: [
|
|
|
|
{
|
|
|
|
destination: `/plugins/${pluginId}`,
|
|
|
|
icon,
|
|
|
|
label: {
|
|
|
|
id: `${pluginId}.plugin.name`,
|
|
|
|
defaultMessage: 'Media Library',
|
|
|
|
},
|
|
|
|
name,
|
|
|
|
permissions: [{ action: 'plugins::upload.read', subject: null }],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-01-23 16:46:50 +01:00
|
|
|
};
|
2019-04-16 18:23:26 +02:00
|
|
|
|
2020-04-09 15:06:27 +02:00
|
|
|
strapi.registerComponent({ name: 'media-library', Component: InputModalStepper });
|
2020-03-05 14:43:00 +01:00
|
|
|
strapi.registerField({ type: 'media', Component: InputMedia });
|
|
|
|
|
2020-01-23 16:46:50 +01:00
|
|
|
return strapi.registerPlugin(plugin);
|
2019-04-16 18:23:26 +02:00
|
|
|
};
|