Page MenuHomePhabricator

Code in SyntaxHighlight blocks is editable, but changes are lost on save
Closed, DuplicatePublic

Description

It's possible to edit code in syntaxhighlight blocks with VE, but any changes are lost on save. To reproduce:

  1. Create a page using the wikitext editor with the following content:
<syntaxhighlight lang="javascript">
var foo = bar;
</syntaxhighlight>
  1. Save the page.
  2. Edit the page in VE, and change "bar" to "baz". Also add a word or two after the syntaxhighlight block so that there will be a difference from the current revision. (I chose 'Changed "bar" to "baz".')
  3. Save the page. In the saved page, "baz" has changed back to "bar".
  4. If you edit again in the wikitext editor, the content is this:
<syntaxhighlight lang="javascript">
var foo = bar;
</syntaxhighlight>Changed "bar" to "baz".

I appreciate that SyntaxHighlight support is being worked upon, and that this problem will probably be solved when the work is finished. However, in the meantime it's probably best to disable editing of SyntaxHighlight blocks to prevent users losing work unnecessarily.

Event Timeline

MrStradivarius raised the priority of this task from to Needs Triage.
MrStradivarius updated the task description. (Show Details)
MrStradivarius added a project: VisualEditor.
MrStradivarius subscribed.

Presumably this was fixed by T45126?

Not exactly. The problem in this task is that VisualEditor wrongly allowed users to edit content that was dynamically generated by an unknown extension. T103455 fixed this problem by restoring the "alien" feature for mediawiki extensions.

T45126 then made SyntaxHighlight a known extension. Thus no longer part of the alien category and evading this issue.