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.17k stars 157 forks source link

Text overlap on selection #276

Open borsemayur2 opened 3 years ago

borsemayur2 commented 3 years ago

I'm getting following error on text selection. What can be the issue? image

jaywcjlove commented 3 years ago

@borsemayur2 Style conflicts.

sametweb commented 3 years ago

highlightEnable={false} solves it. https://github.com/uiwjs/react-md-editor/issues/279#issuecomment-945658072

jaywcjlove commented 3 years ago

@sametweb There is no problem in the Windows Chrome test.

sametweb commented 3 years ago

@sametweb There is no problem in the Windows Chrome test.

I'm testing in Chrome as well. I am also using TailwindCSS, maybe something from there messes it up. I didn't dive deep to understand what clashes. highlightEnable={false} solved it and I left it there.

jaywcjlove commented 3 years ago

@sametweb You can reproduce the problem through codesandbox.io, let me debug and see.

juspky commented 2 years ago

I'm testing in Chrome as well. I am also using TailwindCSS, maybe something from there messes it up. I didn't dive deep to understand what clashes. highlightEnable={false} solved it and I left it there.

Had the same issue in combination with TailwindCSS too. So I can confirm there is a conflict with TailwindCSS and the highlighting, probably it is Tailwinds css reset. highlightEnable={false} helps as a workaround.

JuliaMerz commented 11 months ago

For anyone running into this years later and stubbornly insisting onhighlight, in my case the issue was highlighting on select for textarea—so they were actually lined up until the moment you clicked the text box.

border: 0px !important; resolved it for me.

pre.w-md-editor-text-pre > code,
.w-md-editor-text-input, .w-md-editor-text-input > textarea {
  font-size: 1.8rem !important;
  line-height: 1.618 !important;
  border: 0px !important;
}
div3791 commented 6 months ago

adding highlightEnable={false} causes font family ignored and limits lines to 2 only. minHeight maxHeight are ignored in this case. kindly provide any fix

jaywcjlove commented 6 months ago
import React from "react";
import MDEditor from '@uiw/react-md-editor/nohighlight';

const code = `**Hello world!!!**
\`\`\`js
function demo() {}
\`\`\`
`

export default function App() {
  const [value, setValue] = React.useState(code);
  return (
    <div className="container">
      <MDEditor
        value={value}
        onChange={setValue}
      />
      <MDEditor.Markdown source={value} style={{ whiteSpace: 'pre-wrap' }} />
    </div>
  );
}

@div3791 You can directly remove the code highlighting.