mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Clear state of contextview when there is no selection length.
Make context update method work on single call Change-Id: I2b7f3a31ea5ca1530f927a7e11827d583f134ffb
This commit is contained in:
parent
b31a25c12c
commit
6b8d8d24aa
|
@ -158,10 +158,7 @@ ve.ce.Surface.prototype.onSelect = function( range ) {
|
||||||
}
|
}
|
||||||
_this.updateSelectionTimeout = undefined;
|
_this.updateSelectionTimeout = undefined;
|
||||||
}
|
}
|
||||||
if ( this.updateSelectionTimeout !== undefined ) {
|
this.updateSelectionTimeout = setTimeout( update, 500 );
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.updateSelectionTimeout = setTimeout( update, 750 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ve.ce.Surface.prototype.onTransact = function( tx ) {
|
ve.ce.Surface.prototype.onTransact = function( tx ) {
|
||||||
|
|
|
@ -66,10 +66,11 @@ ve.ui.Toolbar.prototype.updateTools = function() {
|
||||||
}, startNode );
|
}, startNode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update Context
|
|
||||||
if ( range.getLength() > 0 ) {
|
if ( range.getLength() > 0 ) {
|
||||||
annotations = doc.getAnnotationsFromRange( range );
|
annotations = doc.getAnnotationsFromRange( range );
|
||||||
} else {
|
} else {
|
||||||
|
// Clear context
|
||||||
|
_this.surfaceView.contextView.clear();
|
||||||
annotations = doc.getAnnotationsFromOffset(
|
annotations = doc.getAnnotationsFromOffset(
|
||||||
doc.getNearestContentOffset( range.start - 1 )
|
doc.getNearestContentOffset( range.start - 1 )
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue