GithubHelp home page GithubHelp logo

veneliniliev / nova-ckeditor5-classic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from numaxlab/nova-ckeditor5-classic

0.0 2.0 0.0 616 KB

A Laravel Nova CKEditor5 Classic Field.

License: MIT License

JavaScript 8.48% Vue 22.55% CSS 0.22% PHP 68.75%

nova-ckeditor5-classic's Introduction

Introduction

CKEditor5 Classic editor field for Laravel Nova. Use the last version of the popular WYSIWYG editor as a Laravel Nova field.

Latest Version on Packagist Total Downloads

Installation

You can install the package into a Laravel application that uses Nova via composer:

composer require numaxlab/nova-ckeditor5-classic

After installing publish the config:

php artisan vendor:publish --tag=config --provider=NumaxLab\\NovaCKEditor5Classic\\FieldServiceProvider

Usage

Use the NumaxLab\NovaCKEditor5Classic\CKEditor5Classic field in your Nova resource:

namespace App\Nova;

use NumaxLab\NovaCKEditor5Classic\CKEditor5Classic;

class Post extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            CKEditor5Classic::make('Content'),

            // ...
        ];
    }
}

Customizing CKEditor

If you want to change the Editor's settings, you can do so by editing the config file config/ckeditor5Classic.php or by setting it directly in your filed, if you need different setup per field:

CKEditor5Classic::make('Content')->withFiles('public')
->options([...]);

You can visit the CKEditor configuration reference to check the available options.

Image uploads

This Nova field provides native attachments driver which works similar to Trix File Uploads.

To use this attachments driver, publish and run the migration:

php artisan vendor:publish --tag=migrations --provider=NumaxLab\\NovaCKEditor5Classic\\\FieldServiceProvider 
php artisan migrate

Then, allow users to upload images, just like with Trix field, chaining the withFiles method onto the field's definition. When calling this method, you should pass the name of the filesystem disk that images should be stored on:

use NumaxLab\NovaCKEditor5Classic\CKEditor5Classic;

CKEditor5Classic::make('Content')->withFiles('public');

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:

use NumaxLab\NovaCKEditor5Classic\Jobs\PruneStaleAttachments;

/**
* Define the application's command schedule.
*
* @param  \Illuminate\Console\Scheduling\Schedule  $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
    $schedule->call(function () {
        (new PruneStaleAttachments)();
    })->daily();
}

Credits

License

The MIT License (MIT). Please see License File for more information.

nova-ckeditor5-classic's People

Contributors

ablunier avatar michapixel avatar king724 avatar patrickbrouwers avatar veneliniliev avatar

Watchers

James Cloos avatar  avatar

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.