зеркало из https://github.com/nextcloud/text.git
fix(LinkBubble): Allow to close link bubble with Escape
Signed-off-by: Jonas <jonas@freesources.org>
This commit is contained in:
Родитель
60c1711ad5
Коммит
a5911b876b
|
@ -83,6 +83,13 @@ class LinkBubblePluginView {
|
|||
this.hide()
|
||||
}
|
||||
|
||||
keydownHandler = (event) => {
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault()
|
||||
this.hide()
|
||||
}
|
||||
}
|
||||
|
||||
createTooltip() {
|
||||
const { element: editorElement } = this.editor.options
|
||||
const editorIsAttached = !!editorElement.parentElement
|
||||
|
@ -192,9 +199,11 @@ class LinkBubblePluginView {
|
|||
|
||||
show() {
|
||||
this.tippy?.show()
|
||||
this.view.dom.addEventListener('keydown', this.keydownHandler)
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.view.dom.removeEventListener('keydown', this.keydownHandler)
|
||||
this.tippy?.hide()
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче