Added formenctype to <sl-button> (#1009)

* added formenctype to sl-button

* updated changelog

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
This commit is contained in:
Bünyamin Eskiocak
2022-11-21 20:37:54 +03:00
committed by GitHub
parent daebd08475
commit bc6a813c46
3 changed files with 6 additions and 1 deletions

View File

@@ -116,6 +116,10 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon
/** Used to override the form owner's `action` attribute. */
@property({ attribute: 'formaction' }) formAction: string;
/** Used to override the form owner's `enctype` attribute. */
@property({ attribute: 'formenctype' })
formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
/** Used to override the form owner's `method` attribute. */
@property({ attribute: 'formmethod' }) formMethod: 'post' | 'get';

View File

@@ -234,7 +234,7 @@ export class FormSubmitController implements ReactiveController {
// Pass form attributes through to the temporary button
if (invoker) {
['formaction', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => {
['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => {
if (invoker.hasAttribute(attr)) {
button.setAttribute(attr, invoker.getAttribute(attr)!);
}