Giter VIP home page Giter VIP logo

nova-field-ckeditor's Introduction

EOL NOTICE: No further development is planned. This repository will be archived eventually, feel free to fork it and maintain your own version.

Laravel Nova - CkEditor v5 Field

Media, Links & Snippet Browsers (VueJS)

Downloads Version MIT

Includes custom written plugins for Media, Links & Snippet Modals. Publishable stubs for out-of-the-box usage. Implement rich content editing in minutes.

Fields Included:

  • CkEditor Field
  • FeaturedMedia Field
  • MediaUpload Field

Packages Included:

  • Spatie Image Optimizer
  • Intervention Image

Installation

composer require bayareawebpro/nova-field-ckeditor
php artisan vendor:publish --tag=config

Install Optimizers

See: https://github.com/spatie/laravel-image-optimizer

Publish Stubs: Models, Resources, Migrations, Views

Review the included stubs to see the intended implementation.

https://github.com/bayareawebpro/nova-field-ckeditor/tree/master/stubs

php artisan vendor:publish --tag=nova-ckeditor-stubs

Editor Field Usage:

CkEditor::make('Content')
    ->rules('required')
    ->hideFromIndex()
    ->mediaBrowser()
    ->linkBrowser()
    ->height(60)
    ->stacked()
    ->snippets([
        ['name' =>'Cool Snippet1', 'html'=> view('snippets.1')->render()],
        ['name' =>'Cool Snippet2', 'html'=> view('snippets.2')->render()],
        ['name' =>'Cool Snippet3', 'html'=> view('snippets.3')->render()],
    ])
    ->toolbar([
        'heading',
        'horizontalLine',
        '|',
        'link',
        'linkBrowser',
        '|',
        'bold',
        'italic',
        'alignment',
        'subscript',
        'superscript',
        'underline',
        'strikethrough',
        '|',
        'blockQuote',
        'bulletedList',
        'numberedList',
        '|',
        'insertTable',
        'mediaEmbed',
        'mediaBrowser',
        'insertSnippet',
        '|',
        'undo',
        'redo'
    ]),

Note: Snippets will only render CkEditor Elements.
Standard HTML or Figures (table, image, video), see included views. https://ckeditor.com/docs

Recommended Package:

https://github.com/bayareawebpro/laravel-dom-pipeline


FeaturedMedia Field Usage:

FeaturedMedia::make('Image','media_id')
    ->rules('nullable')
    ->sizeOnDetail(800, 600)
    ->sizeOnForms(600, 400)
    ->sizeOnIndex(100,100)
    ->stacked(),

MediaUpload Field Usage:

Note this field is not updatable by default. Replacing media may result in broken images. Delete and re-upload is the intended methodology.

MediaUpload::make('File', $disk='media')
    ->rules('required','mimes:jpg,jpeg,png,gif', 'max:5000')
    ->help('5MB Max FileSize.')
    ->maxWidth(800),

Media Local Disk

'media' => [
    'driver' => 'local',
    'root' => storage_path('app/public/media'),
    'url' => env('APP_URL').'/storage/media',
    'visibility' => 'public',
],

Media Cloud Disk

'media' => [
    'driver' => 's3',
    'key' => env('SPACES_KEY'),
    'secret' => env('SPACES_SECRET'),
    'endpoint' => env('SPACES_ENDPOINT'),
    'region' => env('SPACES_REGION'),
    'bucket' => env('SPACES_BUCKET'),
    'root' => 'media',
    'url' => 'https://'.env('SPACES_BUCKET').'.'.env('SPACES_REGION').'.cdn.digitaloceanspaces.com/media',
    'options' => [ 'CacheControl' => 'max-age=31536000, public' ],
],

MediaStorage

Override the MediaStorage Service by binding your own extended version.

use Illuminate\Http\Request;
use BayAreaWebPro\NovaFieldCkEditor\MediaStorage;
class MyMediaStorage extends MediaStorage
{
    public function __invoke(Request $request)
    {
        // TODO: Change the default implementation.
    }
}
$this->app->bind('ckeditor-media-storage', MyMediaStorage::class);

nova-field-ckeditor's People

Contributors

bayareawebpro avatar pindab0ter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nova-field-ckeditor's Issues

Nova 4 Support

Nova in version 4 was released last week. Any chance we will see support for this in the near future? :-)

Anything we can do to help?

Thanks!

Image title

Hi
In plugin I can add alt to image.
How about title? Is that possible?

Better customization options

Hi,
I installed this package and it's perfectly fine.

But it would be better if we could translate texts in media-browser.vue and also changing api path in fetch function in media-browser.vue
I decided to change name of Media model to Image and after that, media-picker couldn't fetch images and got 404 error.

edit 1: I need translation for all vue templates
edit 2: Is it possible to add color picker, highlighter and font size picker? I see there are a lot of tools that are missing in my toolbar.

format tmp not supported

Hi,

When i want create a media with MediaUpload field, i have this error : Encoding format (tmp) is not supported.

How do I get out of this?

Thank you for answering me.

PS: I did not modify the base models

Media Browser not showing files

Hi,

when using the FeaturedMedia, I get a modal No images are shown.

When I search for something that is not in the media Table. I get No Results in the modal.

When using a partial of the filename, that is in the media table, I get a blank modal.

I checked the nova-api call that is fired. The file is correctly returned in a json.

Working with larval 8.6.0 with nova 3.10.0

Laravel Version Requirement

Nova requires Laravel 7+. It looks like this package requires Laravel 8. Is it possible for this package to require Laravel 7+?

format tmp not supported

Hi,

When i want create a media with MediaUpload field, i have this error : Encoding format (tmp) is not supported.

How do I get out of this?

Thanks

PS: I did not modify the base models

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.