diff --git a/editor/js/ui/clipboard.js b/editor/js/ui/clipboard.js
index 5a8385ca9..2db0f17ec 100644
--- a/editor/js/ui/clipboard.js
+++ b/editor/js/ui/clipboard.js
@@ -72,8 +72,22 @@ RED.clipboard = (function() {
var importNodesDialog = '
'+
''+
'
';
-
-
+
+ function validateImport() {
+ var importInput = $("#clipboard-import");
+ var v = importInput.val();
+ try {
+ JSON.parse(v);
+ importInput.removeClass("input-error");
+ $("#clipboard-dialog-ok").button("enable");
+ } catch(err) {
+ if (v !== "") {
+ importInput.addClass("input-error");
+ }
+ $("#clipboard-dialog-ok").button("disable");
+ }
+ }
+
function importNodes() {
dialogContainer.empty();
dialogContainer.append($(importNodesDialog));
@@ -81,22 +95,12 @@ RED.clipboard = (function() {
$("#clipboard-dialog-cancel").show();
$("#clipboard-dialog-close").hide();
$("#clipboard-dialog-ok").button("disable");
- $("#clipboard-import").keyup(function() {
- var v = $(this).val();
- try {
- JSON.parse(v);
- $(this).removeClass("input-error");
- $("#clipboard-dialog-ok").button("enable");
- } catch(err) {
- if (v !== "") {
- $(this).addClass("input-error");
- }
- $("#clipboard-dialog-ok").button("disable");
- }
- });
+ $("#clipboard-import").keyup(validateImport);
+ $("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)});
+
dialog.dialog("option","title","Import nodes").dialog("open");
}
-
+
function exportNodes() {
dialogContainer.empty();
dialogContainer.append($(exportNodesDialog));