mirror of https://github.com/node-red/node-red.git
Merge 1f8836cd5f into 12566270a6
commit
d216264898
|
|
@ -447,6 +447,7 @@
|
|||
}
|
||||
},
|
||||
"editor": {
|
||||
"button": "Button",
|
||||
"configEdit": "Edit",
|
||||
"configAdd": "Add",
|
||||
"configUpdate": "Update",
|
||||
|
|
@ -470,6 +471,8 @@
|
|||
"searchIcons": "Search icons",
|
||||
"useDefault": "use default",
|
||||
"description": "Description",
|
||||
"disabled": "Disabled",
|
||||
"enabled": "Enabled",
|
||||
"show": "Show",
|
||||
"hide": "Hide",
|
||||
"locale": "Select UI Language",
|
||||
|
|
|
|||
|
|
@ -1426,6 +1426,9 @@ RED.nodes = (function() {
|
|||
node.l = n.l;
|
||||
}
|
||||
}
|
||||
if (n._def.button && n.hasOwnProperty("b") && n.b) {
|
||||
node.b = true;
|
||||
}
|
||||
}
|
||||
if (n.info) {
|
||||
node.info = n.info;
|
||||
|
|
@ -2432,6 +2435,9 @@ RED.nodes = (function() {
|
|||
if (n.hasOwnProperty('g')) {
|
||||
node.g = n.g;
|
||||
}
|
||||
if (n.hasOwnProperty('b')) {
|
||||
node.b = n.b;
|
||||
}
|
||||
if (options.markChanged) {
|
||||
node.changed = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,20 @@
|
|||
node.l = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (node._def.button) {
|
||||
if ($("#node-input-enable-button").prop("checked")) {
|
||||
if (node.hasOwnProperty("b") && node.b) {
|
||||
editState.changes.b = node.b;
|
||||
editState.changed = true;
|
||||
delete node.b;
|
||||
}
|
||||
} else if (!node.b) {
|
||||
editState.changes.b = node.b;
|
||||
editState.changed = true;
|
||||
node.b = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -195,6 +209,21 @@
|
|||
.text(RED._("subflow.subflowInstances", {count:node.instances.length})).show();
|
||||
}
|
||||
|
||||
if (node._def.button) {
|
||||
$('<div class="form-row">'+
|
||||
'<label for="node-input-enable-button" data-i18n="editor.button"></label>'+
|
||||
'<span style="margin-right: 2px;"/>'+
|
||||
'<input type="checkbox" id="node-input-enable-button"/>'+
|
||||
'</div>').appendTo(dialogForm);
|
||||
|
||||
$("#node-input-enable-button").toggleButton({
|
||||
enabledLabel: RED._("editor.enabled"),
|
||||
disabledLabel: RED._("editor.disabled")
|
||||
});
|
||||
|
||||
$("#node-input-enable-button").prop("checked", !node.b).trigger("change");
|
||||
}
|
||||
|
||||
$('<div class="form-row">'+
|
||||
'<label for="node-input-show-label" data-i18n="editor.label"></label>'+
|
||||
'<span style="margin-right: 2px;"/>'+
|
||||
|
|
|
|||
|
|
@ -5079,7 +5079,7 @@ RED.view = (function() {
|
|||
function isButtonEnabled(d) {
|
||||
var buttonEnabled = true;
|
||||
var ws = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (ws && !ws.disabled && !d.d && !ws.locked) {
|
||||
if (ws && !ws.disabled && !d.d && !d.b && !ws.locked) {
|
||||
if (d._def.button.hasOwnProperty('enabled')) {
|
||||
if (typeof d._def.button.enabled === "function") {
|
||||
buttonEnabled = d._def.button.enabled.call(d);
|
||||
|
|
@ -5102,7 +5102,7 @@ RED.view = (function() {
|
|||
}
|
||||
var activeWorkspace = RED.workspaces.active();
|
||||
var ws = RED.nodes.workspace(activeWorkspace);
|
||||
if (ws && !ws.disabled && !d.d && !ws.locked) {
|
||||
if (ws && !ws.disabled && !d.d && !d.b && !ws.locked) {
|
||||
if (d._def.button.toggle) {
|
||||
d[d._def.button.toggle] = !d[d._def.button.toggle];
|
||||
d.dirty = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue