Can we replace line 503-514 with something simpler?

```js
var containsImage = false;

item.forEach(function(content) {
  if (content.type === 'img') {
    containsImage = true;
  }
  this.append(content, {ignoreChange: true});
}, this);

onContentChanged({containsImage: containsImage});
```