mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
Introduced method replacePhantoms in ve.ce.Surface in order to avoid accessing ve.ce.Surface local variable ($phantoms) from ve.ce.AlienNode
Change-Id: I9754d98175c7353f6db5306bc2ce35d6c57fdedb
This commit is contained in:
parent
4aeb00dcbc
commit
94642c797d
|
@ -73,7 +73,7 @@ ve.ce.AlienNode.prototype.onMouseEnter = function () {
|
|||
} )
|
||||
);
|
||||
} );
|
||||
surface.$phantoms.empty().append( $phantoms );
|
||||
surface.replacePhantoms( $phantoms );
|
||||
surface.$.on( 'mousemove.phantoms', ve.bind( this.onSurfaceMouseMove, this ) );
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ ve.ce.AlienNode.prototype.onSurfaceMouseMove = function ( e ) {
|
|||
$target.closest( '.ve-ce-alienNode' ).length === 0
|
||||
) {
|
||||
surface = this.root.getSurface();
|
||||
surface.$phantoms.empty();
|
||||
surface.replacePhantoms( null );
|
||||
surface.$.unbind( 'mousemove.phantoms' );
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1194,6 +1194,16 @@ ve.ce.Surface.prototype.showSelection = function ( range ) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Append passed phantoms to phantoms container after emptying it first.
|
||||
*
|
||||
* @method
|
||||
* @param {jQuery} $phantoms Phantoms to append
|
||||
*/
|
||||
ve.ce.Surface.prototype.replacePhantoms = function( $phantoms ) {
|
||||
this.$phantoms.empty().append( $phantoms );
|
||||
};
|
||||
|
||||
/*! Helpers */
|
||||
|
||||
/**
|
||||
|
@ -1443,4 +1453,4 @@ ve.ce.Surface.prototype.enableRendering = function () {
|
|||
*/
|
||||
ve.ce.Surface.prototype.disableRendering = function () {
|
||||
this.renderingEnabled = false;
|
||||
};
|
||||
};
|
Loading…
Reference in a new issue