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
+10 -2
View File
@@ -166,6 +166,11 @@ type
/// Rang de la piece jointe dans l'entree, ou -1. Il ne se deduit pas du
/// rang de la ligne : les champs personnalises s'intercalent avant.
AttachIndex: Integer;
/// La valeur tient sur plusieurs lignes. Marque ICI, pas devine du libelle
/// ni du contenu : un <input> APPLIQUE la sanitisation de HTML et retire
/// les retours a la ligne en silence. Une note modifiee depuis le telephone
/// y perdait sa mise en forme, et la perte partait au depot.
Multiline: Boolean;
end;
function BuildRows(const E: TVaultEntry): TArray<TDetailRow>;
@@ -174,7 +179,8 @@ var
I: Integer;
procedure Add(const ACaption, AValue: string; ASecret: Boolean;
const AField: string = ''; AAttach: Integer = -1);
const AField: string = ''; AAttach: Integer = -1;
AMultiline: Boolean = False);
begin
// Une ligne vide n'apprend rien - SAUF si elle se remplit. Un identifiant
// absent qu'on ne peut pas ajouter serait une impasse.
@@ -185,6 +191,7 @@ var
LRows[High(LRows)].Secret := ASecret;
LRows[High(LRows)].Field := AField;
LRows[High(LRows)].AttachIndex := AAttach;
LRows[High(LRows)].Multiline := AMultiline;
end;
begin
@@ -195,7 +202,7 @@ begin
// Un site et un identifiant n'ont aucun sens pour une note. Les proposer
// vides reviendrait a inviter a remplir ce que rien n'affichera jamais.
if E.IsNote then
Add('Content', E.Password, False, 'password')
Add('Content', E.Password, False, 'password', -1, True)
else
begin
Add('Site', E.Site, False, 'site');
@@ -263,6 +270,7 @@ begin
// "enregistrable", et la page y met le bouton de telechargement.
if LRows[I].AttachIndex >= 0 then
LObj.AddPair('a', TJSONNumber.Create(LRows[I].AttachIndex));
if LRows[I].Multiline then LObj.AddPair('m', TJSONBool.Create(True));
LArr.AddElement(LObj);
end;
Result := LRoot.ToJSON;