mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Followup 571d6cac
: when the selection changes, undo highlights
Ignoring all bounced change events led to the logic for unhighlighting the previously selected FocusableNode being skipped. This caused a bug where if you clicked a FocusableNode, it would stay highlighted even if you then selected some text, until you highlighted another node (which would then be highlighted forever, etc.) Change-Id: Ia8d74ef85eaa47326d49ef6c0f395b44b90da4dc
This commit is contained in:
parent
2b46215a2c
commit
10bf7b34ca
|
@ -924,9 +924,7 @@ ve.ce.Surface.prototype.onChange = function ( transaction, selection ) {
|
|||
next = null,
|
||||
previous = this.focusedNode;
|
||||
|
||||
// Ignore selection if changeModelSelection is currently being called with the same
|
||||
// (object-identical) selection object (i.e. if the model is calling us back)
|
||||
if ( selection && selection !== this.newModelSelection ) {
|
||||
if ( selection ) {
|
||||
// Detect when only a single inline element is selected
|
||||
if ( !selection.isCollapsed() ) {
|
||||
start = this.documentView.getDocumentNode().getNodeFromOffset( selection.start + 1 );
|
||||
|
@ -965,8 +963,11 @@ ve.ce.Surface.prototype.onChange = function ( transaction, selection ) {
|
|||
rangySel.addRange( rangyRange, false );
|
||||
}
|
||||
}
|
||||
// If there is no focused node, use native selection
|
||||
if ( !this.focusedNode && !this.isRenderingLocked() ) {
|
||||
|
||||
// If there is no focused node, use native selection, but ignore the selection if
|
||||
// changeModelSelection is currently being called with the same (object-identical)
|
||||
// selection object (i.e. if the model is calling us back)
|
||||
if ( !this.focusedNode && !this.isRenderingLocked() && selection !== this.newModelSelection ) {
|
||||
this.showSelection( selection );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue