uiwjs / react-markdown-editor

A markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-markdown-editor
MIT License
337 stars 34 forks source link

Wrap text in editor #206

Closed 92sajid110 closed 1 year ago

92sajid110 commented 1 year ago

Hello, I want to wrap text to new line just like vs code. I have given the fixed height to the editor but didn't find wrapText option

Thanks

jaywcjlove commented 1 year ago

I do not understand what you mean. @92sajid110

92sajid110 commented 1 year ago

in vs code it is Word wrap Word wrap is a feature in VS Code that automatically adjusts the display of long lines of code or text so that they fit within the editor's visible area. When word wrap is enabled, long lines are wrapped onto the next line, making it easier to read and edit code or text without having to scroll horizontally.

jaywcjlove commented 1 year ago

@92sajid110 https://codesandbox.io/embed/react-markdown-editor-https-github-com-uiwjs-react-markdown-editor-issues-206-v2pyr6?fontsize=14&hidenavigation=1&theme=dark

import MarkdownEditor from "@uiw/react-markdown-editor";
import { useState } from "react";
+ import { EditorView } from "@codemirror/view";

const code = `# title\n\nHello World!\n\n`;

export default function App() {
  const [markdownVal, setMarkdownVal] = useState(code);
  return (
    <div className="App">
      <MarkdownEditor
+        extensions={[EditorView.lineWrapping]}
        value={markdownVal}
        onChange={(value) => {
          setMarkdownVal(value);
        }}
      />
    </div>
  );
}
92sajid110 commented 1 year ago

Thanks

92sajid110 commented 1 year ago

Is there any option to highlight custom text like

i made custom component for react
{...}

i want to highlight as this is tag