TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/149529
Change subject: jquery.textSelection: Add setContents function ...................................................................... jquery.textSelection: Add setContents function This function is specified in the commands handler below, but did not have an implementation for the plain textarea case. Better we make this work. A user wanted this api call so his JS cleanup script could work consistently on both plain textarea and the CodeEditor Change-Id: Ib3afc505037a5b12269e55b4b130a38a3fac7823 --- M resources/src/jquery/jquery.textSelection.js M tests/qunit/suites/resources/jquery/jquery.textSelection.test.js 2 files changed, 7 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/29/149529/1 diff --git a/resources/src/jquery/jquery.textSelection.js b/resources/src/jquery/jquery.textSelection.js index 0573f66..e5444eb 100644 --- a/resources/src/jquery/jquery.textSelection.js +++ b/resources/src/jquery/jquery.textSelection.js @@ -63,6 +63,12 @@ return this.val(); }, /** + * Set the contents of the textarea, replacing anything that was there before + */ + setContents: function ( content ) { + this.val( content ); + }, + /** * Get the currently selected text in this textarea. Will focus the textarea * in some browsers (IE/Opera) */ diff --git a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js index 2191c3b..56b0fa9 100644 --- a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js @@ -43,11 +43,7 @@ $( '#qunit-fixture' ).append( $textarea ); - // This method is actually missing atm... - //$textarea.textSelection( 'setContents', opt.before.text); - - // Won't work with the WikiEditor iframe? - $textarea.val( opt.before.text ); + $textarea.textSelection( 'setContents', opt.before.text ); start = opt.before.start; end = opt.before.end; -- To view, visit https://gerrit.wikimedia.org/r/149529 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3afc505037a5b12269e55b4b130a38a3fac7823 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: TheDJ <hartman.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits