-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load assets from remote storage #128
Comments
Hi @adrian1207 your JSON is correct, I think there is might be a bug with the Asset Manager loader. For a moment, as a workaround, I'd suggest loading assets via the main config: ...
assetManager: {
assets: {!! $jsonAssets !!}
}, |
Hi, I have got the latest version and I also seem to have nothing rendering. The JSON that is being returned looks like this.
I have the latest version of Grapesjs: 0.9.4. Maybe it is something with my configuration. When i try and load the images is asset manager it doesn't work either. The only way the asset manager works is if I change the storageManager type to 'local'. My configuration looks like this:
|
There is might be something wrong with the renderer, can you check if there are actually no assets editor.AssetManager.getAll().length Might help you setting some listener before rendering var editor = grapesjs.init({
autorender: 0,
...
});
editor.on('storage:load', function(obj) {
console.log('Loaded ', obj);
})
editor.on('storage:store', function(obj) {
console.log('Stored ', obj);
})
editor.AssetManager.getAll().on('reset change', function(asset){
console.log('Assets changed', asset);
})
editor.render(); |
ah ok the loader, in asset manager, uses |
Thanks, any quick fix i can plug just for temporary testing purposes? |
You should output your assets as an encoded JSON string |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi, 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?
The text was updated successfully, but these errors were encountered: