Skip to content

Commit

Permalink
move editor to config
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Oct 4, 2023
1 parent f6e5408 commit a69eb9a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ trait Configuration

/**
* you can overwrite any model and use your own
*
* @deprecated deprecated since version 3.2
*/
protected array $skyModels = [];

Expand All @@ -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;

Expand Down Expand Up @@ -187,13 +190,19 @@ public static function getModel(string $model): string
)[$model];
}

/*
* @deprecated deprecated since version 3.2
*/
public function editor(string $editor): static
{
$this->editor = $editor;

return $this;
}

/*
* @deprecated deprecated since version 3.2
*/
public function getEditor(): string
{
return $this->editor;
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
]),

Expand Down
2 changes: 1 addition & 1 deletion src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a69eb9a

Please sign in to comment.