mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Cleanup: Get rid of surfaceReady callback"
This commit is contained in:
commit
99485b7cbb
|
@ -230,7 +230,7 @@ ve.init.mw.Target.static.parseDocument = function ( documentString, mode, sectio
|
||||||
* @param {HTMLDocument} doc HTML document
|
* @param {HTMLDocument} doc HTML document
|
||||||
*/
|
*/
|
||||||
ve.init.mw.Target.prototype.documentReady = function ( doc ) {
|
ve.init.mw.Target.prototype.documentReady = function ( doc ) {
|
||||||
this.setupSurface( doc, this.surfaceReady.bind( this ) );
|
this.setupSurface( doc );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -355,9 +355,8 @@ ve.init.mw.Target.prototype.getSurfaceConfig = function ( config ) {
|
||||||
*
|
*
|
||||||
* @method
|
* @method
|
||||||
* @param {HTMLDocument} doc HTML document
|
* @param {HTMLDocument} doc HTML document
|
||||||
* @param {Function} [callback] Callback to call when done
|
|
||||||
*/
|
*/
|
||||||
ve.init.mw.Target.prototype.setupSurface = function ( doc, callback ) {
|
ve.init.mw.Target.prototype.setupSurface = function ( doc ) {
|
||||||
var target = this;
|
var target = this;
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
// Build model
|
// Build model
|
||||||
|
@ -373,21 +372,34 @@ ve.init.mw.Target.prototype.setupSurface = function ( doc, callback ) {
|
||||||
target.track( 'trace.buildModelTree.exit' );
|
target.track( 'trace.buildModelTree.exit' );
|
||||||
|
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
var surface;
|
target.addSurface( doc );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
ve.init.mw.Target.prototype.addSurface = function () {
|
||||||
|
var surface,
|
||||||
|
target = this;
|
||||||
|
|
||||||
// Clear dummy surfaces
|
// Clear dummy surfaces
|
||||||
target.clearSurfaces();
|
// TODO: Move to DesktopArticleTarget
|
||||||
|
this.clearSurfaces();
|
||||||
|
|
||||||
// Create ui.Surface (also creates ce.Surface and dm.Surface and builds CE tree)
|
// Create ui.Surface (also creates ce.Surface and dm.Surface and builds CE tree)
|
||||||
target.track( 'trace.createSurface.enter' );
|
this.track( 'trace.createSurface.enter' );
|
||||||
surface = target.addSurface( dmDoc );
|
// Parent method
|
||||||
|
surface = ve.init.mw.Target.super.prototype.addSurface.apply( this, arguments );
|
||||||
// Add classes specific to surfaces attached directly to the target,
|
// Add classes specific to surfaces attached directly to the target,
|
||||||
// as opposed to TargetWidget surfaces
|
// as opposed to TargetWidget surfaces
|
||||||
surface.$element.addClass( 've-init-mw-target-surface' );
|
surface.$element.addClass( 've-init-mw-target-surface' );
|
||||||
target.track( 'trace.createSurface.exit' );
|
this.track( 'trace.createSurface.exit' );
|
||||||
|
|
||||||
target.dummyToolbar = false;
|
this.dummyToolbar = false;
|
||||||
|
|
||||||
target.setSurface( surface );
|
this.setSurface( surface );
|
||||||
|
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
// Initialize surface
|
// Initialize surface
|
||||||
|
@ -399,10 +411,10 @@ ve.init.mw.Target.prototype.setupSurface = function ( doc, callback ) {
|
||||||
surface.initialize();
|
surface.initialize();
|
||||||
|
|
||||||
target.track( 'trace.initializeSurface.exit' );
|
target.track( 'trace.initializeSurface.exit' );
|
||||||
setTimeout( callback );
|
target.surfaceReady();
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
return surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue