Rich editor and spatie media library

In the docs for the rich text editor in V4 - https://filamentphp.com/docs/4.x/forms/rich-editor#uploading-images-to-the-editor - you can find:
Filament also supports spatie/laravel-medialibrary for storing rich editor file attachments. See our plugin documentation for more information.
But there is no further documentation for this in the corresponding page (https://filamentphp.com/plugins/filament-spatie-media-library#using-media-library-for-rich-editor-file-attachments). Is this a known issue or am I just stupid/blind?
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
Solution:
@awcodes Well I tried this now again with the current documentation provided under https://filamentphp.com/plugins/filament-spatie-media-library#using-media-library-for-rich-editor-file-attachments I copy pasted the code, just renamed the class: ```php...
Jump to solution
3 Replies
awcodes
awcodes3mo ago
It’s in the readme on the 4.x branch of the plugin. Right now you’d need to look at it in GitHub.
Solution
bernhard
bernhard4w ago
@awcodes Well I tried this now again with the current documentation provided under https://filamentphp.com/plugins/filament-spatie-media-library#using-media-library-for-rich-editor-file-attachments I copy pasted the code, just renamed the class:
use Filament\Forms\Components\RichEditor\FileAttachmentProviders\SpatieMediaLibraryFileAttachmentProvider;
use Filament\Forms\Components\RichEditor\Models\Concerns\InteractsWithRichContent;
use Filament\Forms\Components\RichEditor\Models\Contracts\HasRichContent;
use Illuminate\Database\Eloquent\Model;

class Page extends Model implements HasRichContent
{
use InteractsWithRichContent;

public function setUpRichContent(): void
{
$this->registerRichContent('content')
->fileAttachmentsProvider(SpatieMediaLibraryFileAttachmentProvider::make());
}
}
use Filament\Forms\Components\RichEditor\FileAttachmentProviders\SpatieMediaLibraryFileAttachmentProvider;
use Filament\Forms\Components\RichEditor\Models\Concerns\InteractsWithRichContent;
use Filament\Forms\Components\RichEditor\Models\Contracts\HasRichContent;
use Illuminate\Database\Eloquent\Model;

class Page extends Model implements HasRichContent
{
use InteractsWithRichContent;

public function setUpRichContent(): void
{
$this->registerRichContent('content')
->fileAttachmentsProvider(SpatieMediaLibraryFileAttachmentProvider::make());
}
}
and now i get:
Call to undefined method Filament\Forms\Components\RichEditor\RichContentAttribute::fileAttachmentsProvider()
Call to undefined method Filament\Forms\Components\RichEditor\RichContentAttribute::fileAttachmentsProvider()
I have no idea whats wrong?
bernhard
bernhardOP4w ago
Ah, nevermind. Its a typo in the docs. Its fileAttachmentProvider not fileAttachmentsProvider

Did you find this page helpful?