@teleporthq/teleport-uidl-resolver
Advanced tools
Comparing version 0.33.3 to 0.33.4
@@ -19,6 +19,4 @@ "use strict"; | ||
if (linkInParent === void 0) { linkInParent = false; } | ||
// TODO_NOW | ||
var _e = node.content, abilities = _e.abilities, children = _e.children, elementType = _e.elementType, semanticType = _e.semanticType; | ||
var _e = node.content, abilities = _e.abilities, children = _e.children, elementType = _e.elementType, semanticType = _e.semanticType, _f = _e.attrs, attrs = _f === void 0 ? {} : _f; | ||
var linkInNode = linkInParent || !!(abilities === null || abilities === void 0 ? void 0 : abilities.link); | ||
// TODO: think of a way to reuse the traversal that modifies the tree | ||
node.content.children = children === null || children === void 0 ? void 0 : children.map(function (child) { | ||
@@ -87,2 +85,9 @@ var _a; | ||
}); | ||
for (var _i = 0, _g = Object.keys(attrs); _i < _g.length; _i++) { | ||
var attrKey = _g[_i]; | ||
var attr = attrs[attrKey]; | ||
if (attr.type === 'element') { | ||
node.content.attrs[attrKey] = (0, exports.insertLinks)(attr, options, false, node); | ||
} | ||
} | ||
if (abilities === null || abilities === void 0 ? void 0 : abilities.link) { | ||
@@ -89,0 +94,0 @@ if (linkInParent) { |
@@ -16,6 +16,4 @@ var __assign = (this && this.__assign) || function () { | ||
if (linkInParent === void 0) { linkInParent = false; } | ||
// TODO_NOW | ||
var _e = node.content, abilities = _e.abilities, children = _e.children, elementType = _e.elementType, semanticType = _e.semanticType; | ||
var _e = node.content, abilities = _e.abilities, children = _e.children, elementType = _e.elementType, semanticType = _e.semanticType, _f = _e.attrs, attrs = _f === void 0 ? {} : _f; | ||
var linkInNode = linkInParent || !!(abilities === null || abilities === void 0 ? void 0 : abilities.link); | ||
// TODO: think of a way to reuse the traversal that modifies the tree | ||
node.content.children = children === null || children === void 0 ? void 0 : children.map(function (child) { | ||
@@ -84,2 +82,9 @@ var _a; | ||
}); | ||
for (var _i = 0, _g = Object.keys(attrs); _i < _g.length; _i++) { | ||
var attrKey = _g[_i]; | ||
var attr = attrs[attrKey]; | ||
if (attr.type === 'element') { | ||
node.content.attrs[attrKey] = insertLinks(attr, options, false, node); | ||
} | ||
} | ||
if (abilities === null || abilities === void 0 ? void 0 : abilities.link) { | ||
@@ -86,0 +91,0 @@ if (linkInParent) { |
{ | ||
"name": "@teleporthq/teleport-uidl-resolver", | ||
"version": "0.33.3", | ||
"version": "0.33.4", | ||
"description": "A small package that handles the transition from UIDL to HTML elements and has support for custom mappings.", | ||
@@ -32,3 +32,3 @@ "author": "teleportHQ", | ||
}, | ||
"gitHead": "54218e148225ecc586de1c5a9da7e09a54531dd0" | ||
"gitHead": "9dcc1626bf21fda82bcc57ec77b09d16a985f433" | ||
} |
@@ -15,7 +15,5 @@ import { StringUtils } from '@teleporthq/teleport-shared' | ||
): UIDLElementNode => { | ||
// TODO_NOW | ||
const { abilities, children, elementType, semanticType } = node.content | ||
const { abilities, children, elementType, semanticType, attrs = {} } = node.content | ||
const linkInNode = linkInParent || !!abilities?.link | ||
// TODO: think of a way to reuse the traversal that modifies the tree | ||
node.content.children = children?.map((child) => { | ||
@@ -110,2 +108,10 @@ if (child.type === 'element') { | ||
for (const attrKey of Object.keys(attrs)) { | ||
const attr = attrs[attrKey] | ||
if (attr.type === 'element') { | ||
node.content.attrs[attrKey] = insertLinks(attr as UIDLElementNode, options, false, node) | ||
} | ||
} | ||
if (abilities?.link) { | ||
@@ -112,0 +118,0 @@ if (linkInParent) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
354258
5132