From 1a9c95200c7afd5bd4b5dacc16978257afc8d477 Mon Sep 17 00:00:00 2001 From: Nicolas Langle Date: Mon, 29 Jul 2024 16:35:55 +0200 Subject: [PATCH] fix (theme): add missing alert, fix GutenbergBlockWrapper --- .../patterns/fr-alert-informations.php | 32 +++++++++++++++++++ .../src/js/classes/GutenbergBlockWrapper.js | 6 ++++ wp-dsfr-theme/src/js/editor.js | 1 + 3 files changed, 39 insertions(+) diff --git a/wp-dsfr-theme/patterns/fr-alert-informations.php b/wp-dsfr-theme/patterns/fr-alert-informations.php index 1e0708e..e4c4a06 100644 --- a/wp-dsfr-theme/patterns/fr-alert-informations.php +++ b/wp-dsfr-theme/patterns/fr-alert-informations.php @@ -16,6 +16,38 @@

+ +

+ + + +
+ +

+ + + +

+ +
+ + + +

fr-icon-lock-fill :

+ + + +
+ +

+ + + +

+ +
+ + { + // if the user start to edit class in text field, do nothing + if (currentClass && !attributes.className.split(' ').includes(currentClass)) { + currentClass = '' + return + } + let className = attributes.className.replace(currentClass, '').replace(/\s+/g, ' ').trim() if (value !== '') { diff --git a/wp-dsfr-theme/src/js/editor.js b/wp-dsfr-theme/src/js/editor.js index 140881d..3db12c1 100644 --- a/wp-dsfr-theme/src/js/editor.js +++ b/wp-dsfr-theme/src/js/editor.js @@ -140,6 +140,7 @@ blockGroupFrAlert.addSidebarPanelBody('dsfr-panel', { title: 'DSFR' }) blockGroupFrAlert.addSidebarClassSelector('dsfr-panel', { label: "Classe css du type d'alerte", options: [ + { value: '', label: 'Défaut' }, { value: 'fr-alert--info', label: 'Information' }, { value: 'fr-alert--success', label: 'Succès' }, { value: 'fr-alert--error', label: 'Erreur' },