gusmanson/localtinymce
Composer 安装命令:
composer require gusmanson/localtinymce
包简介
A simple, self-hosted TinyMCE with image uploads for Laravel Nova.
README 文档
README
A simple, self-hosted TinyMCE with image uploads for Laravel Nova.
I needed a simple, zero-config WYSIWYG-field for Laravel Nova. Trix was too restrictive and other solutions were too messy. This is what I came up with. It's based on TinyMCE 5. This package supports image uploads (working out of the box, without dependencies or API-keys) and lets users edit HTML directly (so video embeds works fine). The toolbar can be configured.
Installation
composer require gusmanson/localtinymce
Publish the TinyMCE JS and CSS files.
artisan vendor:publish --tag=public --force
Usage
use Gusmanson\Localtinymce\Localtinymce;
public function fields(Request $request) { return [ ID::make('ID', 'id')->sortable(), Text::make('Name', 'name'), Localtinymce::make('Information', 'information')->withFiles('public') ]; }
Options
By default this uses a sensible toolbar and no file uploads. You can use withFiles() and withToolbar() to configure these options.
public function withFiles($disk = null, $dir = null) { // The default storage disk is 'public', the default storage dir is 'uploads'. } public function withToolbar($toolbar) { // The default toolbar is: 'undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | link image code' // 'image' will be removed if file upload isn't enabled }
Uploading
Uploading should just work out of the box! Enable it by using ->withFiles() on your field. Defaults expect you to have symlinked the public disk. The implementation is very basic. This is what happens in the upload controller:
$name = $request->file('attachment')->store($field->storageDir, $field->storageDisk); $url = Storage::disk( $field->storageDisk )->url( $name ); return response()->json([ 'url' => $url ]);;
TinyMCE
Read about TinyMCE here.
统计信息
- 总下载量: 6.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-18