From 3f9f7c4803cebcd47b4bb0e2ed3aafd7080cbaeb Mon Sep 17 00:00:00 2001 From: LT <leetoplayaz@yandex.ru> Date: Fri, 16 Dec 2022 18:12:42 +0300 Subject: [PATCH] tinyMce new methods --- resources/views/fields/tinymce.blade.php | 4 ++-- src/Fields/TinyMce.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/views/fields/tinymce.blade.php b/resources/views/fields/tinymce.blade.php index 9d079d1c2..eb8b5fd6c 100644 --- a/resources/views/fields/tinymce.blade.php +++ b/resources/views/fields/tinymce.blade.php @@ -7,8 +7,8 @@ path_absolute : "/", selector: 'textarea#ckeditor_{{ $field->id() }}', relative_urls: false, - plugins: '{{ $field->plugins }}', - toolbar: '{{ $field->toolbar }}', + plugins: '{{ trim($field->plugins . ' ' . $field->addedPlugins) }}', + toolbar: '{{ trim($field->toolbar . ' ' . $field->addedToolbar) }}', tinycomments_mode: 'embedded', tinycomments_author: '{{ $field->commentAuthor }}', mergetags_list: @json($field->mergeTags), diff --git a/src/Fields/TinyMce.php b/src/Fields/TinyMce.php index 958c3342d..f5971b627 100644 --- a/src/Fields/TinyMce.php +++ b/src/Fields/TinyMce.php @@ -10,8 +10,12 @@ final class TinyMce extends Field public string $plugins = 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed linkchecker a11ychecker tinymcespellchecker permanentpen powerpaste advtable advcode editimage tinycomments tableofcontents footnotes mergetags autocorrect typography inlinecss'; + public string $addedPlugins = ''; + public string $toolbar = 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | addcomment showcomments | spellcheckdialog a11ycheck typography | align lineheight | checklist numlist bullist indent outdent | emoticons charmap | removeformat'; + public string $addedToolbar = ''; + public array $mergeTags = []; public string $commentAuthor = 'Author name'; @@ -51,6 +55,20 @@ public function toolbar(string $toolbar): self return $this; } + public function addPlugins(string $plugins): self + { + $this->addedPlugins = $plugins; + + return $this; + } + + public function addToolbar(string $toolbar): self + { + $this->addedToolbar = $toolbar; + + return $this; + } + protected function token(): string { return config('moonshine.tinymce.token', '');