/**
* Copyright (c) 2006-2013, JGraph Ltd
*/
import React from 'react';
import mxEvent from '../mxgraph/util/mxEvent';
import mxGraph from '../mxgraph/view/mxGraph';
import mxRubberband from '../mxgraph/handler/mxRubberband';
import { error } from '../../packages/core/src/util/gui/mxWindow';
import { load } from '../../packages/core/src/util/network/mxXmlRequest';
class MYNAMEHERE extends React.Component {
constructor(props) {
super(props);
}
render() {
// A container for the graph
return (
<>
{
this.el = el;
}}
style={{
}}
/>
>
);
};
componentDidMount() {
};
}
export default MYNAMEHERE;
function main()
{
// Checks if the browser is supported
if (!mxClient.isBrowserSupported())
{
// Displays an error message if the browser is not supported.
error('Browser is not supported!', 200, false);
}
else
{
mxLog.show();
// Creates the graph inside the given container. The
// editor is used to create certain functionality for the
// graph, such as the rubberband selection, but most parts
// of the UI are custom in this example.
let editor = new mxEditor();
// Configures the editor's UI, the toolbar and the popupmenu.
// Note that the element with the id toolbox is used in the
// config file, the toolbar element (top element) is used below
// to create a second toolbar programmatically.
// The cells to be created via drag and drop are added
// in the templates array in mxEditor, and a custom action is
// added to the built-in actions in the editor, as well.
// The ui section maps the existing DOM elements to the graph
// and toolbar objects, respectively.
// Keep in mind that the as-attributes of the add-items in the
// toolbar and popupmenu sections refer to keys in mxResources.
let config = load('uiconfig.xml').getDocumentElement();
mxObjectCodec.allowEval = true;
editor.configure(config);
mxObjectCodec.allowEval = false;
// Enables new connections in the graph
editor.graph.setConnectable(true);
// Creates the second toolbar programmatically
let container = document.getElementById('toolbar');
let toolbar = new mxDefaultToolbar(container, editor);
// Use eg. mxResources.get("delete") to translate tooltip
toolbar.addItem('Show XML', 'images/icons48/gear.png', 'myFirstAction');
toolbar.addItem('Delete', 'images/icons48/keys.png', 'delete');
console.log('editor', editor);
}
}