Add method that runs after activation, for overriding

Change-Id: I046583e61f328baddb0c09eaff122e991c85f992
This commit is contained in:
Ed Sanders 2016-04-21 16:44:23 +01:00 committed by Alex Monk
parent 7a007e2874
commit 6efd583ff7

View file

@ -409,15 +409,7 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) {
$( 'html' ).removeClass( 've-loading' ).addClass( 've-activating' );
$.when( this.activatingDeferred, this.toolbarSetupDeferred ).done( function () {
$( 'html' ).removeClass( 've-activating' ).addClass( 've-active' );
// Move original content inside the surface for viewport calculations
target.getSurface().$element.prepend( target.$originalContent );
if ( !target.editingTabDialog ) {
// We have to focus the page after hiding the original content, otherwise
// in firefox the contentEditable container was below the view page, and
// 'focus' scrolled the screen down.
target.getSurface().getView().focus();
}
target.afterActivate();
} ).fail( function () {
$( 'html' ).removeClass( 've-activating' );
} );
@ -451,6 +443,22 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) {
return this.activatingDeferred.promise();
};
/**
* Edit mode has finished activating
*/
ve.init.mw.DesktopArticleTarget.prototype.afterActivate = function () {
$( 'html' ).removeClass( 've-activating' ).addClass( 've-active' );
// Move original content inside the surface for viewport calculations
this.getSurface().$element.prepend( this.$originalContent );
if ( !this.editingTabDialog ) {
// We have to focus the page after hiding the original content, otherwise
// in firefox the contentEditable container was below the view page, and
// 'focus' scrolled the screen down.
// Support: Firefox
this.getSurface().getView().focus();
}
};
/**
* Determines whether we want to switch to view mode or not (displaying a dialog if necessary)
* Then, if we do, actually switches to view mode.