SimpleMDE (Markdown Editor) , Marked.js for page visits.

User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

Just pushed my first plugin to github ! \o/

This implements SimpleMDE and /Snarkdown not anymore/ Marked.JS
SimpleMDE is the editor for owners, the Markdown content will be rendered via Marked.JS.

It probably needs some fixing, cleaning and I saw the output for visitors could use some formatting.. :lol: :?

Enjoy !

https://github.com/mjuksel/wondercms-markdown
Last edited by mjxl on Sat Feb 08, 2020 7:01 pm, edited 1 time in total.
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE/snarkdown (Markdown Editor)

Post by mjxl »

I pushed a couple of changes here and there :) A bit messy on github :lol:
  • Removed Snarkdown.js in favor of Marked.js
  • Swapped the local JS/CSS files to CDN delivered ones (jsDeliver).
  • Added a custom.css so we can override styles.
  • Some small tweaks here and there.
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by wiz »

I love the idea and great work!

When reviewing the plugin and testing it, I ran into two issue:
1. The "wondercms-markdown.php" file tries to include JS files from "wonder-markdown" insteaf of "wondercms-markdown".
2. After fixing the above issue, the editor didn't load.
- Please update your WonderCMS to the latest version (3.0.5) and re-run this plugin.

After successfully testing and adding this plugin tot he official repository, we'll add you to our list of contributors: https://wondercms.com/special-contriboturs

Thanks for becoming a part of the WonderCMS journey! :)
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

Crep, I saw it.

I had fixed it on my server , but not yet locally.
Updated to 3.0.2 !

Also could you tell me how to get all the areas for the user?
Right now i'm doing just $('#content'), this could be changed by either the users, or up front by me.

//edit: (I don't really get the PHP parts.. even JS is fairly new to me.)
Last edited by mjxl on Wed Feb 12, 2020 3:43 am, edited 1 time in total.
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

And i fixed it again. :) 3.0.3 works.
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by wiz »

Will re-check/test and add the plugin.

Hopefully this can happen with the 3.0.6 patch, as we found a minor bug where line breaks (br tags) get removed on second edit.

Cheers and thanks!
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

wiz wrote: Sun Feb 16, 2020 11:13 am Will re-check/test and add the plugin.

Hopefully this can happen with the 3.0.6 patch, as we found a minor bug where line breaks (br tags) get removed on second edit.

Cheers and thanks!
Cool, I've also added some new 'features' on my local version.

Added 2 buttons to the editor
One button is to save directly as HTML, this way we don't need a processor for visitors, and do other cool stuff.
The other one cleans the content of HTML, this is when you want to revert back to plain text.

Then I've got a second editor nearly doing what i want, which is far superior to this/summernote :geek:
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by wiz »

Just managed to do another round of testing and found another bug/glitch.

Tested on:
- Firefox 73.0.1

Description:
When the user tries to edit the first section on the page and clicks on the second (static), the first section gets duplicated (along with the editor).

Steps to reproduce:
1. Default WonderCMS installation.
2. Login as admin.
3. Install plugin.
4. Go to homepage.
5. Click/Edit "Website alive" section.
6. Click "About your website" section.
7. "Website alive" section is duplicated.

I guess the expected behaviour would be to only allow the user to edit one block at a time?
Other than that, awesome work! Would you mind sending me over your First/Last name + Twitter/website link so it can be added to our contributors list? https://wondercms.com/special-contributors
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

wiz wrote: Sat Feb 22, 2020 2:32 pm I guess the expected behaviour would be to only allow the user to edit one block at a time?
Other than that, awesome work! Would you mind sending me over your First/Last name + Twitter/website link so it can be added to our contributors list? https://wondercms.com/special-contributors
Exactly yeah, I think this one NEEDS a textarea. Which has the onblur event, making things go ham. (I don't know half i'm doing basically)

I've now set the editors to just load, instead of them waiting for a click, added a tiny bit of CSS.

Updated to 3.0.4 :lol:

Also sending a PM now :)
User avatar
mjxl
Posts: 43
Joined: Thu Jan 30, 2020 4:57 am

Re: SimpleMDE (Markdown Editor) , Marked.js for page visits.

Post by mjxl »

Oh my, i left to bed with a working editor on my website, but probably didnt save that to github.
Come back now , hey an update for my own plugin? BAM , broken XD will investigate

//edit: and 3.0.5 >_>
Post Reply