Control Visibility & Editing Toggle for Plugin Studio #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR: Control Visibility & Editing Toggle for Plugin Studio
Summary
This PR introduces a control visibility context and hook that governs when editing controls are displayed in the Plugin Studio and page rendering environment. It also adds a new environment variable (
VITE_SHOW_EDITING_CONTROLS) to allow toggling of editing UI elements for development and debugging purposes. Additionally, layout and rendering logic has been updated to ensure consistent published vs. studio behavior.Problem / Context
What’s Changed
Configuration
.env.exampleVITE_SHOW_EDITING_CONTROLSto control visibility of editing UI in development.config/index.tsNew Contexts & Hooks
contexts/ControlVisibilityContext.tsx(new)showControls,isPluginStudio,renderMode,canEdit, andcontrolsEnabled.hooks/useControlVisibility.ts(new)Components Updated
DynamicPageRenderer.tsx/plugin-studioroutes use STUDIO mode only;/pagesalways use PUBLISHED mode.GridItemControls.tsx,UnifiedModuleControls.tsxuseShowControls; hide controls when not in studio mode.LayoutEngine.tsxuseControlVisibility.draggable,resizable) now tied toshowControlsrather thanRenderModealone.ModeController.tsxPluginStudioDevModeContext.tsxStyling
index.cssBenefits
VITE_SHOW_EDITING_CONTROLS.Risks & Mitigations
Mitigation: Defaults ensure controls are off in published mode, and only visible in dev + studio routes.
LayoutEnginemay have performance impact.Mitigation: MutationObserver cleanup + scoped visibility checks reduce overhead.
Testing & QA
Env toggle
VITE_SHOW_EDITING_CONTROLS=truein.env→ verify controls visible in studio.false→ verify hidden controls.Routes
/plugin-studio/...→ shows editing UI in dev mode./pages/...→ no editing controls, resize handles hidden.Published Mode CSS
.layout-engine--publishedelements: confirm no resize handles or cursors.Studio Features