mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBERF-8145 Do not focus on editor when adding a table (#6598)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
66db3ac029
commit
c51122ac8d
@ -333,11 +333,14 @@
|
||||
targetItem instanceof MouseEvent ? getEventPositionElement(targetItem) : getPopupPositionElement(targetItem)
|
||||
}
|
||||
|
||||
// addTableHandler opens popup so the editor loses focus
|
||||
// so in the callback we need to refocus again
|
||||
void addTableHandler((options: { rows?: number, cols?: number, withHeaderRow?: boolean }) => {
|
||||
editor.chain().insertTable(options).focus(pos).run()
|
||||
}, position)
|
||||
// We need to trigger it asynchronously in order for the editor to finish its focus event
|
||||
// Otherwise, it hoggs the focus from the popup and keyboard navigation doesn't work
|
||||
setTimeout(() => {
|
||||
// addTableHandler opens popup so the editor loses focus so in the callback we need to refocus again
|
||||
void addTableHandler((options: { rows?: number, cols?: number, withHeaderRow?: boolean }) => {
|
||||
editor.chain().focus(pos).insertTable(options).run()
|
||||
}, position)
|
||||
}, 0)
|
||||
break
|
||||
}
|
||||
case 'code-block':
|
||||
|
Loading…
Reference in New Issue
Block a user