個人部落格地址
安裝 Editor.md擴充套件
git地址
composer require sharemant/laravel-admin-ext-editormd
php artisan vendor:publish --tag=laravel-admin-ext-editormd
配置
在 config/admin.php 的 extensions 陣列中新增配置.
'editormd' => [
// Set to false if you want to disable this extension
'enable' => true,
// Set to true if you want to take advantage the screen length for your editormd instance.
'wideMode' => true,
// Set to true when the instance included in larave-admin tab component.
'dynamicMode' => false,
// Editor.js configuration (Refer to http://pandao.github.io/editor.md/)
'config' =>
[
'path' => '/vendor/laravel-admin-ext/editormd/editormd-1.5.0/lib/',
'width' => '100%',
'height' => 600,
'emoji' => true,
'imageUpload' => true,
'imageFormats' => ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
'imageUploadURL' => '/upload',
'codeFold' => true,
]
]
呼叫
$form->editormd('markdown');
安裝md格式轉html格式擴充套件
composer require yansongda/laravel-parsedown
使用方法,在blade檔案裡面
@parsedown('## h2');
or
{{ parsedown('## h2') }}
圖片上傳配置
{
imageUpload : false,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php",
}
圖片上傳返回JSON data
{
success : 0 | 1, // 0 表示上傳失敗,1 表示上傳成功
message : "提示的資訊,上傳成功或上傳失敗及錯誤資訊等。",
url : "圖片地址" // 上傳成功時才返回
}
接值
$request->file('editormd-image-file')
本作品採用《CC 協議》,轉載必須註明作者和本文連結