mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 21:57:05 +08:00
Added password widget and type
This commit is contained in:
parent
46daf0a9a7
commit
2e9f97797e
@ -9943,6 +9943,7 @@ LGraphNode.prototype.executeAction = function(action)
|
||||
break;
|
||||
case "string":
|
||||
case "text":
|
||||
case "password":
|
||||
ctx.textAlign = "left";
|
||||
ctx.strokeStyle = outline_color;
|
||||
ctx.fillStyle = background_color;
|
||||
@ -9968,7 +9969,11 @@ LGraphNode.prototype.executeAction = function(action)
|
||||
}
|
||||
ctx.fillStyle = text_color;
|
||||
ctx.textAlign = "right";
|
||||
ctx.fillText(String(w.value).substr(0,30), widget_width - margin * 2, y + H * 0.7); //30 chars max
|
||||
let value = w.value;
|
||||
if(w.type == "password") {
|
||||
value = value.replace(/./g, "*");
|
||||
}
|
||||
ctx.fillText(String(value).substr(0,30), widget_width - margin * 2, y + H * 0.7); //30 chars max
|
||||
ctx.restore();
|
||||
}
|
||||
break;
|
||||
@ -10156,6 +10161,7 @@ LGraphNode.prototype.executeAction = function(action)
|
||||
break;
|
||||
case "string":
|
||||
case "text":
|
||||
case "password":
|
||||
if (event.type == LiteGraph.pointerevents_method+"down") {
|
||||
this.prompt("Value",w.value,function(v) {
|
||||
inner_value_change(this, v);
|
||||
|
||||
@ -359,6 +359,22 @@ export const ComfyWidgets = {
|
||||
|
||||
return res;
|
||||
},
|
||||
PASSWORD(node, inputName, inputData, app) {
|
||||
const defaultVal = inputData[1].default || "";
|
||||
const multiline = !!inputData[1].multiline;
|
||||
|
||||
let res;
|
||||
if (multiline) {
|
||||
res = addMultilineWidget(node, inputName, { defaultVal, ...inputData[1] }, app);
|
||||
} else {
|
||||
res = { widget: node.addWidget("password", inputName, defaultVal, () => {}, {}) };
|
||||
}
|
||||
|
||||
if(inputData[1].dynamicPrompts != undefined)
|
||||
res.widget.dynamicPrompts = inputData[1].dynamicPrompts;
|
||||
|
||||
return res;
|
||||
},
|
||||
COMBO(node, inputName, inputData) {
|
||||
const type = inputData[0];
|
||||
let defaultValue = type[0];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user