quickadd
quickadd copied to clipboard
[BUG] User script settings default value not set
I understand this is an undocumented and so perhaps a yet not stable feature but yes, unless the user explicitly opens the settings modal for the user script, the setting object passed to the entry function is empty.
To Reproduce
Steps to reproduce the behavior:
- Install the following user script:
const OPTION_1 = "MyOption;
module.exports = {
entry: start,
settings: {
name: "My Script",
options: {
[OPTION_1]: {
type: "text",
defaultValue: "hello",
},
},
},
};
async function start({ app, obsidian, quickAddApi, variables }, settings) {
console.log(settings);
new Notice(settings[OPTION_1]);
}
- Run the script and observe WITHOUT opening the settings modal.
- Open the settings modal.
- Run the script again.
Expected behavior
Default values for settings to be set without requiring the user to open the settings modal.
Desktop
- OS:: Linux 5.13.19-2-MANJARO x86_64
- Obsidian:: 0.14.15
- QuickAdd:: 0.5.5