1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 22:44:25 +02:00

Implement TextFormatter for posts

Get rid of formatting on user bios, we'll do that with JavaScript
This commit is contained in:
Toby Zerner
2015-07-22 16:03:48 +09:30
parent 6c50f1614b
commit a0fe68272c
15 changed files with 243 additions and 1973 deletions

View File

@@ -60,13 +60,6 @@ class User extends Model
'notification_read_time'
];
/**
* The text formatter instance.
*
* @var FormatterManager
*/
protected static $formatter;
/**
* The hasher with which to hash passwords.
*
@@ -215,29 +208,12 @@ class User extends Model
public function changeBio($bio)
{
$this->bio = $bio;
$this->bio_html = null;
$this->raise(new UserBioWasChanged($this));
return $this;
}
/**
* Get the user's bio formatted as HTML.
*
* @param string $value
* @return string
*/
public function getBioHtmlAttribute($value)
{
if ($value === null) {
$this->bio_html = $value = static::formatBio($this);
$this->save();
}
return $value;
}
/**
* Mark all discussions as read.
*
@@ -565,27 +541,6 @@ class User extends Model
static::$hasher = $hasher;
}
/**
* Set the text formatter instance.
*
* @param FormatterManager $formatter
*/
public static function setFormatter(FormatterManager $formatter)
{
static::$formatter = $formatter;
}
/**
* Get the formatted content of a user's bio.
*
* @param User $user
* @return string
*/
protected static function formatBio(User $user)
{
return static::$formatter->format($user->bio, $user);
}
/**
* Register a preference with a transformer and a default value.
*