承接 iperamuna/filament-ace-editor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iperamuna/filament-ace-editor

Composer 安装命令:

composer require iperamuna/filament-ace-editor

包简介

Ace Editor implementation for Filament 5 Forms and Infolists

README 文档

README

Filament Ace Editor Banner

Filament Ace Editor (Supporting Filament v5)

Latest Version on Packagist Total Downloads License

A powerful Ace Editor implementation for Filament v5 Forms and Infolists with syntax highlighting, themes, autocompletion, and read-only mode support.

Requirements

  • PHP 8.2+
  • Laravel 12.x
  • Filament 5.x

Installation

You can install the package via composer:

composer require iperamuna/filament-ace-editor

The package will automatically detect your Filament version and work seamlessly with your installation.

Usage

Basic Form Field

use Iperamuna\FilamentAceEditor\AceEditor;

AceEditor::make('content')
    ->label('Code Editor')
    ->mode('php')
    ->theme('monokai')
    ->minLines(20)
    ->maxLines(50);

Advanced Configuration

AceEditor::make('script_content')
    ->label('Shell Script')
    ->hint(fn ($state) => new HtmlString(
        view('components.copy-button', ['content' => $state])->render()
    ))
    ->mode('sh')
    ->theme('monokai')
    ->minLines(20)
    ->maxLines(30)
    // Toggleable edit/read-only mode
    ->toggleable(true)
    // Control initial read-only state
    ->defaultReadOnly(fn ($livewire) => $livewire->getRecord() !== null)
    // Add extensions
    ->addExtension('searchbox')
    // Custom editor options
    ->options([
        'tabSize' => 2,
        'showPrintMargin' => false,
        'enableBasicAutocompletion' => true,
    ]);

Infolist Entry

use Iperamuna\FilamentAceEditor\AceEditorEntry;

AceEditorEntry::make('content')
    ->label('Script Content')
    ->mode('sh')
    ->theme('monokai')
    ->minLines(15)
    ->maxLines(50);

Key Features

🔒 Read-Only Mode Control

The defaultReadOnly() method helps prevent unwanted edits, especially useful when editing existing records. You can control it with a boolean or closure:

// Always read-only initially
AceEditor::make('config')
    ->defaultReadOnly(true);

// Read-only when editing existing records, editable when creating new ones
AceEditor::make('script_content')
    ->defaultReadOnly(fn ($livewire) => $livewire->getRecord() !== null);

// Custom logic based on user permissions
AceEditor::make('sensitive_data')
    ->defaultReadOnly(fn ($livewire) => !auth()->user()->can('edit', $livewire->getRecord()));

// Disable read-only mode entirely
AceEditor::make('content')
    ->defaultReadOnly(false);

Example Use Case: When a form is in create mode, the editor automatically opens in edit mode. When viewing or editing an existing record, it starts in read-only mode to prevent accidental changes. Users can toggle to edit mode when needed.

🎨 Theme Support

// Light theme for day work
AceEditor::make('content')
    ->theme('github');

// Dark theme for night owls
AceEditor::make('content')
    ->theme('monokai');

Available themes include: monokai, github, tomorrow, twilight, solarized_light, solarized_dark, and many more.

🔧 Toggleable Edit Mode

Allow users to switch between read-only and edit modes:

AceEditor::make('content')
    ->toggleable(true)  // Shows EDIT/DONE toggle button
    ->defaultReadOnly(true);  // Starts in read-only mode

📏 Flexible Sizing

AceEditor::make('content')
    ->minLines(10)   // Minimum editor height
    ->maxLines(50);  // Maximum editor height

🧩 Extensions Support

AceEditor::make('content')
    ->addExtension('searchbox')
    ->addExtension('beautify')
    ->addExtension('language_tools');

Configuration

Publish the configuration file to customize defaults:

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

This creates config/filament-ace-editor.php:

return [
    'base_url' => 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.7',
    
    'editor_options' => [
        'enableBasicAutocompletion' => true,
        'enableLiveAutocompletion' => true,
        'enableSnippets' => true,
        'showPrintMargin' => true,
        'highlightActiveLine' => true,
        'displayIndentGuides' => true,
    ],
    
    'enabled_extensions' => [
        'language_tools',
        'beautify',
        'searchbox',
    ],
];

Available Methods

Method Description Default
mode(string) Set syntax highlighting mode 'sh'
theme(string) Set editor theme 'monokai'
minLines(int) Set minimum editor height 15
maxLines(int) Set maximum editor height 50
toggleable(bool) Enable edit/read-only toggle true
defaultReadOnly(bool|Closure) Set initial read-only state true
addExtension(string) Add Ace extension []
options(array) Override editor options []

Supported Languages

Ace Editor supports over 110 programming languages and markup formats. Common modes include:

Programming Languages:

  • php, python, javascript, typescript, java, c_cpp, ruby, go, rust

Web Technologies:

  • html, css, scss, less, json, xml, yaml

Data & Config:

  • sql, mysql, pgsql, ini, toml, dockerfile

Scripting:

  • sh (Shell/Bash), powershell, batchfile

Markup:

  • markdown, latex, asciidoc

See the Ace Editor documentation for the complete list of supported modes.

Publishing

Publish the views for customization:

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

Publish the configuration:

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

Supported Features

This package supports most powerful features from Ace Editor:

  • ✅ Syntax highlighting for 110+ languages
  • ✅ Multiple themes (light and dark)
  • ✅ Code autocompletion
  • ✅ Search and replace
  • ✅ Code folding
  • ✅ Multiple cursors
  • ✅ Line numbering
  • ✅ Automatic indentation
  • ✅ Read-only mode with toggle
  • ✅ Customizable key bindings
  • ✅ Extensions support

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

iperamuna/filament-ace-editor 适用场景与选型建议

iperamuna/filament-ace-editor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「ace-editor」 「filament」 「filament-ace-editor」 「code-editor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 iperamuna/filament-ace-editor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 iperamuna/filament-ace-editor 我们能提供哪些服务?
定制开发 / 二次开发

基于 iperamuna/filament-ace-editor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 152
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-27