Fixed using ctrl+enter to submit edits to words not working.

Removed hotkey for export.
This commit is contained in:
Robbie Antenesse 2016-07-11 15:12:28 -06:00
parent ca97409b44
commit 0a5eb01423
3 changed files with 28 additions and 32 deletions

View File

@ -105,9 +105,8 @@ The "Filter Words" drop-down box allows you to filter your dictionary by part of
**Ctrl/Control +** **Ctrl/Control +**
* **Enter/Return** : Submit Word (when typing in Word Form) * **Enter/Return** : Submit Word (when typing in Word or Edit Form)
* **D** : Toggle Dictionary Description visibility. * **D** : Toggle Dictionary Description visibility.
* **E** : Export current dictionary. (Also Ctrl+Shift+S does this.)
* **H** : Open this help window. * **H** : Open this help window.
* **M** : Maximize/Minimize Full Screen textbox when typing in the boxes that have the Maximize button. * **M** : Maximize/Minimize Full Screen textbox when typing in the boxes that have the Maximize button.
* **S** : Jump to Search box. * **S** : Jump to Search box.

View File

@ -156,6 +156,10 @@ function EditWord(indexString) {
} }
errorMessageArea.innerHTML = errorMessage; errorMessageArea.innerHTML = errorMessage;
if (document.getElementById("updateConfirmButton" + indexString)) {
document.getElementById("updateConfirmButton" + indexString).focus();
}
} }
function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) {
@ -859,7 +863,7 @@ function WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, s
return (!currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name.toLowerCase() != word.toLowerCase()) || return (!currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name.toLowerCase() != word.toLowerCase()) ||
(currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name != word) || (currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name != word) ||
currentDictionary.words[parseInt(indexString)].pronunciation != pronunciation || currentDictionary.words[parseInt(indexString)].pronunciation != pronunciation ||
currentDictionary.words[parseInt(indexString)].partOfSpeech != partOfSpeech || currentDictionary.words[parseInt(indexString)].partOfSpeech.trim() != partOfSpeech ||
currentDictionary.words[parseInt(indexString)].simpleDefinition != simpleDefinition || currentDictionary.words[parseInt(indexString)].simpleDefinition != simpleDefinition ||
currentDictionary.words[parseInt(indexString)].longDefinition != longDefinition; currentDictionary.words[parseInt(indexString)].longDefinition != longDefinition;
} }

View File

@ -37,9 +37,9 @@ function SetKeyboardShortcuts() {
// Only allow shortcuts if not currently using fullscreen textbox // Only allow shortcuts if not currently using fullscreen textbox
if (document.getElementById("fullScreenTextboxScreen").style.display == "none") { if (document.getElementById("fullScreenTextboxScreen").style.display == "none") {
if (keyCode == keyCodeFor("m")) { if (keyCode == keyCodeFor("m")) {
if (document.activeElement.id == "longDefinition") { if (document.activeElement.id.indexOf("longDefinition") >= 0) {
e.preventDefault(); e.preventDefault();
ShowFullScreenTextbox('longDefinition', 'Explanation/Long Definition'); ShowFullScreenTextbox(document.activeElement.id, 'Explanation/Long Definition');
} }
else if (document.activeElement.id == "dictionaryDescriptionEdit") { else if (document.activeElement.id == "dictionaryDescriptionEdit") {
e.preventDefault(); e.preventDefault();
@ -58,10 +58,6 @@ function SetKeyboardShortcuts() {
e.preventDefault(); e.preventDefault();
ToggleDescription(); ToggleDescription();
} }
else if ((e.shiftKey && keyCode == keyCodeFor("s")) || keyCode == keyCodeFor("e")) {
e.preventDefault();
ExportDictionary();
}
else if (keyCode == keyCodeFor("s")) { else if (keyCode == keyCodeFor("s")) {
e.preventDefault(); e.preventDefault();
//ToggleSearchFilter(); //ToggleSearchFilter();
@ -90,9 +86,6 @@ function SetKeyboardShortcuts() {
else if (keyCode == keyCodeFor("d")) { else if (keyCode == keyCodeFor("d")) {
e.preventDefault(); e.preventDefault();
} }
else if ((e.shiftKey && keyCode == keyCodeFor("s")) || keyCode == keyCodeFor("e")) {
e.preventDefault();
}
else if (keyCode == keyCodeFor("s")) { else if (keyCode == keyCodeFor("s")) {
e.preventDefault(); e.preventDefault();
} }
@ -142,10 +135,10 @@ function SubmitWordOnCtrlEnter(keypress) {
if (keyCode === keyCodeFor("ctrlEnter") || (keyCode == keyCodeFor("enter") && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10. if (keyCode === keyCodeFor("ctrlEnter") || (keyCode == keyCodeFor("enter") && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10.
event.preventDefault(); event.preventDefault();
AddWord(); if (/\d/.test(document.activeElement.id)) { // If there IS a number in the ID, then it is a word being edited.
EditWord(document.activeElement.id.match(/\d+/)[0]); // .match(/\d+/) returns an array of digits in a string.
if (document.getElementById("newWordButtonArea").style.display == "none" && document.getElementById("editWordButtonArea").style.display == "none") { } else { // Otherwise, it's a new word.
document.getElementById("updateConfirmButton").focus(); AddWord();
} }
} }
} }