fix: terminal WebSocket connection — manage xterm containers in JS
- Remove Alpine x-for template for xterm containers (async rendering bug) - Add static #xterm-wrapper div, JS creates/removes container elements directly - addTab() uses document.createElement + appendChild for instant DOM - switchTab() toggles display:block/none, closeTab() removes from DOM - Add console.log for WebSocket open/close/error debugging - Terminal now connects on page load
This commit is contained in:
@@ -49,16 +49,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- xterm.js containers — one per tab, shown/hidden by Alpine -->
|
||||
<div class="flex-1 relative min-h-0">
|
||||
<template x-for="(tab, idx) in tabs" :key="tab.id">
|
||||
<div x-show="idx === activeTab"
|
||||
x-cloak
|
||||
class="absolute inset-0">
|
||||
<div :id="'xterm-' + tab.id" class="w-full h-full"></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<!-- xterm.js containers — managed by JS, not Alpine -->
|
||||
<div id="xterm-wrapper" class="flex-1 relative min-h-0"></div>
|
||||
|
||||
<!-- Input prompt -->
|
||||
<form @submit.prevent="submitCommand()"
|
||||
|
||||
Reference in New Issue
Block a user