I had such a problem with CKEditor, perhaps the solution will help you.
I've had to wrap the textarea (ckeditor flag for ckeditor) inside a div.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I'm trying to load a comment's data to update using tinymce but it comes up empty, does anyone have any idea what I'm doing wrong? when I remove tinymce the data loads but I need tinycme to format the comments.
Thanks in advance. UPDATE: I am able to successfully edit but. however, the comment date is not displayed. It simply goes blank. After editing the new edition is displayed successfully, I'm having trouble loading the old text data so I can edit the comment. Does anyone have any idea what could be wrong?
code-->
<div>
<div class="mb-2" wire:ignore>
<label class="block font-medium text-sm text-gray-700" for="page-text-editor">Edit Comment</label>
<textarea x-ref="editComment" wire:model.defer="body" name="post" cols="30" rows="4" class="page_text w-full bg-gray-100 rounded-xl border-none placeholder-gray-900 text-sm px-4 py-2"
x-data
x-init="
tinymce.init({
path_absolute: '/',
selector: 'textarea.page_text',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen ',
'insertdatetime media nonbreaking save table directionality',
'emoticons template paste textpattern imagetools help '
],
toolbar: 'insertfile undo redo | styleselect | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media | help ',
relative_urls: false,
remove_script_host : false,
document_base_url: '{{config('app.url')}}/',
language: 'pt_BR',
setup: function (editor) {
editor.on('init change', function () {
editor.save();
});
editor.on('change', function (e) {
@this.set('body', editor.getContent());
});
},
});
">
</textarea>
</div>
</div>
Livewire edit comment
class EditComment extends Component { public Comment $comment; public $body;
protected $rules = [
'body' => 'required|min:4',
];
protected $listeners = ['setEditComment'];
public function setEditComment($commentId)
{
$this->comment = Comment::findOrFail($commentId);
$this->body = $this->comment->body;
$this->emit('editCommentWasSet');
}
public function updateComment()
{
if (auth()->guest() || auth()->user()->cannot('update', $this->comment)) {
abort(Response::HTTP_FORBIDDEN);
}
$this->validate();
$this->comment->body = $this->body;
$this->comment->save();
$this->emit('commentWasUpdated', 'Comment was updated!');
}
public function render()
{
return view('livewire.edit-comment');
}
}
I had such a problem with CKEditor, perhaps the solution will help you.
I've had to wrap the textarea (ckeditor flag for ckeditor) inside a div.
Please or to participate in this conversation.