softbery/laravel-wweditor
Zaawansowany edytor WYSIWYG dla Laravela (alternatywa dla CKEditor) z komponentem Blade, autozapisem, trybami WYSIWYG/HTML/CSS/podgląd, uploadem i storage, konfiguracją przez plik i .env oraz trasami i middleware.
Zaawansowany edytor treści dla Laravela, podobny do CKEditor, z pełną integracją z frameworkiem.
composer require softbery-org/laravel-wweditor
php artisan vendor:publish --tag=wweditor-assets
php artisan vendor:publish --tag=wweditor-config
W config/app.php dodaj:
'providers' => [
// ...
Softbery\WwEditor\WwEditorServiceProvider::class,
],
<x-wweditor::editor
id="my-editor"
content="<h1>Hello World</h1>"
height="500px"
:auto-save="true"
/>
use Softbery\WwEditor\View\Components\WwEditorComponent;
public function create()
{
return view('create', [
'editor' => new WwEditorComponent('content-editor', '', '', '600px')
]);
}
Opublikuj plik konfiguracyjny:
php artisan vendor:publish --tag=wweditor-config
Dostosuj config/wweditor.php:
return [
'route_prefix' => 'wweditor',
'middleware' => ['web'],
'disk' => 'local',
'auto_save' => true,
'auto_save_interval' => 60,
'theme' => 'default',
];
W .env:
WWEDITOR_ROUTE_PREFIX=editor
WWEDITOR_MIDDLEWARE=web,auth
WWEDITOR_DISK=public
WWEDITOR_AUTO_SAVE=true
WWEDITOR_AUTO_SAVE_INTERVAL=60
WWEDITOR_THEME=default
Ctrl/Cmd + S - Zapisz treśćCtrl/Cmd + B - PogrubienieCtrl/Cmd + I - KursywaCtrl/Cmd + U - PodkreślenieCtrl/Cmd + Z - CofnijCtrl/Cmd + Shift + Z - PonówPOST /wweditor/save
Content-Type: application/json
{
"content": "<h1>Hello</h1>",
"css": "body { color: red; }",
"title": "My Content",
"description": "Content description"
}
GET /wweditor/load/{id}
GET /wweditor/list
DELETE /wweditor/delete/{id}
const editor = new WwEditorLaravel('my-editor', {
autoSave: true,
saveUrl: '/wweditor/save',
loadUrl: '/wweditor/load/:id',
autoSaveInterval: 60
});
// Zapis treści
editor.saveContent();
// Wczytanie treści
editor.loadContent('content-id');
// Eksport
editor.exportContent();
<x-wweditor::editor
:toolbar="['bold', 'italic', 'underline', '|', 'createLink']"
/>
<x-wweditor::editor
:modes="['wysiwyg', 'html']"
/>
.wweditor-container {
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
<form method="POST" action="/save">
@csrf
<x-wweditor::editor id="content" :auto-save="false"/>
<button type="submit">Zapisz</button>
</form>
// Controller
public function edit(Post $post)
{
return view('edit', [
'post' => $post
]);
}
// Blade
<x-wweditor::editor
id="content"
:content="$post->content"
:css="$post->css"
/>
<x-wweditor::editor id="editor1" content="Content 1"/>
<x-wweditor::editor id="editor2" content="Content 2"/>
W .env:
WWEDITOR_USE_EXTERNAL_LIBRARIES=true # CDN
WWEDITOR_USE_EXTERNAL_LIBRARIES=false # Local
Assets nie ładują się
php artisan vendor:publish --tag=wweditor-assets
php artisan optimize:clear
Autozapis nie działa
Style CSS nie są stosowane
MIT License - Możesz używać tego pakietu w projektach komercyjnych i osobistych.
How can I help you explore Laravel packages today?