diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 0da7f3de..0739afb3 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -191,6 +191,21 @@ export default { if (this.handleLinks && attrs?.['class']?.includes?.('h-card')) { return ['', children.map(processItem), ''] } + // Turn data-mfm- attributes into a string for the `style` attribute + // If they have a value different than `true`, they need to be added to `style` + // e.g. `attrs={'data-mfm-some': '1deg', 'data-mfm-thing': '5s'}` => "--mfm-some: 1deg;--mfm-thing: 5s;" + let mfm_style = Object.keys(attrs).filter( + (key) => key.startsWith('data-mfm-') && attrs[key] !== true + ).map( + (key) => '--mfm-' + key.substr(9) + ': ' + attrs[key] + ';' + ).reduce((a,v) => a+v, "") + if (mfm_style !== "") { + return [ + opener.slice(0,-1) + " style=\"" + mfm_style + "\">", + children.map(processItem), + closer + ] + } } if (children !== undefined) { diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue index 882b38c5..3002110d 100644 --- a/src/components/status_body/status_body.vue +++ b/src/components/status_body/status_body.vue @@ -1,7 +1,7 @@