Merge "Use .textSelection( 'getContents' ) instead of .val() to get the value of #wpTextbox1"

This commit is contained in:
jenkins-bot 2016-08-04 16:26:39 +00:00 committed by Gerrit Code Review
commit aac64e6068
2 changed files with 8 additions and 6 deletions

View file

@ -550,8 +550,7 @@
},
activateVe: function () {
var wikitext = $( '#wpTextbox1' ).val(),
wikitextModified = wikitext !== initialWikitext;
var wikitext = $( '#wpTextbox1' ).textSelection( 'getContents' );
// Close any open jQuery.UI dialogs (e.g. WikiEditor's find and replace)
if ( $.fn.dialog ) {
@ -560,7 +559,10 @@
if (
mw.config.get( 'wgAction' ) === 'submit' ||
( mw.config.get( 'wgAction' ) === 'edit' && wikitextModified ) ||
(
mw.config.get( 'wgAction' ) === 'edit' &&
wikitext !== initialWikitext
) ||
// switching from section editing must prompt because we can't
// keep changes from that (yet?)
$( 'input[name=wpSection]' ).val()
@ -718,7 +720,7 @@
urlSaysHideWelcome = 'hidewelcomedialog' in new mw.Uri( location.href ).query;
if ( uri.query.action === 'edit' && $( '#wpTextbox1' ).length ) {
initialWikitext = $( '#wpTextbox1' ).val();
initialWikitext = $( '#wpTextbox1' ).textSelection( 'getContents' );
}
if ( init.isAvailable ) {

View file

@ -138,7 +138,7 @@
ve.track( 'trace.restbaseLoad.enter' );
if (
conf.fullRestbaseUrl &&
$( '#wpTextbox1' ).val() &&
$( '#wpTextbox1' ).textSelection( 'getContents' ) &&
!$( '[name=wpSection]' ).val()
) {
switched = true;
@ -153,7 +153,7 @@
data: {
title: pageName,
oldid: oldid,
wikitext: $( '#wpTextbox1' ).val(),
wikitext: $( '#wpTextbox1' ).textSelection( 'getContents' ),
stash: 'true'
},
// Should be synchronised with ApiVisualEditor.php