ça marchotte
This commit is contained in:
parent
60f900740f
commit
5182dcb4c3
25
index.html
25
index.html
@ -597,12 +597,13 @@
|
||||
// Custom input for horizontal definition
|
||||
const customH = document.createElement('div');
|
||||
customH.style.display = 'flex';
|
||||
customH.style.flexDirection = 'column';
|
||||
customH.style.gap = '8px';
|
||||
customH.style.marginTop = '8px';
|
||||
const inputH = document.createElement('input');
|
||||
inputH.type = 'text';
|
||||
inputH.value = grid[row][col].definitionH || '';
|
||||
inputH.style.flex = '1';
|
||||
inputH.style.width = '100%';
|
||||
const saveH = document.createElement('button');
|
||||
saveH.className = 'btn-primary';
|
||||
saveH.textContent = 'Enregistrer (H)';
|
||||
@ -655,12 +656,13 @@
|
||||
// Custom input for vertical definition
|
||||
const customV = document.createElement('div');
|
||||
customV.style.display = 'flex';
|
||||
customV.style.flexDirection = 'column';
|
||||
customV.style.gap = '8px';
|
||||
customV.style.marginTop = '8px';
|
||||
const inputV = document.createElement('input');
|
||||
inputV.type = 'text';
|
||||
inputV.value = grid[row][col].definitionV || '';
|
||||
inputV.style.flex = '1';
|
||||
inputV.style.width = '100%';
|
||||
const saveV = document.createElement('button');
|
||||
saveV.className = 'btn-primary';
|
||||
saveV.textContent = 'Enregistrer (V)';
|
||||
@ -1066,6 +1068,14 @@
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
||||
if (document.getElementById('gridScreen').style.display === 'none') return;
|
||||
|
||||
// If modal is open, do not interact with grid via keyboard
|
||||
const modal = document.getElementById('definitionModal');
|
||||
if (modal.classList.contains('show')) return;
|
||||
|
||||
// don't intercept when focus is inside an input/textarea/contentEditable
|
||||
const ae = document.activeElement;
|
||||
if (ae && (ae.tagName === 'INPUT' || ae.tagName === 'TEXTAREA' || ae.isContentEditable)) return;
|
||||
|
||||
// Toggle orientation with Tab when an active cell exists
|
||||
if (e.key === 'Tab') {
|
||||
if (!activeCell) return;
|
||||
@ -1078,6 +1088,17 @@
|
||||
if (!activeCell) return;
|
||||
const { row, col } = activeCell;
|
||||
|
||||
// Delete key: transform active cell into empty letter
|
||||
if (e.key === 'Delete') {
|
||||
e.preventDefault();
|
||||
grid[row][col].type = 'letter';
|
||||
grid[row][col].letter = '';
|
||||
grid[row][col].definitionH = '';
|
||||
grid[row][col].definitionV = '';
|
||||
renderGrid();
|
||||
return;
|
||||
}
|
||||
|
||||
// Enter: transform empty letter into definition (or open modal if definition exists)
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user