facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.92k stars 1.5k forks source link

[lexical-playground][image-node] Bug Fix: Load image error UI #6111

Closed MaxPlav closed 3 weeks ago

MaxPlav commented 4 weeks ago

Currently, if an image fails to load because of a network error, the page is down, etc. the Node is silently inserted but no UI is shown.

Description

Adding a fallback image that would substitute an original image if it fails to load due to a network failure etc.

Closes: #5564

Test plan

https://github.com/facebook/lexical/issues/5564#issuecomment-2040647027

  1. Open https://playground.lexical.dev/ in a browser
  2. Insert an image and block the image load request via the dev tools.
  3. Try to insert the image once again.
  4. See that a fallback image is loaded instead.

Before

https://github.com/facebook/lexical/assets/5062807/8501bb84-ba14-4f63-be25-dc44d0fc65c9

After

https://github.com/facebook/lexical/assets/5062807/a35980d7-4358-4eca-8806-626b36e10be5

Insert relevant screenshots/recordings/automated-tests

vercel[bot] commented 4 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2024 9:16pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2024 9:16pm