New Features
- Since 1.5.15 ScriptEngine Scripts may have settings. These settings are stored as part of plugin settings. From now, these settings may be edited by the user via the Obsidian plugin settings window.
- See an example use of the feature here
- You can access settings for the active script using
ea.getScriptSettings()
, and store settings withea.setScriptSettings(settings:any)
- Rules for displaying script settings in plugin settings:
- If the setting is a simple literal (boolean, number, string) these will be displayed as such in settings. The name of the setting will be the key for the value.
ea.setScriptSettings({ "value 1": true, "value 2": 1, "value 3": "my string" })
- If the setting is an object and follows the below structure then a description and a valueset may also be added for displaying plugin settings. Values may also be hidden using the
hidden
key.
ea.setScriptSettings({ "value 1": { "value": true, "description": "This is the description for my boolean value" }, "value 2": { "value": 1, "description": "This is the description for my numeric value" }, "value 3": { "value": "my string", "description": "This is the description for my string value", "valueset": ["allowed 1","allowed 2","allowed 3"] }, "value 4": { "value": "my value", "hidden": true } });
- ScriptEngine suggester now includes optional hint and instructions
suggester: (displayItems: string[], items: any[], hint?: string, instructions?:Instruction[])
- Opens a suggester. Displays the displayItems and returns the corresponding item from items[].
- You need to await the result of suggester.
- If the user cancels (ESC), suggester will return
undefined
- Hint and instructions are optional.
interface Instruction { command: string; purpose: string; }