Controlling the RichText component outside of blocks
Controlling the RichText component outside of blocks
Controlling the RichText component outside of blocks
how define elements type in attributes type array of gutenberg blocks
Thank you all for your help! I was on it since days! I found my problem: https://webpack.js.org/concepts/entry-points/ helped me to find the solution Apparently path.resolve( process.cwd(), ‘src’, ‘slider.js’ ) was not working: replacing by simple string path fixed the problem: const defaultConfig = require( ‘@wordpress/scripts/config/webpack.config’ ); module.exports = { …defaultConfig, entry: { …defaultConfig.entry, slider: ‘./src/slider.js’, … Read more
It’s worth a mention that storing child block attributes in the parent block’s attributes is a bit of a bizarre practice in isolation – ideally blocks should be completely independent of one-another. But if some functionality necessitates that a parent block access a child block’s attributes, it would likely have a much smaller potential for … Read more
You can’t use attributes that source data from the HTML markup of your block when using Dynamic Blocks. The attribute selector looks at the Save function’s HTML for the attribute, not the Edit function. You can simply use a type: ‘string’ instead. Hope this helps!
there’s a layout option for the post content block that says it will inherit the default layout. Where is that default coming from? In block themes, the default layout settings (contentSize and wideSize) can be found in the theme.json file in the root theme folder, e.g. at wp-content/themes/twentytwentytwo/theme.json in Twenty Twenty-Two. See source on GitHub … Read more
WordPress does NOT provide date picker block by default but have date component inside core. You need to call relevant components for date picker to work. Here’s code from core Date Component import { DateTimePicker } from ‘@wordpress/components’; import { getSettings } from ‘@wordpress/date’; import { withState } from ‘@wordpress/compose’; const MyDateTimePicker = withState( { … Read more
On the new WordPress 5.0 update, I was able to switch between the classic editor & Gutenberg without installing the “Disable Gutenberg” extension. Looking at the release notes for the “Disable Gutenberg” plugin, it states: “Do not use Disable Gutenberg with other plugins (like the Classic Editor plugin) that also disable or replace Gutenberg. Why? … Read more
Ideally, yes. Blocks are supposed to be WYSIWYG. See the Editor Styles section of the Gutenberg Handbook for how to load theme styles in the editor. You need to add an editor stylesheet with add_editor_style(), the same way you did with the previous editor, but to support the block editor you need to declare theme … Read more
You are creating the MySelectControl component but it is not being used inside the edit function/component. Include it there and it should appear. If you want it to appear in the settings sidebar, rather than in the editor, simply wrap the component inside the inspector-controls component (from the package @wordpress/editor): <InspectorControls> <MySelectControl /> </InspectorControls>