feat: initialise editor with 'first' file
Since sort-files exists, the challengeFiles have an order. The editor now displays the first file on mount.
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
f82886148c
commit
1a985f95f5
@ -14,6 +14,7 @@ import {
|
|||||||
} from '../redux';
|
} from '../redux';
|
||||||
import { userSelector, isDonationModalOpenSelector } from '../../../redux';
|
import { userSelector, isDonationModalOpenSelector } from '../../../redux';
|
||||||
import { Loader } from '../../../components/helpers';
|
import { Loader } from '../../../components/helpers';
|
||||||
|
import { sortFiles } from '../utils/sort-files';
|
||||||
|
|
||||||
import './editor.css';
|
import './editor.css';
|
||||||
|
|
||||||
@ -129,10 +130,11 @@ class Editor extends Component {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { challengeFiles } = this.props;
|
||||||
|
|
||||||
// NOTE: for consitency with this.data (and this.options) currentFileKey
|
// NOTE: for consitency with this.data (and this.options) currentFileKey
|
||||||
// is just a property, not state.
|
// is just a property, not state.
|
||||||
|
this.currentFileKey = sortFiles(challengeFiles)[0].key;
|
||||||
this.currentFileKey = 'indexhtml';
|
|
||||||
|
|
||||||
this.options = {
|
this.options = {
|
||||||
fontSize: '18px',
|
fontSize: '18px',
|
||||||
|
Reference in New Issue
Block a user