diff --git a/modules/ext.wikiEditor.js b/modules/ext.wikiEditor.js index 1ee1b8e5..c858c20a 100644 --- a/modules/ext.wikiEditor.js +++ b/modules/ext.wikiEditor.js @@ -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' ); + } ); }() ); diff --git a/modules/realtimepreview/ManualWidget.js b/modules/realtimepreview/ManualWidget.js index b803da12..53767f60 100644 --- a/modules/realtimepreview/ManualWidget.js +++ b/modules/realtimepreview/ManualWidget.js @@ -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 ); diff --git a/modules/realtimepreview/RealtimePreview.js b/modules/realtimepreview/RealtimePreview.js index cc84e57c..1c16b65e 100644 --- a/modules/realtimepreview/RealtimePreview.js +++ b/modules/realtimepreview/RealtimePreview.js @@ -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();