prompt id always lowercase. see #12

This commit is contained in:
mic 2024-05-14 18:03:02 +02:00
parent 237a325567
commit 2fe25e2e84
3 changed files with 7 additions and 3 deletions

View file

@ -105,7 +105,7 @@
},
"customPrompts_form_label_ID_rules": {
"message": "Must be unique and without spaces",
"message": "Must be unique, lowercase and without spaces",
"description": ""
},

View file

@ -137,4 +137,8 @@ table.prompts_list td.properties{
.small_label{
font-size: small;
font-style: italic;
}
#txtIdNew, .id_output{
text-transform: lowercase;
}

View file

@ -247,7 +247,7 @@ document.addEventListener('DOMContentLoaded', async () => {
tr.querySelector('.btnEditItem').style.display = 'inline'; // Edit btn
tr.querySelector('.btnDeleteItem').style.display = 'inline'; // Delete btn
// Update item data
tr.querySelector('.id_show').innerText = tr.querySelector('.id_output').value;
tr.querySelector('.id_show').innerText = String(tr.querySelector('.id_output').value).toLocaleLowerCase();
tr.querySelector('.name_show').innerText = tr.querySelector('.name_output').value;
tr.querySelector('.text_show').innerText = tr.querySelector('.text_output').value;
tr.querySelector('.type').innerText = tr.querySelector('.type_output').value;
@ -326,7 +326,7 @@ document.addEventListener('DOMContentLoaded', async () => {
return;
}
let newItem = promptsList.add({
id: txtIdNew.value.trim(),
id: String(txtIdNew.value.trim()).toLocaleLowerCase(),
name: txtNameNew.value.trim(),
text: txtTextNew.value.trim(),
type: selectTypeNew.value,