GrapesJS / preset-newsletter

GrapesJS preset configuration for the newsletter editor.
https://grapesjs.com/demo-newsletter-editor.html
BSD 3-Clause "New" or "Revised" License
189 stars 143 forks source link

Error 'Namespace '"grapesjs"' has no exported member 'Plugin'' in Angular 14 #129

Closed atoyansk closed 1 year ago

atoyansk commented 1 year ago

I'm trying to use GrapesJS in Angular 14 project, but I faced an error in 'node_modules\grapesjs-preset-newsletter\dist\index.d.ts' file:

error TS2694: Namespace '"grapesjs"' has no exported member 'Plugin'.

Specifically in this point:

export type RequiredPluginOptions = Required<PluginOptions>;
declare const plugin: grapesjs.Plugin<PluginOptions>;

export {
    plugin as default,
};

I initiated the editor like this:

this.editor = grapesjs.init({
  container: '#gjs',
  fromElement: true,
  height: '700px',
  width: 'auto',
  storageManager: false,
  panels: { defaults: [] },
  plugins: [plugin],
  pluginsOpts: {
      [plugin]: {
          blocksBasicOpts: {
              blocks: ['sect100', 'sect50', 'sect30', 'divider', 'text', 'grid-items', 'image', 'button', 'list-items', 'quote'],
              flexGrid: 1,
          },
      }
  }
});

In package.json:

"grapesjs": "^0.21.1",
"grapesjs-preset-newsletter": "^1.0.1",
"juice": "^9.0.0"

in angular.json:

"styles": [
    "node_modules/grapesjs/dist/css/grapes.min.css",
    "node_modules/grapesjs-preset-newsletter/dist/grapesjs-preset-newsletter.min.css",
    "src/styles.scss"
],
"scripts": [
     "node_modules/grapesjs/dist/grapes.min.js",
     "node_modules/grapesjs-preset-newsletter/dist/grapesjs-preset-newsletter.min.js"
]

Have I missed to install something earlier?

artf commented 1 year ago

Should be fixed here https://github.com/GrapesJS/preset-newsletter/releases/tag/v1.0.2