Closed Feshchenko closed 1 month ago
I met this problem too. I turn input component to a function. and watch insertState.open changed, when it changed, I'll reset loading, it will rerender input. It's work for me.
const [loading, setLoading] = useState(false);
useEffect(() => {
if (!insertState.isOpen) {
setLoading(true);
} else {
setLoading(false);
}
}, [insertState]);
const input = () =>
loading ? (
''
) : (
<div className="flex w-[330px] flex-col">
<div className="flex items-center">
<div className="flex items-center pl-3 text-slate-500 dark:text-slate-400">
<Icons.link className="h-4 w-4" />
</div>
<FloatingLinkUrlInput
className={inputVariants({ variant: 'ghost', h: 'sm' })}
placeholder="Paste link"
/>
</div>
<Separator />
<div className="flex items-center">
<div className="flex items-center pl-3 text-slate-500 dark:text-slate-400">
<Icons.text className="h-4 w-4" />
</div>
<input
className={inputVariants({ variant: 'ghost', h: 'sm' })}
placeholder="Text to display, please press Enter to save"
{...textInputProps}
/>
</div>
</div>
);
Description
After creating the first link, the insert floating UI state persists.
Steps to Reproduce
https://google.com
and textgoogle
https://google.com
andgoogle
and you can't submit it again until adding changeshttps://github.com/udecode/plate/assets/7198398/93d9e5c3-5154-44c1-828b-07e3a21278fe
Sandbox
Expected Behavior
Environment
Bounty
Click here to add a bounty via Algora.
Funding