Gutenberg dynamic block wrappers for shortcodes with editor previews #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The plugin's four shortcodes —
[us_booking],[us_student_login],[us_student_register],[us_group_classes]— show up in the block editor as plain grey shortcode text. There is no way to preview them in the page editor, which makes it hard to style pages to match a theme/layout.Proposal
Wrap each shortcode in a dynamic block (
us-scheduler/booking,us-scheduler/student-login,us-scheduler/student-register,us-scheduler/group-classes):BlockRegistrarclass (alongsideShortcodeRegistrar) registers the blocks viaregister_block_type()withrender_callbacks that delegate to the existing page render methods — no duplicated rendering logic. Shortcodes stay for back-compat.wp.serverSideRender, so the editor shows real server-rendered markup, plustransforms.fromshortcode transforms so pasting a shortcode auto-converts to the block.frontend.cssis attached as the blocks' style handle so it loads inside the editor too and previews pick up theme styling.Acceptance criteria
BlockRegistrarand preview rendering; feature doc indocs/features/composer test,composer lint,composer csall pass