@bebranded/bb-contents 1.0.151 → 1.0.153

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.
Files changed (2) hide show
  1. package/bb-contents.js +55 -15
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -32,7 +32,7 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.151');
35
+ console.log('bb-contents | v1.0.153');
36
36
 
37
37
  // Configuration
38
38
  const config = {
@@ -320,11 +320,16 @@
320
320
  const isVertical = orientation === 'vertical';
321
321
  const useAutoHeight = isVertical && height === 'auto';
322
322
 
323
+ // Vérifier le overflow du parent pour respecter overflow: visible
324
+ const parentComputedStyle = getComputedStyle(element);
325
+ const parentOverflow = parentComputedStyle.overflow;
326
+ const shouldHideOverflow = parentOverflow !== 'visible' && parentOverflow !== '';
327
+
323
328
  mainContainer.style.cssText = `
324
329
  position: relative;
325
330
  width: 100%;
326
331
  height: ${isVertical ? (height === 'auto' ? 'auto' : height + 'px') : 'auto'};
327
- overflow: hidden;
332
+ ${shouldHideOverflow ? 'overflow: hidden;' : 'overflow: visible;'}
328
333
  min-height: auto;
329
334
  ${minHeight ? `min-height: ${minHeight};` : ''}
330
335
  `;
@@ -451,20 +456,48 @@
451
456
  }
452
457
 
453
458
  // Permettre le retour à la ligne pour les conteneurs de texte
459
+ // Ne pas toucher aux éléments qui doivent garder leur taille auto (comme .tag-m)
454
460
  const textContainers = item.querySelectorAll('.use-case_client, .testimonial_client-info, [class*="text"], p, span');
455
461
  textContainers.forEach(container => {
462
+ // Exclure les éléments qui doivent garder leur taille auto (tags, badges, etc.)
463
+ const containerStyle = container.getAttribute('style');
464
+ const shouldPreserveAuto = container.classList.contains('tag-m') ||
465
+ container.classList.contains('tag') ||
466
+ container.classList.contains('badge') ||
467
+ (containerStyle && containerStyle.includes('width'));
468
+
469
+ if (shouldPreserveAuto) {
470
+ // Ne pas toucher à ces éléments, ils gardent leur taille auto
471
+ return;
472
+ }
473
+
456
474
  const containerComputed = getComputedStyle(container);
457
- // Si l'élément a une largeur définie, la préserver
458
- if (containerComputed.width && containerComputed.width !== 'auto' && containerComputed.width !== '0px') {
459
- container.style.width = containerComputed.width;
460
- } else {
461
- // Sinon, prendre 100% de la largeur du parent
462
- container.style.width = '100%';
475
+ // Vérifier si l'élément a un style inline width défini
476
+ const hasInlineWidth = container.style.width && container.style.width !== '';
477
+
478
+ // Si l'élément a une largeur inline définie, la préserver
479
+ if (hasInlineWidth) {
480
+ // Garder la largeur inline
481
+ return;
482
+ }
483
+
484
+ // Si l'élément a une largeur calculée qui n'est pas auto, vérifier si c'est une valeur fixe
485
+ // Sinon, appliquer width: 100% seulement aux conteneurs de texte qui doivent wrapper
486
+ const isTextContainer = container.classList.contains('use-case_client') ||
487
+ container.classList.contains('testimonial_client-info') ||
488
+ container.tagName === 'P' && !container.classList.contains('tag');
489
+
490
+ if (isTextContainer) {
491
+ // Pour les conteneurs de texte principaux, permettre le wrapping
492
+ // Ne pas forcer width si déjà défini
493
+ if (!containerComputed.width || containerComputed.width === 'auto' || containerComputed.width === '0px') {
494
+ container.style.width = '100%';
495
+ }
496
+ // Forcer le retour à la ligne
497
+ container.style.whiteSpace = 'normal';
498
+ container.style.wordWrap = 'break-word';
499
+ container.style.overflowWrap = 'break-word';
463
500
  }
464
- // Forcer le retour à la ligne
465
- container.style.whiteSpace = 'normal';
466
- container.style.wordWrap = 'break-word';
467
- container.style.overflowWrap = 'break-word';
468
501
  });
469
502
  });
470
503
  }, 0);
@@ -633,8 +666,10 @@
633
666
  waitForImagesRender(repeatBlock2),
634
667
  forceFullRender() // NOUVEAU: Forcer le rendu complet
635
668
  ]).then(function() {
636
- // Retirer les copies du conteneur temporaire
637
- document.body.removeChild(tempContainer);
669
+ // Retirer les copies du conteneur temporaire (si toujours présent)
670
+ if (tempContainer && tempContainer.parentNode === document.body) {
671
+ document.body.removeChild(tempContainer);
672
+ }
638
673
 
639
674
  // Maintenant ajouter les copies au scrollContainer
640
675
  // Les images sont maintenant complètement rendues
@@ -694,7 +729,12 @@
694
729
  });
695
730
  }.bind(this));
696
731
  }.bind(this)).catch(function() {
697
- // En cas d'erreur, créer les copies quand même et démarrer
732
+ // En cas d'erreur, nettoyer le tempContainer s'il existe
733
+ if (tempContainer && tempContainer.parentNode === document.body) {
734
+ document.body.removeChild(tempContainer);
735
+ }
736
+
737
+ // Créer les copies quand même et démarrer
698
738
  const repeatBlock1 = mainBlock.cloneNode(true);
699
739
  const repeatBlock2 = mainBlock.cloneNode(true);
700
740
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.151",
3
+ "version": "1.0.153",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {