PHP code example of riodwanto / filament-ace-editor
1. Go to this page and download the library: Download riodwanto/filament-ace-editor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
riodwanto / filament-ace-editor example snippets
use Riodwanto\FilamentAceEditor\AceEditor;
public function form(Form $form): Form
{
return $form
->schema([
...
AceEditor::make('code_editor')
->label('Code Editor')
->mode('php')
->theme('github')
->darkTheme('dracula')
->fontSize('14px')
->cursorStyle('smooth')
->softWrap('free')
->tabSize(4)
->useSoftTabs(true)
->addExtensions(['language_tools', 'beautify'])
->customCompletions([
'php' => [
['caption' => 'dd()', 'value' => 'dd(${1:variable});', 'meta' => 'Laravel debug helper'],
['caption' => 'collect()', 'value' => 'collect(${1:array});', 'meta' => 'Laravel collection'],
]
]),
]);
}
return [
...
'base_url' => 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.43.3',
'file' => 'ace.js',
'editor_config' => [
'useWorker' => false
],
'editor_options' => [
'mode' => 'ace/mode/php',
'theme' => 'ace/theme/eclipse',
'enableBasicAutocompletion' => true,
'enableLiveAutocompletion' => true,
'liveAutocompletionDelay' => 0,
'liveAutocompletionThreshold' => 0,
'enableSnippets' => true,
'enableInlineAutocompletion' => true,
'showPrintMargin' => true,
'wrap' => 'off',
'animatedScroll' => false,
'fadeFoldWidgets' => false,
'displayIndentGuides' => false,
'highlightGutterLine' => false,
'showInvisibles' => false,
],
'dark_mode' => [
'enable' => true,
'theme' => 'ace/theme/dracula',
],
'enabled_extensions' => [
'beautify',
'language_tools',
'inline_autocomplete',
'rtl',
'statusbar',
'whitespace',
'searchbox',
],
...
];
bash
php artisan vendor:publish --tag="filament-ace-editor-views"
bash
php artisan vendor:publish --tag="filament-ace-editor-config"