-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add keystroke handlings for elementspath
and toolbar
plugins
#5252
Conversation
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.
Looks good 👍🏻 I've simplified unit tests as there is no need for an additional helper function (see comment).
/** | ||
* Fires element event handler attribute e.g. | ||
* ```html <button onkeydown="return customFn( event )">x</button>``` | ||
* | ||
* @param {CKEDITOR.dom.element/HTMLElement} element Element with attached event handler attribute. | ||
* @param {String} eventName Event handler attribute name. | ||
* @param {Object} evt Event payload. | ||
*/ | ||
fireElementEventHandler: function( element, eventName, evt ) { | ||
if ( element.$ ) { | ||
element = element.$; | ||
} | ||
|
||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) { | ||
var nativeEvent = CKEDITOR.document.$.createEventObject(); | ||
|
||
for ( var key in evt ) { | ||
nativeEvent[ key ] = evt[ key ]; | ||
} | ||
|
||
element.fireEvent( eventName, nativeEvent ); | ||
} else { | ||
element[ eventName ]( evt ); | ||
} |
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.
We don't need that helper function, as there is already element#fireEventHandler method that covers this polyfill (that helper was moved to core codebase some time ago).
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
Did you follow the CKEditor 4 code style guide?
Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.
What is the proposed changelog entry for this pull request?
What changes did you make?
The solution was taken from: #2412 PR.
I just extracted the helper function to
bender
tools and adjusted a little the manual tests.Which issues does your PR resolve?
Closes #438.