From: Derk-Jan Hartman Date: Thu, 27 Mar 2014 23:33:23 +0000 (+0100) Subject: Edit warning should get value from editors X-Git-Tag: 1.31.0-rc.0~14712^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=0a8f8595f4c44b08db97bb16e02e10062af3f504;p=lhc%2Fweb%2Fwiklou.git Edit warning should get value from editors Editwarning needs to make sure that any editor that uses something other than wpTextbox1 to keep the value of the form, is able to write this into the form before we are allowed to leave the page. This is already supported by the textSelection api, so use that to retrieve the value instead of plain .val() Bug: 61117 Change-Id: I24d7096929c4eed36376ef9089d7f1b72a0b6682 --- diff --git a/resources/Resources.php b/resources/Resources.php index deaa802208..942b3321e6 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1052,6 +1052,7 @@ return array( 'mediawiki.action.edit.editWarning' => array( 'scripts' => 'resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js', 'dependencies' => array( + 'jquery.textSelection', 'mediawiki.jqueryMsg' ), 'messages' => array( diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js index dcd2b0b696..b5654400f7 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js @@ -24,8 +24,8 @@ // the original values if ( mw.config.get( 'wgAction' ) === 'submit' || - $wpTextbox1.data( 'origtext' ) !== $wpTextbox1.val() || - $wpSummary.data( 'origtext' ) !== $wpSummary.val() + $wpTextbox1.data( 'origtext' ) !== $wpTextbox1.textSelection( 'getContents' ) || + $wpSummary.data( 'origtext' ) !== $wpSummary.textSelection( 'getContents' ) ) { // Return our message retval = mw.msg( 'editwarning-warning' );