diff --git a/wax-prosemirror-services/src/MatchingService/components/MatchingContainerComponent.js b/wax-prosemirror-services/src/MatchingService/components/MatchingContainerComponent.js index 8fe2c2ceef28d8d111d55845437931064a3600a4..4d5afc9cd32965a0bed716ff68525e5afa8ac3c7 100644 --- a/wax-prosemirror-services/src/MatchingService/components/MatchingContainerComponent.js +++ b/wax-prosemirror-services/src/MatchingService/components/MatchingContainerComponent.js @@ -228,13 +228,13 @@ export default ({ node, view, getPos }) => { }; options.forEach(option => { - if (getRef(option.value).current) + if (getRef(option.value) && getRef(option.value).current) getRef(option.value).current.addEventListener('keydown', listener); }); return () => { options.forEach(option => { - if (getRef(option.value).current) + if (getRef(option.value) && getRef(option.value).current) getRef(option.value).current.removeEventListener('keydown', listener); }); };