datocms-html-to-structured-text
Advanced tools
Comparing version 1.1.1 to 1.1.3
{ | ||
"name": "datocms-html-to-structured-text", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"description": "Convert HTML (or a `hast` syntax tree) to a valid DatoCMS Structured Text `dast` document", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"dependencies": { | ||
"datocms-structured-text-utils": "^1.1.1", | ||
"datocms-structured-text-utils": "^1.1.3", | ||
"extend": "^3.0.2", | ||
@@ -49,5 +49,6 @@ "hast-util-from-dom": "^3.0.0", | ||
"devDependencies": { | ||
"parse5": "^6.0.1" | ||
"parse5": "^6.0.1", | ||
"unist-util-inspect": "^6.0.0" | ||
}, | ||
"gitHead": "0b4259156a7e1fd7eedd947cc668e1ea9c3fcbc7" | ||
"gitHead": "a6d9f3c373026c368400e39e007bfbed1fa8632c" | ||
} |
@@ -156,3 +156,3 @@ # `datocms-html-to-structured-text` | ||
allowedMarks: Mark[]; | ||
// Properties in this object are avaliable to every handler as Context | ||
// Properties in this object are available to every handler as Context | ||
// is not deeply cloned. | ||
@@ -231,2 +231,3 @@ global: GlobalContext; | ||
const body = find(tree, (node) => node.tagName === 'body'); | ||
visit(body, (node, index, parents) => { | ||
@@ -242,2 +243,3 @@ if ( | ||
// remove image | ||
const imgParent = parents[parents.length - 1]; | ||
@@ -266,2 +268,4 @@ imgParent.children.splice(index, 1); | ||
let nodeInserted = false; | ||
// If we reached the 'div' add the image's node | ||
@@ -272,2 +276,4 @@ if (i === 1) { | ||
liftedImages.add(node); | ||
nodeInserted = true; | ||
} | ||
@@ -284,7 +290,9 @@ | ||
} | ||
// Remove the parent if empty | ||
if (parent.children.length === 0) { | ||
splitChildrenIndex -= 1; | ||
parentsParent.children.splice(splitChildrenIndex, 1); | ||
parentsParent.children.splice( | ||
nodeInserted ? splitChildrenIndex - 1 : splitChildrenIndex, | ||
1, | ||
); | ||
} | ||
@@ -291,0 +299,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168304
354
2