Skip to content

Commit ab7cf0b

Browse files
authored
fix(custom mode): remove space at beginning of custom text lines (@notTamion) (monkeytypegame#5993)
when creating a multi line text in the custom text editor and then reopening the editor all lines after the first will have a space at the start, this is because .join adds a space regardless of whether there is a newline character
1 parent d4e14da commit ab7cf0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

frontend/src/ts/modals/custom-text.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ async function afterAnimation(): Promise<void> {
221221
}
222222

223223
export function show(showOptions?: ShowOptions): void {
224-
state.textarea = CustomText.getText().join(
225-
CustomText.getPipeDelimiter() ? "|" : " "
226-
);
224+
state.textarea = CustomText.getText()
225+
.join(CustomText.getPipeDelimiter() ? "|" : " ")
226+
.replace(/^ +/gm, "");
227227
void modal.show({
228228
...(showOptions as ShowOptions<IncomingData>),
229229
beforeAnimation,

0 commit comments

Comments
 (0)