Issues with pasting a block from clipboard

Permalink 4 users found helpful
When I paste my custom block from clipboard, it does copies the block but it does not seem functional. Do I need to use duplicate() function in my controller to get this to work properly? Can someone give me an example of using duplicate() function?

BlueFractals
 
Sadu replied on at Permalink Reply
Sadu
One small thing I have noticed is that when you duplicate a block via the clipboard, they both end up with the same Block ID (bID).

This can be a problem if you use that bID for anything important - such as a DOM ID which has javascript attached to it.

Something to check anyway.
JohntheFish replied on at Permalink Reply
JohntheFish
As Sadu says, the common bID can cause some blocks to have issues. The easiest work round is to edit/save one or other of the blocks. This creates a new version with a new bID.
BlueFractals replied on at Permalink Reply
BlueFractals
Can this be considered a bug then?
Yes I am using bID in DOM so that each block within the same page can be styled individually.

I also manually tried to edit/save one of the blocks. This is what I noticed:
- Original block (Block A) copied to the clipboard.
- New block (Block B) pasted from the clipboard.
- Block A works but Block B does not.
- Block B edited and saved.
- Now Block B works but Block A does not.
- Edited and saved Block A but no effect.
- Removed Block B and Block A starts working again.

The duplicate() function in the controller can do nothing for this? I am not currently using this function as I am not sure how to use this function.