changed the code edit view to fall back to the text type when no type is detected
This commit is contained in:
parent
3ad3aaf5f3
commit
ee72702214
@ -95,12 +95,19 @@ $(function () {
|
|||||||
|
|
||||||
ace_modes = codepot_get_ace_modes();
|
ace_modes = codepot_get_ace_modes();
|
||||||
var detected_mode = null;
|
var detected_mode = null;
|
||||||
|
var text_mode = null;
|
||||||
|
var text_opt = null;
|
||||||
for (var i in ace_modes)
|
for (var i in ace_modes)
|
||||||
{
|
{
|
||||||
var mode = ace_modes[i];
|
var mode = ace_modes[i];
|
||||||
|
|
||||||
var opt = $("<option></option>").val(mode.mode).text(mode.caption);
|
var opt = $("<option></option>").val(mode.mode).text(mode.caption);
|
||||||
|
|
||||||
|
if (!text_mode && mode.caption == 'Text')
|
||||||
|
{
|
||||||
|
text_mode = mode;
|
||||||
|
text_opt = opt;
|
||||||
|
}
|
||||||
if (mode.supportsFile("<?php print addslashes($file['name']); ?>"))
|
if (mode.supportsFile("<?php print addslashes($file['name']); ?>"))
|
||||||
{
|
{
|
||||||
if (!detected_mode)
|
if (!detected_mode)
|
||||||
@ -114,6 +121,12 @@ $(function () {
|
|||||||
mode_menu.append(opt);
|
mode_menu.append(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!detected_mode && text_mode)
|
||||||
|
{
|
||||||
|
text_opt.attr('selected', 'selected');
|
||||||
|
detected_mode = text_mode;
|
||||||
|
}
|
||||||
|
|
||||||
var editor = ace.edit("code_edit_mainarea_result_code");
|
var editor = ace.edit("code_edit_mainarea_result_code");
|
||||||
//editor.setTheme("ace/theme/chrome");
|
//editor.setTheme("ace/theme/chrome");
|
||||||
if (detected_mode) editor.getSession().setMode (detected_mode.mode);
|
if (detected_mode) editor.getSession().setMode (detected_mode.mode);
|
||||||
@ -239,10 +252,9 @@ $this->load->view (
|
|||||||
|
|
||||||
<div class="title" id="code_edit_mainarea_title">
|
<div class="title" id="code_edit_mainarea_title">
|
||||||
<?php
|
<?php
|
||||||
/*print anchor (
|
print anchor (
|
||||||
"code/file/{$project->id}{$revreqroot}",
|
"code/file/{$project->id}{$revreqroot}",
|
||||||
htmlspecialchars($project->name));*/
|
htmlspecialchars($project->name));
|
||||||
print htmlspecialchars($project->name);
|
|
||||||
|
|
||||||
$exps = explode ('/', $headpath);
|
$exps = explode ('/', $headpath);
|
||||||
$expsize = count($exps);
|
$expsize = count($exps);
|
||||||
@ -253,12 +265,9 @@ $this->load->view (
|
|||||||
$xpar = $this->converter->AsciiToHex ($par);
|
$xpar = $this->converter->AsciiToHex ($par);
|
||||||
|
|
||||||
print '/';
|
print '/';
|
||||||
/*
|
|
||||||
print anchor (
|
print anchor (
|
||||||
"code/file/{$project->id}/{$xpar}{$revreq}",
|
"code/file/{$project->id}/{$xpar}{$revreq}",
|
||||||
htmlspecialchars($exps[$i]));
|
htmlspecialchars($exps[$i]));
|
||||||
*/
|
|
||||||
print htmlspecialchars($exps[$i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($headpath != $file['fullpath'])
|
if ($headpath != $file['fullpath'])
|
||||||
|
Loading…
Reference in New Issue
Block a user