Integrate Trix editor

This commit is contained in:
Ryan Scherler
2020-12-15 14:55:05 -08:00
parent a037ad9733
commit 1c9d7c3ad1
7 changed files with 49 additions and 7 deletions
+1
View File
@@ -8,6 +8,7 @@
],
"license": "MIT",
"require": {
"appstract/laravel-blade-directives": "^1.10",
"blade-ui-kit/blade-heroicons": "^0.3",
"graham-campbell/markdown": "^13.1",
"league/glide-laravel": "^1.0",
+3 -1
View File
@@ -6,7 +6,9 @@
@if ($model)
{{ $modelDirective }}="{{ $model }}"
@endif
{{ old($model ?? $name) ? 'checked' : '' }}
@isset($checked)
checked
@endisset
@if ($extraAttributes)
@foreach ($extraAttributes as $attribute => $value)
{{ $attribute }}="{{ $value }}"
+3 -4
View File
@@ -4,9 +4,7 @@
<input type="{{ $type }}"
name="{{ $name }}"
id="{{ $id ?? $name }}"
@if ($value)
value="{{ old($model ?? $name, $value) }}"
@endif
value="{{ $value ?? '' }}"
@if ($model)
{{ $modelDirective }}="{{ $model }}"
@endif
@@ -15,5 +13,6 @@
{{ $attribute }}="{{ $value }}"
@endforeach
@endif
class="block w-full rounded shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 @error($model ?? $name) border-red-600 motion-safe:animate-shake @else border-gray-300 @enderror">
class="block w-full rounded shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 @error($model ?? $name) border-red-600 motion-safe:animate-shake @else border-gray-300 @enderror"
/>
@overwrite
+1 -1
View File
@@ -13,6 +13,6 @@
@endforeach
@endif
class="block w-full rounded shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 @error($model ?? $name) border-red-600 motion-safe:animate-shake @else border-gray-300 @enderror">
{{ old($model ?? $name, $value) }}
{{ $value ?? '' }}
</textarea>
@overwrite
+33
View File
@@ -0,0 +1,33 @@
@extends('filament::layouts.field-group')
@pushonce('head:trix')
@style('https://www.unpkg.com/trix@1.3.1/dist/trix.css')
@endpushonce
@pushonce('js:trix')
@script('https://www.unpkg.com/trix@1.3.1/dist/trix.js')
@endpushonce
@section('field')
<div
wire:ignore
@if ($model)
{{ $modelDirective }}="{{ $model }}"
@endif
x-data
@trix-blur="$dispatch('change', $event.target.value)"
>
<input type="hidden" id="value-{{ $id ?? $name }}" value="{{ $value ?? '' }}" />
<trix-editor
id="{{ $id ?? $name }}"
input="value-{{ $id ?? $name }}"
class="block w-full rounded shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 border-gray-300"
@if ($extraAttributes)
@foreach ($extraAttributes as $attribute => $value)
{{ $attribute }}="{{ $value }}"
@endforeach
@endif
></trix-editor>
</div>
@overwrite
+1 -1
View File
@@ -13,6 +13,6 @@
@yield('content')
@livewireScripts
@filamentScripts
@stack('scripts')
@stack('js')
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
<?php
namespace Filament\Fields;
class Trix extends Field {
//
}