diff --git a/app/View/Form/Editor.php b/app/View/Form/Editor.php
index 14877977..8a608370 100644
--- a/app/View/Form/Editor.php
+++ b/app/View/Form/Editor.php
@@ -31,14 +31,18 @@ class Editor extends Component
@endif
-
wire('model')->value}} = $event.detail" x-bind="editor"x-data="{
- value: $wire.{{$attributes->wire('model')->value}},
- }" id="{{$id}}" {{$attributes}}>
+ "
+ @updated="$wire.{{$attributes->wire('model')->value}} = $event.detail"
+ x-data="editor($wire.{{$attributes->wire('model')->value}})"
+ id="{{$id}}"
+ {{$attributes}}
+ >
@if($hint)
{{$hint}}
diff --git a/resources/livewire-js/app.js b/resources/livewire-js/app.js
index 0820e9da..f48b0dd1 100644
--- a/resources/livewire-js/app.js
+++ b/resources/livewire-js/app.js
@@ -18,7 +18,7 @@ Alpine.plugin(
window.addEventListener('success', (event) => success(event.detail[0]));
document.addEventListener('alpine:init', () => {
- Alpine.bind('editor', () => editor);
+ Alpine.data('editor', editor);
});
Livewire.start();
diff --git a/resources/livewire-js/editor.js b/resources/livewire-js/editor.js
index 02d35376..7a0de2b8 100644
--- a/resources/livewire-js/editor.js
+++ b/resources/livewire-js/editor.js
@@ -5,11 +5,11 @@ import Paragraph from '@editorjs/paragraph';
import NestedList from '@editorjs/nested-list';
import Alert from 'editorjs-alert';
-export default {
- 'editor': null,
- 'value': null,
+export default (initialValue) => ({
+ editor: null,
+ value: initialValue,
- 'x-init': function () {
+ init: function () {
var tools = {
paragraph: {
class: Paragraph,
@@ -57,4 +57,4 @@ export default {
}, 200),
});
},
-};
+});