~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-02-03 05:01:14 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:384
editor.js: Rewrote the way the editor and surrounding UI are inserted. The top
UI is now integrated into a fixed-height div that appears to be part of the
title bar. Changed some settings in the editor such as disabling toggle,
resize, and replacing tabs with 4 spaces (consistent with console).
editor.css: Restyled editor. The editor pane now takes up the whole screen
(all the way to the edge).

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
    saved_status.data = "Not saved.";
14
14
}
15
15
 
16
 
/** Presents the text editor.
 
16
/** Presents the "editor heading" (the part with the save box)
 
17
 * inserting it into a given element at the front.
17
18
 */
18
 
function handle_text(path, text, handler_type)
 
19
function present_editorhead(elem, path, handler_type)
19
20
{
20
 
    /* Create a textarea with the text in it
21
 
     * (The makings of a primitive editor).
22
 
     */
23
 
 
24
 
    setmode(true);
25
 
    var files = document.getElementById("filesbody");
26
21
    var div = document.createElement("div");
27
 
    files.appendChild(div);
28
 
    div.setAttribute("class", "padding");
 
22
    /* Insert as the head element */
 
23
    elem.insertBefore(div, elem.firstChild)
 
24
    div.setAttribute("id", "editorhead");
29
25
 
30
26
    /* Set up minimal interface */
31
27
    var p = dom_make_text_elem("p", "Path: ");
56
52
            "you save this file, you could corrupt it.");
57
53
        div.appendChild(warn);
58
54
    }
 
55
}
 
56
 
 
57
/** Presents the text editor.
 
58
 */
 
59
function handle_text(path, text, handler_type)
 
60
{
 
61
    /* Create a textarea with the text in it
 
62
     * (The makings of a primitive editor).
 
63
     */
 
64
    setmode(true);
 
65
 
 
66
    var files = document.getElementById("filesbody");
 
67
    /* Put our UI at the top */
 
68
    present_editorhead(files, path, handler_type);
 
69
 
 
70
    var div = document.createElement("div");
 
71
    files.appendChild(div);
59
72
    var txt_elem = dom_make_text_elem("textarea",
60
73
        text.toString())
61
74
    div.appendChild(txt_elem);
68
81
    editAreaLoader.init({
69
82
        id : "editbox",
70
83
        syntax: "python",
71
 
        start_highlight: true
 
84
        start_highlight: true,
 
85
        allow_toggle: false,
 
86
        allow_resize: false,
 
87
        replace_tab_by_spaces: 4,
72
88
    });
73
89
}
74
90