• I was wondering if this possible either with the Free or Pro versions? I have implemented something similar to some of my block plugins, to either reset the current block to defaults or all the available blocks on the pages.

    const resetAllBlockAttributes = ( blocks ) => {
    
    ? blocks.forEach( block => {
    
    ? ? dispatch( 'core/block-editor' ).updateBlockAttributes( block.clientId, {
    
    ? ? ? fontFamily: '',
    
    ? ? ? fontWeight: '',
    
    ? ? ? fontStyle: '',
    
    ? ? } );
    
    ? ? if ( block.innerBlocks.length > 0 ) {
    
    ? ? ? resetAllBlockAttributes( block.innerBlocks );
    
    ? ? }
    
    ? } );
    
    };

    This will be nice to have if you want to start with default values that are coming either from the Customizer or not set at all.

    Not sure if that’s possible with your plugin but it will save me a lot of clicks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible to reset all the blocks to their defaults?’ is closed to new replies.