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; }