A Toast UI Editor field for Laravel Nova.
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', ''),
],
];
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'),
// ...
];
}
}
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.
initialEditTypeMarkdown()
initialEditTypeWYSIWYG()
minHeight(string $minHeight)
language(string $language)
useCommandShortcut(bool $useCommandShortcut = true)
hideModeSwitch(bool $hideModeSwitch = true)
toolbarItems(array $toolbarItems)
chart
uml
colorSyntax
codeSyntaxHighlight
tableMergedCell
height(string $height)
previewStyleVertical()
previewStyleTab()
allowIframe(bool $allowIframe = true)
useCloudinary(bool $useCloudinary = true)
You must configure your Cloudinary credentials as described in nova-toast-ui-editor-field config file.
Please see CHANGELOG for more information on recent changes.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.