dmitrybubyakin / nova-quill-field
A Laravel Nova field.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 114
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Language:Vue
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2022-02-22 18:31:45 UTC
README
Installation
composer require dmitrybubyakin/nova-quill-field
Usage
Quill::make('Body') ->rules('required') ->imageRules('max:2000') // Image validation rules ->alwaysShow() ->storeImagesUsing(function (UploadedFile $file, Request $request) { // Use spatie/laravel-medialibrary to store images return (new static::$model)->newInstance(['uuid' => $request->uuid], true) ->addMedia($file) ->toMediaCollection() ->getFullUrl(); // Return URL }, ['uuid' => $this->resolveUuid()]) // These attributes will be accessible from the request in the store callback ->toolbar([ // Customize toolbar [['header' => 1], ['header' => 2]], [['align' => ''], ['align' => 'center'], ['align' => 'right'], ['align' => 'justify']], ['bold', 'italic', 'underline', 'strike'], ['blockquote', 'code'], [['list' => 'ordered']], ['clean'], ['link', 'image'] ]) ->placeholder('Write down something...'), // Customize placeholder
Event
nova-quill-field:loaded
— Called only once. You can register some global modules here.nova-quill-field:ready
— Called every time the component is mounted. You can configure Quill instance here.
import ImageUploader from './ImageUploader' // Override Image Uploader Nova.$once('nova-quill-field:loaded', Quill => { Quill.register('modules/imageUploader', ImageUploader) }) // Add icons Nova.$once('nova-quill-field:loaded', Quill => { const icons = Quill.import('ui/icons') icons['fullscreen'] = require('!html-loader!../icons/fullscreen.svg') icons['fullscreenExit'] = require('!html-loader!../icons/fullscreen-exit.svg') }) Nova.$on('nova-quill-field:ready', ({ field, quill }) => { if (field.attribute !== 'needed-field') return quill.keyboard.addBinding({ key: 'F', shortKey: true, shiftKey: true, handler (range, context) { // do something... } }) })