Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I know it’s a bit late, but I had the same problem, so I wrote a minor fix, that replaces the img with the svg … hope this helps;)
    It’s important, that when you create your diagram, it has to be exportet as an svg.

    jQuery(document).ready(function($) {
        $('img[title="drawit diagram"]').each(function(index){
    		var diagram = $(this);
    
    		var diagramImg = diagram.attr('title', 'drawit diagram');
    		var diagramImgSrc = diagramImg.context.src;
    				
    		var diagramClasses = diagramImg.context.className;
    		var diagramWidth = diagramImg.context.clientWidth;
    		
    		var container = $('<div class="drawio-diagram ' + diagramClasses + '" style="width:' + diagramWidth + 'px"></div>');
    		container.insertAfter(diagram);
    		
    		container.load(diagramImgSrc);
    		diagram.remove();
    	});
    });

    I know it’s a bit late, but I had the same problem, so I wrote a minor fix, that replaces the img with the svg … hope this helps;)
    It’s important, that when you create your diagram, it has to be exportet as an svg.

    jQuery(document).ready(function($) {
        $('img[title="drawit diagram"]').each(function(index){
    		var diagram = $(this);
    
    		var diagramImg = diagram.attr('title', 'drawit diagram');
    		var diagramImgSrc = diagramImg.context.src;
    				
    		var diagramClasses = diagramImg.context.className;
    		var diagramWidth = diagramImg.context.clientWidth;
    		
    		var container = $('<div class="drawio-diagram ' + diagramClasses + '" style="width:' + diagramWidth + 'px"></div>');
    		container.insertAfter(diagram);
    		
    		container.load(diagramImgSrc);
    		diagram.remove();
    	});
    });
Viewing 2 replies - 1 through 2 (of 2 total)