mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Integrate Trix editor
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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 }}"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -13,6 +13,6 @@
|
||||
@yield('content')
|
||||
@livewireScripts
|
||||
@filamentScripts
|
||||
@stack('scripts')
|
||||
@stack('js')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Fields;
|
||||
|
||||
class Trix extends Field {
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user