Skip to content

Commit

Permalink
TextFieldRenderer: fix missing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Oct 21, 2020
1 parent a53c479 commit 7f21581
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/markdown/TextFieldRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TextFieldRenderer implements NodeVisitor {
for (node in nodes) {
if (Std.isOfType(node, ElementNode)) {
var elementNode = cast(node, ElementNode);
node = new WrappedElementNode(elementNode.tag, elementNode.children, null);
node = new WrappedElementNode(elementNode.tag, elementNode.children, elementNode.attributes, null);
}
node.accept(this);
}
Expand Down Expand Up @@ -178,18 +178,21 @@ class TextFieldRenderer implements NodeVisitor {
}

class WrappedElementNode extends ElementNode {
public function new(tag:String, children:Array<Node>, parent:WrappedElementNode) {
public function new(tag:String, children:Array<Node>, attributes:Map<String, String>, parent:WrappedElementNode) {
for (i in 0...children.length) {
var child = children[i];
if (!Std.isOfType(child, ElementNode)) {
continue;
}
var elementNodeChild = cast(child, ElementNode);
var wrappedChild = new WrappedElementNode(elementNodeChild.tag, elementNodeChild.children, this);
var wrappedChild = new WrappedElementNode(elementNodeChild.tag, elementNodeChild.children, elementNodeChild.attributes, this);
children[i] = wrappedChild;
}
super(tag, children);
this.parent = parent;
for (key in attributes.keys()) {
this.attributes.set(key, attributes.get(key));
}
}

public var parent:WrappedElementNode;
Expand Down

0 comments on commit 7f21581

Please sign in to comment.