UBER-797: Fix popup menu runtime error (#3627)

Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
Maksim Karmatskikh 2023-08-24 21:44:29 +06:00 committed by GitHub
parent 71b653dcac
commit 9396f7ef20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,6 +214,13 @@
// I need to copypaste original function and make a little change
// with showContextMenu falg
shouldShow: ({ editor, view, state, oldState, from, to }) => {
// For some reason shouldShow might be called after dismount and
// after destroing the editor. We should handle this just no to have
// any errors in runtime
if (!element) {
return false
}
const { doc, selection } = state
const { empty } = selection