From a69eb9a7c09a658b3f51766f09be2c988da605e6 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 4 Oct 2023 18:29:54 +0300 Subject: [PATCH] move editor to config --- src/Configuration.php | 9 +++++++++ src/Filament/Resources/PageResource.php | 2 +- src/Filament/Resources/PostResource.php | 2 +- src/Models/Post.php | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Configuration.php b/src/Configuration.php index 8d51121..209e16f 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -34,6 +34,8 @@ trait Configuration /** * you can overwrite any model and use your own + * + * @deprecated deprecated since version 3.2 */ protected array $skyModels = []; @@ -43,6 +45,7 @@ trait Configuration * \LaraZeus\Sky\Editors\TinyEditor::class, * \LaraZeus\Sky\Editors\MarkdownEditor::class, * \LaraZeus\Sky\Editors\RichEditor::class, + * @deprecated deprecated since version 3.2 */ protected string $editor = Editors\MarkdownEditor::class; @@ -187,6 +190,9 @@ public static function getModel(string $model): string )[$model]; } + /* + * @deprecated deprecated since version 3.2 + */ public function editor(string $editor): static { $this->editor = $editor; @@ -194,6 +200,9 @@ public function editor(string $editor): static return $this; } + /* + * @deprecated deprecated since version 3.2 + */ public function getEditor(): string { return $this->editor; diff --git a/src/Filament/Resources/PageResource.php b/src/Filament/Resources/PageResource.php index 8443584..5cbde44 100644 --- a/src/Filament/Resources/PageResource.php +++ b/src/Filament/Resources/PageResource.php @@ -72,7 +72,7 @@ public static function form(Form $form): Form ->afterStateUpdated(function (Set $set, $state) { $set('slug', Str::slug($state)); }), - SkyPlugin::get()->getEditor()::component(), + config('zeus-sky.editor')::component(), ]), Tabs\Tab::make(__('SEO'))->schema([ Hidden::make('user_id') diff --git a/src/Filament/Resources/PostResource.php b/src/Filament/Resources/PostResource.php index a28c15a..dc24e32 100644 --- a/src/Filament/Resources/PostResource.php +++ b/src/Filament/Resources/PostResource.php @@ -65,7 +65,7 @@ public static function form(Form $form): Form $set('slug', Str::slug($state)); }), - SkyPlugin::get()->getEditor()::component() + config('zeus-sky.editor')::component() ->label(__('Post Content')), ]), diff --git a/src/Models/Post.php b/src/Models/Post.php index 88ec8ca..fffb276 100644 --- a/src/Models/Post.php +++ b/src/Models/Post.php @@ -123,7 +123,7 @@ protected function requirePassword(): Attribute public function getContent(): string { //todo - return $this->parseContent(SkyPlugin::get()->getEditor()::render($this->content)); + return $this->parseContent(config('zeus-sky.editor')::render($this->content)); } public function parseContent(string $content): string