torchbox/wagtail — pull request #367 by timheap (2014-06-25 05:47:44+00:00)
Title: Images in rich text fields have extra elements

Images inserted via the 'Image' button in hallo.js rich text fields have extra elements around them that make it hard to apply consistent styles:

```html

```

I looked in to the hallo.js image plugin used, and modified it such that it inserts images just before the current selection point if the selection is empty, and at the start of the container. This unfortunately has some side effects that spoil further editing somewhat:

1. If text is typed around the image, it is not contained in any `

` tag or similar:

```html

Before

Extra text

Before

```

2. If a new line is inserted after the ``, a new `

` is created, instead of a new `

`.

```html

...

```

There are likely more issues as well, but I gave up hunting at this point.

It would be excellent if `` tags were not wrapped as they currently are, but solving it seems rather more involved than I had initially thought. Does anyone have more experience dealing with this, or any ideas where to start fixing this?

cc @jonnyscholes