' . $this->path . '
Max is ' . convert_bytes_to_readable(config('panel.files.max_edit_size')))
- // ->title('File too large!')
- // AlertBanner::make()
- // } catch (FileSizeTooLargeException) {
- // try {
- // ->default(function () {
- // return $this->getDaemonFileRepository()->getContent($this->path, config('panel.files.max_edit_size'));
- // ->closable()
- // ->send();
- //
- // } catch (FileNotFoundException) {
- // AlertBanner::make()
- // $this->redirect(ListFiles::getUrl());
- // ->title('File Not found!')
- // ->danger()
- // ->body('' . $this->path . '
')
- // ->send();
- // ->closable()
- //
- // $this->redirect(ListFiles::getUrl());
- // } catch (FileNotEditableException) {
- // ->title('Could not edit directory!')
- // AlertBanner::make()
- // ->body('' . $this->path . '
')
- // ->closable()
- // ->send();
- // ->danger()
- //
- // }
- // $this->redirect(ListFiles::getUrl());
- // })
- // ->language(fn (Get $get) => $get('lang'))
- // ->view('filament.plugins.monaco-editor'),
+ CodeEditor::make('editor')
+ ->hiddenLabel()
+ ->default(function () {
+ try {
+ return $this->getDaemonFileRepository()->getContent($this->path, config('panel.files.max_edit_size'));
+ } catch (FileSizeTooLargeException) {
+ AlertBanner::make()
+ ->title('' . basename($this->path) . '
is too large!')
+ ->body('Max is ' . convert_bytes_to_readable(config('panel.files.max_edit_size')))
+ ->danger()
+ ->closable()
+ ->send();
+
+ $this->redirect(ListFiles::getUrl(['path' => dirname($this->path)]));
+ } catch (FileNotFoundException) {
+ AlertBanner::make()
+ ->title('' . basename($this->path) . '
not found!')
+ ->danger()
+ ->closable()
+ ->send();
+
+ $this->redirect(ListFiles::getUrl(['path' => dirname($this->path)]));
+ } catch (FileNotEditableException) {
+ AlertBanner::make()
+ ->title('' . basename($this->path) . '
is a directory')
+ ->danger()
+ ->closable()
+ ->send();
+
+ $this->redirect(ListFiles::getUrl(['path' => dirname($this->path)]));
+ } catch (ConnectionException) {
+ // Alert banner for this one will be handled by ListFiles
+
+ $this->redirect(ListFiles::getUrl(['path' => dirname($this->path)]));
+ }
+ }),
]),
]);
}
diff --git a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php
index 99fd6089c..6b460d862 100644
--- a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php
+++ b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php
@@ -2,8 +2,6 @@
namespace App\Filament\Server\Resources\FileResource\Pages;
-//use AbdelhamidErrahmouni\FilamentMonacoEditor\MonacoEditor;
-use App\Enums\EditorLanguages;
use App\Facades\Activity;
use App\Filament\Server\Resources\FileResource;
use App\Models\File;
@@ -20,8 +18,8 @@ use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Facades\Filament;
use Filament\Forms\Components\CheckboxList;
+use Filament\Forms\Components\CodeEditor;
use Filament\Forms\Components\FileUpload;
-use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Infolists\Components\TextEntry;
use Filament\Notifications\Notification;
@@ -408,6 +406,9 @@ class ListFiles extends ListRecords
]);
}
+ /**
+ * @throws \Exception
+ */
protected function getHeaderActions(): array
{
/** @var Server $server */
@@ -429,21 +430,10 @@ class ListFiles extends ListRecords
})
->schema([
TextInput::make('name')
- ->label('File Name')
+ ->label('Name')
->required(),
- Select::make('lang')
- ->label('Syntax Highlighting')
- ->searchable()
- ->native(false)
- ->live()
- ->options(EditorLanguages::class)
- ->selectablePlaceholder(false)
- ->afterStateUpdated(fn ($state) => $this->dispatch('setLanguage', lang: $state))
- ->default(EditorLanguages::plaintext->value),
- // MonacoEditor::make('editor')
- // ->label('')
- // ->view('filament.plugins.monaco-editor')
- // ->language(fn (Get $get) => $get('lang') ?? 'plaintext'),
+ CodeEditor::make('editor')
+ ->hiddenLabel(),
]),
Action::make('new_folder')
->authorize(fn () => auth()->user()->can(Permission::ACTION_FILE_CREATE, $server))
diff --git a/config/filament-monaco-editor.php b/config/filament-monaco-editor.php
deleted file mode 100644
index 8250588fa..000000000
--- a/config/filament-monaco-editor.php
+++ /dev/null
@@ -1,270 +0,0 @@
- [
- 'enable-preview' => false,
- 'show-full-screen-toggle' => true,
- 'show-placeholder' => true,
- 'placeholder-text' => 'Your code here...',
- 'show-loader' => false,
- 'font-size' => '16px',
- 'line-numbers-min-chars' => 3,
- 'automatic-layout' => true,
- 'default-theme' => 'blackboard',
- ],
- 'themes' => [
- 'blackboard' => [
- 'base' => 'vs-dark',
- 'inherit' => true,
- 'rules' => [
- [
- 'background' => '161F27',
- 'token' => '',
- ],
- [
- 'foreground' => 'aeaeae',
- 'token' => 'comment',
- ],
- [
- 'foreground' => 'd8fa3c',
- 'token' => 'constant',
- ],
- [
- 'foreground' => 'ff6400',
- 'token' => 'entity',
- ],
- [
- 'foreground' => 'fbde2d',
- 'token' => 'keyword',
- ],
- [
- 'foreground' => 'fbde2d',
- 'token' => 'storage',
- ],
- [
- 'foreground' => '61ce3c',
- 'token' => 'string',
- ],
- [
- 'foreground' => '61ce3c',
- 'token' => 'meta.verbatim',
- ],
- [
- 'foreground' => '8da6ce',
- 'token' => 'support',
- ],
- [
- 'foreground' => 'ab2a1d',
- 'fontStyle' => 'italic',
- 'token' => 'invalid.deprecated',
- ],
- [
- 'foreground' => 'f8f8f8',
- 'background' => '9d1e15',
- 'token' => 'invalid.illegal',
- ],
- [
- 'foreground' => 'ff6400',
- 'fontStyle' => 'italic',
- 'token' => 'entity.other.inherited-class',
- ],
- [
- 'foreground' => 'ff6400',
- 'token' => 'string constant.other.placeholder',
- ],
- [
- 'foreground' => 'becde6',
- 'token' => 'meta.function-call.py',
- ],
- [
- 'foreground' => '7f90aa',
- 'token' => 'meta.tag',
- ],
- [
- 'foreground' => '7f90aa',
- 'token' => 'meta.tag entity',
- ],
- [
- 'foreground' => 'ffffff',
- 'token' => 'entity.name.section',
- ],
- [
- 'foreground' => 'd5e0f3',
- 'token' => 'keyword.type.variant',
- ],
- [
- 'foreground' => 'f8f8f8',
- 'token' => 'source.ocaml keyword.operator.symbol',
- ],
- [
- 'foreground' => '8da6ce',
- 'token' => 'source.ocaml keyword.operator.symbol.infix',
- ],
- [
- 'foreground' => '8da6ce',
- 'token' => 'source.ocaml keyword.operator.symbol.prefix',
- ],
- [
- 'fontStyle' => 'underline',
- 'token' => 'source.ocaml keyword.operator.symbol.infix.floating-point',
- ],
- [
- 'fontStyle' => 'underline',
- 'token' => 'source.ocaml keyword.operator.symbol.prefix.floating-point',
- ],
- [
- 'fontStyle' => 'underline',
- 'token' => 'source.ocaml constant.numeric.floating-point',
- ],
- [
- 'background' => 'ffffff08',
- 'token' => 'text.tex.latex meta.function.environment',
- ],
- [
- 'background' => '7a96fa08',
- 'token' => 'text.tex.latex meta.function.environment meta.function.environment',
- ],
- [
- 'foreground' => 'fbde2d',
- 'token' => 'text.tex.latex support.function',
- ],
- [
- 'foreground' => 'ffffff',
- 'token' => 'source.plist string.unquoted',
- ],
- [
- 'foreground' => 'ffffff',
- 'token' => 'source.plist keyword.operator',
- ],
- ],
- 'colors' => [
- 'editor.foreground' => '#F8F8F8',
- 'editor.background' => '#101519',
- 'editor.selectionBackground' => '#5a5f63',
- 'editor.lineHighlightBackground' => '#FFFFFF0F',
- 'editorCursor.foreground' => '#FFFFFFA6',
- 'editorWhitespace.foreground' => '#FFFFFF40',
- ],
- ],
- 'iPlastic' => [
- 'base' => 'vs',
- 'inherit' => true,
- 'rules' => [
- [
- 'background' => 'EEEEEEEB',
- 'token' => '',
- ],
- [
- 'foreground' => '009933',
- 'token' => 'string',
- ],
- [
- 'foreground' => '0066ff',
- 'token' => 'constant.numeric',
- ],
- [
- 'foreground' => 'ff0080',
- 'token' => 'string.regexp',
- ],
- [
- 'foreground' => '0000ff',
- 'token' => 'keyword',
- ],
- [
- 'foreground' => '9700cc',
- 'token' => 'constant.language',
- ],
- [
- 'foreground' => '990000',
- 'token' => 'support.class.exception',
- ],
- [
- 'foreground' => 'ff8000',
- 'token' => 'entity.name.function',
- ],
- [
- 'fontStyle' => 'bold underline',
- 'token' => 'entity.name.type',
- ],
- [
- 'fontStyle' => 'italic',
- 'token' => 'variable.parameter',
- ],
- [
- 'foreground' => '0066ff',
- 'fontStyle' => 'italic',
- 'token' => 'comment',
- ],
- [
- 'foreground' => 'ff0000',
- 'background' => 'e71a114d',
- 'token' => 'invalid',
- ],
- [
- 'background' => 'e71a1100',
- 'token' => 'invalid.deprecated.trailing-whitespace',
- ],
- [
- 'foreground' => '000000',
- 'background' => 'fafafafc',
- 'token' => 'text source',
- ],
- [
- 'foreground' => '0033cc',
- 'token' => 'meta.tag',
- ],
- [
- 'foreground' => '0033cc',
- 'token' => 'declaration.tag',
- ],
- [
- 'foreground' => '6782d3',
- 'token' => 'constant',
- ],
- [
- 'foreground' => '6782d3',
- 'token' => 'support.constant',
- ],
- [
- 'foreground' => '3333ff',
- 'fontStyle' => 'bold',
- 'token' => 'support',
- ],
- [
- 'fontStyle' => 'bold',
- 'token' => 'storage',
- ],
- [
- 'fontStyle' => 'bold underline',
- 'token' => 'entity.name.section',
- ],
- [
- 'foreground' => '000000',
- 'fontStyle' => 'bold',
- 'token' => 'entity.name.function.frame',
- ],
- [
- 'foreground' => '333333',
- 'token' => 'meta.tag.preprocessor.xml',
- ],
- [
- 'foreground' => '3366cc',
- 'fontStyle' => 'italic',
- 'token' => 'entity.other.attribute-name',
- ],
- [
- 'fontStyle' => 'bold',
- 'token' => 'entity.name.tag',
- ],
- ],
- 'colors' => [
- 'editor.foreground' => '#000000',
- 'editor.background' => '#EEEEEEEB',
- 'editor.selectionBackground' => '#BAD6FD',
- 'editor.lineHighlightBackground' => '#0000001A',
- 'editorCursor.foreground' => '#000000',
- 'editorWhitespace.foreground' => '#B3B3B3F4',
- ],
- ],
- ],
-];
diff --git a/public/css/filament-monaco-editor/filament-monaco-editor-styles.css b/public/css/filament-monaco-editor/filament-monaco-editor-styles.css
deleted file mode 100644
index d7ccf39c2..000000000
--- a/public/css/filament-monaco-editor/filament-monaco-editor-styles.css
+++ /dev/null
@@ -1 +0,0 @@
-.fme-wrapper{display:flex;width:100%;flex-direction:column}.fme-full-screen{position:fixed;top:0;left:0;z-index:9999;height:100vh;width:100vw;overflow:hidden;border-width:1px;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.fme-control-section{display:flex;justify-content:space-between;padding:.5rem}.fme-code-preview-tab-item{position:relative;z-index:20;display:inline-flex;height:2rem;cursor:pointer;align-items:center;justify-content:center;white-space:nowrap;border-radius:.375rem;padding-left:.75rem;padding-right:.75rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.fme-code-preview-tab-marker-container{position:absolute;left:0;z-index:10;height:100%;width:50%;transition-duration:.3s;transition-timing-function:cubic-bezier(0,0,.2,1)}.fme-code-preview-tab-marker{height:100%;width:100%;border-radius:.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.fme-full-screen-btn{border-radius:.25rem;padding:.25rem .5rem}.fme-full-screen-btn:focus{--tw-bg-opacity:1;background-color:rgba(var(--gray-100),var(--tw-bg-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.fme-full-screen-btn-icon{height:1rem;width:1rem;--tw-text-opacity:1;color:rgba(var(--gray-500),var(--tw-text-opacity))}.fme-code-preview-tab{display:inline-grid;height:2.5rem;width:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none;grid-template-columns:repeat(2,minmax(0,1fr));justify-content:center;border-radius:.5rem;--tw-bg-opacity:1;background-color:rgba(var(--gray-100),var(--tw-bg-opacity));padding:.25rem;--tw-text-opacity:1;color:rgba(var(--gray-500),var(--tw-text-opacity))}.fme-code-preview-tab,.fme-container{position:relative;align-items:center}.fme-container{flex-direction:column;justify-content:flex-start;--tw-bg-opacity:1}.fme-container,.fme-loader{display:flex;height:100%;width:100%}.fme-loader{position:absolute;inset:0;z-index:20;align-items:center;justify-content:center;transition-duration:1s;transition-timing-function:cubic-bezier(0,0,.2,1)}.fme-loader-icon{height:1rem;width:1rem;animation:spin 1s linear infinite;--tw-text-opacity:1;color:rgba(var(--gray-400),var(--tw-text-opacity))}.fme-element-wrapper{position:relative;z-index:10;height:100%;width:100%;border-radius:.25rem}.fme-element{height:100%;width:100%;font-size:1.125rem;line-height:1.75rem}.fme-placeholder{position:absolute;left:0;top:0;z-index:50;margin-left:3.5rem;margin-top:.125rem;width:100%;--tw-translate-x:-0.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgba(var(--gray-500),var(--tw-text-opacity))}.fme-preview-wrapper{height:100%;width:100%;overflow:hidden;border-radius:.25rem;border-width:1px;--tw-bg-opacity:1;background-color:rgba(var(--gray-50),var(--tw-bg-opacity))}.fme-preview{display:flex;height:100%;min-height:80vh;width:100%}.grow{flex-grow:1}.-translate-x-5,.-translate-y-12{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0,.translate-x-12{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5,.translate-x-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180,.translate-y-12{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180,.scale-100{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.truncate,.whitespace-nowrap{white-space:nowrap}.\!bg-gray-50,.\!bg-gray-700{--tw-bg-opacity:1 !important}.pb-6,.py-6{padding-bottom:1.5rem}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus-visible\:ring-1:focus-visible,.focus-visible\:ring-2:focus-visible{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.disabled\:placeholder\:\[-webkit-text-fill-color\:theme\(colors\.gray\.400\)\]:disabled::-moz-placeholder,.disabled\:placeholder\:\[-webkit-text-fill-color\:theme\(colors\.gray\.400\)\]:disabled::placeholder{-webkit-text-fill-color:rgba(var(--gray-400),1)}.group\/button:hover .group-hover\/button\:text-gray-500{--tw-text-opacity:1;color:rgba(var(--gray-500),var(--tw-text-opacity))}.group\/item:focus-visible .group-focus-visible\/item\:underline,.group\/link:focus-visible .group-focus-visible\/link\:underline{text-decoration-line:underline}.dark\:disabled\:placeholder\:\[-webkit-text-fill-color\:theme\(colors\.gray\.500\)\]:disabled:is(.dark *)::-moz-placeholder,.dark\:disabled\:placeholder\:\[-webkit-text-fill-color\:theme\(colors\.gray\.500\)\]:disabled:is(.dark *)::placeholder{-webkit-text-fill-color:rgba(var(--gray-500),1)}.group:focus-visible .dark\:group-focus-visible\:text-gray-200:is(.dark *),.group:hover .dark\:group-hover\:text-gray-200:is(.dark *){--tw-text-opacity:1;color:rgba(var(--gray-200),var(--tw-text-opacity))}:checked+*>.\[\:checked\+\*\>\&\]\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}input:checked+.\[input\:checked\+\&\]\:bg-custom-600{--tw-bg-opacity:1;background-color:rgba(var(--c-600),var(--tw-bg-opacity))}input:checked+.\[input\:checked\+\&\]\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}input:checked+.\[input\:checked\+\&\]\:ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}input:checked+.\[input\:checked\+\&\]\:hover\:bg-custom-500:hover,input:checked+.dark\:\[input\:checked\+\&\]\:bg-custom-500:is(.dark *){--tw-bg-opacity:1;background-color:rgba(var(--c-500),var(--tw-bg-opacity))}input:checked+.dark\:\[input\:checked\+\&\]\:hover\:bg-custom-400:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgba(var(--c-400),var(--tw-bg-opacity))}input:checked:focus-visible+.\[input\:checked\:focus-visible\+\&\]\:ring-custom-500\/50{--tw-ring-color:rgba(var(--c-500),0.5)}input:checked:focus-visible+.dark\:\[input\:checked\:focus-visible\+\&\]\:ring-custom-400\/50:is(.dark *){--tw-ring-color:rgba(var(--c-400),0.5)}input:focus-visible+.\[input\:focus-visible\+\&\]\:z-10{z-index:10}input:focus-visible+.\[input\:focus-visible\+\&\]\:ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px+var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}input:focus-visible+.\[input\:focus-visible\+\&\]\:ring-gray-950\/10{--tw-ring-color:rgba(var(--gray-950),0.1)}input:focus-visible+.dark\:\[input\:focus-visible\+\&\]\:ring-white\/20:is(.dark *){--tw-ring-color:#fff3}
diff --git a/public/js/filament-monaco-editor/filament-monaco-editor-scripts.js b/public/js/filament-monaco-editor/filament-monaco-editor-scripts.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/resources/views/filament/plugins/monaco-editor.blade.php b/resources/views/filament/plugins/monaco-editor.blade.php
deleted file mode 100644
index 6332840f4..000000000
--- a/resources/views/filament/plugins/monaco-editor.blade.php
+++ /dev/null
@@ -1,180 +0,0 @@
-@script
-
-@endscript
-
-