-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Feature] Edit the global default settings #77
Comments
Currently, lines 191-203 in sweet-alert.js are the ones holding the default parameters like this: var params = {
title: '',
text: '',
type: null,
allowOutsideClick: false,
showCancelButton: false,
closeOnConfirm: true,
confirmButtonText: 'OK',
confirmButtonColor: '#AEDEF4',
cancelButtonText: 'Cancel',
imageUrl: null,
imageSize: null
}; Couldn't you just change this so that it fits your project? I don't think there's a need to add an additional place where you can set the defaults. |
Yes, I saw that but the params variable is not public so I cannot extend it from the outside. It would be nice if this could be changed the way jQuery UI does it for exemple. You would just have to expose the params hash so it can be extended from outside the plugin. I can give it a try on a pull request if you feel this is something others could benefit from. |
I agree with @pomartel, the ability to set default options outside of the plugin file would be cool. Having to edit the lib file makes updates more tedious, and prevents the ability to use a public CDN. Currently I'm just handling it with a function that has default attributes, merges in the custom attributes from the parameters, and calls Great plugin, this seriously makes UI much more awesome. |
Guys what do you think about #139? This PR adds the feature (which I think it's a powerful feature) to set a default user params without changing the source code or exporting some variables to global scope, you just have to call the |
@zzarcon yes, I think your implementation is better than mine. Let's hope it gets merged! |
It would be nice if the default settings could be override globally. I could for example change the default button texts to a different locale without having to pass it as params each time I create a new dialog. I will check if I can send you a pull request but my JS skills are a bit rusted!
The text was updated successfully, but these errors were encountered: