From 9ffd940d212ca33c77778d97ac1eb19b10a5febc Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Thu, 19 Nov 2015 13:38:19 -0500 Subject: [PATCH] fix(contenteditable): allow valid null events to callbacks --- src/components/contenteditable/contenteditable.cjsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/contenteditable/contenteditable.cjsx b/src/components/contenteditable/contenteditable.cjsx index 72f4e9f30..a139b8e1c 100644 --- a/src/components/contenteditable/contenteditable.cjsx +++ b/src/components/contenteditable/contenteditable.cjsx @@ -211,6 +211,8 @@ class Contenteditable extends React.Component # the core plugin handlers from being called. # If any of the plugins calls event.stopPropagation(), it will prevent any # other plugin handlers from being called. + # + # NOTE: It's possible for there to be no `event` passed in. _runPluginHandlersForEvent: (method, event, args...) => executeCallback = (plugin) => return if not plugin[method]? @@ -218,12 +220,12 @@ class Contenteditable extends React.Component @atomicEdit(callback, event, args...) for plugin in @props.plugins - break if event.isPropagationStopped() + break if event?.isPropagationStopped() executeCallback(plugin) - return if event.defaultPrevented or event.isPropagationStopped() + return if event?.defaultPrevented or event?.isPropagationStopped() for plugin in @corePlugins - break if event.isPropagationStopped() + break if event?.isPropagationStopped() executeCallback(plugin) _onKeyDown: (event) =>