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

Ace Laravel Package

contao-components/ace

Contao integration for the Ace code editor. Provides backend-ready assets and configuration to embed a powerful in-browser editor with syntax highlighting, themes, and advanced editing features in Contao projects.

View on GitHub
Deep Wiki
Context7

ACE editor integration

Frequently asked questions about Ace
Can I use contao-components/ace for frontend content editing in Contao (e.g., WYSIWYG blocks or custom fields)?
Yes, this package is designed for Contao’s frontend and backend. For frontend use, load ACE via `assets.json` (Contao 4+) or `addJsFile()` in your template. It works well with `ContentElement` or custom DCA fields where inline editing is needed. Ensure your Contao version supports dynamic asset loading.
How do I integrate ACE into a Contao backend module or DCA field (e.g., tl_content or tl_form_field)?
Extend your DCA field with the `aceEditor` eval attribute. For example, add `'eval' => ['aceEditor']` to your field definition in `$GLOBALS['TL_DCA']`. This triggers the editor automatically in the Contao backend. Clear caches (`tl_cache::clearAll()`) after changes to see updates.
Is contao-components/ace compatible with Contao 5, or only Contao 4? Does it support Contao’s new asset pipeline?
This package primarily targets Contao 4, but basic integration may work in Contao 5 if you manually handle assets (e.g., via `addJsFile()`). Contao 5’s asset pipeline is more strict, so test thoroughly. For Contao 5, consider bundling ACE via a CDN or custom build step to avoid conflicts with the new system.
What Laravel versions or frameworks can use this package outside Contao? Can it work with Laravel Mix/Vite?
While built for Contao, you can use the ACE editor in Laravel by manually including its JS/CSS files. Bundle ACE with Laravel Mix or Vite by adding it to your `resources/js` or `public/js` folders. Use Blade directives (e.g., `@if(auth()->check())`) to conditionally load it for admin panels or custom admin interfaces like Filament or Nova.
Are there security risks using ACE in Contao, especially with user-generated content (e.g., XSS)?
Yes, ACE processes raw input, so always sanitize user-generated content before passing it to the editor. Use Contao’s built-in sanitization functions (e.g., `String::sanitize()`) or HTML purifiers like `HTMLPurifier`. For backend fields, validate input via DCA field types to mitigate risks. Avoid dynamically evaluating user input in ACE’s `setValue()`.
How do I configure ACE themes, syntax highlighting, or other editor settings in Contao?
Use the `ace_editor_config` Twig variable to pass custom settings to the editor. For example, in your template: `{{ ace_editor_config|raw }}`. Configure themes (e.g., `ace/mode/javascript`, `ace/theme/monokai`) via JavaScript or Contao’s `addJsFile()` with a custom initialization script. Check the [ACE docs](http://ace.c9.io/) for available options.
What are the performance implications of using ACE in Contao (e.g., page load time, bundle size)?
ACE’s JS bundle (~300KB) can impact performance, especially on mobile or slow connections. Mitigate this by lazy-loading ACE only on pages where it’s needed (e.g., backend modules or specific frontend sections). Use a CDN to offload delivery, or consider a lighter alternative like CodeMirror if performance is critical.
Does contao-components/ace support real-time collaboration or multi-user editing like modern editors (e.g., Monaco)?
No, ACE does not natively support real-time collaboration. It’s designed for single-user editing. For collaborative features, consider alternatives like Monaco (used in VS Code) or TinyMCE with plugins. ACE’s strength lies in its lightweight, embeddable nature for Contao’s use cases, not multi-user workflows.
Are there alternatives to ACE for Contao that offer better long-term maintenance or modern features?
Yes, alternatives like **CodeMirror**, **Monaco Editor**, or **TinyMCE** may suit your needs better. CodeMirror is actively maintained and offers similar syntax highlighting with a smaller footprint. Monaco (from VS Code) provides advanced features but requires more setup. Evaluate based on your need for Contao integration, performance, and future-proofing.
How do I test contao-components/ace in a staging environment before deploying to production?
Start by implementing ACE in a single Contao field (e.g., a custom `ContentElement` or `FormField`). Test in staging with `TL_MODE=dev` to disable caching and ensure assets load correctly. Verify editor functionality across browsers, including fallback behavior (e.g., textarea if ACE fails to load). Use Contao’s debug tools (`?do=contao&debug=1`) to check for errors.
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.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed