diff --git a/ts/components/TextStoryCreator.tsx b/ts/components/TextStoryCreator.tsx index 948c97b27d..a320c84d76 100644 --- a/ts/components/TextStoryCreator.tsx +++ b/ts/components/TextStoryCreator.tsx @@ -301,6 +301,29 @@ export function TextStoryCreator({ ); }, [isColorPickerShowing, colorPickerPopperRef, colorPickerPopperButtonRef]); + useEffect(() => { + if (!isLinkPreviewInputShowing) { + return noop; + } + return handleOutsideClick( + () => { + setIsLinkPreviewInputShowing(false); + return true; + }, + { + containerElements: [ + linkPreviewInputPopperRef, + linkPreviewInputPopperButtonRef, + ], + name: 'TextStoryCreator.linkPreviewInput', + } + ); + }, [ + isLinkPreviewInputShowing, + linkPreviewInputPopperRef, + linkPreviewInputPopperButtonRef, + ]); + const sliderColorNumber = getRGBANumber(sliderValue); let textForegroundColor = sliderColorNumber;