mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +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;
|
||||
}
|
||||
if ( this.updateSelectionTimeout !== undefined ) {
|
||||
return;
|
||||
}
|
||||
this.updateSelectionTimeout = setTimeout( update, 750 );
|
||||
this.updateSelectionTimeout = setTimeout( update, 500 );
|
||||
};
|
||||
|
||||
ve.ce.Surface.prototype.onTransact = function( tx ) {
|
||||
|
|
|
@ -66,10 +66,11 @@ ve.ui.Toolbar.prototype.updateTools = function() {
|
|||
}, startNode );
|
||||
}
|
||||
}
|
||||
// Update Context
|
||||
if ( range.getLength() > 0 ) {
|
||||
annotations = doc.getAnnotationsFromRange( range );
|
||||
} else {
|
||||
// Clear context
|
||||
_this.surfaceView.contextView.clear();
|
||||
annotations = doc.getAnnotationsFromOffset(
|
||||
doc.getNearestContentOffset( range.start - 1 )
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue