File tree 6 files changed +6079
-9
lines changed
6 files changed +6079
-9
lines changed Original file line number Diff line number Diff line change 22
22
"require" : {
23
23
"php" : " ^8.1" ,
24
24
"filament/filament" : " ^3.0" ,
25
+ "illuminate/contracts" : " ^10.0" ,
25
26
"spatie/laravel-package-tools" : " ^1.15.0" ,
26
- "illuminate/contracts " : " ^10.0 "
27
+ "tempest/highlight " : " dev-main "
27
28
},
28
29
"require-dev" : {
29
30
"laravel/pint" : " ^1.0" ,
Original file line number Diff line number Diff line change 1
1
@import '../../vendor/filament/filament/resources/css/theme.css' ;
2
+ @import "../../vendor/tempest/highlight/src/Themes/highlight-light-lite.css" ;
2
3
3
4
.filament-syntax-entry-component .grid {
4
5
@apply block;
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ class="filament-syntax-entry"
6
6
package : ' parallax/filament-syntax-entry'
7
7
) )]"
8
8
>
9
- <div >
10
- {{-- <pre><code>{{ $$getState() }}</code></pre> --}}
11
- {{ $getState () } }
12
- </div >
9
+ <pre >{{ $getValue () } } </pre >
13
10
</div >
14
11
</x-dynamic-component >
Original file line number Diff line number Diff line change 3
3
namespace Parallax \FilamentSyntaxEntry ;
4
4
5
5
use Closure ;
6
- use Filament \Infolists \Components \Concerns \ HasAffixes ;
6
+ use Filament \Infolists \Components \Concerns ;
7
7
use Filament \Infolists \Components \Contracts \HasAffixActions ;
8
8
use Filament \Infolists \Components \Entry ;
9
+ use Illuminate \Support \HtmlString ;
10
+ use Illuminate \Support \Str ;
11
+ use Tempest \Highlight \Highlighter ;
9
12
10
13
class SyntaxEntry extends Entry implements HasAffixActions
11
14
{
12
- use HasAffixes;
15
+ use Concerns \CanFormatState;
16
+ use Concerns \HasAffixes;
13
17
14
18
protected string $ view = 'filament-syntax-entry::syntax-entry ' ;
15
19
@@ -19,6 +23,16 @@ class SyntaxEntry extends Entry implements HasAffixActions
19
23
20
24
protected string | Closure | null $ darkModeTheme = 'filament-dark ' ;
21
25
26
+ public function getValue (): HtmlString
27
+ {
28
+ $ state = $ this ->getState ();
29
+ $ language = $ this ->language ;
30
+ $ toParse = !is_string ($ state ) || $ language === 'json ' ? json_encode ($ state , JSON_PRETTY_PRINT ) : $ state ;
31
+ $ parsed = (new Highlighter ())->parse ($ toParse , 'json ' );
32
+
33
+ return Str::of ($ parsed )->toHtmlString ();
34
+ }
35
+
22
36
public function language (string | Closure $ language ): static
23
37
{
24
38
$ this ->language = $ language ;
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ module.exports = {
9
9
] ,
10
10
safelist : [
11
11
/ s y n t a x - e n t r y - .+ / ,
12
- / h l j s - .+ /
12
+ / h l - .+ /
13
13
]
14
14
}
You can’t perform that action at this time.
0 commit comments