question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Markdown button classnames can overlap with user-based classnames

See original GitHub issue

We got a report from one of our users that Markdown buttons are broken.

image

The original issue https://github.com/Megabit/Blazorise/issues/4060


Basically, it seems that the class names that are used by this library can overlap with Bootstrap or with any other user classes. They are too generic with names table, bold, italic, etc.

I have tried to change them dynamically after the MDE instance is created with the following code:

const easyMDE = new EasyMDE(mdeOptions);

if (easyMDE.options.toolbar) {
    for (let index = 0; index < easyMDE.options.toolbar.length; ++index) {
        const element = easyMDE.options.toolbar[index];

        if (element && element.name && !element.name.startsWith("mde-")) {
            element.name = "mde-" + element.name;
        }
    }
}

and it kinda works but not 100%. From what I can observe, the .toolbar is a global object, and any change to it changes all of the instances. If there are 5 editors on a page, a race condition happens, and one or two editors are rendered without the previously added "mde-" prefix.


My question is.

  1. How can I override MDE classnames? Is it even possible to do?
  2. Can MDE come with predefined classnames that include a prefix? Eg. table becomes mde-table

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Ionarucommented, Sep 20, 2022

2.18.0 has now been released and should be on npm in a few moments 😃

2reactions
Ionarucommented, Aug 25, 2022

Good ideas! I think prefixToClasses will be easier to implement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I define a class name on paragraph using Markdown?
No, Markdown's syntax can't. You can set ID values with Markdown Extra through. You can use regular HTML if you like, and add...
Read more >
easy-markdown-editor - Bountysource
EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving ...
Read more >
Standardize classnames and layout to facilitate theming
CSS selectors should use classnames over IDs. The logic being that we build reusable classes for application in multiple contexts, with ...
Read more >
Bar Charts | Google Developers
In this section, we'll see how to put labels inside (or near) the bars in a bar chart. Let's say we wanted to...
Read more >
Dash User Guide and Documentation
Dash is a productive Python framework for building web applications. Written on top of Flask, Plotly.js, and React.js, Dash is ideal for building...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found