@adobe/helix-importer 3.4.1 → 3.4.2
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/CHANGELOG.md +7 -0
- package/package.json +3 -3
- package/src/utils/DOMUtils.js +2 -2
- package/test/utils/DOMUtils.spec.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.4.2](https://github.com/adobe/helix-importer/compare/v3.4.1...v3.4.2) (2024-06-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* handle complex background image css property ([551289b](https://github.com/adobe/helix-importer/commit/551289b6ab40bec5eb5101c642759cbc47e8e0e6))
|
|
7
|
+
|
|
1
8
|
## [3.4.1](https://github.com/adobe/helix-importer/compare/v3.4.0...v3.4.1) (2024-06-02)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-importer",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "Helix Importer tool: create md / docx from html",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@adobe/eslint-config-helix": "2.0.6",
|
|
30
30
|
"@adobe/helix-docx2md": "1.6.0",
|
|
31
|
-
"@adobe/helix-mediahandler": "2.5.
|
|
31
|
+
"@adobe/helix-mediahandler": "2.5.6",
|
|
32
32
|
"@esm-bundle/chai": "4.3.4-fix.0",
|
|
33
33
|
"@semantic-release/changelog": "6.0.3",
|
|
34
34
|
"@semantic-release/exec": "6.0.3",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"mocha-multi-reporters": "1.5.1",
|
|
48
48
|
"mock-fs": "5.2.0",
|
|
49
49
|
"remark-parse": "11.0.0",
|
|
50
|
-
"semantic-release": "
|
|
50
|
+
"semantic-release": "24.0.0",
|
|
51
51
|
"unist-util-inspect": "8.0.0"
|
|
52
52
|
},
|
|
53
53
|
"license": "Apache-2.0",
|
package/src/utils/DOMUtils.js
CHANGED
|
@@ -261,9 +261,9 @@ export default class DOMUtils {
|
|
|
261
261
|
const prop = split.shift();
|
|
262
262
|
const value = split.join(':').trim();
|
|
263
263
|
if (prop === 'background-image') {
|
|
264
|
-
const
|
|
264
|
+
const sanitizedValue = value.replace(/\s/g, '').split(',').shift();
|
|
265
265
|
const elStyle = element.style;
|
|
266
|
-
elStyle.backgroundImage =
|
|
266
|
+
elStyle.backgroundImage = sanitizedValue;
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
const url = element.style.backgroundImage;
|
|
@@ -423,6 +423,10 @@ describe('DOMUtils#getImgFromBackground', () => {
|
|
|
423
423
|
test(createElement('p', {}, { 'background-image': 'url(http://localhost:3001/image.jpg)' }, 'Some content'), '<img src="http://localhost:3001/image.jpg">');
|
|
424
424
|
});
|
|
425
425
|
|
|
426
|
+
it('with complex background-image style', () => {
|
|
427
|
+
test(createElement('p', { style: 'background-image:url("https://www.server.com/image.jpg"), linear-gradient(transparent, transparent);' }, {}, 'Some content'), '<img src="https://www.server.com/image.jpg">');
|
|
428
|
+
});
|
|
429
|
+
|
|
426
430
|
// `createElement` uses JSDOM to create the test-DOM
|
|
427
431
|
// the workaround in DOMUtils#getImgFromBackground exists _precisely_
|
|
428
432
|
// because of a potential bug in JSDOM due to which it doesn't
|