diff --git a/extension.json b/extension.json index 2f1a3f6a..a6c10aa5 100644 --- a/extension.json +++ b/extension.json @@ -91,6 +91,7 @@ "ext.templateData.images", "ext.templateDataGenerator.data", "jquery.uls.data", + "jquery.textSelection", "ext.templateDataGenerator.ui.images" ], "messages": [ diff --git a/modules/ext.templateDataGenerator.target.js b/modules/ext.templateDataGenerator.target.js index df6f063b..a208f812 100644 --- a/modules/ext.templateDataGenerator.target.js +++ b/modules/ext.templateDataGenerator.target.js @@ -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 */