Stop dictionary update if name or specification blank

This commit is contained in:
Robbie Antenesse 2019-07-10 13:23:32 -06:00 committed by Robbie Antenesse
parent a2542fe7a1
commit f9fa6a178d
4 changed files with 10 additions and 2 deletions

View File

@ -54,7 +54,13 @@ export function saveEditModal() {
const updatedDictionary = cloneObject(window.currentDictionary);
delete updatedDictionary.words;
updatedDictionary.name = removeTags(document.getElementById('editName').value.trim());
if (updatedDictionary.name.length < 1) {
updatedDictionary.name = window.currentDictionary.name;
}
updatedDictionary.specification = removeTags(document.getElementById('editSpecification').value.trim());
if (updatedDictionary.specification.length < 1) {
updatedDictionary.specification = window.currentDictionary.specification;
}
updatedDictionary.description = removeTags(document.getElementById('editDescription').value.trim());
updatedDictionary.partsOfSpeech = document.getElementById('editPartsOfSpeech').value.split(',').map(val => val.trim()).filter(val => val !== '');
updatedDictionary.alphabeticalOrder = document.getElementById('editAlphabeticalOrder').value.split(' ').map(val => val.trim()).filter(val => val !== '');

View File

@ -279,7 +279,7 @@ $nav-font-height: 16px;
#editDescription {
width: 100%;
height: 280px;
height: 240px;
}
}

View File

@ -89,7 +89,7 @@ $mobile-word-form-size: 32px;
}
#editDescription {
width: 100%;
height: 260px;
height: 220px;
}
}

View File

@ -245,9 +245,11 @@
<section id="editDescriptionTab">
<label>Name<br>
<input id="editName" maxlength="50">
<small>Won't update if left blank.</small>
</label>
<label>Specification<br>
<input id="editSpecification" maxlength="50">
<small>Won't update if left blank.</small>
</label>
<label>Description<a class="label-button maximize-button">Maximize</a><br>
<textarea id="editDescription"></textarea>