Skip to content

Commit 83b0fb7

Browse files
Feat: Update comments of demo.
1 parent 659d8fa commit 83b0fb7

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

demo/main.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
const ed = document.getElementById('ed');
6464
const ln = document.getElementById('ln');
6565

66-
// Bloquea añadir más líneas después de la 99 (Enter o paste)
6766
ed.addEventListener('keydown', (e) => {
6867
if (e.key === 'Enter') {
6968
const currentLines = ed.value.split('\n').length;
@@ -76,27 +75,23 @@
7675
const sync = () => {
7776
let lines = ed.value.split('\n');
7877

79-
// Si se intenta pasar de 99 (por paste, etc.), cortamos automáticamente
8078
if (lines.length > 99) {
8179
ed.value = lines.slice(0, 99).join('\n');
8280
lines = ed.value.split('\n');
8381
}
8482

8583
const count = lines.length;
86-
// Números con 2 dígitos (01, 02, ..., 99)
84+
8785
ln.textContent = Array.from({length: count}, (_, i) =>
8886
String(i + 1).padStart(2, '0')
8987
).join('\n');
9088

91-
// Sincronizamos el scroll
9289
ln.scrollTop = ed.scrollTop;
9390
};
9491

95-
// El evento 'input' cubre escribir, borrar y pegar
9692
ed.oninput = sync;
9793
ed.onscroll = sync;
9894

99-
// Inicialización inmediata
10095
sync();
10196
</script>
10297

0 commit comments

Comments
 (0)