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 {
15 function Head($name='edit[content]') {
17 $WikiTheme->addMoreAttr('body'," onload='initEditor()'");
18 //Todo: language selection from available lang/*.js files
20 <script type="text/javascript" src="'.DATA_PATH.'/themes/default/htmlarea3/htmlarea.js"></script>
21 <script type="text/javascript" src="'.DATA_PATH.'/themes/default/htmlarea3/lang/en.js"></script>
22 <script type="text/javascript" src="'.DATA_PATH.'/themes/default/htmlarea3/dialog.js"></script>
23 <style type="text/css">
24 @import url('.DATA_PATH.'/themes/default/htmlarea3/htmlarea.css);
26 <script type="text/javascript">
27 _editor_url = "'.DATA_PATH.'/themes/default/htmlarea3/";
29 function initEditor() {
30 editor = new HTMLArea("'.$name.'");
32 // comment the following two lines to see how customization works
36 // BEGIN: code that adds custom buttons
37 var cfg = editor.config; // this is the default configuration
38 function clickHandler(editor, buttonId) {
41 editor.insertHTML("<?plugin CreateToc ?>");
44 editor.insertHTML((new Date()).toString());
47 editor.execCommand("bold");
48 editor.execCommand("italic");
51 editor.surroundHTML("<span class=\"hilite\">", "</span>");
55 cfg.registerButton("my-toc", "Insert TOC", _editor_url+"ed_custom.gif", false, clickHandler);
56 cfg.registerButton("my-date", "Insert date/time", _editor_url+"ed_custom.gif", false, clickHandler);
57 cfg.registerButton("my-bold-em", "Toggle bold/italic", _editor_url+"ed_custom.gif", false, clickHandler);
58 cfg.registerButton("my-hilite", "Hilite selection", _editor_url+"ed_custom.gif", false, clickHandler);
60 cfg.registerButton("my-sample", "Class: sample", _editor_url+"ed_custom.gif", false,
63 editor.insertHTML("<span class=\"sample\"> </span>");
64 var r = editor._doc.selection.createRange();
65 r.move("character", -2);
66 r.moveEnd("character", 2);
68 } else { // Gecko/W3C compliant
69 var n = editor._doc.createElement("span");
70 n.className = "sample";
71 editor.insertNodeAtSelection(n);
72 var sel = editor._iframe.contentWindow.getSelection();
73 sel.removeAllRanges();
74 var r = editor._doc.createRange();
82 //cfg.pageStyle = "body { background-color: #efd; } .hilite { background-color: yellow; } "+
83 // ".sample { color: green; font-family: monospace; }";
84 // add the new button to the toolbar
85 //cfg.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold-em", "my-hilite", "my-sample"]);
86 // END: code that adds custom buttons
90 function insertHTML() {
91 var html = prompt("Enter some HTML code here");
93 editor.insertHTML(html);
96 function highlight() {
97 editor.surroundHTML(\'<span style="background-color: yellow">\', \'</span>\');
103 function Textarea($textarea,$wikitext,$name='edit[content]') {
104 $out = HTML($textarea,HTML::div(array("id"=>"editareawiki",'style'=>'display:none'),$wikitext),"\n");
105 //TODO: maybe some more custom links
114 // c-hanging-comment-ender-p: nil
115 // indent-tabs-mode: nil