fix(coding-agent): use browser-safe share viewer shortcuts (#3374)
fixes #3358
This commit is contained in:
@@ -262,9 +262,23 @@
|
|||||||
margin-bottom: var(--line-height);
|
margin-bottom: var(--line-height);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.help-hint {
|
||||||
|
flex: 1 1 240px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-toggle-btn,
|
||||||
.download-json-btn {
|
.download-json-btn {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
@@ -276,6 +290,7 @@
|
|||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-toggle-btn:hover,
|
||||||
.download-json-btn:hover {
|
.download-json-btn:hover {
|
||||||
background: var(--hover);
|
background: var(--hover);
|
||||||
border-color: var(--borderAccent);
|
border-color: var(--borderAccent);
|
||||||
|
|||||||
@@ -1291,8 +1291,12 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>Session: ${escapeHtml(header?.id || 'unknown')}</h1>
|
<h1>Session: ${escapeHtml(header?.id || 'unknown')}</h1>
|
||||||
<div class="help-bar">
|
<div class="help-bar">
|
||||||
<span>Ctrl+T toggle thinking · Ctrl+O toggle tools</span>
|
<span class="help-hint">T toggle thinking · O toggle tools</span>
|
||||||
<button class="download-json-btn" onclick="downloadSessionJson()" title="Download session as JSONL">↓ JSONL</button>
|
<div class="help-actions">
|
||||||
|
<button type="button" class="header-toggle-btn" data-action="toggle-thinking" title="Toggle thinking (T)">Toggle thinking</button>
|
||||||
|
<button type="button" class="header-toggle-btn" data-action="toggle-tools" title="Toggle tools (O)">Toggle tools</button>
|
||||||
|
<button type="button" class="download-json-btn" onclick="downloadSessionJson()" title="Download session as JSONL">↓ JSONL</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-info">
|
<div class="header-info">
|
||||||
<div class="info-item"><span class="info-label">Date:</span><span class="info-value">${header?.timestamp ? new Date(header.timestamp).toLocaleString() : 'unknown'}</span></div>
|
<div class="info-item"><span class="info-label">Date:</span><span class="info-value">${header?.timestamp ? new Date(header.timestamp).toLocaleString() : 'unknown'}</span></div>
|
||||||
@@ -1393,6 +1397,7 @@
|
|||||||
renderTree();
|
renderTree();
|
||||||
|
|
||||||
document.getElementById('header-container').innerHTML = renderHeader();
|
document.getElementById('header-container').innerHTML = renderHeader();
|
||||||
|
attachHeaderHandlers();
|
||||||
|
|
||||||
// Build messages using cached DOM nodes
|
// Build messages using cached DOM nodes
|
||||||
const messagesEl = document.getElementById('messages');
|
const messagesEl = document.getElementById('messages');
|
||||||
@@ -1672,6 +1677,20 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const attachHeaderHandlers = () => {
|
||||||
|
document.querySelector('[data-action="toggle-thinking"]')?.addEventListener('click', toggleThinking);
|
||||||
|
document.querySelector('[data-action="toggle-tools"]')?.addEventListener('click', toggleToolOutputs);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isEditableTarget = (element) => {
|
||||||
|
if (!element) return false;
|
||||||
|
const tagName = element.tagName;
|
||||||
|
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT' || tagName === 'BUTTON') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return element.isContentEditable || Boolean(element.closest?.('[contenteditable="true"]'));
|
||||||
|
};
|
||||||
|
|
||||||
// Keyboard shortcuts
|
// Keyboard shortcuts
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
@@ -1679,11 +1698,16 @@
|
|||||||
searchQuery = '';
|
searchQuery = '';
|
||||||
navigateTo(leafId, 'bottom');
|
navigateTo(leafId, 'bottom');
|
||||||
}
|
}
|
||||||
if (e.ctrlKey && e.key === 't') {
|
|
||||||
|
if (isEditableTarget(document.activeElement)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = e.key.toLowerCase();
|
||||||
|
if (key === 't') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
toggleThinking();
|
toggleThinking();
|
||||||
}
|
} else if (key === 'o') {
|
||||||
if (e.ctrlKey && e.key === 'o') {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
toggleToolOutputs();
|
toggleToolOutputs();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user