Skip to content

Commit

Permalink
fix(docz-theme-default): refresh editor after it's mounted (#406) (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
amedora authored and pedronauck committed Dec 13, 2018
1 parent 6addd32 commit c67fa41
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Editor extends Component<EditorProps, EditorState> {
const editorProps = (config: any) => ({
value: this.state.code,
className: editorClassName,
editorDidMount: this.removeLastLine,
editorDidMount: this.onEditorDidMount,
onBeforeChange: this.handleChange,
options: {
...options,
Expand All @@ -124,6 +124,13 @@ export class Editor extends Component<EditorProps, EditorState> {
)
}

private onEditorDidMount = (editor: any) => {
if (editor) {
this.removeLastLine(editor)
editor.refresh()
}
}

private removeLastLine = (editor: any) => {
if (editor && !this.props.withLastLine && this.props.readOnly) {
const lastLine = editor.lastLine()
Expand Down

0 comments on commit c67fa41

Please sign in to comment.