Skip to content

Commit 8c3530e

Browse files
committed
remove using for aceEditor
1 parent 5b66bc3 commit 8c3530e

File tree

6 files changed

+42
-197
lines changed

6 files changed

+42
-197
lines changed

resources/views/filament/infolists/entries/json-entry.blade.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Filament/Infolists/Components/JsonEntry.php

Lines changed: 0 additions & 151 deletions
This file was deleted.

src/Filament/Resources/ExportResource.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,41 @@ public static function infolist(Infolist $infolist): Infolist
118118
->label(__('inspirecms::resources/export.exporter.label'))
119119
->inlineLabel(),
120120

121-
\SolutionForest\InspireCms\Filament\Infolists\Components\JsonEntry::make('payload')
121+
Infolists\Components\TextEntry::make('process_message')
122122
->label(__('inspirecms::resources/export.message.label'))
123123
->columnSpanFull()
124-
->darkTheme('tomorrow_night_eighties')
124+
->size('xs')->color('gray')
125+
->extraAttributes([
126+
'class' => 'bg-gray-100 dark:bg-gray-800 rounded-md p-2 overflow-x-auto',
127+
])
125128
->getStateUsing(function ($record) {
126129
$payload = $record->payload;
127-
128-
return collect($payload)->except('result')->all();
130+
if (! is_array($payload)) {
131+
return '';
132+
}
133+
$arr = Arr::except($payload, ['result']);
134+
return str(json_encode($arr, JSON_PRETTY_PRINT))->wrap('<code>', '</code>')->wrap('<pre>', '</pre>')->toHtmlString();
129135
}),
130136

131-
\SolutionForest\InspireCms\Filament\Infolists\Components\JsonEntry::make('payload.result')
137+
Infolists\Components\TextEntry::make('result')
132138
->label(__('inspirecms::resources/export.result.label'))
133139
->columnSpanFull()
134-
->darkTheme('tomorrow_night_eighties'),
140+
->size('xs')->color('gray')
141+
->extraAttributes([
142+
'class' => 'bg-gray-100 dark:bg-gray-800 rounded-md p-2 overflow-x-auto',
143+
])
144+
->html()
145+
->getStateUsing(function ($record) {
146+
$payload = $record->payload;
147+
if (! is_array($payload)) {
148+
return '';
149+
}
150+
$arr = $payload['result'] ?? [];
151+
if (! is_array($arr)) {
152+
$arr = [$arr];
153+
}
154+
return str(json_encode($arr, JSON_PRETTY_PRINT))->wrap('<code>', '</code>')->wrap('<pre>', '</pre>')->toHtmlString();
155+
}),
135156
]),
136157
]);
137158
}

src/Filament/Resources/Helpers/TemplateResourceHelper.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Filament\Forms;
66
use Filament\Support\Facades\FilamentIcon;
77
use Illuminate\Support\Str;
8-
use Riodwanto\FilamentAceEditor\AceEditor;
98
use SolutionForest\InspireCms\InspireCmsConfig;
109

1110
class TemplateResourceHelper
@@ -34,15 +33,11 @@ public static function getThemeFormComponent()
3433

3534
/**
3635
* @param string $name
37-
* @return Forms\Components\Field|Forms\Components\Component|AceEditor
36+
* @return Forms\Components\Field|Forms\Components\Component
3837
*/
3938
public static function getContentFormComponent($name = 'content')
4039
{
41-
return AceEditor::make($name)
42-
->label(__('inspirecms::resources/template.content.label'))
43-
->mode('php')
44-
->darkTheme('tomorrow_night_eighties')
45-
->height('48rem');
40+
return \Dotswan\FilamentCodeEditor\Fields\CodeEditor::make($name);
4641
}
4742

4843
/** @return Forms\Components\Field|Forms\Components\Component */

src/Filament/Resources/ImportResource.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,20 @@ public static function infolist(Infolist $infolist): Infolist
116116
))
117117
->copyable()->copyableState(fn ($record) => $record->author?->email),
118118

119-
\SolutionForest\InspireCms\Filament\Infolists\Components\JsonEntry::make('payload')
119+
Infolists\Components\TextEntry::make('payload')
120120
->label(__('inspirecms::resources/import.payload.label'))
121121
->columnSpanFull()
122-
->darkTheme('tomorrow_night_eighties'),
122+
->size('xs')->color('gray')
123+
->extraAttributes([
124+
'class' => 'bg-gray-100 dark:bg-gray-800 rounded-md p-2 overflow-x-auto',
125+
])
126+
->getStateUsing(function ($record) {
127+
$payload = $record->payload;
128+
if (! is_array($payload)) {
129+
return '';
130+
}
131+
return str(json_encode($payload, JSON_PRETTY_PRINT))->wrap('<code>', '</code>')->wrap('<pre>', '</pre>')->toHtmlString();
132+
}),
123133
]);
124134
}
125135

src/Filament/Resources/TemplateResource/Pages/ListTemplates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function table(Table $table): Table
6161
})
6262
->form([
6363
TemplateResourceHelper::getThemeFormComponent()->disabled(),
64-
TemplateResourceHelper::getContentFormComponent(),
64+
TemplateResourceHelper::getContentFormComponent()->isReadOnly(true),
6565
])
6666
->mutateRecordDataUsing(fn (Template $record) => [
6767
'theme' => $this->theme,

0 commit comments

Comments
 (0)