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

Styling Issue within React. #413

Closed DaRabus closed 2 years ago

DaRabus commented 2 years ago

Hey Guys,

I tried a lot of things out and moved the component out of every thinkable style and even tried using the Chrome/Firefox CSS tools, but i just can't get it to a proper fit in any way. the Toolbar is horizontal somehow and also the text field is not changeable in the width...

My other components are MUI based styled so basically nothing which should interfere with

I removed now any styling for showing it.

What do i do wrong..

image image image

jaywcjlove commented 2 years ago

https://codesandbox.io/embed/markdown-editor-for-react-izdd6?fontsize=14&hidenavigation=1&theme=dark

You can give me an example using https://codesandbox.io to reproduce your error.

@DaRabus

DaRabus commented 2 years ago

Can't really reproduce it with Sandbox, i will try further with my project.

But is there some docs how i can style proper the single components, like the toolbar and the textfield by itself, cause the css doesnt apply on the parts if i put it on the "Editor"

image

@jaywcjlove

jaywcjlove commented 2 years ago

I don't understand your question. @DaRabus

jaywcjlove commented 2 years ago

You have to reproduce your problem before I can help you.

roshan521 commented 2 years ago

@DaRabus are you now able to use custom css?

DaRabus commented 2 years ago

@roshan521 I actually found this alternative which works with the styling.

https://github.com/HarryChen0506/react-markdown-editor-lite

roshan521 commented 2 years ago

@DaRabus looks sick bro thanks :+1:

jaywcjlove commented 2 years ago

@DaRabus @roshan521 https://github.com/uiwjs/react-markdown-editor

jaywcjlove commented 2 years ago

https://github.com/uiwjs/react-md-editor/blob/f7047fa7089db01dab36e82bc001a68168ad9c48/core/src/index.less#L3-L79

jaywcjlove commented 2 years ago

https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-md-editor/file/markdown-editor.css

raivatshah commented 1 year ago

Hi @jaywcjlove!

I'm trying to use this library on my remix react app. I tried importing the updated CSS file, i.e.import "@uiw/react-md-editor/dist/mdeditor.css"; but my CSS still does not load well.

Screenshot 2023-07-19 at 2 23 32 PM

I'm just trying to setup the basic demo:

import React from "react";
import MDEditor from "@uiw/react-md-editor";
// No import is required in the WebPack.
import "@uiw/react-md-editor/dist/mdeditor.css";

const mkdStr = `
# Markdown Editor

---

**Hello world!!!**

[![](https://avatars.githubusercontent.com/u/1680273?s=80&v=4)](https://avatars.githubusercontent.com/u/1680273?v=4)

\`\`\`javascript
import React from "react";
import ReactDOM from "react-dom";
import MEDitor from '@uiw/react-md-editor';

\`\`\`
`;

export default function LiveEditor() {
  const [value, setValue] = React.useState(mkdStr);
  return (
    <div className="container">
      <h3>Auto</h3>
      <MDEditor height={200} value={value} onChange={(val) => {if (val) setValue(val)}} />
      <h3>Light</h3>
      <div data-color-mode="light">
        <MDEditor height={200} value={value} onChange={(val) => {if (val) setValue(val)}} />
      </div>
      <h3>Light</h3>
      <div data-color-mode="dark">
        <MDEditor height={200} value={value} onChange={(val) => {if (val) setValue(val)}} />
      </div>
    </div>
  );
}

Do you have an idea of perhaps how I can fix this?