-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the Code Editor #17017
Comments
Thanks for exploring this @mapk. I have a few thoughts based on this. What we have now for editing is very minimal and a starting point to iterate from. That said, I think there needs to be a conversation about what that iteration needs to be. Editing code is something ideally there would be less need for, unless that person chose. One part of this is really if more have to edit code then there's a deeper problem. That said, having an experience for those that want to edit is also something to weigh up. A minimal iteration for me would be:
I am not totally convinced in making it look like the old editor and full width. I think having it still be 'of the block' makes a lot of sense as long lines even of code are hard to read anyway. For some of your extra points like dark mode and checkboxes in tab, I think that could be where we have to review if a plugin territory or something to really be of us too lots of people, across range. Totally worth digging into to see if that's case. |
Some syntax highlighting discussion here: #10423 |
I don't think syntax highlighting is needed, but I would like to see the simple button toolbar for bold and italic and links (similar to this editor or the Classic editor HTML mode), so small things can be done while in HTML mode via the toolbar. Also important is the selection maintaining from one view to the other. |
I think this is a really cool idea!
|
Not willing to repeat all the lengthy discussion from https://core.trac.wordpress.org/ticket/12423 but syntax highlighters were extensively tested for accessibility and they're not accessible. The accessibility team is not opposed to a block with syntax highlighting or to an Editor mode with syntax highlighting but in the latter case there should be three Editor modes:
The need for a normal textarea is fundamental, as for some users it's the only accessible way to edit content and actually publish on the web. |
Related: #10423 |
@joyously, I'm not opposed to this. It would be like using the Top Toolbar option in the visual editor. But I'm also okay with not having anything like that included.
@noisysocks, "Decisions, not options!" I get bit with that one all the time. If we can make syntax highlighting accessible, I'm all for defaulting it on. While I'm not for introducing three editor modes as @afercia mentions, he does bring up some good points to consider.
Yep, completely agree. I was just getting excited about the possibilities.
Well that button really feel arbitrarily placed there inside the editor. I'd like to find another home for it.
I'm okay with this because that's HTML that I didn't have to write. Sure I now need to add the |
Agreeing with @afercia there is a clear value in having three editors. The code editor isn't the same as "plain text" as we can enhance the view while maintaining the structural integrity of posts. It becomes another block list of Elements but instead of visual direct-manipulation blocks we get a generalized block supporting every block and that gives us the ability to edit the insides of the block content. That's probably poorly worded. What we would love to avoid is allowing for partial updates to the "source code" of a Gutenberg page. That is, we should never have an autosave or update including, for example, So imagine a different view of the block editor that showed you the block name, JSON attributes, and content of the blocks and was focused on making quicker text edits to the structural elements. However, instead of treating everything as text we make some special behaviors for adding, changing, and manipulating the block structure. This would be akin to the dev tools HTML inspector which lets you click into an HTML tag and change its name, click into the attributes and change their values, and edit the |
Not opposed to alternative editors whether they're atomic, non-atomic, whatever. From an accessibility perspective, noting again the request is to have a native
Hiding the HTML blob behind one more UI doesn't solve the architectural issue and doesn't solve the accessibility issue. Just gives us a textarea please. |
@afercia that's all fine. my response was to the original issue post discussing how to make the code view better for people wanting to mangle more HTML and CSS directly. keeping a plain-text and accessible view is great; it will always belong. what we have currently is the worst of both worlds: we allow non-atomic updates and it's not accessible. I'm just coming in and acknowledging that this view is a different render of the post and has different needs which can go beyond treating the post as plain text, which it isn't.
I'm not sure I follow the point you are trying to make. none of the fragility is new or surprising. the value of editing the "code" structurally is that it adds a layer of protection against the kind of manual updates which unintentionally break blocks. maybe I'm misunderstanding you, but are you trying to express your disagreement with the choice of the comments? what is surprising about the possibility of breaking manual updates? |
Exactly. From your previous comment I had the impression you were acknowledging now what many warned against in the last 2 years and a half (the comments fragility). Regarding the textarea see: Previous comment: See also: 19 Mar 2018 28 Apr 2017 |
How can we move this issue along? |
I think let's punt on syntax highlighting and work on improving the problem areas that @mapk identified in his original comment. Design feedback and a final mockup is needed before we can proceed with development. |
The Design Team discussed this in today's triage on Slack. Some next steps to help this move along are:
Future iterations:
|
I disagree that the borders should be removed. It should stand out as being different from the visual mode blocks. |
Accessibility feedback has already been provided in a couple previous comments, see: I see latest feedback from the Design team on #17017 (comment) asks for something different.
Both features can go in third editing mode. For accessibility and interoperability, it's fundamental there's a simple textarea because that's the only user interface that is guaranteed to work everywhere.
That's not just plain text. It's a H2 heading which allows for better semantics and content navigation for assistive technologies. As such, I disagree on removing it because it's there for an important purpose.
I don't see the need to remove that button: it serves a purpose and improves keyboard accessibility. What is the argument to remove it? In what way its removal would improve the user experience? |
Related issue: |
How soon will visual marking (highlighting) of open/closed wp-comments be implemented in the code editor? |
Since this issue is still open, I figured I'd add my recent experience to it. Last month I spent a bunch of time migrating a couple older themes to full site editing which involved building page layouts in Gutenberg so that I could copy/paste the markup from the Code Editor back into parts and patterns files. Even with some autocompletions, I discovered that it was faster to copy from the Gutenberg code editor than write them from scratch, so being able to quickly identify various parts with Syntax Highlighting in the Code Editor would have made that process much easier. ( ref - #10423 ) |
I'm seeing more and more 1-star reviews in the plugin due to the code editor lacking for more advanced HTML & CSS savvy users. It might be time we take a look at how we'd like to improve the Code Editor.
Current Code Editor
Problem Areas
Solutions
There are a couple of things to improve here. For one, if we improve the appearance, it can become obvious that the user is in the Code Editor mode and we can then get rid of the
Editing code
label.+
block inserter icon so that a user can insert a block in the code editor too! It would just render as code in the document.Proposed Design
The text was updated successfully, but these errors were encountered: