Commit 7caf4de2 authored by Riyad Preukschas's avatar Riyad Preukschas

Fix setting Ace mode

parent 6c1b4485
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
= link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?" = link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?"
:javascript :javascript
var ace_mode = "#{@tree.language.try(:ace_mode)}";
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/javascript"); if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}
$(".save-btn").click(function(){ $(".save-btn").click(function(){
$("#file_content").val(editor.getValue()); $("#file_content").val(editor.getValue());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment