Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @ mentions #420

Open
enahs opened this issue Aug 4, 2022 · 4 comments
Open

Support @ mentions #420

enahs opened this issue Aug 4, 2022 · 4 comments

Comments

@enahs
Copy link

enahs commented Aug 4, 2022

allowing users to @ mention would be a helpful feature

@jaywcjlove
Copy link
Member

@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"));

@enahs
Copy link
Author

enahs commented Aug 5, 2022

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

@amandugar
Copy link

This crashes whole markdown editor when trying to do other tasks

@lasjdfl
Copy link

lasjdfl commented Apr 9, 2024

hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants