mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix color picker widget defaulting to black instead of its initial value and firing change event when added to DOM
This commit is contained in:
@ -166,9 +166,15 @@ export class SettingsUi {
|
|||||||
qrs.injectInput = this.injectInput.checked;
|
qrs.injectInput = this.injectInput.checked;
|
||||||
qrs.save();
|
qrs.save();
|
||||||
});
|
});
|
||||||
|
let initialColorChange = true;
|
||||||
this.color = this.dom.querySelector('#qr--color');
|
this.color = this.dom.querySelector('#qr--color');
|
||||||
this.color.addEventListener('change', (evt)=>{
|
this.color.addEventListener('change', (evt)=>{
|
||||||
const qrs = this.currentQrSet;
|
const qrs = this.currentQrSet;
|
||||||
|
if (initialColorChange) {
|
||||||
|
initialColorChange = false;
|
||||||
|
this.color.color = qrs.color;
|
||||||
|
return;
|
||||||
|
}
|
||||||
qrs.color = evt.detail.rgb;
|
qrs.color = evt.detail.rgb;
|
||||||
qrs.save();
|
qrs.save();
|
||||||
this.currentQrSet.updateColor();
|
this.currentQrSet.updateColor();
|
||||||
@ -194,7 +200,7 @@ export class SettingsUi {
|
|||||||
this.disableSend.checked = this.currentQrSet.disableSend;
|
this.disableSend.checked = this.currentQrSet.disableSend;
|
||||||
this.placeBeforeInput.checked = this.currentQrSet.placeBeforeInput;
|
this.placeBeforeInput.checked = this.currentQrSet.placeBeforeInput;
|
||||||
this.injectInput.checked = this.currentQrSet.injectInput;
|
this.injectInput.checked = this.currentQrSet.injectInput;
|
||||||
this.color.color = this.currentQrSet.color;
|
// this.color.color = this.currentQrSet.color ?? 'transparent';
|
||||||
this.onlyBorderColor.checked = this.currentQrSet.onlyBorderColor;
|
this.onlyBorderColor.checked = this.currentQrSet.onlyBorderColor;
|
||||||
this.qrList.innerHTML = '';
|
this.qrList.innerHTML = '';
|
||||||
const qrsDom = this.currentQrSet.renderSettings();
|
const qrsDom = this.currentQrSet.renderSettings();
|
||||||
|
Reference in New Issue
Block a user