mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 03:13:30 +00:00
Switch the CLIPTextEncode div to a textarea.
This commit is contained in:
parent
d826a0971c
commit
f30a2deb3f
@ -203,8 +203,8 @@ function onObjectInfo(json) {
|
|||||||
type: "customtext",
|
type: "customtext",
|
||||||
name: x,
|
name: x,
|
||||||
dynamic_prompt: dynamic_prompt,
|
dynamic_prompt: dynamic_prompt,
|
||||||
get value() { return this.input_div.innerText;},
|
get value() { return this.input_div.value;},
|
||||||
set value(x) { this.input_div.innerText = x;},
|
set value(x) { this.input_div.value = x;},
|
||||||
callback: function(v){console.log(v);},
|
callback: function(v){console.log(v);},
|
||||||
options: {},
|
options: {},
|
||||||
draw: function(ctx, node, widget_width, y, H){
|
draw: function(ctx, node, widget_width, y, H){
|
||||||
@ -235,13 +235,15 @@ function onObjectInfo(json) {
|
|||||||
ctx.restore();
|
ctx.restore();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
w.input_div = document.createElement('div');
|
w.input_div = document.createElement('textarea');
|
||||||
w.input_div.contentEditable = true;
|
w.input_div.contentEditable = true;
|
||||||
w.input_div.className = "customtext_input";
|
w.input_div.className = "customtext_input";
|
||||||
w.input_div.style.overflow = 'hidden';
|
w.input_div.style.overflow = 'hidden';
|
||||||
w.input_div.style.overflowY = 'auto';
|
w.input_div.style.overflowY = 'auto';
|
||||||
w.input_div.style.padding = 2;
|
w.input_div.style.padding = 2;
|
||||||
w.input_div.innerText = default_val;
|
w.input_div.style.resize = 'none';
|
||||||
|
w.input_div.style.border = 'none';
|
||||||
|
w.input_div.value = default_val;
|
||||||
document.addEventListener('click', function(event) {
|
document.addEventListener('click', function(event) {
|
||||||
if (!w.input_div.contains(event.target)) {
|
if (!w.input_div.contains(event.target)) {
|
||||||
w.input_div.blur();
|
w.input_div.blur();
|
||||||
@ -536,10 +538,10 @@ function graphToPrompt() {
|
|||||||
|
|
||||||
// store the unresolved prompt to restore it after sending the resolved prompt to the backend
|
// store the unresolved prompt to restore it after sending the resolved prompt to the backend
|
||||||
// use of .innerText which keep \n symbols in order to not break multilines support
|
// use of .innerText which keep \n symbols in order to not break multilines support
|
||||||
widget.value_initial = widget.input_div.innerText;
|
widget.value_initial = widget.input_div.value;
|
||||||
|
|
||||||
// resolve the string
|
// resolve the string
|
||||||
var prompt = widget.input_div.innerText;
|
var prompt = widget.input_div.value;
|
||||||
while (prompt.replace("\\{", "").includes('{') && prompt.replace("\\}", "").includes('}')) {
|
while (prompt.replace("\\{", "").includes('{') && prompt.replace("\\}", "").includes('}')) {
|
||||||
const startIndex = prompt.replace("\\{", "00").indexOf('{');
|
const startIndex = prompt.replace("\\{", "00").indexOf('{');
|
||||||
const endIndex = prompt.replace("\\}", "00").indexOf('}');
|
const endIndex = prompt.replace("\\}", "00").indexOf('}');
|
||||||
|
Loading…
Reference in New Issue
Block a user