diff --git a/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php b/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php index d56d9fce4f..71a6395b22 100644 --- a/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php +++ b/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php @@ -53,6 +53,8 @@ use yii\base\InvalidArgumentException; */ abstract class AbstractRichText extends JsWidget { + const PRESET_DOCUMENT = 'document'; + /** * @event Event an event raised after the post-process phase of the rich text. */ diff --git a/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichText.php b/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichText.php index c68c474d13..b91638a4ea 100644 --- a/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichText.php +++ b/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichText.php @@ -154,7 +154,7 @@ class ProsemirrorRichText extends AbstractRichText } } - $this->text = static::parseMentionings($this->text, $this->edit); + $this->text = $this->parseOutput(); if ($this->maxLength > 0) { $this->text = Helpers::truncateText($this->text, $this->maxLength); @@ -168,6 +168,14 @@ class ProsemirrorRichText extends AbstractRichText } + /** + * @since v1.3.2 + */ + protected function parseOutput() + { + return static::parseMentionings($this->text, $this->edit); + } + /** * @return string truncated and stripped text */ @@ -215,9 +223,13 @@ class ProsemirrorRichText extends AbstractRichText return $container->isActive() ? '['.Html::encode($container->getDisplayName()).'](mention:'.$container->guid.' "'.$container->getUrl().'")' : $notFoundResult; - } elseif($container instanceof Space) { + } + + if($container instanceof Space) { return '['.Html::encode($container->name).'](mention:'.$container->guid.' "'.$container->getUrl().'")'; } + + return ''; }); }