Skip to content

Commit db662fe

Browse files
committed
resize textarea if alone
1 parent 813beae commit db662fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

web/assets/static/js/tibula.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (C) 2007-2024 by Ubaldo Porcheddu <[email protected]>
22

3+
34
function tableRowCheck(obj) {
45
input = obj.querySelector('input')
56
input.checked = !input.checked
@@ -60,7 +61,6 @@ function fieldDownload(o, name) {
6061
}
6162
}
6263

63-
6464
function fieldEditor(name) {
6565
var o = document.getElementsByName('ejaValues['+name+']')[0]
6666
if (! editors.hasOwnProperty(name)) {
@@ -91,6 +91,13 @@ toasts.forEach(function (toast) {
9191
}, 5000);
9292
});
9393

94+
var formElements = document.querySelectorAll('input, textarea, select');
95+
if (formElements.length <= 3 && formElements[0].tagName === 'TEXTAREA') {
96+
var screenHeight = window.innerHeight;
97+
var screenWidth = window.innerWidth;
98+
formElements[0].style.height = screenHeight / 2 + 'px';
99+
}
100+
94101
document.getElementById('ejaForm').addEventListener('submit', function(event) {
95102
for (var key in editors) {
96103
editors[key].save()

0 commit comments

Comments
 (0)