forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
51 lines (45 loc) · 1.64 KB
/
api.js
File metadata and controls
51 lines (45 loc) · 1.64 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
39
40
41
42
43
44
45
46
47
48
49
50
51
// api.js - Public API for external use
import { initDiffEditor, updateDiffContent } from './monaco-diff-editor.js';
import { updateFileMetadata } from './ui-controller.js';
/**
* The public API that will be exposed to the global scope
*/
const DiffViewer = {
/**
* Initialize the diff editor with content
* @param {string} originalContent - Content for the original side
* @param {string} modifiedContent - Content for the modified side
* @param {string} path - File path
* @param {string} status - File edit status
* @param {Object} options - Optional configuration for the diff editor
*/
init: function(originalContent, modifiedContent, path, status, options) {
// Initialize editor
initDiffEditor(originalContent, modifiedContent, options);
// Update file metadata and UI
updateFileMetadata(path, status);
},
/**
* Update the diff editor with new content
* @param {string} originalContent - Content for the original side
* @param {string} modifiedContent - Content for the modified side
* @param {string} path - File path
* @param {string} status - File edit status
*/
update: function(originalContent, modifiedContent, path, status) {
// Update editor content
updateDiffContent(originalContent, modifiedContent);
// Update file metadata and UI
updateFileMetadata(path, status);
},
/**
* Handle resize events
*/
handleResize: function() {
const editor = getEditor();
if (editor) {
editor.layout();
}
}
};
export default DiffViewer;