mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Edit check: some simple counters for steps in the process
Change-Id: Iac0faea1f06eb30ac075a702cdcaaec29e0fbaf0
This commit is contained in:
parent
31bd3f00cd
commit
57daf35bd6
|
@ -166,6 +166,7 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
|
||||||
let saveProcessDeferred;
|
let saveProcessDeferred;
|
||||||
|
|
||||||
mw.hook( 've.preSaveProcess' ).add( ( saveProcess, target ) => {
|
mw.hook( 've.preSaveProcess' ).add( ( saveProcess, target ) => {
|
||||||
|
ve.track( 'counter.editcheck.preSaveChecksAvailable' );
|
||||||
const surface = target.getSurface();
|
const surface = target.getSurface();
|
||||||
|
|
||||||
if ( surface.getMode() !== 'visual' ) {
|
if ( surface.getMode() !== 'visual' ) {
|
||||||
|
@ -181,6 +182,7 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
|
||||||
|
|
||||||
let checks = mw.editcheck.editCheckFactory.createAllByListener( 'onBeforeSave', surface );
|
let checks = mw.editcheck.editCheckFactory.createAllByListener( 'onBeforeSave', surface );
|
||||||
if ( checks.length ) {
|
if ( checks.length ) {
|
||||||
|
ve.track( 'counter.editcheck.preSaveChecksShown' );
|
||||||
mw.editcheck.refCheckShown = true;
|
mw.editcheck.refCheckShown = true;
|
||||||
|
|
||||||
const surfaceView = surface.getView();
|
const surfaceView = surface.getView();
|
||||||
|
@ -323,10 +325,12 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
|
||||||
const delay = ve.createDeferred();
|
const delay = ve.createDeferred();
|
||||||
// If they inserted, wait 2 seconds on desktop before showing save dialog
|
// If they inserted, wait 2 seconds on desktop before showing save dialog
|
||||||
setTimeout( () => {
|
setTimeout( () => {
|
||||||
|
ve.track( 'counter.editcheck.preSaveChecksCompleted' );
|
||||||
delay.resolve();
|
delay.resolve();
|
||||||
}, !OO.ui.isMobile() && data.action !== 'reject' ? 2000 : 0 );
|
}, !OO.ui.isMobile() && data.action !== 'reject' ? 2000 : 0 );
|
||||||
return delay.promise();
|
return delay.promise();
|
||||||
} else {
|
} else {
|
||||||
|
ve.track( 'counter.editcheck.preSaveChecksAbandoned' );
|
||||||
return ve.createDeferred().reject().promise();
|
return ve.createDeferred().reject().promise();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in a new issue