mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-12 01:16:19 +00:00
Merge "Switching editor modes would switch editor_interface before success/fail"
This commit is contained in:
commit
f3c5d405b3
|
@ -350,19 +350,20 @@ ReplyWidget.prototype.onModeTabSelectChoose = function ( option ) {
|
|||
// TODO: We rely on #setup to call #saveEditMode, so when we have 2017WTE
|
||||
// we will need to save the new preference here as switching will not
|
||||
// reload the editor.
|
||||
promise.then( null, function () {
|
||||
promise.then( function () {
|
||||
// Switch succeeded
|
||||
mw.track( 'dt.schemaVisualEditorFeatureUse', {
|
||||
feature: 'editor-switch',
|
||||
// TODO: Log as `source-nwe-desktop` when enable2017Wikitext is set
|
||||
action: ( mode === 'visual' ? 'visual' : 'source' ) + '-desktop'
|
||||
} );
|
||||
}, function () {
|
||||
// Switch failed, restore previous tab selection
|
||||
widget.modeTabSelect.selectItemByData( mode === 'source' ? 'visual' : 'source' );
|
||||
} ).always( function () {
|
||||
widget.setPending( false );
|
||||
widget.modeTabSelect.setDisabled( false );
|
||||
} );
|
||||
|
||||
mw.track( 'dt.schemaVisualEditorFeatureUse', {
|
||||
feature: 'editor-switch',
|
||||
// TODO: Log as `source-nwe-desktop` when enable2017Wikitext is set
|
||||
action: ( mode === 'visual' ? 'visual' : 'source' ) + '-desktop'
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -224,7 +224,8 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
|
|||
) ? 1 : sampleRate );
|
||||
}
|
||||
|
||||
if ( data.feature === 'editor-switch' ) {
|
||||
if ( data.feature === 'editor-switch' && data.action.indexOf( 'dialog-' ) === -1 ) {
|
||||
// TODO: Account for `source-nwe-desktop` when enable2017Wikitext is set
|
||||
// eslint-disable-next-line camelcase
|
||||
session.editor_interface = session.editor_interface === 'visualeditor' ? 'wikitext' : 'visualeditor';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue