JSFiddle - React, Tailwind, and code Playground

by thanhvu231

HTML

<script src="http://www.gojs.net/latest/release/go-debug.js"></script>
<div style="width:100%">
  <span id="paletteSpan">
    <b>Palette</b><br />
	<div id="search"> <input id="searchtext" onkeyup="search(event)" placeholder="Search for items"  autocomplete="on" ></input></div>
    <div id="myPalette" style="border: solid 1px blue; " >
	
	</div>
  </span>
  
  
  <span id="diagramSpan" style="display: inline-block; vertical-align: top; ">
    <b>Canvas:</b><br />
    <div id="mytest" style="border: solid 1px blue; "  ></div>
   </span>
  
  

	 
  
  
    </div>


 <button onclick="relayout()">Re-layout Diagram</button> 
 <button onclick="save()">Save</button>
  <button onclick="load()">Load</button>
  Diagram Model saved in JSON format:
  <br />
  <textarea id="mySavedModel" style="width:100%;height:300px">
</textarea>
 <div style="border: 1px solid gray; padding: 10px; margin-bottom: 20px; -moz-border-radius: 10px;
-webkit-border-radius: 10px;">
Width: <input id="widthInput" value="700" />
Height: <input id="heightInput" value="960" />
<!-- Color: <input  id="ColorInput" type="color"/> -->

<button id="makeImages">Generate images for printing</button>
</div>
<div id="myImages">
</div>

CSS

#myPalette ,#toolbar 
{float:left; width: 100px; height:300px; margin:10px;padding:10px;border:1px solid #aaaaaa; -moz-border-radius: 10px;
-webkit-border-radius: 10px;}
#navigator
{float:left; width:200px; height:100px; margin:10px;padding:10px;border:1px solid #aaaaaa; -moz-border-radius: 10px;
-webkit-border-radius: 10px;}
#mytest 
{float:left; width:500px; height:300px; margin:10px;padding:10px;border:1px solid #aaaaaa;-moz-border-radius: 10px;
-webkit-border-radius: 10px;}
#myImages 
{float:left; width:800px; height:500px; margin:10px;padding:10px;border:1px solid #aaaaaa;-moz-border-radius: 10px;
-webkit-border-radius: 10px;}
#mySavedModel, #searchtext
{-moz-border-radius: 10px;
-webkit-border-radius: 10px;}

JavaScript

/*
 $(function() {
    $( "#paletteSpan" ).draggable();
  });
 */ 
  // This variable refers to the Model that both Diagrams use.
// It is here to allow usage by Data property setters.
var myModel;

// define a node data class that automatically notifies when the "loc" property changes value
function Data(category,text,img, p) {
  
  this.category= category;
  this.text= text;
  this.img= img;
  
  if (p !== undefined)
    this._loc = p;
  else
    this._loc = new go.Point();
}

Data.prototype = {
  // set the constructor: needed so that the model can construct copies of the Data
  constructor: Data,

  // define the "loc" property getter and setter
  get loc() { return this._loc; },
  set loc(val) {
    var old = this._loc;
    if (!old.equals(val)) {
      this._loc = val.copy();
	  
      myModel.raiseDataChanged(this, "loc", old, this._loc);
    }
  }
};
var maxx =0;
var maxy=0;
var test;
  var NodeArray = new Array();
	NodeArray[0]={category: "pic", text: "aggregator",img: "aggregator.png",text2: " Used to combine a number of messages\n together into a single message"};
	NodeArray[1]={category: "pic", text: "delay",img: "delay.png"};
	NodeArray[2]={category: "pic", text: "messagefilter",img: "messagefilter.png"};
	NodeArray[3]={category: "pic", text: "router",img: "router.png"};
	NodeArray[4]={category: "pic", text: "when",img: "when.png"};
	NodeArray[5]={category: "pic", text: "recipient list",img: "recipientlist.png"};
	NodeArray[6]={category: "pic", text: "messagetranslator",img: "messagetranslator.png"};
	NodeArray[7]={category: "pic", text: "resequencer",img: "resequencer.png"};
	NodeArray[8]={category: "Comment", text: "comment"};
	NodeArray[9]={category: "pic", text: "queue",img: "queue.png"};
	NodeArray[10]= {category: "pic", text: "CXF",img: "endpoint.png"};
var diagram = new go.Diagram("mytest");
myDiagram= diagram;
var $$ = go.GraphObject.make;
diagram.allowZoom=true;
function engrid(){
diagram.grid.visible = true;
}
function...