Coder Social home page Coder Social logo

Shifted text in edit mode about react-md-editor HOT 7 CLOSED

uiwjs avatar uiwjs commented on May 24, 2024 2
Shifted text in edit mode

from react-md-editor.

Comments (7)

ArthurKnoep avatar ArthurKnoep commented on May 24, 2024 2

Thanks @StephenGrider, @MatheusPires99 and @jaywcjlove for your answers.

Indeed it was a style conflict, the responsible in my case was bulma (damn it bulma).

If someone passes by here with the same problem, here's my fix:

.w-md-editor .title {
    line-height: unset !important;
    font-size: unset !important;
    font-weight: unset !important;
}

from react-md-editor.

MatheusPires99 avatar MatheusPires99 commented on May 24, 2024 1

@ArthurKnoep @brutomfr I had the same problem as well, so I stated to look at the CSS properties that is applied and I found a line-height: 18px; on the element with class.w-md-editor-text. So a set the line-height of this element to unset, and that resolved my problem.

.w-md-editor-text {
  line-height: unset;
}

from react-md-editor.

ArthurKnoep avatar ArthurKnoep commented on May 24, 2024 1

Hey, sorry for the late reply.

Actually this was a big induced by a conflicting style caused by bulma. This is not something that is desirable because it breaks the lines alignment.

from react-md-editor.

brutomfr avatar brutomfr commented on May 24, 2024

I have the same problem.
I did not find a solution

from react-md-editor.

jaywcjlove avatar jaywcjlove commented on May 24, 2024

There is no instance, it can only be judged that it may be a style conflict

from react-md-editor.

StephenGrider avatar StephenGrider commented on May 24, 2024

The editor uses Prism to apply syntax highlighting, see here: https://github.com/uiwjs/react-md-editor/blob/master/src/components/TextArea/index.tsx#L56

Prism itself applies some classnames to elements to get the syntax highlighting effect. Unfortunately, those classnames are extremely common and generic - stuff like title, token, etc.

Here's the crux: if you have any CSS that affects those classNames it'll interfere with Prism's default styling! So @ArthurKnoep, you probably have a .title css rule somewhere that is increasing the font size of that # hello text.

There's no option in this lib to disable the highlighting stuff, but you can sabotage prism directly to keep it from doing any highlighting:

import Prism from 'prismjs';

Prism.languages.markdown = {};

from react-md-editor.

rafaelguedes avatar rafaelguedes commented on May 24, 2024

@ArthurKnoep, how do you manage to add that syntax highlighting?

I mean: how do you manage to type "# hello" and apply the heading style in the "hello" word?

from react-md-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.