跳到主要内容

injectContentManagerComponent() removed

In Strapi 5, the injectContentManagerComponent method is removed because the Content Manager is now a plugin. The Admin Panel API method is replaced by getPlugin('content-manager').injectComponent().

This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

🔌 Is this breaking change affecting plugins?Yes
🤖 Is this breaking change automatically handled by a codemod?No

Breaking change description

In Strapi v4

A component is injected into the Content Manager as follows:

app.injectContentManagerComponent('editView', 'right-links', {
name: 'PreviewButton',
Component: () => (
<Button onClick={() => window.alert('Not here, The preview is.')}>Preview</Button>
),
});

In Strapi 5

A component is injected into the Content Manager as follows:

app.getPlugin('content-manager').injectComponent('editView', 'right-links', {
name: 'PreviewButton',
Component: () => (
<Button onClick={() => window.alert('Not here, The preview is.')}>Preview</Button>
),
});

Migration steps

Change your plugin index.ts file from:

app.injectContentManagerComponent()

to the following:

app.getPlugin('content-manager').injectComponent()