Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Richer Editor Laravel Package

awcodes/richer-editor

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Filament-native: Seamlessly integrates with Filament’s RichEditor component, leveraging its existing architecture (plugins, tools, and rendering pipelines).
    • Modular design: Plugins (e.g., EmbedPlugin, HighlightedCodeBlock) are decoupled, allowing selective adoption without bloating the editor.
    • Extensible: Supports custom blocks (e.g., HighlightedCodeBlock) and tools (e.g., ToolGroup), enabling domain-specific extensions (e.g., analytics annotations).
    • Rendering flexibility: Offers multiple output formats (toHtml(), toMarkdown(), TableOfContents), aligning with Laravel’s templating (Blade) and API-first needs.
    • Theming support: Integrates with Phiki for syntax-highlighted code blocks, reducing reliance on third-party libraries like Prism.js.
  • Cons:

    • Filament dependency: Tight coupling to Filament’s RichEditor may limit reuse in non-Filament Laravel apps (though Filament is a dominant admin framework).
    • Experimental plugins: Features like CodeBlockShikiPlugin or VideoPlugin are marked experimental, requiring validation for production use.
    • CSS/Blade integration: Requires manual theme setup (e.g., @import in app.css), adding minor dev overhead.

Integration Feasibility

  • Laravel/PHP Compatibility:
    • High: Built for Laravel 10+/Filament 4.x/5.x, with PHP 8.1+ support (aligned with modern Laravel stacks).
    • Dependencies: Lightweight (e.g., phiki for code blocks, league/html-to-markdown for conversion), avoiding heavy JS bundles.
  • Database Considerations:
    • Rich content storage: Uses Filament’s RichContent model, ensuring compatibility with Laravel’s Eloquent and database migrations.
    • Custom blocks: May require schema updates if storing block-specific config (e.g., HighlightedCodeBlock themes).
  • Frontend Stack:
    • No JS framework lock-in: Uses Filament’s Alpine.js/Vue integration, but no React/Angular dependencies.
    • Asset pipeline: CSS/JS assets are auto-loaded via Filament’s resource system, reducing manual build steps.

Technical Risk

  • Low-Medium:
    • Proven stability: 10+ releases with minor fixes (e.g., UTF-8 support, dropdown shifts), suggesting maturity.
    • Dependency risks:
      • phiki (code blocks) and league/html-to-markdown are stable but may introduce minor breaking changes.
      • Experimental plugins could require patches for edge cases (e.g., nested embeds).
    • Performance:
      • Rendering: toHtml() with custom blocks may add ~10–30ms latency (negligible for most use cases).
      • Faker tool: Local-only FakerPlugin avoids runtime overhead in production.
    • Security:
      • XSS risks: Mitigated by Filament’s built-in sanitization, but custom blocks (e.g., HighlightedCodeBlock) should validate input (e.g., Phiki’s Theme enum).
      • Embeds: EmbedPlugin uses iframe sandboxes; validate allowed domains (e.g., YouTube, Vimeo).

Key Questions

  1. Feature Prioritization:
    • Which plugins/tools are critical for MVP (e.g., EmbedPlugin vs. TableOfContents)?
    • Are experimental plugins (e.g., VideoPlugin) acceptable for Phase 1, or should they be deferred?
  2. Customization Needs:
    • Will custom blocks/tools require extending the package (e.g., overriding HighlightedCodeBlock)?
    • Are there UI/UX gaps (e.g., missing toolbar icons, accessibility issues)?
  3. Rendering Workflow:
    • Should toMarkdown() be used for API responses, or is toHtml() sufficient?
    • How will TableOfContents be surfaced (e.g., as a sidebar component)?
  4. Maintenance:
    • Who will handle updates (e.g., Phiki version bumps)?
    • Are there plans to contribute fixes upstream (e.g., for SourceCodePlugin UTF-8 issues)?
  5. Testing:
    • Are there Filament-specific tests (e.g., form submission/rendering cycles)?
    • How will edge cases (e.g., nested lists in FakerPlugin) be validated?

Integration Approach

Stack Fit

  • Primary Use Case: Filament Admin Panels in Laravel apps requiring advanced rich-text editing (e.g., CMS, docs, or internal tools).
  • Secondary Use Case: Standalone Laravel apps using Filament’s RichEditor (e.g., SaaS platforms with user-generated content).
  • Anti-Patterns:
    • Avoid for frontend-heavy apps (e.g., React/Vue SPAs) where TinyMCE/CKEditor may be preferred.
    • Not suitable for headless CMS where Markdown-first workflows dominate.

Migration Path

  1. Assessment Phase:
    • Audit existing rich-text fields (e.g., ckeditor, trix) to identify gaps (e.g., missing tables, code blocks).
    • Map Filament versions (e.g., v4.x vs. v5.x) to ensure compatibility.
  2. Pilot Integration:
    • Start with a single resource (e.g., Page model) to test:
      • Plugin stability (e.g., EmbedPlugin + YouTube links).
      • Rendering consistency (toHtml() vs. toMarkdown()).
    • Use FakerPlugin for test data generation (local-only).
  3. Incremental Rollout:
    • Phase 1: Core plugins (Embed, Link, SourceCode) + custom blocks (e.g., HighlightedCodeBlock).
    • Phase 2: Experimental features (e.g., TableOfContents) after validation.
    • Phase 3: Custom tools (e.g., ToolGroup for domain-specific actions).
  4. Fallback Plan:
    • If integration fails, revert to Filament’s native RichEditor or use a lightweight alternative like trix.

Compatibility

Component Compatibility Mitigation
Filament Version v4.x (v1.x) / v5.x (v2.x) Pin to exact minor version (e.g., filament/filament:^5.0).
Laravel Version 10.x+ (tested) Use ^10.0 in composer.json to avoid breaking changes.
Database Eloquent RichContent fields No changes needed; uses Filament’s default storage.
Frontend Alpine.js/Vue (Filament’s default) No conflicts; assets auto-loaded via Filament’s resource system.
Custom Blocks Requires RichContentRenderer configuration Document block schemas (e.g., HighlightedCodeBlock themes) in DB migrations.
Experimental Plugins VideoPlugin, CodeBlockShikiPlugin (unstable) Disable in production until tested.

Sequencing

  1. Setup:
    • Install via Composer: composer require awcodes/richer-editor.
    • Add CSS/Blade imports to resources/css/app.css or Filament’s theme.
    • Publish assets if using custom themes: php artisan vendor:publish --tag=richer-editor.
  2. Configuration:
    • Extend RichEditor in a Form component (e.g., app/Filament/Resources/PageResource.php):
      use Awcodes\RicherEditor\Plugins\EmbedPlugin;
      RichEditor::make('content')
          ->plugins([EmbedPlugin::make()])
          ->toolbarButtons(['embed']);
      
  3. Rendering:
    • Configure RichContentRenderer in a Service Provider or Controller:
      use Awcodes\RicherEditor\Blocks\HighlightedCodeBlock;
      RichContentRenderer::make($content)
          ->customBlocks([HighlightedCodeBlock::class => ['light' => Theme::GithubLight]])
          ->toHtml();
      
  4. Testing:
    • Validate:
      • Plugin functionality (e.g., embeds render correctly).
      • Custom blocks persist in DB and render accurately.
      • Edge cases (e.g., nested lists, special characters).

Operational Impact

Maintenance

  • Pros:
    • MIT License: Allows modifications without legal constraints.
    • Active Development: Regular releases (monthly) with dependency updates.
    • Filament Alignment: Bug fixes will align with Filament’s roadmap.
  • Cons:
    • Dependency Management:
      • Monitor phiki and league/html-to-markdown for breaking changes.
      • Pin versions in composer.json to avoid surprises.
    • Custom Code:
      • Extensions (e.g., custom blocks) require manual updates
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle