Include bundle in view data
This commit is contained in:
parent
ee00d22095
commit
fc15d21314
|
@ -384,11 +384,11 @@ private function getBladeComponent(array $data, ?array $variant, ?array $options
|
||||||
{
|
{
|
||||||
switch ($this->kind) {
|
switch ($this->kind) {
|
||||||
case self::Images:
|
case self::Images:
|
||||||
return new Image($data, $variant, $options);
|
return new Image($this->bundle, $data, $variant, $options);
|
||||||
case self::Sounds:
|
case self::Sounds:
|
||||||
return new Sound($data);
|
return new Sound($this->bundle, $data);
|
||||||
case self::Videos:
|
case self::Videos:
|
||||||
return new Video($data);
|
return new Video($this->bundle, $data);
|
||||||
default:
|
default:
|
||||||
throw new Exception(sprintf('Unknown Blade Component for attachment kind "%s"', $this->kind));
|
throw new Exception(sprintf('Unknown Blade Component for attachment kind "%s"', $this->kind));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\View\Components;
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use App\Classes\Bundle;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
@ -15,7 +16,7 @@ abstract class BaseMediaComponent extends Component
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(protected array $data, protected ?array $variant = [], protected ?array $options = [])
|
public function __construct(protected Bundle $bundle, protected array $data, protected ?array $variant = [], protected ?array $options = [])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ public function render(): View|Closure|string
|
||||||
'originalData' => $this->data,
|
'originalData' => $this->data,
|
||||||
'variantData' => $this->variant,
|
'variantData' => $this->variant,
|
||||||
'options' => $this->options,
|
'options' => $this->options,
|
||||||
|
'bundle' => $this->bundle,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<div class="chat-me markdown-body">{!! (new \App\Services\Markdown\Formatter($slot))->render() !!}</div>
|
<div class="chat-me markdown-body">{!! (new \App\Services\Markdown\Formatter($slot, $mainBundle))->render() !!}</div>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
@props(['name'])
|
@props(['name'])
|
||||||
|
|
||||||
<div class="chat-other markdown-body">{!! (new \App\Services\Markdown\Formatter($slot))->render() !!}</div>
|
<div class="chat-other markdown-body">{!! (new \App\Services\Markdown\Formatter($slot, $mainBundle))->render() !!}</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<figure>
|
<figure>
|
||||||
@if (!empty($originalData['prompt']) && empty($options['nolink']))
|
@if (!empty($originalData['prompt']) && empty($options['nolink']))
|
||||||
<figcaption class="markdown-body">
|
<figcaption class="markdown-body">
|
||||||
{!! (new \App\Services\Markdown\Formatter($originalData['prompt']))->render() !!}
|
{!! (new \App\Services\Markdown\Formatter($originalData['prompt'], $bundle))->render() !!}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
@endif
|
@endif
|
||||||
@if(!empty($options['nolink']))
|
@if(!empty($options['nolink']))
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
@if (empty($options['nolink']) && (!empty($originalData['title']) || !empty($originalData['attribution'])))
|
@if (empty($options['nolink']) && (!empty($originalData['title']) || !empty($originalData['attribution'])))
|
||||||
<figcaption class="markdown-body">
|
<figcaption class="markdown-body">
|
||||||
@if (!empty($originalData['title']))
|
@if (!empty($originalData['title']))
|
||||||
{!! (new \App\Services\Markdown\Formatter($originalData['title']))->render() !!}
|
{!! (new \App\Services\Markdown\Formatter($originalData['title'], $bundle))->render() !!}
|
||||||
@endif
|
@endif
|
||||||
@if (!empty($originalData['attribution']))
|
@if (!empty($originalData['attribution']))
|
||||||
{!! (new \App\Services\Markdown\Formatter($originalData['attribution']))->render() !!}
|
{!! (new \App\Services\Markdown\Formatter($originalData['attribution'], $bundle))->render() !!}
|
||||||
@endif
|
@endif
|
||||||
</figcaption>
|
</figcaption>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</audio>
|
</audio>
|
||||||
<figcaption class="markdown-body">
|
<figcaption class="markdown-body">
|
||||||
@if (!empty($originalData['title']))
|
@if (!empty($originalData['title']))
|
||||||
{!! (new \App\Services\Markdown\Formatter($originalData['title']))->render() !!}
|
{!! (new \App\Services\Markdown\Formatter($originalData['title'], $bundle))->render() !!}
|
||||||
@endif
|
@endif
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<details class="spoiler">
|
<details class="spoiler">
|
||||||
<summary>Spoiler</summary>
|
<summary>Spoiler</summary>
|
||||||
<div class="markdown-body">{!! (new \App\Services\Markdown\Formatter($slot))->render() !!}</div>
|
<div class="markdown-body">{!! (new \App\Services\Markdown\Formatter($slot, $mainBundle))->render() !!}</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<details class="update">
|
<details class="update">
|
||||||
<summary>{{ $title }}</summary>
|
<summary>{{ $title }}</summary>
|
||||||
<div class="markdown-body">{!! (new \App\Services\Markdown\Formatter($slot))->render() !!}</div>
|
<div class="markdown-body">{!! (new \App\Services\Markdown\Formatter($slot, $mainBundle))->render() !!}</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user