mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
textSelection compat layer getCaretPosition could error if no selection
Reported as happening when a gadget was triggering some calls early in initialization, presumably before the surface had reached the point where it had been focused. Bug: T334930 Change-Id: Idebc31ef042d45acf59d8dceaa7566744233f426
This commit is contained in:
parent
2fde6f2caa
commit
4d4093b938
|
@ -77,7 +77,7 @@ ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
|
|||
caretPos = range ? surfaceModel.getSourceOffsetFromOffset( range.start ) : 0;
|
||||
|
||||
return options.startAndEnd ?
|
||||
[ caretPos, surfaceModel.getSourceOffsetFromOffset( range.end ) ] :
|
||||
[ caretPos, range ? surfaceModel.getSourceOffsetFromOffset( range.end ) : 0 ] :
|
||||
caretPos;
|
||||
},
|
||||
replaceSelection: function ( value ) {
|
||||
|
|
Loading…
Reference in a new issue