fill in data-mfm- variables
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful

Things like `speed=0.1s` now work

I also noticed a class was set on StatusBody, but we don't use it, we use StatusContent.
Therefor I removed it now.

We do still pass the setting through StatusBody to RichContent bc it's used there to decide to not show greentext for arrows when MFM was used.
Note that while this setting still works
* You have to refresh the page to see it working (was already like this, so I didn't touch it here)
* It explicitly checks for content type. If womeone provides MFM-like HTML, then it will still show as greentext if that option is enabled
  I think it's a bit inconsistent, but otoh, the inconsistency to me seems more that we ignore the greentext option for one input type specifically

I do still notice generall bugs with MFM.
* Position doesn't seem to work, neither does scale.
* There also seems to be a regression where custom emojis don't become larger any more with e.g. `$[x2 :hehe: ]`

I don't assume the regression is made in this commit, so I add this already. The rest needs to be fixed before merging.
This commit is contained in:
ilja 2024-08-05 11:52:48 +02:00
parent 3065416c93
commit f12068d6c2
2 changed files with 12 additions and 1 deletions

View file

@ -191,6 +191,17 @@ export default {
if (this.handleLinks && attrs?.['class']?.includes?.('h-card')) {
return ['', children.map(processItem), '']
}
// Turn data-mfm- attributes into a string for the styles 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_styles = 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_styles !== "") {
return [opener.slice(0,-1) + " style=\"" + mfm_styles + "\">", children.map(processItem), closer]
}
}
if (children !== undefined) {

View file

@ -1,7 +1,7 @@
<template>
<div
class="StatusBody"
:class="{ '-compact': compact, 'mfm-disabled': !renderMisskeyMarkdown }"
:class="{ '-compact': compact }"
>
<div class="body">
<div