fix(task-view): allow task selection when inline editor is disabled

Previously, clicking on task content would always prevent event bubbling,
blocking task selection even when the inline editor feature was disabled.
This fix ensures stopPropagation() is only called when:
- Opening task in file with Cmd/Ctrl+click
- Showing the inline editor (when enabled)

This allows clicks to properly bubble up for task selection when the
inline editor is disabled, restoring expected behavior.
This commit is contained in:
Quorafind 2025-09-09 17:50:02 +08:00
parent 36ca266eb3
commit 81f7775e8a
2 changed files with 8 additions and 4 deletions

View file

@ -818,19 +818,21 @@ export class TaskListItemComponent extends Component {
private registerContentClickHandler() {
// Make content clickable for editing or navigation
this.registerDomEvent(this.contentEl, "click", async (e) => {
e.stopPropagation();
// Check if modifier key is pressed (Cmd/Ctrl)
if (Keymap.isModEvent(e)) {
// Open task in file
e.stopPropagation();
await this.openTaskInFile();
} else if (
this.plugin.settings.enableInlineEditor &&
!this.isCurrentlyEditing()
) {
// Only stop propagation if we're actually going to show the editor
e.stopPropagation();
// Show inline editor only if enabled
this.getInlineEditor().showContentEditor(this.contentEl);
}
// If inline editor is disabled, let the click bubble up to select the task
});
}

View file

@ -887,17 +887,19 @@ export class TaskTreeItemComponent extends Component {
private registerContentClickHandler() {
// Make content clickable for editing or navigation
this.registerDomEvent(this.contentEl, "click", async (e) => {
e.stopPropagation();
// Check if modifier key is pressed (Cmd/Ctrl)
if (Keymap.isModEvent(e)) {
// Open task in file
e.stopPropagation();
await this.openTaskInFile();
} else if (this.plugin.settings.enableInlineEditor && !this.isCurrentlyEditing()) {
// Only stop propagation if we're actually going to show the editor
e.stopPropagation();
// Show inline editor only if enabled
const editor = this.getInlineEditor();
editor.showContentEditor(this.contentEl);
}
// If inline editor is disabled, let the click bubble up to select the task
});
}