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

Incorrect cursor position #578

Open
Shekhar-Dangi opened this issue Oct 3, 2023 · 5 comments
Open

Incorrect cursor position #578

Shekhar-Dangi opened this issue Oct 3, 2023 · 5 comments

Comments

@Shekhar-Dangi
Copy link

Shekhar-Dangi commented Oct 3, 2023

I am using react-md-editor in my nextjs application but while typing, my cursor position is not correct.

Screen.Recording.2023-10-03.at.10.23.59.PM.mov

Here is my code :

"use client";
import "@uiw/react-md-editor/markdown-editor.css";
import "@uiw/react-markdown-preview/markdown.css";
import dynamic from "next/dynamic";
import { useState } from "react";

const MDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false });
function Editor() {
  const [value, setValue] = useState("**Hello world!!!**");
  return (
    <div data-color-mode="dark">
      <MDEditor
        autoFocus="on"
        key={1}
        tabSize={4}
        value={value}
        onChange={setValue}
      />
    </div>
  );
}

export default Editor;
@jaywcjlove
Copy link
Member

@Shekhar-Dangi Example: https://github.com/uiwjs/react-md-editor/tree/master/example/nextjs

Most likely it’s a style conflict, unable to reproduce your error

@jvanderberg
Copy link

jvanderberg commented Nov 7, 2023

We had the same problem and found we had a global stylesheet that had:

* {
  font-family: ...
}

Moving this to a body style appears to have fixed things and allows the MDEditor component to use its own internal fonts.

So I'd look for someplace where you overriding fonts or font attributes at a global level.

@psycho-baller
Copy link
Contributor

@jvanderberg's answer sparked an idea which was basically to do this when overriding the font:

body .w-md-editor-text-pre > code,
body .w-md-editor-text-input {
    ...
}

I prefixed the classnames with the body tag. After hours of confusion, that solves my issue

@hjyang369
Copy link

use this code. highlightEnable={false}
and They had the same issues as you. https://github.com/uiwjs/react-md-editor/issues/276

@devnoot
Copy link

devnoot commented Jul 6, 2024

use this code. highlightEnable={false} and They had the same issues as you. https://github.com/uiwjs/react-md-editor/issues/276

Thanks, this solved me issue as well

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

6 participants