Compare commits
2 Commits
v0.3.5-bet
...
v0.3.5-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a09e0e0c2 | ||
|
|
47fa2e01bb |
@@ -400,7 +400,7 @@ export default function Shell({ api }) {
|
|||||||
|
|
||||||
const onResize = () => {
|
const onResize = () => {
|
||||||
const el = document.getElementById(`terminal-${tabId}`)
|
const el = document.getElementById(`terminal-${tabId}`)
|
||||||
if (el && el.style.visibility !== 'hidden' && el.style.position !== 'absolute') {
|
if (el && el.style.display !== 'none') {
|
||||||
fitAddon.fit()
|
fitAddon.fit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,26 +438,24 @@ export default function Shell({ api }) {
|
|||||||
const tryInit = (attempt) => {
|
const tryInit = (attempt) => {
|
||||||
if (cancelled || attempt > 20) return
|
if (cancelled || attempt > 20) return
|
||||||
const shellCol = document.querySelector('.shell-terminal-col')
|
const shellCol = document.querySelector('.shell-terminal-col')
|
||||||
if (!shellCol) {
|
if (!shellCol || shellCol.offsetParent === null) {
|
||||||
pending.push(setTimeout(() => tryInit(attempt + 1), 150))
|
pending.push(setTimeout(() => tryInit(attempt + 1), 150))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const container = document.getElementById(`terminal-${tab.id}`)
|
const container = document.getElementById(`terminal-${tab.id}`)
|
||||||
if (!container) {
|
if (!container || container.offsetHeight === 0) {
|
||||||
pending.push(setTimeout(() => tryInit(attempt + 1), 100))
|
pending.push(setTimeout(() => tryInit(attempt + 1), 100))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!tabsRef.current[tab.id]) {
|
if (!tabsRef.current[tab.id]) {
|
||||||
initTerminal(tab.id, tab)
|
initTerminal(tab.id, tab)
|
||||||
}
|
}
|
||||||
if (activeTab === tab.id) {
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (cancelled) return
|
if (cancelled) return
|
||||||
const entry = tabsRef.current[tab.id]
|
const entry = tabsRef.current[tab.id]
|
||||||
if (entry) entry.fitAddon.fit()
|
if (entry) entry.fitAddon.fit()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tryInit(0)
|
tryInit(0)
|
||||||
return () => {
|
return () => {
|
||||||
@@ -472,7 +470,7 @@ export default function Shell({ api }) {
|
|||||||
const entry = tabsRef.current[tab.id]
|
const entry = tabsRef.current[tab.id]
|
||||||
if (entry) {
|
if (entry) {
|
||||||
const el = document.getElementById(`terminal-${tab.id}`)
|
const el = document.getElementById(`terminal-${tab.id}`)
|
||||||
if (el && el.style.visibility !== 'hidden') {
|
if (el && el.style.display !== 'none') {
|
||||||
entry.fitAddon.fit()
|
entry.fitAddon.fit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,10 +839,7 @@ export default function Shell({ api }) {
|
|||||||
key={tab.id}
|
key={tab.id}
|
||||||
id={`terminal-${tab.id}`}
|
id={`terminal-${tab.id}`}
|
||||||
className="shell-xterm-instance"
|
className="shell-xterm-instance"
|
||||||
style={activeTab === tab.id
|
style={{ display: activeTab === tab.id ? 'block' : 'none' }}
|
||||||
? { visibility: 'visible', pointerEvents: 'auto' }
|
|
||||||
: { visibility: 'hidden', pointerEvents: 'none' }
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -384,8 +384,8 @@ input::placeholder { color: var(--text-disabled); }
|
|||||||
|
|
||||||
.shell-xterm-wrapper { flex: 1; background: var(--bg); overflow: hidden; position: relative; }
|
.shell-xterm-wrapper { flex: 1; background: var(--bg); overflow: hidden; position: relative; }
|
||||||
.shell-xterm-instance {
|
.shell-xterm-instance {
|
||||||
position: absolute; inset: 0; padding: 4px;
|
height: 100%;
|
||||||
display: block !important;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
.shell-xterm-instance .xterm { height: 100%; padding: 4px; }
|
.shell-xterm-instance .xterm { height: 100%; padding: 4px; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user