waynestate / nova-ckeditor4-field by nickdenardis

This nova package allows you to use CKEditor 4 for text areas.
565,104
61
5
Package Data
Maintainer Username: nickdenardis
Maintainer Contact: web@wayne.edu (Web Communications)
Package Create Date: 2018-10-23
Package Last Update: 2023-11-20
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-19 15:14:34
Package Statistics
Total Downloads: 565,104
Monthly Downloads: 9,704
Daily Downloads: 385
Total Stars: 61
Total Watchers: 5
Total Forks: 21
Total Open Issues: 1

Laravel Nova CKEditor 4 Field

This nova package allows you to use CKEditor 4 for text areas using Vue Ckeditor2

CKEditor Form Field

Installation

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

composer require waynestate/nova-ckeditor4-field

By default the CKEditor 4 instance used is the latest (4.14.0) Full All version (https://cdn.ckeditor.com/). If you wish to use a different CKEditor 4 you can do so by publishing and editing the configuration.

Usage

<?php

namespace App\Nova;

use Waynestate\Nova\CKEditor;

class Article extends Resource
{
    // ...

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

            CKEditor::make('Body', 'body');
                
            // ...
        ];
    }
}

Overriding Config Values

To change any of config values, publish a config file:

php artisan vendor:publish --tag=config --provider="Waynestate\Nova\CKEditorFieldServiceProvider"

Customization

Configuration options

You can change the configuration options of the CKEditor instance by either editing the published config file at nova.ckeditor-field.options

    /*
    |--------------------------------------------------------------------------------
    | CKEditor Options
    |--------------------------------------------------------------------------------
    |
    | To view a list of all available options checkout the CKEditor API documentation
    | https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html
    |
    */
    'options' => [
        'toolbar' => [
            ['Source','-','Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
            ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
            ['Image','Table','HorizontalRule','SpecialChar','PageBreak'],
            '/',
            ['Bold','Italic','Strike','-','Subscript','Superscript'],
            ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
            ['JustifyLeft','JustifyCenter','JustifyRight'],
            ['Link','Unlink','Anchor'],
            '/',
            ['Format','FontSize'],
            ['Maximize', 'ShowBlocks','-','About']
        ]
    ],

or you can pass it with the options method using:

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

        CKEditor::make('Body', 'body')->options([
            'height' => 300,
            'toolbar' => [
                ['Source','-','Cut','Copy','Paste'],
            ],
        ]),

        // ...
    ];
}

Custom CKEditor Instance

If you wish to not use the CKEditor from the CKEditor CDN, you can change the ckeditor_url under config/nova/ckeditor-field.php to point to the URL of the CKEditor you wish to use.

If you wish to go the route of a Custom CKEditor Instance using Composer then follow the steps at Using Composer for Custom CKEditor Instance

Contributing

Please see CONTRIBUTING for details.

License

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