~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/editor.js

  • Committer: wagrant
  • Date: 2008-07-09 04:08:52 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:837
Add a highlighting-language selector to the editor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    }
53
53
}
54
54
 
 
55
function highlighting_changed(select)
 
56
{
 
57
    editbox.edit(editbox.getCode(), select.value);
 
58
}
 
59
 
55
60
/** Presents the text editor.
56
61
 */
57
62
function handle_text(path, text, handler_type)
70
75
        text.toString())
71
76
    div.appendChild(txt_elem);
72
77
    txt_elem.setAttribute("id", "editbox");
73
 
    language = language_from_mime(current_file.type)
 
78
    language = language_from_mime(current_file.type);
74
79
 
75
80
    // Assume plaintext if no type can be determined.
76
 
    txt_elem.className = "codepress " + (language ? language : 'text');
 
81
    language = language ? language : "text";
 
82
    document.getElementById("highlighting_select").value = language;
 
83
 
 
84
    txt_elem.className = "codepress " + language;
77
85
    txt_elem.setAttribute("onchange", "edit_text()");
78
86
    /* TODO: Make CSS height: 100% work */
79
87
    txt_elem.setAttribute("rows", "35");