Changing upload URL for AssetManager programmatically
Question
I've got an situation where depending on how the Asset Manager is opened I want to pass a slightly different upload URL.
In the asset:upload:start event I have it looking to see which upload URL it should use, and if I have to change it I'm doing the
amConfig = editorAssetManager.getConfig() amConfig.upload = 'NEW URL'
but it's not using the new URL for the upload it sticks with the one defined on init. Is there way to update the config once grapesjs has been loaded? I don't see a set or a setConfig anywhere
Answers (3)
editor.AssetManager.config.upload = 'NEW_URL' will do it
The value in config is only used during init so changing it does nothing, maybe changing these might help:
editor.Assets.FileUploader().config.upload = 'NEW_URL';
editor.Assets.AssetsView().config.upload = 'NEW_URL'
Thanks, just tried both of those, but no luck, at least in the asset:upload:start event
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3010
Asset Manager Configuration Is not Working
Hi, I tried all possible ways to change asset manager configuration, but it is not working as expected. Even I create a sample plugin but i...
Issue #646
Images dropped onto image picker get uploaded twice
Set the asset manager with the dropzone option set to true (which is true by default), something like that: then drop an image onto the dro...
Issue #2358
[QUESTIONS] How to set callbacks when asset click
I can see that image has been set only with a single click on image asset. I want to close the modal even on when click. I try to set a cal...
Issue #372
Asset Manager not automatically add images to assets after uploading
The JSON response of an upload is like this {"data":["http://url.com/flower.jpg"]} The response event is working.In the response event resp...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.