Issue #902Opened February 27, 2018by isaacnikon3 reactions

[QUESTION] gjs-preset-newsletter not found

Question

Code SnippetTEXT
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)

isaacnikonMarch 6, 20183 reactions

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, 20180 reactions

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, 20190 reactions

@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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.