feat(apk): notes de commandes, une commande copiee a la fois

Bloc Commands en tete d'une note "commands", groupe par groupe, avec un
bouton copier. ParseCommandNote est le portage du decoupage du poste
(groupes, lignes continuees). La copie passe par un rang, comme les autres
lignes du detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-10-10 19:39:38 +01:00
parent f112de508b
commit b1c0c1e11b
4 changed files with 118 additions and 0 deletions
+23
View File
@@ -279,6 +279,11 @@
.field .val.multi { white-space: pre-wrap; word-break: normal;
overflow-wrap: anywhere; }
.field.totp .val { font-size: 30px; font-weight: 300; letter-spacing: 2px; }
/* Note de commandes : une commande par ligne, sous le titre de son groupe. */
.field.cmds .cmd-group { font-size: 12px; font-weight: 600; opacity: .7;
text-transform: uppercase; margin: 10px 0 2px; }
.field.cmds .cmd-line { padding: 4px 0; }
.field.cmds .val.cmd { font-family: monospace; font-size: 14px; }
.bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.18);
margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text);
@@ -1089,6 +1094,23 @@ function renderDetail(d) {
+ '<button class="btn ico-btn" data-copy="totp">'
+ ico('copy', 'Copy code') + '</button></div>'
+ '<div class="bar"><i id="totpb"></i></div></div>';
// NOTE DE COMMANDES : une ligne par commande, groupees sous leur titre, avec
// un bouton copier. Le texte entier reste plus bas, dans "Content".
if (d.cmds && d.cmds.length) {
var lastG = null;
html += '<div class="field cmds"><div class="cap">Commands</div>';
for (i = 0; i < d.cmds.length; i++) {
var cm = d.cmds[i];
if (cm.g !== lastG) {
lastG = cm.g;
if (cm.g) html += '<div class="cmd-group">' + esc(cm.g) + '</div>';
}
html += '<div class="line cmd-line"><div class="val cmd">' + esc(cm.c) + '</div>'
+ '<button class="btn ico-btn" data-copy="cmd" data-k="' + i + '">'
+ ico('copy', 'Copy command') + '</button></div>';
}
html += '</div>';
}
for (i = 0; i < detailRows.length; i++) {
var r = detailRows[i];
html += '<div class="field"><div class="cap">' + esc(r.c) + '</div>'
@@ -1170,6 +1192,7 @@ document.getElementById('fields').addEventListener('click', function (ev) {
var copy = t.getAttribute('data-copy');
if (copy === 'totp') { send('copy?f=totp'); return; }
if (copy === 'row') { send('copy?f=row&k=' + t.getAttribute('data-k')); return; }
if (copy === 'cmd') { send('copy?f=cmd&k=' + t.getAttribute('data-k')); return; }
});