@node-red/editor-client 3.0.0-beta.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locales/en-US/editor.json +4 -0
- package/locales/ja/editor.json +16 -4
- package/package.json +1 -1
- package/public/red/about +40 -522
- package/public/red/keymap.json +15 -13
- package/public/red/red.js +174 -77
- package/public/red/red.min.js +2 -2
- package/public/red/style.min.css +2 -2
- package/public/red/tours/welcome.js +5 -5
- package/public/vendor/vendor.js +3 -3
package/public/red/keymap.json
CHANGED
|
@@ -3,16 +3,12 @@
|
|
|
3
3
|
"alt-shift-p":"core:manage-palette",
|
|
4
4
|
"ctrl-f": "core:search",
|
|
5
5
|
"ctrl-shift-f": "core:list-flows",
|
|
6
|
-
"ctrl-+": "core:zoom-in",
|
|
7
|
-
"ctrl--": "core:zoom-out",
|
|
8
|
-
"ctrl-0": "core:zoom-reset",
|
|
9
|
-
"ctrl-enter": "core:confirm-edit-tray",
|
|
10
|
-
"ctrl-escape": "core:cancel-edit-tray",
|
|
11
6
|
"ctrl-d": "core:deploy-flows",
|
|
12
|
-
"ctrl-g i": "core:show-info-tab",
|
|
13
|
-
"ctrl-g h": "core:show-help-tab",
|
|
14
|
-
"ctrl-g d": "core:show-debug-tab",
|
|
15
7
|
"ctrl-g c": "core:show-config-tab",
|
|
8
|
+
"ctrl-g d": "core:show-debug-tab",
|
|
9
|
+
"ctrl-g h": "core:show-help-tab",
|
|
10
|
+
"ctrl-g i": "core:show-info-tab",
|
|
11
|
+
"ctrl-g v": "core:show-version-control-tab",
|
|
16
12
|
"ctrl-g x": "core:show-context-tab",
|
|
17
13
|
"ctrl-e": "core:show-export-dialog",
|
|
18
14
|
"ctrl-i": "core:show-import-dialog",
|
|
@@ -23,11 +19,8 @@
|
|
|
23
19
|
"ctrl-alt-r": "core:show-remote-diff",
|
|
24
20
|
"ctrl-alt-n": "core:new-project",
|
|
25
21
|
"ctrl-alt-o": "core:open-project",
|
|
26
|
-
"ctrl-g v": "core:show-version-control-tab",
|
|
27
22
|
"ctrl-shift-l": "core:show-event-log",
|
|
28
|
-
"ctrl-shift-p":"core:show-action-list"
|
|
29
|
-
"alt-w": "core:hide-flow",
|
|
30
|
-
"alt-shift-w": "core:show-last-hidden-flow"
|
|
23
|
+
"ctrl-shift-p":"core:show-action-list"
|
|
31
24
|
},
|
|
32
25
|
"red-ui-sidebar-node-config": {
|
|
33
26
|
"backspace": "core:delete-config-selection",
|
|
@@ -93,7 +86,16 @@
|
|
|
93
86
|
"alt-a v": "core:distribute-selection-vertically",
|
|
94
87
|
"shift-f": "core:search-previous",
|
|
95
88
|
"f": "core:search-next",
|
|
96
|
-
"alt-l l": "core:split-wire-with-link-nodes"
|
|
89
|
+
"alt-l l": "core:split-wire-with-link-nodes",
|
|
90
|
+
"alt-w": "core:hide-flow",
|
|
91
|
+
"alt-shift-w": "core:show-last-hidden-flow",
|
|
92
|
+
"ctrl-+": "core:zoom-in",
|
|
93
|
+
"ctrl--": "core:zoom-out",
|
|
94
|
+
"ctrl-0": "core:zoom-reset"
|
|
97
95
|
|
|
96
|
+
},
|
|
97
|
+
"red-ui-editor-stack": {
|
|
98
|
+
"ctrl-enter": "core:confirm-edit-tray",
|
|
99
|
+
"ctrl-escape": "core:cancel-edit-tray"
|
|
98
100
|
}
|
|
99
101
|
}
|
package/public/red/red.js
CHANGED
|
@@ -5326,6 +5326,7 @@ RED.nodes = (function() {
|
|
|
5326
5326
|
function importNodes(newNodesObj,options) { // createNewIds,createMissingWorkspace) {
|
|
5327
5327
|
const defOpts = { generateIds: false, addFlow: false, reimport: false, importMap: {} }
|
|
5328
5328
|
options = Object.assign({}, defOpts, options)
|
|
5329
|
+
options.importMap = options.importMap || {}
|
|
5329
5330
|
const createNewIds = options.generateIds;
|
|
5330
5331
|
const reimport = (!createNewIds && !!options.reimport)
|
|
5331
5332
|
const createMissingWorkspace = options.addFlow;
|
|
@@ -15444,8 +15445,8 @@ RED.deploy = (function() {
|
|
|
15444
15445
|
null
|
|
15445
15446
|
]
|
|
15446
15447
|
if (RED.settings.runtimeState && RED.settings.runtimeState.ui === true) {
|
|
15447
|
-
mainMenuItems.push({id:"deploymenu-item-runtime-start", icon:"red/images/start.svg",label:
|
|
15448
|
-
mainMenuItems.push({id:"deploymenu-item-runtime-stop", icon:"red/images/stop.svg",label:
|
|
15448
|
+
mainMenuItems.push({id:"deploymenu-item-runtime-start", icon:"red/images/start.svg",label:RED._("deploy.startFlows"),sublabel:RED._("deploy.startFlowsDesc"),onselect:"core:start-flows", visible:false})
|
|
15449
|
+
mainMenuItems.push({id:"deploymenu-item-runtime-stop", icon:"red/images/stop.svg",label:RED._("deploy.stopFlows"),sublabel:RED._("deploy.stopFlowsDesc"),onselect:"core:stop-flows", visible:false})
|
|
15449
15450
|
}
|
|
15450
15451
|
mainMenuItems.push({id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"})
|
|
15451
15452
|
RED.menu.init({id:"red-ui-header-button-deploy-options", options: mainMenuItems });
|
|
@@ -18554,13 +18555,18 @@ RED.keyboard = (function() {
|
|
|
18554
18555
|
if (partialState) {
|
|
18555
18556
|
partialState = null;
|
|
18556
18557
|
return resolveKeyEvent(evt);
|
|
18557
|
-
} else if (Object.keys(handler).length > 0) {
|
|
18558
|
-
partialState = handler;
|
|
18559
|
-
evt.preventDefault();
|
|
18560
|
-
return null;
|
|
18561
|
-
} else {
|
|
18562
|
-
return null;
|
|
18563
18558
|
}
|
|
18559
|
+
if (Object.keys(handler).length > 0) {
|
|
18560
|
+
// check if there's a potential combined handler initiated by this keyCode
|
|
18561
|
+
for (let h in handler) {
|
|
18562
|
+
if (matchHandlerToEvent(evt,handler[h]) > -1) {
|
|
18563
|
+
partialState = handler;
|
|
18564
|
+
evt.preventDefault();
|
|
18565
|
+
break;
|
|
18566
|
+
}
|
|
18567
|
+
}
|
|
18568
|
+
}
|
|
18569
|
+
return null;
|
|
18564
18570
|
} else {
|
|
18565
18571
|
var depth = Infinity;
|
|
18566
18572
|
var matchedHandler;
|
|
@@ -19779,6 +19785,7 @@ RED.view = (function() {
|
|
|
19779
19785
|
let flashingNodeId;
|
|
19780
19786
|
|
|
19781
19787
|
var clipboard = "";
|
|
19788
|
+
let clipboardSource
|
|
19782
19789
|
|
|
19783
19790
|
// Note: these are the permitted status colour aliases. The actual RGB values
|
|
19784
19791
|
// are set in the CSS - flow.scss/colors.scss
|
|
@@ -20312,8 +20319,10 @@ RED.view = (function() {
|
|
|
20312
20319
|
});
|
|
20313
20320
|
|
|
20314
20321
|
RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection);
|
|
20315
|
-
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();});
|
|
20316
|
-
RED.actions.add("core:paste-from-internal-clipboard",function(){
|
|
20322
|
+
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection(true);deleteSelection();});
|
|
20323
|
+
RED.actions.add("core:paste-from-internal-clipboard",function(){
|
|
20324
|
+
importNodes(clipboard,{generateIds: clipboardSource === 'copy', generateDefaultNames: clipboardSource === 'copy'});
|
|
20325
|
+
});
|
|
20317
20326
|
|
|
20318
20327
|
RED.actions.add("core:detach-selected-nodes", function() { detachSelectedNodes() })
|
|
20319
20328
|
|
|
@@ -21833,6 +21842,9 @@ RED.view = (function() {
|
|
|
21833
21842
|
}
|
|
21834
21843
|
}
|
|
21835
21844
|
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
|
|
21845
|
+
if (clipboardSource === 'cut') {
|
|
21846
|
+
clipboardSource = 'copy'
|
|
21847
|
+
}
|
|
21836
21848
|
updateActiveNodes();
|
|
21837
21849
|
RED.nodes.dirty(true);
|
|
21838
21850
|
}
|
|
@@ -22387,7 +22399,7 @@ RED.view = (function() {
|
|
|
22387
22399
|
}
|
|
22388
22400
|
}
|
|
22389
22401
|
|
|
22390
|
-
function copySelection() {
|
|
22402
|
+
function copySelection(isCut) {
|
|
22391
22403
|
if (mouse_mode === RED.state.SELECTING_NODE) {
|
|
22392
22404
|
return;
|
|
22393
22405
|
}
|
|
@@ -22451,6 +22463,7 @@ RED.view = (function() {
|
|
|
22451
22463
|
}
|
|
22452
22464
|
}
|
|
22453
22465
|
clipboard = JSON.stringify(nns);
|
|
22466
|
+
clipboardSource = isCut ? 'cut' : 'copy'
|
|
22454
22467
|
RED.menu.setDisabled("menu-item-edit-paste", false);
|
|
22455
22468
|
if (nodeCount > 0) {
|
|
22456
22469
|
RED.notify(RED._("clipboard.nodeCopied",{count:nodeCount}),{id:"clipboard"});
|
|
@@ -22970,11 +22983,17 @@ RED.view = (function() {
|
|
|
22970
22983
|
|
|
22971
22984
|
if (active && ((portType === PORT_TYPE_INPUT && ((d._def && d._def.inputLabels)||d.inputLabels)) || (portType === PORT_TYPE_OUTPUT && ((d._def && d._def.outputLabels)||d.outputLabels)))) {
|
|
22972
22985
|
portLabelHoverTimeout = setTimeout(function() {
|
|
22986
|
+
const n = port && port.node()
|
|
22987
|
+
const nId = n && n.__data__ && n.__data__.id
|
|
22988
|
+
//check see if node has been deleted since timeout started
|
|
22989
|
+
if(!n || !n.parentNode || !RED.nodes.node(n.__data__.id)) {
|
|
22990
|
+
return; //node is gone!
|
|
22991
|
+
}
|
|
22973
22992
|
var tooltip = getPortLabel(d,portType,portIndex);
|
|
22974
22993
|
if (!tooltip) {
|
|
22975
22994
|
return;
|
|
22976
22995
|
}
|
|
22977
|
-
var pos = getElementPosition(
|
|
22996
|
+
var pos = getElementPosition(n);
|
|
22978
22997
|
portLabelHoverTimeout = null;
|
|
22979
22998
|
portLabelHover = showTooltip(
|
|
22980
22999
|
(pos[0]+(portType===PORT_TYPE_INPUT?-2:12)),
|
|
@@ -23161,6 +23180,9 @@ RED.view = (function() {
|
|
|
23161
23180
|
updateSelection();
|
|
23162
23181
|
RED.nodes.dirty(true);
|
|
23163
23182
|
redraw();
|
|
23183
|
+
if (clipboardSource === 'cut') {
|
|
23184
|
+
clipboardSource = 'copy'
|
|
23185
|
+
}
|
|
23164
23186
|
resetMouseVars();
|
|
23165
23187
|
d3.event.stopPropagation();
|
|
23166
23188
|
return;
|
|
@@ -23408,6 +23430,10 @@ RED.view = (function() {
|
|
|
23408
23430
|
if (d.hasOwnProperty('l')?!d.l : (d.type === "link in" || d.type === "link out")) {
|
|
23409
23431
|
var parentNode = this.parentNode;
|
|
23410
23432
|
portLabelHoverTimeout = setTimeout(function() {
|
|
23433
|
+
//check see if node has been deleted since timeout started
|
|
23434
|
+
if(!parentNode || !parentNode.parentNode || !RED.nodes.node(parentNode.id)) {
|
|
23435
|
+
return; //node is gone!
|
|
23436
|
+
}
|
|
23411
23437
|
var tooltip;
|
|
23412
23438
|
if (d._def.label) {
|
|
23413
23439
|
tooltip = d._def.label;
|
|
@@ -23770,7 +23796,7 @@ RED.view = (function() {
|
|
|
23770
23796
|
var mdn = mousedown_node;
|
|
23771
23797
|
var options = [];
|
|
23772
23798
|
options.push({name:"delete",disabled:(movingSet.length()===0 && selectedLinks.length() === 0),onselect:function() {deleteSelection();}});
|
|
23773
|
-
options.push({name:"cut",disabled:(movingSet.length()===0),onselect:function() {copySelection();deleteSelection();}});
|
|
23799
|
+
options.push({name:"cut",disabled:(movingSet.length()===0),onselect:function() {copySelection(true);deleteSelection();}});
|
|
23774
23800
|
options.push({name:"copy",disabled:(movingSet.length()===0),onselect:function() {copySelection();}});
|
|
23775
23801
|
options.push({name:"paste",disabled:(clipboard.length===0),onselect:function() {importNodes(clipboard, {generateIds: true, touchImport: true});}});
|
|
23776
23802
|
options.push({name:"edit",disabled:(movingSet.length() != 1),onselect:function() { RED.editor.edit(mdn);}});
|
|
@@ -24244,12 +24270,10 @@ RED.view = (function() {
|
|
|
24244
24270
|
icon_groupEl.setAttribute("y",0);
|
|
24245
24271
|
icon_groupEl.style["pointer-events"] = "none";
|
|
24246
24272
|
node[0][0].__iconGroup__ = icon_groupEl;
|
|
24247
|
-
var icon_shade = document.createElementNS("http://www.w3.org/2000/svg","
|
|
24273
|
+
var icon_shade = document.createElementNS("http://www.w3.org/2000/svg","path");
|
|
24248
24274
|
icon_shade.setAttribute("x",0);
|
|
24249
24275
|
icon_shade.setAttribute("y",0);
|
|
24250
24276
|
icon_shade.setAttribute("class","red-ui-flow-node-icon-shade")
|
|
24251
|
-
icon_shade.setAttribute("width",30);
|
|
24252
|
-
icon_shade.setAttribute("height",Math.min(50,d.h-4));
|
|
24253
24277
|
icon_groupEl.appendChild(icon_shade);
|
|
24254
24278
|
node[0][0].__iconShade__ = icon_shade;
|
|
24255
24279
|
|
|
@@ -24542,9 +24566,20 @@ RED.view = (function() {
|
|
|
24542
24566
|
}
|
|
24543
24567
|
|
|
24544
24568
|
icon.attr("y",function(){return (d.h-d3.select(this).attr("height"))/2;});
|
|
24545
|
-
|
|
24569
|
+
|
|
24570
|
+
|
|
24571
|
+
const iconShadeHeight = d.h
|
|
24572
|
+
const iconShadeWidth = 30
|
|
24573
|
+
this.__iconShade__.setAttribute("d", hideLabel ?
|
|
24574
|
+
`M5 0 h${iconShadeWidth-10} a 5 5 0 0 1 5 5 v${iconShadeHeight-10} a 5 5 0 0 1 -5 5 h-${iconShadeWidth-10} a 5 5 0 0 1 -5 -5 v-${iconShadeHeight-10} a 5 5 0 0 1 5 -5` : (
|
|
24575
|
+
"right" === d._def.align ?
|
|
24576
|
+
`M 0 0 h${iconShadeWidth-5} a 5 5 0 0 1 5 5 v${iconShadeHeight-10} a 5 5 0 0 1 -5 5 h-${iconShadeWidth-5} v-${iconShadeHeight}` :
|
|
24577
|
+
`M5 0 h${iconShadeWidth-5} v${iconShadeHeight} h-${iconShadeWidth-5} a 5 5 0 0 1 -5 -5 v-${iconShadeHeight-10} a 5 5 0 0 1 5 -5`
|
|
24578
|
+
)
|
|
24579
|
+
)
|
|
24580
|
+
this.__iconShadeBorder__.style.display = hideLabel?'none':''
|
|
24546
24581
|
this.__iconShadeBorder__.setAttribute("d",
|
|
24547
|
-
"M " + (((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) ? 0 :
|
|
24582
|
+
"M " + (((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) ? 0.5 : 29.5) + " "+(d.selected?1:0.5)+" l 0 " + (d.h - (d.selected?2:1))
|
|
24548
24583
|
);
|
|
24549
24584
|
faIcon.attr("y",(d.h+13)/2);
|
|
24550
24585
|
}
|
|
@@ -25920,7 +25955,13 @@ RED.view = (function() {
|
|
|
25920
25955
|
showQuickAddDialog:showQuickAddDialog,
|
|
25921
25956
|
calculateNodeDimensions: calculateNodeDimensions,
|
|
25922
25957
|
getElementPosition:getElementPosition,
|
|
25923
|
-
showTooltip:showTooltip
|
|
25958
|
+
showTooltip:showTooltip,
|
|
25959
|
+
dimensions: function() {
|
|
25960
|
+
return {
|
|
25961
|
+
width: space_width,
|
|
25962
|
+
height: space_height
|
|
25963
|
+
};
|
|
25964
|
+
}
|
|
25924
25965
|
};
|
|
25925
25966
|
})();
|
|
25926
25967
|
;RED.view.annotations = (function() {
|
|
@@ -26339,6 +26380,9 @@ RED.view.tools = (function() {
|
|
|
26339
26380
|
$(document).one('keyup',endKeyboardMove);
|
|
26340
26381
|
endMoveSet = true;
|
|
26341
26382
|
}
|
|
26383
|
+
var dim = RED.view.dimensions();
|
|
26384
|
+
var space_width = dim.width;
|
|
26385
|
+
var space_height = dim.height;
|
|
26342
26386
|
var minX = 0;
|
|
26343
26387
|
var minY = 0;
|
|
26344
26388
|
var node;
|
|
@@ -26354,6 +26398,12 @@ RED.view.tools = (function() {
|
|
|
26354
26398
|
node.n.dirty = true;
|
|
26355
26399
|
node.n.x += dx;
|
|
26356
26400
|
node.n.y += dy;
|
|
26401
|
+
if ((node.n.x +node.n.w/2) >= space_width) {
|
|
26402
|
+
node.n.x = space_width -node.n.w/2;
|
|
26403
|
+
}
|
|
26404
|
+
if ((node.n.y +node.n.h/2) >= space_height) {
|
|
26405
|
+
node.n.y = space_height -node.n.h/2;
|
|
26406
|
+
}
|
|
26357
26407
|
node.n.dirty = true;
|
|
26358
26408
|
if (node.n.type === "group") {
|
|
26359
26409
|
RED.group.markDirty(node.n);
|
|
@@ -27048,7 +27098,7 @@ RED.view.tools = (function() {
|
|
|
27048
27098
|
* @param {Object || Object[]} wires The wire(s) to split and replace with link-out, link-in nodes.
|
|
27049
27099
|
*/
|
|
27050
27100
|
function splitWiresWithLinkNodes(wires) {
|
|
27051
|
-
let wiresToSplit = wires || RED.view.selection().links;
|
|
27101
|
+
let wiresToSplit = wires || (RED.view.selection().links && RED.view.selection().links.filter(e => !e.link));
|
|
27052
27102
|
if (!wiresToSplit) {
|
|
27053
27103
|
return
|
|
27054
27104
|
}
|
|
@@ -27286,7 +27336,7 @@ RED.view.tools = (function() {
|
|
|
27286
27336
|
}
|
|
27287
27337
|
|
|
27288
27338
|
function addJunctionsToWires(wires) {
|
|
27289
|
-
let wiresToSplit = wires || RED.view.selection().links;
|
|
27339
|
+
let wiresToSplit = wires || (RED.view.selection().links && RED.view.selection().links.filter(e => !e.link));
|
|
27290
27340
|
if (!wiresToSplit) {
|
|
27291
27341
|
return
|
|
27292
27342
|
}
|
|
@@ -27314,6 +27364,7 @@ RED.view.tools = (function() {
|
|
|
27314
27364
|
linkGroups.sort(function(A,B) {
|
|
27315
27365
|
return groupedLinks[B].length - groupedLinks[A].length
|
|
27316
27366
|
})
|
|
27367
|
+
const wasDirty = RED.nodes.dirty()
|
|
27317
27368
|
linkGroups.forEach(function(gid) {
|
|
27318
27369
|
var links = groupedLinks[gid]
|
|
27319
27370
|
var junction = {
|
|
@@ -27404,12 +27455,14 @@ RED.view.tools = (function() {
|
|
|
27404
27455
|
})
|
|
27405
27456
|
if (addedJunctions.length > 0) {
|
|
27406
27457
|
RED.history.push({
|
|
27458
|
+
dirty: wasDirty,
|
|
27407
27459
|
t: 'add',
|
|
27408
27460
|
links: addedLinks,
|
|
27409
27461
|
junctions: addedJunctions,
|
|
27410
27462
|
removedLinks: Array.from(removedLinks)
|
|
27411
27463
|
})
|
|
27412
27464
|
RED.nodes.dirty(true)
|
|
27465
|
+
RED.view.select({nodes: addedJunctions });
|
|
27413
27466
|
}
|
|
27414
27467
|
RED.view.redraw(true);
|
|
27415
27468
|
}
|
|
@@ -43375,7 +43428,7 @@ RED.search = (function() {
|
|
|
43375
43428
|
};
|
|
43376
43429
|
|
|
43377
43430
|
})();
|
|
43378
|
-
;RED.contextMenu = (function() {
|
|
43431
|
+
;RED.contextMenu = (function () {
|
|
43379
43432
|
|
|
43380
43433
|
let menu;
|
|
43381
43434
|
function createMenu() {
|
|
@@ -43392,10 +43445,6 @@ RED.search = (function() {
|
|
|
43392
43445
|
// ],
|
|
43393
43446
|
// width: 200,
|
|
43394
43447
|
// })
|
|
43395
|
-
|
|
43396
|
-
|
|
43397
|
-
|
|
43398
|
-
|
|
43399
43448
|
}
|
|
43400
43449
|
|
|
43401
43450
|
function disposeMenu() {
|
|
@@ -43411,42 +43460,80 @@ RED.search = (function() {
|
|
|
43411
43460
|
}
|
|
43412
43461
|
|
|
43413
43462
|
const selection = RED.view.selection()
|
|
43463
|
+
const noSelection = !selection || Object.keys(selection).length === 0
|
|
43414
43464
|
const hasSelection = (selection.nodes && selection.nodes.length > 0);
|
|
43415
43465
|
const hasMultipleSelection = hasSelection && selection.nodes.length > 1;
|
|
43416
|
-
const
|
|
43417
|
-
const
|
|
43418
|
-
const
|
|
43466
|
+
const virtulLinks = (selection.links && selection.links.filter(e => !!e.link)) || [];
|
|
43467
|
+
const wireLinks = (selection.links && selection.links.filter(e => !e.link)) || [];
|
|
43468
|
+
const hasLinks = wireLinks.length > 0;
|
|
43469
|
+
const isSingleLink = !hasSelection && hasLinks && wireLinks.length === 1
|
|
43470
|
+
const isMultipleLinks = !hasSelection && hasLinks && wireLinks.length > 1
|
|
43419
43471
|
const canDelete = hasSelection || hasLinks
|
|
43420
43472
|
const isGroup = hasSelection && selection.nodes.length === 1 && selection.nodes[0].type === 'group'
|
|
43421
43473
|
|
|
43422
43474
|
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
|
43475
|
+
const offset = $("#red-ui-workspace-chart").offset()
|
|
43423
43476
|
|
|
43477
|
+
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
|
43478
|
+
let addY = options.y - offset.top + $("#red-ui-workspace-chart").scrollTop()
|
|
43479
|
+
|
|
43480
|
+
if (RED.view.snapGrid) {
|
|
43481
|
+
const gridSize = RED.view.gridSize()
|
|
43482
|
+
addX = gridSize * Math.floor(addX / gridSize)
|
|
43483
|
+
addY = gridSize * Math.floor(addY / gridSize)
|
|
43484
|
+
}
|
|
43424
43485
|
|
|
43425
43486
|
const menuItems = [
|
|
43426
|
-
{ onselect: 'core:show-action-list', onpostselect: function() {} },
|
|
43487
|
+
{ onselect: 'core:show-action-list', onpostselect: function () { } },
|
|
43427
43488
|
{
|
|
43428
43489
|
label: RED._("contextMenu.insert"),
|
|
43429
43490
|
options: [
|
|
43430
43491
|
{
|
|
43431
43492
|
label: RED._("contextMenu.node"),
|
|
43432
|
-
onselect: function() {
|
|
43493
|
+
onselect: function () {
|
|
43433
43494
|
RED.view.showQuickAddDialog({
|
|
43434
|
-
position: [
|
|
43495
|
+
position: [addX, addY],
|
|
43435
43496
|
touchTrigger: true,
|
|
43436
|
-
splice: isSingleLink?selection.links[0]:undefined,
|
|
43497
|
+
splice: isSingleLink ? selection.links[0] : undefined,
|
|
43437
43498
|
// spliceMultiple: isMultipleLinks
|
|
43438
43499
|
})
|
|
43439
43500
|
}
|
|
43440
43501
|
},
|
|
43441
|
-
{
|
|
43502
|
+
(hasLinks) ? { // has least 1 wire selected
|
|
43442
43503
|
label: RED._("contextMenu.junction"),
|
|
43443
43504
|
onselect: 'core:split-wires-with-junctions',
|
|
43444
|
-
disabled:
|
|
43505
|
+
disabled: !hasLinks
|
|
43506
|
+
} : {
|
|
43507
|
+
label: RED._("contextMenu.junction"),
|
|
43508
|
+
onselect: function () {
|
|
43509
|
+
const nn = {
|
|
43510
|
+
_def: { defaults: {} },
|
|
43511
|
+
type: 'junction',
|
|
43512
|
+
z: RED.workspaces.active(),
|
|
43513
|
+
id: RED.nodes.id(),
|
|
43514
|
+
x: addX,
|
|
43515
|
+
y: addY,
|
|
43516
|
+
w: 0, h: 0,
|
|
43517
|
+
outputs: 1,
|
|
43518
|
+
inputs: 1,
|
|
43519
|
+
dirty: true
|
|
43520
|
+
}
|
|
43521
|
+
const historyEvent = {
|
|
43522
|
+
dirty: RED.nodes.dirty(),
|
|
43523
|
+
t: 'add',
|
|
43524
|
+
junctions: [nn]
|
|
43525
|
+
}
|
|
43526
|
+
RED.nodes.addJunction(nn);
|
|
43527
|
+
RED.history.push(historyEvent);
|
|
43528
|
+
RED.nodes.dirty(true);
|
|
43529
|
+
RED.view.select({nodes: [nn] });
|
|
43530
|
+
RED.view.redraw(true)
|
|
43531
|
+
}
|
|
43445
43532
|
},
|
|
43446
43533
|
{
|
|
43447
43534
|
label: RED._("contextMenu.linkNodes"),
|
|
43448
43535
|
onselect: 'core:split-wire-with-link-nodes',
|
|
43449
|
-
disabled:
|
|
43536
|
+
disabled: !hasLinks
|
|
43450
43537
|
}
|
|
43451
43538
|
]
|
|
43452
43539
|
|
|
@@ -43454,28 +43541,13 @@ RED.search = (function() {
|
|
|
43454
43541
|
|
|
43455
43542
|
}
|
|
43456
43543
|
]
|
|
43457
|
-
|
|
43458
|
-
// {
|
|
43459
|
-
// label: (isSingleLink || isMultipleLinks)?'Insert into wire...':'Add node...',
|
|
43460
|
-
// onselect: function() {
|
|
43461
|
-
// RED.view.showQuickAddDialog({
|
|
43462
|
-
// position: [ options.x - offset.left, options.y - offset.top ],
|
|
43463
|
-
// touchTrigger: true,
|
|
43464
|
-
// splice: isSingleLink?selection.links[0]:undefined,
|
|
43465
|
-
// spliceMultiple: isMultipleLinks
|
|
43466
|
-
// })
|
|
43467
|
-
// }
|
|
43468
|
-
// },
|
|
43469
|
-
// )
|
|
43470
|
-
// if (hasLinks && !hasSelection) {
|
|
43471
|
-
// menuItems.push({ onselect: 'core:split-wires-with-junctions', label: 'Insert junction'})
|
|
43472
|
-
// }
|
|
43544
|
+
|
|
43473
43545
|
menuItems.push(
|
|
43474
43546
|
null,
|
|
43475
43547
|
{ onselect: 'core:undo', disabled: RED.history.list().length === 0 },
|
|
43476
43548
|
{ onselect: 'core:redo', disabled: RED.history.listRedo().length === 0 },
|
|
43477
43549
|
null,
|
|
43478
|
-
{ onselect: 'core:cut-selection-to-internal-clipboard', label: RED._("keyboard.cutNode"), disabled: !hasSelection},
|
|
43550
|
+
{ onselect: 'core:cut-selection-to-internal-clipboard', label: RED._("keyboard.cutNode"), disabled: !hasSelection },
|
|
43479
43551
|
{ onselect: 'core:copy-selection-to-internal-clipboard', label: RED._("keyboard.copyNode"), disabled: !hasSelection },
|
|
43480
43552
|
{ onselect: 'core:paste-from-internal-clipboard', label: RED._("keyboard.pasteNode"), disabled: !RED.view.clipboard() },
|
|
43481
43553
|
{ onselect: 'core:delete-selection', disabled: !canDelete },
|
|
@@ -43487,27 +43559,34 @@ RED.search = (function() {
|
|
|
43487
43559
|
menuItems.push(
|
|
43488
43560
|
null,
|
|
43489
43561
|
isGroup ?
|
|
43490
|
-
|
|
43491
|
-
|
|
43562
|
+
{ onselect: 'core:ungroup-selection', disabled: !isGroup }
|
|
43563
|
+
: { onselect: 'core:group-selection', disabled: !hasSelection }
|
|
43492
43564
|
)
|
|
43493
43565
|
if (canRemoveFromGroup) {
|
|
43494
43566
|
menuItems.push({ onselect: 'core:remove-selection-from-group', label: RED._("menu.label.groupRemoveSelection") })
|
|
43495
43567
|
}
|
|
43496
43568
|
|
|
43497
43569
|
}
|
|
43498
|
-
|
|
43570
|
+
|
|
43571
|
+
var direction = "right";
|
|
43572
|
+
var MENU_WIDTH = 500; // can not use menu width here
|
|
43573
|
+
if ((options.x -$(document).scrollLeft()) >
|
|
43574
|
+
($(window).width() -MENU_WIDTH)) {
|
|
43575
|
+
direction = "left";
|
|
43576
|
+
}
|
|
43577
|
+
|
|
43499
43578
|
menu = RED.menu.init({
|
|
43500
|
-
direction:
|
|
43579
|
+
direction: direction,
|
|
43501
43580
|
onpreselect: function() {
|
|
43502
43581
|
disposeMenu()
|
|
43503
43582
|
},
|
|
43504
|
-
onpostselect: function() {
|
|
43583
|
+
onpostselect: function () {
|
|
43505
43584
|
RED.view.focus()
|
|
43506
43585
|
},
|
|
43507
43586
|
options: menuItems
|
|
43508
43587
|
});
|
|
43509
43588
|
|
|
43510
|
-
menu.attr("id","red-ui-workspace-context-menu");
|
|
43589
|
+
menu.attr("id", "red-ui-workspace-context-menu");
|
|
43511
43590
|
menu.css({
|
|
43512
43591
|
position: "absolute"
|
|
43513
43592
|
})
|
|
@@ -43518,34 +43597,35 @@ RED.search = (function() {
|
|
|
43518
43597
|
var top = options.y
|
|
43519
43598
|
var left = options.x
|
|
43520
43599
|
|
|
43521
|
-
if (top+menu.height()
|
|
43522
|
-
top -= (top+menu.height())
|
|
43600
|
+
if (top + menu.height() - $(document).scrollTop() > $(window).height()) {
|
|
43601
|
+
top -= (top + menu.height()) - $(window).height() + 22;
|
|
43523
43602
|
}
|
|
43524
|
-
if (left+menu.width()
|
|
43525
|
-
left -= (left+menu.width())
|
|
43603
|
+
if (left + menu.width() - $(document).scrollLeft() > $(window).width()) {
|
|
43604
|
+
left -= (left + menu.width()) - $(window).width() + 18;
|
|
43526
43605
|
}
|
|
43527
43606
|
menu.css({
|
|
43528
|
-
top: top+"px",
|
|
43529
|
-
left: left+"px"
|
|
43607
|
+
top: top + "px",
|
|
43608
|
+
left: left + "px"
|
|
43530
43609
|
})
|
|
43531
43610
|
$(".red-ui-menu.red-ui-menu-dropdown").hide();
|
|
43532
|
-
$(document).on("mousedown.red-ui-workspace-context-menu", function(evt) {
|
|
43611
|
+
$(document).on("mousedown.red-ui-workspace-context-menu", function (evt) {
|
|
43533
43612
|
if (menu && menu[0].contains(evt.target)) {
|
|
43534
43613
|
return
|
|
43535
43614
|
}
|
|
43536
43615
|
disposeMenu()
|
|
43537
43616
|
});
|
|
43538
43617
|
menu.show();
|
|
43539
|
-
|
|
43540
|
-
|
|
43541
|
-
// target: $('#red-ui-main-container'),
|
|
43542
|
-
// x: options.x,
|
|
43543
|
-
// y: options.y
|
|
43544
|
-
// })
|
|
43545
|
-
|
|
43618
|
+
// set focus to first item so that pressing escape key closes the menu
|
|
43619
|
+
$("#red-ui-workspace-context-menu :first(ul) > a").trigger("focus")
|
|
43546
43620
|
|
|
43547
43621
|
}
|
|
43548
|
-
|
|
43622
|
+
// Allow escape key hook and other editor events to close context menu
|
|
43623
|
+
RED.keyboard.add("red-ui-workspace-context-menu", "escape", function () { RED.contextMenu.hide() })
|
|
43624
|
+
RED.events.on("editor:open", function () { RED.contextMenu.hide() });
|
|
43625
|
+
RED.events.on("search:open", function () { RED.contextMenu.hide() });
|
|
43626
|
+
RED.events.on("type-search:open", function () { RED.contextMenu.hide() });
|
|
43627
|
+
RED.events.on("actionList:open", function () { RED.contextMenu.hide() });
|
|
43628
|
+
RED.events.on("view:selection-changed", function () { RED.contextMenu.hide() });
|
|
43549
43629
|
return {
|
|
43550
43630
|
show: show,
|
|
43551
43631
|
hide: disposeMenu
|
|
@@ -45084,6 +45164,7 @@ RED.subflow = (function() {
|
|
|
45084
45164
|
RED.nodes.dirty(true);
|
|
45085
45165
|
RED.view.updateActive();
|
|
45086
45166
|
RED.view.select(null);
|
|
45167
|
+
RED.view.focus();
|
|
45087
45168
|
}
|
|
45088
45169
|
|
|
45089
45170
|
|
|
@@ -45138,6 +45219,7 @@ RED.subflow = (function() {
|
|
|
45138
45219
|
|
|
45139
45220
|
|
|
45140
45221
|
function buildEnvUIRow(row, tenv, ui, node) {
|
|
45222
|
+
console.log(tenv, ui)
|
|
45141
45223
|
ui.label = ui.label||{};
|
|
45142
45224
|
if ((tenv.type === "cred" || (tenv.parent && tenv.parent.type === "cred")) && !ui.type) {
|
|
45143
45225
|
ui.type = "cred";
|
|
@@ -45198,6 +45280,17 @@ RED.subflow = (function() {
|
|
|
45198
45280
|
default: inputType
|
|
45199
45281
|
})
|
|
45200
45282
|
input.typedInput('value',val.value)
|
|
45283
|
+
if (inputType === 'cred') {
|
|
45284
|
+
if (node.credentials) {
|
|
45285
|
+
if (node.credentials[tenv.name]) {
|
|
45286
|
+
input.typedInput('value', node.credentials[tenv.name]);
|
|
45287
|
+
} else if (node.credentials['has_'+tenv.name]) {
|
|
45288
|
+
input.typedInput('value', "__PWRD__")
|
|
45289
|
+
} else {
|
|
45290
|
+
input.typedInput('value', "");
|
|
45291
|
+
}
|
|
45292
|
+
}
|
|
45293
|
+
}
|
|
45201
45294
|
} else {
|
|
45202
45295
|
input.val(val.value)
|
|
45203
45296
|
}
|
|
@@ -45839,6 +45932,7 @@ RED.group = (function() {
|
|
|
45839
45932
|
RED.history.push(historyEvent);
|
|
45840
45933
|
RED.view.select({nodes:[group]});
|
|
45841
45934
|
RED.nodes.dirty(true);
|
|
45935
|
+
RED.view.focus();
|
|
45842
45936
|
}
|
|
45843
45937
|
}
|
|
45844
45938
|
}
|
|
@@ -45861,6 +45955,7 @@ RED.group = (function() {
|
|
|
45861
45955
|
RED.history.push(historyEvent);
|
|
45862
45956
|
RED.view.select({nodes:newSelection})
|
|
45863
45957
|
RED.nodes.dirty(true);
|
|
45958
|
+
RED.view.focus();
|
|
45864
45959
|
}
|
|
45865
45960
|
}
|
|
45866
45961
|
|
|
@@ -45955,6 +46050,7 @@ RED.group = (function() {
|
|
|
45955
46050
|
});
|
|
45956
46051
|
RED.history.push(historyEvent);
|
|
45957
46052
|
RED.nodes.dirty(true);
|
|
46053
|
+
RED.view.focus();
|
|
45958
46054
|
}
|
|
45959
46055
|
}
|
|
45960
46056
|
|
|
@@ -45982,6 +46078,7 @@ RED.group = (function() {
|
|
|
45982
46078
|
}
|
|
45983
46079
|
}
|
|
45984
46080
|
RED.view.select({nodes:selection.nodes})
|
|
46081
|
+
RED.view.focus();
|
|
45985
46082
|
}
|
|
45986
46083
|
}
|
|
45987
46084
|
function createGroup(nodes) {
|
|
@@ -53127,17 +53224,17 @@ RED.touch.radialMenu = (function() {
|
|
|
53127
53224
|
return [
|
|
53128
53225
|
{
|
|
53129
53226
|
id: "3_0",
|
|
53130
|
-
label: "3.0
|
|
53227
|
+
label: "3.0",
|
|
53131
53228
|
path: "./tours/welcome.js"
|
|
53132
53229
|
},
|
|
53133
53230
|
{
|
|
53134
53231
|
id: "2_2",
|
|
53135
|
-
label: "2.2
|
|
53232
|
+
label: "2.2",
|
|
53136
53233
|
path: "./tours/2.2/welcome.js"
|
|
53137
53234
|
},
|
|
53138
53235
|
{
|
|
53139
53236
|
id: "2_1",
|
|
53140
|
-
label: "2.1
|
|
53237
|
+
label: "2.1",
|
|
53141
53238
|
path: "./tours/2.1/welcome.js"
|
|
53142
53239
|
}
|
|
53143
53240
|
];
|