diff --git a/inst/app/app-dev.R b/inst/app/app-dev.R index 3ccc942..4112287 100644 --- a/inst/app/app-dev.R +++ b/inst/app/app-dev.R @@ -8,6 +8,7 @@ ui <- fluidPage( theme = bslib::bs_theme(version = 5L), # add button actionButton("show_wizard", "Show wizard"), + actionButton("show_shinyalert", "Show shinyalert"), wizard( modal = TRUE, lock_start = TRUE, diff --git a/inst/main.js b/inst/main.js index 65d1838..7f14df3 100644 --- a/inst/main.js +++ b/inst/main.js @@ -11,10 +11,18 @@ $.extend(wizard, { let args = $(el).data("configuration"); + // check if wizard is initialized, return if yes + //TODO debug why shinyalert is causing the wizard to re-initialize + if ($(el).data("wizard")) { + return; + } + + const wizard = new Wizard(args); wizard.init(); + // expose wizard.lock function this.lock = function() { wizard.lock(); @@ -58,6 +66,7 @@ $.extend(wizard, { } else if (msg === "reset") { this.reset(); } + //TODO understand why message show is not being received // else if (msg.type === "show") { // var modal = bootstrap.Modal.getOrCreateInstance( // document.getElementById('wizard-modal-' + el.id), {}