Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Draft.js更改默认单空格字体_Css_Reactjs_Draftjs - Fatal编程技术网

Css Draft.js更改默认单空格字体

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; }

默认情况下,草稿编辑器使用默认系统monospace。我想知道它们是否是通过Draft.css或使用全局css类将其更改为ConsoleAS的一种方法。

编辑器组件的根元素具有
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纯黑;
}