Load assets from remote storage
See original GitHub issueHi, at first - thank you for this editor, its great and I will surely use it in many projects! 😃
I have a problem with loading assets on init.
My storage configuration is:
storageManager: {
type: 'remote',
urlStore: '{!! url('admin/marketing/subscription/campaigns/store', [$model->id]) !!}',
urlLoad: '{!! url('admin/marketing/subscription/campaigns/load', [$model->id]) !!}',
contentTypeJson: true
}
My load function in PHP:
foreach((array)$entity->assets as $asset)
{
$assets[] = ['src' => File::find($asset)->getFullUrl(), 'type' => 'image'];
}
return response()->json(['gjs-html' => $entity->content, 'gjs-css' => $entity->styles, 'gjs-assets' => $assets]);
And Im returning this JSON from backend:
{"gjs-html":"SOME HTML", "gjs-css":"SOME CSS", "gjs-assets":[{"src":"http:\/\/edito.localhost\/storage\/image\/cms_subscription_campaigns\/2017\/6\/27\/4db7ee187e2798fe7828c88cc79e70af\/IMG_9489m.jpg","type":"image"}]}
In result, I have all HTML and CSS loaded in editor, but images (assets) component is still empty. How to return data from load function in backend to fill assets component with my files?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Thanks, any quick fix i can plug just for temporary testing purposes?
ah ok the loader, in asset manager, uses
JSON.parse
on any value 😁 will fix it for the next release