rainsens/simplemde

支持上传图片的laravel-admin markdown编辑器扩展

1.1.0 2019-04-11 07:23 UTC

This package is auto-updated.

Last update: 2024-09-12 22:55:33 UTC


README

Simplemde是一款优秀的markdown编辑器,此扩展用于将Simplemde集成到laravel-admin表单中。

截图

wx20180906-130207

安装

composer require rainsens/simplemde
composer require intervention/image

然后

php artisan vendor:publish --tag=laravel-admin-simplemde
php artisan storage:link

配置

config/admin.php文件的extensions部分,添加属于此扩展的一些配置。

    'extensions' => [

        'simplemde' => [
        
            // Set to false if you want to disable this extension
            'enable' => true,
            
            // Set upload url for attachment
            'upload_url' => 'attachments/upload',
            
            // If you want to set an alias for the calling method
            //'alias' => 'markdown',
            
            // Editor configuration
            'config' => [
                
            ]
        ]
    ]

编辑器的配置可以在Simplemde 文档中找到。

    'config' => [
        'autofocus'   => true,
        'placeholder' => 'xxxx',
        ....
    ]

使用方法

在表单中使用

$form->simplemde('content');

设置高度

$form->simplemde('content')->height(500);

如果配置中指定了方法别名为markdown

$form->markdown('content');

许可

MIT 许可证 (MIT)许可。