1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 16:44:17 +02:00

Fix the width of inline edit field

This commit is contained in:
Peter Knut
2024-10-03 23:31:27 +02:00
committed by Jakub Vrana
parent 7eccd59856
commit edef2b1a3d
2 changed files with 8 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ tbody tr:hover td, tbody tr:hover th { background: #eee; }
pre { margin: 1em 0 0; }
pre, textarea { font: 100%/1.25 monospace; }
pre.jush { background: #fff; }
input, textarea { box-sizing: border-box; }
input, select { vertical-align: middle; }
input.default { box-shadow: 1px 1px 1px #777; }
input.required { box-shadow: 1px 1px 1px red; }

View File

@@ -708,9 +708,13 @@ function selectClick(event, text, warning) {
td.innerHTML = original;
}
};
var pos = event.rangeOffset;
var value = (td.firstChild && td.firstChild.alt) || td.textContent || td.innerText;
input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border)
let pos = event.rangeOffset;
let value = (td.firstChild && td.firstChild.alt) || td.textContent || td.innerText;
const tdStyle = window.getComputedStyle(td, null);
input.style.width = Math.max(td.clientWidth - parseFloat(tdStyle.paddingLeft) - parseFloat(tdStyle.paddingRight), 20) + 'px';
if (text) {
var rows = 1;
value.replace(/\n/g, function () {