Skip to content
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

Asset Manager Upload / Store file Limit #2227

Merged
merged 3 commits into from
Sep 4, 2019
Merged

Asset Manager Upload / Store file Limit #2227

merged 3 commits into from
Sep 4, 2019

Conversation

tliscomb
Copy link

asset manager added config & logic to set max file(s) size; preventing the user from exceeding their limit.

}
if (config.uploadMaxFileSize > 0 && config.uploadMaxFileSize <= fileSize / 1024) {
alert(config.uploadMaxFileSizeAlertText || 'The file(s) you have selected to add exceed your space limit');
return;
}
Copy link
Member

@artf artf Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, instead of those 2 options, I'd prefer something like config.beforeUpload callback where the user can define its own logic and raise its own UI (we shouldn't use alert in the framework, if you feel the need to do it, it means you have to create a customizable callback for the user). Eg.

const { beforeUpload } = config;
const beforeUploadRes = beforeUpload && 
	beforeUpload({ fileSize, files, ...maybeOtherOptions });
if (beforeUploadRes === false) return;

@@ -115,12 +115,20 @@ export default Backbone.View.extend(
body.append(param, params[param]);
}

var fileSize = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use let

@tliscomb
Copy link
Author

tliscomb commented Sep 4, 2019

@artf, I made the changes you requested; which makes this a lot cleaner and better for me too. Thank you.

Do I need to do a new pull request or is this sufficient?

@artf
Copy link
Member

artf commented Sep 4, 2019

@artf, I made the changes you requested; which makes this a lot cleaner and better for me too. Thank you.

Do I need to do a new pull request or is this sufficient?

No, it's perfect now, thank you very much

@artf artf merged commit 3a4b2e2 into GrapesJS:dev Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants