Fix Import section not showing up in settings (#3849)
This commit is contained in:
parent
fc4ba4509f
commit
5e54306fd0
1 changed files with 10 additions and 1 deletions
|
@ -51,7 +51,7 @@ export class SettingSwitchComponent implements AfterContentInit {
|
|||
const inputElement = element.querySelector('input');
|
||||
|
||||
// If no id, generate a random id and assign it to the input
|
||||
inputElement.id = crypto.randomUUID();
|
||||
inputElement.id = this.generateId();
|
||||
|
||||
if (inputElement && inputElement.id) {
|
||||
this.labelId = inputElement.id;
|
||||
|
@ -62,4 +62,13 @@ export class SettingSwitchComponent implements AfterContentInit {
|
|||
});
|
||||
}
|
||||
|
||||
private generateId(): string {
|
||||
if (crypto && crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
// Fallback for browsers without crypto.randomUUID (which has happened multiple times in my user base)
|
||||
return 'id-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now().toString(36);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue