Preserve image accessibility and dimensions in MJML
This commit is contained in:
1 parent
1c05e02d94
commit
07ed6b2596
4 files changed
+32
-4
No files matched your search
@@ -382,7 +382,7 @@ export const imageBlock = leaf(
|
||||
node,
|
||||
),
|
||||
mjml: ({ node }) =>
|
||||
`<mj-image src="${html(attrs(node).src)}" alt="${html(attrs(node).alt)}" width="${html(attrs(node).width)}px" />`,
|
||||
`<mj-image src="${html(attrs(node).src)}" alt="${html(attrs(node).decorative ? "" : attrs(node).alt)}" width="${html(attrs(node).width)}px" height="${html(attrs(node).height)}px" />`,
|
||||
},
|
||||
({ node }) => (attrs(node).decorative ? "" : `[${String(attrs(node).alt)}]\n\n`),
|
||||
);
|
||||
|
||||
@@ -240,8 +240,8 @@ export function importMjml(
|
||||
type: "content.image",
|
||||
version: 1,
|
||||
props: {
|
||||
src: a.src ?? "",
|
||||
alt: a.alt ?? "",
|
||||
src: decode(a.src ?? ""),
|
||||
alt: decode(a.alt ?? ""),
|
||||
width: (a.width ?? "600").replace(/px$/, ""),
|
||||
height: (a.height ?? "300").replace(/px$/, ""),
|
||||
decorative: false,
|
||||
|
||||
Reference in new issue
Block a user