From e6d98b2ba8d5f826035983130f1d34223e0f1bb0 Mon Sep 17 00:00:00 2001 From: sokripon Date: Fri, 20 Dec 2024 17:45:02 +0100 Subject: [PATCH 1/3] fix(TextComponent): add white-space pre formatting for inline text --- src-theme/src/routes/menu/common/TextComponent.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src-theme/src/routes/menu/common/TextComponent.svelte b/src-theme/src/routes/menu/common/TextComponent.svelte index 86afd86bf22..b265c0cff44 100644 --- a/src-theme/src/routes/menu/common/TextComponent.svelte +++ b/src-theme/src/routes/menu/common/TextComponent.svelte @@ -148,6 +148,7 @@ .text { display: inline; + white-space: pre; &.allow-preformatting { font-family: monospace; From 9dc2af1efaf3acb9d2c598fc9fd9e18db7c6ea35 Mon Sep 17 00:00:00 2001 From: sokripon Date: Mon, 30 Dec 2024 03:31:38 +0100 Subject: [PATCH 2/3] feat(TextComponent): add preFormattingMonospace --- .../src/routes/menu/common/TextComponent.svelte | 14 +++++++++----- .../src/routes/menu/multiplayer/Multiplayer.svelte | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src-theme/src/routes/menu/common/TextComponent.svelte b/src-theme/src/routes/menu/common/TextComponent.svelte index b265c0cff44..78fc521d554 100644 --- a/src-theme/src/routes/menu/common/TextComponent.svelte +++ b/src-theme/src/routes/menu/common/TextComponent.svelte @@ -3,6 +3,7 @@ export let textComponent: TTextComponent | string; export let allowPreformatting = false; + export let preFormattingMonospace = true; export let inheritedColor = "#ffffff"; export let inheritedStrikethrough = false; export let inheritedItalic = false; @@ -107,7 +108,7 @@ {#if typeof textComponent === "string"} - + {:else if textComponent} {#if textComponent.text} {#if !textComponent.text.includes("§")} @@ -116,9 +117,10 @@ class:underlined={textComponent.underlined !== undefined ? textComponent.underlined : inheritedUnderlined} class:strikethrough={textComponent.strikethrough !== undefined ? textComponent.strikethrough : inheritedStrikethrough} class:allow-preformatting={allowPreformatting} + class:monospace={preFormattingMonospace && allowPreformatting} style="color: {textComponent.color !== undefined ? translateColor(textComponent.color) : translateColor(inheritedColor)}; font-size: {fontSize}px;">{textComponent.text} {:else} - connectToServer(server.address)}> - From c17d46f0d5981408adb952277f29496d8a77f5e3 Mon Sep 17 00:00:00 2001 From: sokripon Date: Mon, 30 Dec 2024 03:35:02 +0100 Subject: [PATCH 3/3] fix(multiplayer): disable preFormattingMonospace for TextComponent --- src-theme/src/routes/menu/multiplayer/Multiplayer.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-theme/src/routes/menu/multiplayer/Multiplayer.svelte b/src-theme/src/routes/menu/multiplayer/Multiplayer.svelte index fe020fc3bb8..ec54a208a87 100644 --- a/src-theme/src/routes/menu/multiplayer/Multiplayer.svelte +++ b/src-theme/src/routes/menu/multiplayer/Multiplayer.svelte @@ -177,7 +177,7 @@ :`data:image/png;base64,${server.icon}`} title={server.name} on:dblclick={() => connectToServer(server.address)}> -