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.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.