Trim and filter etymology entries into array

This commit is contained in:
Robbie Antenesse 2020-04-29 23:52:31 -06:00
parent 4fee98c8fe
commit 5f15ec6353
1 changed files with 3 additions and 2 deletions

View File

@ -186,7 +186,7 @@ export function submitWordForm() {
};
if (removeTags(etymology).trim() !== '') {
word.etymology = removeTags(etymology).trim();
word.etymology = removeTags(etymology).split(',').map(w => w.trim()).filter(w => w.length > 0);
}
if (validateWord(word)) {
@ -209,6 +209,7 @@ export function clearWordForm() {
document.getElementById('wordPartOfSpeech').value = '';
document.getElementById('wordDefinition').value = '';
document.getElementById('wordDetails').value = '';
document.getElementById('wordEtymology').value = '';
document.getElementById('wordName').focus();
}
@ -283,7 +284,7 @@ export function confirmEditWord(id) {
};
if (removeTags(etymology).trim() !== '') {
word.etymology = removeTags(etymology).trim();
word.etymology = removeTags(etymology).split(',').map(w => w.trim()).filter(w => w.length > 0);
}
if (validateWord(word, wordId)) {