Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit d0e226f

Browse files
Merge pull request #112 from poldixd/patch-1
Added $previewMaxHeight() and $previewMinHeight() to the disabled view
2 parents 92f8834 + 5d19c2e commit d0e226f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

resources/views/tiny-editor.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ class="overflow-hidden"
123123
@else
124124
<div
125125
x-html="state"
126-
class="block w-full max-w-none rounded-lg border border-gray-300 bg-white p-3 opacity-70 shadow-sm transition duration-75 prose dark:prose-invert dark:border-gray-600 dark:bg-gray-700 dark:text-white"
126+
@style([
127+
'max-height: '.$getPreviewMaxHeight().'px' => $getPreviewMaxHeight() > 0,
128+
'min-height: '.$getPreviewMinHeight().'px' => $getPreviewMinHeight() > 0,
129+
])
130+
class="block w-full max-w-none rounded-lg border border-gray-300 bg-white p-3 opacity-70 shadow-sm transition duration-75 prose dark:prose-invert dark:border-gray-600 dark:bg-gray-700 dark:text-white overflow-y-auto"
127131
></div>
128132
@endunless
129133
</div>

src/Components/TinyEditor.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class TinyEditor extends Field implements Contracts\CanBeLengthConstrained, Cont
2222

2323
protected int $minHeight = 0;
2424

25+
protected int $previewMaxHeight = 0;
26+
27+
protected int $previewMinHeight = 0;
28+
2529
// TinyMCE var: external_plugins
2630
protected array $externalPlugins;
2731

@@ -73,6 +77,16 @@ public function getMinHeight(): int
7377
return $this->minHeight;
7478
}
7579

80+
public function getPreviewMaxHeight(): int
81+
{
82+
return $this->previewMaxHeight;
83+
}
84+
85+
public function getPreviewMinHeight(): int
86+
{
87+
return $this->previewMinHeight;
88+
}
89+
7690
public function getFileAttachmentsDirectory(): ?string
7791
{
7892
return filled($directory = $this->evaluate($this->fileAttachmentsDirectory)) ? $directory : config('filament-forms-tinyeditor.profiles.'.$this->profile.'.upload_directory');
@@ -257,6 +271,20 @@ public function minHeight(int $minHeight): static
257271
return $this;
258272
}
259273

274+
public function previewMaxHeight(int $previewMaxHeight): static
275+
{
276+
$this->previewMaxHeight = $previewMaxHeight;
277+
278+
return $this;
279+
}
280+
281+
public function previewMinHeight(int $previewMinHeight): static
282+
{
283+
$this->previewMinHeight = $previewMinHeight;
284+
285+
return $this;
286+
}
287+
260288
public function isSimple(): bool
261289
{
262290
return (bool) $this->evaluate($this->isSimple);

0 commit comments

Comments
 (0)