Merge "ve.ui.MWEditSummaryWidget: Use built-in 'allowLinebreaks' option"

This commit is contained in:
jenkins-bot 2023-10-26 15:55:41 +00:00 committed by Gerrit Code Review
commit aac7f99742
2 changed files with 2 additions and 18 deletions

View file

@ -24,7 +24,7 @@
"license-name": "MIT", "license-name": "MIT",
"type": "editor", "type": "editor",
"requires": { "requires": {
"MediaWiki": ">= 1.41" "MediaWiki": ">= 1.42"
}, },
"callback": "MediaWiki\\Extension\\VisualEditor\\Hooks::onRegistration", "callback": "MediaWiki\\Extension\\VisualEditor\\Hooks::onRegistration",
"ServiceWiringFiles": [ "ServiceWiringFiles": [

View file

@ -23,10 +23,7 @@ ve.ui.MWEditSummaryWidget = function VeUiMWEditSummaryWidget( config ) {
ve.ui.MWEditSummaryWidget.super.call( this, ve.extendObject( { ve.ui.MWEditSummaryWidget.super.call( this, ve.extendObject( {
autosize: true, autosize: true,
maxRows: 15, maxRows: 15,
inputFilter: function ( value ) { allowLinebreaks: false
// Prevent the user from inputting newlines (this kicks in on paste, etc.)
return value.replace( /\r?\n/g, ' ' );
}
}, config ) ); }, config ) );
// Mixin method // Mixin method
@ -131,19 +128,6 @@ ve.ui.MWEditSummaryWidget.prototype.adjustSize = function () {
return this; 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 * Get recent edit summaries for the logged in user
* *