mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-17 22:03:09 +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)
|
targetItem instanceof MouseEvent ? getEventPositionElement(targetItem) : getPopupPositionElement(targetItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
// addTableHandler opens popup so the editor loses focus
|
// We need to trigger it asynchronously in order for the editor to finish its focus event
|
||||||
// so in the callback we need to refocus again
|
// Otherwise, it hoggs the focus from the popup and keyboard navigation doesn't work
|
||||||
void addTableHandler((options: { rows?: number, cols?: number, withHeaderRow?: boolean }) => {
|
setTimeout(() => {
|
||||||
editor.chain().insertTable(options).focus(pos).run()
|
// addTableHandler opens popup so the editor loses focus so in the callback we need to refocus again
|
||||||
}, position)
|
void addTableHandler((options: { rows?: number, cols?: number, withHeaderRow?: boolean }) => {
|
||||||
|
editor.chain().focus(pos).insertTable(options).run()
|
||||||
|
}, position)
|
||||||
|
}, 0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'code-block':
|
case 'code-block':
|
||||||
|
Loading…
Reference in New Issue
Block a user