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
'mediawiki.action.edit.editWarning' => array(
'scripts' => 'resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js',
'dependencies' => array(
+ 'jquery.textSelection',
'mediawiki.jqueryMsg'
),
'messages' => array(
// 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' );