Stop dictionary update if name or specification blank
This commit is contained in:
parent
a2542fe7a1
commit
f9fa6a178d
|
@ -54,7 +54,13 @@ export function saveEditModal() {
|
||||||
const updatedDictionary = cloneObject(window.currentDictionary);
|
const updatedDictionary = cloneObject(window.currentDictionary);
|
||||||
delete updatedDictionary.words;
|
delete updatedDictionary.words;
|
||||||
updatedDictionary.name = removeTags(document.getElementById('editName').value.trim());
|
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());
|
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.description = removeTags(document.getElementById('editDescription').value.trim());
|
||||||
updatedDictionary.partsOfSpeech = document.getElementById('editPartsOfSpeech').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
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 !== '');
|
updatedDictionary.alphabeticalOrder = document.getElementById('editAlphabeticalOrder').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
||||||
|
|
|
@ -279,7 +279,7 @@ $nav-font-height: 16px;
|
||||||
|
|
||||||
#editDescription {
|
#editDescription {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 280px;
|
height: 240px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ $mobile-word-form-size: 32px;
|
||||||
}
|
}
|
||||||
#editDescription {
|
#editDescription {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 260px;
|
height: 220px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,9 +245,11 @@
|
||||||
<section id="editDescriptionTab">
|
<section id="editDescriptionTab">
|
||||||
<label>Name<br>
|
<label>Name<br>
|
||||||
<input id="editName" maxlength="50">
|
<input id="editName" maxlength="50">
|
||||||
|
<small>Won't update if left blank.</small>
|
||||||
</label>
|
</label>
|
||||||
<label>Specification<br>
|
<label>Specification<br>
|
||||||
<input id="editSpecification" maxlength="50">
|
<input id="editSpecification" maxlength="50">
|
||||||
|
<small>Won't update if left blank.</small>
|
||||||
</label>
|
</label>
|
||||||
<label>Description<a class="label-button maximize-button">Maximize</a><br>
|
<label>Description<a class="label-button maximize-button">Maximize</a><br>
|
||||||
<textarea id="editDescription"></textarea>
|
<textarea id="editDescription"></textarea>
|
||||||
|
|
Loading…
Reference in New Issue