xn/code-mirror-editor

code editor extension for laravel-admin

dev-master 2023-07-15 10:06 UTC

This package is auto-updated.

Last update: 2024-12-15 04:58:40 UTC


README

This is a laravel-admin extension that integrates CodeMirror into laravel-admin.

Installation

First, install dependencies:

composer require xn/code-mirror-editor

Then, publish the resource directory:

php artisan vendor:publish --tag=laravel-admin-code-mirror-editor

Configuration

In the extensions section of the config/admin.php file, add some configuration that belongs to this extension.


    'extensions' => [

        'code-mirror-editor' => [
        
            // Set to false if you want to disable this extension
            'enable' => true,
            
            // Editor configuration
            'config' => [
                
            ]
        ]
    ]

The configuration of the editor can be found in CodeMirror Docmentation

使用

在form表单中使用它:

$form->codeMirrorEditor('code');

// alias of `js` method
$form->cme('code');

// alias of `html` method
$form->cmeHtml('code');

Set height

$form->codeMirrorEditor('code')->height(500);

More resources

Awesome Laravel-admin

License

Licensed under The MIT License (MIT).