File tree 1 file changed +8
-9
lines changed
packages/ra-input-rich-text/src
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ const suggestions = tags => {
375
375
} ,
376
376
377
377
onKeyDown ( props ) {
378
- if ( props . event . key === 'Escape' ) {
378
+ if ( popup && popup [ 0 ] && props . event . key === 'Escape' ) {
379
379
popup [ 0 ] . hide ( ) ;
380
380
381
381
return true ;
@@ -396,15 +396,14 @@ const suggestions = tags => {
396
396
if ( component ) {
397
397
component . destroy ( ) ;
398
398
}
399
+ // Remove references to the old popup and component upon destruction/exit.
400
+ // (This should prevent redundant calls to `popup.destroy()`, which Tippy
401
+ // warns in the console is a sign of a memory leak, as the `suggestion`
402
+ // plugin seems to call `onExit` both when a suggestion menu is closed after
403
+ // a user chooses an option, *and* when the editor itself is destroyed.)
404
+ popup = undefined ;
405
+ component = undefined ;
399
406
} ) ;
400
-
401
- // Remove references to the old popup and component upon destruction/exit.
402
- // (This should prevent redundant calls to `popup.destroy()`, which Tippy
403
- // warns in the console is a sign of a memory leak, as the `suggestion`
404
- // plugin seems to call `onExit` both when a suggestion menu is closed after
405
- // a user chooses an option, *and* when the editor itself is destroyed.)
406
- popup = undefined ;
407
- component = undefined ;
408
407
} ,
409
408
} ;
410
409
} ,
You can’t perform that action at this time.
0 commit comments