Skip to content

Commit

Permalink
fix new editor
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu committed Dec 13, 2021
1 parent d37d4be commit 72b7298
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/NewEditor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { MonacoService, EditorsManager, FilesManager, SpecificationService } fro

import state from '../../state';
import { TabContext } from '../Panels/Tabs';
import { sampleSpec } from '../../state/editor';

interface EditorProps extends MonacoEditorProps {}

export const Editor: React.FunctionComponent<EditorProps> = (props = {}) => {
const { currentTab, tab } = useContext(TabContext);
const { file } = tab.metadata || {};
const { file = {} } = tab.metadata || {};

const editorState = state.useEditorState();
const parserState = state.useParserState();
Expand Down Expand Up @@ -70,8 +71,8 @@ export const Editor: React.FunctionComponent<EditorProps> = (props = {}) => {

return (
<MonacoEditor
language={file.extension}
defaultValue={file.content}
language={file.extension || 'yaml'}
defaultValue={file.content || sampleSpec}
theme="asyncapi-theme"
onMount={handleEditorDidMount}
onChange={onChange}
Expand Down

0 comments on commit 72b7298

Please sign in to comment.