rangy
rangy copied to clipboard
class Applier: error adding more than 1 classes
I need to add 2 extra classes to the applier, I tried to use the next options
elementProperties : { className : 'highlight rangy' }
but that give me the next error
failed to execute 'add' on 'DOMTokenList': The token provided ('highlight rangy') contains HTML space characters, which are not valid in tokens.
To solve that I had to modify the rangy-classapplier.js function addClass line 70
changing the first if to that
if (typeof el.classList == "object" && typeof className == "object") {
if that is correct, you can added to the code or I can do a commit with that.
I don't believe this was ever implemented ... but it seems like it definitely should be! Is there a workaround to make this work with more than two classes?
The answer from @dryaner should work for as many classes as you like, as long as they are space delimited.
My question is: how can we get the undoToSelection to work with multiple classes as well?