Enable autocomplete on summaries. Closes #1778.

This commit is contained in:
Antonin Delpeuch 2018-10-28 10:06:19 +01:00
parent 3fb282852d
commit 5b810f7c6e
2 changed files with 17 additions and 6 deletions

View File

@ -6,12 +6,15 @@
<div class="perform-edits-warnings-area" bind="warningsArea">
</div>
<div class="wikibase-perform-edits-area">
<form id="wikibase-perform-edits-form" onsubmit="return false;" bind="performEditsForm" autocomplete="on">
<p><span bind="loggedInAs"></span> <a bind="loggedInUsername" target="_blank"></a>.</p>
<p><span bind="editSummaryLabel"></span> <input type="text" name="editSummary" bind="editSummary" class="edit-summary" value="" /></p>
<div class="wikibase-login-buttons">
<button class="button cancel-button" bind="cancelButton"></button>
<button class="button button-primary" bind="performEditsButton"></button>
</div>
</form>
<iframe id="hiddeniframe" src="javascript:false" class="hidden" bind="hiddenIframe"></iframe>
</div>
</div>
</div>

View File

@ -30,10 +30,17 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
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 formCopy = hiddenIframe.find("#wikibase-perform-edits-form");
formCopy.submit();
if(elmts.editSummary.val().length == 0) {
elmts.editSummary.focus();
} else {
@ -51,6 +58,7 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
}
});
}
event.preventDefault();
});
}
};