Issue #902✓ SolvedOpened February 27, 2018by isaacnikon3 reactions

Gjs-preset-newsletter not found

快速解答by isaacnikon3

Hi @artf thanks for the pointer 💃 , the above code was throwing an error nlPlugin not a function, doing this helped it run thanks a lot again 👍

Read full answer below ↓

Question

代码片段TEXT
I am new to posting issues on github,
i am using latest version of both GrapesJS and newsletter preset from npm
i have done
var grapesjs = require('grapesjs');
require('grapesjs-preset-newsletter');
 and

ngOnInit() {
    var editor = grapesjs.init({
      container: '#gjs',
      plugins: ['gjs-preset-newsletter'],
      pluginsOpts: {
        'gjs-preset-newsletter': {}
      }
    });
  }

if i follow the same process for webpage preset it works fine, only newsletter preset i get an error in console saying gjs-preset-newsletter not found. i am trying to create a component in angular
any help would be appreciated thanks :)

Answers (3)

👍 Most helpfulisaacnikonMarch 6, 2018

Hi @artf thanks for the pointer 💃 , the above code was throwing an error nlPlugin not a function,

doing this helped it run

var grapesjs = require('grapesjs');
var nlPlugin = require('grapesjs-preset-newsletter');
grapesjs.plugins.add('gjs-preset-newsletter-2', nlPlugin.default);
...
      plugins: ['gjs-preset-newsletter-2'],

thanks a lot again 👍

artfMarch 6, 2018

Hi @isaacnikon and welcome on board :) Btw grapesjs-preset-newsletter is not added in a proper way if you want to load it globally, try with this instead

var grapesjs = require('grapesjs');
var nlPlugin = require('grapesjs-preset-newsletter');
grapesjs.plugins.add('gjs-preset-newsletter-2', nlPlugin);
...
plugins: ['gjs-preset-newsletter-2'],
absyahSeptember 10, 2019

@isaacnikon Hei, .default does the magic. Thanks! 👍 Also giga thanks to @artf for these awesome plugins ! ! ! 🙌

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.