Merge "Use textSelection API to modify textarea"

This commit is contained in:
jenkins-bot 2018-01-26 18:39:35 +00:00 committed by Gerrit Code Review
commit 2b2d29e603
2 changed files with 3 additions and 2 deletions

View file

@ -91,6 +91,7 @@
"ext.templateData.images",
"ext.templateDataGenerator.data",
"jquery.uls.data",
"jquery.textSelection",
"ext.templateDataGenerator.ui.images"
],
"messages": [

View file

@ -338,11 +338,11 @@ mw.TemplateData.TextareaTarget = function mwTemplateDataTextareaTarget( $textare
OO.inheritClass( mw.TemplateData.TextareaTarget, mw.TemplateData.Target );
mw.TemplateData.TextareaTarget.prototype.getWikitext = function () {
return this.$textarea.val();
return this.$textarea.textSelection( 'getContents' );
};
mw.TemplateData.TextareaTarget.prototype.setWikitext = function ( newWikitext ) {
this.$textarea.val( newWikitext );
this.$textarea.textSelection( 'setContents', newWikitext );
};
/* global ve */