easy-markdown-editor
easy-markdown-editor copied to clipboard
Pluggable dialog implementations
Is your feature request related to a problem? Please describe.
I'm working on an electron app and I would like to use the options to prompt the user for link/image url's but Electron will not implement the prompt() API.
Describe the solution you'd like
It would be cool if I could provide an alternative implementation of these dialog API's using in-browser dialogs instead of the native dialogs for environments that don't support them.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context
I feel like for everyone's sake, simpler is better here - stick to the API defined by the browsers, just take an extra option or two so you can provide an implementation of prompt() and any other similar functions (alert() and confirm() are the other two, but I'm not sure if this library actually uses them). This extra option can then just default back to the browser API if nothing is provided, eg. config.prompt || browser.prompt.
Hmm, ok, according to the documentation in TypeScript the official definition is:
prompt(message?: string, _default?: string): string | null;
For the sake of being able to do something useful to prompt the user for input, this will probably need to return a Promise or take a callback instead.