Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi 自動補完的建議 #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion static/js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,17 @@ $(document).ready(function(){
// 按 tab 鍵補完
var ans_ac_keydown = function(e) {
var ans_shadow = $('#ans-shadow').val();
if (e.which == 9 && ans_shadow !== "" && ans_shadow !== $('#ans').val()) {

if (ans_shadow == "" || ans_shadow == $('#ans').val())
return;
// Both tab or arrow right will autocomplete */
if (e.which == 9 || e.which == 39) {
$('#ans').val($('#ans-shadow').val());
e.preventDefault();
}
// work around to return focus
if (e.which == 9)
setTimeout('$("#ans").focus();$("#ans").select();', 300);
}

// 找出自動完成
Expand Down