mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
fix(views/board): unable to click while editing column
This commit is contained in:
parent
9589164008
commit
e851701a9e
@ -24,7 +24,12 @@ export class ColumnDragHandler implements BaseDragHandler {
|
||||
// Delay drag start to allow click detection
|
||||
let dragStartTimer: number | null = null;
|
||||
|
||||
$titleEl.on("mousedown", () => {
|
||||
$titleEl.on("mousedown", (e) => {
|
||||
// Don't interfere with editing mode or input field interactions
|
||||
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear any existing timer
|
||||
if (dragStartTimer) {
|
||||
clearTimeout(dragStartTimer);
|
||||
@ -38,7 +43,12 @@ export class ColumnDragHandler implements BaseDragHandler {
|
||||
}, 150);
|
||||
});
|
||||
|
||||
$titleEl.on("mouseup mouseleave", () => {
|
||||
$titleEl.on("mouseup mouseleave", (e) => {
|
||||
// Don't interfere with editing mode
|
||||
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel drag start timer on mouse up or leave
|
||||
if (dragStartTimer) {
|
||||
clearTimeout(dragStartTimer);
|
||||
|
@ -363,6 +363,12 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
// Handle column title editing with click detection that works with dragging
|
||||
this.$container.on('mousedown', 'h3[data-column-value]', (e) => {
|
||||
const $titleEl = $(e.currentTarget);
|
||||
|
||||
// Don't interfere with editing mode
|
||||
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
let hasMoved = false;
|
||||
const startX = e.clientX;
|
||||
@ -419,12 +425,20 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
const $titleSpan = $titleEl.find("span").first(); // Get the text span
|
||||
const currentTitle = $titleSpan.text();
|
||||
$titleEl.addClass("editing");
|
||||
|
||||
// Disable dragging while editing
|
||||
$titleEl.attr("draggable", "false");
|
||||
|
||||
const $input = $("<input>")
|
||||
.attr("type", "text")
|
||||
.val(currentTitle)
|
||||
.attr("placeholder", "Column title");
|
||||
|
||||
// Prevent events from bubbling to parent drag handlers
|
||||
$input.on('mousedown mouseup click', (e) => {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$titleEl.empty().append($input);
|
||||
$input.focus().select();
|
||||
|
||||
@ -434,6 +448,9 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
}
|
||||
|
||||
$titleEl.removeClass("editing");
|
||||
|
||||
// Re-enable dragging after editing
|
||||
$titleEl.attr("draggable", "true");
|
||||
|
||||
let finalTitle = currentTitle;
|
||||
if (save) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user