-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathindex.ts
More file actions
38 lines (31 loc) · 1.11 KB
/
index.ts
File metadata and controls
38 lines (31 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// index.ts - Main entry point for the Monaco Editor diff view
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
import { initDiffEditor } from './js/monaco-diff-editor';
import { setupUI } from './js/ui-controller';
import DiffViewer from './js/api';
// Initialize everything when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
// Hide loading indicator as Monaco is directly imported
const loadingElement = document.getElementById('loading');
if (loadingElement) {
loadingElement.style.display = 'none';
}
// Set up UI elements and event handlers
setupUI();
// Make sure the editor follows the system theme
DiffViewer.followSystemTheme();
// Handle window resize events
window.addEventListener('resize', () => {
DiffViewer.handleResize();
});
});
// Define DiffViewer on the window object
declare global {
interface Window {
DiffViewer: typeof DiffViewer;
}
}
// Expose the MonacoDiffViewer API to the global scope
window.DiffViewer = DiffViewer;
// Export the MonacoDiffViewer for webpack
export default DiffViewer;