mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Record usage statistics for syntax highlighting
Bug: T260138 Change-Id: Ic9b95d6331bf85704822a69483880faaaa578a0e
This commit is contained in:
parent
de62f40fc2
commit
7d01567c4f
|
@ -167,6 +167,11 @@
|
|||
"ext.CodeMirror.visualEditor.init",
|
||||
"ext.CodeMirror.visualEditor"
|
||||
]
|
||||
},
|
||||
"EventLogging": {
|
||||
"Schemas": {
|
||||
"CodeMirrorUsage": 20713609
|
||||
}
|
||||
}
|
||||
},
|
||||
"manifest_version": 2
|
||||
|
|
|
@ -210,6 +210,18 @@
|
|||
setCodeEditorPreference( true );
|
||||
}
|
||||
updateToolbarButton();
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
mw.track( 'event.CodeMirrorUsage', {
|
||||
editor: 'wikitext',
|
||||
enabled: codeMirror !== null,
|
||||
toggled: true,
|
||||
session_token: mw.user.sessionId(),
|
||||
user_id: mw.user.getId(),
|
||||
// eslint-disable-next-line no-jquery/no-global-selector
|
||||
edit_start_ts_ms: parseInt( $( 'input[name="wpStarttime"]' ).val() ) * 1000 || 0
|
||||
} );
|
||||
/* eslint-enable camelcase */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,8 +261,19 @@
|
|||
if ( useCodeMirror ) {
|
||||
enableCodeMirror();
|
||||
}
|
||||
|
||||
updateToolbarButton();
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
mw.track( 'event.CodeMirrorUsage', {
|
||||
editor: 'wikitext',
|
||||
enabled: useCodeMirror,
|
||||
toggled: false,
|
||||
session_token: mw.user.sessionId(),
|
||||
user_id: mw.user.getId(),
|
||||
// eslint-disable-next-line no-jquery/no-global-selector
|
||||
edit_start_ts_ms: parseInt( $( 'input[name="wpStarttime"]' ).val() ) * 1000 || 0
|
||||
} );
|
||||
/* eslint-enable camelcase */
|
||||
}
|
||||
|
||||
$( function () {
|
||||
|
|
|
@ -44,6 +44,17 @@ ve.ui.CodeMirrorTool.prototype.onSelect = function () {
|
|||
|
||||
new mw.Api().saveOption( 'usecodemirror', useCodeMirror ? 1 : 0 );
|
||||
mw.user.options.set( 'usecodemirror', useCodeMirror ? 1 : 0 );
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
mw.track( 'event.CodeMirrorUsage', {
|
||||
editor: 'wikitext-2017',
|
||||
enabled: useCodeMirror,
|
||||
toggled: true,
|
||||
session_token: mw.user.sessionId(),
|
||||
user_id: mw.user.getId(),
|
||||
edit_start_ts_ms: ( this.toolbar.target.startTimeStamp * 1000 ) || 0
|
||||
} );
|
||||
/* eslint-enable camelcase */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -60,6 +71,19 @@ ve.ui.CodeMirrorTool.prototype.onSurfaceChange = function ( oldSurface, newSurfa
|
|||
useCodeMirror = mw.user.options.get( 'usecodemirror' ) > 0;
|
||||
command.execute( surface, [ useCodeMirror ] );
|
||||
this.setActive( useCodeMirror );
|
||||
|
||||
if ( this.toolbar.target.startTimeStamp ) {
|
||||
/* eslint-disable camelcase */
|
||||
mw.track( 'event.CodeMirrorUsage', {
|
||||
editor: 'wikitext-2017',
|
||||
enabled: useCodeMirror,
|
||||
toggled: false,
|
||||
session_token: mw.user.sessionId(),
|
||||
user_id: mw.user.getId(),
|
||||
edit_start_ts_ms: ( this.toolbar.target.startTimeStamp * 1000 ) || 0
|
||||
} );
|
||||
/* eslint-enable camelcase */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue