OscarGodson / EpicEditor

EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.
http://epiceditor.com
MIT License
4.25k stars 334 forks source link

Side by side editing when not in fullscreen mode #337

Closed giodamelio closed 10 years ago

giodamelio commented 10 years ago

I want to be able to preview in real time like I am in fullscreen mode. Is there any way to do that?

ghost commented 10 years ago

You can do like this in the html :

<div id="epiceditor-preview"></div>

And in the js script where you initialize epiceditor, add this with the correct id you just defined :

var editor = new EpicEditor(opts);
editor.load();

editor.on('update', function () {
    document.querySelector('#epiceditor-preview').innerHTML = this.exportFile(null, 'html');
}).emit('update');

Something like that. Putting those things side by side is just css after that.

giodamelio commented 10 years ago

Awesome, thanks