uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.17k stars 157 forks source link

Create and edit element using markdown #395

Open StasSpawn opened 2 years ago

StasSpawn commented 2 years ago

Can i use this component for: 1) Create elements/comments on page (I need multiple elements, like comment section) 2) Edit them after they was created (button edit - click - and elements inside this comment return to MarkDown, where user can make some changes)

jaywcjlove commented 2 years ago

@StasSpawn Not sure if you need an example like this https://codesandbox.io/s/markdown-editor-for-react-uiwjs-react-md-editor-issues-395-jxcwzq?file=/index.js

image
import MDEditor from "@uiw/react-md-editor";
+ import { commands } from "@uiw/react-md-editor";

+ const commandsObj = [
+   commands.codeEdit,
+   commands.codePreview,
+   commands.divider,
+   commands.fullscreen
+ ];

<MDEditor
+  extraCommands={commandsObj}
+  preview="edit"
  height={200}
  value={value}
  onChange={setValue}
/>
StasSpawn commented 2 years ago

@jaywcjlove I need something like this. 2022-05-27_132545

1) Now i can create comments 2) But i also want to edit them.

jaywcjlove commented 2 years ago

https://codesandbox.io/s/markdown-editor-for-react-uiwjs-react-md-editor-issues-395-jxcwzq?file=/index.js

@StasSpawn

StasSpawn commented 2 years ago

@jaywcjlove Thank you so much for answer! I will check your work!

For now i manage to do it myself. But I'm using only 1 MDEditor inside modal window for creating and aditing comments.

StasSpawn commented 2 years ago

@jaywcjlove Hello.

I've return to your examples and realize - they don't have creation functionality. Here we have already created comments and can edit them. But I need to 1) create multiple comments 2) and then change each of them.

So, we dont have an initial items with comments, they has to be created and first.