mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Add Comic Mono to the list (#1330)
* Add Comic Mono to list and make default * Update preview * Create folder if missing. * match composer lock from pr
This commit is contained in:
parent
82ef6c1408
commit
a5ffff8c8c
@ -377,7 +377,15 @@ class EditProfile extends BaseEditProfile
|
||||
Select::make('console_font')
|
||||
->label(trans('profile.font'))
|
||||
->options(function () {
|
||||
$fonts = [];
|
||||
$fonts = [
|
||||
'ComicMono' => 'ComicMono ( Default )', //default
|
||||
];
|
||||
|
||||
if (!File::exists(public_path('storage/fonts'))) {
|
||||
File::makeDirectory(public_path('storage/fonts'));
|
||||
$this->fillForm();
|
||||
}
|
||||
|
||||
foreach (File::allFiles(public_path('storage/fonts')) as $file) {
|
||||
if ($file->getExtension() === 'ttf') {
|
||||
$name = pathinfo($file->getFilename(), PATHINFO_FILENAME);
|
||||
@ -388,14 +396,29 @@ class EditProfile extends BaseEditProfile
|
||||
return $fonts;
|
||||
})
|
||||
->reactive()
|
||||
->default('ComicMono')
|
||||
->afterStateUpdated(fn ($state, callable $set) => $set('font_preview', $state)),
|
||||
Placeholder::make('font_preview')
|
||||
->label('Preview')
|
||||
->content(function (Get $get) {
|
||||
$fontName = $get('console_font') ?? 'No font selected.';
|
||||
|
||||
$fontUrl = asset("storage/fonts/{$fontName}.ttf");
|
||||
$fontSize = $get('console_font_size') . 'px';
|
||||
$fontUrl = asset("storage/fonts/{$fontName}.ttf");
|
||||
|
||||
if ($fontName === 'ComicMono') {
|
||||
return new HtmlString(<<<HTML
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/comic-mono@0.0.1/index.css">
|
||||
<style>
|
||||
.preview-text {
|
||||
font-family: Comic Mono;
|
||||
font-size: $fontSize;
|
||||
margin-top: 10px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span>
|
||||
HTML);
|
||||
}
|
||||
|
||||
return new HtmlString(<<<HTML
|
||||
<style>
|
||||
|
4
composer.lock
generated
4
composer.lock
generated
@ -4,11 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
<<<<<<< HEAD
|
||||
"content-hash": "27da5be2bf613398e6fa75cdf8131bf7",
|
||||
=======
|
||||
"content-hash": "5c5a89d4207dd9efb7a8c3a410aa838c",
|
||||
>>>>>>> main
|
||||
"packages": [
|
||||
{
|
||||
"name": "abdelhamiderrahmouni/filament-monaco-editor",
|
||||
|
Loading…
x
Reference in New Issue
Block a user