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

Not getting the checked list from preview mode ? #214

Open
IntelligaiaVivek opened this issue Jul 28, 2021 · 4 comments
Open

Not getting the checked list from preview mode ? #214

IntelligaiaVivek opened this issue Jul 28, 2021 · 4 comments

Comments

@IntelligaiaVivek
Copy link

IntelligaiaVivek commented Jul 28, 2021

I am not able to get the checked and unchecked state from preview, whether we have selected any checklist or not?

Example:-

image

@jaywcjlove
Copy link
Member

You can use rehype plugins to solve this problem.

import React from "react";
import ReactDOM from "react-dom";
import MDEditor from '@uiw/react-md-editor';

export default function App() {
  const [value, setValue] = React.useState("**Hello world!!!**");
  return (
    <div className="container">
      <MDEditor
        value={value}
        onChange={setValue}
        previewOptions={{
            rehypePlugins: [yourPlugins]
        }}
      />
    </div>
  );
}

This is just an idea, not sure to solve your problem.
@IntelligaiaVivek

@IntelligaiaVivek
Copy link
Author

IntelligaiaVivek commented Jul 28, 2021

ok no problem @jaywcjlove Again thanks for this Awesome editor :)

@Fakh94
Copy link

Fakh94 commented Sep 7, 2022

Which plugin we need to use to achieve the select in the checklist ?

@jaywcjlove
Copy link
Member

@Fakh94 https://codesandbox.io/embed/markdown-editor-for-react-https-github-com-uiwjs-react-md-editor-issues-214-bioqy9?fontsize=14&hidenavigation=1&theme=dark

import React from "react";
import ReactDOM from "react-dom";
import MDEditor from "@uiw/react-md-editor";
import rehypeRewrite from "rehype-rewrite";

const mkdStr = `
- [ ] TODO
`;

function App() {
  const [value, setValue] = React.useState(mkdStr);

  return (
    <div className="container">
      <h3>Auto</h3>
      <MDEditor
        height={200}
        previewOptions={{
          rehypePlugins: [
            [
              rehypeRewrite,
              {
                rewrite: (node, index, parent) => {
                  console.log(node);
                }
              }
            ]
          ]
        }}
        value={value}
        onChange={setValue}
      />
    </div>
  );
}

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

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

3 participants