fix(apk): la zone URL prend la hauteur de son texte

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-17 17:42:51 +01:00
parent 826b0809aa
commit 05ff08886d
+15 -2
View File
@@ -301,7 +301,7 @@
jamais - la fin d'une URL longue restait hors d'atteinte. */
-webkit-user-select: text; user-select: text;
}
.field-in.multi { height: auto; padding: 12px 44px 12px 14px; resize: none;
.field-in.multi { height: auto; min-height: 46px; overflow: hidden; padding: 12px 44px 12px 14px; resize: none;
line-height: 1.35; word-break: break-all; display: block; }
.field-in::placeholder { color: var(--muted); }
/* La fleche dit si le panneau est deplie, et de quel bouton il descend. */
@@ -572,7 +572,7 @@
<!-- ZONE DE TEXTE ET NON input : l'URL passe a la ligne et se lit en
entier. Un input d'une ligne ne defilait pas sous le doigt dans la
WebView de l'app, et la fin d'une URL d'API restait inatteignable. -->
<textarea class="field-in multi" id="sUrl" rows="3"
<textarea class="field-in multi" id="sUrl" rows="1"
placeholder="repository URL, e.g. https://git.example.com/owner/repo"
autocomplete="off" autocorrect="off" autocapitalize="none"
spellcheck="false" inputmode="url"></textarea>
@@ -778,6 +778,7 @@ document.getElementById('settings').addEventListener('click', function (ev) {
if (!id) return;
var el = document.getElementById(id);
el.value = '';
if (el.classList.contains('multi')) autoGrow(el);
el.focus();
});
@@ -1629,6 +1630,7 @@ function openSettings() {
document.getElementById('secCode').hidden = !vaultOpen;
showLog(false);
document.body.classList.add('on-settings');
autoGrow(document.getElementById('sUrl')); // mesurable seulement une fois affiche
send('state?view=settings');
}
@@ -1639,6 +1641,16 @@ function openSettings() {
// https://git.example.com/OWNER/REPO (ou .../src/branch/main/FICHIER) devient
// l'URL de l'API des contenus. Une URL d'API ou d'endpoint PHP passe telle quelle,
// et une forme non reconnue aussi - Sync dira alors ce qui ne va pas.
// LA ZONE DE L'URL PREND LA HAUTEUR DE SON TEXTE : une ligne pour une adresse
// courte, davantage si elle passe a la ligne.
function autoGrow(el) {
el.style.height = 'auto';
el.style.height = el.scrollHeight + 'px';
}
document.addEventListener('input', function (ev) {
if (ev.target.classList && ev.target.classList.contains('multi')) autoGrow(ev.target);
});
// L'inverse, pour l'affichage : l'URL d'API se relit comme l'adresse du depot.
function shortRepoUrl(u) {
var m = /^(https?:\/\/[^\/]+)\/api\/v1\/repos\/([^\/]+)\/([^\/]+)\/contents\/(.+)$/i.exec(u || '');
@@ -1657,6 +1669,7 @@ document.getElementById('sSave').addEventListener('click', function () {
var sUrl = document.getElementById('sUrl');
elUrl.value = normalizeRepoUrl(sUrl.value);
sUrl.value = shortRepoUrl(elUrl.value);
autoGrow(sUrl);
elTok.value = document.getElementById('sTok').value.trim();
elPwd.value = document.getElementById('sPwd').value;
pushConfig();