{
if (linkPreviewOffsetTop) {
setLinkPreviewOffsetTop(undefined);
}
}}
onKeyUp={ev => {
if (ev.key === 'Escape' && linkPreviewOffsetTop) {
setLinkPreviewOffsetTop(undefined);
}
}}
ref={measureRef}
>
{(textContent || onChange) && (
{onChange ? (
onChange(ev.currentTarget.value)}
placeholder={i18n('TextAttachment__placeholder')}
ref={textEditorRef}
style={getTextStyles(
textContent,
textAttachment.textForegroundColor,
textAttachment.textStyle,
i18n
)}
value={textContent}
/>
) : (
)}
)}
{textAttachment.preview && textAttachment.preview.url && (
<>
{linkPreviewOffsetTop && !isThumbnail && (
{i18n('TextAttachment__preview__link')}
{textAttachment.preview.url}
)}
setLinkPreviewOffsetTop(linkPreview?.current?.offsetTop)
}
onMouseOver={() =>
setLinkPreviewOffsetTop(linkPreview?.current?.offsetTop)
}
>
>
)}
)}