Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MarkdownEditor.php #149

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Editors/MarkdownEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace LaraZeus\Sky\Editors;

use Filament\Forms\Components\Component;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Textarea;
use LaraZeus\Sky\Classes\ContentEditor;
use Spatie\FilamentMarkdownEditor\MarkdownEditor as MarkdownEditorAlias;

class MarkdownEditor implements ContentEditor
{
public static function component(): Component
{
if (class_exists(MarkdownEditorAlias::class)) {
return MarkdownEditorAlias::make('content')
if (class_exists(RichEditor::class)) {
return RichEditor::make('content')
->required();
}

Expand All @@ -21,7 +21,7 @@ public static function component(): Component

public static function render(string $content): string
{
if (class_exists(MarkdownEditorAlias::class)) {
if (class_exists(RichEditor::class)) {
return str($content)->markdown();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public static function form(Form $form): Form

$set('slug', Str::slug($state));
}),
SkyPlugin::get()->getEditor()::component(),
SkyPlugin::get()->getEditor()::component()
->label(__('Post Content')),
]),

Tabs\Tab::make(__('SEO'))->schema([
Expand Down