mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Log editor switches to visualeditorfeatureuse
Depends lightly on a patch to WikiEditor, which will hook up the logging there for the case where the switch is happening from WikiEditor to VisualEditor on the same pageload. Bug: T221191 Change-Id: Ibafec77b2eabd3b3b3767472b7b5a40e3312bf18
This commit is contained in:
parent
10de6f2c2f
commit
38e3c3fbdb
|
@ -1182,6 +1182,7 @@
|
|||
switchToolbar.on( 'switchEditor', function ( mode ) {
|
||||
if ( mode === 'visual' ) {
|
||||
init.activateVe( 'visual' );
|
||||
$( '#wpTextbox1' ).trigger( 'wikiEditor-switching-visualeditor' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
|
@ -1519,6 +1519,40 @@ ve.init.mw.DesktopArticleTarget.prototype.onUnload = function () {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.switchToVisualEditor = function () {
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.switchToVisualEditor.apply( this, arguments );
|
||||
|
||||
if ( ve.init.target.isModeAvailable( 'visual' ) ) {
|
||||
ve.track( 'activity.editor-switch', { action: 'visual-desktop' } );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.switchToWikitextEditor = function () {
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.switchToWikitextEditor.apply( this, arguments );
|
||||
|
||||
if ( ve.init.target.isModeAvailable( 'source' ) ) {
|
||||
ve.track( 'activity.editor-switch', { action: 'source-nwe-desktop' } );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.switchToWikitextSection = function () {
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.switchToWikitextSection.apply( this, arguments );
|
||||
|
||||
ve.track( 'activity.editor-switch', { action: 'source-nwe-desktop' } );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -1533,6 +1567,7 @@ ve.init.mw.DesktopArticleTarget.prototype.switchToFallbackWikitextEditor = funct
|
|||
prefPromise = mw.libs.ve.setEditorPreference( 'wikitext' );
|
||||
|
||||
if ( !modified ) {
|
||||
ve.track( 'activity.editor-switch', { action: 'source-desktop' } );
|
||||
ve.track( 'mwedit.abort', { type: 'switchnochange', mechanism: 'navigate', mode: 'visual' } );
|
||||
this.submitting = true;
|
||||
prefPromise.done( function () {
|
||||
|
@ -1551,6 +1586,7 @@ ve.init.mw.DesktopArticleTarget.prototype.switchToFallbackWikitextEditor = funct
|
|||
this.serialize(
|
||||
this.getDocToSave(),
|
||||
function ( wikitext ) {
|
||||
ve.track( 'activity.editor-switch', { action: 'source-desktop' } );
|
||||
ve.track( 'mwedit.abort', { type: 'switchwith', mechanism: 'navigate', mode: 'visual' } );
|
||||
target.submitWithSaveFields( { wpDiff: true, wpAutoSummary: '' }, wikitext );
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if ( ve.init.target.constructor.static.platformType === 'phone' ) {
|
||||
if ( ve.init.target && ve.init.target.constructor.static.platformType === 'phone' ) {
|
||||
// handled in MobileFrontend for session-identification reasons
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue