django-markdown-editor icon indicating copy to clipboard operation
django-markdown-editor copied to clipboard

MARTOR_ENABLE_ADMIN_CSS not disabling bootstrap styling

Open JElgar opened this issue 1 year ago • 4 comments

Discussed in https://github.com/agusmakmun/django-markdown-editor/discussions/258

Originally posted by JElgar August 19, 2024 Hey! I'm trying to find a markdown editor to use in the django admin. This one looks awesome and exactly what I need. The one small thing I'm struggling with is integrating it with unfold.

If I disable unfold and use the vanilla django admin everything works great but if I open an admin form with any martor field with unfold then all the css goes a bit wild.

image

I saw in your README you have

# Disable admin style when using custom admin interface e.g django-grappelli (default is True)
MARTOR_ENABLE_ADMIN_CSS = True

which seems to allude to you supporting this kind of use case but I tried setting it to False but I got the same issue.

I have noticed that folks are having issues with unfold and other markdown editors (e.g. https://github.com/unfoldadmin/django-unfold/issues/497) so potentially not something can be solved here.

JElgar avatar Aug 20 '24 12:08 JElgar

The styles causing the issues are coming from bootstrap.min.css. It looks like all those styles are pulled in regardless of the value MARTOR_ENABLE_ADMIN_CSS. I wonder if there is a way we can only apply those styling just to the component rather than the whole admin panel?

JElgar avatar Aug 20 '24 12:08 JElgar

hello @JElgar for this case you can use your own style:

# If you need to use your own themed "bootstrap" or "semantic ui" dependency
# replace the values with the file in your static files dir
MARTOR_ALTERNATIVE_JS_FILE_THEME = "semantic-themed/semantic.min.js"   # default None
MARTOR_ALTERNATIVE_CSS_FILE_THEME = "semantic-themed/semantic.min.css" # default None
MARTOR_ALTERNATIVE_JQUERY_JS_FILE = "jquery/dist/jquery.min.js"        # default None

agusmakmun avatar Aug 21 '24 01:08 agusmakmun

did u find any solution ?

dragonscraper avatar Jun 15 '25 21:06 dragonscraper

I found the issue.

For me, I was copying the settings from the README 1 for 1 without reading through them entirely. The MARTOR_ALTERNATIVE _* variables are included in that README example settings file as strings that go to theoretical locations, while the default is None.

Copying without looking means your changing the file locations without realizing it, then confused why Django Admin isnt loading files that dont exist that you told it to look for.

Deleting MARTOR_ALTERNATIVE_JS_FILE_THEME, MARTOR_ALTERNATIVE_CSS_FILE_THEME, and MARTOR_ALTERNATIVE_JQUERY_JS_FILE worked for me.

resba avatar Aug 13 '25 14:08 resba