uiwjs / react-markdown-editor

A markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-markdown-editor
MIT License
337 stars 34 forks source link

How is preview show by default #222

Closed a1392136 closed 6 months ago

a1392136 commented 6 months ago
  1. When I import the editor as follows, the preview is not show, How to control preview from ts code
  2. Is it possible to only enable preview mode without editing, Instead of using
    const [markdown, setMarkdown] = useState("");
    <MarkdownEditor
            height="300px"
            value={markdown}
            onChange={(value) => {
              setMarkdown(value);
            }}
          />
jaywcjlove commented 6 months ago

@a1392136 You can provide a reproducible example of the error, and I'll take a look.

a1392136 commented 6 months ago

@a1392136 You can provide a reproducible example of the error, and I'll take a look.

I use this component in my electron application. The markdown editor works fine, but previews are not shown by default. I want the preview to be shown by default when rendering.

default: image

The desired effect: image

jaywcjlove commented 6 months ago

https://github.com/uiwjs/react-markdown-editor/blob/460df663c8d089effb1a61acd6e904b00b43ec5b/core/src/index.tsx#L29-L30

<MarkdownEditor
  value={markdownVal}
+  visible={true}