我需要扩展draft-js-emoji-plugin中的几个CSS规则。
文档中提到的方法是将theme
对象传递给配置:
const theme = {
emojiSelectButton: 'someclassname'
};
const emojiPlugin = createEmojiPlugin({theme});
不幸的是,这会覆盖整个主题类名,而不是只添加一个类名。根据代码中的注释,这种行为是有意设计的:
// Styles are overwritten instead of merged as merging causes a lot of confusion.
//
// Why? Because when merging a developer needs to know all of the underlying
// styles which needs a deep dive into the code. Merging also makes it prone to
// errors when upgrading as basically every styling change would become a major
// breaking change. 1px of an increased padding can break a whole layout.
相关问题中的开发人员建议导入draft-js-emoji-plugin/lib/plugin.css并在代码中进行扩展。无论如何,此文件中的每个类名都带有后缀(CSS模块),它们可能会被更改,因此不可靠。
我不知道如何在不复制整个主题的情况下应用几个修复程序。