fix: resolve reset all function and image changing functionality issues
Fixed reset all function: - Fix section-reset event handler to call updateSectionContent instead of non-existent updateTextareaContent - Ensure proper DOM updates when sections are reset Fixed image changing functionality: - Improve image replacement flow with proper DOM updates - Add safety checks for section retrieval after content updates - Ensure updateSectionContent is called for immediate DOM reflection Added comprehensive test suite to verify image functionality works correctly. All functionality now working as expected. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1352,7 +1352,8 @@ class DOMRenderer {
|
||||
this.updateSectionContent(data.sectionId, data.content);
|
||||
});
|
||||
this.sectionManager.on('section-reset', (data) => {
|
||||
this.updateTextareaContent(data.content, data.sectionId);
|
||||
this.hideEditor(data.sectionId);
|
||||
this.updateSectionContent(data.sectionId, data.content);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1977,7 +1978,14 @@ class DOMRenderer {
|
||||
);
|
||||
this.sectionManager.updateContent(sectionId, newMarkdown);
|
||||
this.hideEditor(sectionId);
|
||||
setTimeout(() => this.showImageEditor(sectionId, this.sectionManager.sections.get(sectionId)), 100);
|
||||
this.updateSectionContent(sectionId, newMarkdown);
|
||||
// Wait for DOM update before showing image editor
|
||||
setTimeout(() => {
|
||||
const updatedSection = this.sectionManager.sections.get(sectionId);
|
||||
if (updatedSection) {
|
||||
this.showImageEditor(sectionId, updatedSection);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
Reference in New Issue
Block a user