fix(dashboard): disable text editing on widget re-renders in edit mode
Ensure contenteditable and input fields remain disabled when widgets are re-rendered during edit mode (e.g., during auto-layout, cross-tab moves, or tab switches). This prevents text editing from interfering with drag operations. Previously, disableContentEditing() was only called when entering edit mode, so any widgets rendered afterward would have editable fields again. Now, renderWidgetContent() checks if in edit mode and disables editing on newly rendered widgets.
This commit is contained in:
1 parent
f566ad1d93
commit
a330ea9b98
1 file changed
+16
@@ -726,6 +726,22 @@ export class DashboardManager {
|
|||||||
} else {
|
} else {
|
||||||
console.warn(`[DashboardManager] No render function for ${widget.type}`);
|
console.warn(`[DashboardManager] No render function for ${widget.type}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If in edit mode, disable content editing on this widget
|
||||||
|
if (this.editManager && this.editManager.isEditMode) {
|
||||||
|
const editableElements = element.querySelectorAll('[contenteditable="true"]');
|
||||||
|
editableElements.forEach(el => {
|
||||||
|
el.dataset.wasEditable = 'true';
|
||||||
|
el.contentEditable = 'false';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Also disable input fields
|
||||||
|
const inputElements = element.querySelectorAll('input, textarea');
|
||||||
|
inputElements.forEach(el => {
|
||||||
|
el.dataset.wasEnabled = el.disabled ? 'false' : 'true';
|
||||||
|
el.disabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user