moonshine / ace
Ace editor for MoonShine
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: ^8.2|^8.3
- ext-curl: *
- ext-json: *
Requires (Dev)
- moonshine/moonshine: ^3.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0.1
- rector/rector: ^1.0
Conflicts
- moonshine/moonshine: <3.0.0
This package is auto-updated.
Last update: 2024-10-20 06:39:03 UTC
README
Extends Textarea and has the same features
Note
The package is based on the Ace library.
Compatibility
Installation
composer require moonshine/ace
Usage
use MoonShine\Ace\Fields\Code; Code::make('Code')
Default config
To change the default settings, you need to publish the configuration file:
php artisan vendor:publish --tag="moonshine-ace-config"
You can also add additional options to the configuration file that will apply to all Code
fields
'options' => [ 'language' => 'javascript', 'options' => [ 'useSoftTabs' => true, 'navigateWithinSoftTabs' => true, ], 'themes' => [ 'light' => 'chrome', 'dark' => 'cobalt' ], ],
Note
For more information, visit the Ace library.
Language
To change the language, use the language()
method.
language(string $language)
Code::make('Code') ->language('php');
Themes
To change the themes, use the themes()
method.
themes(string $light = null, string $dark = null)
Code::make('Code') ->themes('chrome', 'cobalt');
Options
The addOption()
method allows you to add additional options for a field
addOption(string $name, string|int|float|bool $value)
Code::make('Code') ->addOption('showGutter', false)