I am trying to create a class applier that would wrap the selection in the following element:
<code class="mainClass selector1 selector2">Selected Content</code>
I am doing the following:
var Applier = rangy.createClassApplier("mainClass",
{
elementTagName: "code",
elementProperties:
{
className: [ "selector1", "selector2" ]
}
});
Applier.toggleSelection();
This yields the following:
<code class="mainClass selector1,selector2">Selected Content</code>
What is the syntax to create the applier so that it does what I am trying to do?
It seems like this was not implemented (see here). To fix it, change line 69 in range.classApplied to this:
if (typeof el.classList == "object" && typeof className == "object")