Use arrow callbacks in other modules

Change-Id: Ib07720923de6657ae55ac29a07c5cc85b088a70d
This commit is contained in:
Ed Sanders 2024-05-03 17:50:15 +01:00
parent a5de8d5653
commit 1980827aec
2 changed files with 16 additions and 19 deletions

View file

@ -78,7 +78,6 @@ ve.ui.EditCheckContextItem.prototype.close = function ( data ) {
ve.ui.EditCheckContextItem.prototype.onAcceptClick = function () {
ve.track( 'activity.editCheckReferences', { action: 'edit-check-confirm' } );
var contextItem = this;
var fragment = this.data.fragment;
var windowAction = ve.ui.actionFactory.create( 'window', this.context.getSurface(), 'check' );
@ -115,7 +114,7 @@ ve.ui.EditCheckContextItem.prototype.onAcceptClick = function () {
if ( citoidData && citoidData.action === 'manual-choose' ) {
// The plain reference dialog has been launched. Wait for the data from
// the basic Cite closing promise instead.
contextItem.context.getSurface().getDialogs().once( 'closing', ( win, closed, citeData ) => {
this.context.getSurface().getDialogs().once( 'closing', ( win, closed, citeData ) => {
citoidOrCiteDataDeferred.resolve( citeData );
} );
} else {
@ -128,13 +127,13 @@ ve.ui.EditCheckContextItem.prototype.onAcceptClick = function () {
// Reference was not inserted - re-open this context
setTimeout( () => {
// Deactivate again for mobile after teardown has modified selections
contextItem.context.getSurface().getView().deactivate();
contextItem.context.afterContextChange();
this.context.getSurface().getView().deactivate();
this.context.afterContextChange();
}, 500 );
} else {
// Edit check inspector is already closed by this point, but
// we need to end the workflow.
contextItem.close( citoidData );
this.close( citoidData );
}
} );
} );
@ -143,7 +142,6 @@ ve.ui.EditCheckContextItem.prototype.onAcceptClick = function () {
ve.ui.EditCheckContextItem.prototype.onRejectClick = function () {
ve.track( 'activity.editCheckReferences', { action: 'edit-check-reject' } );
var contextItem = this;
var windowAction = ve.ui.actionFactory.create( 'window', this.context.getSurface(), 'check' );
windowAction.open(
'editCheckReferencesInspector',
@ -153,14 +151,14 @@ ve.ui.EditCheckContextItem.prototype.onRejectClick = function () {
}
// eslint-disable-next-line arrow-body-style
).then( ( instance ) => {
// contextItem.openingCitoid = false;
// this.openingCitoid = false;
return instance.closing;
} ).then( ( data ) => {
if ( !data ) {
// Form was closed, re-open this context
contextItem.context.afterContextChange();
this.context.afterContextChange();
} else {
contextItem.close( data );
this.close( data );
}
} );
};

View file

@ -107,9 +107,8 @@ ve.ui.MWExportWikitextDialog.prototype.initialize = function () {
*/
ve.ui.MWExportWikitextDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWExportWikitextDialog.super.prototype.getSetupProcess.call( this, data )
.next( function () {
var dialog = this,
surface = ve.init.target.getSurface(),
.next( () => {
var surface = ve.init.target.getSurface(),
wikitextInput = this.wikitextLayout.textInput;
this.titleButton.setDisabled( true );
this.wikitextLayout.textInput.pushPending();
@ -117,13 +116,13 @@ ve.ui.MWExportWikitextDialog.prototype.getSetupProcess = function ( data ) {
wikitextInput.setValue( wikitext.trim() );
wikitextInput.$input.scrollTop( 0 );
wikitextInput.popPending();
dialog.titleButton.setDisabled( false );
dialog.updateSize();
this.titleButton.setDisabled( false );
this.updateSize();
}, () => {
// TODO: Display API errors
wikitextInput.popPending();
} );
}, this );
} );
};
/**
@ -131,7 +130,7 @@ ve.ui.MWExportWikitextDialog.prototype.getSetupProcess = function ( data ) {
*/
ve.ui.MWExportWikitextDialog.prototype.getReadyProcess = function ( data ) {
return ve.ui.MWExportWikitextDialog.super.prototype.getReadyProcess.call( this, data )
.next( function () {
.next( () => {
this.titleInput.focus();
// Fix height of wikitext input
@ -148,7 +147,7 @@ ve.ui.MWExportWikitextDialog.prototype.getReadyProcess = function ( data ) {
);
}
}, this );
} );
};
/**
@ -156,9 +155,9 @@ ve.ui.MWExportWikitextDialog.prototype.getReadyProcess = function ( data ) {
*/
ve.ui.MWExportWikitextDialog.prototype.getTeardownProcess = function ( data ) {
return ve.ui.MWExportWikitextDialog.super.prototype.getTeardownProcess.call( this, data )
.next( function () {
.next( () => {
this.wikitextLayout.textInput.setValue( '' );
}, this );
} );
};
/**