textSelection: Implement getCaretPosition

Bug: T185992
Depends-On: Id60f4b8aa177564f5252508ce6cff2424eb03fc8
Change-Id: I1a1a953dfbb299a15ba9d4d3e624e6779e72d11c
This commit is contained in:
Ed Sanders 2018-01-27 12:22:44 -08:00
parent aeb4f2f2b7
commit 9e16e1cbd4

View file

@ -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