Skip to content

Commit

Permalink
Fixed issue CSC495-2014#122
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiao Wang committed Mar 21, 2014
1 parent a0fd89e commit 88b1659
Show file tree
Hide file tree
Showing 246 changed files with 183,967 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{ HTML::script('/js/helpers.js') }}
{{ HTML::script('/js/bootstrap.js') }}
{{ HTML::script('/js/mainTabbedInterface.js') }}
{{ HTML::script('/js/ace.js') }}
{{ HTML::script('/js/src-noconflict/ace.js') }}

{{ HTML::script('/js/ui/jquery.ui.position.js') }}
{{ HTML::script('/js/ui/jquery.ui.core.js') }}
Expand Down
37 changes: 37 additions & 0 deletions public/js/mainTabbedInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,43 @@ $(function()

document.getElementById(id).name = label; //set the name of tabs
var editor = ace.edit(id); //editor format
editor.setTheme("ace/theme/eclipse");

//set highlight format based on different files
//ace edior has lots of program language modes. The followings are just the most common ones
if(tabTitle.indexOf(".css") != -1)
{
editor.getSession().setMode("ace/mode/css");
}
else if(tabTitle.indexOf(".js") != -1)
{
editor.getSession().setMode("ace/mode/javascript");
}
else if(tabTitle.indexOf(".html") != -1 || tabTitle.indexOf(".htm") != -1)
{
editor.getSession().setMode("ace/mode/html");
}
else if(tabTitle.indexOf(".java") != -1)
{
editor.getSession().setMode("ace/mode/java");
}
else if(tabTitle.indexOf(".json") != -1)
{
editor.getSession().setMode("ace/mode/json");
}
else if(tabTitle.indexOf(".tex") != -1)
{
editor.getSession().setMode("ace/mode/tex");
}
else if(tabTitle.indexOf(".xml") != -1)
{
editor.getSession().setMode("ace/mode/xml");
}
else
{
editor.getSession().setMode("ace/mode/text");
}

edited[openedTabCtr] = false;
editor.getSession().on('change', function(e){
edited[tabs.tabs("option","active")+1] = true;
Expand Down
Loading

0 comments on commit 88b1659

Please sign in to comment.