jeffersongoncalves/filament-ace-editor-field
Filament v5 form field that embeds the Ace code editor. Adds syntax-highlighted editing with configurable language modes, themes, height, and placeholder support for a richer code/text input experience in Laravel admin panels.
Pros:
make(), rules(), extraAttributes()). Reduces friction in adoption.monokai, github), editor modes, and UI customization (height, placeholders) via PHP methods.required(), maxLength()) and Laravel rules (e.g., json, active_url).Cons:
Purifier or custom middleware) to mitigate XSS risks.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Filament Version Mismatch | High | Pin to a specific Filament version (e.g., ^5.3) in composer.json to avoid breaking changes. Monitor Filament’s upgrade guide. |
| Ace Editor Deprecation | Medium | Evaluate migration path to Monaco Editor (VS Code’s engine) if Ace Editor becomes unsupported. Track Filament’s roadmap for native editor support. |
| XSS Vulnerabilities | High | Implement server-side sanitization (e.g., Purifier for HTML, json_decode() for JSON) and restrict editor modes (e.g., mode('html') only). |
| Performance Impact | Low | Test in staging with realistic form loads. Consider lazy-loading the editor if critical. |
| Customization Limits | Low | Document workarounds for theming/UI tweaks (e.g., overriding Ace’s CSS via Filament’s extraAttributes()). |
| Laravel 13+ Compatibility | Low | Confirmed support for Laravel 13.x (via Testbench v11.0). Monitor for future Laravel major versions. |
html only).Purifier for HTML, json_decode() for JSON).text or longText columns).validationRules() and Laravel’s built-in validators (e.g., json, active_url).actingAs(), fill()).composer require jeffersongoncalves/filament-ace-editor-field:^2.0
php artisan vendor:publish --tag=filament-ace-editor-field-config
config/filament-ace-editor-field.php:
return [
'default_mode' => 'html',
'default_theme' => 'monokai',
];
AceEditorInput:
use JeffersonGoncalves\Filament\AceEditorField\Forms\Components\AceEditorInput;
AceEditorInput::make('email_template')
->mode('html')
->theme('github')
->height(400)
->validationRules(['required', 'max:5000'])
->placeholder('Enter HTML for your email template'),
use Illuminate\Validation\Rules\File;
public static function rules(): array
{
return [
'email_template' => ['required', 'string', 'max:5000', function ($attribute, $value, $fail) {
// Custom sanitization logic (e.g., Purifier for HTML)
if (str_contains($value, '<script>')) {
$fail('Scripts are not allowed.');
}
}],
];
}
How can I help you explore Laravel packages today?