fix(android): editing a note was about to strip its line breaks

Making every field editable put a note's body behind an <input>, and HTML's
value sanitization removes CR and LF without a word. The formatting would
have been lost on the phone and published to the repository at the next
save - silent, and irreversible once the desktop pulled it.

Multi-line is marked on the row in Delphi, like the field name, rather than
guessed from the caption or from whether the value happens to contain a
newline today: a single-line note one wants to make multi-line deserves the
same control.

The row wraps through a class set when the editor opens, not through :has() -
that selector does not exist before Chrome 105, and an older engine would
ignore the rule without saying so.
This commit is contained in:
r-zakarya
2026-08-22 11:33:10 +01:00
parent 0fa521b709
commit 8315ce9230
2 changed files with 27 additions and 2 deletions
+17
View File
@@ -85,6 +85,13 @@
dependre d'une mesure qui n'arrive jamais. Elle disparait au premier
champ quitte, donc rien ne flotte quand on ne tape pas. */
body.typing .scroll { padding-bottom: 60vh; }
/* Une zone de texte occupe plusieurs lignes : la rangee cesse d'etre une
rangee. Sans cela les boutons la compriment a la hauteur d'un champ.
UNE CLASSE POSEE A L'OUVERTURE, pas un selecteur :has() - celui-ci
n'existe pas avant Chrome 105, et un moteur plus ancien ignorerait la
regle sans rien dire. */
.line.wrap { flex-wrap: wrap; }
.line.wrap textarea { flex-basis: 100%; }
/* --- barre de recherche ------------------------------------------------ */
.top { padding: 10px 12px 6px; display: flex; gap: 8px; }
@@ -830,6 +837,15 @@ document.getElementById('fields').addEventListener('click', function (ev) {
function editorControl(k) {
var val = detailRows[k].v;
var style = ' style="margin:0;flex:1;min-width:0;width:auto"';
// UNE ZONE DE TEXTE POUR CE QUI TIENT SUR PLUSIEURS LIGNES. Un <input>
// applique la sanitisation de HTML et retire les retours a la ligne en
// silence : le corps d'une note y perdait sa mise en forme, et la perte
// partait au depot a l'enregistrement suivant.
if (detailRows[k].m)
return '<textarea class="field-in" id="editval" rows="6"'
+ ' autocorrect="off" spellcheck="false"'
+ ' style="margin:0;flex:1;min-width:0;width:auto;height:auto;'
+ 'padding:10px 14px;resize:vertical"></textarea>';
if (editField !== 'folder')
return '<input class="field-in" id="editval" autocomplete="off"'
+ ' type="' + (detailRows[k].s ? 'password' : 'text') + '"'
@@ -891,6 +907,7 @@ function openEditor(k) {
editField = detailRows[k].e || '';
if (!editField) return;
var line = row.parentNode;
line.classList.toggle('wrap', !!detailRows[k].m);
line.innerHTML = editorControl(k)
// Show n'a de sens que sur un champ masque. Sur un site en clair il
// n'aurait rien a reveler - et l'inverse : il le CACHERAIT.