+11
-1
@@ -169,7 +169,14 @@ function makeHotkeyInput(value = '') {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
async function promptText({ title, label = 'Value', value = '', placeholder = '', multiline = false } = {}) {
|
||||
async function promptText({
|
||||
title,
|
||||
label = 'Value',
|
||||
value = '',
|
||||
placeholder = '',
|
||||
multiline = false,
|
||||
onInput = null,
|
||||
} = {}) {
|
||||
return new Promise((resolve) => {
|
||||
const field = multiline
|
||||
? el('textarea', { rows: 6, placeholder }, value)
|
||||
@@ -197,6 +204,9 @@ async function promptText({ title, label = 'Value', value = '', placeholder = ''
|
||||
resolve(field.value);
|
||||
}
|
||||
});
|
||||
field.addEventListener('input', () => {
|
||||
if (typeof onInput === 'function') onInput(field.value);
|
||||
});
|
||||
|
||||
setTimeout(() => field.focus(), 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user