riodwanto/filament-ace-editor

为 Filament 3 表单实现的 Ace Editor

v1.1.1 2024-09-16 04:34 UTC

This package is auto-updated.

Last update: 2024-09-16 04:35:55 UTC


README

Latest Version on Packagist Total Downloads

为 Filament 表单实现的 Ace Editor。

安装

您可以通过 composer 安装此包

composer require riodwanto/filament-ace-editor

使用方法

use Riodwanto\FilamentAceEditor\AceEditor;

public function form(Form $form): Form
{
    return $form
        ->schema([
            ...
            AceEditor::make('code-editor')
                ->mode('php')
                ->theme('github')
                ->darkTheme('dracula'),
        ])

}
可用方法

所有默认值可以 在此处查看

发布

您可以使用以下方法发布视图

php artisan vendor:publish --tag="filament-ace-editor-views"

您可以使用以下方法发布配置文件

php artisan vendor:publish --tag="filament-ace-editor-config"
config

这是已发布配置文件的内容

return [
    ...

    // Initilization ace config
    'editor_config' => [
        'useWorker' => false
    ],

    // Editor options
    'editor_options' => [
        'mode' => 'ace/mode/php',
        'theme' => 'ace/theme/eclipse',
        'enableBasicAutocompletion' => true,
        'enableLiveAutocompletion' => true,
        'liveAutocompletionDelay' => 0,
        'liveAutocompletionThreshold' => 0,
        'enableSnippets' => true,
        'enableInlineAutocompletion' => true,
        'showPrintMargin' => false,
        'wrap' => 'free'
    ],

    'dark_mode' => [
        'enable' => true,
        'theme' => 'ace/theme/dracula',
    ],

    'enabled_extensions' => [
        'beautify',
        'language_tools',
        'inline_autocomplete',
    ],
    
    ...
];
支持的 Ace 功能

Buy Me A Coffee

鸣谢

许可证

MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件