mirror of
https://github.com/node-red/node-red.git
synced 2025-12-28 07:41:42 +01:00
Add a node annotation if there info property set
This commit is contained in:
@@ -865,6 +865,39 @@ RED.view = (function() {
|
||||
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 !!n.info }
|
||||
})
|
||||
|
||||
RED.view.annotations.register("red-ui-flow-node-changed",{
|
||||
type: "badge",
|
||||
|
||||
Reference in New Issue
Block a user