editPost without undo entry

Yes, editPost is a wrapper around editEntityRecord which according to the core/data docs takes an options object that supports undoIgnore: options Object: Options for the edit. options.undoIgnore [boolean]: Whether to ignore the edit in undo history or not. While you could use this, generally the need to use it implies a mistake or misunderstanding somewhere, … Read more

How to use useSelect to retrieve the currently default fontFamily?

It turns out that it wasn’t really needed to find the default font as an empty string is interpreted as the default font. I just did it this way: <FontFamilyControl> value={ buttonFontFamily || ” } onChange={ ( newFontFamily ) => { setAttributes({ buttonFontFamily: newFontFamily }) } } </FontFamilyControl> Another important thing to notice here is … Read more

Avoid automatic scroll jump when dragging a resize handle in a Gutenberg block

Apparently, this is the standard behavior of the library on which the ResizableBox component is based: https://github.com/bokuweb/re-resizable/issues/727 To fix my issue I had to add the following code to my block: import {useRef} from ‘@wordpress/element’; // Refs used to retain block’s scroll position while dragging the resize handle. const parentScrollOffsetX = useRef(0) const parentScrollOffsetY = … Read more