FEAT: Accurate Documentation on uploadFile
Question
WARNING
READ and FOLLOW next 3 steps, then REMOVE them before posting the issue
- Follow CONTRIBUTING Guidelines https://github.com/artf/grapesjs/blob/master/CONTRIBUTING.md
- Do a quick SEARCH first, to see if someone else didn't open the same issue
- All relative statements/questions have to be filled/answered, otherwise, the issue might be CLOSED
- JSFiddle Starter template https://jsfiddle.net/szLp8h4n
- CodeSandbox Starter template https://codesandbox.io/s/1r0w2pk1vl
What are you trying to add to GrapesJS? Add more documentation to uploadFile and also create a function to upload files by providing a URL.
Describe your feature request detailed So, basically I want to add more documentation to the first parameter of uploadFIle function and to add another function to save files just by providing the URL. I've already done this, you can see at the bottom of this issue.
Is there an alternative at the latest version?
[ ] Yes (describe the alternative) [X] No
Is this related to an issue?
[ ] Yes (Give a link to the issue) [X] No
In File FileUploader.js
...
/**
* Upload files
* @param {Object} e Event OR an array of file objects.
* @return {Promise}
* @private
* */
uploadFile(e, clb) {
const files = Array.isArray(e)? e : e.dataTransfer ? e.dataTransfer.files : e.target.files;
...
/**
*
* @param url
* * @param name
*/
async uploadFileURL(url, name){
const response = await fetch(url);
// here image is url/location of image
const blob = await response.blob();
const file = new File([blob], name, {type: blob.type});
this.uploadFile([file]);
}
If you want I can create a pull request with it.
Answers (2)
There is already an option for upload URL https://github.com/artf/grapesjs/blob/8822aa6c6e8ced09ad50f2c8392f1754d3a6ec8b/src/asset_manager/config/config.js#L18-L21
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3405
FEAT: An event to hook into before a block in dropped into the canvas
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3364
FEAT: @How to fix container size when we are drag element inside the container,Container will be expended according to the child dragged element. How we can auto size child element according to the parent container. Container should not be expend according to the child element. It's should be show scroll.
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3463
BUG: inspector overflow broken
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3313
There are lots of click required to make text editable, can we make text field editable on a single Click.
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
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.