mirror of
				https://github.com/Alamantus/Lexiconga.git
				synced 2025-11-04 10:17:01 +01:00 
			
		
		
		
	Got ctrl+enter to submit a word from the Word Form. Just need to resolve some focus issues after editing.
This commit is contained in:
		
							parent
							
								
									20899eaa80
								
							
						
					
					
						commit
						06f5fe58c4
					
				
					 2 changed files with 16 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -60,19 +60,19 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php');
 | 
			
		|||
    <form id="wordEntryForm">
 | 
			
		||||
        <div id="formLockButton" class="clickable" onclick="ToggleWordFormLock()" title="Lock/unlock form from the top of the page">🔒</div>
 | 
			
		||||
        <label><span>Word</span>
 | 
			
		||||
            <input type="text" id="word" />
 | 
			
		||||
            <input type="text" id="word" onkeydown="SubmitWordOnCtrlEnter(this)" />
 | 
			
		||||
        </label>
 | 
			
		||||
        <label><span>Pronunciation <a class="helperlink" href="/ipa_character_picker/" target="_blank" title="IPA Character Picker backed up from http://r12a.github.io/pickers/ipa/">IPA Characters</a></span>
 | 
			
		||||
            <input type="text" id="pronunciation" />
 | 
			
		||||
            <input type="text" id="pronunciation" onkeydown="SubmitWordOnCtrlEnter(this)" />
 | 
			
		||||
        </label>
 | 
			
		||||
        <label><span>Part of Speech</span>
 | 
			
		||||
            <select id="partOfSpeech"></select>
 | 
			
		||||
        </label>
 | 
			
		||||
        <label><span>Equivalent Word(s)</span>
 | 
			
		||||
            <input type="text" id="simpleDefinition" />
 | 
			
		||||
            <input type="text" id="simpleDefinition" onkeydown="SubmitWordOnCtrlEnter(this)" />
 | 
			
		||||
        </label>
 | 
			
		||||
        <label><span>Explanation/Long Definition <span id="showFullScreenTextbox" class="clickable" onclick="ShowFullScreenTextbox('longDefinition', 'Explanation/Long Definition')">Maximize</span></span>
 | 
			
		||||
            <textarea id="longDefinition"></textarea>
 | 
			
		||||
            <textarea id="longDefinition" onkeydown="SubmitWordOnCtrlEnter(this)"></textarea>
 | 
			
		||||
        </label>
 | 
			
		||||
        <input type="hidden" id="editIndex" />
 | 
			
		||||
        <span id="errorMessage"></span>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								js/ui.js
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								js/ui.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -248,6 +248,18 @@ function CloseUpdateConflictArea(displayId) {
 | 
			
		|||
    EnableForm();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function SubmitWordOnCtrlEnter(keypress) {
 | 
			
		||||
    var keyCode = (event.which ? event.which : event.keyCode);
 | 
			
		||||
 | 
			
		||||
    if (keyCode === 10 || (keyCode == 13 && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10.
 | 
			
		||||
        AddWord();
 | 
			
		||||
        
 | 
			
		||||
        if (document.getElementById("newWordButtonArea").style.display == "none" && document.getElementById("editWordButtonArea").style.display == "none") {
 | 
			
		||||
            document.getElementById("updateConfirmButton").focus();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function DisableForm() {
 | 
			
		||||
    document.getElementById("word").disabled = true;
 | 
			
		||||
    document.getElementById("pronunciation").disabled = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue