Update perform-edits-dialog.js to trap [RETURN] in editSummary and proceed to action (#2550)

* Update perform-edits-dialog.js

Adding PerformEditsDialog.doFormSubmit() to share with keypress() [RETURN] from editField and « Edit Uploads ».

* var doFormSubmit = function()…

Change PerformEditsDialog.doFormSubmit to  var doFormSubmit = function()

* Update perform-edits-dialog.js

Convert [TAB] to 2x [SPACE].

* Update perform-edits-dialog.js

Move evt.preventDefault(); to where it belongs.

* Update perform-edits-dialog.js

Spacing corrections.

* Update perform-edits-dialog.js

Spacing corrections.
This commit is contained in:
Antoine Beaubien 2020-04-20 03:16:06 -04:00 committed by GitHub
parent bf84fc9cf1
commit da5bdcfdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,26 +18,15 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
this._elmts.performEditsButton.text($.i18n('perform-wikidata-edits/perform-edits'));
this._elmts.cancelButton.text($.i18n('perform-wikidata-edits/cancel'));
var hiddenIframe = $('#hiddenIframe').contents();
var dismiss = function() {
DialogSystem.dismissUntil(self._level - 1);
};
elmts.loggedInUsername
.text(logged_in_username)
.attr('href','https://www.wikidata.org/wiki/User:'+logged_in_username);
frame.find('.cancel-button').click(function() {
dismiss();
});
var hiddenIframe = $('#hiddenIframe').contents();
if (max_severity === 'CRITICAL') {
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
} else {
elmts.performEditsButton.click(function() {
hiddenIframe.find('body').append(
elmts.performEditsForm.clone());
var doFormSubmit = function() {
hiddenIframe.find('body').append(elmts.performEditsForm.clone());
var formCopy = hiddenIframe.find("#wikibase-perform-edits-form");
formCopy.submit();
@ -48,16 +37,33 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
"wikidata",
"perform-wikibase-edits",
{},
{
summary: elmts.editSummary.val(),
},
{ summary: elmts.editSummary.val(), },
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
{ onDone:
function() {
{ onDone: function() { dismiss(); } }
);
}
}
elmts.loggedInUsername
.text(logged_in_username)
.attr('href','https://www.wikidata.org/wiki/User:'+logged_in_username);
frame.find('.cancel-button').click(function() {
dismiss();
});
this._elmts.editSummary.keypress(function (evt) {
if (evt.which === 13) {
doFormSubmit();
evt.preventDefault();
}
});
}
if (max_severity === 'CRITICAL') {
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
} else {
elmts.performEditsButton.click(function() {
doFormSubmit();
});
}
};