Add a way to modify what happens when you duplicate a block #35755
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
When you duplicate a block it copies over 1to1 all the attributes and nested blocks. Which is exactly what it should do in 99% of cases. But when you for example duplicate a block that has a custom anchor set for your block that now causes an issue since the
id
attribute no longer is unique and you have multiple elements on the page that share the same ID.This is a problem every time you need to store a unique identified in a block.
What is your proposed solution?
Like the
migration
callback function you can define for block depreciation it would be cool to add something similar to block duplication that allows you to override the behavior of core.Alternatively, a hook that fires inside the cloning process would also solve the problem and would also work for things like the core anchor support.
The text was updated successfully, but these errors were encountered: