jsPlumb - 将字符串值添加到边缘

jsPlumb - adding a string value to an edge

我正在使用 jQuery jsPlumb 制作一个网络应用程序。我有兴趣提示用户在拖放新边缘时插入一个值。但是,我不确定该怎么做。

有人能帮忙吗?

jsPlumb - http://www.jsplumb.org/demo/flowchart/dom.html

谢谢!

如果"drag-and-drop a new edge"是指建立连接,那么您可以使用连接事件。

 jsPlumb.bind("connection", function (connInfo, originalEvent) {
     // you could ask for input here.
     var userText = prompt("Please enter your name", "Harry Potter");
     // If you want to put the text in  the overlay label on the 
      connInfo.connection.getOverlay("label").setLabel(userText);

 } );

以上代码应该能够获取用户的输入并将其设置到创建的连接的覆盖层中。