aspiring_dev
aspiring_dev

Reputation: 93

Draft.js styles not working

I'm trying to use Draft.js with the Image plugin. Here are my problems. I manage to get it to work, but the styles aren't loaded and the editor takes the whole page and the buttons aren't styled.

enter image description here

I load the styles from the provided CSS

import './Draft.css';
import editorStyles from './editorStyles.css';
import 'draft-js-image-plugin/lib/plugin.css';

But it doesn't do anything. I'm working with Create React App, so style-loader and css-loader should be working fine.

Thanks for the help.

Upvotes: 0

Views: 2659

Answers (1)

Mikhail Shabrikov
Mikhail Shabrikov

Reputation: 8509

About styles in draft-js-image-plugin/lib/plugin.css. It looks like a mistake in the plugin documentation. We can read there:

The plugin ships with a default styling available at this location in the installed package: node_modules/draft-js-image-plugin/lib/plugin.css

But if we check this file in our node_modules directory, we see that this file is empty. No any styles.

enter image description here

About other styles. Check that you have Draft.css and editorStyles.css files and this files located in the same directory that your component. Do you have some errors in the console? It would be great if you provide full your code.

Upvotes: 2

Related Questions