agusmakmun / django-markdown-editor

Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI
GNU General Public License v3.0
807 stars 1.34k forks source link

MARTOR_ENABLE_ADMIN_CSS not disabling bootstrap styling #259

Open JElgar opened 3 weeks ago

JElgar commented 3 weeks ago

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](https://github.com/unfoldadmin/django-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 commented 3 weeks ago

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?

agusmakmun commented 3 weeks ago

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