amnestywebsite / humanity-theme

The Amnesty International WordPress Humanity Theme
https://wordpresstheme.amnesty.org/
Other
35 stars 9 forks source link

Add a transforms.to within the custom collapsable block #241

Closed Gentyspun closed 3 months ago

Gentyspun commented 3 months ago

Ref: https://github.com/amnestywebsite/humanity-theme/issues/229

Adds a transform.to to the JS block registration of the custom collapsable block to allow it to be changed to a core/details block while retaining the attributes and innerBlocks

Steps to test:

  1. Edit a post
  2. Add a collapsable block (This is now hidden from the block inserter so will need to be added via code editor )
  3. Save the post and refresh, now click the block icon in the block toolbar and notice Details appears in the transform options
  4. Click Details in the options and the collapsable block should change to a Details block while retaining all the content and attributes

Example: http://bigbite.im/v/vVSMnE