GrapesJS / preset-webpage

GrapesJS Plugin Webpage Preset
http://grapesjs.com/demo.html
BSD 3-Clause "New" or "Revised" License
335 stars 291 forks source link

Headers are not being added to AssetManager GET requests #74

Closed jwalton922 closed 2 years ago

jwalton922 commented 2 years ago

I'm guessing this is more of an issue with my understanding of how the AssetManager works, but here is my problem:

I am using the grapejs-preset-webpage plugin. I have images that need to be retrieved with a custom authentication header. After initializing grapejs with assetManager config to add headers, `const editor = grapesjs.init({ ... assetManager: { headers: {'foo': 'bar'} }, ...

});`

I try to add my protected images like so: var assetManager = editor.AssetManager; assetManager.add('https://cdn.pixabay.com/photo/2017/08/24/11/04/brain-2676370_960_720.jpg')

When I try to add an image block, I expect to see the request go through with my custom header, but it is not getting added. When i add an image via a link through the Asset Manager modal, I also don't see the headers being added. What am I missing or doing wrong?

Here's a codepen with my basic setup: https://codepen.io/jwalton922/pen/mdLrddL

artf commented 2 years ago

Replied to you here https://github.com/artf/grapesjs/discussions/4578#discussioncomment-3632776