| 105 | } |
| 106 | |
| 107 | update_image() { |
| 108 | if (this.im.attr('href')) { |
| 109 | URL.revokeObjectURL(this.im.attr('href')); |
| 110 | } |
| 111 | const image = this.model.get('image'); |
| 112 | const format = image.get('format'); |
| 113 | if (format === 'url') { |
| 114 | const url = new TextDecoder('utf-8').decode(image.get('value')); |
| 115 | this.im.attr('href', url); |
| 116 | } else { |
| 117 | const blob = new Blob([image.get('value')], { |
| 118 | type: 'image/' + image.get('format'), |
| 119 | }); |
| 120 | const url = URL.createObjectURL(blob); |
| 121 | this.im.attr('href', url); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | remove() { |
| 126 | URL.revokeObjectURL(this.im.attr('href')); |