Page MenuHomePhabricator

Be able to switch to VisualEditor after starting to edit a section without losing edits
Closed, ResolvedPublic8 Estimated Story Points

Description

Steps to reproduce:

  1. Go to https://en.wikipedia.org/wiki/Foobar?action=edit&section=2 with your editor set to WikiText source editor
  2. Make an edit
  3. Try to switch to VisualEditor

Expected results: Editor is switched to VisualEditor with edit still intact.

Actual results: The user is given a dialog box asking if they want to switch and discard their changes.

Proposed solution: Take new section content, splice into base revision's wikitext using replaceSectionAtRev.

Event Timeline

This is a page-blanking bug.

Steps to reproduce:

  1. Click "Edit source" on a section in a long page.
  1. Switch to the visual editor.
  1. Notice that the entire rest of the page is missing in VisualEditor.
  1. Make your change and save the page.
  1. Notice that the entire rest of the page has been blanked now.

one way to solve this is to switch to VE all-page edit, incorporating the changes performed in wikieditor (i think this is what the original description of this ticket, "Take new section content, splice into base revision's wikitext using replaceSectionAtRev." means).

another approach, would be to teach VE to perform true section edit, which is what most editors expect when clicking the "edit" linkett next to section heading.

personally, i would vote for the second option. i vaguely remember several (many?) tickets requesting section edit.
the last bug ( T117713 ) demonstrate that VE is *capable* of doing a single-section edit. why not take advantage of this "accidental" discovery, and teach VE to do true section edit?
this will also close quite a few tickets ( T53903 and all it "see also's", at the least, and most probably quite a few more tickets ).

some work needs to be done, for sure, e.g., disable some controls in section-edit mode ("page options, prolly some others), but is is well worth it. section edit is something editors want and expect, and its absence is a major drawback for VE.

peace.

another approach, would be to teach VE to perform true section edit, which is what most editors expect when clicking the "edit" linkett next to section heading.

personally, i would vote for the second option. i vaguely remember several (many?) tickets requesting section edit

Patches welcome. Still.

another approach, would be to teach VE to perform true section edit, which is what most editors expect when clicking the "edit" linkett next to section heading.

personally, i would vote for the second option. i vaguely remember several (many?) tickets requesting section edit

Patches welcome. Still.

sorry, this is a bit above what i can do ATM.
however, this bug demonstrated *almost* the desired functionality.
before the bug fix was deployed, i performed several section edits (the first time, i did not realized it's a bug, and when i switched to VE from wikieditor section edit, i said to myself "kudos, VE team... it's a very welcome development". only after saving and noticing the damage did i realize it was unintentional. after the first time, i repeated it quite a few times, only omitting the "save").
all the "section edit" i did this way looked pretty good to me. i did not see a single problem with the editing or the resulting wikitext (i used "display changes" to examine the generated wikitext, and to verify the nuking of the rest of the page...)

there might be some behaviors of VE that implicitly rely on it always being "full page edit" (e.g., the "page options" menu). other than that, i believe the last bug demonstrated that this should be readily doable.

of course, the "save" logic needs to change. your original description ("Take new section content, splice into base revision's wikitext using replaceSectionAtRev.") outlines the way to do it.

peace.

I can't reproduce this with the steps given in T117716#1794863. Is this task still valid?

I can't reproduce this with the steps given in T117716#1794863.

Yup. You need to go to something like https://en.wikipedia.org/wiki/Foobar?action=edit&section=2, make a change, and try to switch. It won't let you switch with changes.

Is this task still valid?

Yes. We want to be able to switch from section wikitext editing to visual editing and back.

kaldari renamed this task from Be able to switch editors after starting to edit a section to Be able to switch to VisualEditor after starting to edit a section without losing edits.Aug 15 2018, 8:10 AM
kaldari updated the task description. (Show Details)

Change 503651 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] WIP: section switch from wikitext to ve

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

Change 503670 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/MobileFrontend@master] Allow wikitext content to be passed to VisualEditor

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

Change 503670 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Allow wikitext content to be passed to VisualEditor

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

Change 503651 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Section switch from wikitext to VE

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

Change 510094 had a related patch set uploaded (by Jforrester; owner: Esanders):
[mediawiki/extensions/VisualEditor@wmf/1.34.0-wmf.4] Section switch from wikitext to VE

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

Change 510094 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@wmf/1.34.0-wmf.4] Section switch from wikitext to VE

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