优化付费内容的显隐

This commit is contained in:
al 2024-11-14 15:40:31 +08:00
parent bb26b62cc1
commit d132076ff3
2 changed files with 4 additions and 2 deletions

View File

@ -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) && (
<div
className="font-bold text-btn my-4 text-base"
onClick={() => setIsOpenText(!isOpenText)}

View File

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