diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-02-18 16:52:45 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-02-18 16:53:56 -0400 |
commit | c308769580169a85a6c01a5150bfb48d8d5e1aab (patch) | |
tree | 19613beb72878a0eacb429a81ad2d5a2d660df26 /src | |
parent | 0bfce8e39bf928fb512843db6b4a24fb992dc3c3 (diff) |
replacer, content: allow warning attribute on image nodes
Diffstat (limited to 'src')
-rw-r--r-- | src/content/dependencies/transformContent.js | 18 | ||||
-rw-r--r-- | src/util/replacer.js | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 757a9507..84881016 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -226,9 +226,16 @@ export default { ? to('media.path', node.src.slice('media/'.length)) : node.src); - const {inline, link, width, height, style, pixelate} = node; - - if (inline) { + const { + link, + style, + warning, + width, + height, + pixelate, + } = node; + + if (node.inline) { return { type: 'image', inline: true, @@ -259,6 +266,11 @@ export default { height: height ?? null, thumb: slots.thumb, + warnings: + (warning + ? warning.split(', ') + : null), + attributes: [ {class: 'content-image'}, diff --git a/src/util/replacer.js b/src/util/replacer.js index 00dfb800..8e6cac7b 100644 --- a/src/util/replacer.js +++ b/src/util/replacer.js @@ -495,6 +495,7 @@ export function postprocessImages(inputNodes) { if (attributes.get('link')) imageNode.link = attributes.get('link'); if (attributes.get('style')) imageNode.style = attributes.get('style'); + if (attributes.get('warning')) imageNode.warning = attributes.get('warning'); if (attributes.get('width')) imageNode.width = parseInt(attributes.get('width')); if (attributes.get('height')) imageNode.height = parseInt(attributes.get('height')); if (attributes.get('pixelate')) imageNode.pixelate = true; |