poVoq there's nothing I can do on my end.

I think Sami's extension would work out of the box with mine, it just needs to change its requirements to allow fof/formatting to be disabled.

8 months later

Currently having a problem with CodePen.
I installed the ext. Enabled all except Codepen modules. Cleared cache
Edited the post and its still embedding the codepen instead of showing a link to it.

    phloo does it appear on new posts or not?

    If you edited an older post, make sure to change at least one character for Flarum to re-parse the input.

      clarkwinkelmann it's not a new post and its edited all the time.
      But no change. There is always a codepen iframe.
      And it's not even possible to use the link-function (breaks the codepen link)

        phloo but if you create a new post with a codepen link, is it embedded or not? If you edit the post so there's no longer any codepen link at all, then edit to add it back in, does the iframe come back? If you edit a post that never had a codepen and add one, does the iframe appear? Trying to narrow down where the issue is.

        EDIT: now I see you posted more messages in the FoF Formatting discussion. If you have MediaEmbed enabled in FoF Formatting it will override my extension and always enable all embeds.

        Ah, that was what I misunderstood. I thought your extension overwrites FoF Formatting not the other way.
        I now disabled mediaEmbed in FoF and it seems to work.

        You can use this extension at the same time as FoF Formatting, but you should not enable MediaEmbed in FoF Formatting when doing so.

        I missed this part obviously. Mea culpa 🙂

        2 months later

        Version 1.0.1

        • Fix error if previously supported site is removed in a TextFormatter update.
        • Remove leftover console.log in admin panel.

          clarkwinkelmann Hi Clark, would it be possible to add an X embed to Media Embed? The current problem that many forums are facing is that users are already starting to share links from x.com instead of twitter.com, so the embed is not generated. Over time this is only going to get worse. I've tried to do it myself, but my knowledge doesn't go that far, I thought it would be easy by replacing the domains and using Twitter's embed.js, but apparently not, as the extension still uses the s9 script.

            clarkwinkelmann Perfect, now I do. But for some reason this isn't working for me:

            <xsl:if test="$MEDIAEMBED_THEME=\'dark\'">#theme=dark</xsl:if>

            I understand that it conditions the tweet to dark/white mode depending on the active theme. But it only inserts them with a white background, is there anything I should be aware of? I have FOF Formated and Selective Media Embed. With neither of the two extensions does it change the colour of the tweet.

              Oshvam I don't believe the $MEDIAEMBED_THEME feature of TextFormatter is used by Flarum or any extension.

              I remember playing with it in the past but didn't manage to get anything working.

              It can be changed using a local extender if you are ever going to be using dark mode, but to use it together with Nightmode would require compiling 2 different TextFormatter instances which Flarum doesn't natively support and would be complicated to maintain.

                a month later

                clarkwinkelmann That's a template parameter, you can change it on the renderer itself with something like this:

                $renderer->setParameter('MEDIAEMBED_THEME', 'dark');

                You only have to set it once, but nothing bad happens if you overwrite it before every call to the renderer. You can also configure the renderer used for live preview the same way:

                s9e.TextFormatter.setParameter('MEDIAEMBED_THEME', 'dark');

                Make sure the API is exported:

                diff --git a/framework/core/src/Formatter/Formatter.php b/framework/core/src/Formatter/Formatter.php
                index 2dbc97c..a219696 100644
                --- a/framework/core/src/Formatter/Formatter.php
                +++ b/framework/core/src/Formatter/Formatter.php
                @@ -121,7 +121,7 @@ class Formatter
                         $configurator->rendering->getEngine()->cacheDir = $this->cacheDir; // @phpstan-ignore-line
                 
                         $configurator->enableJavaScript();
                -        $configurator->javascript->exports = ['preview'];
                +        $configurator->javascript->exports = ['preview', 'setParameter'];
                a year later

                Trc4 I'm not sure if I understand your situation.

                Rich Embeds can be used to create a YouTube preview and embedded player. In that case TextFormatter / MediaEmbed / Selective MediaEmbed shouldn't have any impact on it. Is this not the case?

                If you have excluded YouTube from Rich Embeds and are using MediaEmbed through FoF Formatting or Selective MediaEmbed, then all the relevant code is within TextFormatter itself. FoF Formatting and MediaEmbed just toggle this feature without adding any additional javascript or CSS. A change of height of TextFormatter custom tags should ideally be handled by Flarum, because it's too complex to expect every extension to handle it without causing conflicts between each other.

                • Trc4 replied to this.

                  clarkwinkelmann> Oh, I was referring to this post. If that's the case, I'll leave it out.

                  CyberGene But if you have the FoF Formatting extension, you will have to disable the “media embed” option there and also install the (free) Selective Media Embed extension and in its options to have all websites enabled except for YouTube