Set section to null when switching from NWE to VE

This prevents the discard warning from being shown if the user
switches back to NWE then back to VE, as by this point they
have left section editing.

Change-Id: I734684c54a8900aab3332ed8421cb42f7f845738
This commit is contained in:
Ed Sanders 2016-11-02 15:53:29 +00:00
parent 1866a8680c
commit 56679dfb35

View file

@ -105,6 +105,7 @@ ve.init.mw.DesktopWikitextArticleTarget.prototype.switchToVisualEditor = functio
.then( function ( closing ) { return closing; } )
.then( function ( data ) {
if ( data && data.action === 'discard' ) {
target.section = null;
target.setMode( 'visual' );
target.reloadSurface();
}