1. Go to this page and download the library: Download athphane/filament-editorjs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
athphane / filament-editorjs example snippets
return [
/**
* The profiles to use for the editorjs field.
* The default profile is the default_profile from the config.
*/
'profiles' => [
'default' => [
'header', 'image', 'delimiter', 'list', 'underline', 'quote', 'table',
],
'pro' => [
'header', 'image', 'delimiter', 'list', 'underline', 'quote', 'table',
'raw', 'code', 'inline-code', 'style',
],
],
/**
* The default profile to use for the editorjs field.
*/
'default_profile' => 'default',
/**
* The allowed image mime types for the editorjs field.
*/
'image_mime_types' => [
'image/jpeg',
'image/png',
'image/gif',
'image/tiff',
'image/x-citrix-png',
'image/x-png',
'image/svg+xml',
'image/svg',
],
];
/**
* The name of the field that contains the content for the editorjs field
*/
public function editorJsContentFieldName(): string
{
return 'new_column_name';
}
public function registerMediaCollections(): void
{
$this->registerEditorJsMediaCollections();
}
public function registerMediaConversions(?Media $media = null): void
{
$this->registerEditorJsMediaConversions($media);
}
public function registerMediaCollections(): void
{
$this->registerEditorJsMediaCollections(mime_types: [
'image/jpeg',
'image/png',
'image/gif',
'image/tiff',
'image/x-citrix-png',
'image/x-png',
'image/svg+xml',
'image/svg',
]);
}
public function registerMediaCollections(): void
{
$this->registerEditorJsMediaCollections(generate_responsive_images: false);
}
/**
* The name of the media collection for the editorjs media collection
*/
public function editorjsMediaCollectionName(): string
{
return 'new_media_collection_name';
}
public static function form(Form $form): Form
{
return $form
->schema([
EditorjsTextField::make('content')
->placeholder('Start writing...'),
]);
}