From 346c29fdf212d3482f57347e2eb9338c229dfe52 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Mon, 20 Jan 2020 17:09:00 +0100 Subject: [PATCH] - Fix #3803: Invalid editor preset handling - Fix: Invalid editor placeholder handling --- protected/humhub/docs/CHANGELOG_DEV.md | 2 ++ .../content/widgets/richtext/AbstractRichText.php | 9 +++++++-- .../widgets/richtext/AbstractRichTextEditor.php | 10 ++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/protected/humhub/docs/CHANGELOG_DEV.md b/protected/humhub/docs/CHANGELOG_DEV.md index d00b50e9d4..b3ba46e3d3 100644 --- a/protected/humhub/docs/CHANGELOG_DEV.md +++ b/protected/humhub/docs/CHANGELOG_DEV.md @@ -27,6 +27,8 @@ HumHub Change Log (DEVELOP) - Enh: Notification targets can be deactivated or overwritten by configuration - Fix #3810: Print Media Cluttered by HREF Content - Enh: Added further print style enhancements +- Fix #3803: Invalid editor preset handling +- Fix: Invalid editor placeholder handling 1.4.0-beta.2 ------------ diff --git a/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php b/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php index 72979bd223..cc6a05d273 100644 --- a/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php +++ b/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php @@ -156,14 +156,19 @@ abstract class AbstractRichText extends JsWidget */ public function getData() { - return [ + $result = [ 'exclude' => $this->exclude, 'include' => $this->include, 'plugin-options' => $this->pluginOptions, - 'preset' => $this->preset, 'edit' => $this->edit, 'ui-richtext' => true ]; + + if(!empty($this->preset)) { + $result['preset'] = $this->preset; + } + + return $result; } /** diff --git a/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php b/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php index 77f7537843..8e0c6e43c3 100644 --- a/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php +++ b/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php @@ -238,12 +238,18 @@ class AbstractRichTextEditor extends JsInputWidget 'exclude' => $this->exclude, 'include' => $this->include, 'mentioning-url' => $this->getMentioningUrl(), - 'placeholder' => $this->placeholder, 'plugin-options' => $this->pluginOptions, - 'preset' => $this->preset, 'focus' => $this->focus ]; + if(!empty($this->preset)) { + $result['preset'] = $this->preset; + } + + if(!empty($this->placeholder)) { + $result['placeholder'] = $this->placeholder; + } + if ($this->disabled) { $result['disabled'] = true; $result['disabled-text'] = $this->disabledText;