Browse Source

Don't overwrite empty lines

Fixes https://github.com/thatsmydoing/typingfreaks/issues/19

Previously, empty lines would not propagate down but just accept any
changes pushed from earlier lines. This is inconsistent with how a text
editor would normally behave with regards to the lines so we adjust it
here to match.
Thomas Dy 2 years ago
parent
commit
bc4ad05148
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/editor/lyrics.ts

+ 4 - 1
src/editor/lyrics.ts

@@ -316,7 +316,10 @@ export class LineEditor {
       this.adjustTimeInput();
     }
 
-    if (current === '') {
+    const isLastLine = part === 'time'
+      ? this.nextLine === undefined
+      : this.nextLine === this.container.lastLine;
+    if (current === '' && isLastLine) {
       return;
     }