working pagedown!!!!
This commit is contained in:
@ -160,6 +160,7 @@ $(function() {
|
||||
// new MarkdownEditor('#exercise_instructions');
|
||||
new MarkdownEditor('#exercise_description');
|
||||
// todo: add an ace editor for each file
|
||||
new PagedownEditor('#exercise_description');
|
||||
|
||||
enableInlineFileCreation();
|
||||
inferFileAttributes();
|
||||
|
@ -1,22 +0,0 @@
|
||||
(function() {
|
||||
var ACE_FILES_PATH = '/assets/ace/';
|
||||
|
||||
converter = Markdown.getSanitizingConverter()
|
||||
editor = new Markdown.Editor converter
|
||||
|
||||
editor.run();
|
||||
editor.refreshPreview()
|
||||
|
||||
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('markdown');
|
||||
session.setUseWrapMode(true);
|
||||
session.setValue($(selector).val());
|
||||
};
|
||||
})();
|
11
app/assets/javascripts/pagedown.js
Normal file
11
app/assets/javascripts/pagedown.js
Normal file
@ -0,0 +1,11 @@
|
||||
(function() {
|
||||
var ACE_FILES_PATH = '/assets/ace/';
|
||||
|
||||
window.PagedownEditor = function(selector) {
|
||||
var converter = Markdown.getSanitizingConverter();
|
||||
var editor = new Markdown.Editor( converter );
|
||||
|
||||
editor.run();
|
||||
|
||||
};
|
||||
})();
|
@ -9,12 +9,7 @@
|
||||
.form-group
|
||||
= f.label(:description)
|
||||
= f.hidden_field(:description)
|
||||
/.form-control.markdown
|
||||
.wmd-panel
|
||||
#wmd-button-bar
|
||||
textarea#wmd-input
|
||||
#wmd-preview
|
||||
= f.pagedown_editor :description, {skip_preview: false, panel_class: 'wmd-panel', button_bar_id: 'wmd-button-bar', button_bar_class: '', editor_id: 'wmd-input', editor_class: 'wmd-input', preview_id: 'wmd-preview', preview_class: '', }
|
||||
.form-control.markdown
|
||||
/.form-group
|
||||
= f.label(:description)
|
||||
= f.hidden_field(:description)
|
||||
|
@ -22,7 +22,6 @@ module CodeOcean
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
config.time_zone = 'Berlin'
|
||||
config.assets.precompile += %w( markdown-buttons.png )
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
|
Reference in New Issue
Block a user