JointJS - TextBlock

prevent contextmenu. https://github.com/clientIO/joint/issues/2658

by Roman Bruckner

HTML

<script src="https://cdn.jsdelivr.net/npm/@joint/[email protected]/dist/joint.min.js"></script>
<div id="paper"></div>

JavaScript

const { dia, shapes, mvc } = joint;

const graph = new dia.Graph({}, { cellNamespace: shapes });

const paper = new dia.Paper({
    model: graph,
    background: {
        color: '#F8F9FA',
    },
    async: true,
    cellViewNamespace: shapes
});

document.getElementById('paper').appendChild(paper.el);

const rect1 = new shapes.standard.TextBlock({
    position: { x: 100, y: 50 },
    size: { width: 100, height: 50 },
    attrs: {
        label: {
            text: 'Hello',
            style: {
               fontFamily: 'monospace',
               fontWeight: 'bold'
            }
        }
    }
});

graph.addCell([rect1]);