check to code-server-like

This commit is contained in:
Cai
2025-09-21 15:33:00 +08:00
parent 252c426c3e
commit 271672c904
10 changed files with 129416 additions and 1673 deletions

View File

@@ -106,7 +106,7 @@
});
// 防抖处理非粘贴的编辑操作
const content = event.document.getText();
const content = changes.text;
debounceSendToServer({
type: 'fileEdit',
filePath: filePath,
@@ -155,23 +155,29 @@
}
let socket = null;
function openTerminal(event) {
event.stopPropagation();
const terminalDiv = document.getElementById('terminal');
terminalDiv.style.display = (terminalDiv.style.display === 'none' || terminalDiv.style.display === '') ? 'block' : 'none';
if (socket == null) {
socket = io.connect('http://' + document.domain + ':5200/vsc-like/terminal');
// document.getElementById('terminal').style.display = 'block';
if (document.getElementById('terminal').style.display === 'none' || document.getElementById('terminal').style.display === '') {
document.getElementById('terminal').style.display = 'block';
}else{
document.getElementById('terminal').style.display = 'none';
}
socket.on('connected', function(data) {
console.log('Terminal connected');
});
socket.on('terminal_output', function(data) {
const terminalDiv = document.getElementById('terminal');
terminalDiv.textContent += data.data;
});
// event.stopPropagation();
// const terminalDiv = document.getElementById('terminal');
// terminalDiv.style.display = (terminalDiv.style.display === 'none' || terminalDiv.style.display === '') ? 'block' : 'none';
// if (socket == null) {
// socket = io.connect('http://' + document.domain + ':5200/vsc-like/terminal');
// }
// socket.on('connected', function(data) {
// console.log('Terminal connected');
// });
// socket.on('terminal_output', function(data) {
// const terminalDiv = document.getElementById('terminal');
// terminalDiv.textContent += data.data;
// });
function sendTerminalInput(input) {
socket.emit('send_input', { input: input });
}
// function sendTerminalInput(input) {
// socket.emit('send_input', { input: input });
// }
}
// 按钮绑定事件