Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mermaid does not load when used within a Flow topic #52

Open
bitsofmymind opened this issue Jul 29, 2020 · 6 comments
Open

Mermaid does not load when used within a Flow topic #52

bitsofmymind opened this issue Jul 29, 2020 · 6 comments

Comments

@bitsofmymind
Copy link

Setup and configuration

  • Mermaid version: 2.2
  • MediaWiki version: 1.34.0
  • PHP version: 7.3.20
  • Database system (MySQL, PostgresQL, etc.) and version: MySQL 5.7.16

Issue

This is a bit of a corner case, but we've found out that Mermaid does not load when called within a Flow (StructuredDiscussions) topic. The syntax does not work standalone and needs to be wrapped in a Template, but that's probably a Flow issue.

However, when wrapped in a Template and called from a Flow topic, the mermaid librairies are not loaded.

Adding the following to Mediawiki:Common.js seems to get it to work:

if(mw.config.get('wgNamespaceNumber') % 2 && $('.ext-mermaid').length) 
{ 
    var config = mw.config.get( 'mermaid' );
    mw.loader.using( [ 'mediawiki.api', 'ext.mermaid', 'ext.mermaid.theme.' + config.theme ] );
 }
@kghbln
Copy link
Member

kghbln commented Aug 6, 2020

Thanks for reporting and suggesting a fix. You can create a pull if you like.

@kghbln
Copy link
Member

kghbln commented Aug 7, 2020

@JeroenDeDauw This suggests adding something to common.js Probably a solution could be added to Mermaid code itself. Something to integrate into 3.0.0 (#48) though not a blocker

@JeroenDeDauw
Copy link
Member

This looks like a bug, not like a breaking change, so I do not feel in any way compelled to work on this by 3.0 release

@kghbln
Copy link
Member

kghbln commented Aug 7, 2020

This looks like a bug, not like a breaking change, so I do not feel in any way compelled to work on this by 3.0 release

No worries. That's why I mentioned: though not a blocker.

@bitsofmymind
Copy link
Author

Thank you gents,

In fact, the proposed solutions works "most of the time" but sometimes doesn't, which leads me to believe that it browser timing sensitive. In short, it's an ugly hack.

The problem indeed seems to lie with the Flow extension. I figured I'd report it in case someone came up with a better fix.

@kghbln
Copy link
Member

kghbln commented Aug 10, 2020

In fact, the proposed solutions works "most of the time" but sometimes doesn't, which leads me to believe that it browser timing sensitive. In short, it's an ugly hack.

Still much better than nothing and great that you shared this interim solution.

The problem indeed seems to lie with the Flow extension. I figured I'd report it in case someone came up with a better fix.

I suspect this is may very well be the case. Keeping fingers crossed since development for Flow has basically been reduced to hot fixes only afaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants