I am working on text parser. The code is intended to work in a browser. It needs to support an ability to allow user to enter value[s] to be used by the parser while the text is being processed. I found a package dialig-promise
to be used for this purpose, but things are not working like I want. My goal is for fillMacro()
is to block until the dialog is closed, but it is not happening.
dataMacro(obj) {
...
fragments.push(myDate);
},
fillMacro(obj) {
console.log(`fillText ${JSON.stringify(obj)}`);
return new Promise((resolve, reject) => {
promptPromise("Please enter value for "+ obj.name, obj.defaultValue || '')
.then(inp => {
console.log('entered:', inp);
resolve(inp);
}, err => {
console.log("User Escapes. Use default?")
resolve(obj.defaultValue || '');
});
})
.then(value => {
fragments.push(value);
});
console.log('finished processing fillText');
},
textMacro(obj) {
...
fragments.push(myText);
}
Please advise.