mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Using getRelativeContentOffset for insertAnnotations
Previously, we were looking one offset to the left to load the insertAnnotations. This would fail at the beginning of a document that began with a slug, and probably other cases too. Now using getRelativeContent offset. Change-Id: I31b24e2ccfa9fda2ce7fb19d1221f8708a96083f
This commit is contained in:
parent
4ae9096632
commit
75c154ef6c
|
@ -120,7 +120,8 @@ ve.dm.Surface.prototype.change = function ( transactions, selection ) {
|
|||
|
||||
// Clear and add annotations to stack if insertingAnnotations isn't happening
|
||||
if (!this.insertingAnnotations) {
|
||||
var annotations = this.documentModel.getAnnotationsFromOffset( this.getSelection().start - 1 );
|
||||
var contentOffset = this.documentModel.getNearestContentOffset( this.getSelection().start - 1, -1 ),
|
||||
annotations = this.documentModel.getAnnotationsFromOffset( contentOffset );
|
||||
|
||||
// Reset insertAnnotations
|
||||
this.documentModel.insertAnnotations = new ve.AnnotationSet();
|
||||
|
|
Loading…
Reference in a new issue