mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
fix(skills): keep edit mode open on outside-the-textarea click (#4011)
Clicking the card body outside the edit <textarea> bubbled to the card's click handler and collapsed the card, silently discarding unsaved skill edits (issue #4002). The textarea's own stopPropagation only shields clicks landing on it. Bail out of the card click handler while a .skill-md-editor is present so the card only leaves edit mode via Save (Cancel button is handled separately by #3580). Mirrors the same guard into the built-in capability card, which shared the bug. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -514,6 +514,8 @@ function _buildBuiltinCards() {
|
||||
|
||||
card.addEventListener('click', (e) => {
|
||||
if (e.target.closest('button, input, textarea')) return;
|
||||
// Editing in progress → don't collapse on an outside-the-textarea click.
|
||||
if (card.querySelector('.skill-md-editor')) return;
|
||||
_expandBuiltinCard(card, b.name);
|
||||
});
|
||||
return card;
|
||||
@@ -786,6 +788,10 @@ function renderSkillsList() {
|
||||
card.addEventListener('click', (e) => {
|
||||
if (card._suppressNextClick) { card._suppressNextClick = false; return; }
|
||||
if (e.target.closest('button, input, textarea')) return;
|
||||
// While editing, a click on the card body (outside the textarea) must
|
||||
// NOT collapse the card — that silently discards unsaved edits. Only
|
||||
// Save/Cancel exit edit mode.
|
||||
if (card.querySelector('.skill-md-editor')) return;
|
||||
if (_selectMode) {
|
||||
const cb = card.querySelector('.skill-select-cb');
|
||||
if (cb) { cb.checked = !cb.checked; cb.dispatchEvent(new Event('change')); }
|
||||
|
||||
Reference in New Issue
Block a user