mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-02 17:34:49 +08:00
fix(contenteditable): allow valid null events to callbacks
This commit is contained in:
parent
2d3121a91d
commit
ff620e1d2f
1 changed files with 5 additions and 3 deletions
|
@ -211,6 +211,8 @@ class Contenteditable extends React.Component
|
||||||
# the core plugin handlers from being called.
|
# the core plugin handlers from being called.
|
||||||
# If any of the plugins calls event.stopPropagation(), it will prevent any
|
# If any of the plugins calls event.stopPropagation(), it will prevent any
|
||||||
# other plugin handlers from being called.
|
# other plugin handlers from being called.
|
||||||
|
#
|
||||||
|
# NOTE: It's possible for there to be no `event` passed in.
|
||||||
_runPluginHandlersForEvent: (method, event, args...) =>
|
_runPluginHandlersForEvent: (method, event, args...) =>
|
||||||
executeCallback = (plugin) =>
|
executeCallback = (plugin) =>
|
||||||
return if not plugin[method]?
|
return if not plugin[method]?
|
||||||
|
@ -218,12 +220,12 @@ class Contenteditable extends React.Component
|
||||||
@atomicEdit(callback, event, args...)
|
@atomicEdit(callback, event, args...)
|
||||||
|
|
||||||
for plugin in @props.plugins
|
for plugin in @props.plugins
|
||||||
break if event.isPropagationStopped()
|
break if event?.isPropagationStopped()
|
||||||
executeCallback(plugin)
|
executeCallback(plugin)
|
||||||
|
|
||||||
return if event.defaultPrevented or event.isPropagationStopped()
|
return if event?.defaultPrevented or event?.isPropagationStopped()
|
||||||
for plugin in @corePlugins
|
for plugin in @corePlugins
|
||||||
break if event.isPropagationStopped()
|
break if event?.isPropagationStopped()
|
||||||
executeCallback(plugin)
|
executeCallback(plugin)
|
||||||
|
|
||||||
_onKeyDown: (event) =>
|
_onKeyDown: (event) =>
|
||||||
|
|
Loading…
Add table
Reference in a new issue