@socialgouv/fiches-travail-data-types 4.439.0 → 4.441.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/fetch-data/parseDom.js +19 -10
- package/package.json +1 -1
|
@@ -43,26 +43,35 @@ const formatPicture = (node) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (comment) {
|
|
47
|
+
const [, src = ""] = comment.data.match(SRC_REGEX);
|
|
48
|
+
if (src.length) {
|
|
49
|
+
const srcClean = getCleanSrc(src);
|
|
50
|
+
node.parentNode.innerHTML = `<img src="${srcClean}" style="width:100%;height:auto;" />`;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
let image;
|
|
55
|
+
node
|
|
56
|
+
.childNodes
|
|
57
|
+
.forEach(function (childNode) {
|
|
58
|
+
if (childNode.nodeName === "IMG") {
|
|
59
|
+
image = childNode;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (image) {
|
|
63
|
+
node.replaceWith(image);
|
|
53
64
|
}
|
|
54
|
-
const srcClean = getCleanSrc(src);
|
|
55
|
-
node.parentNode.innerHTML = `<img src="${srcClean}" style="width:100%;height:auto;" />`;
|
|
56
65
|
};
|
|
57
66
|
const formatImage = (node) => {
|
|
58
67
|
node.removeAttribute("onmousedown");
|
|
59
68
|
if (node.getAttribute("src").indexOf("data:image") === -1) {
|
|
69
|
+
node.removeAttribute("srcset");
|
|
70
|
+
node.removeAttribute("sizes");
|
|
60
71
|
let src = node.getAttribute("src");
|
|
61
72
|
if (!src.match(/^https?:\/\//)) {
|
|
62
73
|
const srcClean = getCleanSrc(src);
|
|
63
74
|
node.setAttribute("src", srcClean);
|
|
64
|
-
node.removeAttribute("srcset");
|
|
65
|
-
node.removeAttribute("sizes");
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
};
|