mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-23 23:03:46 +00:00
Add explicit replaceSelection() implementation
The $.textSelection() facade in CodeEditor is missing a replaceSelection() implementation. This causes $.textSelection() to fall back to a naive implementation, which does not work, thus breaking any gadget or extension that tries to interact with CodeEditor using this method. As a fix, provide a native replaceSelection() implementation that calls the appropriate ACE editor method: Bug: T342127 Change-Id: Ie3ed681b39c5d4d2bed50030a397a2b1c877c9fb
This commit is contained in:
parent
795d19bd6f
commit
2f7ce4dd50
|
@ -733,6 +733,16 @@
|
|||
return context.codeEditor.getCopyText();
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace the current selection with the given text.
|
||||
* DO NOT CALL THIS DIRECTLY, use $.textSelection( 'functionname', options ) instead
|
||||
*
|
||||
* @param {string} text
|
||||
*/
|
||||
replaceSelection: function ( text ) {
|
||||
context.codeEditor.insert( text );
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts text at the begining and end of a text selection, optionally inserting text at the caret when
|
||||
* selection is empty.
|
||||
|
|
Loading…
Reference in a new issue