mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-23 07:26:54 +00:00
Add parse tree helper for styling elements
This commit is contained in:
parent
36290c14fa
commit
5c2f698842
@ -29,4 +29,14 @@ exports.addClassToParseTreeNode = function(node,classString) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.addStyleToParseTreeNode = function(node,name,value) {
|
||||
if(node.type === "element") {
|
||||
node.attributes = node.attributes || {};
|
||||
node.attributes["style"] = node.attributes["style"] || {type: "string", value: ""};
|
||||
if(node.attributes["style"].type === "string") {
|
||||
node.attributes["style"].value += name + ":" + value + ";";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user