Issue #4273πŸ’¬ AnsweredOpened Apr 20, 2022by boomshakar1 reactions

How to trigger the 'Import Template (modal)' on page load

Quick answerby boomshakar❀ 1

@boomshakar please don't convert discussions to issues Noted. Thanks

Read full answer below ↓

Question

Hello, Please i'm in need of the logic on how to the import template modal on initialization of the page... I'm using the newsletter preset plugin What i'm trying to achieve?: Make the user upload their code once the page has been loaded. Below are the logics I've tried, editor.on('load',(model, argument )=> { //open modAL const modal = edit.Modal; const cmdd = edit.Commands; //filter using component name if (model.getName() === 'Import template') { //not working //show modal modal.open(); } edit.on('modal:', (a, b, c) => { //not working console.log({ a }); console.log({ b }); console.log({ c...

Answers (4)

boomshakarβ€’ Apr 22, 2022

@boomshakar please don't convert discussions to issues

Noted. Thanks

boomshakarβ€’ Apr 21, 2022

Hi @artf, 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-...

artfβ€’ Apr 21, 2022

@boomshakar please don't convert discussions to issues

GJSBlockβ€’ May 17, 2026

Thanks for reporting this, @boomshakar. Great question about How to trigger the 'Import Template (modal)' on page load. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener met...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.