1- /* eslint-disable no-bitwise */
2- // import React from 'react';
3-
4- // import cn from 'classnames';
5- // import { registerRulesForLanguage } from 'monaco-ace-tokenizer';
6- // import PropTypes from 'prop-types';
7- // import MonacoEditor from 'react-monaco-editor';
1+ import React , { Component } from 'react' ;
82
93import PropTypes from 'prop-types' ;
104import { connect } from 'react-redux' ;
@@ -17,28 +11,30 @@ import {
1711} from '../selectors/index' ;
1812import { actions } from '../slices' ;
1913
20- class ExtendedEditor {
14+ class ExtendedEditor extends Component {
2115 static propTypes = {
2216 monacoTheme : PropTypes . string ,
23- fontFamly : PropTypes . string || undefined ,
17+ fontFamily : PropTypes . string , // corrected prop name
2418 } ;
2519
2620 static defaultProps = {
2721 monacoTheme : 'default' ,
28- fontFamly : undefined ,
29- }
22+ fontFamily : undefined ,
23+ } ;
3024
3125 constructor ( props ) {
32- // super(props);
33-
26+ super ( props ) ;
3427 this . options = {
3528 fontFamily : props . fontFamily ,
3629 ...this . options ,
3730 } ;
3831 }
3932
4033 async componentDidMount ( ) {
41- super . componentDidMount ( ) ;
34+ // If there's a need to call the parent method, ensure it exists.
35+ if ( super . componentDidMount ) {
36+ super . componentDidMount ( ) ;
37+ }
4238
4339 const { monacoTheme } = this . props ;
4440 const { monaco } = this ;
@@ -60,18 +56,22 @@ class ExtendedEditor {
6056 }
6157
6258 async componentDidUpdate ( prevProps , prevState ) {
63- super . componentDidUpdate ( prevProps , prevState ) ;
59+ if ( super . componentDidUpdate ) {
60+ super . componentDidUpdate ( prevProps , prevState ) ;
61+ }
6462
6563 const { monacoTheme } = this . props ;
6664 const { monaco } = this ;
6765
68- if ( monacoTheme
66+ if (
67+ monacoTheme
6968 && monacoTheme !== prevProps . monacoTheme
7069 && monacoTheme === 'custom'
7170 ) {
7271 monaco . editor . defineTheme ( monacoTheme , customTheme ) ;
7372 monaco . editor . setTheme ( monacoTheme ) ;
74- } else if ( monacoTheme
73+ } else if (
74+ monacoTheme
7575 && monacoTheme !== prevProps . monacoTheme
7676 && monacoTheme !== 'default'
7777 ) {
@@ -88,7 +88,14 @@ class ExtendedEditor {
8888 }
8989
9090 componentWillUnmount ( ) {
91- super . componentWillUnmount ( ) ;
91+ if ( super . componentWillUnmount ) {
92+ super . componentWillUnmount ( ) ;
93+ }
94+ }
95+
96+ render ( ) {
97+ // Implement your render method here
98+ return null ;
9299 }
93100}
94101
0 commit comments