From f947fb9cf24922746eab35a85cebcb0f2ce4a3e6 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 23 Nov 2021 17:36:08 +0530 Subject: [PATCH] fix: attach image modal for tour --- frappe/public/js/frappe/form/form_tour.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/frappe/public/js/frappe/form/form_tour.js b/frappe/public/js/frappe/form/form_tour.js index 9bae776d66..7946495b45 100644 --- a/frappe/public/js/frappe/form/form_tour.js +++ b/frappe/public/js/frappe/form/form_tour.js @@ -68,7 +68,7 @@ frappe.ui.form.FormTour = class FormTour { if (step.fieldtype == 'Table') this.handle_table_step(step); if (step.is_table_field) this.handle_child_table_step(step); - //if (step.fieldtype == 'Attach Image') this.handle_attach_image_steps(step); + if (step.fieldtype == 'Attach Image') this.handle_attach_image_steps(step); }); if (this.tour.save_on_complete) { @@ -243,7 +243,6 @@ frappe.ui.form.FormTour = class FormTour { } add_step_to_save() { - console.log("save") const page_id = `[id="page-${this.frm.doctype}"]`; const $save_btn = `${page_id} .standard-actions .primary-action`; const save_step = { @@ -267,10 +266,8 @@ frappe.ui.form.FormTour = class FormTour { handle_attach_image_steps() { $('.btn-attach').one('click', () => { - frappe.utils.sleep(300) setTimeout(() => { const modal_element = $(".file-uploader").closest(".modal-content"); - modal_element.css("z-index", "1000004 !important"); const attach_dialog_step = { element: modal_element[0], allowClose: false, @@ -285,13 +282,14 @@ frappe.ui.form.FormTour = class FormTour { this.driver_steps.splice(this.driver.currentStep + 1, 0, attach_dialog_step); this.update_driver_steps(); // need to define again, since driver.js only considers steps which are inside DOM - frappe.utils.sleep(300).then(() => this.driver.start(this.driver.currentStep + 1)); - console.log('click', this.driver_steps) - }, 1000); - - modal_element.on('hidden.bs.modal', () => { this.driver.moveNext(); - }) - }) + this.driver.overlay.refresh(); + + modal_element.closest('.modal').on('hidden.bs.modal', () => { + this.driver.moveNext(); + }); + + }, 500); + }); } };