fix: Hide control panel from regular visitors
- Move control panel initialization from start() to startEditor() - Ensure UI only appears after successful gate activation - Regular visitors now see zero indication of insertr presence - Maintains 'invisible CMS' principle for end users User Experience: - Before gate: Website appears completely normal - After gate: Control panel slides in for authenticated editors - Gates remain the only trigger mechanism for editors
This commit is contained in:
@@ -78,21 +78,24 @@ window.Insertr = {
|
||||
document.head.appendChild(link);
|
||||
},
|
||||
|
||||
// Start the system - initializes auth gates and UI
|
||||
// Start the system - only creates invisible editor gates
|
||||
start() {
|
||||
if (this.auth) {
|
||||
this.auth.init(); // Sets up editor gates
|
||||
this.auth.init(); // Sets up invisible editor gates only
|
||||
}
|
||||
|
||||
if (this.controlPanel) {
|
||||
// Note: Control panel is NOT created here - only after gate activation
|
||||
// Note: Editor is NOT started here - only when authentication succeeds
|
||||
},
|
||||
|
||||
// Start the full editor system (called when gate is activated)
|
||||
startEditor() {
|
||||
// Initialize control panel UI (first time only)
|
||||
if (this.controlPanel && !this.controlPanel.isInitialized) {
|
||||
this.controlPanel.init(); // Creates unified control panel UI
|
||||
}
|
||||
|
||||
// Note: Editor is NOT started here, only when authentication succeeds
|
||||
},
|
||||
|
||||
// Start the full editor system (called when trigger is activated)
|
||||
startEditor() {
|
||||
// Start editor functionality
|
||||
if (this.editor && !this.editor.isActive) {
|
||||
this.editor.start();
|
||||
}
|
||||
@@ -139,7 +142,8 @@ function autoInitialize() {
|
||||
if (insertrScript) {
|
||||
config.siteId = insertrScript.getAttribute('data-site-id'); // No fallback - let ApiClient handle missing values
|
||||
config.apiEndpoint = insertrScript.getAttribute('data-api-endpoint') || '/api/content';
|
||||
config.mockAuth = insertrScript.getAttribute('data-mock-auth') === 'true';
|
||||
config.authProvider = insertrScript.getAttribute('data-auth-provider') || 'mock';
|
||||
config.mockAuth = config.authProvider === 'mock'; // Set mockAuth based on provider
|
||||
config.debug = insertrScript.getAttribute('data-debug') === 'true';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user