Skip to content

Commit

Permalink
Fix picture elements add new image
Browse files Browse the repository at this point in the history
  • Loading branch information
matt8707 committed Oct 11, 2024
1 parent 75acc13 commit 16f69cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/lib/Modal/PictureElements/konvaEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ export class KonvaEditor extends KonvaBase {
* Add image
*/
public async addImage() {
const src = '/favicon.png';
const src = 'https://demo.home-assistant.io/stub_config/t-shirt-promo.png';

try {
const image = await this.loadImage(src);
Expand All @@ -1884,6 +1884,22 @@ export class KonvaEditor extends KonvaBase {
this.handleAddNode(node);
} catch (err) {
console.error('error adding image:', err);

// add empty fallback
const node = new Konva.Image({
type: 'image',
name: 'Image',
image: undefined,
src: src,
width: 100,
height: 100,
draggable: true
});

this.handleAddNode(node);

// gray box onerror
await this.updateImage(node, src, false);
}
}

Expand Down

0 comments on commit 16f69cd

Please sign in to comment.