diff --git a/markitect/document_manager.py b/markitect/document_manager.py index 8886a381..f9929244 100644 --- a/markitect/document_manager.py +++ b/markitect/document_manager.py @@ -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} """