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.03k stars 149 forks source link

工具栏提示如何设置中文 #621

Closed Ellen0604 closed 3 months ago

Ellen0604 commented 3 months ago

image

jaywcjlove commented 3 months ago

@Ellen0604 Upgrade v4.0.4

我添加了国际方法,这可能是我目前想到最简单的办法,同时不增加打包后的体积,同时方便使用

import React, { useContext } from "react";
import MDEditor, { commands } from "@uiw/react-md-editor";
import { getCommands, getExtraCommands } from "@uiw/react-md-editor/commands-cn";

export default function App() {
  const [value, setValue] = React.useState("**Hello world!!!**");
  return (
    <MDEditor
      value={value}
      preview="edit"
      commands={[...getCommands()]}
      extraCommands={[...getExtraCommands()]}
      onChange={(val) => setValue(val)}
    />
  );
}
Ellen0604 commented 3 months ago

十分感谢