From 488bbb746100eeea15ee3efe0b16fba4e569ed96 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Tue, 22 Sep 2026 11:18:17 +0800 Subject: [PATCH] feat: Line-height adjustments for Chinese, Japanese and Korean documents (#13822) --- shared/editor/components/Styles.ts | 15 +++++++++++++++ shared/utils/language.test.ts | 1 + shared/utils/language.ts | 3 +++ 3 files changed, 19 insertions(+) diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index 9a1537f72d..68632f00d6 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -523,6 +523,21 @@ const textStyle = () => css` margin-bottom: 0.8em; } } + + /* East Asian scripts */ + :lang(zh), /* Chinese */ + :lang(ja), /* Japanese */ + :lang(ko) { + /* Korean */ + p { + line-height: 1.8; + } + + .ProseMirror > p { + margin-top: 0.8em; + margin-bottom: 0.8em; + } + } `; const style = (props: Props) => css` diff --git a/shared/utils/language.test.ts b/shared/utils/language.test.ts index c3336a9ea0..795ee87e86 100644 --- a/shared/utils/language.test.ts +++ b/shared/utils/language.test.ts @@ -37,6 +37,7 @@ describe("getSupportedLanguage", () => { describe("getLangFor", () => { it("returns languages that need special text styling", () => { expect(getLangFor("fa")).toEqual("fa"); + expect(getLangFor("zh")).toEqual("zh"); }); it("ignores other or empty languages", () => { diff --git a/shared/utils/language.ts b/shared/utils/language.ts index 82d14c93ad..1643b7f646 100644 --- a/shared/utils/language.ts +++ b/shared/utils/language.ts @@ -91,6 +91,9 @@ const scriptsWithLang = new Set([ "he", // Hebrew "am", // Amharic "mn", // Mongolian + "zh", // Chinese + "ja", // Japanese + "ko", // Korean ]); /**