pioul / Minimalist-Online-Markdown-Editor

This is the simplest and slickest online Markdown editor.
http://markdown.pioul.fr
MIT License
265 stars 45 forks source link

Save/Load markdown data to/from a .md file. SOLVED (forked) #5

Closed vincurekf closed 10 years ago

vincurekf commented 10 years ago

Hi there :) I was just wondering if is there a way to save the edited text (in markdown panel) to a .md file, or loading data from .md to textarea for editing.

I've tried simply loading the data from localStorage:

...
var textToSave = localStorage.getItem("markdown"); 
...
// and then saving to a .md file which works 
// but it's not a perfect way (just my guess)

But it's beyond my skill to pull data from .md file to localStorage for editing.

Does anyone know how to manage this? Thanks for any response ;)

EDIT: Solved, added.
Check link below: mome, enhanced MinimalistOnlineMarkdownEditor ;)

philippe-git commented 10 years ago

Hey!

That's an interesting feature, one that has been requested a good amount of times already, and it totally makes sense for such an editor, so I'm definitely up for it.

Loading from and saving to files from JavaScript isn't something I've done before, so I had to read a bit about it and what browser APIs allow us to do today, and I sadly couldn't find any straightforward and cross-browser way to do it.

However, this editor being also available as a Chrome app, and Chrome having a cool API for apps to do just this, it'd be pretty painless to implement that feature inside the Chrome app.

So I'm split between adding that feature only in the Chrome app (which would be somewhat unfair to the regular app), or waiting a couple of months for modern browsers to gain even more market share and these APIs to stabilize.

(About your edit and what what you've implemented in your fork: Great! I didn't know you were thinking about server-side file saving. I want the main branch of this tool to be client-side only, mainly because that's how it works since the beginning and it's good for privacy. If your solution works for you, I'm glad it does though, and for your information, I did just the same thing for my personal blog / site: the dashboard / writing panel is a fork of MOME that handles creating and saving pages and blog posts in Markdown :-))

Cheers!