From f76cddcc953908e2447511803c5dcfc494dc22b4 Mon Sep 17 00:00:00 2001 From: Shinuwa Date: Fri, 14 Aug 2026 08:49:26 +0200 Subject: [PATCH] Add notepad text import export --- docs/STORAGE_SCHEMA.md | 1 + tests/helpers/data-validation.mjs | 11 +++ tests/static-toolboxes.test.mjs | 4 +- tests/toolbox-modules.test.mjs | 20 ++++ website/public/data/site.json | 39 +++++--- .../toolboxes/modules/NotepadModule.jsx | 10 +- .../src/features/toolboxes/modules/index.jsx | 2 +- .../features/toolboxes/modules/textImport.js | 97 ++++++++++++++++++- 8 files changed, 165 insertions(+), 19 deletions(-) diff --git a/docs/STORAGE_SCHEMA.md b/docs/STORAGE_SCHEMA.md index af63776..122fa3e 100644 --- a/docs/STORAGE_SCHEMA.md +++ b/docs/STORAGE_SCHEMA.md @@ -708,6 +708,7 @@ Règles communes : Formats : +- `notepad` : format structuré `@notepad`, bloc `@html` / `@endhtml` pour le HTML riche nettoyé, meta `@drawingMode: permanent` et `@drawings: {...}` pour les dessins permanents. Un collage texte simple reste accepté et devient une note sans mise en forme. - `checklist` : sections `# Catégorie`, lignes `Item: quantité cible`. - `links` : lignes `Titre: https://...` ou URL seule. - `counters` : lignes `Libellé: valeur`, valeurs négatives acceptées. diff --git a/tests/helpers/data-validation.mjs b/tests/helpers/data-validation.mjs index 3ef7ba1..bdf0db2 100644 --- a/tests/helpers/data-validation.mjs +++ b/tests/helpers/data-validation.mjs @@ -156,6 +156,17 @@ export function validateSiteContent(site) { "toolboxes.modules.notepad.permanentStatus", "toolboxes.modules.notepad.updatedAtPrefix", "toolboxes.modules.notepad.sessionStorageError", + "toolboxes.modules.notepad.importPlaceholder", + "toolboxes.modules.notepad.importOpenButton", + "toolboxes.modules.notepad.exportOpenButton", + "toolboxes.modules.notepad.importModalTitle", + "toolboxes.modules.notepad.exportModalTitle", + "toolboxes.modules.notepad.importButton", + "toolboxes.modules.notepad.exportButton", + "toolboxes.modules.notepad.importSuccess", + "toolboxes.modules.notepad.exportSuccess", + "toolboxes.modules.notepad.importError", + "toolboxes.modules.notepad.exportInfo", "toolboxes.modules.checklist.itemPlaceholder", "toolboxes.modules.checklist.sectionPlaceholder", "toolboxes.modules.checklist.quantityLabel", diff --git a/tests/static-toolboxes.test.mjs b/tests/static-toolboxes.test.mjs index 9ea6059..8db82a6 100644 --- a/tests/static-toolboxes.test.mjs +++ b/tests/static-toolboxes.test.mjs @@ -142,7 +142,7 @@ test("toolbox module registry and modules expose expected behavior", async () => assert.match(moduleRegistry, /Planificateur d'équipements/); assert.match(moduleRegistry, /imageAnnotation:/); assert.match(moduleRegistry, /Annotation d'images/); - assert.match(moduleRegistry, /editable: false/); + assert.match(moduleRegistry, /notepad: \{ label: "Bloc notes", icon: "notepad", Component: NotepadModule, editable: true \}/); assert.match(moduleRegistry, /module-edit-button/); assert.match(moduleRegistry, /itemReorder\.startDrag/); assert.match(moduleRegistry, /onPointerDown/); @@ -159,6 +159,8 @@ test("toolbox module registry and modules expose expected behavior", async () => assert.match(moduleRegistry, /CompactDropdown/); assert.doesNotMatch(source, /