Skip to content

Commit

Permalink
fix: editor height when having multiple editors in same page
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardcreagia committed Jul 10, 2023
1 parent 140b799 commit f3dc579
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 0 additions & 8 deletions resources/css/plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,3 @@
.cm-content {
padding: 0.5rem !important;
}

.cm-scroller {
max-height: var(--maxInputHeight) !important;
}

.cm-scroller, .cm-gutter {
min-height: var(--minInputHeight) !important;
}
2 changes: 1 addition & 1 deletion resources/dist/filament-code-field.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions resources/views/code-field.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
:disabled="$isDisabled()"
dir="ltr"
>
@php($codeFieldId = 'code-field-'.\Illuminate\Support\Str::slug($getId()))

<style>
:root {
--minInputHeight: {{ $getMinHeight() }};
--maxInputHeight: {{ $getMaxHeight() }};
#{{ $codeFieldId }} .cm-scroller {
max-height: {{ $getMaxHeight() }} !important;
}
#{{ $codeFieldId }} .cm-scroller, .cm-gutter {
min-height: {{ $getMinHeight() }} !important;
}
</style>

<div x-data="filamentCodeField({
state: $wire.{{ $applyStateBindingModifiers('entangle(\''.$getStatePath().'\')') }},
displayMode: {{ $displayMode ? 1 : 0 }},
Expand All @@ -27,9 +33,10 @@
withLineNumbers: {{ $lineNumbers ? 1 : 0 }},
withAutocompletion: {{ $autocompletion ? 1 : 0 }}
})">
<div wire:ignore
x-ref="codeBlock"
class="bg-white border overflow-hidden block w-full transition duration-75 rounded-lg shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-inset focus:ring-primary-500 disabled:opacity-70 dark:bg-gray-700 dark:text-white dark:focus:border-primary-500 border-gray-300 dark:border-gray-600"
></div>
<div id="{{ $codeFieldId }}" wire:ignore>
<div x-ref="codeBlock"
class="bg-white border overflow-hidden block w-full transition duration-75 rounded-lg shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-inset focus:ring-primary-500 disabled:opacity-70 dark:bg-gray-700 dark:text-white dark:focus:border-primary-500 border-gray-300 dark:border-gray-600"
></div>
</div>
</div>
</x-dynamic-component>

0 comments on commit f3dc579

Please sign in to comment.