Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

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 4ba0e52 commit 06b0721
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 06b0721

Please sign in to comment.