uiwjs / react-markdown-editor

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

Why onBlur removed all text in editor ? #68

Closed surohak closed 3 years ago

surohak commented 3 years ago
  1. write text.
  2. onBlur from the editor.
  3. do some other action in the page
jaywcjlove commented 3 years ago

@SuroHak There is no way to judge your problem without demonstration.

surohak commented 3 years ago

@jaywcjlove you can see an example here. https://codesandbox.io/s/wizardly-worker-43hwb?file=/src/App.js

  1. input in the markdown
  2. input in the other input element
jaywcjlove commented 3 years ago

https://codesandbox.io/s/elastic-breeze-9k7st?file=/src/App.js

@SuroHak Upgrade + @uiw/react-markdown-editor@3.1.1

import MarkdownEditor from "@uiw/react-markdown-editor";
import { useState } from "react";
import "./styles.css";

export default function App() {
  const [val, setVal] = useState("");

  return (
    <div className="App">
      <input
        value={val}
        onChange={(e) => {
          setVal(e.target.value);
        }}
      />
      <MarkdownEditor
        value={val}
        onChange={(editor, data, value) => {
          setVal(value);
        }}
      />
    </div>
  );
}
surohak commented 3 years ago

ok I will try

surohak commented 3 years ago

Seems fixed )) Thank you @jaywcjlove