BPMN-IO issue: Cannot attach diagram to Canvas


#1

Hi
I try to display a diagram using BpmnViewer from bpmn.io.
If I use

 <div class="content">
  <div id="diagramCanvas"></div>

with

var BpmnViewer = window.BpmnJS;

var viewer = new BpmnViewer({ container: ‘#diagramCanvas’ });

everything works fine and the diagram is getting displayed.

But than I read the follwoing blog https://bpmn.io/blog/posts/2017-bpmn-js-0-20.html where it was mentioned, that the viewer can now be attached to any element in the DOM.
So I tried to attach the viewer to a canvas, but all I get is an empty area

My code is:

<canvas id="canvas" width="800" height="500" style="border:1px solid #000000;"></canvas>

and

var BpmnViewer = window.BpmnJS;
// create detached
var viewer = new BpmnViewer();
// attach it to some element
viewer.attachTo(’#canvas’);

Where is my mistake?
Thanks and best regards, Roland


#2

Make sure your container element is a div, not a canvas.That should fix your problem.