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

Checking for other countries character type in onKeyDown #18

Closed
kimwz opened this issue Jun 15, 2012 · 14 comments
Closed

Checking for other countries character type in onKeyDown #18

kimwz opened this issue Jun 15, 2012 · 14 comments

Comments

@kimwz
Copy link

kimwz commented Jun 15, 2012

I found an issue more
onKeyDown is checking only alphabet and some characters above all
there is no problem when typing in English
but it was not work for me when typing in Korean

@warpech
Copy link
Member

warpech commented Jun 15, 2012

Do you have some idea how to fix this? I wonder if it can be generally checked if a printable character was pressed, without explicit testing of keyCode ranges. Do you have some clue how other scripts do this?

@kimwz
Copy link
Author

kimwz commented Jun 15, 2012

I don't know the way to fix it clearly. but I added a code if keycode is 229. it works for me and most of windows user. you can search on google about the keycode 229.

@warpech
Copy link
Member

warpech commented Jun 15, 2012

I've read about the 229 keyCode. It looks like a nice hack to use it but there might be various browser/OS inconsistencies. I would prefer more generic solution to find printable characters.

I just had an idea that maybe I should move the "if" clause from the begining of onKeyDown to switch->default. You can find it here: https://gist.github.com/2935778

Could you please try to use it and let me know if it fixes your problems with typing Koeran chars? Please let me know when browsers/OS can you test.

@kimwz
Copy link
Author

kimwz commented Jun 15, 2012

It's a solution , there's no more problem Korean chars. but it'll be better if you prevent to work some function key (F1F12) and windows key and others :) I tested for IE9(79mode) , Firefox, Crome latest version with Windows7
thanks a lot

@harrygates
Copy link

This change has broken my ability to put selects, like the following, in a cell:

select id= "western_coastal" name="Western Coastal Region">
option value="California">California
option selected="selected" value="Oregon">Oregon
option value="Washington">Washington
</select

Now the code above shows up in the cell, instead of the select dropdown.

@warpech
Copy link
Member

warpech commented Jun 15, 2012

You mean the change from the Gist above? I think you rather mean the change from issue #19 ?

@harrygates
Copy link

Oops. Yes, you are correct - from issue #19.

@warpech
Copy link
Member

warpech commented Jun 15, 2012

@kimwz, you are probably right. check out the new revision of the Gist - https://gist.github.com/2935778/bab92801690261fef0424bb157a5193384cd5822

I returned to idea of whitelisting printable characters. This time I allow any character > 225. Could you also check it out on some Korean Mac? Do you think it would work on a Mac just as on Windows?

@kimwz
Copy link
Author

kimwz commented Jun 15, 2012

I tested with my Mac and Windows.

it's perfect on Windows. unluckily I saw new problem on Mac. it's probably selectionStart position problem. the problem is that cursor position is 0 when I typed a character in Korean. Cursor position must be "value.length". (in this case, must be 1)

@warpech
Copy link
Member

warpech commented Jun 15, 2012

Thanks, that's something good to start with.

It is suprising that text cursor is not at the end of textarea in Mac. The plugin does not do anything to move the cursor position. Does it behave correctly on Mac when you type a Latin (English) character?

Could you maybe play with the code and propose a solution for the Mac issue? I don't have Mac system.

@warpech
Copy link
Member

warpech commented Jun 15, 2012

@gatesh - please check my latest comment in issue #19

@kimwz
Copy link
Author

kimwz commented Jun 18, 2012

luckily I found a answer about Korean chars on Mac problem. I think you can remove code like below

if (useOriginalValue) {
priv.editProxy.val(datamap.get(priv.selStart.row, priv.selStart.col));
}
/*
else {
priv.editProxy.val('');
}
*/

I think you don't have to clear editProxy value because there is "priv.editProxy[0].select();"
New issue on Mac will be solved when you remove that code

@warpech
Copy link
Member

warpech commented Jun 18, 2012

Yes, technically you should be correct that select() removes the need of clearing the cell value.

But in fact, when you remove this line, it is easy to produce an en error when typing really fast. Try to press 1 then ENTER multiple times very fast. Then go back up and press 2 then ENTER multiple times (again very fast). You are likely to have a result similar to:

error.png

Because of that, I think this is not a solution because it introduces other problems... Any other ideas maybe?

warpech added a commit that referenced this issue Jun 21, 2012
@warpech
Copy link
Member

warpech commented Jun 21, 2012

@kimwz, finally I submitted a change that removes the below code according to your sugestion.

/*
else {
priv.editProxy.val('');
}
*/

Could you please test again and tell me if it helped for Korean chars in all browsers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants