aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTamion <[email protected]>2024-11-04 11:38:40 +0100
committerGitHub <[email protected]>2024-11-04 11:38:40 +0100
commitab7cf0b3825354c9b1f2507251e7ced710eca886 (patch)
treec7455d5c423e74ffb3c14d31d3e4b838d69c54d1
parentd4e14da02cca4ed2feca73b943126ea26c26cac6 (diff)
downloadmonkeytype-ab7cf0b3825354c9b1f2507251e7ced710eca886.tar.gz
monkeytype-ab7cf0b3825354c9b1f2507251e7ced710eca886.zip
fix(custom mode): remove space at beginning of custom text lines (@notTamion) (#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
-rw-r--r--frontend/src/ts/modals/custom-text.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/frontend/src/ts/modals/custom-text.ts b/frontend/src/ts/modals/custom-text.ts
index 2c84b4541..37b07ae3a 100644
--- a/frontend/src/ts/modals/custom-text.ts
+++ b/frontend/src/ts/modals/custom-text.ts
@@ -221,9 +221,9 @@ async function afterAnimation(): Promise<void> {
}
export function show(showOptions?: ShowOptions): void {
- state.textarea = CustomText.getText().join(
- CustomText.getPipeDelimiter() ? "|" : " "
- );
+ state.textarea = CustomText.getText()
+ .join(CustomText.getPipeDelimiter() ? "|" : " ")
+ .replace(/^ +/gm, "");
void modal.show({
...(showOptions as ShowOptions<IncomingData>),
beforeAnimation,