Skip to content

Commit

Permalink
Merge pull request #112 from poldixd/patch-1
Browse files Browse the repository at this point in the history
Added $previewMaxHeight() and $previewMinHeight() to the disabled view
  • Loading branch information
mohamedsabil83 authored Nov 14, 2023
2 parents 92f8834 + 5d19c2e commit d0e226f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resources/views/tiny-editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ class="overflow-hidden"
@else
<div
x-html="state"
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"
@style([
'max-height: '.$getPreviewMaxHeight().'px' => $getPreviewMaxHeight() > 0,
'min-height: '.$getPreviewMinHeight().'px' => $getPreviewMinHeight() > 0,
])
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"
></div>
@endunless
</div>
Expand Down
28 changes: 28 additions & 0 deletions src/Components/TinyEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class TinyEditor extends Field implements Contracts\CanBeLengthConstrained, Cont

protected int $minHeight = 0;

protected int $previewMaxHeight = 0;

protected int $previewMinHeight = 0;

// TinyMCE var: external_plugins
protected array $externalPlugins;

Expand Down Expand Up @@ -73,6 +77,16 @@ public function getMinHeight(): int
return $this->minHeight;
}

public function getPreviewMaxHeight(): int
{
return $this->previewMaxHeight;
}

public function getPreviewMinHeight(): int
{
return $this->previewMinHeight;
}

public function getFileAttachmentsDirectory(): ?string
{
return filled($directory = $this->evaluate($this->fileAttachmentsDirectory)) ? $directory : config('filament-forms-tinyeditor.profiles.'.$this->profile.'.upload_directory');
Expand Down Expand Up @@ -257,6 +271,20 @@ public function minHeight(int $minHeight): static
return $this;
}

public function previewMaxHeight(int $previewMaxHeight): static
{
$this->previewMaxHeight = $previewMaxHeight;

return $this;
}

public function previewMinHeight(int $previewMinHeight): static
{
$this->previewMinHeight = $previewMinHeight;

return $this;
}

public function isSimple(): bool
{
return (bool) $this->evaluate($this->isSimple);
Expand Down

0 comments on commit d0e226f

Please sign in to comment.