For example I implemented laravel-grapesjs in my Page model. While building the page, I would like to add a block of "Latest posts".
In the latest posts, just simply load the latest posts dynamically even after the page is saved.
First, I tried to add a custom template/block with foreach loop
@foreach($posts as $post)
{{$post->title}}
@endforeach
It did load the latest posts in the editor but then save as static content.
=======================
Then I created an api to get posts and try to load the post with ajax.
Adding the ajax script is a good solution but dont add it through the grapeJS editor. Add it as an extra field somewhere in edit page, save it as a different attribute of your model and show it that way.
For example I implemented laravel-grapesjs in my Page model. While building the page, I would like to add a block of "Latest posts". In the latest posts, just simply load the latest posts dynamically even after the page is saved.
First, I tried to add a custom template/block with foreach loop
It did load the latest posts in the editor but then save as static content.
======================= Then I created an api to get posts and try to load the post with ajax.
But still fail because when adding the block to editor, the script part got removed.
==========================
Doese any one know how we can add dynamic content? Thank you for the great package!