m4v3rick

This works for me, I have not managed to condition it to night mode, so I activated the dark mode of the default tweets.

It's not the most orthodox, but while a better solution is implemented, you can do the following:

Go to: vendor/s9e/text-formatter/src/plugins/Media Embed/Collections and locate the "CachedDefinitionCollection.php" file.

Look for this line:

https://s9e.github.io/iframe/2/twitter.min.html#<xsl:value-of select="@id"/><xsl:if test="$MEDIAEMBED_THEME=\'dark\'">#theme=dark</xsl:if>

and replace it with this:

https://s9e.github.io/iframe/2/twitter.min.html#<xsl:value-of select="@id"/>#theme=dark

Maybe @IanM and @luceos or @Ralkage (They are nigthmode contributors and will know the extension better than I do.) can get to condition the line.

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

calling the exact variable of fof/nightmode

    Oshvam I did some tests in FoF Nightmode, unfortunately there doesn't seem to be a way to change this value based on the user choice FriendsOfFlarum/nightmode68

    If we are only talking about Flarum built-in dark mode, this is something we could add in FoF Formatting, where we do what I show in my draft PR but based on Flarum global dark mode switch.

    I notice the dark mode Twitter embed still has white background behind the rounded corners, which make the thing look ugly without additional styling...

      clarkwinkelmann I understand, thanks for responding. Yes, the white borders on the inserted tweet are a pain in the ass.

      I was trying to validate it with a LESS condition similar to this.

      'src' => sprintf('https://s9e.github.io/iframe/2/twitter.min.html#%s%s', '<xsl:value-of select="@id"/>', (@$config['dark-mode']) ? '#theme=dark' : ''),

      But my knowledge doesn't go that far. And it generates conflicts in the code.

      4 months later

      Can you tell me why I cannot link to a CodePen instead of automatically embedding it?
      I installed https://discuss.flarum.org/d/31404-selective-mediaembed/5 and disabled CodePen but it still shows up.
      Even if I add a link with title and codepen link it is replaced by the embedded code and breaking the format.

      Thanks in advance!

        phloo Do you have MediaEmbed enabled in this extension? If so, you should disable it. If not, then it shouldn't be a problem with this extension and instead with selective mediaembed, since you have the functionality that would make the Codepen embed through this ext disabled.

          datitisev
          Yes I have it enabed since we want for the most service.
          Codepen is disabled in "selective mediaembed" because its exactly what I try to get: no auto-embedding codepens. But it is obviously not working.

            phloo You shouldn't have media embed enabled on this ext as it conflicts with the settings from that one.

            From selective mediaembed's discussion:

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

              datitisev Thanks, yes, thats what I overlooked. It works now as intended.
              Thanks for the headsup! 🙂

              14 days later

              Since twitter is changing over more and more to the x.com domain can we request to get x.com support in the plugin?

                Powermage the supported websites are not implemented in this extension. It's part of TextFormatter.

                I am sure JoshyPHP from the TextFormatter project will make the required changes in time.

                This extension will automatically inherit and fix or improvement made in TextFormatter.

                  14 days later

                  attentive you should be able to run composer update s9e/text-formatter in the same folder where you usually run Flarum commands and Composer will attempt to update TextFormatter to the latest available version. The Composer output should show the old and new version it was updated to. Then clear Flarum cache for the update to take effect.

                  Flarum currently requests any 2.x version of TextFormatter so all recent releases of TextFormatter should be picked up by Flarum (and will already be installed when doing a fresh install). I see the latest versions of TextFormatter require PHP 8.0 or higher. If you are running Flarum on PHP 7.3/7.4 Composer will only install an older compatible TextFormatter version.

                  7 days later

                  Thanks @clarkwinkelmann, that is very helpful.

                  I was able to sort it out by both changing the version of PHP Flarum was running on from 7.4 to 8.1, which didn't cause issues, and by running a composer update s9e/text-formatter followed by php flarum cache:clear.

                  After I reloaded our forum the new-fangled x.com URLs were being converted into embedded tweets as you'd hope.

                    7 days later

                    Seems something wrong after upgrade 1.8.1 to 1.8.2..

                    • Flarum 1.8.2
                    • PHP 8.0.17
                    • MySQL 5.7.27-30
                    • FoF Formatting 1.0.3 ON
                      • Autoimage Off
                      • Autovideo On
                      • FancyPants Off
                      • HTMLEntities Off
                      • MediaEmbed On
                      • PipeTables On
                      • TaskLists On

                    Infinite page loading with YouTube video embedded however all seems already loaded. And I cant manually stop this. Checked in FireFox and Google Chrome.

                    You can check this in this post: [CUTTED]

                    And if you press CTRL+F5 - problem is gone while next time time loading.

                    If I replace video player embedding with just direct link - all works fine.

                    Is it my network problem or cause of some Flarum frontend changes?

                    ADDED: I am just try with VPN and it works just fine.. So, seems network/region related.

                      Gorm I don't understand what your issue is. Can you share a link or video where we can see the issue, or describe in more details the steps that lead to the error? You say it works after a refresh, does that mean the problem only happens when coming from the discussion list?

                      Have you tried using different browsers and private browsing in addition to VPN?

                      Is there any javascript error in the browser development console?

                      Since YouTube loads in an iframe it's not supposed to be able to break the Flarum single page app, so the issue would be in the extension javascript side.

                        clarkwinkelmann I cant repeat the issue. I am clear caches and restart my laptop and problem totally gone 🙂 So, its common system related (or cache). No problem for 2 days on Flarum 1.8.2. Thanks for your attention.

                        4 days later

                        clarkwinkelmann

                        You say the extension API can disable MediaEmbed sources, but I've only found docs relating to adding sources, I specifically want to disable Facebook embedding but leave everything else alone, but haven't found a way to do that that doesn't involve modifying the plugin source. Can you point me in the right direction?