Differency normal characters and half characters on keydown

前端 未结 2 721
挽巷
挽巷 2021-01-15 03:53

We forked experimental Mediawiki VisualEditor. This WYSIWYM editor work with a hidden textarea and a representation of the content in DOM. When you focus the view, the focus

相关标签:
2条回答
  • 2021-01-15 04:14

    Just found a workaround. By listening to keyup event, dead keys returns a keyIdentifier property set to Unidentified.

    So :

    keyuphandler = function(e)
    {
        if (e.keyIdentifier === 'Unidentified')
        {
            return;
        }
        doSomething();
    }
    
    0 讨论(0)
  • 2021-01-15 04:32

    Do you get the character from the key down event or do you read it from the text area? I just tried this with an input field and it's value did not change on the first press of the ^ button. However, I am using windows. The last resort would obviously be to handle these modifying key presses differently. This might get somewhat complex if you aim to support key combinations like alt+654. I will try it again on my mac as soon as I get home after work.

    0 讨论(0)
提交回复
热议问题