admin管理员组文章数量:1430621
My immediate goal is to add a block type that's the same as an existing block type, except for the name. Then I can use CSS to style it appropriately. This would be used (via the block editor) by non-technical folks, so telling them to add a block of the initial type, then go to Advanced -> Additional CSS Class
is not a good idea. I've tried several ways to reach my goal, but come to a roadblock for each, so the question is: is there a simple way, or do I need to create a custom block type from scratch?
(Below attempts are hypothetically in PHP in a plugin, or in some simple JavaScript code.)
First, I thought there would something simple in the API that would directly do what I want. But I didn't see anything.
Then I thought I'd do it myself by getting some block type object, copying and modifying it, then giving that to registerBlockType
. But I couldn't find a function to get info about a block type.
Finally, I thought I'd create a block template out of some container block enclosing the block I wanted to base things off of. Again, CSS could easily be used to make the template look as I desired. But there don't seem to be any suitable container blocks.
The various approaches could be questions in their own right. As often is the case, it's hard to be sure of the best question granularity.
本文标签: How to make a block similar to another block
版权声明:本文标题:How to make a block similar to another block 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745468744a2659651.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论