-
handleKeyDownLinea(e, linea.id)}
- onBlur={(e) => handleBlurLinea(e, linea.id)}
- onClick={() => {
- if (editingLineaId !== linea.id) {
- setEditingLineaId(linea.id)
- setTempNombreLinea(linea.nombre)
- }
- }}
- className={`text-foreground block w-full truncate text-sm font-bold wrap-break-word outline-none ${
- editingLineaId === linea.id
- ? 'border-primary/40 cursor-text border-b pb-1'
- : 'cursor-pointer'
- }`}
- >
- {linea.nombre}
-
+
+
+
+ setEditingLineaId(linea.id)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault()
+ e.currentTarget.blur()
+ }
+ if (e.key === 'Escape') {
+ e.preventDefault()
+ e.currentTarget.textContent = linea.nombre
+ e.currentTarget.blur()
+ }
+ }}
+ onBlur={(e) =>
+ confirmarEdicionLinea(
+ linea.id,
+ e.currentTarget.textContent,
+ )
+ }
+ className="text-foreground hover:text-foreground/85 block w-full cursor-text text-sm leading-snug wrap-break-word transition-colors outline-none"
+ >
+ {linea.nombre}
+
+
+
+ {linea.nombre}
+
+
-
-
+