Git Product home page Git Product logo

nova-toast-ui-editor-field's Introduction

Laravel Nova Toast UI Editor field

Latest Version on Packagist Software License StyleCI Quality Score Total Downloads

A Toast UI Editor field for Laravel Nova.

toast ui editor field screenshot

Contents

Installation

You can install the package via composer:

composer require bbs-lab/nova-toast-ui-editor-field

The package will automatically register itself.

You can publish the config-file with:

php artisan vendor:publish --provider="BbsLab\NovaToastUiEditorField\FieldServiceProvider" --tag="config"

This is the contents of the published config file:

<?php

use BbsLab\NovaToastUiEditorField\ToastUiEditor;

return [

    'initialEditType' => ToastUiEditor::EDIT_TYPE_WYSIWYG,

    'options' => [
        'minHeight' => '200px',
        'language' => 'en-US',
        'useCommandShortcut' => true,
        'usageStatistics' => false,
        'hideModeSwitch' => false,
        'toolbarItems' => [
            'heading',
            'bold',
            'italic',
            'strike',
            'divider',
            'hr',
            'quote',
            'divider',
            'ul',
            'ol',
            'task',
            'indent',
            'outdent',
            'divider',
            'table',
            'image',
            'link',
            'divider',
            'code',
            'codeblock',
        ],
    ],
    
    'plugins' => ['chart', 'tableMergedCell', 'uml', 'colorSyntax', 'codeSyntaxHighlight'],

    'height' => '300px',

    'previewStyle' => ToastUiEditor::PREVIEW_STYLE_TAB,

    'allowIframe' => false,

    'useCloudinary' => false,

    'cloudinary' => [
        'cloud_name' => env('CLOUDINARY_CLOUD_NAME', ''),
        'api_key' => env('CLOUDINARY_API_KEY', ''),
        'api_secret' => env('CLOUDINARY_API_SECRET', ''),
        'username' => env('CLOUDINARY_USERNAME', ''),
    ],

];

Usage

You can use the BBSLab\NovaToastUiEditorField\ToastUiEditor field in your Nova resource:

<?php

namespace App\Nova;

use BBSLab\NovaToastUiEditorField\ToastUiEditor;
use Illuminate\Http\Request;

class BlogPost extends Resource
{
    // ...
    
    public function fields(Request $request)
    {
        return [
            // ...

            ToastUiEditor::make('Content'),

            // ...
        ];
    }
    
}

Advanced usage

Toast UI Editor configuration

You may configure the underlying Toast UI Editor instance with the following field's methods. Checkout Toast UI - Vue Editor documentation.

You may also configure defaults in config-file.

initialEditType

initialEditTypeMarkdown()

initialEditTypeWYSIWYG()

options

minHeight(string $minHeight)

language(string $language)

useCommandShortcut(bool $useCommandShortcut = true)

hideModeSwitch(bool $hideModeSwitch = true)

toolbarItems(array $toolbarItems)

plugins

chart uml colorSyntax codeSyntaxHighlight tableMergedCell

height

height(string $height)

previewStyle

previewStyleVertical()

previewStyleTab()

Allow iframe in markdown/html

allowIframe(bool $allowIframe = true)

Use Cloudinary as image picker

useCloudinary(bool $useCloudinary = true)

You must configure your Cloudinary credentials as described in nova-toast-ui-editor-field config file.

Changelog

Please see CHANGELOG for more information on recent changes.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

nova-toast-ui-editor-field's People

Contributors

mikaelpopowicz avatar trippo avatar robertonegro avatar

Watchers

James Cloos 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.