尝试使用 Advanced block settings
选项卡中的设置构建自定义 block ,该选项卡在 RHS 的侧边栏中打开...
WordPress 的默认 block 似乎在那里有设置,但遗憾的是无法在任何地方找到它的文档...
任何指示都会非常有帮助!
最佳答案
更新 2018/08/16自从我最初写这篇文章以来,检查器控件链接似乎随着古腾堡的发展而移动。
粗略的想法是,您添加的所有内容都是 <InspectorControls>
的子项, 当用户关注您的 block 时,将出现在侧边栏中:
return (
<InspectorControls>
{/* Whatever is inside this block will be displayed on the sidebar */} .
</InspectorControls>
{/* Whatever is outside, will be displayed on the editor as usual */}
)
看看这篇文章以供引用:
我认为您正在寻找的是古腾堡的 InspectorControls .我从 lucasstark/gutenberg-gravityforms 找到了一个例子显示它们正在使用中。
通过古腾堡挖掘我发现了以下选项,但没有官方文档(最好的是 this )展示它们的用法:
-
InspectorControls.CheckboxControl
-
InspectorControls.RadioControl
-
InspectorControls.RangeControl
-
InspectorControls.SelectControl
-
InspectorControls.TextControl
-
InspectorControls.TextareaControl
希望对您有所帮助。
关于wordpress - 在高级 block 设置中添加字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48338664/