dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.83k stars 589 forks source link

labletype `html` contain js #401

Open withlin opened 4 years ago

withlin commented 4 years ago
let html= `
  <html>
 <head>
  <script type="text/javascript">

   function changeFunc() {
    alert("12131");
   }

  </script>
 </head>
 <body>
  <button type="button" on-click="changeFunc()">Change</button>
 </body>
</html>
  `

  let data = {
    nodes: [
      {
        id: "1",
        label: "<h3>Node 1</h3>",
        labelType: "html"
      },
      {
        id: "2",
        label: html,
        labelType: "html",
        config: {
          style: 'fill: #afa'
        }
      }
    ],
    links: [
      {
        source: '1',
        target: '2',
        label: 'TO',
        config: {
          arrowheadStyle: 'display: none',
          curve: d3.curveBasis
        }
      },
    ]
  }

but the changeFunc function is not working.