pagery-edition 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -240,11 +240,12 @@ export function TexteEditable({
|
|
|
240
240
|
const sauvegarder = useCallback(async () => {
|
|
241
241
|
if (!refElement.current) return;
|
|
242
242
|
const el = refElement.current;
|
|
243
|
-
// Extraire le texte brut (sans HTML)
|
|
244
|
-
const nouveauTexte = (el.textContent || "").replace(/\s+/g, " ").trim();
|
|
243
|
+
// Extraire le texte brut (sans HTML, normaliser espaces et retours a la ligne)
|
|
244
|
+
const nouveauTexte = (el.textContent || "").replace(/[\n\r]+/g, " ").replace(/\s+/g, " ").trim();
|
|
245
|
+
const texteOriginalNormalise = texteOriginal.current.replace(/\s+/g, " ").trim();
|
|
245
246
|
el.contentEditable = "false";
|
|
246
247
|
setEnEdition(false);
|
|
247
|
-
if (nouveauTexte !==
|
|
248
|
+
if (nouveauTexte !== texteOriginalNormalise) {
|
|
248
249
|
await modifierTexte(cle, nouveauTexte);
|
|
249
250
|
}
|
|
250
251
|
}, [cle, modifierTexte]);
|
|
@@ -301,9 +302,9 @@ export function TexteEditable({
|
|
|
301
302
|
}}
|
|
302
303
|
onKeyDown={gererTouche}
|
|
303
304
|
suppressContentEditableWarning
|
|
304
|
-
{...(
|
|
305
|
+
{...(doitRendreHtml ? { dangerouslySetInnerHTML: { __html: htmlRendu } } : {})}
|
|
305
306
|
>
|
|
306
|
-
{
|
|
307
|
+
{doitRendreHtml ? undefined : texte}
|
|
307
308
|
</Balise>
|
|
308
309
|
{enEdition && monte && (
|
|
309
310
|
<BarreOutils
|