Issue #471💬 AnsweredOpened November 1, 2017by tomichal0 reactions

Third-party library styles collision

快速解答by tomichal

I looked inside the https://github.com/artf/grapesjs-blocks-basic plugin and it looks like the problem I'm experiencing is coming from there, namely the plugin does not use the grapesjs editor's config setting, despite initially fetching it from the editor here: https://github.com/artf/grapesjs-blocks-basic/blob/22d77...

Read full answer below ↓

Question

Hi, I would like to include a third-party styles and javascript in the editor. They are being added like this:

... 
const editor = grapesjs.init({
  canvas: {
    styles: [
      /path/to/css/file
    ],
    scripts: [
      /path/to/js/file
    ]
  },
...
})
...

The issue I'm experiencing with the third-party CSS is that some of its style rules are colliding with the style rules of the editor, e.g. the third-party library uses a class "row".

Is there any recommended way around it? Perhaps I'm missing some kind of an obvious solution to this? Thank you for any help and for creating an awesome editor!

Answers (3)

tomichalNovember 1, 2017

I looked inside the https://github.com/artf/grapesjs-blocks-basic plugin and it looks like the problem I'm experiencing is coming from there, namely the plugin does not use the grapesjs editor's stylePrefix config setting, despite initially fetching it from the editor here: https://github.com/artf/grapesjs-blocks-basic/blob/22d7799d7ecfccd55da67035acb797c8e7f86ccd/src/index.js#L4

After getting the stylePrefix from the editor the plugin proceeds to hard code CSS class names, e.g. .row, which is one of the, or maybe the only, class conflicting with the external library styles I'm trying to use in the editor (https://vmware.github.io/clarity/).

lock[bot]September 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.