Changing upload URL for AssetManager programmatically
editor.AssetManager.config.upload = 'NEW_URL' will do it
Read full answer below ↓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 (4)
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
Thanks for reporting this, @rcloss. Great question about Changing upload URL for AssetManager programmatically. The recommended approach with GrapesJS is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most o...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3251
How can I specify position of dropped element ?
I want to specify the position of dragging element. for example, if I have a header block which no matter where you drag, it should be plac...
Issue #4289
"storage:start:load" event is not being trigged
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome latest Reproducible demo link Bind...
Issue #3415
Custom Asset Manager. How to set bg image
Hi there! I'm building a custom modal for the Asset Manager and basically, it seems that I need to override command. How I can understand i...
Issue #3333
npm start not working
Hi, I want to develop the source code but I cannot get started. I got errors when start the project. Can anybody help me? Thank you very mu...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.