mermaid: fix width for some graphs #655

This commit is contained in:
Sören Weber 2023-09-30 21:39:57 +02:00
parent 45113efdf1
commit bb77153860
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -322,7 +322,9 @@ function initMermaid( update, attrs ) {
svg.call( zoom );
var parent = this.parentElement;
// we need to copy the maxWidth, otherwise our reset button will not align in the upper right
parent.style.maxWidth = this.style.maxWidth;
parent.style.maxWidth = this.style.maxWidth || this.getAttribute( 'width' );
// if no unit is given for the width
parent.style.maxWidth = parent.style.maxWidth || this.getAttribute( 'width' ) + 'px';
parent.insertAdjacentHTML( 'beforeend', '<span class="svg-reset-button" title="' + window.T_Reset_view + '"><i class="fas fa-undo-alt"></i></span>' );
parent.querySelector( '.svg-reset-button' ).addEventListener( 'click', function( event ){
inner.transition()