pull/4955/merge
Nick O'Leary 2025-04-14 10:33:45 -04:00 committed by GitHub
commit ceb7b26e51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 60 additions and 0 deletions

View File

@ -111,6 +111,7 @@
"userSettings": "User Settings",
"nodes": "Nodes",
"displayStatus": "Show node status",
"displayInfoIcon": "Show node information icon",
"displayConfig": "Configuration nodes",
"import": "Import",
"importExample": "Import example flow",

View File

@ -140,6 +140,7 @@ RED.userSettings = (function() {
title: "menu.label.nodes",
options: [
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"},
{setting:"view-node-info-icon", label:"menu.label.displayInfoIcon", default: true, toggle:true,onchange:"core:toggle-node-info-icon"},
{setting:"view-node-show-label",label:"menu.label.showNodeLabelDefault",default: true, toggle:true}
]
},

View File

@ -82,6 +82,7 @@ RED.view = (function() {
var slicePathLast = null;
var ghostNode = null;
var showStatus = false;
let showNodeInfo = true;
var lastClickNode = null;
var dblClickPrimed = null;
var clickTime = 0;
@ -860,11 +861,51 @@ RED.view = (function() {
toggleStatus(state);
}
});
RED.actions.add("core:toggle-node-info-icon", function (state) {
if (state === undefined) {
RED.userSettings.toggle("view-node-info-icon");
} else {
toggleNodeInfo(state)
}
})
RED.view.annotations.init();
RED.view.navigator.init();
RED.view.tools.init();
RED.view.annotations.register("red-ui-flow-node-docs",{
type: "badge",
class: "red-ui-flow-node-docs",
element: function(node) {
const docsBadge = document.createElementNS("http://www.w3.org/2000/svg","g")
const pageOutline = document.createElementNS("http://www.w3.org/2000/svg","rect");
pageOutline.setAttribute("x",0);
pageOutline.setAttribute("y",0);
pageOutline.setAttribute("rx",2);
pageOutline.setAttribute("width",7);
pageOutline.setAttribute("height",10);
docsBadge.appendChild(pageOutline)
const pageLines = document.createElementNS("http://www.w3.org/2000/svg","path");
pageLines.setAttribute("d", "M 7 3 h -3 v -3 M 2 8 h 3 M 2 6 h 3 M 2 4 h 2")
docsBadge.appendChild(pageLines)
$(docsBadge).on('click', function (evt) {
if (node.type === "subflow") {
RED.editor.editSubflow(activeSubflow, 'editor-tab-description');
} else if (node.type === "group") {
RED.editor.editGroup(node, 'editor-tab-description');
} else {
RED.editor.edit(node, 'editor-tab-description');
}
})
return docsBadge;
},
show: function(n) { return showNodeInfo && !!n.info }
})
RED.view.annotations.register("red-ui-flow-node-changed",{
type: "badge",
@ -6007,6 +6048,11 @@ RED.view = (function() {
//TODO: subscribe/unsubscribe here
redraw();
}
function toggleNodeInfo(s) {
showNodeInfo = s
RED.nodes.eachNode(function(n) { n.dirty = true;});
redraw();
}
function setSelectedNodeState(isDisabled) {
if (mouse_mode === RED.state.SELECTING_NODE) {
return;

View File

@ -244,6 +244,18 @@ svg:not(.red-ui-workspace-lasso-active) {
stroke-linecap: round;
}
.red-ui-flow-node-docs {
stroke-width: 1px;
stroke-linejoin: round;
stroke-linecap: round;
stroke: var(--red-ui-node-border);
fill: none;
cursor: pointer;
rect {
fill: white;
}
}
g.red-ui-flow-node-selected {
.red-ui-workspace-select-mode & {
opacity: 1;