From 21334a0fa85f6ee63041a7c0a978cac502daf6a4 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Wed, 2 Mar 2016 11:55:50 +0000 Subject: [PATCH] Keep summary and checkbox selections when swtiching WTE->VE Bug: T128529 Change-Id: I8a7deac1c4d9390c1db7d78c3e0a11d927ef127b --- .../init/targets/ve.init.mw.DesktopArticleTarget.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index 55347ff56e..565e5448d6 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -55,7 +55,11 @@ ve.init.mw.DesktopArticleTarget = function VeInitMwDesktopArticleTarget( config this.scrollTop = null; this.currentUri = currentUri; this.section = currentUri.query.vesection; - this.initialEditSummary = currentUri.query.summary; + if ( $( '#wpSummary' ).length ) { + this.initialEditSummary = $( '#wpSummary' ).val(); + } else { + this.initialEditSummary = currentUri.query.summary; + } this.namespaceName = mw.config.get( 'wgCanonicalNamespace' ); this.viewUri = new mw.Uri( mw.util.getUrl( this.pageName ) ); this.isViewPage = ( @@ -285,6 +289,9 @@ ve.init.mw.DesktopArticleTarget.prototype.loadSuccess = function ( response ) { ( !!mw.user.options.get( 'watchcreations' ) && !this.pageExists ) || data.watched === '' }; + $( '.editCheckboxes input' ).each( function () { + defaults[ this.name ] = this.checked; + } ); $checkboxes = $( '
' ).html( ve.getObjectValues( data.checkboxes ).join( '' ) ); $checkboxes.find( 'input[type=checkbox]' ).each( function () {