lexical-editor.blade.php 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. @php
  2. use Filament\Support\Facades\FilamentAsset;
  3. $statePath = $getStatePath();
  4. @endphp
  5. <x-dynamic-component
  6. :component="$getFieldWrapperView()"
  7. :field="$field"
  8. >
  9. <div
  10. @class([
  11. 'lexical-editor rounded-md relative text-gray-950 bg-white shadow-sm ring-1 dark:bg-white/5 dark:text-white',
  12. 'ring-gray-950/10 dark:ring-white/20' => ! $errors->has($statePath),
  13. 'ring-danger-600 dark:ring-danger-600' => $errors->has($statePath),
  14. ])
  15. >
  16. <div
  17. ax-load="visible"
  18. ax-load-src="{{ FilamentAsset::getAlpineComponentSrc('lexical-component', 'malzariey/filament-lexical-editor') }}"
  19. x-data="lexicalComponent({
  20. state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
  21. enabledToolbars: @js($getEnabledToolbars()),
  22. basicColors: @js(['#ef3346', '#1A3673', '#FF7500', '#00B6ED', '#6557B8', '#00AB16'])
  23. })"
  24. x-ignore
  25. wire:ignore
  26. class="editor-shell w-full"
  27. >
  28. <style>
  29. .lexical__h2 { font-size: 22px; font-weight: 500; }
  30. .lexical__h3 { font-size: 18px; font-weight: 400; }
  31. .lexical__h4 { font-size: 18px; font-weight: 400; }
  32. .lexical__h5 { font-size: 17.008px; font-weight: 400; }
  33. .lexical__listItem { font-size: 15px; font-weight: 400; }
  34. .lexical__paragraph { font-size: 15px; font-weight: 400; }
  35. </style>
  36. <div class="toolbar flex-wrap">
  37. @foreach($getEnabledToolbars() as $toolbar)
  38. <x-filament-lexical-editor::toolbar :toolbar="$toolbar"/>
  39. @endforeach
  40. </div>
  41. <div class="editor-container tree-view p-2 ">
  42. <div class="editor-scroller">
  43. <div x-ref="editor"
  44. @link-clicked="showLinkEditorDialog( $event.detail.target,$event.detail.url, false)"
  45. @link-created="showLinkEditorDialog( $event.detail.target, $event.detail.url,)"
  46. @close-link-editor-dialog="closeLinkEditorDialog()"
  47. class="editor" style="max-width: unset" contenteditable="true" role="textbox" spellcheck="true"
  48. aria-placeholder="Enter some rich text..." data-lexical-editor="true"/>
  49. </div>
  50. </div>
  51. <x-filament-lexical-editor::dialogs/>
  52. </div>
  53. </div>
  54. </x-dynamic-component>