Skip to content

Commit

Permalink
Fix View mode
Browse files Browse the repository at this point in the history
Force mode to preview when field is disabled
  • Loading branch information
invaders-xx committed Sep 8, 2022
1 parent d211a15 commit 18a8fbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 0 additions & 7 deletions resources/views/json-editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,8 @@
})"
x-cloak
wire:ignore>
@unless($isDisabled())
<div x-ref="editor" class="w-full ace_editor"
style="min-height: 30vh;height:{{ $getHeight() }}px"></div>
@else
<div
x-html="state"
class="max-w-none p-3 prose border border-gray-300 rounded shadow-sm"
></div>
@endunless
</div>
</x-forms::field-wrapper>

4 changes: 4 additions & 0 deletions src/Forms/JSONEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function getHeight(): ?int

public function getModes(): ?string
{
if ($this->isDisabled())
{
$this->modes = ['preview'];
}
return json_encode($this->evaluate($this->modes));
}

Expand Down

0 comments on commit 18a8fbc

Please sign in to comment.