Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add opt.createFormCallback to initFormioInstance #25

Merged
merged 2 commits into from
Apr 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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