Trix is an open-source WYSIWYG editor from the creators of Basecamp and it’s designed to be a different editor. Here is how they describe it:
Most WYSIWYG editors are wrappers around HTML’s contenteditable and execCommand APIs, designed by Microsoft to support live editing of web pages in Internet Explorer 5.5, and eventually reverse-engineered and copied by other browsers.
Trix sidesteps these inconsistencies by treating contenteditable as an I/O device: when input makes its way to the editor, Trix converts that input into an editing operation on its internal document model, then re-renders that document back into the editor. This gives Trix complete control over what happens after every keystroke, and avoids the need to use execCommand at all.
First, install the Composer package:
composer require te7a-houdini/laravel-trix
Publish the assets:
php artisan vendor:publish --provider="Te7aHoudini\LaravelTrix\LaravelTrixServiceProvider"
Then, run the migrations:
php artisan migrate
Once you’ve installed the package pretend you have an articles Model and you want the Trix editor on it’s create and update forms. All you need to do is use Blade and it’s included directives:
<html> <head> @trixassets </head> <body> <form method="POST" action="route('article.store')"> @csrf @trix(\App\Article::class, 'content') <input type="submit"> </form> </body> </html>
The package includes a lot more features like handling uploaded files, rendering for existing models, and advanced configuration. You can find out more about this package from the Github page and read the full user guide.
***Filed in: News
- Backend Software Engineer (PHP Developer)
Austin TX, Bonita Springs FL
Certified eSupport Corp
- Laravel Developer
Glendale, CA (COVID Remote)
- Full-Stack Engineer (Mid to Senior)
Remote (EST, CST)
- Senior Laravel Developer (AI Applications)
Remote from anywhere in the UK or from our London office
- Full Stack Engineer
Join 31,000+ others and never miss out on new tips, tutorials, and more.
The Hottest Black Friday Deals!
It’s that time of year again. Where you can save huge amounts of money on everything from training courses, to full a…
Laraform – Full-Stack Form Builder for Vue.js & Laravel (sponsor)
Laraform is a full-stack library that supercharges and standardizes the entire form building process. With Laraform y…