Skip to content

Commit 3a40dff

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent e8c3c1b commit 3a40dff

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

src/Filament/Forms/Components/MarkdownEditor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function mutateMediaPickerState(Model | MediaAsset $mediaAsset)
176176

177177
// Determine media type and tag
178178
$type = 'link'; // Default to link
179-
179+
180180
if ($mediaAsset->isImage()) {
181181
$type = 'img';
182182

@@ -188,11 +188,11 @@ protected function mutateMediaPickerState(Model | MediaAsset $mediaAsset)
188188
});
189189

190190
$attributes['data-media-thumbnail'] = $thumbnail;
191-
}
191+
}
192192
// Video handling
193193
elseif ($mimeType && str_starts_with($mimeType, 'video/')) {
194194
$type = 'video';
195-
195+
196196
// Add video-specific attributes
197197
$attributes['data-media-type'] = 'video';
198198
$attributes['controls'] = 'controls';
@@ -203,7 +203,7 @@ protected function mutateMediaPickerState(Model | MediaAsset $mediaAsset)
203203
// Audio handling
204204
elseif ($mimeType && str_starts_with($mimeType, 'audio/')) {
205205
$type = 'audio';
206-
206+
207207
// Add audio-specific attributes
208208
$attributes['data-media-type'] = 'audio';
209209
$attributes['controls'] = 'controls';
@@ -212,8 +212,8 @@ protected function mutateMediaPickerState(Model | MediaAsset $mediaAsset)
212212

213213
// Convert attributes array to string
214214
$attributesString = collect($attributes)
215-
->filter(fn($value) => !is_null($value) && $value !== '')
216-
->map(fn($value, $key) => in_array($value, ['controls', 'metadata']) ? $key : "{$key}=\"{$value}\"")
215+
->filter(fn ($value) => ! is_null($value) && $value !== '')
216+
->map(fn ($value, $key) => in_array($value, ['controls', 'metadata']) ? $key : "{$key}=\"{$value}\"")
217217
->join(' ');
218218

219219
$content = match ($type) {

src/Filament/Forms/Components/RichEditor/Plugins/MediaPickerRichPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function mutateMediaPickerState(Model | MediaAsset $mediaAsset)
139139
'title' => $title,
140140
'filename' => $media?->file_name,
141141
'mimeType' => $media?->mime_type,
142-
... ($mediaAsset->isImage() ? [
142+
...($mediaAsset->isImage() ? [
143143
'responsive' => collect($mediaAsset->getResponsiveImages(isAbsolute: false))
144144
->flatten(1)
145145
->pluck('url', 'width')

src/Filament/Forms/Components/RichEditor/TipTapExtensions/CmsMediaAssetExtension.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace SolutionForest\InspireCms\Filament\Forms\Components\RichEditor\TipTapExtensions;
44

5-
use Illuminate\Support\Arr;
65
use Tiptap\Core\Node;
76
use Tiptap\Utils\HTML;
87

@@ -65,8 +64,7 @@ public function addAttributes(): array
6564
public function renderHTML($node, array $HTMLAttributes = []): array
6665
{
6766
$innerContent = match (true) {
68-
str_starts_with($node->attrs?->mimeType ?? '', 'image/') =>
69-
!str_ends_with($node->attrs?->filename ?? '', '.svg')
67+
str_starts_with($node->attrs?->mimeType ?? '', 'image/') => ! str_ends_with($node->attrs?->filename ?? '', '.svg')
7068
? sprintf(
7169
'<a href="%s" target="_blank" rel="noopener noreferrer" class="trix-attachment-mediapicker-link"><img src="%s" alt="%s" loading="lazy" class="trix-attachment-image trix-attachment-mediapicker-img" %s></a>',
7270
htmlspecialchars($node->attrs?->url ?? ''),
@@ -79,18 +77,16 @@ public function renderHTML($node, array $HTMLAttributes = []): array
7977
htmlspecialchars($node->attrs?->thumbnailUrl ?? $node->attrs?->url ?? ''),
8078
htmlspecialchars($node->attrs?->title ?? ''),
8179
),
82-
str_starts_with($node->attrs?->mimeType ?? '', 'video/') =>
83-
sprintf(
84-
'<video controls src="%s" alt="%s" loading="lazy" class="trix-attachment-video trix-attachment-mediapicker-video"></video>',
85-
htmlspecialchars($node->attrs?->url ?? ''),
86-
htmlspecialchars($node->attrs?->title ?? ''),
87-
),
88-
str_starts_with($node->attrs?->mimeType ?? '', 'audio/') =>
89-
sprintf(
90-
'<audio controls src="%s" alt="%s" loading="lazy" class="trix-attachment-audio trix-attachment-mediapicker-audio"></audio>',
91-
htmlspecialchars($node->attrs?->url ?? ''),
92-
htmlspecialchars($node->attrs?->title ?? ''),
93-
),
80+
str_starts_with($node->attrs?->mimeType ?? '', 'video/') => sprintf(
81+
'<video controls src="%s" alt="%s" loading="lazy" class="trix-attachment-video trix-attachment-mediapicker-video"></video>',
82+
htmlspecialchars($node->attrs?->url ?? ''),
83+
htmlspecialchars($node->attrs?->title ?? ''),
84+
),
85+
str_starts_with($node->attrs?->mimeType ?? '', 'audio/') => sprintf(
86+
'<audio controls src="%s" alt="%s" loading="lazy" class="trix-attachment-audio trix-attachment-mediapicker-audio"></audio>',
87+
htmlspecialchars($node->attrs?->url ?? ''),
88+
htmlspecialchars($node->attrs?->title ?? ''),
89+
),
9490
default => sprintf(
9591
'<a href="%s" target="_blank" rel="noopener noreferrer" class="trix-attachment-mediapicker-link">%s</a>',
9692
htmlspecialchars($node->attrs?->url ?? ''),
@@ -120,15 +116,16 @@ private function convertResponsiveAttributes($elements)
120116
$responsiveData = [];
121117
if ($elements instanceof \stdClass) {
122118
$elements = json_decode(json_encode($elements), true);
123-
} else if (is_string($elements)) {
119+
} elseif (is_string($elements)) {
124120
$elements = json_decode($elements, true);
125-
}
126-
if (!is_array($elements)) {
121+
}
122+
if (! is_array($elements)) {
127123
return $responsiveData;
128124
}
129125
foreach ($elements as $key => $value) {
130126
$responsiveData["data-image-responsive__{$key}"] = $value;
131127
}
128+
132129
return $responsiveData;
133130
}
134131
}

0 commit comments

Comments
 (0)