1. Go to this page and download the library: Download wangta69/laravel-editor 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/ */
wangta69 / laravel-editor example snippets
use Pondol\Editor\Facades\Editor;
// 1) Base64 인라인 이미지를 실제 파일로 추출 후 URL 치환 (SVG 등 XSS 위험 포맷 자동 차단)
$html = Editor::extractBase64Image(
$request->input('content'),
public_path('uploads/editor'),
'/uploads/editor/'
);
// 2) Markdown -> 안전한 HTML 변환
$markdownHtml = Editor::toHtml($article->markdown_body);
// 3) Editor.js JSON -> 안전한 HTML 변환
$blockHtml = Editor::renderEditorJs($article->blocks_json);
use Pondol\Editor\Events\ImageUploaded;
Event::listen(ImageUploaded::class, function (ImageUploaded $event) {
// $event->disk, $event->path, $event->url, $event->userId 등 활용
});
use Pondol\Editor\Traits\SmartEditor;
class PostController extends Controller
{
use SmartEditor;
public function uploadImage(Request $request)
{
$result = $this->_uploadStore($request, 'uploads/posts');
if (! empty($result['error'])) {
return response()->json(['success' => false]);
}
return $result['url'];
}
}