@drozd-red/strapi-plugin-copy-any-component
v1.1.2
Published
A powerful Strapi plugin that allows you to copy and reorder components (sections) between pages using an intuitive drag-and-drop interface. Works with any content type and dynamic zone - no code required!
Downloads
216
Readme
Copy Any Component (Strapi v5)
This Strapi Admin plugin allows you to:
- copy components between entries;
- move blocks with drag-and-drop;
- reorder blocks inside the target entry;
- save changes as draft (without auto-publish);
- work with locales and dynamic zones
blocks/content.
Requirements
- Node.js
>=18 - Strapi v5
- React 18 in Strapi Admin
For local development, make sure these packages are available in your backend project:
@strapi/design-system@strapi/icons
Plugin structure
Key files:
strapi-server.js- plugin server side (bootstrap, routes, controllers)strapi-admin.js- plugin admin entry pointadmin/src/*- plugin admin UIserver/src/services/advanced-controller.js- main copy/validation logicserver/src/services/component-copy.js- legacy service (compatibility)
Enable in current project (local resolve mode)
backend/config/plugins.ts:
export default () => ({
"copy-any-component": {
enabled: true,
resolve: "./src/plugins/copy-any-component",
},
});Enable as an npm package
After publishing to npm:
- Install the package in
backend:
pnpm add @drozd-red/strapi-plugin-copy-any-component- Update
backend/config/plugins.ts:
export default () => ({
"copy-any-component": {
enabled: true,
config: {
// optional initial values
// contentType: "api::page.page",
// dynamicZoneField: "blocks",
},
},
});- Restart Strapi:
pnpm developSave and publish behavior
- The plugin updates sections in the target entry.
- The plugin publish endpoint intentionally returns success with
skippedPublish: true. - This means the entry stays in draft/modified state until you publish it manually in Content Manager.
Constraints and validation
- Only
blocksandcontentzones are allowed. - Component compatibility is validated:
blocks-> component uid must start withepic.content-> component uid must start withcontent-blocks.
- The plugin removes component system fields (
id,documentId,createdAt, etc.) before saving.
Plugin endpoints
Admin routes:
GET /copy-any-component/content-typesPUT /copy-any-component/configGET /copy-any-component/pagesGET /copy-any-component/pages/:pageId/sectionsPOST /copy-any-component/pages/:sourcePageId/copy-to/:targetPageIdPUT /copy-any-component/pages/:pageId/sectionsPOST /copy-any-component/pages/:pageId/publish
Troubleshooting
Failed to fetch dynamically imported module ... HomePage.tsx
Check that:
- you use the current
strapi-admin.jswithout.tsextension imports; @strapi/design-systemand@strapi/iconsare installed inbackend;- you fully restarted Strapi after changes (
pnpm develop).
Out of memory during strapi build
Increase Node.js memory:
$env:NODE_OPTIONS="--max-old-space-size=6144"; pnpm buildLicense
MIT
