Issue #851✓ SolvedOpened Feb 8, 2018by maxtacco3 reactions

Promise returning plugins

Quick answerby nashton1093

I had a similar requirement. If it helps others, my solution in the end was to create a plugin which then loads my other plugins; The editor config would just reference the one plugin and the plugin options for that plugin would contain the plugins and options for the others to load. The plugin code; The editor init c...

Read full answer below ↓

Question

Hi @artf, I have a case where a custom plugin needs to check user permissions before doing any kind of initialization. The method that does the check returns a Promise, so I have to wait for it to resolve before doing anything. Unfortunately, this creates a raise condition with editor rendering and UI gets into some weird state. In order to solve this issue I have to set 'editor.autorender' to false and then render editor manually once my plugin is initialized. This is fine for now, but I'm not quite sure how I would handle this case if I had multiple custom plugins depending on some async lo...

Answers (3)

👍 Most helpfulnashton109Jul 13, 2019

I had a similar requirement. If it helps others, my solution in the end was to create a plugin which then loads my other plugins; The editor config would just reference the one plugin and the plugin options for that plugin would contain the plugins and options for the others to load. The plugin cod...

maxtaccoFeb 8, 2018

Also, this may require GrapesJS' init method to return a Promise instead of the editor, but this can be limited only to cases when there are any plugins that return Promises.

artfFeb 9, 2018

I have to set 'editor.autorender' to false and then render editor manually once my plugin is initialized. This is fine for now, but I'm not quite sure how I would handle this case if I had multiple custom plugins depending on some async logic Just use a variable as a flag which counts your custom e...

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.