Skip to content

Commit

Permalink
Merge pull request #579 from matt8707/picture-elements
Browse files Browse the repository at this point in the history
Fix picture elements add new image
  • Loading branch information
matt8707 authored Oct 11, 2024
2 parents 75acc13 + 16f69cd commit 25c374d
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 25c374d

Please sign in to comment.