Skip to content

Commit 4828d04

Browse files
committed
fix(editor): v1.19.3 — fit-to-width on open + form-field names accept spaces
A) The continuous view started at zoom 1.0 (fitMode=null) → an A4 page sat small in a wide canvas ("la taille du formulaire est pas bonne, ça doit occuper tout l'espace"). Default fitMode to 'width' so the scroller computes fit-to-width from its live viewport on open; a manual zoom still clears fitMode upstream. B) The form-field name validator was /^[A-Za-z0-9_.-]+$/ which rejected spaces — but a partial AcroForm /T name is a PDF text string ("NAIS ENF 5", "Prénom", "Nom d'usage" are all valid). Broadened to /^[^\p{Cc}]+$/u (non-empty, no control chars); FR/EN error message updated to the empty-name case.
1 parent 409f577 commit 4828d04

7 files changed

Lines changed: 38 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to GigaPDF are documented here.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.19.3] - 2026-07-02
9+
10+
### Fixed — document fills the canvas on open; form-field names accept spaces
11+
12+
- **The page now fits the width of the editor as soon as a document opens**, instead
13+
of showing at 100 % (a small A4 sheet floating in a large empty canvas). The
14+
continuous view computes the exact fit-to-width zoom from its live width; a manual
15+
zoom still takes over from there.
16+
- **A form field can be named with spaces (and accents).** The name validator wrongly
17+
rejected `NAIS ENF 5`, `Prénom`, `Nom d'usage`… — a PDF field name is a text
18+
string, so spaces and punctuation are valid. Only a truly empty name is refused now.
19+
820
## [1.19.2] - 2026-07-02
921

1022
### Fixed — no more vanishing footer lines or misplaced headers on dense forms

apps/web/messages/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@
22302230
"formField": {
22312231
"fieldType": "Field type",
22322232
"name": "Field name",
2233-
"nameInvalid": "Allowed characters: letters, digits, _ . -",
2233+
"nameInvalid": "The field name cannot be empty.",
22342234
"nameDuplicate": "This name is already used by another field.",
22352235
"tooltip": "Label / tooltip",
22362236
"placeholder": "Placeholder text",

apps/web/messages/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@
22302230
"formField": {
22312231
"fieldType": "Type de champ",
22322232
"name": "Nom du champ",
2233-
"nameInvalid": "Caractères autorisés : lettres, chiffres, _ . -",
2233+
"nameInvalid": "Le nom du champ ne peut pas être vide.",
22342234
"nameDuplicate": "Ce nom est déjà utilisé par un autre champ.",
22352235
"tooltip": "Libellé / infobulle",
22362236
"placeholder": "Texte indicatif",

apps/web/src/app/(site)/[locale]/(legal)/changelog/changelog-content.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ interface ChangelogEntry {
1414
}
1515

1616
const changelog: ChangelogEntry[] = [
17+
{
18+
version: "1.19.3",
19+
date: "2026-07-02",
20+
type: "patch",
21+
changes: [
22+
{ type: "fix", description: "Editor: the document now fits the width of the canvas as soon as it opens, instead of showing small at 100% in a large empty area. A manual zoom still takes over from there." },
23+
{ type: "fix", description: "Form fields: a field name can now contain spaces and accents (\"NAIS ENF 5\", \"Prénom\", \"Nom d'usage\"). The old validator wrongly rejected spaces — a PDF field name is a text string, so only a truly empty name is refused now." },
24+
],
25+
},
1726
{
1827
version: "1.19.2",
1928
date: "2026-07-02",

apps/web/src/components/editor/properties-panel.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,14 @@ function hexToRgb01(hex: string | null | undefined): [number, number, number] |
135135
return [((n >> 16) & 0xff) / 255, ((n >> 8) & 0xff) / 255, (n & 0xff) / 255];
136136
}
137137

138-
/** Charset AcroForm sûr pour un nom de champ (lettres, chiffres, _ . -). */
139-
const FIELD_NAME_PATTERN = /^[A-Za-z0-9_.\-]+$/;
138+
/**
139+
* Un nom (partiel) de champ AcroForm `/T` est une PDF *text string* : espaces,
140+
* accents et ponctuation sont parfaitement valides (les vrais formulaires
141+
* administratifs les utilisent : « NAIS ENF 5 », « Prénom », « Nom d'usage »).
142+
* La seule contrainte réelle est un nom NON vide sans caractères de contrôle —
143+
* l'ancien `^[A-Za-z0-9_.-]+$` rejetait à tort l'espace (« erreur bidon »).
144+
*/
145+
const FIELD_NAME_PATTERN = /^[^\p{Cc}]+$/u;
140146

141147
/**
142148
* Petit set de polices SYSTÈME proposé en repli sous les polices du document.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "giga-pdf",
3-
"version": "1.19.2",
3+
"version": "1.19.3",
44
"private": true,
55
"packageManager": "pnpm@10.28.0",
66
"description": "Giga-PDF - WYSIWYG PDF Editing Platform",

packages/editor/src/stores/canvas-store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ const initialState: CanvasState = {
7272
zoom: 1.0,
7373
minZoom: 0.1,
7474
maxZoom: 8.0,
75-
fitMode: null,
75+
// Fit the page to the viewport WIDTH on load so the document fills the canvas
76+
// area (a bare `zoom: 1.0` leaves an A4 page smaller than a wide viewport —
77+
// "la taille du formulaire est pas bonne, ça doit occuper tout l'espace"). The
78+
// continuous scroller computes the exact zoom from its live width; a manual
79+
// zoom clears fitMode upstream, so this only governs the initial view.
80+
fitMode: "width",
7681
panOffset: { x: 0, y: 0 },
7782
activeTool: "select",
7883
activeSubtype: null,

0 commit comments

Comments
 (0)