From d132076ff32911cb012f461b9b7021856013600d Mon Sep 17 00:00:00 2001 From: al Date: Thu, 14 Nov 2024 15:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=98=E8=B4=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=9A=84=E6=98=BE=E9=9A=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/PostItem/index.js | 3 ++- utils/tools.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/PostItem/index.js b/components/PostItem/index.js index 08d71b4..ef02bbf 100644 --- a/components/PostItem/index.js +++ b/components/PostItem/index.js @@ -240,7 +240,8 @@ export default function PostItem({ {!( !data?.is_zone_moment_unlocked && data?.text_visible_range < 999 ) && - (data.text?.length > 140 || getcountLines(data.text) > 1) && ( + (data.text?.length > 140 || + getcountLines(data.paid_text || "") > 1) && (
setIsOpenText(!isOpenText)} diff --git a/utils/tools.js b/utils/tools.js index 1b1da7a..f9e65cf 100644 --- a/utils/tools.js +++ b/utils/tools.js @@ -153,6 +153,7 @@ export function getVideoBase64(url) { } export function getcountLines(str) { - const lines = str.split("\n").filter((line) => line.trim() !== ""); + const newStr = str.startsWith("\n") ? str.slice(1) : str; + const lines = newStr.split("\n").filter((line) => line.trim() !== ""); return lines.length; }