fix: resolve Firefox display issue in md-render --edit mode
Fixed JavaScript execution order problem where MarkitectEditor class was being instantiated before it was defined, causing Firefox to fail rendering the HTML page. Changes: - Moved editor script definitions before DOMContentLoaded event handler - Ensured proper script execution sequence for cross-browser compatibility - Maintained existing functionality for regular (non-edit) mode rendering Fixes #154: Html generated by "md-render --edit" does not show in firefox 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -551,6 +551,9 @@ class DocumentManager:
|
||||
const markdownContent = {js_markdown_content};
|
||||
{editor_config}
|
||||
|
||||
// Define editor class and scripts first
|
||||
{editor_scripts}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {{
|
||||
const contentDiv = document.getElementById('markdown-content');
|
||||
if (contentDiv && typeof marked !== 'undefined') {{
|
||||
@@ -564,8 +567,6 @@ class DocumentManager:
|
||||
{'markitectEditor = new MarkitectEditor();' if edit_mode else ''}
|
||||
{'}}' if edit_mode else ''}
|
||||
}});
|
||||
|
||||
{editor_scripts}
|
||||
</script>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
Reference in New Issue
Block a user