|
1 /** |
|
2 * $Id: editor_template_src.js 162 2007-01-03 16:16:52Z spocke $ |
|
3 * |
|
4 * @author Moxiecode |
|
5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
|
6 */ |
|
7 |
|
8 var TinyMCE_SimpleTheme = { |
|
9 // List of button ids in tile map |
|
10 _buttonMap : 'bold,bullist,cleanup,italic,numlist,redo,strikethrough,underline,undo', |
|
11 |
|
12 getEditorTemplate : function() { |
|
13 var html = ''; |
|
14 |
|
15 html += '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}">'; |
|
16 html += '<tr><td align="center">'; |
|
17 html += '<span id="{$editor_id}">IFRAME</span>'; |
|
18 html += '</td></tr>'; |
|
19 html += '<tr><td class="mceToolbar" align="center" height="1">'; |
|
20 html += tinyMCE.getButtonHTML('bold', 'lang_bold_desc', '{$themeurl}/images/{$lang_bold_img}', 'Bold'); |
|
21 html += tinyMCE.getButtonHTML('italic', 'lang_italic_desc', '{$themeurl}/images/{$lang_italic_img}', 'Italic'); |
|
22 html += tinyMCE.getButtonHTML('underline', 'lang_underline_desc', '{$themeurl}/images/{$lang_underline_img}', 'Underline'); |
|
23 html += tinyMCE.getButtonHTML('strikethrough', 'lang_striketrough_desc', '{$themeurl}/images/strikethrough.gif', 'Strikethrough'); |
|
24 html += '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />'; |
|
25 html += tinyMCE.getButtonHTML('undo', 'lang_undo_desc', '{$themeurl}/images/undo.gif', 'Undo'); |
|
26 html += tinyMCE.getButtonHTML('redo', 'lang_redo_desc', '{$themeurl}/images/redo.gif', 'Redo'); |
|
27 html += '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />'; |
|
28 html += tinyMCE.getButtonHTML('cleanup', 'lang_cleanup_desc', '{$themeurl}/images/cleanup.gif', 'mceCleanup'); |
|
29 html += '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />'; |
|
30 html += tinyMCE.getButtonHTML('bullist', 'lang_bullist_desc', '{$themeurl}/images/bullist.gif', 'InsertUnorderedList'); |
|
31 html += tinyMCE.getButtonHTML('numlist', 'lang_numlist_desc', '{$themeurl}/images/numlist.gif', 'InsertOrderedList'); |
|
32 html += '</td></tr></table>'; |
|
33 |
|
34 return { |
|
35 delta_width : 0, |
|
36 delta_height : 20, |
|
37 html : html |
|
38 }; |
|
39 }, |
|
40 |
|
41 handleNodeChange : function(editor_id, node) { |
|
42 // Reset old states |
|
43 tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal'); |
|
44 tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal'); |
|
45 tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal'); |
|
46 tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal'); |
|
47 tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal'); |
|
48 tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal'); |
|
49 |
|
50 // Handle elements |
|
51 do { |
|
52 switch (node.nodeName.toLowerCase()) { |
|
53 case "b": |
|
54 case "strong": |
|
55 tinyMCE.switchClass(editor_id + '_bold', 'mceButtonSelected'); |
|
56 break; |
|
57 |
|
58 case "i": |
|
59 case "em": |
|
60 tinyMCE.switchClass(editor_id + '_italic', 'mceButtonSelected'); |
|
61 break; |
|
62 |
|
63 case "u": |
|
64 tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected'); |
|
65 break; |
|
66 |
|
67 case "strike": |
|
68 tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonSelected'); |
|
69 break; |
|
70 |
|
71 case "ul": |
|
72 tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected'); |
|
73 break; |
|
74 |
|
75 case "ol": |
|
76 tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected'); |
|
77 break; |
|
78 } |
|
79 } while ((node = node.parentNode) != null); |
|
80 } |
|
81 }; |
|
82 |
|
83 tinyMCE.addTheme("simple", TinyMCE_SimpleTheme); |
|
84 tinyMCE.addButtonMap(TinyMCE_SimpleTheme._buttonMap); |