fix: menu buttons broken when title contains apostrophes — use showAttachModalById to avoid inline onclick escaping issues
This commit is contained in:
parent
cec6841938
commit
1645061932
|
|
@ -526,8 +526,8 @@
|
|||
<td>${labelPill(label)}</td>
|
||||
<td style="text-align:center">
|
||||
${item.answer_count > 0
|
||||
? `<span class="badge" style="background:rgba(74,222,128,.15);color:#4ade80;cursor:pointer" onclick="showAttachModal('${eid}','${escHtml(title)}')">${item.answer_count}</span>`
|
||||
: `<span style="color:var(--ds-tx3);cursor:pointer;font-size:12px" onclick="showAttachModal('${eid}','${escHtml(title)}')">—</span>`}
|
||||
? `<span class="badge" style="background:rgba(74,222,128,.15);color:#4ade80;cursor:pointer" onclick="showAttachModalById('${eid}')">${item.answer_count}</span>`
|
||||
: `<span style="color:var(--ds-tx3);cursor:pointer;font-size:12px" onclick="showAttachModalById('${eid}')">—</span>`}
|
||||
</td>
|
||||
<td style="max-width:140px;overflow:hidden;text-overflow:ellipsis;color:var(--ds-tx2);font-size:12px" title="${escHtml(buyerComment)}">${escHtml(buyerComment)}</td>
|
||||
<td style="max-width:140px;overflow:hidden;text-overflow:ellipsis;color:var(--ds-tx2);font-size:12px" title="${escHtml(sellerComment)}">${escHtml(sellerComment)}</td>
|
||||
|
|
@ -535,7 +535,7 @@
|
|||
<td style="position:relative">
|
||||
<button onclick="toggleMenu(event,'${eid}')" style="background:none;border:none;cursor:pointer;color:var(--ds-tx3);font-size:16px;padding:2px 6px">…</button>
|
||||
<div id="menu-${eid}" class="actions-menu" style="display:none">
|
||||
<button onclick="showAttachModal('${eid}','${escHtml(title)}')">Attach Answer</button>
|
||||
<button onclick="showAttachModalById('${eid}')">Attach Answer</button>
|
||||
<button onclick="editRequest('${eid}', event)">Edit</button>
|
||||
<button onclick="deleteEntry('${eid}')">Delete</button>
|
||||
</div>
|
||||
|
|
@ -800,6 +800,13 @@
|
|||
}
|
||||
|
||||
// ---- Attach answer modal ----
|
||||
function showAttachModalById(reqId) {
|
||||
const item = treeData.find(t => t.entry_id === reqId);
|
||||
const d = item ? (item.data || {}) : {};
|
||||
const title = d.title || d.description || 'Untitled';
|
||||
showAttachModal(reqId, title);
|
||||
}
|
||||
|
||||
function showAttachModal(reqId, reqTitle) {
|
||||
attachRequestId = reqId;
|
||||
document.getElementById('attachReqTitle').textContent = reqTitle;
|
||||
|
|
|
|||
Loading…
Reference in New Issue