Make alphabetical order editable

This commit is contained in:
Robbie Antenesse 2019-07-09 13:06:03 -06:00 committed by Robbie Antenesse
parent 2bf0f15f67
commit aa956e9820
2 changed files with 13 additions and 6 deletions

View File

@ -13,7 +13,7 @@ export function updateDictionary () {
}
export function openEditModal() {
const { name, specification, description, partsOfSpeech } = window.currentDictionary;
const { name, specification, description, partsOfSpeech, alphabeticalOrder } = window.currentDictionary;
const { consonants, vowels, blends } = window.currentDictionary.details.phonology;
const { phonotactics, orthography, grammar } = window.currentDictionary.details;
const { allowDuplicates, caseSensitive, sortByDefinition, theme, isPublic } = window.currentDictionary.settings;
@ -22,6 +22,7 @@ export function openEditModal() {
document.getElementById('editSpecification').value = specification;
document.getElementById('editDescription').value = description;
document.getElementById('editPartsOfSpeech').value = partsOfSpeech.join(',');
document.getElementById('editAlphabeticalOrder').value = alphabeticalOrder.join(' ');
document.getElementById('editConsonants').value = consonants.join(' ');
document.getElementById('editVowels').value = vowels.join(' ');
@ -52,6 +53,7 @@ export function saveEditModal() {
window.currentDictionary.specification = removeTags(document.getElementById('editSpecification').value.trim());
window.currentDictionary.description = removeTags(document.getElementById('editDescription').value.trim());
window.currentDictionary.partsOfSpeech = document.getElementById('editPartsOfSpeech').value.split(',').map(val => val.trim()).filter(val => val !== '');
window.currentDictionary.alphabeticalOrder = document.getElementById('editAlphabeticalOrder').value.split(' ').map(val => val.trim()).filter(val => val !== '');
window.currentDictionary.details.phonology.consonants = document.getElementById('editConsonants').value.split(' ').map(val => val.trim()).filter(val => val !== '');
window.currentDictionary.details.phonology.vowels = document.getElementById('editVowels').value.split(' ').map(val => val.trim()).filter(val => val !== '');
@ -75,14 +77,15 @@ export function saveEditModal() {
} else {
window.currentDictionary.settings.isPublic = false;
}
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
saveDictionary();
renderTheme();
renderDictionaryDetails();
renderPartsOfSpeech();
sortWords(true);
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
saveDictionary();
if (hasToken()) {
import('./account/index.js').then(account => {
account.uploadDetailsDirect();

View File

@ -255,8 +255,12 @@
<label>Parts of Speech <small>(Comma Separated List)</small><br>
<input id="editPartsOfSpeech" maxlength="2500" placeholder="Noun,Adjective,Verb">
</label>
<label>Alphabetical Order <small>(Comma Separated List. Include every letter!)</small><br>
<input id="editAlphabeticalOrder" disabled value="English Alphabet">
<label>Alphabetical Order <small>(Space Separated List)</small><br>
<input id="editAlphabeticalOrder" placeholder="a A b B c C d D ...">
<a class="label-help-button" onclick="alert('Include every letter and case! Any letters used in your words that are not specified will be sorted in the default order below your alphabetically custom-sorted words.\n\nLexiconga can only sort by single characters and will sort by the words AS ENTERED, not using orthographic translation.')">
Field Info
</a>&nbsp;
<small>Leave blank for default (case-insensitive ASCII/Unicode sorting)</small>
</label>
<h3>Phonology</h3>
<div class="split three">