diff --git a/app/Livewire/MonacoEditor.php b/app/Livewire/MonacoEditor.php new file mode 100644 index 000000000..bd2a3c868 --- /dev/null +++ b/app/Livewire/MonacoEditor.php @@ -0,0 +1,51 @@ + '$refresh', + ]; + + public $language; + + public function __construct( + public ?string $id = null, + public ?string $name = null, + public ?string $type = 'text', + public ?string $monacoContent = null, + public ?string $value = null, + public ?string $label = null, + public ?string $placeholder = null, + public bool $required = false, + public bool $disabled = false, + public bool $readonly = false, + public bool $allowTab = false, + public bool $spellcheck = false, + public ?string $helper = null, + public bool $realtimeValidation = false, + public bool $allowToPeak = true, + public string $defaultClass = 'input scrollbar font-mono', + public string $defaultClassInput = 'input' + ) { + // + } + + public function render() + { + if (is_null($this->id)) { + $this->id = new Cuid2(7); + } + + if (is_null($this->name)) { + $this->name = $this->id; + } + + return view('components.forms.monaco-editor'); + } +} diff --git a/app/View/Components/Forms/Textarea.php b/app/View/Components/Forms/Textarea.php index bfdf03a31..7d1860500 100644 --- a/app/View/Components/Forms/Textarea.php +++ b/app/View/Components/Forms/Textarea.php @@ -19,6 +19,8 @@ public function __construct( public ?string $value = null, public ?string $label = null, public ?string $placeholder = null, + public ?string $monacoEditorLanguage = '', + public bool $useMonacoEditor = false, public bool $required = false, public bool $disabled = false, public bool $readonly = false, diff --git a/resources/views/components/forms/monaco-editor.blade.php b/resources/views/components/forms/monaco-editor.blade.php new file mode 100644 index 000000000..880e0759b --- /dev/null +++ b/resources/views/components/forms/monaco-editor.blade.php @@ -0,0 +1,451 @@ +
+
+
+
+
+ + + + +
+
+
+
+
+
+
diff --git a/resources/views/components/forms/textarea.blade.php b/resources/views/components/forms/textarea.blade.php index 2c32c585e..7f7457c4f 100644 --- a/resources/views/components/forms/textarea.blade.php +++ b/resources/views/components/forms/textarea.blade.php @@ -24,6 +24,17 @@ function handleKeydown(e) { @endif @endif + @if($useMonacoEditor) + + @else @if ($type === 'password')
@if ($allowToPeak) @@ -64,7 +75,7 @@ class="absolute inset-y-0 right-0 flex items-center h-6 pt-2 pr-2 cursor-pointer @disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}" name="{{ $name }}" name={{ $id }}> @endif - + @endif @error($id)
-