fix trimmed text

This commit is contained in:
2025-01-05 09:32:57 +01:00
parent 88a574aa80
commit e3fa1678c2

View File

@@ -15,7 +15,6 @@ export type ChordMode = 'show' | 'hide' | 'onlyFirst';
templateUrl: './song-text.component.html',
styleUrls: ['./song-text.component.less'],
animations: [songSwitch],
standalone: false,
})
export class SongTextComponent implements OnInit {
public sections: Section[] = [];
@@ -100,6 +99,15 @@ export class SongTextComponent implements OnInit {
return this.index !== -1 && this.index !== i;
}
public transform(text: string): string {
if (this.isComment(text)) text = text.slice(1);
return text;
}
public isComment(text: string) {
return text.startsWith('#');
}
private render() {
this.offset = 0;
this.sections = [];
@@ -124,13 +132,4 @@ export class SongTextComponent implements OnInit {
return 'show';
}
}
public transform(text: string): string {
if (this.isComment(text)) text = text.slice(1);
return text.trim();
}
public isComment(text: string) {
return text.startsWith('#');
}
}