Initialize tab state to avoid flicker

Also set 'defaultMode' before calling parent constructor.

Bug: T234403
Change-Id: I08320bd539419ddf7ba22a5dc316177d751bcb8d
This commit is contained in:
Ed Sanders 2020-05-22 13:20:06 +01:00 committed by Esanders
parent 16cf49e7e4
commit ac476eb4cf
2 changed files with 6 additions and 3 deletions

View file

@ -118,6 +118,9 @@ function ReplyWidget( commentController, parsoidData, config ) {
framed: false framed: false
} ); } );
// Initialize to avoid flicker when switching mode
this.modeTabSelect.selectItemByData( this.getMode() );
this.modeTabSelect.connect( this, { this.modeTabSelect.connect( this, {
choose: 'onModeTabSelectChoose' choose: 'onModeTabSelectChoose'
} ); } );

View file

@ -13,13 +13,13 @@ require( './dt.ui.UsernameCompletion.js' );
* @param {Object} [config] Configuration options * @param {Object} [config] Configuration options
*/ */
function ReplyWidgetVisual() { function ReplyWidgetVisual() {
// Parent constructor
ReplyWidgetVisual.super.apply( this, arguments );
// TODO: Support 2017 wikitext editor // TODO: Support 2017 wikitext editor
this.defaultMode = 'visual'; this.defaultMode = 'visual';
this.initialValue = null; this.initialValue = null;
// Parent constructor
ReplyWidgetVisual.super.apply( this, arguments );
// TODO: Rename this widget to VE, as it isn't just visual mode // TODO: Rename this widget to VE, as it isn't just visual mode
this.$element.addClass( 'dt-ui-replyWidget-ve' ); this.$element.addClass( 'dt-ui-replyWidget-ve' );
} }