0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Tweaked feed item when in inbox view (#21255)

no refs
This commit is contained in:
Michael Barrett 2024-10-08 17:03:14 +01:00 committed by GitHub
parent 638e7d8d1a
commit f798955bc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,17 +156,6 @@ function renderTimestamp(object: ObjectProperties) {
return (<a className='whitespace-nowrap text-grey-700 hover:underline' href={object.url} title={`${timestamp}`}>{getRelativeTimestamp(date)}</a>);
}
const truncateHTML = (html: string, maxLength: number) => {
const tempElement = document.createElement('div');
tempElement.innerHTML = html;
const textContent = tempElement.textContent || tempElement.innerText || '';
const truncatedText = textContent.substring(0, maxLength);
return `${truncatedText}&hellip;”`;
};
const FeedItemStats: React.FC<{
object: ObjectProperties;
likeCount: number;
@ -478,7 +467,7 @@ const FeedItem: React.FC<FeedItemProps> = ({actor, object, layout, type, comment
</div>
</div>
</div>
<Heading className='line-clamp-1 font-semibold leading-normal' level={5} data-test-activity-heading>{object.name ? object.name : <span>{author.name}: <span dangerouslySetInnerHTML={({__html: truncateHTML(object.content, 30)})}></span></span>}</Heading>
<Heading className='line-clamp-1 font-semibold leading-normal' level={5} data-test-activity-heading>{object.name ? object.name : <span dangerouslySetInnerHTML={({__html: object.content})}></span>}</Heading>
<div dangerouslySetInnerHTML={({__html: object.content})} className='ap-note-content line-clamp-1 text-pretty text-[1.5rem] text-grey-700'></div>
</div>
{renderInboxAttachment(object)}
@ -502,4 +491,4 @@ const FeedItem: React.FC<FeedItemProps> = ({actor, object, layout, type, comment
return (<></>);
};
export default FeedItem;
export default FeedItem;