oliwol/filament-rich-editor-heroicons
Filament v4/v5 plugin for RichEditor (TipTap) that adds a searchable Heroicons picker. Insert inline SVG icons (outline/solid/mini) into content with configurable size, alignment, and color, and render them via RichContentRenderer.
composer require oliwol/filament-rich-editor-heroicons
RichEditor component:
use Oliwol\FilamentRichEditorHeroicons\FilamentRichEditorHeroicons;
RichEditor::make('content')
->toolbarButtons([
'bold', 'italic', 'addHeroicon', // Add the heroicon button
])
->plugins([
FilamentRichEditorHeroicons::make(),
]);
addHeroicon toolbar button, search for an icon (e.g., bell), select a style (e.g., outline), and insert it into the editor.Content Creation Workflow:
addHeroicon button in the RichEditor toolbar to open the modal.arrow, check-circle) and preview them in the dropdown.Rendering Stored Content:
RichContentRenderer to render saved content with icons in Blade views or model accessors:
RichContentRenderer::make($this->html)
->plugins([
FilamentRichEditorHeroicons::make(),
]);
Customizing Icon Behavior:
outline and solid):
FilamentRichEditorHeroicons::make()
->styles(['outline', 'solid']);
FilamentRichEditorHeroicons::make()
->defaultSize('lg')
->sizes([
'sm' => 16,
'md' => 24,
'lg' => 32,
'xl' => 48,
]);
addHeroicon button logically in the toolbar (e.g., near other formatting tools like bold or italic).aria-label="warning" for a exclamation-circle icon).php artisan vendor:publish --tag="filament-rich-editor-heroicons-translations"
Missing Plugin Registration:
FilamentRichEditorHeroicons::make() to the plugins() array of RichEditor will prevent the heroicon button from working.RichContentRenderer for rendering.Unrendered Icons:
RichContentRenderer is not configured to include the plugin when rendering saved content.RichContentRenderer:
RichContentRenderer::make($html)->plugins([FilamentRichEditorHeroicons::make()]);
Style or Size Mismatches:
styles() and sizes() configurations match the expected Heroicon styles (e.g., outline, solid, mini).SVG Sanitization Issues:
fill, aria-hidden).Toolbar Button Visibility:
addHeroicon button may not appear if not explicitly added to toolbarButtons().'addHeroicon' in the toolbarButtons() array.F12) to inspect errors related to the Heroicons script or TipTap extensions.data-* attributes (e.g., data-icon, data-svg) when rendered.FilamentRichEditorHeroicons::make() // No customizations
Custom Icon Sets:
HeroiconPicker component or creating a custom TipTap extension.Dynamic Icon Properties:
HeroiconPicker class.Additional Attributes:
data-tooltip) by extending the TipTap node or SVG rendering logic.Theming:
heroicon-picker-modal).#000000). Customize via the modal or by overriding the color picker logic.alignment="left" or alignment="right" may require additional CSS to handle block-level behavior consistently.How can I help you explore Laravel packages today?