Remove PlainText language, use null instead

This commit is contained in:
Raj Siva-Rajah
2025-06-08 03:34:57 +00:00
parent acf2527f86
commit cc4aaf6c51
6 changed files with 11 additions and 8 deletions
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -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
+3 -3
View File
@@ -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';
}