Draft-js-plugins: Mentions plugin: augment default theme instead of replacing it

Created on 6 Jun 2017  路  3Comments  路  Source: draft-js-plugins/draft-js-plugins

Hey there - not sure if this is a bug, question, or feature request...

I like the default theme for the mentions plugin, but I wanted to make some minor adjustments (specifically to the mention class):

.mention { color: blue; }
const mentionPlugin = createMentionPlugin({ theme });

^ this works, however it _completely_ overrides the default styles draft-js-mention-plugin/lib/plugin.css

Is there any way to merge the theme so that I can augment it instead of completely replacing it?

Thanks!

documentation faq mentions-plugin question

Most helpful comment

good question, I just saw this and in the next release of mentions the defaultTheme will be exposed, so you can do

import { defaultTheme } from 'draft-js-mention-plugin'
const theme = {
  ...defaultTheme
  ...myTheme
}

All 3 comments

did you solve this ?

good question, I just saw this and in the next release of mentions the defaultTheme will be exposed, so you can do

import { defaultTheme } from 'draft-js-mention-plugin'
const theme = {
  ...defaultTheme
  ...myTheme
}

Does this still work since you moved to linaria? I cant make it work anymore, and I guess those classnames like .draftJsMentionPlugin__mentionSuggestions__2DWjA are random? I mean, they isn't safe to target in my style.css file and make modifications to that class directly?

Was this page helpful?
0 / 5 - 0 ratings