fix: enable section click functionality for edit UI
- Fixed conflicting DOMContentLoaded handlers that were overwriting section content - Added modular component detection to prevent content rendering conflicts - Updated initialization to use markdown content directly instead of empty container - Verified complete functionality: sections clickable, floating menu appears, accept/cancel buttons work Root cause: Two competing event handlers were initializing content differently, causing sections to be overwritten by direct HTML rendering. Solution: Added component detection guard and proper content initialization. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1104,9 +1104,16 @@ class CleanDocumentManager:
|
||||
document.addEventListener('DOMContentLoaded', function() {{
|
||||
console.log("Rendering content...");
|
||||
|
||||
// Check if modular components are being used
|
||||
if (typeof SectionManager !== 'undefined') {{
|
||||
console.log("✓ Modular components detected - skipping direct content rendering");
|
||||
console.log("✓ Content will be rendered by modular architecture");
|
||||
return;
|
||||
}}
|
||||
|
||||
const contentDiv = document.getElementById('markdown-content');
|
||||
|
||||
// Step 1: Ensure content is always displayed
|
||||
// Step 1: Ensure content is always displayed (fallback for non-modular mode)
|
||||
if (contentDiv) {{
|
||||
if (typeof marked !== 'undefined') {{
|
||||
try {{
|
||||
@@ -1259,11 +1266,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
debugPanel.addMessage(`Changes cancelled for section: ${data.sectionId}`, 'WARNING');
|
||||
});
|
||||
|
||||
// Initialize with existing markdown content if present
|
||||
const existingContent = container.textContent || container.innerText || '';
|
||||
if (existingContent.trim()) {
|
||||
const sections = sectionManager.createSectionsFromMarkdown(existingContent);
|
||||
// Initialize with markdown content
|
||||
const markdownToRender = markdownContent || '';
|
||||
if (markdownToRender.trim()) {
|
||||
const sections = sectionManager.createSectionsFromMarkdown(markdownToRender);
|
||||
domRenderer.renderAllSections(sections);
|
||||
debugPanel.addMessage(`Initialized with ${sections.length} sections`, 'INFO');
|
||||
} else {
|
||||
debugPanel.addMessage('No markdown content to initialize', 'WARNING');
|
||||
}
|
||||
|
||||
// Make components globally available for debugging
|
||||
|
||||
Reference in New Issue
Block a user