Fix #3302 smiley are not render into last activity module and email

This commit is contained in:
buddh4 2018-09-20 16:52:18 +02:00
parent 0cd1699c04
commit 7c342e174a
3 changed files with 1506 additions and 0 deletions

View File

@ -16,6 +16,7 @@ HumHub Change Log
- Enh: Allow urls in array form in homeUrl configuration
- Fix: Javascript `humhub.modules.util.object.extend` not working on older Safari version
- Enh: Enable usage of `humhub\modules\content\widgets\PermaLink` outside of `humhub.modules.content.Content` components.
- Fix #3302 smiley are not render into last activity module and email
1.3.2 (September 4, 2018)
--------------------------

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
namespace humhub\modules\content\widgets\richtext;
use humhub\libs\EmojiMap;
use humhub\libs\Helpers;
use humhub\libs\Markdown;
use humhub\libs\ParameterEvent;
@ -182,9 +183,21 @@ class ProsemirrorRichText extends AbstractRichText
protected function renderMinimal() {
$parser = new Markdown();
$result = strip_tags($parser->parse($this->text));
$result = $this->toUTF8Emoji($result);
return ($this->maxLength > 0) ? Helpers::truncateText($result, $this->maxLength) : $result;
}
protected function toUTF8Emoji($text)
{
return preg_replace_callback('/:(([A-Za-z0-9])+):/', function($match) {
if(isset($match[1])) {
$result = EmojiMap::MAP[$match[1]];
}
return empty($result) ? $match[0] : $result;
}, $text);
}
/**
* @return string html extension holding the actual oembed dom nodes which will be embedded into the rich text
*/