mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-12 08:50:57 +00:00
TextSelection: Make chainable methods chainable
Bug: T188119 Change-Id: I40030e1cbd3bc77a0db424d38cd61815deac2e12
This commit is contained in:
parent
b0ee15034a
commit
cc611f4254
|
@ -60,6 +60,7 @@
|
||||||
},
|
},
|
||||||
setContents: function ( content ) {
|
setContents: function ( content ) {
|
||||||
codeMirror.doc.setValue( content );
|
codeMirror.doc.setValue( content );
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
getSelection: function () {
|
getSelection: function () {
|
||||||
return codeMirror.doc.getSelection();
|
return codeMirror.doc.getSelection();
|
||||||
|
@ -67,9 +68,11 @@
|
||||||
setSelection: function ( options ) {
|
setSelection: function ( options ) {
|
||||||
codeMirror.doc.setSelection( codeMirror.doc.posFromIndex( options.start ), codeMirror.doc.posFromIndex( options.end ) );
|
codeMirror.doc.setSelection( codeMirror.doc.posFromIndex( options.start ), codeMirror.doc.posFromIndex( options.end ) );
|
||||||
codeMirror.focus();
|
codeMirror.focus();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
replaceSelection: function ( value ) {
|
replaceSelection: function ( value ) {
|
||||||
codeMirror.doc.replaceSelection( value );
|
codeMirror.doc.replaceSelection( value );
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
getCaretPosition: function ( options ) {
|
getCaretPosition: function ( options ) {
|
||||||
var caretPos = codeMirror.doc.indexFromPos( codeMirror.doc.getCursor( true ) ),
|
var caretPos = codeMirror.doc.indexFromPos( codeMirror.doc.getCursor( true ) ),
|
||||||
|
@ -81,6 +84,7 @@
|
||||||
},
|
},
|
||||||
scrollToCaretPosition: function () {
|
scrollToCaretPosition: function () {
|
||||||
codeMirror.scrollIntoView( null );
|
codeMirror.scrollIntoView( null );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue