HermanMartinus / bearblog

Free, no-nonsense, super fast blogging.
MIT License
2.36k stars 73 forks source link

[Tiny Change] Please add this for EasyMDE widget for easy editing toolbar and to prettify Markdown? This is how: #274

Closed salemandreus closed 4 months ago

salemandreus commented 4 months ago

It's just these 3 lines to add EasyMDE to a django project, (I added it in a django site here) and it's really this simple:

Add to template:

Import EasyMDE:

<!--Downloads/installs markdown widget from CDN-->
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>

Enable for Element:

<!--Target element (replace 'id_content' with your element's id) -->
<script>new EasyMDE({element: document.getElementById('id_content')});</script>

That's it!

HermanMartinus commented 4 months ago

So I certainly can't do that without pissing off a large chunk of Bear's user-base who value the simplicity of a simple text area (I also personally lean that way and dislike the vast majority of these editor interfaces).

That being said, your feature request inspired me to add the ability to add your own footer content to your dashboard editors.

In Settings / Advanced settings you'll see a Custom dashboard footer content field. In there you can paste

<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
<script>new EasyMDE({element: document.getElementById('body_content')});</script>

and your editors should work :)

salemandreus commented 4 months ago

Heya

I bought the premium subscription to test if that worked.

I'm not able to make it work that way. It seems to be because the headers and footers apply to the public blog site, whereas the editing posts layout is separate(I tested that it didn't come through by adding text as the footer, which only shows in public view and not when editing a post or the home page).

Would you be able to add it in, and if some people prefer the textarea without anything else, just set it as a toggle or have it as a configurable attribute or something? Surely being able to preview markdown live (even having it be optional) would be appreciated?

I'm currently having to navigate through to the draft/published page every time to check that the markdown renders as I expected, and then navigate back again to correct anything, and then navigate forward again to check that that edit rendered as expected, navigate back again etc... which makes editing a really cumbersome process.

Thanks

salemandreus commented 4 months ago

Oh, Murphy's law, despite struggling with this for who knows how long, immediately after writing all this, I discover that dashboard footer is a separate thing to the custom headers and footers!

🤦 Please forgive me! 😅

And thanks for adding it, it looks great now!