Skip to content

Commit eda1d2f

Browse files
committed
fix: Fix the issue of visiable props.
1 parent 1b7b926 commit eda1d2f

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/components/PreviewMarkdown/index.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ export default class PreviewMarkdown extends React.Component<IPreviewMarkdown, I
5656
value: props.value
5757
}
5858
}
59-
if (props.visible !== state.visible) {
60-
return {
61-
visible: props.visible
62-
}
63-
}
6459
return null;
6560
}
6661

src/components/ToolBarMode/index.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
&-toolbar-mode {
55
float: right;
66
padding-right: 5px;
7+
border-bottom: 0 !important;
78
.active {
89
color: #06c;
910
}

src/index.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,13 @@ export default class MarkdownEditor extends React.PureComponent<IMarkdownEditor,
101101
}
102102
}
103103

104-
private onBlur = (editor: IInstance, event: Event) => {
105-
const { onBlur } = this.props as IMarkdownEditor;
106-
if (onBlur) {
107-
onBlur(editor, event);
108-
}
109-
}
110-
111104
private previewMarkdown() {
105+
const isVisible = this.preview.state.visible;
112106
if (this.preview) {
113-
this.preview.state.visible ? this.preview.hide() : this.preview.show();
114-
this.toolbarsMode.updateMode('preview', !this.preview.state.visible);
115-
this.CodeMirror.editor.setSize(this.preview.state.visible ? '100%' : '50%');
107+
isVisible ? this.preview.hide() : this.preview.show();
108+
this.preview.setState({ visible: !isVisible });
109+
this.toolbarsMode.updateMode('preview', !isVisible);
110+
this.CodeMirror.editor.setSize(isVisible ? '100%' : '50%');
116111
}
117112
}
118113

0 commit comments

Comments
 (0)