Feature #2567 Added workaround to enable contentcollector to write key-value attributes

This commit is contained in:
Thomas Muehlichen 2015-03-26 18:49:35 +01:00
parent a67664055d
commit 1c05933dc9

View file

@ -297,7 +297,23 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas
{ {
if (state.attribs[a]) if (state.attribs[a])
{ {
lst.push([a, 'true']); // The following splitting of the attribute name is a workaround
// to enable the content collector to store key-value attributes
// see https://github.com/ether/etherpad-lite/issues/2567 for more information
// in long term the contentcollector should be refactored to get rid of this workaround
var ATTRIBUTE_SPLIT_STRING = "::";
// see if attributeString is splittable
var attributeSplits = a.split(ATTRIBUTE_SPLIT_STRING);
if (attributeSplits.length > 1) {
// the attribute name follows the convention key::value
// so save it as a key value attribute
lst.push([attributeSplits[0], attributeSplits[1]]);
} else {
// the "normal" case, the attribute is just a switch
// so set it true
lst.push([a, 'true']);
}
} }
} }
if (state.authorLevel > 0) if (state.authorLevel > 0)