Make Episerver SelectionEditor support HTML-labels

Somewhere between the releases of Episerver 7.5 and latest, a small but subtle change in how the epi-cms/contentediting/editors/SelectionEditor displays labels in associated drop downs was made.

The line label: item.text was replaced with label: entities.encode(item.text) rendering in everything put in a label being encoded.

Drop down with HTML code visible

While I think some things gains on being encoded, in some use cases we need to be able to display HTML-formatted labels, hence encoding is bad.

But as it turns out, Dojo and Episerver is pretty smart, giving us the ability to create our own SelectionEditor, implement our own functionality of _setSelectionsAttr while inheriting the rest of the functionallity from the build-in Dojo module.

Rendering in:

Drop down with icons visible

And as always, use at own risk.