FIX custom modal multiline prompt

pull/1/head
serapath 7 years ago committed by yann300
parent ea2988ac7b
commit eebccbd4fb
  1. 2
      src/app/tabs/run-tab.js
  2. 19
      src/app/ui/modal-dialog-custom.js

@ -285,7 +285,7 @@ function makeRecorder (appAPI, appEvents) {
}
runButton.onclick = () => {
var opts = { title: `Enter Transactions`, text: `Paste the array of transaction you want to replay here`, inputValue: '', multiline: true }
modalDialogCustom.prompt(opts, function confirm (json = '[]') {
modalDialogCustom.promptMulti(opts, function confirm (json = '[]') {
try {
var txArray = JSON.parse(json)
} catch (e) {

@ -11,12 +11,21 @@ module.exports = {
alert: function (text) {
modal('', yo`<div>${text}</div>`, null, { label: null })
},
prompt: function ({ title, text, inputValue, multiline }, ok, cancel) {
prompt: function (title, text, inputValue, ok, cancel) {
if (!inputValue) inputValue = ''
var input = multiline
? yo`<textarea id="prompt_text" class=${css.prompt_text} rows="4" cols="50"></textarea>`
: yo`<input type='text' name='prompt_text' id='prompt_text' class="${css['prompt_text']}" value='${inputValue}' >`
var input = yo`<input type='text' name='prompt_text' id='prompt_text' class="${css['prompt_text']}" value='${inputValue}' >`
modal(title, yo`<div>${text}<div>${input}</div></div>`,
{
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) }
},
{
fn: () => { if (typeof cancel === 'function') cancel() }
}
)
},
promptMulti: function ({ title, text, inputValue }, ok, cancel) {
if (!inputValue) inputValue = ''
var input =yo`<textarea id="prompt_text" class=${css.prompt_text} rows="4" cols="50"></textarea>`
modal(title, yo`<div>${text}<div>${input}</div></div>`,
{
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) }

Loading…
Cancel
Save