Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

content-copy

Adds Dynamic Zone clipboard actions for the sections field in Content Manager.

Admin usage

  • In Content Manager edit view, the sections field shows a clipboard icon near the label.
  • Open the clipboard panel to copy a block or paste it (replace/insert/append).

Clipboard storage key:

content-copy:clipboard

Payload shape:

{
  kind: "dz-block",
  component: "blocks.hero-main",
  data: { ... },
  ts: 1730000000000,
  source: {
    uid: "api::page.page",
    entryId: "documentId-or-id",
    field: "sections",
    index: 0
  }
}

API

POST /content-copy/dz/apply

{
  "uid": "api::page.page",
  "entryId": "documentId-or-id",
  "field": "sections",
  "operation": "replace",
  "index": 0,
  "locale": "en",
  "clipboard": {
    "kind": "dz-block",
    "component": "blocks.404",
    "data": {
      "title": "Pasted"
    },
    "ts": 1730000000000,
    "source": {
      "uid": "api::page.page",
      "entryId": "documentId-or-id",
      "field": "sections",
      "index": 0
    }
  }
}

Response:

{
  "data": {
    "uid": "api::page.page",
    "entryId": "documentId-or-id",
    "field": "sections",
    "locale": "en",
    "sections": [ ... ]
  }
}

POST /content-copy/dz/preview

Same payload as /dz/apply, but does not persist changes. Returns the computed sections array.

Install in another project

Option A: Git subtree (recommended)

From the target project backend/:

git subtree add --prefix=src/plugins/content-copy git@github.com:YOUR_USER/content-copy-plugin.git main --squash

Option B: Copy the folder

Copy src/plugins/content-copy into the target project at the same path.

Enable the plugin

Update config/plugins.js:

'content-copy': {
  enabled: true,
  resolve: './src/plugins/content-copy',
},

Build

Run:

npm run build

Notes

  • Only the sections dynamic zone is supported.
  • Clipboard data is normalized on copy (system keys removed, media objects to IDs).
  • For i18n, pass locale to target the active locale.

About

Strapi plugin for copy dynamic zone blocks

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages