InvokeAI/invokeai/frontend/web/src/features
psychedelicious 19c5435332 fix(ui): copy image via img onload to blob
There's a bug in chrome that screws with headers on fetch requests and 307 responses. This causes images to fail to copy in the commercial environment.

This change attempts to get around this by copying images in a different way (similar to how the canvas works). When the user requests a copy we:
- create an `<img />` element
- set `crossOrigin` if needed
- add an onload handler:
  - create a canvas element
  - draw image onto it
  - export canvas to blob

This is wrapped in a promise which resolves to the blob, which can then be copied to clipboard.

---

A customized version of Konva's `useImage` hook is also included, which returns the image blob in addition to the `<img />` element. Unfortunately, this hook is not suitable for use across the app, because it does all the image fetching up front, regardless of whether we actually want to copy the image.

In other words, we'd have to fetch the whole image file even if the user is just skipping through image metadata, in order to have the blob to copy. The callback approach means we only fetch the image when the user clicks copy. The hook is thus currently unused.
2023-10-17 06:43:19 +11:00
..
canvas fix(ui): reset canvas batchIds on clear/batch cancel 2023-10-15 18:28:05 +11:00
changeBoardModal Translation update (#4503) 2023-09-13 17:31:34 +10:00
controlAdapters fix(ui): use _other for control adapter collapse 2023-10-15 18:34:25 +11:00
deleteImageModal chore(ui): "controlnet" -> "controladapters" 2023-10-07 22:30:15 +11:00
dnd feat(ui): refactor control adapters 2023-10-07 22:30:15 +11:00
dynamicPrompts feat(ui): refactor informational popover 2023-09-22 13:23:26 -04:00
embedding Translation update (#4503) 2023-09-13 17:31:34 +10:00
gallery Hide Metadata in Info View (#4787) 2023-10-14 21:25:07 +11:00
lora fix(ui): add missing translation strings 2023-10-12 22:46:47 +11:00
nodes fix(nodes,ui): optional metadata 2023-10-15 10:44:16 +11:00
parameters feat (ui, generation): High Resolution Fix MVP in Text2Image Linear Flow (#4819) 2023-10-14 10:34:41 +00:00
queue fix(ui): add missing translation strings 2023-10-12 22:46:47 +11:00
sdxl fix(ui): add missing translation strings 2023-10-12 22:46:47 +11:00
system fix(ui): copy image via img onload to blob 2023-10-17 06:43:19 +11:00
ui fix(ui): copy image via img onload to blob 2023-10-17 06:43:19 +11:00