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

Update Mermaid to 10.2.1 and fix mermaid.init() call #96

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mediawiki-mermaid",
"version": "8.14.0",
"version": "10.2.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "lib/mermaid.core.js",
"keywords": [
Expand All @@ -27,7 +27,7 @@
]
},
"dependencies": {
"mermaid": "8.14.0"
"mermaid": "10.2.1"
},
"files": [
"lib"
Expand Down
45 changes: 22 additions & 23 deletions resources/ext.mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,32 @@
* @author mwjames
*/

/*global jQuery, mediaWiki, smw */
/*global jQuery, mediaWiki, mermaid */
/*jslint white: true */

( function( $, mw ) {
(function ($, mw) {
"use strict";

'use strict';
const generateString = (length) =>
Array(length)
.fill("")
.map(() => Math.random().toString(36).charAt(2))
.join("");

var config = mw.config.get( 'mermaid' );
mw.loader.using(["mediawiki.api", "ext.mermaid"]).then(function () {
$(document).ready(function () {
$(".ext-mermaid").each(function () {
let that = $(this);

mw.loader.using( [ 'mediawiki.api', 'ext.mermaid' ] ).then( function () {
let id = "ext-mermaid-" + generateString(10);
let data = that.data("mermaid");

$( document ).ready( function() {
that.find(".mermaid-dots").hide();
that.append(`<div id="${id}">${data.content}</div>`);

$( '.ext-mermaid' ).each( function() {

var that = $( this );

var id = 'ext-mermaid-' + ( new Date().getTime() );
var data = that.data( 'mermaid' );

that.find( '.mermaid-dots' ).hide();
that.append( '<div id=' + id + '> ' + data.content + ' </div>' );

mermaid.initialize( data.config );
mermaid.init( undefined, $( "#" + id ) );
} );
} );
} );

}( jQuery, mediaWiki ) );
mermaid.initialize(data.config);
mermaid.init(undefined, document.getElementById(id));
});
});
});
})(jQuery, mediaWiki);
1,634 changes: 1,630 additions & 4 deletions resources/mermaid.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/mermaid.min.js.map

Large diffs are not rendered by default.

Loading