fix text area editing
This commit is contained in:
parent
49d47a89fe
commit
b99f165a92
2 changed files with 28 additions and 13 deletions
12
js/kiri.js
12
js/kiri.js
|
|
@ -1329,6 +1329,8 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
nval = parseInt(nval);
|
nval = parseInt(nval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (uie.type === 'textarea') {
|
||||||
|
nval = uie.value.trim().split('\n');
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1366,6 +1368,16 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
device.internal++;
|
device.internal++;
|
||||||
updateExtruderFields(device);
|
updateExtruderFields(device);
|
||||||
};
|
};
|
||||||
|
UI.extDel.disabled = device.extruders.length < 2;
|
||||||
|
UI.extDel.onclick = function() {
|
||||||
|
device.extruders.splice(device.internal,1);
|
||||||
|
updateExtruderFields(device);
|
||||||
|
};
|
||||||
|
UI.extAdd.onclick = function() {
|
||||||
|
device.extruders.push(clone(device.extruders[device.internal]));
|
||||||
|
device.internal = device.extruders.length - 1;
|
||||||
|
updateExtruderFields(device);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -328,25 +328,28 @@ var gs_moto_ui = exports;
|
||||||
|
|
||||||
btn.appendChild(DOC.createTextNode("edit"));
|
btn.appendChild(DOC.createTextNode("edit"));
|
||||||
btn.onclick = function(ev) {
|
btn.onclick = function(ev) {
|
||||||
btn.parentNode.appendChild(box);
|
|
||||||
btn.parentNode.onclick = btn.onclick;
|
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
txt.scrollTop = 0;
|
|
||||||
txt.scrollLeft = 0;
|
|
||||||
txt.selectionEnd = 0;
|
|
||||||
let rows = txt.value.split('\n');
|
|
||||||
let cols = 0;
|
|
||||||
rows.forEach(row => {
|
|
||||||
cols = Math.max(cols, row.length);
|
|
||||||
});
|
|
||||||
txt.setAttribute("cols", Math.max(30, cols + 1));
|
|
||||||
txt.setAttribute("rows", Math.max(10, rows.length + 1));
|
|
||||||
// drop clicks on TextArea
|
|
||||||
if (ev.target === txt) {
|
if (ev.target === txt) {
|
||||||
|
// drop clicks on TextArea
|
||||||
ev.target.focus();
|
ev.target.focus();
|
||||||
} else {
|
} else {
|
||||||
|
// first time, button click / show
|
||||||
|
btn.parentNode.appendChild(box);
|
||||||
|
btn.parentNode.onclick = btn.onclick;
|
||||||
|
txt.scrollTop = 0;
|
||||||
|
txt.scrollLeft = 0;
|
||||||
|
txt.selectionEnd = 0;
|
||||||
|
let rows = txt.value.split('\n');
|
||||||
|
let cols = 0;
|
||||||
|
rows.forEach(row => {
|
||||||
|
cols = Math.max(cols, row.length);
|
||||||
|
});
|
||||||
|
txt.setAttribute("cols", Math.max(30, cols + 1));
|
||||||
|
txt.setAttribute("rows", Math.max(10, rows.length + 1));
|
||||||
|
|
||||||
let showing = pop === lastPop;
|
let showing = pop === lastPop;
|
||||||
hidePop();
|
hidePop();
|
||||||
|
inputAction();
|
||||||
if (!showing) {
|
if (!showing) {
|
||||||
pop.style.display = "flex";
|
pop.style.display = "flex";
|
||||||
lastPop = pop;
|
lastPop = pop;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue