mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-01 00:06:52 +01:00 
			
		
		
		
	Fix missing font (#1404)
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									bd2a00760d
								
							
						
					
					
						commit
						af609994b6
					
				| @ -32,6 +32,7 @@ use Filament\Forms\Components\Textarea; | |||||||
| use Filament\Forms\Components\TextInput; | use Filament\Forms\Components\TextInput; | ||||||
| use Filament\Forms\Components\ToggleButtons; | use Filament\Forms\Components\ToggleButtons; | ||||||
| use Filament\Forms\Get; | use Filament\Forms\Get; | ||||||
|  | use Filament\Forms\Set; | ||||||
| use Filament\Notifications\Notification; | use Filament\Notifications\Notification; | ||||||
| use Filament\Pages\Auth\EditProfile as BaseEditProfile; | use Filament\Pages\Auth\EditProfile as BaseEditProfile; | ||||||
| use Filament\Support\Colors\Color; | use Filament\Support\Colors\Color; | ||||||
| @ -402,27 +403,35 @@ class EditProfile extends BaseEditProfile | |||||||
|                                                     }) |                                                     }) | ||||||
|                                                     ->reactive() |                                                     ->reactive() | ||||||
|                                                     ->default('monospace') |                                                     ->default('monospace') | ||||||
|                                                     ->afterStateUpdated(fn ($state, callable $set) => $set('font_preview', $state)), |                                                     ->afterStateUpdated(fn ($state, Set $set) => $set('font_preview', $state)), | ||||||
|                                                 Placeholder::make('font_preview') |                                                 Placeholder::make('font_preview') | ||||||
|                                                     ->label(trans('profile.font_preview')) |                                                     ->label(trans('profile.font_preview')) | ||||||
|                                                     ->columnSpan(2) |                                                     ->columnSpan(2) | ||||||
|                                                     ->content(function (Get $get) { |                                                     ->content(function (Get $get) { | ||||||
|                                                         $fontName = $get('console_font') ?? 'monospace'; |                                                         $fontName = $get('console_font') ?? 'monospace'; | ||||||
|                                                         $fontSize = $get('console_font_size') . 'px'; |                                                         $fontSize = $get('console_font_size') . 'px'; | ||||||
|                                                         $fontUrl = asset("storage/fonts/{$fontName}.ttf"); |                                                         $style = <<<CSS | ||||||
| 
 |  | ||||||
|                                                         return new HtmlString(<<<HTML |  | ||||||
|                                                                     <style> |  | ||||||
|                                                                         @font-face { |  | ||||||
|                                                                             font-family: "CustomPreviewFont"; |  | ||||||
|                                                                             src: url("$fontUrl"); |  | ||||||
|                                                                         } |  | ||||||
|                                                             .preview-text { |                                                             .preview-text { | ||||||
|                                                                             font-family: "CustomPreviewFont"; |                                                                 font-family: $fontName; | ||||||
|                                                                 font-size: $fontSize; |                                                                 font-size: $fontSize; | ||||||
|                                                                 margin-top: 10px; |                                                                 margin-top: 10px; | ||||||
|                                                                 display: block; |                                                                 display: block; | ||||||
|                                                             } |                                                             } | ||||||
|  |                                                         CSS; | ||||||
|  |                                                         if ($fontName !== 'monospace') { | ||||||
|  |                                                             $fontUrl = asset("storage/fonts/$fontName.ttf"); | ||||||
|  |                                                             $style = <<<CSS | ||||||
|  |                                                                 @font-face { | ||||||
|  |                                                                     font-family: $fontName; | ||||||
|  |                                                                     src: url("$fontUrl"); | ||||||
|  |                                                                 } | ||||||
|  |                                                                 $style | ||||||
|  |                                                             CSS; | ||||||
|  |                                                         } | ||||||
|  | 
 | ||||||
|  |                                                         return new HtmlString(<<<HTML | ||||||
|  |                                                             <style> | ||||||
|  |                                                             {$style}   | ||||||
|                                                             </style> |                                                             </style> | ||||||
|                                                             <span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span> |                                                             <span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span> | ||||||
|                                                         HTML); |                                                         HTML); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
|         $userFontSize = auth()->user()->getCustomization()['console_font_size'] ?? 14; |         $userFontSize = auth()->user()->getCustomization()['console_font_size'] ?? 14; | ||||||
|         $userRows =  auth()->user()->getCustomization()['console_rows'] ?? 30; |         $userRows =  auth()->user()->getCustomization()['console_rows'] ?? 30; | ||||||
|     @endphp |     @endphp | ||||||
|     @if($userFont) |     @if($userFont !== "monospace") | ||||||
|         <link rel="preload" href="{{ asset("storage/fonts/{$userFont}.ttf") }}" as="font" crossorigin> |         <link rel="preload" href="{{ asset("storage/fonts/{$userFont}.ttf") }}" as="font" crossorigin> | ||||||
|         <style> |         <style> | ||||||
|             @font-face { |             @font-face { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 JoanFo
						JoanFo