mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
try to trim imported/dragged flows to [ ]
This commit is contained in:
parent
5826de76ca
commit
661e1a4f90
@ -83,9 +83,11 @@ RED.clipboard = (function() {
|
|||||||
function validateImport() {
|
function validateImport() {
|
||||||
var importInput = $("#clipboard-import");
|
var importInput = $("#clipboard-import");
|
||||||
var v = importInput.val();
|
var v = importInput.val();
|
||||||
|
v = v.substring(v.indexOf('['),v.lastIndexOf(']')+1);
|
||||||
try {
|
try {
|
||||||
JSON.parse(v);
|
JSON.parse(v);
|
||||||
importInput.removeClass("input-error");
|
importInput.removeClass("input-error");
|
||||||
|
importInput.val(v);
|
||||||
$("#clipboard-dialog-ok").button("enable");
|
$("#clipboard-dialog-ok").button("enable");
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
if (v !== "") {
|
if (v !== "") {
|
||||||
@ -153,8 +155,6 @@ RED.clipboard = (function() {
|
|||||||
RED.keyboard.add(/* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();});
|
RED.keyboard.add(/* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();});
|
||||||
RED.keyboard.add(/* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();});
|
RED.keyboard.add(/* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#chart').on("dragenter",function(event) {
|
$('#chart').on("dragenter",function(event) {
|
||||||
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
|
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
|
||||||
$("#dropTarget").css({display:'table'});
|
$("#dropTarget").css({display:'table'});
|
||||||
@ -173,18 +173,13 @@ RED.clipboard = (function() {
|
|||||||
.on("drop",function(event) {
|
.on("drop",function(event) {
|
||||||
var data = event.originalEvent.dataTransfer.getData("text/plain");
|
var data = event.originalEvent.dataTransfer.getData("text/plain");
|
||||||
hideDropTarget();
|
hideDropTarget();
|
||||||
|
data = data.substring(data.indexOf('['),data.lastIndexOf(']')+1);
|
||||||
RED.view.importNodes(data);
|
RED.view.importNodes(data);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
import: importNodes,
|
import: importNodes,
|
||||||
export: exportNodes
|
export: exportNodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user