GrapesJS / components-tabs

Simple tabs component plugin for GrapesJS
BSD 3-Clause "New" or "Revised" License
37 stars 36 forks source link

GrapesJS Tabs Not Found #10

Closed rastaprime20 closed 4 years ago

rastaprime20 commented 4 years ago

Hi,

Hope you are doing well. I'm currently adding this plugin GrapesJS Tabs, however I end up having this error, saying that, "Plugin grapesjs-tabs not found".

I was able to import one plugin before, which is the Lory Slider successfully, by doing the following:

try { const grapesjs = require('grapesjs') ;
require("default-passive-events"); require('grapesjs/dist/css/grapes.min.css'); require('font-awesome/css/font-awesome.min.css'); require('../../assets/css/gramateria.css'); require('../../assets/css/blocks.css'); require('../../assets/css/blocks-manager.css'); require('grapesjs-tabs'); require('grapesjs-lory-slider');

Then adding the plugin in the array of plugins when you initialize the grapesjs.

const editor = grapesjs.init({ allowScripts: 1, showOffsets: 1, autorender: 0, noticeOnUnload: 0, container: '#gjs', height: '100%', fromElement: true, clearOnRender: 0, plugins: ['grapesjs-tabs', 'grapesjs-lory-slider'], pluginsOpts: { 'grapesjs-tabs': {} }

I'm not sure what I'm missing... I used the require function to import plugins.

Can you try to help me out with this?

Regards

artf commented 4 years ago

Actually the lory plugin uses the old plugin loader, you should load grapesjs-tabs in this way:

import grapesjsTabsPlugin from 'grapesjs-tabs';

...
plugins: [grapesjsTabsPlugin, 'grapesjs-lory-slider'],
pluginsOpts: {
    [grapesjsTabsPlugin]: {}
}