admin管理员组

文章数量:1130349

How do I modify a core block, in my case gallery block to add extra markup to can fire some lightbox on created gallery. Is there a way to hook in on render of gallery on frontpage to adjust markup?

How do I modify a core block, in my case gallery block to add extra markup to can fire some lightbox on created gallery. Is there a way to hook in on render of gallery on frontpage to adjust markup?

Share Improve this question asked Jan 5, 2019 at 18:09 fefefefe 8943 gold badges14 silver badges34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 5

You need to use Block Filters to modify existing blocks. There are couple of handy hooks you need to use in place of edit and save function to wrap around core blocks into your desirable block structure.

For your purpose I guess, you need to use - blocks.getSaveElement and editor.BlockEdit

How do I modify a core block, in my case gallery block to add extra markup to can fire some lightbox on created gallery. Is there a way to hook in on render of gallery on frontpage to adjust markup?

How do I modify a core block, in my case gallery block to add extra markup to can fire some lightbox on created gallery. Is there a way to hook in on render of gallery on frontpage to adjust markup?

Share Improve this question asked Jan 5, 2019 at 18:09 fefefefe 8943 gold badges14 silver badges34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 5

You need to use Block Filters to modify existing blocks. There are couple of handy hooks you need to use in place of edit and save function to wrap around core blocks into your desirable block structure.

For your purpose I guess, you need to use - blocks.getSaveElement and editor.BlockEdit

本文标签: customizationGutenberg extend core blocks