Support » Plugin: Gutenberg » Gutenberg does not play nicely with code editor

  • Resolved nelsonbase

    (@nelsonbase)


    I do all of my work in the code editor and rely on what i write remaining as i wrote it. Unfortunately Gutenberg takes a lot of liberties with it, removing whitespace that is important for readability and inserting it’s own stuff to keep track of blocks. The first problem makes it quite difficult to work with the new editor.

    It looks like the ability to add media from the code editor has been removed, so i have to switch to the visual editor just to do this. In the visual editor it’s pretty confusing and time-consuming because you can only add an image at the bottom of existing code, not in the middle – so after adding an image i then have to switch back into the code editor and move the image to where i want it.

    Unfortunately, when i switch to the visual editor then back to the code editor, the formatting of my content gets changed – whitespace is removed and comments are added. This also happens whenever the post is saved in the code editor. I’m definitely not happy with this new “feature” and prefer the old way, which does not change what i write.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter nelsonbase

    (@nelsonbase)

    More… I just tried putting the code into a custom HTML block and it remains as i put it, without getting changed by the editor. Maybe if the editor is set to the code editor the default block type could be custom HTML instead of Classic? Something to think about.

    Something is quirky here though, because after i’ve created some code in a custom HTML block, if i remove the block tags then the block reverts to Classic, and after that my code does not get modified when saving of switching between code and visual. Not very consistent behavior.

    Moderator Marius L. J.

    (@clorith)

    Hi,

    We’ll not be changing the default editor, since the idea is backwards compatibility and putting it into the classic block is perfect for this.

    The reason it converts to classic is because the block tags are what tells Gutenberg that this is a block made in Gutenberg. If there are no block tags, it reads it as coming from the classic editor and pops it into the classic block for backwards compatibility.

    Basically, editing out the block “wrappers” will cause weird behavior that we honestly can not account for beyond reverting to the classic block and hoping all goes well (as block content is not always usable in the classic editor this may lead to unexpected behaviors).

    Thread Starter nelsonbase

    (@nelsonbase)

    Hi Marius –

    I think the general concept of using a classic editor block as the default is a good one, but the implementation is less than ideal. There would probably be a lot fewer complaints if all the functionality of the classic editor (with some exceptions) remained available when it’s being used in a block – notably the ability to insert images (including in the code editor).

    Having GB block wrappers show up in the code editor is not a show stopper, but losing whitespace creates a significant usability problem.

    I’m not happy with the current state of Gutenberg because it gets hugely in the way of productivity. What it would take for me to adopt it is for all of the current functionality of the classic editor to remain available and for blocks to be optionally available as extra functionality for quickly creating more complex content – using Gutenberg only as a content templating system and not trying to shoehorn traditional word processing functionality into blocks.

    For me the concept of using a block to basically just create an HTML tag is ridiculously dysfunctional. Using blocks for headings, paragraphs, blockquotes, and lists is overkill and inferior to traditional ways of inserting such content.

    There may be a good case for using image blocks because it makes possible separate instances of image meta data like captions, but removing word-processor-style image insertion breaks backward compatiility.

    I concede however that it may be better functionality to create and manipulate compound tags like tables using blocks.

    Moderator Marius L. J.

    (@clorith)

    What whitespace-loss are you referring to? The classic block should not lose anything, and should ideally be a straight 1-to-1 representation of what you have today, so if there’s anything lost in that transition that’s something we’ll want to look into of course.

    Thread Starter nelsonbase

    (@nelsonbase)

    Here’s how you can reproduce what i’m talking about.

    Open up the Sample Page in Gutenberg. Switch to the code editor. Insert blank lines between the paragraphs and blockquotes. I always put space between blocks to make it easier to read when i’m editing.

    Now simply click the preview or update button and watch that space get removed.

    Moderator Marius L. J.

    (@clorith)

    Got’cha.

    So that’s part of the cleanup process that runs automatically to prevent any invalid parsing when there’s non-standard content between blocks, I’m not sure if we’ll be making any modifications to this behavior, but I’ve at least mentioned the concern to the developers 🙂

    I’m adding on here since the last point discussed about “whitespace” is an issue I’m currently dealing with. Within the Classic Block, when the contents contain paragraphs with non-breaking spaces in them, the (let’s call them) spacer paragraphs are retained when Gutenberg is initially activated (and original contents are converted to a Classic Block). However once you edit the Classic Block (not even converting to Gutenberg Blocks) the spacer paragraphs are wiped out. This drastically collapses pages where lots of these spacer paragraphs exist (ex. <p>&nbsp;</p>. There is no way to edit the original contents and retain the original spacing without converting to blocks and adding spacer blocks.

    Moderator Marius L. J.

    (@clorith)

    Hiya @clenfert,

    This is another users topic, and it is now more than 2 months old, please create your own topic as per the Forum Guidelines, so that we don’t overburden the original poster with notifications 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Gutenberg does not play nicely with code editor’ is closed to new replies.