4 * requires installation into themes/default/htmlarea3/
5 * MSIE => 5.5, Mozilla >= 1.3
11 require_once 'lib/WysiwygEdit.php';
13 class WysiwygEdit_htmlarea3 extends WysiwygEdit
16 function Head($name = 'edit[content]')
19 $WikiTheme->addMoreAttr('body', " onload='initEditor()'");
20 //Todo: language selection from available lang/*.js files
22 <script type="text/javascript" src="' . DATA_PATH . '/themes/default/htmlarea3/htmlarea.js"></script>
23 <script type="text/javascript" src="' . DATA_PATH . '/themes/default/htmlarea3/lang/en.js"></script>
24 <script type="text/javascript" src="' . DATA_PATH . '/themes/default/htmlarea3/dialog.js"></script>
25 <style type="text/css">
26 @import url(' . DATA_PATH . '/themes/default/htmlarea3/htmlarea.css);
28 <script type="text/javascript">
29 _editor_url = "' . DATA_PATH . '/themes/default/htmlarea3/";
31 function initEditor() {
32 editor = new HTMLArea("' . $name . '");
34 // comment the following two lines to see how customization works
38 // BEGIN: code that adds custom buttons
39 var cfg = editor.config; // this is the default configuration
40 function clickHandler(editor, buttonId) {
43 editor.insertHTML("<?plugin CreateToc ?>");
46 editor.insertHTML((new Date()).toString());
49 editor.execCommand("bold");
50 editor.execCommand("italic");
53 editor.surroundHTML("<span class=\"hilite\">", "</span>");
57 cfg.registerButton("my-toc", "Insert TOC", _editor_url+"ed_custom.gif", false, clickHandler);
58 cfg.registerButton("my-date", "Insert date/time", _editor_url+"ed_custom.gif", false, clickHandler);
59 cfg.registerButton("my-bold-em", "Toggle bold/italic", _editor_url+"ed_custom.gif", false, clickHandler);
60 cfg.registerButton("my-hilite", "Hilite selection", _editor_url+"ed_custom.gif", false, clickHandler);
62 cfg.registerButton("my-sample", "Class: sample", _editor_url+"ed_custom.gif", false,
65 editor.insertHTML("<span class=\"sample\"> </span>");
66 var r = editor._doc.selection.createRange();
67 r.move("character", -2);
68 r.moveEnd("character", 2);
70 } else { // Gecko/W3C compliant
71 var n = editor._doc.createElement("span");
72 n.className = "sample";
73 editor.insertNodeAtSelection(n);
74 var sel = editor._iframe.contentWindow.getSelection();
75 sel.removeAllRanges();
76 var r = editor._doc.createRange();
84 //cfg.pageStyle = "body { background-color: #efd; } .hilite { background-color: yellow; } "+
85 // ".sample { color: green; font-family: monospace; }";
86 // add the new button to the toolbar
87 //cfg.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold-em", "my-hilite", "my-sample"]);
88 // END: code that adds custom buttons
92 function insertHTML() {
93 var html = prompt("Enter some HTML code here");
95 editor.insertHTML(html);
98 function highlight() {
99 editor.surroundHTML(\'<span style="background-color: yellow">\', \'</span>\');
105 function Textarea($textarea, $wikitext, $name = 'edit[content]')
107 $out = HTML($textarea, HTML::div(array("id" => "editareawiki", 'style' => 'display:none'), $wikitext), "\n");
108 //TODO: maybe some more custom links
117 // c-hanging-comment-ender-p: nil
118 // indent-tabs-mode: nil