react-md-editor icon indicating copy to clipboard operation
react-md-editor copied to clipboard

Support @ mentions

Open enahs opened this issue 3 years ago • 4 comments

allowing users to @ mention would be a helpful feature

enahs avatar Aug 04 '22 22:08 enahs

@enahs Example: https://codesandbox.io/embed/markdown-editor-for-react-uiwjs-react-md-editor-issues-420-vto6ge?fontsize=14&hidenavigation=1&theme=dark

import React from "react";
import ReactDOM from "react-dom";
import { MentionsInput, Mention } from "react-mentions";
import Mentions from "rc-mentions";
import MDEditor from "@uiw/react-md-editor";
import "./index.css";

const mkdStr = `# Markdown Editor for [React]

**Hello world!!!**`;

function App() {
  const [value, setValue] = React.useState(mkdStr);
  return (
    <div className="container">
      <MDEditor
        renderTextarea={(props, { onChange }) => {
          return (
            <Mentions
              value={props.value}
              onChange={(newValue) => setValue(newValue)}
            >
              <Mentions.Option value="light">Light</Mentions.Option>
              <Mentions.Option value="bamboo">Bamboo</Mentions.Option>
              <Mentions.Option value="cat">Cat</Mentions.Option>
            </Mentions>
          );
        }}
        height={200}
        value={value}
        onChange={setValue}
      />
    </div>
  );
}

ReactDOM.render(<App />, document.getElementById("container"));

jaywcjlove avatar Aug 05 '22 01:08 jaywcjlove

Super helpful. very useful feature. should add to the readme!

enahs avatar Aug 05 '22 01:08 enahs

This crashes whole markdown editor when trying to do other tasks

amandugar avatar Feb 11 '24 15:02 amandugar

hi

lasjdfl avatar Apr 09 '24 12:04 lasjdfl