-
Notifications
You must be signed in to change notification settings - Fork 610
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
HtmlEditor: Fix for context menu not closing when escape button pressed #28871
base: 25_1
Are you sure you want to change the base?
Conversation
…25_1-html-editor-focus-issue-in-context-menu
@@ -71,6 +71,15 @@ if (Quill) { | |||
eventsEngine.off(this.editorInstance._getContent(), CONTEXT_MENU_EVENT); | |||
} | |||
|
|||
_escKeyHandler() { | |||
this._contextMenu.hide(); |
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.
[excess actions]
No need to call it here. Escape hides contextMenu by default, we only need to additonally focus the editor.
} | ||
|
||
_addEscapeHandler(e) { | ||
e.component.registerKeyHandler('escape', this._escKeyHandler.bind(this)); |
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.
[refactoring]
I think it's overhead to create a separate method for _escKeyHandler
. Let's just pass an arrow function here
this.editorInstance.focus(); | ||
} | ||
|
||
_addEscapeHandler(e) { |
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.
Let's name it a bit wider while this method if passed to initialized
_addEscapeHandler(e) { | |
_onContextMenuInitialized(e) { |
$tableElement.trigger('dxcontextmenu'); | ||
this.clock.tick(10); | ||
const container = this.quillInstance.container; | ||
$(container).trigger($.Event('keydown', { key: 'Escape', keyCode: 27, which: 27 })); |
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.
This is supposed to be triggered on a contextMenu element
this.createWidget(); | ||
|
||
const $tableElement = this.$element.find('td').eq(0); | ||
$tableElement.trigger('dxcontextmenu'); |
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.
[copypaste]
Please use helper utils. U used this.createWidget
, why don't u use this.getContextMenu
?
No description provided.