Typescript and lit version change + fix form submit.

This commit is contained in:
John Livingston
2024-05-23 18:35:23 +02:00
committed by Mehdi Benadel
parent afec3d90ed
commit 0672dc24a0
5 changed files with 97 additions and 48 deletions

View File

@ -47,7 +47,8 @@ export class ChannelConfigurationElement extends LivechatElement {
});
private _saveConfig = () => {
private _saveConfig = (ev?: Event) => {
ev?.preventDefault()
if (this._channelDetailsService && this._channelConfiguration) {
this._channelDetailsService.saveOptions(this._channelConfiguration.channel.id, this._channelConfiguration.configuration)
.then((value) => {
@ -183,7 +184,7 @@ export class ChannelConfigurationElement extends LivechatElement {
</livechat-help-button>
</h1>
<p>${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_DESC)}</p>
<form livechat-configuration-channel-options role="form">
<form livechat-configuration-channel-options role="form" @submit=${this._saveConfig}>
<div class="row mt-3">
<div class="row mt-5">
<div class="col-12 col-lg-4 col-xl-3">
@ -339,7 +340,7 @@ export class ChannelConfigurationElement extends LivechatElement {
: ''
}
<div class="form-group mt-5">
<button type="button" class="peertube-button-link orange-button" @click=${this._saveConfig}>${ptTr(LOC_SAVE)}</button>
<input type="submit" class="peertube-button-link orange-button" value=${ptTr(LOC_SAVE)} />
</div>
${(this._formStatus && this._formStatus.success === undefined) ?
html`<div class="alert alert-warning" role="alert">

View File

@ -115,7 +115,7 @@ export class DynamicTableFormElement extends LitElement {
}
`;
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
protected createRenderRoot = () => {
if (document.head.querySelector(`style[data-tagname="${this.tagName}"]`)) {
return this;
}

View File

@ -8,7 +8,7 @@ import { LitElement } from 'lit'
* Base class for all Custom Elements.
*/
export class LivechatElement extends LitElement {
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
protected createRenderRoot = () => {
return this
}
}