Download the PHP package pathfindermediagroup/nova-froala-field without Composer
On this page you can find all versions of the php package pathfindermediagroup/nova-froala-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pathfindermediagroup/nova-froala-field
More information about pathfindermediagroup/nova-froala-field
Files in pathfindermediagroup/nova-froala-field
Package nova-froala-field
Short Description A Laravel Nova Froala WYSIWYG Editor Field.
License MIT
Homepage https://github.com/pathfindermediagroup/nova-froala-field
Informations about the package nova-froala-field
This package is abandoned
As of October 2022 we have made the decision to migrate away from Froala. Froala has still not given any concrete plans to migrate to Vue3. Without Vue3 we cannot migrate to Nova 4, and thus we made the decision to migrate to another editor.
Feel free to fork this repository if you want to keep updating it.
Froala WYSIWYG Editor field for Laravel Nova
Introduction
This is a fork of the original froala/nova-froala-field
repository. The original is no longer maintained. I created this fork because our company needs a working version of Froala in Nova. This fork contains an updated version of Froala (v4) without 3rd party plugin support (you can read here why).
Upgrading from v3 to v4
This version has some new minimum requirements:
PHP
^8.0laravel/framework
^9.0laravel/nova
^3.0league/flysystem
^3.0 (default with Laravel 9)
You may replace "froala/nova-froala-field": "^3.x"
with "pathfindermediagroup/nova-froala-field": "^4.0"
in your composer.json
if you were using the old version from Froala. Just make sure to force publish the new assets like so:
You may also remove the public/vendor/nova/froala
folder from your project, as it is no longer needed or supported.
Froala WYSIWYG Editor Field
Full support of attaching Images, Files and Videos
Notifications for Froala events are handled by Toasted which is provided in Nova by default.
Installation
You can install the package into a Laravel application that uses Nova via composer:
Usage
Just use the Froala\NovaFroalaField\Froala
field in your Nova resource:
Override Config Values
To change any of config values for froala field, publish a config file:
Customize Editor Options
For changing any Available Froala Option
edit nova.froala-field.options
value:
If you want to set options only to specific field, just pass them to options
method:
Attachments
Nova Froala Field provides native attachments driver which works similar to Trix File Uploads, but with ability to optimize images and preserve file names.
Also you have an ability to switch to the trix
driver to use its upload system.
- It's Recommended to use
froala
driver (enabled by default) to be able to use current and future additional features for attachments, provided by Froala.
Froala Driver
To use froala
driver, publish and run a migration:
Trix Driver
If previously you have used Trix attachments and you want to preserve behavior with same tables and handlers
you can use trix
driver in config file:
Attachments Usage
To allow users to upload images, files and videos, just like with Trix field, chain the withFiles
method onto the field's definition. When calling the withFiles
method, you should pass the name of the filesystem disk that photos should be stored on:
And also, in your app/Console/Kernel.php
file, you should register a daily job to prune any stale attachments from the pending attachments table and storage:
Filenames Preservation
A unique ID is generated by default to serve as the file name according to store
method specification.
If you want to preserve original client filenames for uploaded attachments, change preserve_file_names
option in config file to true
.
Images Optimization
All uploaded images will be optimized by default by spatie/image-optimizer.
You can disable image optimization in config file:
Or set custom optimization options for any optimizer:
Image optimization currently supported only for local filesystems
Upload Max Filesize
You can set max upload filesize for attachments. If set to null
, max upload filesize equals to php.ini upload_max_filesize
directive value.
Display Edited Content
According to Froala Display Edited Content documentation you should publish Froala styles:
include into view where an edited content is shown:
Also, you should make sure that you put the edited content inside an element that has the .fr-view
class:
Show on Index Page
You have an ability to show field content on resource index page in popup window:
Just click Show Content
License Key
To setup your license key, uncomment key
option in the config file and set FROALA_KEY
environment variable
3rd Party Integrations
I decided to remove 3rd party integrations like embedly and Tui. The reason for this being is that I wanted an updated version of Froala in Nova. I could not get it to work properly with the 3rd party integrations. I do not use them, and thus I am not inclined to spend more time on trying to get them to work. If you know how to do this, feel free to create a pull request.
Advanced
Custom Event Handlers
If you want to setup custom event handlers for froala editor instance, create js file and assign events
property to window.froala
:
to all callbacks provided in window.froala.events
, the context of VueJS form field component is automatically applied, you can work with this
inside callbacks like with Vue instance component.
After that, load the js file into Nova scripts in NovaServiceProvider::boot
method:
Customize Attachment Handlers
You can change any of attachment handlers by passing a callable
:
Development
You may get started with this package as follows (after cloning the repository):
Fixing code-style
PHP
JS
Testing
Building dev assets
Building production assets
Contributing
To contribute, simply make a pull request to this repository with your changes. Make sure they are documented well in your pull request description.
Credits
- Slava Razum For creating the original plugin
- Woeler For updating the abandoned plugin to Froala version 4, Laravel version 9 and Mix version 6
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of nova-froala-field with dependencies
laravel/nova Version ^3.0
league/flysystem Version ^3.0
spatie/image-optimizer Version ^1.6