ç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
|
// Custom input for horizontal definition
|
||||||
const customH = document.createElement('div');
|
const customH = document.createElement('div');
|
||||||
customH.style.display = 'flex';
|
customH.style.display = 'flex';
|
||||||
|
customH.style.flexDirection = 'column';
|
||||||
customH.style.gap = '8px';
|
customH.style.gap = '8px';
|
||||||
customH.style.marginTop = '8px';
|
customH.style.marginTop = '8px';
|
||||||
const inputH = document.createElement('input');
|
const inputH = document.createElement('input');
|
||||||
inputH.type = 'text';
|
inputH.type = 'text';
|
||||||
inputH.value = grid[row][col].definitionH || '';
|
inputH.value = grid[row][col].definitionH || '';
|
||||||
inputH.style.flex = '1';
|
inputH.style.width = '100%';
|
||||||
const saveH = document.createElement('button');
|
const saveH = document.createElement('button');
|
||||||
saveH.className = 'btn-primary';
|
saveH.className = 'btn-primary';
|
||||||
saveH.textContent = 'Enregistrer (H)';
|
saveH.textContent = 'Enregistrer (H)';
|
||||||
@ -655,12 +656,13 @@
|
|||||||
// Custom input for vertical definition
|
// Custom input for vertical definition
|
||||||
const customV = document.createElement('div');
|
const customV = document.createElement('div');
|
||||||
customV.style.display = 'flex';
|
customV.style.display = 'flex';
|
||||||
|
customV.style.flexDirection = 'column';
|
||||||
customV.style.gap = '8px';
|
customV.style.gap = '8px';
|
||||||
customV.style.marginTop = '8px';
|
customV.style.marginTop = '8px';
|
||||||
const inputV = document.createElement('input');
|
const inputV = document.createElement('input');
|
||||||
inputV.type = 'text';
|
inputV.type = 'text';
|
||||||
inputV.value = grid[row][col].definitionV || '';
|
inputV.value = grid[row][col].definitionV || '';
|
||||||
inputV.style.flex = '1';
|
inputV.style.width = '100%';
|
||||||
const saveV = document.createElement('button');
|
const saveV = document.createElement('button');
|
||||||
saveV.className = 'btn-primary';
|
saveV.className = 'btn-primary';
|
||||||
saveV.textContent = 'Enregistrer (V)';
|
saveV.textContent = 'Enregistrer (V)';
|
||||||
@ -1066,6 +1068,14 @@
|
|||||||
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
||||||
if (document.getElementById('gridScreen').style.display === 'none') 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
|
// Toggle orientation with Tab when an active cell exists
|
||||||
if (e.key === 'Tab') {
|
if (e.key === 'Tab') {
|
||||||
if (!activeCell) return;
|
if (!activeCell) return;
|
||||||
@ -1078,6 +1088,17 @@
|
|||||||
if (!activeCell) return;
|
if (!activeCell) return;
|
||||||
const { row, col } = activeCell;
|
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)
|
// Enter: transform empty letter into definition (or open modal if definition exists)
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user