Skip to content

Commit

Permalink
Merge pull request #25 from qld-gov-au/release-v1.0.4
Browse files Browse the repository at this point in the history
add opt.createFormCallback to initFormioInstance
  • Loading branch information
devonpis authored Apr 13, 2022
2 parents 76dc385 + 93d5783 commit b90191b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/helpers/FormioLoader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ const initFormioInstance = (elem, opts) => {
form.formio = formio;
form.options.formio = formio;

// Force new tab on formlinks
$(elem).on("click", `a`, (e) => {
e.target.target = "_blank";
});
if (typeof opts.createFormCallback === "function") {
opts.createFormCallback();
} else {
// Force new tab on formlinks
$(elem).on("click", `a`, (e) => {
e.target.target = "_blank";
});
}

defaultCreateFormController({
form,
Expand Down Expand Up @@ -148,6 +152,7 @@ const initFormio = () => {
formioNamespace,
formioCreateformOptions,
formioCreateformController,
formioCreateformCallback,
} = elem.dataset;
initFormioInstance(elem, {
projectName: formioProjectName,
Expand All @@ -159,6 +164,7 @@ const initFormio = () => {
namespace: formioNamespace,
createFormOptions: window[formioCreateformOptions],
createFormController: window[formioCreateformController],
createFormCallback: window[formioCreateformCallback],
});
});
};
Expand Down

0 comments on commit b90191b

Please sign in to comment.