File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,10 @@ export default class ReactCodeMirror extends Component<ICodeMirror> {
113113
114114 this . renderCodeMirror ( this . props ) ;
115115 }
116-
117- public async componentWillReceiveProps ( nextPros : ICodeMirror ) {
118- this . renderCodeMirror ( nextPros ) ;
116+ public UNSAFE_componentWillReceiveProps ( nextPros : ICodeMirror ) {
117+ if ( nextPros . value !== this . props . value || nextPros . width !== this . props . width || nextPros . height !== this . props . height ) {
118+ this . renderCodeMirror ( nextPros ) ;
119+ }
119120 }
120121
121122 // 将props中所有的事件处理函数映射并保存
Original file line number Diff line number Diff line change @@ -19,11 +19,9 @@ export interface IMarkdownEditor extends IProps, ICodeMirror {
1919 options ?: CodeMirror . EditorConfiguration ,
2020}
2121
22- interface IMarkdownEditorState {
23- fullscreen : boolean ;
24- }
22+ interface IMarkdownEditorState { }
2523
26- export default class MarkdownEditor extends React . PureComponent < IMarkdownEditor , IMarkdownEditorState , { } > {
24+ export default class MarkdownEditor extends React . PureComponent < IMarkdownEditor , IMarkdownEditorState > {
2725 public static displayName = 'MarkdownEditor' ;
2826 public static defaultProps : IMarkdownEditor = {
2927 onChange : ( ) => null ,
You can’t perform that action at this time.
0 commit comments