Merge "Realtime Preview: add event tracking to triggered events"

This commit is contained in:
jenkins-bot 2022-07-27 07:19:40 +00:00 committed by Gerrit Code Review
commit 2f1e4604ee
3 changed files with 17 additions and 0 deletions

View file

@ -269,5 +269,17 @@
mw.hook( 'ext.WikiEditor.realtimepreview.disable' ).add( function () {
logEditFeature( 'preview', 'preview-realtime-off' );
} );
mw.hook( 'ext.WikiEditor.realtimepreview.stop' ).add( function () {
logEditFeature( 'preview', 'preview-realtime-error-stopped' );
} );
mw.hook( 'ext.WikiEditor.realtimepreview.reloadError' ).add( function () {
logEditFeature( 'preview', 'preview-realtime-reload-error' );
} );
mw.hook( 'ext.WikiEditor.realtimepreview.reloadHover' ).add( function () {
logEditFeature( 'preview', 'preview-realtime-reload-hover' );
} );
mw.hook( 'ext.WikiEditor.realtimepreview.reloadManual' ).add( function () {
logEditFeature( 'preview', 'preview-realtime-reload-manual' );
} );
}() );

View file

@ -40,6 +40,7 @@ function ManualWidget( realtimePreview, reloadHoverButton ) {
if ( this.enabled ) {
this.doRealtimePreview();
}
mw.hook( 'ext.WikiEditor.realtimepreview.reloadManual' ).fire( this );
}.bind( realtimePreview )
} );
this.$element.append( this.$icon, $reloadLabel, $reloadButton );

View file

@ -36,6 +36,7 @@ function RealtimePreview() {
this.manualWidget.toggle( true );
}
this.doRealtimePreview();
mw.hook( 'ext.WikiEditor.realtimepreview.reloadError' ).fire( this );
}.bind( this )
} );
@ -53,6 +54,8 @@ function RealtimePreview() {
if ( this.enabled ) {
this.doRealtimePreview( true );
}
// Let other things happen after refreshing.
mw.hook( 'ext.WikiEditor.realtimepreview.reloadHover' ).fire( this );
}.bind( this )
} );
@ -304,6 +307,7 @@ RealtimePreview.prototype.checkResponseTimes = function ( time ) {
if ( ( totalResponseTime / this.responseTimes.length ) > this.configData.realtimeDisableDuration ) {
this.inManualMode = true;
this.manualWidget.toggle( true );
mw.hook( 'ext.WikiEditor.realtimepreview.stop' ).fire( this );
}
this.responseTimes.shift();