Support » Fixing WordPress » Can you use Gutenberg blocks w/o the Visual Editor?

  • Resolved bpc

    (@bpc)


    I’ve avoided the WP Visual Editor like the plague for years because of its nasty habit of messing up coded content.

    I’d like to take advantage of some of the features of Gutenberg blocks, but I really want to stay as far away as possible from the Visual Editor.

    Is the VE required for all Gutenberg features?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    I’m not sure what you mean by “the visusal editor” in this context. The classic editor had two modes, ‘visual’ and ‘text’. The block editor (gutenberg) has its own modes. Please explain. Have you installed the Classic Editor plugin or are you using a version of WP less than 5?

    Thread Starter bpc

    (@bpc)

    I’m using WP 5.4.2. I have the Classic Editor plug-in installed, with the option of using either it or Gutenberg.

    However, IIRC, you can’t actually do anything in Gutenberg without activating the visual editor, which I still view with the greatest suspicion. Once burned…

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    The Block Editor replaces the Classic Editor. It’s a visual thing, though you can use HTML blocks or put it in a code mode. I suggest you spend a little time getting used to it because, well, it’s not going away.

    Thread Starter bpc

    (@bpc)

    I have a long list of hand-coded pages in this site, and no desire to break or redo any of them.

    I can remember the Visual Editor florfing coded pages, and don’t want to go through that again. If I use Gutenberg on this site, it will be for only a few pages on which I’m attempting to achieve a specific look.

    If you’re running the Classic Editor plug-in and enable the Visual Editor, you’re in the mode I’m describing.

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    You cannot use the classic editor and the block editor on the same page/post, but you can use a classic block on a block editor page.

    Again, the die is cast, the Rubicon is crossed … WordPress will be increasingly built on blocks moving forward, so it’s time to adapt your workflow.

    Thread Starter bpc

    (@bpc)

    I’m not looking for guidance on future methodology, Steven, and yes, I see the handwriting on the proverbial wall. I’m just trying to find out if I have to enable the clunky Visual Editor to use Gutenberg on a specific page or two.

    I realize you can’t use the Classic Editor and Gutenberg on the same page. I’m trying to find out if I have to use the Visual Editor version of the Classic Editor on all the pages I don’t let Gutenberg near.

    Joy

    (@joyously)

    I hadn’t tried it before, but if you configure your site as
    – no Classic Editor plugin
    – user profile has Visual editor disabled
    then editing a page shows your the HTML in a textarea where you can edit, but none of the tools for inserting new blocks works. You can edit what is there, though. I think the parsing is turned off also, because I tried adding id="first" to a paragraph and it let me, which it usually doesn’t, but it also added another <p></p> wrapper on it, making it invalid HTML. I suppose I should open an issue for this.

    If I switch my configuration to
    – Classic Editor plugin, set to let the user choose which editor to use
    – user profile has Visual editor enabled
    I can edit a post that contains blocks with the Classic editor and change things in Text mode as expected. But I’m pretty sure that changes I make will cause parsing errors when rendering on the front end, because the parser is so strict. As long as there are any block markup comments in the post, it will be processed as blocks, and they don’t like a mixture of blocks and HTML. That’s why there is a Classic block and Custom HTML block. (seems like a weird limitation to me)
    But this is the opposite of what you are asking about. I can use Classic on blocks, with potential problems. The Classic editor remembers my Visual or Text mode selection from last edit, so that’s not a problem.
    If I open something in the block editor, it does default to Visual. Switching to Code mode, again I can edit what is there, but the tools to add blocks don’t work. But when I got out and back in, the choice of Code or Visual was the same as when I left, so at least that is consistent.

    The third mode, only in the block editor, is when you are in Visual mode, but use the toolbar on the block to Edit HTML. But this invokes the parser again, so you are limited in what you can do.
    Edit: I forgot to add, if you leave the block editor in Visual mode, and edit the same post in Classic, it opens in the mode you left (which in my case was Text mode), so they are saved as two separate things.

    • This reply was modified 1 year ago by Joy.
    Thread Starter bpc

    (@bpc)

    Thanks, Joy. That’s very helpful.

    It’s starting to look as if I have to enable the Visual Editor to be able to use Gutenberg on any pages at all, which means that the Classic Editor will be in Visual mode on all the other pages.

    Visual Editor used to strip out code, and otherwise mess up pages from the TinyMCE, so I have avoided it. But I don’t want to have to resort to a page builder just to put a few blocks of content side by side with some art.

    Ech. Fun.

    Joy

    (@joyously)

    Visual editor still does mess up HTML. But you can use Classic without disabling it in the user profile. At least, if you are careful to never click on Visual. Simply enable it in the profile, edit an empty page and click on Text mode. Then you can leave the post. Every post you edit with Classic should still be in Text mode since that’s the way you left it. And you can go into block editor in Visual mode. It’s got a separate toggle (saved separately from Classic).
    The thing I didn’t try was whether a Classic block switch from Visual to Text affects the main Classic editor.
    If you don’t have a test site, you can try these things in a sandbox: https://wpsandbox.net/

    Thread Starter bpc

    (@bpc)

    Thank you for the comprehensive answer to my question! I really appreciate it.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    For future reference, the new “visual editor” has some better protections around custom code that you may want to learn about.

    Specifically, the editor is now made of blocks. Whereas with the classic editor, you were all-in on switching to the Visual editor or not, with the block editor, you can keep specific blocks separated.

    One of the blocks is called the “Custom HTML” block, and it does more or less what you would expect. You can put in whatever HTML you like into that block, and you get exactly what is there. The editor doesn’t screw with it at all. This means that you can mix some of the blocks that you want to be visually edited with other blocks where you want your custom HTML code, and they don’t touch one another. You can even reorder them and such.

    Additionally, any block can be switched into Custom HTML mode (though not necessarily switched back if you go on to edit it). A block is just a user interface, made in javascript, that produces HTML. The classic editor can be thought of as a single block in this respect. The whole thing was in visual or code mode. With blocks, each block is separate, and can be whatever type of block it is… or a custom HTML block with no more interface than a text box.

    TLDR: Your question doesn’t make a lot of sense because you’re not thinking with blocks yet. Some of the terminology is still there (Visual Editor, Code editor, etc), but the point of blocks is that you never really need to switch out of “visual” mode. Everything is accessible from there directly.

    Thread Starter bpc

    (@bpc)

    The minute you click on the check box to make the Visual Editor active, which you apparently have to do if you want to use any of Gutenberg’s features when you use it to edit a page, then Classic Editor uses the “oldstyle” Visual Editor. I see the typeface switch to Georgia and I know it’s active.

    Apparently, one can edit a page/post with Gutenberg even without switching on that check box, but one will be unable to add blocks or otherwise alter the page without switching on that check box. That’s why I’ve avoided Gutenberg heretofore.

    That would mean subjecting Classic Editor pages to the Visual Editor’s vagaries if I had to add a word here or there, simply because the Visual Editor was active.

    Thread Starter bpc

    (@bpc)

    I was going to add a screen shot, but apparently cannot.

    The check box in question appears on the WP Profile page:
    Visual Editor (Disable the visual editor when writing)

    If the checkbox is inactive, the VE alters, if not takes over, the display of Classic Editor pages.

    If the checkbox is activated, you can use the Gutenberg editor but you cannot actually add/edit anything.

    Catch-22

    • This reply was modified 1 year ago by bpc. Reason: ETA clarification of check box
    • This reply was modified 1 year ago by bpc.
    Joy

    (@joyously)

    You can link to screenshots wherever you want to store them. I use postimage.org.

    It’s not a Catch-22, though. As I said, you can enable the visual editor in the profile and edit a new post using Classic. It will likely be in Visual mode. Switch to Text mode, and get out. Try another to make sure it’s still in Text mode. Then you can edit any of your existing posts without affecting them. And the block editor will be in Visual mode, which means you can add blocks, because in Text mode you can’t.

    Be aware that the block editor shows the Custom HTML block in an iframe and there is no interface for the theme to style it, so it won’t be styled at all. But it won’t be in an iframe on the front end, so the Preview button will show the true look of it.

    Thread Starter bpc

    (@bpc)

    When you say “Switch to Text mode, and get out,” where’s the option to switch?

    That’s the one thing I’m missing.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Can you use Gutenberg blocks w/o the Visual Editor?’ is closed to new replies.