admin管理员组文章数量:1323330
currently i am developing a block and i am trying to use an experimental API __experimentalCaptureChildToolbar
(see ). This should be included in 7.2.0 of Gutenberg. It seems however unable to really tell which version is included in Wordpress (What version of Gutenberg is included with WordPress?) but i am using Wordpress 5.5.1 so it should be fine.
I was trying to simply use it like done one the navigation block, .2/packages/block-library/src/navigation/edit.js. However it did not change anything.
I am not sure how the navigation block works (and if) as it is also experimental, from what i can see. I could not get any documentation or information via Google on how to turn on those experimental blocks. Can anybody help?
From what the documentation and all the sparse info i could find on the web on __experimentalCaptureChildToolbar
is it should be easy to just use it. Anybody has any guidance on how to use or has implemented it him-/herself?
Thank you.
P.S: There's not much to the code than adding the attribute
edit: function( props) {
...
return (
<>
<Toolbar>...</Toolbar>
<InnerBlocks
template={ slidesTemplate }
templateLock="all"
allowedBlocks={ allowedBlocks }
__experimentalCaptureToolbars={ true }
/>
</>
);
}
currently i am developing a block and i am trying to use an experimental API __experimentalCaptureChildToolbar
(see https://github/WordPress/gutenberg/pull/18440). This should be included in 7.2.0 of Gutenberg. It seems however unable to really tell which version is included in Wordpress (What version of Gutenberg is included with WordPress?) but i am using Wordpress 5.5.1 so it should be fine.
I was trying to simply use it like done one the navigation block, https://github/WordPress/gutenberg/blob/7.2/packages/block-library/src/navigation/edit.js. However it did not change anything.
I am not sure how the navigation block works (and if) as it is also experimental, from what i can see. I could not get any documentation or information via Google on how to turn on those experimental blocks. Can anybody help?
From what the documentation and all the sparse info i could find on the web on __experimentalCaptureChildToolbar
is it should be easy to just use it. Anybody has any guidance on how to use or has implemented it him-/herself?
Thank you.
P.S: There's not much to the code than adding the attribute
edit: function( props) {
...
return (
<>
<Toolbar>...</Toolbar>
<InnerBlocks
template={ slidesTemplate }
templateLock="all"
allowedBlocks={ allowedBlocks }
__experimentalCaptureToolbars={ true }
/>
</>
);
}
Share
Improve this question
asked Sep 3, 2020 at 8:46
patmanpatman
1111 bronze badge
2
|
1 Answer
Reset to default 1https://github/WordPress/gutenberg/blob/2d7e6904cee90a92bf1fc60467d1c6bb03654656/packages/block-editor/src/components/inner-blocks/README.md#__experimentalcapturetoolbars
Determines whether the toolbars of all child Blocks (applied deeply, recursive) should have their toolbars "captured" and shown on the Block which is consuming InnerBlocks.
For example, a button block, deeply nested in several levels of block X that utilises this property will see the button block's toolbar displayed on block X's toolbar area.
That seems to be it, a true
or false
value, there are no other ways to use it.
Note, that as an experimental API, this prop will not be available in the future, either because it was removed, or because it's no longer experimental and is renamed. I strongly advise against using it in production code for that reason.
Additionally, because it is experimental, that is not a guarantee that it will work, afterall, it's experimental code.
本文标签: block editorHow to use experimentalCaptureChildToolbar
版权声明:本文标题:block editor - How to use __experimentalCaptureChildToolbar 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742139593a2422523.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
has-toolbar-captured
which from what i can see is not used while the toolbars are active. – patman Commented Sep 4, 2020 at 15:19