mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
textSelection: Implement getCaretPosition
Bug: T185992 Depends-On: Id60f4b8aa177564f5252508ce6cff2424eb03fc8 Change-Id: I1a1a953dfbb299a15ba9d4d3e624e6779e72d11c
This commit is contained in:
parent
aeb4f2f2b7
commit
9e16e1cbd4
|
@ -59,8 +59,14 @@ ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
|
|||
surface.getModel().getRangeFromSourceOffsets( options.start, options.end )
|
||||
);
|
||||
},
|
||||
getCaretPosition: function () {
|
||||
// TODO
|
||||
getCaretPosition: function ( options ) {
|
||||
var range = surface.getModel().getSelection().getCoveringRange(),
|
||||
surfaceModel = surface.getModel(),
|
||||
caretPos = surfaceModel.getSourceOffsetFromOffset( range.start );
|
||||
|
||||
return options.startAndEnd ?
|
||||
[ caretPos, surfaceModel.getSourceOffsetFromOffset( range.end ) ] :
|
||||
caretPos;
|
||||
},
|
||||
encapsulateSelection: function () {
|
||||
// TODO
|
||||
|
|
Loading…
Reference in a new issue