Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Jan 23, 2026

This pull request refactors the MageForge inspector integration to use HTML comment markers with embedded JSON metadata for block identification, replacing the previous approach of injecting data-mageforge-* attributes directly into the DOM. The JavaScript inspector logic is updated to parse these comment markers, enabling more robust and layout-agnostic detection of block regions and their metadata. The changes improve reliability, performance, and maintainability of the inspector tooling.

Inspector Markup Refactor:

  • Switched from injecting data-mageforge-* attributes on elements to wrapping block HTML with MageForge comment markers containing JSON metadata in InspectorHints.php. [1] [2]

Inspector JavaScript Updates:

  • Added logic in inspector.js to parse MageForge comment markers, extract block metadata, and cache block regions for efficient lookup. [1] [2]
  • Refactored block detection so inspector features (highlight, badge, panel) now use the parsed JSON metadata instead of reading attributes, and improved parent block inheritance logic for structure tab rendering. [1] [2] [3] [4]

Inspector Interaction Improvements:

  • Fixed badge unpinning logic to ensure click handlers are properly managed and picker is reactivated as needed.

These changes collectively modernize the inspector's integration, making it more robust and future-proof.

@dermatz dermatz merged commit a2f9ebf into main Jan 23, 2026
12 checks passed
@dermatz dermatz deleted the feat-inspector-manipulation branch January 23, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants