1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Scope input/export actions to be global

This commit is contained in:
Nick O'Leary 2017-01-11 14:15:14 +00:00
parent 4e636d7eec
commit a95727b654
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 22 additions and 4 deletions

View File

@ -9,11 +9,12 @@
"ctrl-escape": "core:cancel-edit-tray", "ctrl-escape": "core:cancel-edit-tray",
"ctrl-g i": "core:show-info-tab", "ctrl-g i": "core:show-info-tab",
"ctrl-g d": "core:show-debug-tab", "ctrl-g d": "core:show-debug-tab",
"ctrl-g c": "core:show-config-tab" "ctrl-g c": "core:show-config-tab",
},
"workspace": {
"ctrl-e": "core:show-export-dialog", "ctrl-e": "core:show-export-dialog",
"ctrl-i": "core:show-import-dialog", "ctrl-i": "core:show-import-dialog",
"ctrl-space": "core:toggle-sidebar"
},
"workspace": {
"backspace": "core:delete-selection", "backspace": "core:delete-selection",
"delete": "core:delete-selection", "delete": "core:delete-selection",
"enter": "core:edit-selected-node", "enter": "core:edit-selected-node",
@ -23,7 +24,6 @@
"ctrl-z": "core:undo", "ctrl-z": "core:undo",
"ctrl-a": "core:select-all-nodes", "ctrl-a": "core:select-all-nodes",
"shift-?": "core:show-help", "shift-?": "core:show-help",
"ctrl-space": "core:toggle-sidebar",
"up": "core:move-selection-up", "up": "core:move-selection-up",
"right": "core:move-selection-right", "right": "core:move-selection-right",
"down": "core:move-selection-down", "down": "core:move-selection-down",

View File

@ -21,6 +21,7 @@ RED.clipboard = (function() {
var dialogContainer; var dialogContainer;
var exportNodesDialog; var exportNodesDialog;
var importNodesDialog; var importNodesDialog;
var disabled = false;
function setupDialogs() { function setupDialogs() {
dialog = $('<div id="clipboard-dialog" class="hide node-red-dialog"><form class="dialog-form form-horizontal"></form></div>') dialog = $('<div id="clipboard-dialog" class="hide node-red-dialog"><form class="dialog-form form-horizontal"></form></div>')
@ -128,6 +129,9 @@ RED.clipboard = (function() {
} }
function importNodes() { function importNodes() {
if (disabled) {
return;
}
dialogContainer.empty(); dialogContainer.empty();
dialogContainer.append($(importNodesDialog)); dialogContainer.append($(importNodesDialog));
dialogContainer.i18n(); dialogContainer.i18n();
@ -153,6 +157,10 @@ RED.clipboard = (function() {
} }
function exportNodes() { function exportNodes() {
if (disabled) {
return;
}
dialogContainer.empty(); dialogContainer.empty();
dialogContainer.append($(exportNodesDialog)); dialogContainer.append($(exportNodesDialog));
dialogContainer.i18n(); dialogContainer.i18n();
@ -279,6 +287,16 @@ RED.clipboard = (function() {
RED.actions.add("core:show-import-dialog",importNodes); RED.actions.add("core:show-import-dialog",importNodes);
RED.events.on("editor:open",function() { disabled = true; });
RED.events.on("editor:close",function() { disabled = false; });
RED.events.on("search:open",function() { disabled = true; });
RED.events.on("search:close",function() { disabled = false; });
RED.events.on("type-search:open",function() { disabled = true; });
RED.events.on("type-search:close",function() { disabled = false; });
RED.events.on("palette-editor:open",function() { disabled = true; });
RED.events.on("palette-editor:close",function() { disabled = false; });
$('#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'});