mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
parent
edddeeb553
commit
de42c316c0
|
@ -1,7 +1,6 @@
|
|||
import Component from 'flarum/Component';
|
||||
import avatar from 'flarum/helpers/avatar';
|
||||
import username from 'flarum/helpers/username';
|
||||
import humanTime from 'flarum/helpers/humanTime';
|
||||
import highlight from 'flarum/helpers/highlight';
|
||||
|
||||
/**
|
||||
|
@ -22,8 +21,7 @@ export default class PostPreview extends Component {
|
|||
<a className="PostPreview" href={app.route.post(post)} config={m.route} onclick={this.props.onclick}>
|
||||
<span className="PostPreview-content">
|
||||
{avatar(user)}
|
||||
{username(user)}
|
||||
{humanTime(post.time())}
|
||||
{username(user)}{' '}
|
||||
<span className="PostPreview-excerpt">{excerpt}</span>
|
||||
</span>
|
||||
</a>
|
||||
|
|
|
@ -34,9 +34,15 @@ export function slug(string) {
|
|||
* @return {String}
|
||||
*/
|
||||
export function getPlainContent(string) {
|
||||
return $('<div/>').html(string.replace(/(<\/p>|<br>)/g, '$1 ')).text();
|
||||
const dom = $('<div/>').html(string.replace(/(<\/p>|<br>)/g, '$1 '));
|
||||
|
||||
dom.find(getPlainContent.removeSelectors.join(',')).remove();
|
||||
|
||||
return dom.text();
|
||||
}
|
||||
|
||||
getPlainContent.removeSelectors = ['blockquote'];
|
||||
|
||||
/**
|
||||
* Make a string's first character uppercase.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user