Download the PHP package animalinstinct/laravel-backpack-editorjs without Composer
On this page you can find all versions of the php package animalinstinct/laravel-backpack-editorjs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download animalinstinct/laravel-backpack-editorjs
More information about animalinstinct/laravel-backpack-editorjs
Files in animalinstinct/laravel-backpack-editorjs
Package laravel-backpack-editorjs
Short Description EditorJS field for the Laravel Backpack
License MIT
Informations about the package laravel-backpack-editorjs
Laravel Backpack EditorJs field
Package adds the editorjs field to the Laravel Backpack admin panel.
https://github.com/animalinstinct/laravel-backpack-editorjs
Dependencies
codex-team/editor.js - Server-side implementation sample for the Editor.js. It contains data validation, HTML sanitization and converts output from Editor.js to the Block objects.
Installation
Run the install script
Configuration
For laravel 9,10
Add the LaravelBackpackEditorJsServiceProvider to the service providers list.
Add middleware to the Backpack base config. The middleware would set context to not use the Laravel-Editor.js parser for the backpack routes.
Usage
In the Backpack controllers, use 'editorjs' as a field type
In the model import the trait, use it, and declare the fields would be used as editorjs fields for the parser could do it's job.
Backup fields
The backup field will be used if the field value is not a valid JSON (for cases when you have another editor before and desire to save it as is). To set that kind a field import EditorJsField trait, use it in your CrudController, the call the trait method EditorJsField::withBackup() in the field type.
The first argument is a current model, then field name and backup field to show instead.