import Intro from '/docs/snippets/breaking-change-page-intro.md'
import MigrationIntro from '/docs/snippets/breaking-change-page-migration-intro.md'
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().
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()