Support

Account

Home Forums Gutenberg Switch to edit mode by default

Solved

Switch to edit mode by default

  • Hello.
    I can’t find any info on the net. Do you think it’s possible to switch the block to “Edit mode” by default? When it’s in “Preview mode”, if the block is empty, as it’s empty, the customer think it’s not working…

  • You might be looking for the mode option for acf_register_block?

    https://www.advancedcustomfields.com/resources/acf_register_block/

    It sets the block’s default display mode, either “edit” or “preview”.

    Using the supports option you can disable toggling between modes, too. So you could disable the preview mode entirely if you want.

  • Hi jnicol,
    could you please elaborate on how I would set the defualt mode to “edit” and then disable toggling between modes?
    Thank you,
    Pat

  • For future reference, as I hope that this question has been resolved in the mean time:

    acf_register_block_type(array(
     ...
     'mode'	=> 'edit',
     'supports' => array('mode' => false),
    ));

    When using these settings for a block, it will start in edit mode and the user won’t be able to switch.

  • Just an FYI if using ProxxiM’s solution be careful if adding this after the fact, as any blocks created and in the preview mode, will still be in preview mode and you won’t be able to change them back. For this reason it would be really nice if there was a forcemode option, as there are times you may modify an exsisting block to make it more customizable and not want it to have a preview mode anymore.

  • I think I’m in the opposite boat? I want blocks to be in Preview mode every time a post is loaded, even if the block was in edit mode last time it was saved…

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Switch to edit mode by default’ is closed to new replies.