rahmanramsi / filament-editorjs

MIT License
74 stars 32 forks source link

Alpine Expression Error: editorjs is not defined #19

Open Rudston opened 1 year ago

Rudston commented 1 year ago

Hello, I am getting the above error.

Alpine.start() is called in my app.js

It seems that the listener document.addEventListener("alpine:init", () => { Alpine.data( "editorjs",

Only gets set after that so it does not get triggered and as a result editorjs is not available...? Grateful for any assistance.

"filament/filament": "^2.16", "filament/forms": "^2.0", "livewire/livewire": "^2.10", "laravel/framework": "^9.19",

CeriseGoutPelican commented 1 year ago

In case useful, from @rhmrms on Discord:

  1. Publish assets
    php artisan vendor:publish --provider="FilamentEditorJs\FilamentEditorJsServiceProvider" --tag="filament-editorjs-assets"
  2. Add style in layout
    <link href="{{ asset('vendor/filament-editorjs/css/editor.css') }}" rel="stylesheet">
  3. Add scripts before Alpine
    <script src="{{ asset('vendor/filament-editorjs/js/editor.js') }}"></script>