Skip to content

Commit 2ee2a85

Browse files
committed
feat: support for widths of image and assets images
1 parent 0a55c01 commit 2ee2a85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/fromRedactor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export const fromRedactor = (el: any, options?:IHtmlToJsonOptions) : IAnyObject
513513
}
514514

515515
else if (sizeAttrs.width.slice(sizeAttrs.width.length - 2) === 'px') {
516-
sizeAttrs.width = (Number(sizeAttrs.width.slice(0, sizeAttrs.width.length - 2)) / 1920) * 100
516+
sizeAttrs.width = Number(sizeAttrs.width.slice(0, sizeAttrs.width.length - 2))
517517
}
518518
}
519519
if (el.style?.['max-width']) {
@@ -524,7 +524,7 @@ export const fromRedactor = (el: any, options?:IHtmlToJsonOptions) : IAnyObject
524524

525525
else if (sizeAttrs['max-width'].slice(sizeAttrs['max-width'].length - 2) === 'px') {
526526
sizeAttrs['max-width'] =
527-
(Number(sizeAttrs['max-width'].slice(0, sizeAttrs['max-width'].length - 2)) / 1920) * 100
527+
Number(sizeAttrs['max-width'].slice(0, sizeAttrs['max-width'].length - 2))
528528
}
529529
}
530530
let captionElements = el.getElementsByTagName("FIGCAPTION")

0 commit comments

Comments
 (0)