Page MenuHomePhabricator

Prompt user before automatically converting pasted HTML to wikitext
Closed, ResolvedPublic40 Estimated Story Points

Assigned To
Authored By
Esanders
Mar 19 2018, 5:44 PM
Referenced Files
F18081450: image.png
May 8 2018, 3:17 PM
F18064468: image.png
May 7 2018, 11:29 PM
F18064473: image.png
May 7 2018, 11:29 PM
F16909192: image.png
Apr 11 2018, 4:28 AM
Tokens
"Love" token, awarded by TheDJ."Meh!" token, awarded by dr0ptp4kt."Love" token, awarded by Schnark."Love" token, awarded by Dvorapa.

Description

As discussed in T153315, converting pasted HTML to wikitext is not always the desired result. This can be especially annoying if the formatted HTML contains wikitext, as it will be escaped with <nowiki> tags.

We should instead prompt the user when pasting formatted HTML, and force them to deliberately choose the "convert to wikitext" option, with the default being plain-text (and possibly a reminder about the CTRL+SHIFT+V shortcut?).

This behaviour is similar to the paste dialog shown in excel/calc when the source format can't be inferred (e.g. "CSV or TSV?")

Event Timeline

Esanders set the point value for this task to 40.

Change 425462 had a related patch set uploaded (by DLynch; owner: DLynch):
[VisualEditor/VisualEditor@master] SurfaceFragment: tell insertDocument whether it's from a paste

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

Change 425464 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/VisualEditor@master] MWWikitextSurfaceFragment: ask the paster whether to convert to wikitext or use plain text

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

image.png (267×359 px, 24 KB)

I'm sure people might want to give feedback on the wording of this.

I was wondering before if the dialog should contain either a visual example of rich vs plaintext, or a snippet of your actual pasted content in both modes? The latter probably has more problems, e.g. when your pasted text is very long or contains almost no formatting.

But maybe this is ok for a first pass.

Snippet of your actual content in both modes does also have the drawback that we'd have to wait for it to run the round trip to the server for the conversion, as well.

I did consider examples, but I wasn't sure I could write something which was sufficiently compact and would make sense to people who didn't already know what the non-example text meant.

Could literally annotate the current message, maybe? "Your inserted content contains rich content. Should we convert the rich content to '''wikitext''', or insert just the plain text?"

I would replace "rich text/content" with "formatting" or "text formatting", as I think the former is too technical.

Could literally annotate the current message, maybe? "Your inserted content contains rich content. Should we convert the rich content to '''wikitext''', or insert just the plain text?"

This could work. Or to drive the point home: " ... text formatting ... '''[[wikitext]]''' ..."

Thoughts @Deskana?

This could work. Or to drive the point home: " ... text formatting ... '''[[wikitext]]''' ..."

Personally, I think that would cause more confusion than clarity. Curious what @Deskana thinks though.

This could work. Or to drive the point home: " ... text formatting ... '''[[wikitext]]''' ..."

Personally, I think that would cause more confusion than clarity. Curious what @Deskana thinks though.

Agreed. I also don't think using "we" is the best here, since the visual editor is not a collective of sentient beings; passive voice would be better. I also also think "pasted" would be better than "inserted", since that's the exact action the user will have taken. I also also also think the button would be better labelled "Convert to wikitext", as that's more consistent with the message, which doesn't contain the word "markup".

Let's go with "Your pasted content contains formatting. Should it be converted to wikitext, or inserted as plain text?" with the buttons "Convert to wikitext" and "Use plain text".

Change 433980 had a related patch set uploaded (by DLynch; owner: DLynch):
[VisualEditor/VisualEditor@master] ce.Surface: Refactor afterPaste

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

Change 425462 abandoned by DLynch:
SurfaceFragment: tell insertDocument whether it's from a paste

Reason:
Replaced by 433980

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

Change 433980 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ce.Surface: Refactor afterPaste

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

Change 433947 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (511911451)

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

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

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

Change 425464 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ce.MWWikitextSurface: ask on paste about wikitext conversion

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

I've found that if I don't want to insert a text (and press Esc) the software inserts it anyway as wikitext. It can cause that user doesn't notice it and saves with undesired texts.

Furthermore, would a default setting for this be possible? Most of the time, I need wikitext format, so it would be very useful if the software doesn't ask it all the time.

@Bencemac: On the defaults front, as much as anything that's a UI question. Fitting the setting in, changing the setting later, etc.

I admit, I didn't consider canceling that dialog, since it's inserted at a point in the process where it wasn't previously possible to cancel anything. Thus it's not one which has a cancel action, and OOUI's escape-key behavior is producing unintuitive results.

@DLynch What does this mean: can I hope positive outcome? I think adding a setting should be high priority. Without it, pasting texts is pain even tough I find this function really useful. About escaping, it is a little bit strange; plain text is the default, but it inserting as wikitext?

Deskana triaged this task as Medium priority.