Skip to content

Commit 7dd6d75

Browse files
committed
add allow attributes to parse
1 parent 94fee4c commit 7dd6d75

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

vendor/assets/javascripts/wysihtml5.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4899,6 +4899,7 @@ wysihtml5.dom.parse = (function() {
48994899
var attributes = {}, // fresh new set of attributes to set on newNode
49004900
setClass = rule.set_class, // classes to set
49014901
addClass = rule.add_class, // add classes based on existing attributes
4902+
allowAttributes = rule.allow_attributes, // copy attributes from old to new node
49024903
setAttributes = rule.set_attributes, // attributes to set on the current node
49034904
checkAttributes = rule.check_attributes, // check/convert values of attributes
49044905
allowedClasses = currentRules.classes,
@@ -4918,6 +4919,17 @@ wysihtml5.dom.parse = (function() {
49184919
if (setAttributes) {
49194920
attributes = wysihtml5.lang.object(setAttributes).clone();
49204921
}
4922+
4923+
if (allowAttributes) {
4924+
allowAttributesLength = allowAttributes.length;
4925+
for (i = 0; i<allowAttributesLength; i++) {
4926+
attributeName = allowAttributes[i];
4927+
newAttributeValue = _getAttribute(oldNode, attributeName);
4928+
if (typeof(newAttributeValue) === "string") {
4929+
attributes[attributeName] = newAttributeValue;
4930+
}
4931+
}
4932+
}
49214933

49224934
if (checkAttributes) {
49234935
for (attributeName in checkAttributes) {

0 commit comments

Comments
 (0)