awcodes/richer-editor
Enhance Filament’s Rich Editor with a suite of plugins and tools—embeds, emojis, fullscreen, links, source code, IDs, debugging, faker content, and Shiki code blocks. Designed to extend the editor experience in Filament 4/5.
composer require awcodes/richer-editor
resources/css/app.css or filament.css):
@import '../../../../vendor/awcodes/richer-editor/resources/css/index.css';
@source '../../../../vendor/awcodes/richer-editor/resources/views/**/*.blade.php';
use Awcodes\RicherEditor\Plugins\EmbedPlugin;
use Awcodes\RicherEditor\Plugins\LinkPlugin;
RichEditor::make('content')
->plugins([
EmbedPlugin::make(),
LinkPlugin::make(),
])
->toolbarButtons(['embed', 'link'])
Add a rich editor to a Filament resource:
use Filament\Forms\Components\RichEditor;
use Awcodes\RicherEditor\Plugins\EmojiPlugin;
RichEditor::make('description')
->plugins([
EmojiPlugin::make(),
])
->toolbarButtons(['emoji'])
EmbedPlugin for YouTube, SourceCodePlugin for syntax highlighting).RichEditor component:
RichEditor::make('content')
->plugins([
EmbedPlugin::make(),
SourceCodePlugin::make(),
])
->toolbarButtons(['embed', 'sourceCode'])
Organize tools into collapsible groups for cleaner UIs:
use Awcodes\RicherEditor\Tools\ToolGroup;
RichEditor::make('content')
->tools([
ToolGroup::make('formatting')
->label('Formatting')
->icon('heroicon-o-text')
->items(['bold', 'italic', 'underline']),
])
->toolbarButtons(['formatting'])
Convert rich content to HTML/Markdown:
// HTML output
$html = RichContentRenderer::make($content)->toHtml();
// Markdown output
$markdown = RichContentRenderer::make($content)->toMarkdown();
Generate mock rich content for testing:
$fakeContent = RichContentFaker::make()
->heading(level: 2)
->paragraphs(count: 3)
->asHtml();
Missing CSS imports:
@import for the package’s CSS will break styling.index.css is imported in your theme.Plugin conflicts:
DebugPlugin, FakerPlugin) are local-only and will throw errors in production.if (app()->environment('local')) {
RichEditor::make('content')->plugins([DebugPlugin::make()]);
}
ToolGroup dropdowns:
Syntax highlighting:
PhikiCodeBlockPlugin is not database-compatible—use only for frontend rendering.DebugPlugin (local-only) to see registered tools:
DebugPlugin::make()->showToolbarButtons(true)
SourceCodePlugin may fail on malformed tags. Validate input with:
SourceCodePlugin::make()->validateTags(true)
Custom blocks:
Extend HighlightedCodeBlock for new syntax themes:
class CustomCodeBlock extends HighlightedCodeBlock {
public function getTheme(): string {
return Theme::Dracula;
}
}
Toolbar customization:
Override default buttons via toolbarButtons():
->toolbarButtons(['customButton', 'embed'])
Faker customization:
Add custom blocks to RichContentFaker:
RichContentFaker::make()->customBlock(
id: 'alert',
config: ['type' => 'warning']
)
toMarkdown() in loops: It’s computationally expensive. Cache results if reused.IdPlugin is enabled if using LinkPlugin for anchor links.defer() for heavy plugins:
RichEditor::make('content')
->plugins([EmbedPlugin::make()->defer()])
How can I help you explore Laravel packages today?