Skip to content

Logical flaw with stylesheets for Markdown #42

Description

@InAnYan

Context
I've been trying to integrate your component to JabRef. In the app we provide a custom CSS file, that is automatically loaded and updated into Scene (it's called Base.css). The app also has theming change. This change is also handled, and to the scene a new additional CSS file is loaded (for example Dark.css).

The problem
The thing is, I couldn't use this features with your MarkdownView controller, and I think the error is like this:

Look how CSS stylesheets are loaded to the component:

  1. Base.css is loaded into Scene.
  2. MarkdownView will inherit this Base.css.
  3. (!) MarkdownView will load mdfx.css file and overwrite the styles.
  4. MarkdownView will also load mdfx-default.css if getDefaultStylesheets is not overriden.

Workaround
And in order to solve this issue, we needed to overwrite the getDefaultStylesheets to include our Base.css or Dark.css. The flow of CSS looks like this: Base.css -> mdfx.css -> Base.css. And only that will work.

Interpretation
So instead of inheriting the CSS files already loaded to Scene and use it from the bottom, we are forced to add it again on top.

Proposed solution

  • Do not load mfdx.css (or load this not in constructor, but in getDefaultStylesheets).
  • If users want to provide their style, force them to provide all the classes that are present in mfdx.css and mdfx-default.css

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions