diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index 429785b9..09cc63cd 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -486,14 +486,11 @@ const MarkdownTextInput = React.forwardRef( EventTarget.prototype.addEventListener = function (eventName, callback) { if (eventName === 'paste' && typeof callback === 'function') { originalAddEventListener.call(this, eventName, function (event) { - try { - if (divRef.current && divRef.current.contains(event.target as Node)) { - // pasting returns styled span elements as event.target instead of the contentEditable div. We want to keep the div as the target - Object.defineProperty(event, 'target', {writable: false, value: divRef.current}); - } - callback(event); - // eslint-disable-next-line no-empty - } catch (e) {} + if (divRef.current && divRef.current.contains(event.target as Node)) { + // pasting returns styled span elements as event.target instead of the contentEditable div. We want to keep the div as the target + Object.defineProperty(event, 'target', {writable: false, value: divRef.current}); + } + callback(event); }); } else { originalAddEventListener.call(this, eventName, callback);