PHP code example of nakipelo / orchid-ckeditor
1. Go to this page and download the library: Download nakipelo/orchid-ckeditor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nakipelo / orchid-ckeditor example snippets
use Nakipelo\Orchid\CKEditor\CKEditor;
// In your Screen class
public function fields(): array
{
return [
CKEditor::make('content')
->title('Content')
->
use Nakipelo\Orchid\CKEditor\CKEditor;
public function fields(): array
{
return [
CKEditor::make('content')
->title('Content')
->setOptions([
'toolbar' => [
['Bold', 'Italic', 'Underline'],
['NumberedList', 'BulletedList'],
['Link', 'Unlink'],
['Image', 'Table'],
],
'height' => 300,
])
->mergeOptions([
'filebrowserImageBrowseUrl' => '/filemanager?type=Images',
'filebrowserImageUploadUrl' => '/filemanager/upload?type=Images&_token=' . csrf_token(),
]),
];
}
return [
/**
* URL for loading CKEditor
*/
'editorUrl' => '//cdn.ckeditor.com/4.22.1/full/ckeditor.js',
/**
* Default editor options
*/
'options' => [
'filebrowserImageBrowseUrl' => '/filemanager?type=Images',
'filebrowserImageUploadUrl' => '/filemanager/upload?type=Images&_token=',
'filebrowserBrowseUrl' => '/filemanager?type=Files',
'filebrowserUploadUrl' => '/filemanager/upload?type=Files&_token=',
]
];
Route::group(['prefix' => 'filemanager', 'middleware' => ['web', 'auth']], function () {
\UniSharp\LaravelFilemanager\Lfm::routes();
});
$editor = CKEditor::make('content')
->setOptions([
'toolbar' => [
['Bold', 'Italic', 'Underline'],
['NumberedList', 'BulletedList'],
['Link', 'Unlink'],
['Image', 'Table'],
['Source'],
],
'height' => 400,
'width' => '100%',
'language' => 'en',
'uiColor' => '#f0f0f0',
'removeDialogTabs' => 'image:advanced;link:advanced',
]);
bash
php artisan vendor:publish --provider="Nakipelo\Orchid\CKEditor\CKEditorServiceProvider"
bash
php artisan vendor:publish --tag=ckeditor-config
src/
├── CKEditor.php # Main field class
└── CKEditorServiceProvider.php # Service Provider
resources/js/
├── ckeditor.js # Stimulus entry point
└── ckeditor_controller.js # Stimulus controller
views/
└── field.blade.php # Blade field template
config/
└── config.php # Default configuration