Skip to content

Commit 585e0e4

Browse files
committed
Remove try catch block from event prtotype
1 parent 3af92e8 commit 585e0e4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/MarkdownTextInput.web.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -486,14 +486,12 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
486486
EventTarget.prototype.addEventListener = function (eventName, callback) {
487487
if (eventName === 'paste' && typeof callback === 'function') {
488488
originalAddEventListener.call(this, eventName, function (event) {
489-
try {
490-
if (divRef.current && divRef.current.contains(event.target as Node)) {
491-
// pasting returns styled span elements as event.target instead of the contentEditable div. We want to keep the div as the target
492-
Object.defineProperty(event, 'target', {writable: false, value: divRef.current});
493-
}
494-
callback(event);
495-
// eslint-disable-next-line no-empty
496-
} catch (e) {}
489+
if (divRef.current && divRef.current.contains(event.target as Node)) {
490+
// pasting returns styled span elements as event.target instead of the contentEditable div. We want to keep the div as the target
491+
Object.defineProperty(event, 'target', {writable: false, value: divRef.current});
492+
}
493+
callback(event);
494+
// eslint-disable-next-line no-empty
497495
});
498496
} else {
499497
originalAddEventListener.call(this, eventName, callback);

0 commit comments

Comments
 (0)