Skip to content

Feature/building sharer button block - #1

Merged
firestar300 merged 5 commits into
developfrom
feature/building-sharer-button-block
Jun 19, 2026
Merged

Feature/building sharer button block#1
firestar300 merged 5 commits into
developfrom
feature/building-sharer-button-block

Conversation

@firestar300

@firestar300 firestar300 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Pull Request — feature/building-sharer-button-blockdevelop

Summary

Implémentation complète du bloc Post Sharing Button : copie du lien de l’article et partage natif via l’API Web Share.

Bloc Gutenberg

  • Renommage du bloc en blockparty/post-sharing-button
  • Bloc dynamique (rendu PHP, suppression de save.js)
  • RichText pour personnaliser les libellés « Copier le lien » et « Partager »
  • TextControl pour le libellé affiché après copie (copiedLabel)
  • Icônes par défaut (link, share, check) via mask-image et variables CSS surchargeables par le thème
  • Bascule visuelle vers l’icône check + mise à jour du libellé et de la zone sr-only après copie

Réglages éditeur

  • Panneau Display : visibilité copier/partager par appareil (Desktop / Mobile) via displaySettings
  • Panneau Icon : affichage des icônes et position gauche/droite
  • Panneau Copy Button : libellé post-copie

PHP

  • Architecture alignée sur blockparty-icons : namespace Blockparty\PostSharing, autoload PSR-4
  • BlockRenderer : rendu dynamique avec URL/titre de la publication courante
  • ResponsiveDisplay : classes CSS responsive + breakpoint filtrable (blockparty_post_sharing_breakpoint, défaut 600px)

Front-end (view.js)

  • Copie presse-papiers avec fallback
  • Partage via navigator.share() (progressive enhancement)
  • Feedback copie : libellé bouton + aria-live

i18n & docs

  • Fichiers de traduction FR (languages/)
  • README.md
  • Blueprint WordPress Playground mis à jour

Qualité & tooling

  • phpcs.xml.dist : scan du dossier includes/
  • Mise à jour des dépendances Composer (wpcs ^3.3, phpcs ^3.13.4)
  • Scripts npm : make-pot, make-json, start:env / stop:env

Test plan

  • npm install && npm run build — build OK
  • composer install && composer cs — PHPCS OK
  • Insérer le bloc sur un article dans l’éditeur
  • Vérifier l’édition des libellés (RichText) et des réglages (Display, Icon, Copy Button)
  • Sur le front : copie du lien → libellé + icône check + annonce lecteur d’écran
  • Sur le front : bouton Partager (navigateur compatible) / masqué si API indisponible
  • Tester la visibilité responsive Desktop/Mobile et le filtre de breakpoint
  • Vérifier les traductions FR dans l’éditeur
  • Tester le blueprint sur WordPress Playground

3 commits · 26 fichiers · +1537 / -25870 lignes


Note

Low Risk
New editor block and front-end clipboard/share behavior with no auth or sensitive data paths; scope is limited to post permalink sharing UI.

Overview
This PR ships the Post Sharing Button Gutenberg block (blockparty/post-sharing-button) as a dynamic block: PHP renders copy/share actions with the current post URL and title, and the scaffold-style init is replaced by a namespaced bootstrap with Composer PSR-4 autoload for BlockRenderer and ResponsiveDisplay.

Server-side, BlockRenderer outputs labeled buttons, optional icon layout classes, and data-* attributes for the view script; ResponsiveDisplay adds per-viewport visibility classes and injects breakpoint CSS (filterable via blockparty_post_sharing_breakpoint). Front-end behavior in view.js handles clipboard copy (with fallback), Web Share when available, copied-state UI, and aria-live feedback.

Tooling & release: French translations and POT, a full README.md, Playground blueprint/demo post (replacing the prior modal demo), .gitignore for composer.lock, and bumped PHPCS/WPCS dev dependencies.

Reviewed by Cursor Bugbot for commit 37a0e7c. Bugbot is set up for automated code reviews on this repo. Configure here.

This commit transforms the initial block scaffold into a robust feature. It introduces server-side rendering for the post sharing block, allowing for dynamic content and improved performance.

Key changes include:
- Refactoring block rendering logic into dedicated PHP classes (`BlockRenderer`, `ResponsiveDisplay`).
- Adding comprehensive block attributes for customizing button labels, icon visibility, and icon positioning.
- Implementing responsive display settings, enabling conditional visibility of copy and share buttons based on viewport.
- Integrating front-end JavaScript for clipboard copy functionality and leveraging the native Web Share API for sharing post URLs.
- Enhancing development tooling with new Composer autoload rules, updated plugin metadata, and i18n scripts.
- Updating dependencies and removing the old `package-lock.json` to reflect the new structure.

This significantly enhances the block's functionality, customizability, and overall user experience.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bde7f1b. Configure here.

Comment thread blockparty-post-sharing.php
Comment thread src/blockparty-post-sharing/view.js
Comment thread src/blockparty-post-sharing/view.js
firestar300 and others added 2 commits June 19, 2026 15:43
Throw when execCommand('copy') fails so users do not see a false success state, and show feedback when canShare rejects the share payload.

Co-authored-by: Cursor <cursoragent@cursor.com>
@firestar300
firestar300 merged commit 4d25a1e into develop Jun 19, 2026
3 checks passed
@firestar300
firestar300 deleted the feature/building-sharer-button-block branch June 19, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant