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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-01-14 01:40:49 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:220
browser: Removed 3 buttons which didn't do anything.
    Split editor handler into editor.js.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/** Presents the text editor.
 
3
 */
 
4
function handle_text(path, text, handler_type)
 
5
{
 
6
    /* Create a textarea with the text in it
 
7
     * (The makings of a primitive editor).
 
8
     */
 
9
 
 
10
    setmode(true);
 
11
    var files = document.getElementById("filesbody");
 
12
    var div = document.createElement("div");
 
13
    files.appendChild(div);
 
14
    div.setAttribute("class", "padding");
 
15
    /* First, print a warning message if this is not actually a text file.
 
16
     */
 
17
    if (handler_type != "text")
 
18
    {
 
19
        var warn = dom_make_text_elem("p",
 
20
            "Warning: You are editing a binary " +
 
21
            "file, which explains any strange characters you may see. If " +
 
22
            "you save this file, you could corrupt it.");
 
23
        div.appendChild(warn);
 
24
    }
 
25
    var txt_elem = dom_make_text_elem("textarea",
 
26
        text.toString())
 
27
    div.appendChild(txt_elem);
 
28
    txt_elem.setAttribute("id", "editbox");
 
29
    /* TODO: Make CSS height: 100% work */
 
30
    txt_elem.setAttribute("rows", "20");
 
31
}
 
32