From 0167346cbb99ae1f21e1861feadcfd3644dce694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 25 Oct 2023 13:39:13 +0200 Subject: [PATCH] ve.ui.MWEditSummaryWidget: Use built-in 'allowLinebreaks' option New in OOUI v0.48.2. Change-Id: I28dfa2405167ee4b9d9cd2fd3bb3e15498247ac6 --- extension.json | 2 +- .../ui/widgets/ve.ui.MWEditSummaryWidget.js | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/extension.json b/extension.json index 1558f915aa..e0c12814cb 100644 --- a/extension.json +++ b/extension.json @@ -24,7 +24,7 @@ "license-name": "MIT", "type": "editor", "requires": { - "MediaWiki": ">= 1.41" + "MediaWiki": ">= 1.42" }, "callback": "MediaWiki\\Extension\\VisualEditor\\Hooks::onRegistration", "ServiceWiringFiles": [ diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js index cfcfa95116..e736c82eae 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js @@ -23,10 +23,7 @@ ve.ui.MWEditSummaryWidget = function VeUiMWEditSummaryWidget( config ) { ve.ui.MWEditSummaryWidget.super.call( this, ve.extendObject( { autosize: true, maxRows: 15, - inputFilter: function ( value ) { - // Prevent the user from inputting newlines (this kicks in on paste, etc.) - return value.replace( /\r?\n/g, ' ' ); - } + allowLinebreaks: false }, config ) ); // Mixin method @@ -131,19 +128,6 @@ ve.ui.MWEditSummaryWidget.prototype.adjustSize = function () { return this; }; -/** - * @inheritdoc - */ -ve.ui.MWEditSummaryWidget.prototype.onKeyPress = function ( e ) { - if ( e.which === OO.ui.Keys.ENTER ) { - e.preventDefault(); - } - // Grand-parent method - // Multi-line only fires 'enter' on ctrl+enter, but this should - // fire on plain enter as it behaves like a single line input. - OO.ui.TextInputWidget.prototype.onKeyPress.call( this, e ); -}; - /** * Get recent edit summaries for the logged in user *