maxeckel / livewire-editorjs

This Package aims for an easy integration of Editor.JS with Laravel Livewire
MIT License
146 stars 20 forks source link

Demo #19

Closed BenjaminHoegh closed 2 years ago

BenjaminHoegh commented 2 years ago

Do you have a repo where you have set up a full working example? I may just be stupid but I don't quite get how to make it work

maxeckel commented 2 years ago

Hey Benjamin, no there is no repo with an demo. But you could show me how you tried to implement it, so that I am able to help you.

BenjaminHoegh commented 2 years ago

Well right now it just a clean install of Laravel, Livewire and AlpineJS.

then I inserted the code you provided:

<html>
    <head>
        @livewireStyles
    </head>
    <body>

        @livewire('editorjs', [
            'editorId' => "myEditor",
            'value' => $value,
            'uploadDisk' => 'public',
            'downloadDisk' => 'public',
            'class' => '...',
            'style' => '...',
            'readOnly' => true,
            'placeholder' => 'Lorem ipsum dolor sit amet'
        ])

        @livewireScripts
        <script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.2/dist/alpine.min.js"></script>
    </body>
</html>

Then i'm getting Undefined variable $value

maxeckel commented 2 years ago

That's probably because you don't provide a value. Ff you don't pass a value to the view that can not work. Also I don't see the inclusion of the provided scripts using "@livewireEditorjsScripts".

Please refer to the installation instructions of the readme.

BenjaminHoegh commented 2 years ago

Okay so now it works. how do I get it to save the data from it when pressing a button?

https://github.com/BenjaminHoegh/LivewireEditorJS

maxeckel commented 2 years ago

The Editor syncs its state to the server when the content changes. It emits a livewire event with the state. Please refer to the docs: https://github.com/maxeckel/livewire-editorjs#events--saving-state