Community
Participate
Working Groups
I was assuming that if I returned false out of an action's function, the editor would let the key event propagate. But it appears that this return value is only used to decide if a default handler should be run. editor._doAction always returns true if a binding was registered, even if no one did anything. My case is the Esc key. We bind the Esc key to cancel any active modes in the editor. If there is no active mode, I return false from my action function. Outside the editor, we hook Esc to dismiss the "Show Keys" panel if it's active. But since the Esc key never propagates out of the editor, we never get the Esc. This makes it very difficult to dismiss the Show Keys panel (Ctrl+Shift+?). I think that editor._doAction should return false if the function returned false and no default handler was run.
Felipe, could you look at this for RC1? If it's too high risk, then I'll need to look at a workaround (I think I know of one)...
Yes I can, the code is simple to change. But we need to be careful, if the action handler does not explicitly returns true or false, javascript will put undefined there. Which has the value of false in an if statement. So instead of doing if (!a.userHandler()) maybe is better to use if (a.userHandler() === false) to make sure the action propagation only proceeds when the user handler explicitly returns false. Silenio: As for invokeAction, I don't think it will change. cause the doc says it returns true when a handler is called (which means to me that is doesn't matter what the handler returns, as long the name has handler the invokeAction returns true...
fixed http://git.eclipse.org/c/e4/org.eclipse.orion.client.git/commit/?id=92590403058b6f1cfbf0c432674fa3b56fe9821e the doc in setAction() says: " If the given handler returns <code>true</code>, the default action handler is not called." so, the handler has to explicitly return true to stop the action, not returning or returning false will allow the text view handler (or user-agent default handle) to run.