Use Array#push instead of Array#concat

Change-Id: I605e726fce1cf1acf39ffdcfe8c7cd51c032a372
This commit is contained in:
Ed Sanders 2024-05-24 13:53:04 +01:00 committed by Bartosz Dziewoński
parent ea5639b20b
commit 177639f5be
2 changed files with 14 additions and 12 deletions

View file

@ -251,22 +251,24 @@ function getCheckboxesPromise( pageName, oldId ) {
* @return {string[]} * @return {string[]}
*/ */
function getReplyWidgetModules() { function getReplyWidgetModules() {
const veConf = mw.config.get( 'wgVisualEditorConfig' ); const modules = [];
let modules = [ 'ext.discussionTools.ReplyWidget' ]
.concat( veConf.pluginModules.filter( mw.loader.getState ) );
if ( OO.ui.isMobile() ) { if ( OO.ui.isMobile() ) {
modules = [ modules.push(
'ext.visualEditor.core.mobile', 'ext.visualEditor.core.mobile',
'ext.visualEditor.mwextensions' 'ext.visualEditor.mwextensions'
].concat( modules ); );
} else { } else {
modules = [ modules.push(
'ext.visualEditor.core.desktop', 'ext.visualEditor.core.desktop',
'ext.visualEditor.desktopTarget', 'ext.visualEditor.desktopTarget',
'ext.visualEditor.mwextensions.desktop' 'ext.visualEditor.mwextensions.desktop'
].concat( modules ); );
} }
modules.push( 'ext.discussionTools.ReplyWidget' );
const veConf = mw.config.get( 'wgVisualEditorConfig' );
modules.push( ...veConf.pluginModules.filter( mw.loader.getState ) );
return modules; return modules;
} }

View file

@ -11,7 +11,7 @@ require( './CommentTarget.js' );
* @param {Object} [config] Configuration options * @param {Object} [config] Configuration options
*/ */
function CommentTargetWidget( replyWidget, config ) { function CommentTargetWidget( replyWidget, config ) {
let excludeCommands = [ const excludeCommands = [
'blockquoteWrap', // T258194 'blockquoteWrap', // T258194
// Disable to allow Tab/Shift+Tab to move focus out of the widget (T172694) // Disable to allow Tab/Shift+Tab to move focus out of the widget (T172694)
'indent', 'indent',
@ -26,7 +26,7 @@ function CommentTargetWidget( replyWidget, config ) {
]; ];
if ( !replyWidget.isNewTopic ) { if ( !replyWidget.isNewTopic ) {
excludeCommands = excludeCommands.concat( [ excludeCommands.push(
// Disable commands for things whose wikitext markup doesn't work when indented // Disable commands for things whose wikitext markup doesn't work when indented
'heading1', 'heading1',
'heading2', 'heading2',
@ -37,10 +37,10 @@ function CommentTargetWidget( replyWidget, config ) {
'insertTable', 'insertTable',
'transclusionFromSequence', // T253667 'transclusionFromSequence', // T253667
'preformatted' 'preformatted'
] ); );
} }
config = Object.assign( {}, { config = Object.assign( {
excludeCommands: excludeCommands excludeCommands: excludeCommands
}, config ); }, config );