Skip to content
Discussion options

You must be logged in to vote

I was able to get what I want by triggering click() on the button itself,

const modal = edit.Modal;
const query = new URLSearchParams(location.search);
const uploadQuery = query.get('key');
if (uploadQuery === 'upload-code') {
  const importClick = document.querySelector('.gjs-pn-btn.fa.fa-download');
  importClick.click();
  edit.on('modal', (e) => {
    if (e.open && e.title.textContent === 'Import template') {
      modal.setTitle('<div>Import your Template [inline-html/css]</div>');
    }
  });
}

If there's a better workaround, i'd be glad If you share with me the knowledge.
Thanks.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by boomshakar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant