From 7f21581ccba5994a6185d9b20d90befd0c64b6d3 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Wed, 21 Oct 2020 11:19:26 -0700 Subject: [PATCH] TextFieldRenderer: fix missing attributes --- src/markdown/TextFieldRenderer.hx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/markdown/TextFieldRenderer.hx b/src/markdown/TextFieldRenderer.hx index 0045d81..a764ab9 100644 --- a/src/markdown/TextFieldRenderer.hx +++ b/src/markdown/TextFieldRenderer.hx @@ -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); } @@ -178,18 +178,21 @@ class TextFieldRenderer implements NodeVisitor { } class WrappedElementNode extends ElementNode { - public function new(tag:String, children:Array, parent:WrappedElementNode) { + public function new(tag:String, children:Array, attributes:Map, 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;