mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-14 04:34:04 +00:00
Moved text input dialog to frontend
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import InputDialog from '../dialogs/input.svelte';
|
||||
|
||||
function newDialog(dialogComponent, data = {}) {
|
||||
const outlet = document.createElement('div');
|
||||
outlet.className = 'dialogoutlet';
|
||||
@ -15,6 +17,17 @@ function newDialog(dialogComponent, data = {}) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
const dialogs = { new: newDialog };
|
||||
function enterText(title = '', description = '', value = '') {
|
||||
const instance = newDialog(InputDialog, { title, description, value });
|
||||
|
||||
return new Promise(resolve => {
|
||||
instance.$on('submit', event => {
|
||||
instance.$close();
|
||||
resolve(event.detail.value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const dialogs = { new: newDialog, enterText };
|
||||
|
||||
export default dialogs;
|
||||
|
Reference in New Issue
Block a user