16 lines
607 B
Plaintext
16 lines
607 B
Plaintext
(function() {
|
|
var ACE_FILES_PATH = '<%= "#{Rails.application.config.relative_url_root.chomp('/')}/assets/ace/" %>';
|
|
|
|
window.MarkdownEditor = function(selector) {
|
|
ace.config.set('modePath', ACE_FILES_PATH);
|
|
var editor = ace.edit($(selector).next()[0]);
|
|
editor.on('change', function() {
|
|
$(selector).val(editor.getValue());
|
|
});
|
|
editor.setShowPrintMargin(false);
|
|
var session = editor.getSession();
|
|
session.setMode('ace/mode/markdown');
|
|
session.setUseWrapMode(true);
|
|
session.setValue($(selector).val());
|
|
};
|
|
})(); |