diff --git a/composer.json b/composer.json index cfc03959aa..9c0268ec53 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "bower-asset/imagesloaded": "*", "bower-asset/jquery-timeentry": "^2.0", "bower-asset/caret.js": "0.2.2", - "npm-asset/humhub-prosemirror-richtext": "^1.0.6", + "npm-asset/humhub-prosemirror-richtext": "^1.0.7", "npm-asset/at.js": "^1.5.1", "yiisoft/yii2-queue": "~2.0.0", "yiisoft/yii2-redis": "~2.0.0", diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index 62a97cddd1..6167d46c61 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -9,7 +9,8 @@ HumHub Change Log - Fix: Click to topics lead on streams without topic filter throws javascript error. (https://github.com/humhub/humhub-modules-polls/issues/49) - Fix: Existing files may cause NULL pointer exception - Fix: Newly created profile fields cannot be updated - +- Enh: Added `AbstractRichTextEditor::layout` in order to change richtext style +- Enh: Added `block` type RichText for non focus menu style 1.3.0-beta.3 (July 30, 2018) ----------------------------- diff --git a/protected/humhub/modules/comment/views/comment/edit.php b/protected/humhub/modules/comment/views/comment/edit.php index 53e967d3b3..7b33045d57 100644 --- a/protected/humhub/modules/comment/views/comment/edit.php +++ b/protected/humhub/modules/comment/views/comment/edit.php @@ -23,6 +23,7 @@ $submitUrl = Url::to(['/comment/comment/edit', 'id' => $comment->id, 'contentMod
field($comment, 'message')->widget(RichTextField::class, [ 'id' => 'comment_input_'.$comment->id, + 'layout' => RichTextField::LAYOUT_INLINE, 'placeholder' => Yii::t('CommentModule.views_edit', 'Edit your comment...'), 'focus' => true ])->label(false) ?> diff --git a/protected/humhub/modules/comment/widgets/views/form.php b/protected/humhub/modules/comment/widgets/views/form.php index 28b1500237..f85ac89ba5 100644 --- a/protected/humhub/modules/comment/widgets/views/form.php +++ b/protected/humhub/modules/comment/widgets/views/form.php @@ -23,6 +23,7 @@ $submitUrl = Url::to(['/comment/comment/post']);
'newCommentForm_' . $id, + 'layout' => RichTextField::LAYOUT_INLINE, 'pluginOptions' => ['maxHeight' => '300px'], 'placeholder' => Yii::t('CommentModule.widgets_views_form', 'Write a new comment...'), 'name' => 'message' diff --git a/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php b/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php index dd000414e7..5893921261 100644 --- a/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php +++ b/protected/humhub/modules/content/widgets/richtext/AbstractRichTextEditor.php @@ -46,11 +46,20 @@ use yii\helpers\Url; */ class AbstractRichTextEditor extends JsInputWidget { + const LAYOUT_BLOCK = 'block'; + + const LAYOUT_INLINE = 'inline'; + /** * @var string richtext feature preset e.g: 'markdown', 'normal', 'full' */ public $preset; + /** + * @var string defines the style/layout of the richtext + */ + public $layout = self::LAYOUT_BLOCK; + /** * Can be used to overwrite the default placeholder. * @@ -131,14 +140,9 @@ class AbstractRichTextEditor extends JsInputWidget */ public $label = false; - /** - * @var [] renderer class definition - */ - public static $renderer; - - /** - * @inhertidoc - */ + /** + * @inhertidoc + */ public function run() { $inputOptions = $this->getInputAttributes(); @@ -160,6 +164,11 @@ class AbstractRichTextEditor extends JsInputWidget return $input . $richText . $this->prepend(); } + /** + * @var [] renderer class definition + */ + public static $renderer; + /** * This method can be overwritten in order to prepend content after the actual rich text content. * @return string diff --git a/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichTextEditor.php b/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichTextEditor.php index f7dae6f40c..97a7b93cd8 100644 --- a/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichTextEditor.php +++ b/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichTextEditor.php @@ -32,7 +32,7 @@ class ProsemirrorRichTextEditor extends AbstractRichTextEditor /** * @var string defines the editor style, which will be added as class attribute */ - public $menuClass = self::MENU_CLASS_FOCUS; + public $menuClass; public static $renderer = [ 'class' => ProsemirrorRichText::class @@ -40,8 +40,11 @@ class ProsemirrorRichTextEditor extends AbstractRichTextEditor public function init() { - if($this->menuClass === static::MENU_CLASS_PLAIN) { + if($this->layout === static::LAYOUT_BLOCK) { $this->exclude[] = 'resizeNav'; + $this->menuClass = static::MENU_CLASS_PLAIN; + } else { + $this->menuClass = static::MENU_CLASS_FOCUS; } parent::init(); diff --git a/protected/humhub/modules/post/views/post/edit.php b/protected/humhub/modules/post/views/post/edit.php index f55595ea4f..167cf6cd01 100644 --- a/protected/humhub/modules/post/views/post/edit.php +++ b/protected/humhub/modules/post/views/post/edit.php @@ -19,6 +19,7 @@ $submitUrl = $post->content->container->createUrl('/post/post/edit', ['id' => $p
field($post, 'message')->widget(RichTextField::class, [ 'id' => 'post_input_'. $post->id, + 'layout' => RichTextField::LAYOUT_INLINE, 'pluginOptions' => ['maxHeight' => '300px'], 'placeholder' => Yii::t('PostModule.views_edit', 'Edit your post...') ])->label(false) ?> diff --git a/protected/humhub/modules/post/widgets/views/form.php b/protected/humhub/modules/post/widgets/views/form.php index cb3c5c9f64..d2ec3bb751 100644 --- a/protected/humhub/modules/post/widgets/views/form.php +++ b/protected/humhub/modules/post/widgets/views/form.php @@ -6,6 +6,7 @@ use humhub\modules\content\widgets\richtext\RichTextField; 'contentForm_message', + 'layout' => RichTextField::LAYOUT_INLINE, 'pluginOptions' => ['maxHeight' => '300px'], 'placeholder' => Yii::t("PostModule.widgets_views_postForm", "What's on your mind?"), 'name' => 'message', diff --git a/static/less/richtext.less b/static/less/richtext.less index eeec354ab1..15c38351e7 100644 --- a/static/less/richtext.less +++ b/static/less/richtext.less @@ -234,7 +234,7 @@ position: relative; min-height: 1em; color: #666; - padding: 1px 6px; + padding: 1px 6px 1px 0; top: 0; left: 0; right: 0; z-index: 10; -moz-box-sizing: border-box;