mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +00:00
Switched to a WAY faster method of updating annotated retained regions
This commit is contained in:
parent
3ed6544fe2
commit
ff5ba54115
|
@ -175,7 +175,8 @@ es.TransactionProcessor.prototype.applyAnnotations = function( to, update ) {
|
||||||
var i,
|
var i,
|
||||||
j,
|
j,
|
||||||
length,
|
length,
|
||||||
annotation;
|
annotation,
|
||||||
|
changes = 0;
|
||||||
// Handle annotations
|
// Handle annotations
|
||||||
if ( this.set.length ) {
|
if ( this.set.length ) {
|
||||||
for ( i = 0, length = this.set.length; i < length; i++ ) {
|
for ( i = 0, length = this.set.length; i < length; i++ ) {
|
||||||
|
@ -193,6 +194,7 @@ es.TransactionProcessor.prototype.applyAnnotations = function( to, update ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
changes++;
|
||||||
}
|
}
|
||||||
if ( this.clear.length ) {
|
if ( this.clear.length ) {
|
||||||
for ( i = 0, length = this.clear.length; i < length; i++ ) {
|
for ( i = 0, length = this.clear.length; i < length; i++ ) {
|
||||||
|
@ -212,12 +214,13 @@ es.TransactionProcessor.prototype.applyAnnotations = function( to, update ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
changes++;
|
||||||
}
|
}
|
||||||
if ( update ) {
|
if ( update && changes ) {
|
||||||
var updates = this.model.selectNodes( new es.Range( this.cursor, to ) );
|
var from = this.model.getNodeFromOffset( this.cursor );
|
||||||
for ( i = 0; i < updates.length; i++ ) {
|
this.model.traverseLeafNodes( function( node ) {
|
||||||
updates[i].node.emit( 'update' );
|
node.emit( 'update' );
|
||||||
}
|
}, from );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue