mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 19:26:46 +00:00
Automatically bind and unbind context's window event bindings on documentNode focus and blur
Change-Id: Ie43165da49a36a7d0d13a52318d9c5438dad9605
This commit is contained in:
parent
7a1d74fd18
commit
bcf93eb695
|
@ -892,6 +892,10 @@ ve.ce.Surface.prototype.getModel = function() {
|
||||||
return this.model;
|
return this.model;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ve.ce.Surface.prototype.getDocument = function() {
|
||||||
|
return this.documentView;
|
||||||
|
};
|
||||||
|
|
||||||
/* Inheritance */
|
/* Inheritance */
|
||||||
|
|
||||||
ve.extendClass( ve.ce.Surface, ve.EventEmitter );
|
ve.extendClass( ve.ce.Surface, ve.EventEmitter );
|
||||||
|
|
|
@ -45,7 +45,10 @@ ve.ui.Context = function( surfaceView, $overlay ) {
|
||||||
'mousedown': ve.proxy( this.onMouseDown, this ),
|
'mousedown': ve.proxy( this.onMouseDown, this ),
|
||||||
'mouseup': ve.proxy( this.onMouseUp, this )
|
'mouseup': ve.proxy( this.onMouseUp, this )
|
||||||
} );
|
} );
|
||||||
$( window ).bind( 'resize scroll', ve.proxy( this.set, this ) );
|
this.surfaceView.getDocument().getDocumentNode().$.on( {
|
||||||
|
'focus': ve.proxy( this.onDocumentFocus, this ),
|
||||||
|
'blur': ve.proxy( this.onDocumentBlur, this )
|
||||||
|
} );
|
||||||
|
|
||||||
// Intitialization
|
// Intitialization
|
||||||
this.addInspector( 'link', new ve.ui.LinkInspector( this.toolbarView, this ) );
|
this.addInspector( 'link', new ve.ui.LinkInspector( this.toolbarView, this ) );
|
||||||
|
@ -53,6 +56,14 @@ ve.ui.Context = function( surfaceView, $overlay ) {
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
|
ve.ui.Context.prototype.onDocumentFocus = function( event ) {
|
||||||
|
$( window ).bind( 'resize.ve-ui-context scroll.ve-ui-context', ve.proxy( this.set, this ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
ve.ui.Context.prototype.onDocumentBlur = function( event ) {
|
||||||
|
$( window ).unbind( 'resize.ve-ui-context scroll.ve-ui-context' );
|
||||||
|
};
|
||||||
|
|
||||||
ve.ui.Context.prototype.onMouseDown = function( event ) {
|
ve.ui.Context.prototype.onMouseDown = function( event ) {
|
||||||
this.clicking = true;
|
this.clicking = true;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
Loading…
Reference in a new issue