Page MenuHomePhabricator

VisualEditor should retrieve content of all Page: pages wikitext editor field when switching from WikiEditor
Closed, ResolvedPublic8 Estimated Story Points

Description

When switching from WikiEditor editor to VisualEditor only the content of wpTextbox1 is retrieved and not all the fields (wpHeaderTextbox, wpTextbox1, wpFooterTextbox and wpQuality)

ProofreadPage should be able to override ArticleTargetLoader.requestPageData in order to retrieve content from all fields

Event Timeline

This problem is not confined to ProofreadPage, it happens on regular articles too.

Jdforrester-WMF triaged this task as Unbreak Now! priority.Jun 29 2016, 5:29 PM

Yes, but at this stage ve.init.mw isn't even set up so we can't go and get a function in the appropriate target to ask it for wikitext to send.

This problem is not confined to ProofreadPage, it happens on regular articles too.

How does this cause issues in regular articles?

@Jdforrester-WMF Does someone in your team plans to work on it soon or is an external change proposal welcome? As the loading of the Wikitext edit form content is not part of the ArticleTarget interface yet, this change is probably going to be a bit tricky.

How does this cause issues in regular articles?

We build a fake read page, so stuff like the categories list is missing.

I've been thinking about this today, and recently moved from using .val() to .textSelection( 'getContents' ) in VE for another piece of editing software to help with switching in a similar case (WTE->VE) - T135747. Maybe what we could do is have a hidden input element that's just used by JS to store a jquery.textSelection-style function.
ProofreadPage could register a getWikitext handler (which would get stored in the input element's data, and would know how to build the full wikitext from wpHeaderTextbox, wpFooterTextbox, and wpQuality as well as wpTextbox1), overriding the default of something like this.parent( 'form' ).find( '#wpTextbox1' ).textSelection( 'getContents' ). VE would call it when appropriate (replacing all our current textSelection calls), and magically get back the full wikitext to submit to RB.
@Esanders, @Krinkle: Any thoughts/objections?

Storing a function in data seems a bit strange, but I @Krinkle will have a better idea of how the get wikitext stuff should work.

Esanders updated the task description. (Show Details)
Aklapper lowered the priority of this task from Unbreak Now! to High.Dec 5 2016, 10:15 AM

Lowering priority to actually reflect reality ("Unbreak Now!" priority for nearly half a year and no assignee set by the VisualEditor team).

Change 331642 had a related patch set uploaded (by Esanders):
Rebuild full wikitext when switching from WTE to VE

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

Change 331642 merged by jenkins-bot:
Rebuild full wikitext when switching from WTE to VE

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

Tpt claimed this task.

Resolved by Ed's change( thank you!).