Fix desktop session rename editing
This commit is contained in:
1 parent
d205cd023e
commit
54e8d46603
3 files changed
+30
-5
No files matched your search
@@ -2909,6 +2909,12 @@ async function closeSession(id) {
|
||||
|
||||
const convMenu = document.getElementById('conv-menu');
|
||||
let menuTargetId = null;
|
||||
function isSessionRowInteractiveTarget(target) {
|
||||
const el = target instanceof Element ? target : null;
|
||||
return !!el?.closest?.(
|
||||
'.ci-more, .ci-rename-input, button, input, textarea, select, a, [contenteditable="true"], [data-no-session-select]'
|
||||
);
|
||||
}
|
||||
convListEl.addEventListener('click', (e) => {
|
||||
const more = e.target.closest('.ci-more');
|
||||
if (more) {
|
||||
@@ -2928,6 +2934,7 @@ convListEl.addEventListener('click', (e) => {
|
||||
convMenu.style.left = (rect.right - convMenu.offsetWidth) + 'px';
|
||||
return;
|
||||
}
|
||||
if (isSessionRowInteractiveTarget(e.target)) return;
|
||||
const it = e.target.closest('.conv-item');
|
||||
if (it && it.dataset.id) {
|
||||
setActiveSession(it.dataset.id);
|
||||
@@ -2964,8 +2971,10 @@ convMenu.addEventListener('click', (e) => {
|
||||
const titleEl = item.querySelector('.ci-title');
|
||||
if (!titleEl) return;
|
||||
const oldTitle = sess.title || '';
|
||||
item.classList.add('renaming');
|
||||
const inp = document.createElement('input');
|
||||
inp.className = 'ci-rename-input';
|
||||
inp.dataset.noSessionSelect = '1';
|
||||
inp.maxLength = 50;
|
||||
inp.value = oldTitle;
|
||||
titleEl.replaceWith(inp);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>GenericAgent</title>
|
||||
<link rel="stylesheet" href="assets/fonts/fonts.css?v=2">
|
||||
<link rel="stylesheet" href="styles.css?v=181">
|
||||
<link rel="stylesheet" href="styles.css?v=182">
|
||||
<!-- KaTeX: LaTeX 公式渲染 -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" crossorigin="anonymous">
|
||||
<!-- highlight.js: 代码高亮 -->
|
||||
@@ -674,6 +674,6 @@
|
||||
<!-- highlight.js -->
|
||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js" crossorigin="anonymous"></script>
|
||||
<script src="phosphor-icons.js?v=2"></script>
|
||||
<script src="app.js?v=208"></script>
|
||||
<script src="app.js?v=209"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1427,15 +1427,30 @@ span.flatpickr-weekday{ color:var(--muted) !important; font-size:11px; }
|
||||
.conv-item{ display:flex; align-items:center; gap:9px; padding:9px 10px; border-radius:4px; cursor:pointer; }
|
||||
.conv-item:hover{ background:var(--line-soft); }
|
||||
.conv-item.active{ background:var(--accent-bg); }
|
||||
.conv-item.renaming{
|
||||
cursor:default;
|
||||
background:color-mix(in srgb, var(--accent-bg) 70%, var(--panel));
|
||||
}
|
||||
.ci-dot{ width:7px; height:7px; border-radius:50%; background:var(--ok); flex:0 0 auto; }
|
||||
.conv-item.idle .ci-dot{ background:var(--dot-idle); }
|
||||
.ci-main{ flex:1; min-width:0; }
|
||||
.ci-title{ font-size:13px; font-weight:500; color:var(--txt-strong); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
.ci-rename-input{
|
||||
font-size:13px; font-weight:500; color:var(--txt-strong); width:100%;
|
||||
border:1px solid var(--accent); border-radius:4px; padding:1px 4px;
|
||||
background:var(--field-bg); outline:none;
|
||||
display:block; width:100%; min-width:0; height:24px; box-sizing:border-box;
|
||||
margin:-3px 0 -2px; padding:0 7px;
|
||||
border:1px solid color-mix(in srgb, var(--accent) 44%, var(--line-strong));
|
||||
border-radius:4px; background:var(--card); outline:none;
|
||||
color:var(--txt-strong); caret-color:var(--accent);
|
||||
font-family:var(--font-sans); font-size:13px; font-weight:500; line-height:22px;
|
||||
box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent);
|
||||
transition:border-color .12s, box-shadow .12s, background .12s;
|
||||
}
|
||||
.ci-rename-input:focus{
|
||||
border-color:var(--accent);
|
||||
background:var(--field-bg);
|
||||
box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
|
||||
}
|
||||
.ci-rename-input::selection{ background:color-mix(in srgb, var(--accent) 28%, transparent); }
|
||||
.ci-pin{ width:14px; height:14px; color:var(--accent); margin-right:3px; vertical-align:-3px; flex:0 0 auto; display:inline-block; }
|
||||
.ci-meta{ font-size:11px; color:var(--muted); margin-top:2px; }
|
||||
.ci-more{
|
||||
@@ -1446,6 +1461,7 @@ span.flatpickr-weekday{ color:var(--muted) !important; font-size:11px; }
|
||||
}
|
||||
.ci-more svg{ width:20px; height:20px; }
|
||||
.conv-item:hover .ci-more, .conv-item.active .ci-more{ opacity:1; }
|
||||
.conv-item.renaming .ci-more{ opacity:0; pointer-events:none; }
|
||||
.ci-more:hover{ background:var(--hover-dim); color:var(--txt-2); }
|
||||
|
||||
.ctx-menu{
|
||||
|
||||
Reference in new issue
Block a user