From ad6ca179ef944fed81f81a2fdc35efb216ad2153 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 7 Jan 2025 19:06:25 +0800 Subject: [PATCH] throw error when the selection is invalid --- src/MarkdownTextInput.web.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index b2feb40a..ea94c0e7 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -241,10 +241,7 @@ const MarkdownTextInput = React.forwardRef { if (!contentSelection.current || contentSelection.current.end - contentSelection.current.start < 1) { - return { - text: '', - cursorPosition: 0, - }; + throw new Error('[react-native-live-markdown] invalid selection'); } const selectedText = parsedText.slice(contentSelection.current.start, contentSelection.current.end);