fix issue with textarea

This commit is contained in:
anapnoe 2023-02-06 04:29:35 +02:00
parent bd431065b4
commit 249928a6c4
2 changed files with 46 additions and 10 deletions
javascript
style.css

View File

@ -293,18 +293,24 @@ onUiUpdate(function(){
})
/* resizable textarea */
gradioApp().querySelectorAll('[id $= "_prompt"] textarea').forEach(function(elem){
elem.classList.add("input-text");
elem.classList.remove("gr-text-input", "gr-box");
})
gradioApp().querySelectorAll('[id $= "_prompt"] textarea').forEach(function (elem) {
elem.style.boxSizing = 'border-box';
var offset = elem.offsetHeight - elem.clientHeight;
elem.addEventListener('input', function (e) {
e.target.style.minHeight = 'auto';
e.target.style.minHeight = e.target.scrollHeight + offset + 'px';
});
});
/* split view resize */
gradioApp().querySelectorAll('#txt2img_splitter, #img2img_splitter').forEach((elem) => {
elem.addEventListener("mousedown", function(e) {
e.preventDefault();
let resizer = e.currentTarget;
let leftSide = resizer.previousElementSibling;
let rightSide = resizer.nextElementSibling;

View File

@ -1822,10 +1822,17 @@ input:focus {
border-radius: 0 !important;
}
#img2img_neg_prompt label, #img2img_prompt label, #txt2img_neg_prompt label, #txt2img_prompt label {
#img2img_neg_prompt label,
#img2img_prompt label,
#txt2img_neg_prompt label,
#txt2img_prompt label {
border: 0;
}
#img2img_neg_prompt span, #img2img_prompt span, #txt2img_neg_prompt span, #txt2img_prompt span {
#img2img_neg_prompt span,
#img2img_prompt span,
#txt2img_neg_prompt span,
#txt2img_prompt span {
border-bottom: 0 !important;
}
@ -1835,12 +1842,35 @@ input:focus {
#txt2img_neg_prompt textarea
{
min-height: 37px;
overflow: hidden !important;
/*overflow: hidden !important; */
}
#txt2img_results::after{
/*
#txt2img_prompt label {
display: grid;
}
#txt2img_prompt label::after {
content: attr(data-replicated-value) " ";
white-space: pre-wrap;
visibility: hidden;
}
#txt2img_prompt label > textarea {
resize: none;
overflow: hidden;
}
#txt2img_prompt label > textarea,
#txt2img_prompt label::after {
border: 1px solid black;
padding: 0.5rem;
font: inherit;
grid-area: 1 / 1 / 2 / 2;
}
*/
pre {
white-space: pre-wrap; /* css-3 */