mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Remove PlainText language, use null instead
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -2,10 +2,11 @@
|
||||
title: Code editor
|
||||
---
|
||||
import AutoScreenshot from "@components/AutoScreenshot.astro"
|
||||
import UtilityInjection from "@components/UtilityInjection.astro"
|
||||
|
||||
## Introduction
|
||||
|
||||
The code editor component allows you to write code in a set of common programming languages: HTML, CSS, JavaScript, PHP and JSON.
|
||||
The code editor component allows you to write code in a set of common programming languages. By default, no language syntax highlighting is applied.
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\CodeEditor;
|
||||
|
||||
@@ -28,6 +28,10 @@ export default function codeEditorFormComponent({
|
||||
},
|
||||
|
||||
getLanguageExtension: function () {
|
||||
if (!language) {
|
||||
return []
|
||||
}
|
||||
|
||||
const extensions = {
|
||||
css,
|
||||
html,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('code-editor', 'filament/forms') }}"
|
||||
x-data="codeEditorFormComponent({
|
||||
isDisabled: @js($isDisabled),
|
||||
language: @js($language->value),
|
||||
language: @js($language?->value),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
})"
|
||||
wire:ignore
|
||||
|
||||
@@ -15,16 +15,16 @@ class CodeEditor extends Field
|
||||
*/
|
||||
protected string $view = 'filament-forms::components.code-editor';
|
||||
|
||||
protected Language | Closure $language = Language::PlainText;
|
||||
protected Language | Closure | null $language = null;
|
||||
|
||||
public function language(Language | Closure $language): static
|
||||
public function language(Language | Closure | null $language): static
|
||||
{
|
||||
$this->language = $language;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLanguage(): Language
|
||||
public function getLanguage(): ?Language
|
||||
{
|
||||
return $this->evaluate($this->language);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,4 @@ enum Language: string
|
||||
case Json = 'json';
|
||||
|
||||
case Php = 'php';
|
||||
|
||||
case PlainText = 'plain_text';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user