feat(dashboard): add confirmations, fix UX issues, and optimize grid rendering
BREAKING CHANGE: applyDashboardConfig() now accepts optional second parameter for optimization Add auto-arrange confirmation dialog: - Add warning popup before auto-arranging widgets across all tabs - Follows same pattern as reset layout confirmation - Prevents accidental destructive operations Fix text selection interference: - Apply user-select: none to entire .rpg-widget in edit mode - Previously only applied to .rpg-widget-content - Prevents text selection when dragging widgets, especially in attribute boxes - Improves drag interaction on both desktop and mobile Fix edit controls visibility: - Add CSS rule to completely hide edit controls outside edit mode - Controls now properly hidden when not in edit mode - Settings button (⚙) kept for future widget configuration Fix input disabling in edit mode: - Call disableContentEditing() after tab switches in onTabChange() - Call disableContentEditing() in syncAllControls() - Ensures text fields remain non-editable in edit mode after all operations Fix resize grid background rendering: - Copy drag handler grid logic EXACTLY to resize handler - Use gridEngine.calculateGridHeight(widgets) instead of manual calculation - Add proper remToPixels() conversions for gap and rowHeight - Pass widgets array through initWidget() and startResize() - Grid now renders correctly during resize, matching drag behavior Optimize layout operations: - Add skipInitialSwitch option to applyDashboardConfig() - Prevents redundant clearGrid() calls during resetLayout() - Defers rendering until after layout calculations complete Files modified: - dashboardIntegration.js: Auto-arrange confirmation - dashboardManager.js: skipInitialSwitch option, input disabling, widgets array - editModeManager.js: Input disabling in syncAllControls() - resizeHandler.js: Grid rendering fixes with proper unit conversions - style.css: Text selection prevention, edit controls visibility
This commit is contained in:
@@ -246,10 +246,20 @@ function setupDashboardEventListeners(dependencies) {
|
||||
// Auto-layout button
|
||||
const autoLayoutBtn = document.querySelector('#rpg-dashboard-auto-layout');
|
||||
if (autoLayoutBtn) {
|
||||
autoLayoutBtn.addEventListener('click', () => {
|
||||
autoLayoutBtn.addEventListener('click', async () => {
|
||||
if (dashboardManager) {
|
||||
console.log('[RPG Companion] Auto-layout button clicked');
|
||||
dashboardManager.autoLayoutWidgets();
|
||||
const confirmed = await showConfirmDialog({
|
||||
title: 'Auto-Arrange All Widgets?',
|
||||
message: 'This will reorganize all widgets across all tabs and may change their positions. This action cannot be undone.',
|
||||
variant: 'warning',
|
||||
confirmText: 'Auto-Arrange',
|
||||
cancelText: 'Cancel'
|
||||
});
|
||||
|
||||
if (confirmed) {
|
||||
console.log('[RPG Companion] Auto-layout button clicked');
|
||||
dashboardManager.autoLayoutWidgets();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user