From 0a8f8595f4c44b08db97bb16e02e10062af3f504 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Fri, 28 Mar 2014 00:33:23 +0100 Subject: [PATCH] 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 --- resources/Resources.php | 1 + .../src/mediawiki.action/mediawiki.action.edit.editWarning.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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' ); -- 2.20.1