xn / xn-ckeditor
Easy way to use ckeditor in laravel-admin
v2.0.4
2023-03-10 06:33 UTC
Requires
- php: >=8.0.0
- ext-gd: *
- ext-json: *
- ext-zip: *
- laravel/framework: >=9.0
- league/flysystem: ^3.0
- league/flysystem-aws-s3-v3: ^3.0
- league/flysystem-azure-blob-storage: ^3.0
- league/flysystem-ftp: ^3.0
- pimple/pimple: ~3.0
- spatie/flysystem-dropbox: ^2.0
This package is auto-updated.
Last update: 2024-05-10 08:55:40 UTC
README
ckeditor for xn/laravel-admin
Installing
composer require xn/xn-ckeditor
php artisan vendor:publish --tag=xn-ckeditor --tag="ckfinder-config"
Configuration
In the extensions section of the config/admin.php file, add some configuration that belongs to this extension.
'extensions' => [
'ckeditor' => [
//Set to false if you want to disable this extension
'enable' => true,
// Editor configuration
'config' => [
'filebrowserBrowseUrl' => '/admin/ckfinder/browser',
'filebrowserImageBrowseUrl' => '/admin/ckfinder/browser',
]
]
],
add admin/routes.php
Route::group([
'prefix' => 'admin/ckfinder',
'middleware' => config('admin.route.middleware'),
], function () {
Route::any('connector', '\Xn\CKEditor\Controller\CKFinderController@requestAction')
->name('ckfinder_connector');
Route::any('browser', '\Xn\CKEditor\Controller\CKFinderController@browserAction')
->name('ckfinder_browser');
});
edit app/Http/Middleware/EncryptCookies.php
// app/Http/Middleware/EncryptCookies.php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
'ckCsrfToken',
// ...
];
}
edit app/Http/Middleware/VerifyCsrfToken.php
// app/Http/Middleware/VerifyCsrfToken.php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'admin/ckfinder/*',
// ...
];
}
Usage
$form->ckeditor('content', '內容');
$form->ckeditor('content')->options(['height' => 500,'contentsCss' => '/css/frontend.css']);
$form->ckuploader('image', __('cover'));
License
MIT