mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Introduce ArticleTarget#afterSurfaceReady
This method should be called once the surface is visible and ready to be focused. Change-Id: I43a1d9cabd59181d2beab8f4a29700d031903c22
This commit is contained in:
parent
93df71af77
commit
6c471c5b1e
|
@ -483,13 +483,18 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
|||
// Parent method
|
||||
ve.init.mw.ArticleTarget.super.prototype.surfaceReady.apply( this, arguments );
|
||||
|
||||
// Do this after window is made scrollable on mobile
|
||||
// ('surfaceReady' handler in VisualEditorOverlay in MobileFrontend)
|
||||
this.restoreEditSection();
|
||||
|
||||
mw.hook( 've.activationComplete' ).fire();
|
||||
};
|
||||
|
||||
/**
|
||||
* Runs after the surface has been made ready and visible
|
||||
*
|
||||
* Implementing sub-classes must call this method.
|
||||
*/
|
||||
ve.init.mw.ArticleTarget.prototype.afterSurfaceReady = function () {
|
||||
this.restoreEditSection();
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
|
@ -456,6 +456,8 @@ ve.init.mw.DesktopArticleTarget.prototype.afterActivate = function () {
|
|||
// (We do this here because toggling 've-active' class above hides it)
|
||||
this.$editableContent.find( 'style[data-mw-deduplicate^="TemplateStyles:"]' ).prop( 'disabled', true );
|
||||
|
||||
this.afterSurfaceReady();
|
||||
|
||||
if ( !this.editingTabDialog ) {
|
||||
if ( this.sectionTitle ) {
|
||||
this.sectionTitle.focus();
|
||||
|
|
|
@ -290,10 +290,6 @@ ve.init.mw.MobileArticleTarget.prototype.surfaceReady = function () {
|
|||
return;
|
||||
}
|
||||
|
||||
// Calls scrollSelectionIntoView so must be called before parent,
|
||||
// which calls goToHeading. (T225292)
|
||||
this.adjustContentPadding();
|
||||
|
||||
// Deactivate the surface so any initial selection set in surfaceReady
|
||||
// listeners doesn't cause the keyboard to be shown.
|
||||
this.getSurface().getView().deactivate( false );
|
||||
|
@ -317,6 +313,16 @@ ve.init.mw.MobileArticleTarget.prototype.surfaceReady = function () {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.MobileArticleTarget.prototype.afterSurfaceReady = function () {
|
||||
this.adjustContentPadding();
|
||||
|
||||
// Parent method
|
||||
ve.init.mw.MobileArticleTarget.super.prototype.afterSurfaceReady.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Match the content padding to the toolbar height
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue