mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #1856 from kazuhitoyokoi/master-nodedescriptionproperty
Add node description property UI
This commit is contained in:
commit
0529eed0c9
@ -509,6 +509,9 @@ RED.nodes = (function() {
|
||||
node.icon = n.icon;
|
||||
}
|
||||
}
|
||||
if (n.info) {
|
||||
node.info = n.info;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -947,6 +950,7 @@ RED.nodes = (function() {
|
||||
inputLabels: n.inputLabels,
|
||||
outputLabels: n.outputLabels,
|
||||
icon: n.icon,
|
||||
info: n.info,
|
||||
changed:false,
|
||||
_config:{}
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ RED.editor = (function() {
|
||||
var editing_node = null;
|
||||
var editing_config_node = null;
|
||||
var subflowEditor;
|
||||
var nodeInfoEditor;
|
||||
|
||||
var editTrayWidthCache = {};
|
||||
|
||||
@ -839,6 +840,20 @@ RED.editor = (function() {
|
||||
})
|
||||
$('<div class="uneditable-input" id="node-settings-icon">').text(node.icon).appendTo(iconRow);
|
||||
}
|
||||
|
||||
if (node.type.indexOf("subflow") != 0 && node.type !== "comment") {
|
||||
$('<hr>').appendTo(dialogForm);
|
||||
$('<div class="form-row"><span data-i18n="editor.description"></span><div id="node-label-form-info"></div></div>').appendTo(dialogForm);
|
||||
$('<div style="height: 150px;" class="node-text-editor" id="node-info-input-info-editor" ></div>').appendTo(dialogForm);
|
||||
nodeInfoEditor = RED.editor.createEditor({
|
||||
id: 'node-info-input-info-editor',
|
||||
mode: 'ace/mode/markdown',
|
||||
value: ""
|
||||
});
|
||||
if (node.info) {
|
||||
nodeInfoEditor.getSession().setValue(node.info, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateLabels(editing_node, changes, outputMap) {
|
||||
@ -1126,6 +1141,10 @@ RED.editor = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (node.type.indexOf("subflow") != 0 && node.type !== "comment") {
|
||||
node.info = nodeInfoEditor.getValue();
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
var wasChanged = editing_node.changed;
|
||||
editing_node.changed = true;
|
||||
@ -1240,6 +1259,9 @@ RED.editor = (function() {
|
||||
RED.sidebar.info.refresh(editing_node);
|
||||
}
|
||||
RED.workspaces.refresh();
|
||||
if (node.type.indexOf("subflow") != 0 && node.type !== "comment") {
|
||||
nodeInfoEditor.destroy();
|
||||
}
|
||||
RED.view.redraw(true);
|
||||
editStack.pop();
|
||||
},
|
||||
|
@ -277,6 +277,10 @@ RED.sidebar.info = (function() {
|
||||
// TODO: help
|
||||
infoText = infoText + marked(textInfo);
|
||||
}
|
||||
if (node.info) {
|
||||
infoSection.title.text(RED._("sidebar.info.nodeHelp"));
|
||||
infoText = marked(node.info || "") || ('<span class="node-info-none">' + RED._("sidebar.info.none") + '</span>');
|
||||
}
|
||||
if (infoText) {
|
||||
setInfoText(infoText);
|
||||
}
|
||||
|
@ -267,6 +267,7 @@
|
||||
"defaultLabel": "use default label",
|
||||
"searchIcons": "Search icons",
|
||||
"useDefault": "use default",
|
||||
"description": "Description",
|
||||
"errors": {
|
||||
"scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it"
|
||||
}
|
||||
|
@ -266,6 +266,7 @@
|
||||
"defaultLabel": "既定の名前を使用",
|
||||
"searchIcons": "アイコンを検索",
|
||||
"useDefault": "デフォルトを使用",
|
||||
"description": "詳細",
|
||||
"errors": {
|
||||
"scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user