Css Draft.js更改默认单空格字体
默认情况下,草稿编辑器使用默认系统monospace。我想知道它们是否是通过Draft.css或使用全局css类将其更改为ConsoleAS的一种方法。编辑器组件的根元素具有Css Draft.js更改默认单空格字体,css,reactjs,draftjs,Css,Reactjs,Draftjs,默认情况下,草稿编辑器使用默认系统monospace。我想知道它们是否是通过Draft.css或使用全局css类将其更改为ConsoleAS的一种方法。编辑器组件的根元素具有DraftEditor root类 可以使用此类名以以下方式指定样式: .DraftEditor-root { font-family: Consolas; // other styles thay you want: font-size: 24px; border: 1px solid black; }
DraftEditor root
类
可以使用此类名以以下方式指定样式:
.DraftEditor-root {
font-family: Consolas;
// other styles thay you want:
font-size: 24px;
border: 1px solid black;
}
查看下面的演示,在本例中,我使用了“Arial”字体系列,并使用了“Consolas”,其工作原理与此类似:
const{Editor,EditorState,ContentState}=Draft;
类容器扩展了React.Component{
建造师(道具){
超级(道具);
此.state={
editorState:editorState.createWithContent(ContentState.createFromText('Arial字体系列'))
};
}
_handleChange=(编辑状态)=>{
this.setState({editorState});
}
render(){
返回(
);
}
}
render(,document.getElementById('react-root')代码>
.DraftEditor根目录{
字体系列:Arial;
字体大小:24px;
边框:1px纯黑;
}
编辑器组件的根元素具有DraftEditor根
类
可以使用此类名以以下方式指定样式:
.DraftEditor-root {
font-family: Consolas;
// other styles thay you want:
font-size: 24px;
border: 1px solid black;
}
查看下面的演示,在本例中,我使用了“Arial”字体系列,并使用了“Consolas”,其工作原理与此类似:
const{Editor,EditorState,ContentState}=Draft;
类容器扩展了React.Component{
建造师(道具){
超级(道具);
此.state={
editorState:editorState.createWithContent(ContentState.createFromText('Arial字体系列'))
};
}
_handleChange=(编辑状态)=>{
this.setState({editorState});
}
render(){
返回(
);
}
}
render(,document.getElementById('react-root')代码>
.DraftEditor根目录{
字体系列:Arial;
字体大小:24px;
边框:1px纯黑;
}