mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix #3302 smiley are not render into last activity module and email
This commit is contained in:
parent
0cd1699c04
commit
7c342e174a
@ -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)
|
||||
--------------------------
|
||||
|
1492
protected/humhub/libs/EmojiMap.php
Normal file
1492
protected/humhub/libs/EmojiMap.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user