Page MenuHomePhabricator

Can't edit preformatted text using visual editor in Flow posts
Closed, ResolvedPublic

Description

I can't edit preformatted text using visual editor in Flow posts.

Steps to reproduce:

  1. Open any Flow editing form – to reply, to post a new topic, or to edit existing post.
  2. Switch to wikitext editor.
  3. Type <pre>foo</pre>. (Alternatively, instead of steps 1–3, open an existing post that contains <pre> for editing.)
  4. Switch to visual editor.
  5. Try to change the foo to something else, perhaps bar.
  6. Switch back to wikitext, or save the post

Expected: I see bar in preformatted text. Actual: I see foo in preformatted text.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I first saw this problem yesterday. Editing in wikitext mode still works, but you have to realize what's happening… https://www.mediawiki.org/w/index.php?title=Topic:Tls0dpofyexl6l6y&action=compare-post-revisions&topic_newRevision=tlw4rxnmfvegv4sb

See also T159231 – VisualEditor also has <pre> support broken at the moment, but in a completely different way?

Checked, just in case - the following works:
<code></code>
<blockquote></blockquote>

@matmarex re T159231: <pre> text displays contents in the surface without the newlines, which is confusing. - I thought the inspector is the new feature for editing pre-formatted text.

matmarex renamed this task from Can't edit preformatted text using visual editor in Flow posts to Can't edit preformatted text using visual editor.Mar 1 2017, 8:50 PM

After fixing T159231 in VE, I found out that it's affected by this problem too. So this is not Flow-specific. The root cause is the same change in Parsoid, rGPAR79ccfb9372cb: Treat html pre and nowiki as extension tags.

(Flow was not affected by T159231, because it does not load ve.dm.MWExtensionNode, so the <pre typeof="mw:Extension/pre"> matched ve.dm.PreformattedNode. It's not clear to me if this is intentional. It seems that all unrecognized MediaWiki extension tags are currently broken in Flow, I filed T159380: Flow's visual editor doesn't know about extensions tags about it.)

So, the reason why the contents of a <pre> can't be edited is because they are now duplicated in data-mw.body.extsrc, and VisualEditor doesn't know it has to handle that for preformatted text.

OK, actually, this is quite a mess. Let's handle it on T159231, I'll copy the relevant parts there.

For Flow: this issue will be fixed (the preformatted text will be editable, one way or another) if either T159231 or T159380 is fixed.

matmarex renamed this task from Can't edit preformatted text using visual editor to Can't edit preformatted text using visual editor in Flow posts.Mar 1 2017, 10:23 PM

Looks like T159380 was fixed, and this should be fixed too. See T159231 about the silly interface that preformatted text now has.

This issue has been fixed - the edits to preformatted text that are done via VE can be saved.

T159231: <pre> text displays contents in the surface without the newlines, which is confusing. is still valid since it is addressing the issue of not being able to edit preformatted text directly.

Etonkovidova triaged this task as Medium priority.