tiny_mce_helper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
@@ -0,0 +1,361 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <meta name="keywords" content="TinyMCE:Configuration,Configuration/accessibility focus,Configuration/accessibility warnings,Configuration/add form submit trigger,Configuration/add unload trigger,Configuration/apply source formatting,Configuration/ask,Configuration/auto focus,Configuration/auto reset designmode,Configuration/auto resize,Configuration/browsers" />
6
+ <link rel="shortcut icon" href="/favicon.ico" />
7
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php" title="Moxiecode Documentation Wiki (English)" />
8
+ <title>TinyMCE:Configuration - Moxiecode Documentation Wiki</title>
9
+ <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/skins/monobook/main.css?9"; /*]]>*/</style>
10
+ <link rel="stylesheet" type="text/css" media="print" href="/skins/common/commonPrint.css" />
11
+ <!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css";</style><![endif]-->
12
+ <!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css";</style><![endif]-->
13
+ <!--[if IE 6]><style type="text/css">@import "/skins/monobook/IE60Fixes.css";</style><![endif]-->
14
+ <!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?1";</style><![endif]-->
15
+ <!--[if lt IE 7]><script type="text/javascript" src="/skins/common/IEFixes.js"></script>
16
+ <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
17
+
18
+ <script type= "text/javascript">
19
+ var skin = "monobook";
20
+ var stylepath = "/skins";
21
+
22
+ var wgArticlePath = "/index.php/$1";
23
+ var wgScriptPath = "";
24
+ var wgServer = "http://wiki.moxiecode.com";
25
+
26
+ var wgCanonicalNamespace = "TinyMCE";
27
+ var wgNamespaceNumber = 100;
28
+ var wgPageName = "TinyMCE:Configuration";
29
+ var wgTitle = "Configuration";
30
+ var wgArticleId = 1515;
31
+ var wgIsArticle = true;
32
+
33
+ var wgUserName = null;
34
+ var wgUserLanguage = "en";
35
+ var wgContentLanguage = "en";
36
+ </script>
37
+
38
+ <script type="text/javascript" src="/skins/common/wikibits.js?1"><!-- wikibits js --></script>
39
+ <script type="text/javascript" src="/index.php?title=-&amp;action=raw&amp;gen=js"><!-- site js --></script>
40
+ <style type="text/css">/*<![CDATA[*/
41
+ @import "/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000";
42
+ @import "/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000";
43
+ @import "/index.php?title=-&action=raw&gen=css&maxage=18000";
44
+ /*]]>*/</style>
45
+ <!-- Head Scripts -->
46
+ </head>
47
+ <body class="mediawiki ns-100 ltr">
48
+ <div id="globalWrapper">
49
+ <div id="column-content">
50
+ <div id="content">
51
+ <a name="top" id="top"></a>
52
+ <h1 class="firstHeading">TinyMCE:Configuration</h1>
53
+ <div id="bodyContent">
54
+ <h3 id="siteSub">From Moxiecode Documentation Wiki</h3>
55
+ <div id="contentSub"></div>
56
+ <div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div> <!-- start content -->
57
+ <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
58
+ <ul>
59
+ <li class="toclevel-1"><a href="#Configuration_reference"><span class="tocnumber">1</span> <span class="toctext">Configuration reference</span></a>
60
+ <ul>
61
+ <li class="toclevel-2"><a href="#Configuration_options"><span class="tocnumber">1.1</span> <span class="toctext">Configuration options</span></a>
62
+ <ul>
63
+ <li class="toclevel-3"><a href="#General"><span class="tocnumber">1.1.1</span> <span class="toctext">General</span></a></li>
64
+ <li class="toclevel-3"><a href="#Callbacks"><span class="tocnumber">1.1.2</span> <span class="toctext">Callbacks</span></a></li>
65
+ <li class="toclevel-3"><a href="#Cleanup.2FOutput"><span class="tocnumber">1.1.3</span> <span class="toctext">Cleanup/Output</span></a></li>
66
+ <li class="toclevel-3"><a href="#URL"><span class="tocnumber">1.1.4</span> <span class="toctext">URL</span></a></li>
67
+ <li class="toclevel-3"><a href="#Layout"><span class="tocnumber">1.1.5</span> <span class="toctext">Layout</span></a></li>
68
+ <li class="toclevel-3"><a href="#Visual_aids"><span class="tocnumber">1.1.6</span> <span class="toctext">Visual aids</span></a></li>
69
+ <li class="toclevel-3"><a href="#Undo.2FRedo"><span class="tocnumber">1.1.7</span> <span class="toctext">Undo/Redo</span></a></li>
70
+ <li class="toclevel-3"><a href="#File_lists"><span class="tocnumber">1.1.8</span> <span class="toctext">File lists</span></a></li>
71
+ <li class="toclevel-3"><a href="#Tab_specific"><span class="tocnumber">1.1.9</span> <span class="toctext">Tab specific</span></a></li>
72
+ <li class="toclevel-3"><a href="#Triggers.2FPatches"><span class="tocnumber">1.1.10</span> <span class="toctext">Triggers/Patches</span></a></li>
73
+ <li class="toclevel-3"><a href="#Advanced_theme"><span class="tocnumber">1.1.11</span> <span class="toctext">Advanced theme</span></a></li>
74
+ </ul>
75
+ </li>
76
+ </ul>
77
+ </li>
78
+ <li class="toclevel-1"><a href="#Initialization_of_TinyMCE"><span class="tocnumber">2</span> <span class="toctext">Initialization of TinyMCE</span></a>
79
+ <ul>
80
+ <li class="toclevel-2"><a href="#Example_of_TinyMCE_configuration"><span class="tocnumber">2.1</span> <span class="toctext">Example of TinyMCE configuration</span></a></li>
81
+ </ul>
82
+ </li>
83
+ </ul>
84
+ </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
85
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=1" title="Edit section: Configuration reference">edit</a>]</div><a name="Configuration_reference"></a><h2> Configuration reference </h2>
86
+ <p>This document is the index/reference page for all available core configuration options in TinyMCE.
87
+ </p>
88
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=2" title="Edit section: Configuration options">edit</a>]</div><a name="Configuration_options"></a><h3> Configuration options </h3>
89
+ <p>All configuration options below are to be placed within the tinyMCE.init() JavaScript call.
90
+ </p>
91
+ <div style="float: left; width: 260px; padding: 5px;">
92
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=3" title="Edit section: General">edit</a>]</div><a name="General"></a><h4> General </h4>
93
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/accessibility_focus" title="TinyMCE:Configuration/accessibility focus">accessibility_focus</a>
94
+ </li><li> <a href="/index.php/TinyMCE:Configuration/accessibility_warnings" title="TinyMCE:Configuration/accessibility warnings">accessibility_warnings</a>
95
+ </li><li> <a href="/index.php/TinyMCE:Configuration/ask" title="TinyMCE:Configuration/ask">ask</a>
96
+ </li><li> <a href="/index.php/TinyMCE:Configuration/auto_focus" title="TinyMCE:Configuration/auto focus">auto_focus</a>
97
+ </li><li> <a href="/index.php/TinyMCE:Configuration/auto_reset_designmode" title="TinyMCE:Configuration/auto reset designmode">auto_reset_designmode</a>
98
+ </li><li> <a href="/index.php/TinyMCE:Configuration/auto_resize" title="TinyMCE:Configuration/auto resize">auto_resize</a>
99
+ </li><li> <a href="/index.php/TinyMCE:Configuration/browsers" title="TinyMCE:Configuration/browsers">browsers</a>
100
+ </li><li> <a href="/index.php/TinyMCE:Configuration/button_tile_map" title="TinyMCE:Configuration/button tile map">button_tile_map</a>
101
+ </li><li> <a href="/index.php/TinyMCE:Configuration/custom_shortcuts" title="TinyMCE:Configuration/custom shortcuts">custom_shortcuts</a>
102
+ </li><li> <a href="/index.php/TinyMCE:Configuration/debug" title="TinyMCE:Configuration/debug">debug</a>
103
+ </li><li> <a href="/index.php/TinyMCE:Configuration/default_document" title="TinyMCE:Configuration/default document">default_document</a>
104
+ </li><li> <a href="/index.php/TinyMCE:Configuration/dialog_type" title="TinyMCE:Configuration/dialog type">dialog_type</a>
105
+ </li><li> <a href="/index.php/TinyMCE:Configuration/directionality" title="TinyMCE:Configuration/directionality">directionality</a>
106
+ </li><li> <a href="/index.php/TinyMCE:Configuration/docs_language" title="TinyMCE:Configuration/docs language">docs_language</a>
107
+ </li><li> <a href="/index.php/TinyMCE:Configuration/editor_deselector" title="TinyMCE:Configuration/editor deselector">editor_deselector</a>
108
+ </li><li> <a href="/index.php/TinyMCE:Configuration/editor_selector" title="TinyMCE:Configuration/editor selector">editor_selector</a>
109
+ </li><li> <a href="/index.php/TinyMCE:Configuration/elements" title="TinyMCE:Configuration/elements">elements</a>
110
+ </li><li> <a href="/index.php/TinyMCE:Configuration/event_elements" title="TinyMCE:Configuration/event elements">event_elements</a>
111
+ </li><li> <a href="/index.php/TinyMCE:Configuration/focus_alert" title="TinyMCE:Configuration/focus alert">focus_alert</a>
112
+ </li><li> <a href="/index.php/TinyMCE:Configuration/gecko_spellcheck" title="TinyMCE:Configuration/gecko spellcheck">gecko_spellcheck</a>
113
+ </li><li> <a href="/index.php/TinyMCE:Configuration/hide_selects_on_submit" title="TinyMCE:Configuration/hide selects on submit">hide_selects_on_submit</a>
114
+ </li><li> <a href="/index.php/TinyMCE:Configuration/language" title="TinyMCE:Configuration/language">language</a>
115
+ </li><li> <a href="/index.php/TinyMCE:Configuration/mode" title="TinyMCE:Configuration/mode">mode</a>
116
+ </li><li> <a href="/index.php/TinyMCE:Configuration/nowrap" title="TinyMCE:Configuration/nowrap">nowrap</a>
117
+ </li><li> <a href="/index.php/TinyMCE:Configuration/object_resizing" title="TinyMCE:Configuration/object resizing">object_resizing</a>
118
+ </li><li> <a href="/index.php/TinyMCE:Configuration/plugins" title="TinyMCE:Configuration/plugins">plugins</a>
119
+ </li><li> <a href="/index.php/TinyMCE:Configuration/strict_loading_mode" title="TinyMCE:Configuration/strict loading mode">strict_loading_mode</a>
120
+ </li><li> <a href="/index.php/TinyMCE:Configuration/table_inline_editing" title="TinyMCE:Configuration/table inline editing">table_inline_editing</a>
121
+ </li><li> <a href="/index.php/TinyMCE:Configuration/textarea_trigger" title="TinyMCE:Configuration/textarea trigger">textarea_trigger</a>
122
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme" title="TinyMCE:Configuration/theme">theme</a>
123
+ </li></ul>
124
+ <p><br />
125
+ </p>
126
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=4" title="Edit section: Callbacks">edit</a>]</div><a name="Callbacks"></a><h4>Callbacks</h4>
127
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/cleanup_callback" title="TinyMCE:Configuration/cleanup callback">cleanup_callback</a>
128
+ </li><li> <a href="/index.php/TinyMCE:Configuration/execcommand_callback" title="TinyMCE:Configuration/execcommand callback">execcommand_callback</a>
129
+ </li><li> <a href="/index.php/TinyMCE:Configuration/file_browser_callback" title="TinyMCE:Configuration/file browser callback">file_browser_callback</a>
130
+ </li><li> <a href="/index.php/TinyMCE:Configuration/handle_event_callback" title="TinyMCE:Configuration/handle event callback">handle_event_callback</a>
131
+ </li><li> <a href="/index.php/TinyMCE:Configuration/handle_node_change_callback" title="TinyMCE:Configuration/handle node change callback">handle_node_change_callback</a>
132
+ </li><li> <a href="/index.php/TinyMCE:Configuration/init_instance_callback" title="TinyMCE:Configuration/init instance callback">init_instance_callback</a>
133
+ </li><li> <a href="/index.php/TinyMCE:Configuration/onchange_callback" title="TinyMCE:Configuration/onchange callback">onchange_callback</a>
134
+ </li><li> <a href="/index.php/TinyMCE:Configuration/oninit" title="TinyMCE:Configuration/oninit">oninit</a>
135
+ </li><li> <a href="/index.php/TinyMCE:Configuration/onpageload" title="TinyMCE:Configuration/onpageload">onpageload</a>
136
+ </li><li> <a href="/index.php/TinyMCE:Configuration/remove_instance_callback" title="TinyMCE:Configuration/remove instance callback">remove_instance_callback</a>
137
+ </li><li> <a href="/index.php/TinyMCE:Configuration/save_callback" title="TinyMCE:Configuration/save callback">save_callback</a>
138
+ </li><li> <a href="/index.php/TinyMCE:Configuration/setupcontent_callback" title="TinyMCE:Configuration/setupcontent callback">setupcontent_callback</a>
139
+ </li><li> <a href="/index.php/TinyMCE:Configuration/urlconverter_callback" title="TinyMCE:Configuration/urlconverter callback">urlconverter_callback</a>
140
+ </li></ul>
141
+ <p><br />
142
+ </p>
143
+ </div>
144
+ <div style="float: left; width: 260px; padding: 5px;">
145
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=5" title="Edit section: Cleanup/Output">edit</a>]</div><a name="Cleanup.2FOutput"></a><h4>Cleanup/Output</h4>
146
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/apply_source_formatting" title="TinyMCE:Configuration/apply source formatting">apply_source_formatting</a>
147
+ </li><li> <a href="/index.php/TinyMCE:Configuration/cleanup" title="TinyMCE:Configuration/cleanup">cleanup</a>
148
+ </li><li> <a href="/index.php/TinyMCE:Configuration/cleanup_on_startup" title="TinyMCE:Configuration/cleanup on startup">cleanup_on_startup</a>
149
+ </li><li> <a href="/index.php/TinyMCE:Configuration/cleanup_serializer" title="TinyMCE:Configuration/cleanup serializer">cleanup_serializer</a>
150
+ </li><li> <a href="/index.php/TinyMCE:Configuration/convert_fonts_to_spans" title="TinyMCE:Configuration/convert fonts to spans">convert_fonts_to_spans</a>
151
+ </li><li> <a href="/index.php/TinyMCE:Configuration/convert_newlines_to_brs" title="TinyMCE:Configuration/convert newlines to brs">convert_newlines_to_brs</a>
152
+ </li><li> <a href="/index.php/TinyMCE:Configuration/doctype" title="TinyMCE:Configuration/doctype">doctype</a>
153
+ </li><li> <a href="/index.php/TinyMCE:Configuration/encoding" title="TinyMCE:Configuration/encoding">encoding</a>
154
+ </li><li> <a href="/index.php/TinyMCE:Configuration/entities" title="TinyMCE:Configuration/entities">entities</a>
155
+ </li><li> <a href="/index.php/TinyMCE:Configuration/entity_encoding" title="TinyMCE:Configuration/entity encoding">entity_encoding</a>
156
+ </li><li> <a href="/index.php/TinyMCE:Configuration/extended_valid_elements" title="TinyMCE:Configuration/extended valid elements">extended_valid_elements</a>
157
+ </li><li> <a href="/index.php/TinyMCE:Configuration/fix_content_duplication" title="TinyMCE:Configuration/fix content duplication">fix_content_duplication</a>
158
+ </li><li> <a href="/index.php/TinyMCE:Configuration/fix_list_elements" title="TinyMCE:Configuration/fix list elements">fix_list_elements</a>
159
+ </li><li> <a href="/index.php/TinyMCE:Configuration/fix_table_elements" title="TinyMCE:Configuration/fix table elements">fix_table_elements</a>
160
+ </li><li> <a href="/index.php/TinyMCE:Configuration/font_size_classes" title="TinyMCE:Configuration/font size classes">font_size_classes</a>
161
+ </li><li> <a href="/index.php/TinyMCE:Configuration/font_size_style_values" title="TinyMCE:Configuration/font size style values">font_size_style_values</a>
162
+ </li><li> <a href="/index.php/TinyMCE:Configuration/force_p_newlines" title="TinyMCE:Configuration/force p newlines">force_p_newlines</a>
163
+ </li><li> <a href="/index.php/TinyMCE:Configuration/force_br_newlines" title="TinyMCE:Configuration/force br newlines">force_br_newlines</a>
164
+ </li><li> <a href="/index.php/TinyMCE:Configuration/force_hex_style_colors" title="TinyMCE:Configuration/force hex style colors">force_hex_style_colors</a>
165
+ </li><li> <a href="/index.php/TinyMCE:Configuration/forced_root_block" title="TinyMCE:Configuration/forced root block">forced_root_block</a>
166
+ </li><li> <a href="/index.php/TinyMCE:Configuration/inline_styles" title="TinyMCE:Configuration/inline styles">inline_styles</a>
167
+ </li><li> <a href="/index.php/TinyMCE:Configuration/invalid_elements" title="TinyMCE:Configuration/invalid elements">invalid_elements</a>
168
+ </li><li> <a href="/index.php/TinyMCE:Configuration/merge_styles_invalid_parents" title="TinyMCE:Configuration/merge styles invalid parents">merge_styles_invalid_parents</a>
169
+ </li><li> <a href="/index.php/TinyMCE:Configuration/remove_linebreaks" title="TinyMCE:Configuration/remove linebreaks">remove_linebreaks</a>
170
+ </li><li> <a href="/index.php/TinyMCE:Configuration/remove_trailing_nbsp" title="TinyMCE:Configuration/remove trailing nbsp">remove_trailing_nbsp</a>
171
+ </li><li> <a href="/index.php/TinyMCE:Configuration/preformatted" title="TinyMCE:Configuration/preformatted">preformatted</a>
172
+ </li><li> <a href="/index.php/TinyMCE:Configuration/trim_span_elements" title="TinyMCE:Configuration/trim span elements">trim_span_elements</a>
173
+ </li><li> <a href="/index.php/TinyMCE:Configuration/valid_child_elements" title="TinyMCE:Configuration/valid child elements">valid_child_elements</a>
174
+ </li><li> <a href="/index.php/TinyMCE:Configuration/valid_elements" title="TinyMCE:Configuration/valid elements">valid_elements</a>
175
+ </li><li> <a href="/index.php/TinyMCE:Configuration/verify_css_classes" title="TinyMCE:Configuration/verify css classes">verify_css_classes</a>
176
+ </li><li> <a href="/index.php/TinyMCE:Configuration/verify_html" title="TinyMCE:Configuration/verify html">verify_html</a>
177
+ </li></ul>
178
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=6" title="Edit section: URL">edit</a>]</div><a name="URL"></a><h4>URL</h4>
179
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/convert_urls" title="TinyMCE:Configuration/convert urls">convert_urls</a>
180
+ </li><li> <a href="/index.php/TinyMCE:Configuration/relative_urls" title="TinyMCE:Configuration/relative urls">relative_urls</a>
181
+ </li><li> <a href="/index.php/TinyMCE:Configuration/remove_script_host" title="TinyMCE:Configuration/remove script host">remove_script_host</a>
182
+ </li><li> <a href="/index.php/TinyMCE:Configuration/document_base_url" title="TinyMCE:Configuration/document base url">document_base_url</a>
183
+ </li></ul>
184
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=7" title="Edit section: Layout">edit</a>]</div><a name="Layout"></a><h4>Layout</h4>
185
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/content_css" title="TinyMCE:Configuration/content css">content_css</a>
186
+ </li><li> <a href="/index.php/TinyMCE:Configuration/popups_css" title="TinyMCE:Configuration/popups css">popups_css</a>
187
+ </li><li> <a href="/index.php/TinyMCE:Configuration/popups_css_add" title="TinyMCE:Configuration/popups css add">popups_css_add</a>
188
+ </li><li> <a href="/index.php/TinyMCE:Configuration/editor_css" title="TinyMCE:Configuration/editor css">editor_css</a>
189
+ </li><li> <a href="/index.php/TinyMCE:Configuration/width" title="TinyMCE:Configuration/width">width</a>
190
+ </li><li> <a href="/index.php/TinyMCE:Configuration/height" title="TinyMCE:Configuration/height">height</a>
191
+ </li></ul>
192
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=8" title="Edit section: Visual aids">edit</a>]</div><a name="Visual_aids"></a><h4>Visual aids</h4>
193
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/visual" title="TinyMCE:Configuration/visual">visual</a>
194
+ </li><li> <a href="/index.php/TinyMCE:Configuration/visual_table_class" title="TinyMCE:Configuration/visual table class">visual_table_class</a>
195
+ </li></ul>
196
+ </div>
197
+ <div style="float: left; width: 260px; padding: 5px;">
198
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=9" title="Edit section: Undo/Redo">edit</a>]</div><a name="Undo.2FRedo"></a><h4>Undo/Redo</h4>
199
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/custom_undo_redo" title="TinyMCE:Configuration/custom undo redo">custom_undo_redo</a>
200
+ </li><li> <a href="/index.php/TinyMCE:Configuration/custom_undo_redo_levels" title="TinyMCE:Configuration/custom undo redo levels">custom_undo_redo_levels</a>
201
+ </li><li> <a href="/index.php/TinyMCE:Configuration/custom_undo_redo_keyboard_shortcuts" title="TinyMCE:Configuration/custom undo redo keyboard shortcuts">custom_undo_redo_keyboard_shortcuts</a>
202
+ </li><li> <a href="/index.php/TinyMCE:Configuration/custom_undo_redo_restore_selection" title="TinyMCE:Configuration/custom undo redo restore selection">custom_undo_redo_restore_selection</a>
203
+ </li></ul>
204
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=10" title="Edit section: File lists">edit</a>]</div><a name="File_lists"></a><h4>File lists</h4>
205
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/external_link_list_url" title="TinyMCE:Configuration/external link list url">external_link_list_url</a>
206
+ </li><li> <a href="/index.php/TinyMCE:Configuration/external_image_list_url" title="TinyMCE:Configuration/external image list url">external_image_list_url</a>
207
+ </li></ul>
208
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=11" title="Edit section: Tab specific">edit</a>]</div><a name="Tab_specific"></a><h4>Tab specific</h4>
209
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/display_tab_class" title="TinyMCE:Configuration/display tab class">display_tab_class</a>
210
+ </li><li> <a href="/index.php/TinyMCE:Configuration/hidden_tab_class" title="TinyMCE:Configuration/hidden tab class">hidden_tab_class</a>
211
+ </li></ul>
212
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=12" title="Edit section: Triggers/Patches">edit</a>]</div><a name="Triggers.2FPatches"></a><h4>Triggers/Patches</h4>
213
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/add_form_submit_trigger" title="TinyMCE:Configuration/add form submit trigger">add_form_submit_trigger</a>
214
+ </li><li> <a href="/index.php/TinyMCE:Configuration/add_unload_trigger" title="TinyMCE:Configuration/add unload trigger">add_unload_trigger</a>
215
+ </li><li> <a href="/index.php/TinyMCE:Configuration/submit_patch" title="TinyMCE:Configuration/submit patch">submit_patch</a>
216
+ </li></ul>
217
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=13" title="Edit section: Advanced theme">edit</a>]</div><a name="Advanced_theme"></a><h4>Advanced theme</h4>
218
+ <ul><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_layout_manager" title="TinyMCE:Configuration/theme advanced layout manager">theme_advanced_layout_manager</a>
219
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_blockformats" title="TinyMCE:Configuration/theme advanced blockformats">theme_advanced_blockformats</a>
220
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_styles" title="TinyMCE:Configuration/theme advanced styles">theme_advanced_styles</a>
221
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_source_editor_width" title="TinyMCE:Configuration/theme advanced source editor width">theme_advanced_source_editor_width</a>
222
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_source_editor_height" title="TinyMCE:Configuration/theme advanced source editor height">theme_advanced_source_editor_height</a>
223
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_source_editor_wrap" title="TinyMCE:Configuration/theme advanced source editor wrap">theme_advanced_source_editor_wrap</a>
224
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_toolbar_location" title="TinyMCE:Configuration/theme advanced toolbar location">theme_advanced_toolbar_location</a>
225
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_toolbar_align" title="TinyMCE:Configuration/theme advanced toolbar align">theme_advanced_toolbar_align</a>
226
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_statusbar_location" title="TinyMCE:Configuration/theme advanced statusbar location">theme_advanced_statusbar_location</a>
227
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_buttons_1_n" title="TinyMCE:Configuration/theme advanced buttons 1 n">theme_advanced_buttons&lt;1-n&gt;</a>
228
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_buttons_1_n_add" title="TinyMCE:Configuration/theme advanced buttons 1 n add">theme_advanced_buttons&lt;1-n&gt;_add</a>
229
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_buttons_1_n_add_before" title="TinyMCE:Configuration/theme advanced buttons 1 n add before">theme_advanced_buttons&lt;1-n&gt;_add_before</a>
230
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_disable" title="TinyMCE:Configuration/theme advanced disable">theme_advanced_disable</a>
231
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_containers" title="TinyMCE:Configuration/theme advanced containers">theme_advanced_containers</a>
232
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_containers_default_class" title="TinyMCE:Configuration/theme advanced containers default class">theme_advanced_containers_default_class</a>
233
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_containers_default_align" title="TinyMCE:Configuration/theme advanced containers default align">theme_advanced_containers_default_align</a>
234
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_container_container" title="TinyMCE:Configuration/theme advanced container container">theme_advanced_container_&lt;container&gt;</a>
235
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_container_container_class" title="TinyMCE:Configuration/theme advanced container container class">theme_advanced_container_&lt;container&gt;_class</a>
236
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_container_container_align" title="TinyMCE:Configuration/theme advanced container container align">theme_advanced_container_&lt;container&gt;_align</a>
237
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_custom_layout" title="TinyMCE:Configuration/theme advanced custom layout">theme_advanced_custom_layout</a>
238
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_link_targets" title="TinyMCE:Configuration/theme advanced link targets">theme_advanced_link_targets</a>
239
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_resizing" title="TinyMCE:Configuration/theme advanced resizing">theme_advanced_resizing</a>
240
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_resizing_use_cookie" title="TinyMCE:Configuration/theme advanced resizing use cookie">theme_advanced_resizing_use_cookie</a>
241
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_resize_horizontal" title="TinyMCE:Configuration/theme advanced resize horizontal">theme_advanced_resize_horizontal</a>
242
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_path" title="TinyMCE:Configuration/theme advanced path">theme_advanced_path</a>
243
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_fonts" title="TinyMCE:Configuration/theme advanced fonts">theme_advanced_fonts</a>
244
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_text_colors" title="TinyMCE:Configuration/theme advanced text colors">theme_advanced_text_colors</a>
245
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_background_colors" title="TinyMCE:Configuration/theme advanced background colors">theme_advanced_background_colors</a>
246
+ </li><li> <a href="/index.php/TinyMCE:Configuration/theme_advanced_more_colors" title="TinyMCE:Configuration/theme advanced more colors">theme_advanced_more_colors</a>
247
+ </li></ul>
248
+ </div>
249
+ <div style="clear: both;">&nbsp;</div>
250
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=14" title="Edit section: Initialization of TinyMCE">edit</a>]</div><a name="Initialization_of_TinyMCE"></a><h2>Initialization of TinyMCE</h2>
251
+ <p>In order to initialize the TinyMCE the following code must be placed within HEAD element of a document. The following example is configured to convert all TEXTAREA elements into editors when the page loads. There are other <a href="/index.php/TinyMCE:Configuration/mode" title="TinyMCE:Configuration/mode">modes</a> as well.
252
+ </p>
253
+ <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=TinyMCE:Configuration&amp;action=edit&amp;section=15" title="Edit section: Example of TinyMCE configuration">edit</a>]</div><a name="Example_of_TinyMCE_configuration"></a><h4>Example of TinyMCE configuration</h4>
254
+ <pre>
255
+ &lt;html&gt;
256
+ &lt;head&gt;
257
+ &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;../jscripts/tiny_mce/tiny_mce.js&quot;&gt;&lt;/script&gt;
258
+ &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
259
+ tinyMCE.init({
260
+ theme&nbsp;: &quot;advanced&quot;,
261
+ mode&nbsp;: &quot;textareas&quot;
262
+ });
263
+ &lt;/script&gt;
264
+ &lt;/head&gt;
265
+ </pre>
266
+ <p>Note: Remember to remove the last "," character in the options list.
267
+ </p>
268
+ <!-- Saved in parser cache with key docwiki:pcache:idhash:1515-0!1!0!!en!2 and timestamp 20070819194128 -->
269
+ <div class="printfooter">
270
+ Retrieved from "<a href="http://wiki.moxiecode.com/index.php/TinyMCE:Configuration">http://wiki.moxiecode.com/index.php/TinyMCE:Configuration</a>"</div>
271
+ <!-- end content -->
272
+ <div class="visualClear"></div>
273
+ </div>
274
+ </div>
275
+ </div>
276
+ <div id="column-one">
277
+ <div id="p-cactions" class="portlet">
278
+ <h5>Views</h5>
279
+ <ul>
280
+ <li id="ca-nstab-tinymce" class="selected"><a href="/index.php/TinyMCE:Configuration">TinyMCE</a></li>
281
+ <li id="ca-talk" class="new"><a href="/index.php?title=TinyMCE_Talk:Configuration&amp;action=edit">Discussion</a></li>
282
+ <li id="ca-edit"><a href="/index.php?title=TinyMCE:Configuration&amp;action=edit">Edit</a></li>
283
+ <li id="ca-history"><a href="/index.php?title=TinyMCE:Configuration&amp;action=history">History</a></li>
284
+ </ul>
285
+ </div>
286
+ <div class="portlet" id="p-personal">
287
+ <h5>Personal tools</h5>
288
+ <div class="pBody">
289
+ <ul>
290
+ <li id="pt-login"><a href="/index.php?title=Special:Userlogin&amp;returnto=TinyMCE:Configuration">Log in / create account</a></li>
291
+ </ul>
292
+ </div>
293
+ </div>
294
+ <div class="portlet" id="p-logo">
295
+ <a style="background-image: url(/images/logo.gif);" href="/index.php/Main_Page" title="Main Page"></a>
296
+ </div>
297
+ <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
298
+ <div class='portlet' id='p-Documentation'>
299
+ <h5>Documentation</h5>
300
+ <div class='pBody'>
301
+ <ul>
302
+ <li id="n-TinyMCE"><a href="/index.php/TinyMCE:Index">TinyMCE</a></li>
303
+ <li id="n-TinyMCE-FAQ"><a href="/index.php/TinyMCE:FAQ">TinyMCE FAQ</a></li>
304
+ <li id="n-TinyMCE-Compressor"><a href="/index.php/TinyMCE:Compressor">TinyMCE Compressor</a></li>
305
+ <li id="n-TinyMCE-Spellchecker"><a href="/index.php/TinyMCE:Plugins/spellchecker">TinyMCE Spellchecker</a></li>
306
+ <li id="n-MCImageManager"><a href="/index.php/MCImageManager:Index">MCImageManager</a></li>
307
+ <li id="n-MCFileManager"><a href="/index.php/MCFileManager:Index">MCFileManager</a></li>
308
+ <li id="n-recentchanges"><a href="/index.php/Special:Recentchanges">Recent changes</a></li>
309
+ </ul>
310
+ </div>
311
+ </div>
312
+ <div id="p-search" class="portlet">
313
+ <h5><label for="searchInput">Search</label></h5>
314
+ <div id="searchBody" class="pBody">
315
+ <form action="/index.php/Special:Search" id="searchform"><div>
316
+ <input id="searchInput" name="search" type="text" accesskey="f" value="" />
317
+ <input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go" />&nbsp;
318
+ <input type='submit' name="fulltext" class="searchButton" value="Search" />
319
+ </div></form>
320
+ </div>
321
+ </div>
322
+ <div class="portlet" id="p-tb">
323
+ <h5>Toolbox</h5>
324
+ <div class="pBody">
325
+ <ul>
326
+ <li id="t-whatlinkshere"><a href="/index.php?title=Special:Whatlinkshere&amp;target=TinyMCE%3AConfiguration">What links here</a></li>
327
+ <li id="t-recentchangeslinked"><a href="/index.php?title=Special:Recentchangeslinked&amp;target=TinyMCE%3AConfiguration">Related changes</a></li>
328
+ <li id="t-specialpages"><a href="/index.php/Special:Specialpages">Special pages</a></li>
329
+ <li id="t-print"><a href="/index.php?title=TinyMCE:Configuration&amp;printable=yes">Printable version</a></li> <li id="t-permalink"><a href="/index.php?title=TinyMCE:Configuration&amp;oldid=2888">Permanent link</a></li> </ul>
330
+ </div>
331
+ </div>
332
+ <div class="portlet" id="p-ex">
333
+ <h5>External links</h5>
334
+ <div class="pBody">
335
+ <ul>
336
+ <li><a href="http://tinymce.moxiecode.com">TinyMCE Website</a></li>
337
+ <li><a href="http://tinymce.moxiecode.com/forum">TinyMCE Forum</a></li>
338
+ <li><a href="http://www.moxiecode.com">Moxiecode Website</a></li>
339
+ <li><a href="http://www.w3schools.com/">W3Schools Website</a></li>
340
+ <li><a href="http://www.fiddlertool.com/fiddler/">Fiddler Tool</a></li>
341
+ <li><a href="http://sourceforge.net/tracker/?atid=635682&group_id=103281&func=browse">Report a bug</a></li>
342
+ </ul>
343
+ </div>
344
+ </div>
345
+ </div><!-- end of the left (by default at least) column -->
346
+ <div class="visualClear"></div>
347
+ <div id="footer">
348
+ <div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="/skins/common/images/poweredby_mediawiki_88x31.png" alt="MediaWiki" /></a></div>
349
+ <ul id="f-list">
350
+ <li id="lastmod"> This page was last modified 15:32, 17 May 2007.</li>
351
+ <li id="viewcount">This page has been accessed 194,097 times.</li>
352
+ <li id="privacy"><a href="/index.php/Moxiecode_Documentation_Wiki:Privacy_policy" title="Moxiecode Documentation Wiki:Privacy policy">Privacy policy</a></li>
353
+ <li id="about"><a href="/index.php/Moxiecode_Documentation_Wiki:About" title="Moxiecode Documentation Wiki:About">About Moxiecode Documentation Wiki</a></li>
354
+ <li id="disclaimer"><a href="/index.php/Moxiecode_Documentation_Wiki:General_disclaimer" title="Moxiecode Documentation Wiki:General disclaimer">Disclaimers</a></li>
355
+ </ul>
356
+ </div>
357
+
358
+
359
+ <script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script>
360
+ </div>
361
+ <!-- Served by monster in 0.148 secs. --></body></html>
@@ -0,0 +1,18 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require 'action_controller'
4
+ require 'action_controller/test_process'
5
+ require 'action_view'
6
+
7
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/app_root"
8
+ EXPANDED_RAILS_ROOT = File.expand_path(RAILS_ROOT)
9
+
10
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
11
+ require File.dirname(__FILE__) + '/../init'
12
+
13
+ class Test::Unit::TestCase #:nodoc:
14
+ private
15
+ def assert_html_equal(expected, actual)
16
+ assert_equal expected.strip.gsub(/\n\s*/, ''), actual.strip.gsub(/\n\s*/, '')
17
+ end
18
+ end
@@ -0,0 +1,323 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ # Don't go out to the Internet if we're not live
4
+ unless ENV['LIVE']
5
+ class << PluginAWeek::Helpers::TinyMCEHelper
6
+ # Use pages ewe've already downloaded for Sourceforge and Wiki information
7
+ def open(name, *rest, &block)
8
+ if name.include?('sourceforge')
9
+ name = 'test/files/sourceforge.html'
10
+ elsif name.include?('wiki')
11
+ name = 'test/files/wiki.html'
12
+ end
13
+
14
+ super
15
+ end
16
+
17
+ # User files we've already downloaded for extracting the TinyMCE soure
18
+ def system(cmd, *args)
19
+ if cmd =~ /^wget .+2_0_8/
20
+ FileUtils.cp("#{EXPANDED_RAILS_ROOT}/../../test/files/tinymce_2_0_8.tgz", '/tmp/')
21
+ elsif cmd =~ /^wget .+2_1_1_1/
22
+ FileUtils.cp("#{EXPANDED_RAILS_ROOT}/../../test/files/tinymce_2_1_1_1.tgz", '/tmp/')
23
+ else
24
+ super
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ # Simulate user input
31
+ class << STDIN
32
+ attr_accessor :prompted
33
+
34
+ def gets
35
+ @prompted = true
36
+ "#{@gets.is_a?(Array) ? @gets.shift : @gets}\n"
37
+ end
38
+
39
+ def gets=(value)
40
+ @gets = value
41
+ end
42
+ end
43
+
44
+ class TinyMceHelperTest < Test::Unit::TestCase
45
+ include ActionView::Helpers::TagHelper
46
+ include ActionView::Helpers::AssetTagHelper
47
+ include ActionView::Helpers::JavaScriptHelper
48
+ include PluginAWeek::Helpers::TinyMCEHelper
49
+
50
+ def setup
51
+ PluginAWeek::Helpers::TinyMCEHelper.verbose = true
52
+ @uses_tiny_mce = nil
53
+
54
+ # Set up config path
55
+ @config_root = "#{RAILS_ROOT}/config"
56
+ FileUtils.cp("#{RAILS_ROOT}/config_bak/tiny_mce_options.yml", @config_root)
57
+ @original_config_files = Dir["#{RAILS_ROOT}/config/**/*"].sort
58
+
59
+ # Set up public path
60
+ @public_root = "#{RAILS_ROOT}/public"
61
+ FileUtils.mkdir_p("#{RAILS_ROOT}/public/javascripts")
62
+
63
+ # Track valid options
64
+ @original_valid_options = PluginAWeek::Helpers::TinyMCEHelper.valid_options.dup
65
+
66
+ # Set default STDIN value
67
+ STDIN.gets = 'n'
68
+ STDIN.prompted = false
69
+
70
+ # Set up test request
71
+ @request = ActionController::TestRequest.new
72
+ @controller = ActionController::Base.new
73
+ @controller.request = @request
74
+ @controller.instance_eval {@_params = request.path_parameters}
75
+ @controller.send(:initialize_current_url)
76
+
77
+ # Make sure we always start in a test environment
78
+ Object.const_set('RAILS_ENV', 'test')
79
+ end
80
+
81
+ def test_valid_options_should_not_be_empty
82
+ assert PluginAWeek::Helpers::TinyMCEHelper.valid_options.any?
83
+ end
84
+
85
+ def test_install_should_save_latest_version_to_default_target
86
+ PluginAWeek::Helpers::TinyMCEHelper.install(:force => true)
87
+
88
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce")
89
+ assert File.open("#{RAILS_ROOT}/public/javascripts/tinymce/changelog").readlines.join.include?('Version 2.1.1.1')
90
+ end
91
+
92
+ def test_install_should_allow_custom_version
93
+ PluginAWeek::Helpers::TinyMCEHelper.install(:version => '2.0.8', :force => true)
94
+
95
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce")
96
+ assert File.open("#{RAILS_ROOT}/public/javascripts/tinymce/changelog").readlines.join.include?('Version 2.0.8')
97
+ end
98
+
99
+ def test_install_should_allow_custom_target
100
+ PluginAWeek::Helpers::TinyMCEHelper.install(:target => 'public/javascripts/tiny_mce', :force => true)
101
+
102
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tiny_mce")
103
+ end
104
+
105
+ def test_install_should_prompt_user_if_base_target_already_exists
106
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
107
+ PluginAWeek::Helpers::TinyMCEHelper.install
108
+
109
+ assert STDIN.prompted
110
+ end
111
+
112
+ def test_install_should_skip_if_target_exists_and_user_skips
113
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
114
+ STDIN.gets = 'n'
115
+ PluginAWeek::Helpers::TinyMCEHelper.install
116
+
117
+ assert !File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce/changelog")
118
+ end
119
+
120
+ def test_install_should_not_skip_if_target_exists_and_user_doesnt_skip
121
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
122
+ STDIN.gets = 'y'
123
+ PluginAWeek::Helpers::TinyMCEHelper.install
124
+
125
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce/changelog")
126
+ end
127
+
128
+ def test_install_should_continue_prompting_user_if_target_exists_and_invalid_option_is_typed
129
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
130
+ STDIN.gets = %w(k y)
131
+ PluginAWeek::Helpers::TinyMCEHelper.install
132
+
133
+ assert STDIN.gets.chomp.empty?
134
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce/changelog")
135
+ end
136
+
137
+ def test_install_should_overwrite_existing_folder_if_forced
138
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
139
+ PluginAWeek::Helpers::TinyMCEHelper.install(:force => true)
140
+
141
+ assert File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce/changelog")
142
+ end
143
+
144
+ def test_uninstall_should_remove_options_configuration
145
+ PluginAWeek::Helpers::TinyMCEHelper.uninstall
146
+ assert !File.exists?("#{RAILS_ROOT}/config/tiny_mce_options.yml")
147
+ end
148
+
149
+ def test_uninstall_should_remove_tinymce_source
150
+ FileUtils.mkdir("#{RAILS_ROOT}/public/javascripts/tinymce")
151
+ PluginAWeek::Helpers::TinyMCEHelper.uninstall
152
+
153
+ assert !File.exists?("#{RAILS_ROOT}/public/javascripts/tinymce")
154
+ end
155
+
156
+ def test_should_update_options_if_options_configuration_doesnt_exist
157
+ FileUtils.rm("#{RAILS_ROOT}/config/tiny_mce_options.yml")
158
+ PluginAWeek::Helpers::TinyMCEHelper.update_options
159
+
160
+ assert File.exists?("#{RAILS_ROOT}/config/tiny_mce_options.yml")
161
+ options = File.open(PluginAWeek::Helpers::TinyMCEHelper::OPTIONS_FILE_PATH) {|f| YAML.load(f.read)}
162
+ assert_instance_of Array, options
163
+ end
164
+
165
+ def test_should_update_options_if_options_configuration_exists
166
+ File.truncate("#{RAILS_ROOT}/config/tiny_mce_options.yml", 0)
167
+ PluginAWeek::Helpers::TinyMCEHelper.update_options
168
+
169
+ assert File.exists?("#{RAILS_ROOT}/config/tiny_mce_options.yml")
170
+ options = File.open(PluginAWeek::Helpers::TinyMCEHelper::OPTIONS_FILE_PATH) {|f| YAML.load(f.read)}
171
+ assert_instance_of Array, options
172
+ end
173
+
174
+ def test_should_be_using_tiny_mce_if_instance_variable_exists
175
+ @uses_tiny_mce = true
176
+ assert using_tiny_mce?
177
+ end
178
+
179
+ def test_should_not_be_using_tiny_mce_if_instance_variable_doesnt_exist
180
+ @uses_tiny_mce = false
181
+ assert !using_tiny_mce?
182
+ end
183
+
184
+ def test_should_use_source_file_name_if_in_development
185
+ Object.const_set('RAILS_ENV', 'development')
186
+ assert_equal 'tinymce/tiny_mce_src', tiny_mce_file_name
187
+ end
188
+
189
+ def test_should_use_compressed_file_name_if_in_test
190
+ Object.const_set('RAILS_ENV', 'test')
191
+ assert_equal 'tinymce/tiny_mce', tiny_mce_file_name
192
+ end
193
+
194
+ def test_should_use_compressed_file_name_if_in_production
195
+ Object.const_set('RAILS_ENV', 'production')
196
+ assert_equal 'tinymce/tiny_mce', tiny_mce_file_name
197
+ end
198
+
199
+ def test_should_use_environment_file_name_for_javascript_include_in_development
200
+ Object.const_set('RAILS_ENV', 'development')
201
+ assert_equal '<script src="/javascripts/tinymce/tiny_mce_src.js" type="text/javascript"></script>', javascript_include_tiny_mce
202
+ end
203
+
204
+ def test_should_use_environment_file_name_for_javascript_include_in_test
205
+ Object.const_set('RAILS_ENV', 'test')
206
+ assert_equal '<script src="/javascripts/tinymce/tiny_mce.js" type="text/javascript"></script>', javascript_include_tiny_mce
207
+ end
208
+
209
+ def test_should_include_conditional_javascript_if_using_tiny_mce
210
+ @uses_tiny_mce = true
211
+ assert_equal '<script src="/javascripts/tinymce/tiny_mce.js" type="text/javascript"></script>', javascript_include_tiny_mce_if_used
212
+ end
213
+
214
+ def test_should_not_include_conditional_javascript_if_not_using_tiny_mce
215
+ @uses_tiny_mce = false
216
+ assert_nil javascript_include_tiny_mce_if_used
217
+ end
218
+
219
+ def test_script_should_use_textareas_mode_and_simple_theme_by_default
220
+ expected = <<-end_eval
221
+ tinyMCE.init({
222
+ mode : 'textareas',
223
+ theme : 'simple'
224
+ });
225
+ end_eval
226
+ assert_html_equal expected, tiny_mce_init_script
227
+ end
228
+
229
+ def test_script_should_raise_exception_if_invalid_option_provided
230
+ assert_raise(ArgumentError) {tiny_mce_init_script(:invalid => true)}
231
+ end
232
+
233
+ def test_script_should_not_raise_exception_if_invalid_option_provided_but_valid_options_is_nil
234
+ PluginAWeek::Helpers::TinyMCEHelper.valid_options = nil
235
+ assert_nothing_raised {tiny_mce_init_script(:invalid => true)}
236
+ end
237
+
238
+ def test_script_should_not_raise_exception_if_invalid_option_provided_but_valid_options_is_empty
239
+ PluginAWeek::Helpers::TinyMCEHelper.valid_options = []
240
+ assert_nothing_raised {tiny_mce_init_script(:invalid => true)}
241
+ end
242
+
243
+ def test_script_should_not_raise_exception_for_dynamic_options
244
+ assert_nothing_raised {tiny_mce_init_script(:theme_advanced_buttons_1 => '', :theme_advanced_container_test => '')}
245
+ end
246
+
247
+ def test_script_should_convert_symbols
248
+ expected = <<-end_eval
249
+ tinyMCE.init({
250
+ mode : 'textareas',
251
+ theme : 'simple'
252
+ });
253
+ end_eval
254
+ assert_html_equal expected, tiny_mce_init_script(:mode => :textareas)
255
+ end
256
+
257
+ def test_script_should_convert_numbers
258
+ expected = <<-end_eval
259
+ tinyMCE.init({
260
+ mode : 'textareas',
261
+ theme : 'simple',
262
+ width : '640'
263
+ });
264
+ end_eval
265
+ assert_html_equal expected, tiny_mce_init_script(:width => 640)
266
+ end
267
+
268
+ def test_script_should_convert_arrays
269
+ expected = <<-end_eval
270
+ tinyMCE.init({
271
+ mode : 'textareas',
272
+ theme : 'simple',
273
+ valid_elements : 'b,p,br,i,u'
274
+ });
275
+ end_eval
276
+ assert_html_equal expected, tiny_mce_init_script(:valid_elements => %w(b p br i u))
277
+ end
278
+
279
+ def test_script_should_convert_boolean_true
280
+ expected = <<-end_eval
281
+ tinyMCE.init({
282
+ auto_reset_designmode : true,
283
+ mode : 'textareas',
284
+ theme : 'simple'
285
+ });
286
+ end_eval
287
+ assert_html_equal expected, tiny_mce_init_script(:auto_reset_designmode => true)
288
+ end
289
+
290
+ def test_script_should_convert_boolean_false
291
+ expected = <<-end_eval
292
+ tinyMCE.init({
293
+ auto_reset_designmode : false,
294
+ mode : 'textareas',
295
+ theme : 'simple'
296
+ });
297
+ end_eval
298
+ assert_html_equal expected, tiny_mce_init_script(:auto_reset_designmode => false)
299
+ end
300
+
301
+ def test_script_should_raise_exception_if_unknown_value_class_provided
302
+ assert_raise(ArgumentError) {tiny_mce_init_script(:mode => Hash.new)}
303
+ end
304
+
305
+ def test_tiny_mce_should_wrap_script_in_javascript_tag
306
+ expected = <<-end_eval
307
+ <script type="text/javascript">
308
+ //<![CDATA[
309
+ tinyMCE.init({
310
+ mode : 'textareas',
311
+ theme : 'simple'
312
+ });
313
+ //]]>
314
+ </script>
315
+ end_eval
316
+ assert_html_equal expected, tiny_mce
317
+ end
318
+
319
+ def teardown
320
+ FileUtils.rmtree(@public_root)
321
+ PluginAWeek::Helpers::TinyMCEHelper.valid_options = @original_valid_options
322
+ end
323
+ end