Don't catch keyboard events outside vim canvas #24
Conversation
vimjs.lastMouseDownTarget = vimjs.canvas_node; // set focus on start | ||
|
||
var ignoreKeys = function() { | ||
var retval = (vimjs.lastMouseDownTarget !== vimjs.canvas_node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just return !(a !== b)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I shortened it now. I was looking at some similar code where there could be a problem with undefined checks, that's why it was like that.
…mitted everything. This reverts commit 1eadf16.
Ok. I made the changes you requested. |
Oh, sorry, I accidentally committed everything. Wait a second. |
@@ -24,7 +24,7 @@ $EM_DIR/emconfigure ./configure \ | |||
--disable-workshop \ | |||
--disable-netbeans \ | |||
--disable-sniff \ | |||
--disable-multibyte \ | |||
--enable-multibyte \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested this?
How much would the size of vim.js
be increased? And are the characters displayed correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this was not supposed to be committed. The size increases from 25MB to 44MB with multibyte, but the multibyte patch is not complete since it does not work yet. I shall send a different pull request for that once I am done.
Ok. That should fix it. Now contains only the keyboard fix. |
Looks good to me now. Thanks! |
Don't catch keyboard events outside vim canvas
If you want to embed vim.js on a bigger page, you need to be able to use keyboard outside vim canvas. Currently the page listens on document and uses preventDefault. This patch makes it only catch key events if last mouse down was on canvas.
I also fix one bug with IE not having console.group.