Draft-js: Possibility to override the core class names

Created on 24 May 2016  Â·  1Comment  Â·  Source: facebook/draft-js

src/component/base/DraftEditor.react.js uses a special class names, for example:

  • DraftEditor/root
  • DraftEditor/editorContainer
  • public/DraftEditor/content
  • etc

But how we can see at facebook.com, it uses minimized 5-digit names of these same classes:
_..looks like CSS Modules usage_
facebook

How we can redefine Draft.js class names in our own projects the same way?
It seems at the moment the editor does not provide the api to change the core class names..

Most helpful comment

This ties into our internal CSS build system and it's not going to be practical for us to support this in open source – it's unlikely that it will make a practical difference for anyone so hopefully it isn't a big deal for you. If you're interested, we statically transform calls to cx() using a Babel transform that replaces the class names with a minified version. (We never reference classes with a slash without using cx().) If you were motivated you could implement the same thing by building Draft from source but it's unlikely to be worth the time it would take you to set it up.

>All comments

This ties into our internal CSS build system and it's not going to be practical for us to support this in open source – it's unlikely that it will make a practical difference for anyone so hopefully it isn't a big deal for you. If you're interested, we statically transform calls to cx() using a Babel transform that replaces the class names with a minified version. (We never reference classes with a slash without using cx().) If you were motivated you could implement the same thing by building Draft from source but it's unlikely to be worth the time it would take you to set it up.

Was this page helpful?
0 / 5 - 0 ratings