Page MenuHomePhabricator

Descriptive text can't be distinguished from content text in visual diffs
Closed, ResolvedPublic8 Estimated Story Points

Description

See this example (sorry, private wiki).

I think I like having a description of what was changed, such as "Template parameters changed: link changed from A to B, title changed from C to D..." etc, but longer text makes it too difficult to actually figure out what changed.

See the long description field, "Description changed from Many of you...[many lines later] link. to Join our speaker..." There's no visual distinction, it's all grey text, so "from" and "to" don't stand out.

You probably may use quotes, bold, italics, and more to fix this.

Event Timeline

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

The messaging system doesn't really support formatting at the moment, which is why we haven't done this yet. There may be some hack we can do though.

Ping @matmarex

Deskana moved this task from To Triage to TR6: Visual diffs on the VisualEditor board.

mw.message will do wikitext parsing, but ideally this would work in ve-core too.

The messaging system doesn't really support formatting at the moment, which is why we haven't done this yet. There may be some hack we can do though.

To elaborate: MediaWiki's messaging system (mw.message + mw.jqueryMsg) does support formatting (it can treat the message as a HTML DOM tree, rather than just text), but the fallback system we use in standalone VisualEditor (jquery.i18n) does not.

In a perfect world, this would be as easy as replacing code like this:

return ve.msg( 'visualeditor-changedesc-changed', key, change.from, change.to );

With:

return mw.message('visualeditor-changedesc-changed', key, $( '<i>' ).text( change.from ), $( '<i>' ).text( change.to ) ).parseDom();

(We would have to do this in about 15 places for the descriptions for different elements, e.g. template parameter, link target, etc.)

Given the imperfect world we live in, I think we will instead need something like this, to construct the HTML string by hand:

return $( $.parseHTML(
	ve.escapeHtml( ve.msg( 'visualeditor-changedesc-changed', '$1', '$2', '$3' ) )
		.replace( '$1', ve.escapeHtml( key ) )
		.replace( '$2', '<i>' + ve.escapeHtml( change.from ) + '</i>' )
		.replace( '$3', '<i>' + ve.escapeHtml( change.to ) + '</i>' )
) );

(And probably some helper function for it, since it looks icky.)

Alternatively, we could try to make mw.message + mw.jqueryMsg a separate library independent of MediaWiki, or we could try to add the missing features to jquery.i18n, but either of these would be a major undertaking.

I'll have a look at this, we can probably do better than HTML building and create a method that supports DOM arguments.

Change 440664 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Create an 'htmlMsg' function for HTML messages with HTML or DOM arguments

https://gerrit.wikimedia.org/r/440664

Change 440665 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Use ve.htmlMsg to highlight values in attribute changes

https://gerrit.wikimedia.org/r/440665

Change 441028 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Implement getHtmlMessage in mw.Platform and use for DiffElement

https://gerrit.wikimedia.org/r/441028

Change 441167 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Cite@master] Use getHtmlMessage for DiffElement

https://gerrit.wikimedia.org/r/441167

Change 440664 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Create an 'htmlMsg' function for HTML messages with HTML or DOM arguments

https://gerrit.wikimedia.org/r/440664

Change 440665 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Use ve.htmlMsg to highlight values in attribute changes

https://gerrit.wikimedia.org/r/440665

Change 441028 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a1fd90540)

https://gerrit.wikimedia.org/r/441028

Change 441167 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Use getHtmlMessage for DiffElement

https://gerrit.wikimedia.org/r/441167

Deskana renamed this task from Descriptive text can't be distinguished from content text to Descriptive text can't be distinguished from content text in visual diffs.Jun 25 2018, 2:06 PM
Deskana closed this task as Resolved.
Vvjjkkii renamed this task from Descriptive text can't be distinguished from content text in visual diffs to wjcaaaaaaa.Jul 1 2018, 1:08 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Esanders as the assignee of this task.
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed the point value for this task.
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from wjcaaaaaaa to Descriptive text can't be distinguished from content text in visual diffs.Jul 2 2018, 5:08 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to Esanders.
CommunityTechBot lowered the priority of this task from High to Low.
CommunityTechBot set the point value for this task to 8.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.