Skip to content

Commit

Permalink
fix: fix enablePreview props issue. (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 22, 2023
1 parent 3810340 commit 5146be2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/src/commands/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IMarkdownEditor, ToolBarProps } from '..';

const Preview: React.FC<{ command: ICommand; editorProps: IMarkdownEditor & ToolBarProps }> = (props) => {
const { editorProps } = props;
const { containerEditor, preview, previewWidth = '50%', enablePreview } = editorProps;
const { containerEditor, preview, previewWidth = '50%', enablePreview = true } = editorProps;
const [visible, setVisible] = useState(props.editorProps.visible);
useEffect(() => setVisible(props.editorProps.visible), [props.editorProps.visible]);
useEffect(() => {
Expand Down Expand Up @@ -34,7 +34,6 @@ const Preview: React.FC<{ command: ICommand; editorProps: IMarkdownEditor & Tool
}
}
}, [visible, containerEditor, preview, previewWidth]);

if (!enablePreview) return;

return (
Expand Down

0 comments on commit 5146be2

Please sign in to comment.