locomotive-tinymce-rails 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. data/LICENSE +18 -0
  2. data/README.md +67 -0
  3. data/Rakefile +65 -0
  4. data/app/assets/javascripts/tinymce/preinit.js.erb +5 -0
  5. data/app/assets/javascripts/tinymce-jquery.js +3 -0
  6. data/app/assets/javascripts/tinymce.js +2 -0
  7. data/lib/tinymce/rails/engine.rb +9 -0
  8. data/lib/tinymce/rails/sprockets_monkeypatch.rb +13 -0
  9. data/lib/tinymce/rails/version.rb +7 -0
  10. data/lib/tinymce/rails.rb +3 -0
  11. data/lib/tinymce-rails.rb +1 -0
  12. data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -0
  13. data/vendor/assets/javascripts/tinymce/langs/en.js +1 -0
  14. data/vendor/assets/javascripts/tinymce/license.txt +504 -0
  15. data/vendor/assets/javascripts/tinymce/plugins/advhr/css/advhr.css +5 -0
  16. data/vendor/assets/javascripts/tinymce/plugins/advhr/editor_plugin.js +1 -0
  17. data/vendor/assets/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +57 -0
  18. data/vendor/assets/javascripts/tinymce/plugins/advhr/js/rule.js +43 -0
  19. data/vendor/assets/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +1 -0
  20. data/vendor/assets/javascripts/tinymce/plugins/advhr/rule.htm +58 -0
  21. data/vendor/assets/javascripts/tinymce/plugins/advimage/css/advimage.css +13 -0
  22. data/vendor/assets/javascripts/tinymce/plugins/advimage/editor_plugin.js +1 -0
  23. data/vendor/assets/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +50 -0
  24. data/vendor/assets/javascripts/tinymce/plugins/advimage/image.htm +235 -0
  25. data/vendor/assets/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
  26. data/vendor/assets/javascripts/tinymce/plugins/advimage/js/image.js +462 -0
  27. data/vendor/assets/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +1 -0
  28. data/vendor/assets/javascripts/tinymce/plugins/advlink/css/advlink.css +8 -0
  29. data/vendor/assets/javascripts/tinymce/plugins/advlink/editor_plugin.js +1 -0
  30. data/vendor/assets/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +61 -0
  31. data/vendor/assets/javascripts/tinymce/plugins/advlink/js/advlink.js +532 -0
  32. data/vendor/assets/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +1 -0
  33. data/vendor/assets/javascripts/tinymce/plugins/advlink/link.htm +338 -0
  34. data/vendor/assets/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -0
  35. data/vendor/assets/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +176 -0
  36. data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin.js +1 -0
  37. data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +172 -0
  38. data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -0
  39. data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +137 -0
  40. data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -0
  41. data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +431 -0
  42. data/vendor/assets/javascripts/tinymce/plugins/autosave/langs/en.js +4 -0
  43. data/vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -0
  44. data/vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +120 -0
  45. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -0
  46. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +160 -0
  47. data/vendor/assets/javascripts/tinymce/plugins/directionality/editor_plugin.js +1 -0
  48. data/vendor/assets/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +82 -0
  49. data/vendor/assets/javascripts/tinymce/plugins/emotions/editor_plugin.js +1 -0
  50. data/vendor/assets/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +43 -0
  51. data/vendor/assets/javascripts/tinymce/plugins/emotions/emotions.htm +42 -0
  52. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
  53. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
  54. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  55. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  56. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
  57. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
  58. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
  59. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
  60. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  61. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
  62. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
  63. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
  64. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  65. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
  66. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
  67. data/vendor/assets/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
  68. data/vendor/assets/javascripts/tinymce/plugins/emotions/js/emotions.js +43 -0
  69. data/vendor/assets/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +1 -0
  70. data/vendor/assets/javascripts/tinymce/plugins/example/dialog.htm +22 -0
  71. data/vendor/assets/javascripts/tinymce/plugins/example/editor_plugin.js +1 -0
  72. data/vendor/assets/javascripts/tinymce/plugins/example/editor_plugin_src.js +84 -0
  73. data/vendor/assets/javascripts/tinymce/plugins/example/img/example.gif +0 -0
  74. data/vendor/assets/javascripts/tinymce/plugins/example/js/dialog.js +19 -0
  75. data/vendor/assets/javascripts/tinymce/plugins/example/langs/en.js +3 -0
  76. data/vendor/assets/javascripts/tinymce/plugins/example/langs/en_dlg.js +3 -0
  77. data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin.js +1 -0
  78. data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin_src.js +50 -0
  79. data/vendor/assets/javascripts/tinymce/plugins/fullpage/css/fullpage.css +143 -0
  80. data/vendor/assets/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -0
  81. data/vendor/assets/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +405 -0
  82. data/vendor/assets/javascripts/tinymce/plugins/fullpage/fullpage.htm +259 -0
  83. data/vendor/assets/javascripts/tinymce/plugins/fullpage/js/fullpage.js +232 -0
  84. data/vendor/assets/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +1 -0
  85. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -0
  86. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +159 -0
  87. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +110 -0
  88. data/vendor/assets/javascripts/tinymce/plugins/iespell/editor_plugin.js +1 -0
  89. data/vendor/assets/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +54 -0
  90. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -0
  91. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +699 -0
  92. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  93. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  94. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  95. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  96. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  97. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  98. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  99. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  100. data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/template.htm +387 -0
  101. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +1 -0
  102. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  103. data/vendor/assets/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -0
  104. data/vendor/assets/javascripts/tinymce/plugins/layer/editor_plugin_src.js +262 -0
  105. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -0
  106. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +139 -0
  107. data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -0
  108. data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin_src.js +925 -0
  109. data/vendor/assets/javascripts/tinymce/plugins/media/css/media.css +17 -0
  110. data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin.js +1 -0
  111. data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin_src.js +890 -0
  112. data/vendor/assets/javascripts/tinymce/plugins/media/js/embed.js +73 -0
  113. data/vendor/assets/javascripts/tinymce/plugins/media/js/media.js +464 -0
  114. data/vendor/assets/javascripts/tinymce/plugins/media/langs/en_dlg.js +1 -0
  115. data/vendor/assets/javascripts/tinymce/plugins/media/media.htm +922 -0
  116. data/vendor/assets/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
  117. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -0
  118. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +54 -0
  119. data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -0
  120. data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +95 -0
  121. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -0
  122. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +74 -0
  123. data/vendor/assets/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -0
  124. data/vendor/assets/javascripts/tinymce/plugins/paste/editor_plugin_src.js +871 -0
  125. data/vendor/assets/javascripts/tinymce/plugins/paste/js/pastetext.js +36 -0
  126. data/vendor/assets/javascripts/tinymce/plugins/paste/js/pasteword.js +51 -0
  127. data/vendor/assets/javascripts/tinymce/plugins/paste/langs/en_dlg.js +1 -0
  128. data/vendor/assets/javascripts/tinymce/plugins/paste/pastetext.htm +27 -0
  129. data/vendor/assets/javascripts/tinymce/plugins/paste/pasteword.htm +21 -0
  130. data/vendor/assets/javascripts/tinymce/plugins/preview/editor_plugin.js +1 -0
  131. data/vendor/assets/javascripts/tinymce/plugins/preview/editor_plugin_src.js +53 -0
  132. data/vendor/assets/javascripts/tinymce/plugins/preview/example.html +28 -0
  133. data/vendor/assets/javascripts/tinymce/plugins/preview/jscripts/embed.js +73 -0
  134. data/vendor/assets/javascripts/tinymce/plugins/preview/preview.html +17 -0
  135. data/vendor/assets/javascripts/tinymce/plugins/print/editor_plugin.js +1 -0
  136. data/vendor/assets/javascripts/tinymce/plugins/print/editor_plugin_src.js +34 -0
  137. data/vendor/assets/javascripts/tinymce/plugins/save/editor_plugin.js +1 -0
  138. data/vendor/assets/javascripts/tinymce/plugins/save/editor_plugin_src.js +101 -0
  139. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +6 -0
  140. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -0
  141. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +61 -0
  142. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +142 -0
  143. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +1 -0
  144. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +100 -0
  145. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/css/content.css +1 -0
  146. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -0
  147. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +436 -0
  148. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
  149. data/vendor/assets/javascripts/tinymce/plugins/style/css/props.css +13 -0
  150. data/vendor/assets/javascripts/tinymce/plugins/style/editor_plugin.js +1 -0
  151. data/vendor/assets/javascripts/tinymce/plugins/style/editor_plugin_src.js +55 -0
  152. data/vendor/assets/javascripts/tinymce/plugins/style/js/props.js +635 -0
  153. data/vendor/assets/javascripts/tinymce/plugins/style/langs/en_dlg.js +1 -0
  154. data/vendor/assets/javascripts/tinymce/plugins/style/props.htm +840 -0
  155. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -0
  156. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +122 -0
  157. data/vendor/assets/javascripts/tinymce/plugins/table/cell.htm +180 -0
  158. data/vendor/assets/javascripts/tinymce/plugins/table/css/cell.css +17 -0
  159. data/vendor/assets/javascripts/tinymce/plugins/table/css/row.css +25 -0
  160. data/vendor/assets/javascripts/tinymce/plugins/table/css/table.css +13 -0
  161. data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin.js +1 -0
  162. data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin_src.js +1408 -0
  163. data/vendor/assets/javascripts/tinymce/plugins/table/js/cell.js +319 -0
  164. data/vendor/assets/javascripts/tinymce/plugins/table/js/merge_cells.js +27 -0
  165. data/vendor/assets/javascripts/tinymce/plugins/table/js/row.js +237 -0
  166. data/vendor/assets/javascripts/tinymce/plugins/table/js/table.js +484 -0
  167. data/vendor/assets/javascripts/tinymce/plugins/table/langs/en_dlg.js +1 -0
  168. data/vendor/assets/javascripts/tinymce/plugins/table/merge_cells.htm +32 -0
  169. data/vendor/assets/javascripts/tinymce/plugins/table/row.htm +158 -0
  170. data/vendor/assets/javascripts/tinymce/plugins/table/table.htm +188 -0
  171. data/vendor/assets/javascripts/tinymce/plugins/template/blank.htm +12 -0
  172. data/vendor/assets/javascripts/tinymce/plugins/template/css/template.css +23 -0
  173. data/vendor/assets/javascripts/tinymce/plugins/template/editor_plugin.js +1 -0
  174. data/vendor/assets/javascripts/tinymce/plugins/template/editor_plugin_src.js +159 -0
  175. data/vendor/assets/javascripts/tinymce/plugins/template/js/template.js +106 -0
  176. data/vendor/assets/javascripts/tinymce/plugins/template/langs/en_dlg.js +1 -0
  177. data/vendor/assets/javascripts/tinymce/plugins/template/template.htm +31 -0
  178. data/vendor/assets/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -0
  179. data/vendor/assets/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +83 -0
  180. data/vendor/assets/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -0
  181. data/vendor/assets/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +114 -0
  182. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +142 -0
  183. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +142 -0
  184. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +149 -0
  185. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +142 -0
  186. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +11 -0
  187. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +9 -0
  188. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/del.htm +162 -0
  189. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  190. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
  191. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +162 -0
  192. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +28 -0
  193. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +28 -0
  194. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +111 -0
  195. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +28 -0
  196. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +53 -0
  197. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +229 -0
  198. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +53 -0
  199. data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +1 -0
  200. data/vendor/assets/javascripts/tinymce/themes/advanced/about.htm +52 -0
  201. data/vendor/assets/javascripts/tinymce/themes/advanced/anchor.htm +26 -0
  202. data/vendor/assets/javascripts/tinymce/themes/advanced/charmap.htm +55 -0
  203. data/vendor/assets/javascripts/tinymce/themes/advanced/color_picker.htm +74 -0
  204. data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template.js +1 -0
  205. data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template_src.js +1362 -0
  206. data/vendor/assets/javascripts/tinymce/themes/advanced/image.htm +80 -0
  207. data/vendor/assets/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
  208. data/vendor/assets/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
  209. data/vendor/assets/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
  210. data/vendor/assets/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
  211. data/vendor/assets/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
  212. data/vendor/assets/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
  213. data/vendor/assets/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
  214. data/vendor/assets/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
  215. data/vendor/assets/javascripts/tinymce/themes/advanced/img/trans.gif +0 -0
  216. data/vendor/assets/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
  217. data/vendor/assets/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
  218. data/vendor/assets/javascripts/tinymce/themes/advanced/js/about.js +73 -0
  219. data/vendor/assets/javascripts/tinymce/themes/advanced/js/anchor.js +43 -0
  220. data/vendor/assets/javascripts/tinymce/themes/advanced/js/charmap.js +363 -0
  221. data/vendor/assets/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -0
  222. data/vendor/assets/javascripts/tinymce/themes/advanced/js/image.js +251 -0
  223. data/vendor/assets/javascripts/tinymce/themes/advanced/js/link.js +153 -0
  224. data/vendor/assets/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -0
  225. data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en.js +1 -0
  226. data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en_dlg.js +1 -0
  227. data/vendor/assets/javascripts/tinymce/themes/advanced/link.htm +57 -0
  228. data/vendor/assets/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -0
  229. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/content.css +50 -0
  230. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/dialog.css +117 -0
  231. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
  232. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
  233. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  234. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  235. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
  236. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
  237. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/ui.css +214 -0
  238. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +24 -0
  239. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +105 -0
  240. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +102 -0
  241. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +48 -0
  242. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +117 -0
  243. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  244. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  245. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  246. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +217 -0
  247. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  248. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  249. data/vendor/assets/javascripts/tinymce/themes/advanced/source_editor.htm +25 -0
  250. data/vendor/assets/javascripts/tinymce/themes/simple/editor_template.js +1 -0
  251. data/vendor/assets/javascripts/tinymce/themes/simple/editor_template_src.js +84 -0
  252. data/vendor/assets/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
  253. data/vendor/assets/javascripts/tinymce/themes/simple/langs/en.js +1 -0
  254. data/vendor/assets/javascripts/tinymce/themes/simple/skins/default/content.css +25 -0
  255. data/vendor/assets/javascripts/tinymce/themes/simple/skins/default/ui.css +32 -0
  256. data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/content.css +17 -0
  257. data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  258. data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +35 -0
  259. data/vendor/assets/javascripts/tinymce/tiny_mce.js +1 -0
  260. data/vendor/assets/javascripts/tinymce/tiny_mce_jquery.js +1 -0
  261. data/vendor/assets/javascripts/tinymce/tiny_mce_jquery_src.js +15905 -0
  262. data/vendor/assets/javascripts/tinymce/tiny_mce_popup.js +5 -0
  263. data/vendor/assets/javascripts/tinymce/tiny_mce_src.js +16728 -0
  264. data/vendor/assets/javascripts/tinymce/utils/editable_selects.js +70 -0
  265. data/vendor/assets/javascripts/tinymce/utils/form_utils.js +210 -0
  266. data/vendor/assets/javascripts/tinymce/utils/mctabs.js +162 -0
  267. data/vendor/assets/javascripts/tinymce/utils/validate.js +252 -0
  268. metadata +334 -0
@@ -0,0 +1,925 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2011, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://tinymce.moxiecode.com/license
8
+ * Contributing: http://tinymce.moxiecode.com/contributing
9
+ */
10
+
11
+ (function() {
12
+ var each = tinymce.each, Event = tinymce.dom.Event, bookmark;
13
+
14
+ // Skips text nodes that only contain whitespace since they aren't semantically important.
15
+ function skipWhitespaceNodes(e, next) {
16
+ while (e && (e.nodeType === 8 || (e.nodeType === 3 && /^[ \t\n\r]*$/.test(e.nodeValue)))) {
17
+ e = next(e);
18
+ }
19
+ return e;
20
+ }
21
+
22
+ function skipWhitespaceNodesBackwards(e) {
23
+ return skipWhitespaceNodes(e, function(e) {
24
+ return e.previousSibling;
25
+ });
26
+ }
27
+
28
+ function skipWhitespaceNodesForwards(e) {
29
+ return skipWhitespaceNodes(e, function(e) {
30
+ return e.nextSibling;
31
+ });
32
+ }
33
+
34
+ function hasParentInList(ed, e, list) {
35
+ return ed.dom.getParent(e, function(p) {
36
+ return tinymce.inArray(list, p) !== -1;
37
+ });
38
+ }
39
+
40
+ function isList(e) {
41
+ return e && (e.tagName === 'OL' || e.tagName === 'UL');
42
+ }
43
+
44
+ function splitNestedLists(element, dom) {
45
+ var tmp, nested, wrapItem;
46
+ tmp = skipWhitespaceNodesBackwards(element.lastChild);
47
+ while (isList(tmp)) {
48
+ nested = tmp;
49
+ tmp = skipWhitespaceNodesBackwards(nested.previousSibling);
50
+ }
51
+ if (nested) {
52
+ wrapItem = dom.create('li', { style: 'list-style-type: none;'});
53
+ dom.split(element, nested);
54
+ dom.insertAfter(wrapItem, nested);
55
+ wrapItem.appendChild(nested);
56
+ wrapItem.appendChild(nested);
57
+ element = wrapItem.previousSibling;
58
+ }
59
+ return element;
60
+ }
61
+
62
+ function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
63
+ e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
64
+ return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
65
+ }
66
+
67
+ function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
68
+ var prev = skipWhitespaceNodesBackwards(e.previousSibling);
69
+ if (prev) {
70
+ return attemptMerge(prev, e, allowDifferentListStyles ? prev : false, mergeParagraphs);
71
+ } else {
72
+ return e;
73
+ }
74
+ }
75
+
76
+ function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
77
+ var next = skipWhitespaceNodesForwards(e.nextSibling);
78
+ if (next) {
79
+ return attemptMerge(e, next, allowDifferentListStyles ? next : false, mergeParagraphs);
80
+ } else {
81
+ return e;
82
+ }
83
+ }
84
+
85
+ function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
86
+ if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
87
+ return merge(e1, e2, differentStylesMasterElement);
88
+ } else if (e1 && e1.tagName === 'LI' && isList(e2)) {
89
+ // Fix invalidly nested lists.
90
+ e1.appendChild(e2);
91
+ }
92
+ return e2;
93
+ }
94
+
95
+ function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
96
+ if (!e1 || !e2) {
97
+ return false;
98
+ } else if (e1.tagName === 'LI' && e2.tagName === 'LI') {
99
+ return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
100
+ } else if (isList(e1)) {
101
+ return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
102
+ } else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P';
103
+ }
104
+
105
+ function isListForIndent(e) {
106
+ var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
107
+ return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
108
+ }
109
+
110
+ function containsOnlyAList(e) {
111
+ var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
112
+ return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
113
+ }
114
+
115
+ function merge(e1, e2, masterElement) {
116
+ var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
117
+ if (e1.tagName === 'P') {
118
+ e1.appendChild(e1.ownerDocument.createElement('br'));
119
+ }
120
+ while (e2.firstChild) {
121
+ e1.appendChild(e2.firstChild);
122
+ }
123
+ if (masterElement) {
124
+ e1.style.listStyleType = masterElement.style.listStyleType;
125
+ }
126
+ e2.parentNode.removeChild(e2);
127
+ attemptMerge(lastOriginal, firstNew, false);
128
+ return e1;
129
+ }
130
+
131
+ function findItemToOperateOn(e, dom) {
132
+ var item;
133
+ if (!dom.is(e, 'li,ol,ul')) {
134
+ item = dom.getParent(e, 'li');
135
+ if (item) {
136
+ e = item;
137
+ }
138
+ }
139
+ return e;
140
+ }
141
+
142
+ tinymce.create('tinymce.plugins.Lists', {
143
+ init: function(ed) {
144
+ var LIST_TABBING = 'TABBING';
145
+ var LIST_EMPTY_ITEM = 'EMPTY';
146
+ var LIST_ESCAPE = 'ESCAPE';
147
+ var LIST_PARAGRAPH = 'PARAGRAPH';
148
+ var LIST_UNKNOWN = 'UNKNOWN';
149
+ var state = LIST_UNKNOWN;
150
+
151
+ function isTabInList(e) {
152
+ // Don't indent on Ctrl+Tab or Alt+Tab
153
+ return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&
154
+ (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
155
+ }
156
+
157
+ function isCursorAtEndOfContainer() {
158
+ var range = ed.selection.getRng();
159
+ var startContainer = range.startContainer;
160
+ if (startContainer.nodeType == 3) {
161
+ return (range.endOffset == startContainer.nodeValue.length);
162
+ } else if (startContainer.nodeType == 1) {
163
+ return range.endOffset == startContainer.childNodes.length;
164
+ }
165
+ return false;
166
+ }
167
+
168
+ // If we are at the end of a paragraph in a list item, pressing enter should create a new list item instead of a new paragraph.
169
+ function isEndOfParagraph() {
170
+ var node = ed.selection.getNode();
171
+ var isLastParagraphOfLi = node.tagName === 'P' && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;
172
+ return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();
173
+ }
174
+
175
+ function isOnLastListItem() {
176
+ var li = getLi();
177
+ var grandParent = li.parentNode.parentNode;
178
+ var isLastItem = li.parentNode.lastChild === li;
179
+ return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li);
180
+ }
181
+
182
+ function isNestedList(grandParent) {
183
+ if (isList(grandParent)) {
184
+ return grandParent.parentNode && grandParent.parentNode.tagName === 'LI';
185
+ } else {
186
+ return grandParent.tagName === 'LI';
187
+ }
188
+ }
189
+
190
+ function isInEmptyListItem() {
191
+ return ed.selection.isCollapsed() && isEmptyListItem(getLi());
192
+ }
193
+
194
+ function getLi() {
195
+ var n = ed.selection.getStart();
196
+ // Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position
197
+ return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n;
198
+ }
199
+
200
+ function isEmptyListItem(li) {
201
+ var numChildren = li.childNodes.length;
202
+ if (li.tagName === 'LI') {
203
+ return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li));
204
+ }
205
+ return false;
206
+ }
207
+
208
+ function isEmptyIE9Li(li) {
209
+ // only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these
210
+ var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'});
211
+ var isLastLi = li == lis[lis.length - 1];
212
+ var child = li.firstChild;
213
+ return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));
214
+ }
215
+
216
+ function isEnter(e) {
217
+ return e.keyCode === tinymce.VK.ENTER;
218
+ }
219
+
220
+ function isEnterWithoutShift(e) {
221
+ return isEnter(e) && !e.shiftKey;
222
+ }
223
+
224
+ function getListKeyState(e) {
225
+ if (isTabInList(e)) {
226
+ return LIST_TABBING;
227
+ } else if (isEnterWithoutShift(e) && isOnLastListItem()) {
228
+ return LIST_ESCAPE;
229
+ } else if (isEnterWithoutShift(e) && isInEmptyListItem()) {
230
+ return LIST_EMPTY_ITEM;
231
+ } else if (isEnterWithoutShift(e) && isEndOfParagraph()) {
232
+ return LIST_PARAGRAPH;
233
+ } else {
234
+ return LIST_UNKNOWN;
235
+ }
236
+ }
237
+
238
+ function cancelDefaultEvents(ed, e) {
239
+ // list escape is done manually using outdent as it does not create paragraphs correctly in td's
240
+ if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) {
241
+ Event.cancel(e);
242
+ }
243
+ }
244
+
245
+ // Creates a new list item after the current selection's list item parent
246
+ function createNewLi(ed, e) {
247
+ if (state == LIST_PARAGRAPH) {
248
+ var node = ed.selection.getNode();
249
+ var li = ed.dom.create("li");
250
+ var parentLi = ed.dom.getParent(node, 'li');
251
+ ed.dom.insertAfter(li, parentLi);
252
+
253
+ // Move caret to new list element.
254
+ if (tinyMCE.isIE8) {
255
+ li.appendChild(ed.dom.create(" ")); // IE needs an element within the bullet point
256
+ ed.selection.setCursorLocation(li, 1);
257
+ } else if (tinyMCE.isGecko) {
258
+ // This setTimeout is a hack as FF behaves badly if there is no content after the bullet point
259
+ setTimeout(function () {
260
+ var n = ed.getDoc().createTextNode('\uFEFF');
261
+ li.appendChild(n);
262
+ ed.selection.setCursorLocation(li, 0);
263
+ }, 0);
264
+ } else {
265
+ ed.selection.setCursorLocation(li, 0);
266
+ }
267
+ Event.cancel(e);
268
+ }
269
+ }
270
+
271
+ function imageJoiningListItem(ed, e) {
272
+ var prevSibling;
273
+
274
+ if (!tinymce.isGecko)
275
+ return;
276
+
277
+ var n = ed.selection.getStart();
278
+ if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG')
279
+ return;
280
+
281
+ function lastLI(node) {
282
+ var child = node.firstChild;
283
+ var li = null;
284
+ do {
285
+ if (!child)
286
+ break;
287
+
288
+ if (child.tagName === 'LI')
289
+ li = child;
290
+ } while (child = child.nextSibling);
291
+
292
+ return li;
293
+ }
294
+
295
+ function addChildren(parentNode, destination) {
296
+ while (parentNode.childNodes.length > 0)
297
+ destination.appendChild(parentNode.childNodes[0]);
298
+ }
299
+
300
+ // Check if there is a previous sibling
301
+ prevSibling = n.parentNode.previousSibling;
302
+ if (!prevSibling)
303
+ return;
304
+
305
+ var ul;
306
+ if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL')
307
+ ul = prevSibling;
308
+ else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL'))
309
+ ul = prevSibling.previousSibling;
310
+ else
311
+ return;
312
+
313
+ var li = lastLI(ul);
314
+
315
+ // move the caret to the end of the list item
316
+ var rng = ed.dom.createRng();
317
+ rng.setStart(li, 1);
318
+ rng.setEnd(li, 1);
319
+ ed.selection.setRng(rng);
320
+ ed.selection.collapse(true);
321
+
322
+ // save a bookmark at the end of the list item
323
+ var bookmark = ed.selection.getBookmark();
324
+
325
+ // copy the image an its text to the list item
326
+ var clone = n.parentNode.cloneNode(true);
327
+ if (clone.tagName === 'P' || clone.tagName === 'DIV')
328
+ addChildren(clone, li);
329
+ else
330
+ li.appendChild(clone);
331
+
332
+ // remove the old copy of the image
333
+ n.parentNode.parentNode.removeChild(n.parentNode);
334
+
335
+ // move the caret where we saved the bookmark
336
+ ed.selection.moveToBookmark(bookmark);
337
+ }
338
+
339
+ // fix the cursor position to ensure it is correct in IE
340
+ function setCursorPositionToOriginalLi(li) {
341
+ var list = ed.dom.getParent(li, 'ol,ul');
342
+ if (list != null) {
343
+ var lastLi = list.lastChild;
344
+ lastLi.appendChild(ed.getDoc().createElement(''));
345
+ ed.selection.setCursorLocation(lastLi, 0);
346
+ }
347
+ }
348
+
349
+ this.ed = ed;
350
+ ed.addCommand('Indent', this.indent, this);
351
+ ed.addCommand('Outdent', this.outdent, this);
352
+ ed.addCommand('InsertUnorderedList', function() {
353
+ this.applyList('UL', 'OL');
354
+ }, this);
355
+ ed.addCommand('InsertOrderedList', function() {
356
+ this.applyList('OL', 'UL');
357
+ }, this);
358
+
359
+ ed.onInit.add(function() {
360
+ ed.editorCommands.addCommands({
361
+ 'outdent': function() {
362
+ var sel = ed.selection, dom = ed.dom;
363
+
364
+ function hasStyleIndent(n) {
365
+ n = dom.getParent(n, dom.isBlock);
366
+ return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
367
+ }
368
+
369
+ return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
370
+ }
371
+ }, 'state');
372
+ });
373
+
374
+ ed.onKeyUp.add(function(ed, e) {
375
+ if (state == LIST_TABBING) {
376
+ ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
377
+ state = LIST_UNKNOWN;
378
+ return Event.cancel(e);
379
+ } else if (state == LIST_EMPTY_ITEM) {
380
+ var li = getLi();
381
+ var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey;
382
+ ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null);
383
+ if (tinymce.isIE) {
384
+ setCursorPositionToOriginalLi(li);
385
+ }
386
+
387
+ return Event.cancel(e);
388
+ } else if (state == LIST_ESCAPE) {
389
+ if (tinymce.isIE8) {
390
+ // append a zero sized nbsp so that caret is positioned correctly in IE8 after escaping and applying formatting.
391
+ // if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after
392
+ // escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
393
+ var n = ed.getDoc().createTextNode('\uFEFF');
394
+ ed.selection.getNode().appendChild(n);
395
+ } else if (tinymce.isIE9 || tinymce.isGecko) {
396
+ // IE9 does not escape the list so we use outdent to do this and cancel the default behaviour
397
+ // Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves
398
+ ed.execCommand('Outdent');
399
+ return Event.cancel(e);
400
+ }
401
+ }
402
+ });
403
+
404
+ function fixListItem(parent, reference) {
405
+ // a zero-sized non-breaking space is placed in the empty list item so that the nested list is
406
+ // displayed on the below line instead of next to it
407
+ var n = ed.getDoc().createTextNode('\uFEFF');
408
+ parent.insertBefore(n, reference);
409
+ ed.selection.setCursorLocation(n, 0);
410
+ // repaint to remove rendering artifact. only visible when creating new list
411
+ ed.execCommand('mceRepaint');
412
+ }
413
+
414
+ function fixIndentedListItemForGecko(ed, e) {
415
+ if (isEnter(e)) {
416
+ var li = getLi();
417
+ if (li) {
418
+ var parent = li.parentNode;
419
+ var grandParent = parent && parent.parentNode;
420
+ if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) {
421
+ fixListItem(grandParent, parent);
422
+ }
423
+ }
424
+ }
425
+ }
426
+
427
+ function fixIndentedListItemForIE8(ed, e) {
428
+ if (isEnter(e)) {
429
+ var li = getLi();
430
+ if (ed.dom.select('ul li', li).length === 1) {
431
+ var list = li.firstChild;
432
+ fixListItem(li, list);
433
+ }
434
+ }
435
+ }
436
+
437
+ function fixDeletingFirstCharOfList(ed, e) {
438
+ function listElements(list, li) {
439
+ var elements = [];
440
+ var walker = new tinymce.dom.TreeWalker(li, list);
441
+ for (var node = walker.current(); node; node = walker.next()) {
442
+ if (ed.dom.is(node, 'ol,ul,li')) {
443
+ elements.push(node);
444
+ }
445
+ }
446
+ return elements;
447
+ }
448
+
449
+ if (e.keyCode == tinymce.VK.BACKSPACE) {
450
+ var li = getLi();
451
+ if (li) {
452
+ var list = ed.dom.getParent(li, 'ol,ul');
453
+ if (list && list.firstChild === li) {
454
+ var elements = listElements(list, li);
455
+ ed.execCommand("Outdent", false, elements);
456
+ ed.undoManager.add();
457
+ return Event.cancel(e);
458
+ }
459
+ }
460
+ }
461
+ }
462
+
463
+ ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
464
+ ed.onKeyDown.add(cancelDefaultEvents);
465
+ ed.onKeyDown.add(imageJoiningListItem);
466
+ ed.onKeyDown.add(createNewLi);
467
+
468
+ if (tinymce.isGecko) {
469
+ ed.onKeyUp.add(fixIndentedListItemForGecko);
470
+ }
471
+ if (tinymce.isIE8) {
472
+ ed.onKeyUp.add(fixIndentedListItemForIE8);
473
+ }
474
+ if (tinymce.isGecko || tinymce.isWebKit) {
475
+ ed.onKeyDown.add(fixDeletingFirstCharOfList);
476
+ }
477
+ },
478
+
479
+ applyList: function(targetListType, oppositeListType) {
480
+ var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
481
+ selectedBlocks = ed.selection.getSelectedBlocks();
482
+
483
+ function cleanupBr(e) {
484
+ if (e && e.tagName === 'BR') {
485
+ dom.remove(e);
486
+ }
487
+ }
488
+
489
+ function makeList(element) {
490
+ var list = dom.create(targetListType), li;
491
+
492
+ function adjustIndentForNewList(element) {
493
+ // If there's a margin-left, outdent one level to account for the extra list margin.
494
+ if (element.style.marginLeft || element.style.paddingLeft) {
495
+ t.adjustPaddingFunction(false)(element);
496
+ }
497
+ }
498
+
499
+ if (element.tagName === 'LI') {
500
+ // No change required.
501
+ } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
502
+ processBrs(element, function(startSection, br) {
503
+ doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
504
+ li = startSection.parentNode;
505
+ adjustIndentForNewList(li);
506
+ cleanupBr(br);
507
+ });
508
+ if (li) {
509
+ if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) {
510
+ dom.split(li.parentNode.parentNode, li.parentNode);
511
+ }
512
+ attemptMergeWithAdjacent(li.parentNode, true);
513
+ }
514
+ return;
515
+ } else {
516
+ // Put the list around the element.
517
+ li = dom.create('li');
518
+ dom.insertAfter(li, element);
519
+ li.appendChild(element);
520
+ adjustIndentForNewList(element);
521
+ element = li;
522
+ }
523
+ dom.insertAfter(list, element);
524
+ list.appendChild(element);
525
+ attemptMergeWithAdjacent(list, true);
526
+ applied.push(element);
527
+ }
528
+
529
+ function doWrapList(start, end, template) {
530
+ var li, n = start, tmp;
531
+ while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
532
+ start = dom.split(start.parentNode, start.previousSibling);
533
+ start = start.nextSibling;
534
+ n = start;
535
+ }
536
+ if (template) {
537
+ li = template.cloneNode(true);
538
+ start.parentNode.insertBefore(li, start);
539
+ while (li.firstChild) dom.remove(li.firstChild);
540
+ li = dom.rename(li, 'li');
541
+ } else {
542
+ li = dom.create('li');
543
+ start.parentNode.insertBefore(li, start);
544
+ }
545
+ while (n && n != end) {
546
+ tmp = n.nextSibling;
547
+ li.appendChild(n);
548
+ n = tmp;
549
+ }
550
+ if (li.childNodes.length === 0) {
551
+ li.innerHTML = '<br _mce_bogus="1" />';
552
+ }
553
+ makeList(li);
554
+ }
555
+
556
+ function processBrs(element, callback) {
557
+ var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
558
+ breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
559
+
560
+ function isAnyPartSelected(start, end) {
561
+ var r = dom.createRng(), sel;
562
+ bookmark.keep = true;
563
+ ed.selection.moveToBookmark(bookmark);
564
+ bookmark.keep = false;
565
+ sel = ed.selection.getRng(true);
566
+ if (!end) {
567
+ end = start.parentNode.lastChild;
568
+ }
569
+ r.setStartBefore(start);
570
+ r.setEndAfter(end);
571
+ return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
572
+ }
573
+
574
+ function nextLeaf(br) {
575
+ if (br.nextSibling)
576
+ return br.nextSibling;
577
+ if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
578
+ return nextLeaf(br.parentNode);
579
+ }
580
+
581
+ // Split on BRs within the range and process those.
582
+ startSection = element.firstChild;
583
+ // First mark the BRs that have any part of the previous section selected.
584
+ var trailingContentSelected = false;
585
+ each(dom.select(breakElements, element), function(br) {
586
+ if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
587
+ return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
588
+ }
589
+ if (isAnyPartSelected(startSection, br)) {
590
+ dom.addClass(br, '_mce_tagged_br');
591
+ startSection = nextLeaf(br);
592
+ }
593
+ });
594
+ trailingContentSelected = (startSection && isAnyPartSelected(startSection, undefined));
595
+ startSection = element.firstChild;
596
+ each(dom.select(breakElements, element), function(br) {
597
+ // Got a section from start to br.
598
+ var tmp = nextLeaf(br);
599
+ if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
600
+ return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
601
+ }
602
+ if (dom.hasClass(br, '_mce_tagged_br')) {
603
+ callback(startSection, br, previousBR);
604
+ previousBR = null;
605
+ } else {
606
+ previousBR = br;
607
+ }
608
+ startSection = tmp;
609
+ });
610
+ if (trailingContentSelected) {
611
+ callback(startSection, undefined, previousBR);
612
+ }
613
+ }
614
+
615
+ function wrapList(element) {
616
+ processBrs(element, function(startSection, br, previousBR) {
617
+ // Need to indent this part
618
+ doWrapList(startSection, br);
619
+ cleanupBr(br);
620
+ cleanupBr(previousBR);
621
+ });
622
+ }
623
+
624
+ function changeList(element) {
625
+ if (tinymce.inArray(applied, element) !== -1) {
626
+ return;
627
+ }
628
+ if (element.parentNode.tagName === oppositeListType) {
629
+ dom.split(element.parentNode, element);
630
+ makeList(element);
631
+ attemptMergeWithNext(element.parentNode, false);
632
+ }
633
+ applied.push(element);
634
+ }
635
+
636
+ function convertListItemToParagraph(element) {
637
+ var child, nextChild, mergedElement, splitLast;
638
+ if (tinymce.inArray(applied, element) !== -1) {
639
+ return;
640
+ }
641
+ element = splitNestedLists(element, dom);
642
+ while (dom.is(element.parentNode, 'ol,ul,li')) {
643
+ dom.split(element.parentNode, element);
644
+ }
645
+ // Push the original element we have from the selection, not the renamed one.
646
+ applied.push(element);
647
+ element = dom.rename(element, 'p');
648
+ mergedElement = attemptMergeWithAdjacent(element, false, ed.settings.force_br_newlines);
649
+ if (mergedElement === element) {
650
+ // Now split out any block elements that can't be contained within a P.
651
+ // Manually iterate to ensure we handle modifications correctly (doesn't work with tinymce.each)
652
+ child = element.firstChild;
653
+ while (child) {
654
+ if (dom.isBlock(child)) {
655
+ child = dom.split(child.parentNode, child);
656
+ splitLast = true;
657
+ nextChild = child.nextSibling && child.nextSibling.firstChild;
658
+ } else {
659
+ nextChild = child.nextSibling;
660
+ if (splitLast && child.tagName === 'BR') {
661
+ dom.remove(child);
662
+ }
663
+ splitLast = false;
664
+ }
665
+ child = nextChild;
666
+ }
667
+ }
668
+ }
669
+
670
+ each(selectedBlocks, function(e) {
671
+ e = findItemToOperateOn(e, dom);
672
+ if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
673
+ hasOppositeType = true;
674
+ } else if (e.tagName === targetListType || (e.tagName === 'LI' && e.parentNode.tagName === targetListType)) {
675
+ hasSameType = true;
676
+ } else {
677
+ hasNonList = true;
678
+ }
679
+ });
680
+
681
+ if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) {
682
+ actions = {
683
+ 'LI': changeList,
684
+ 'H1': makeList,
685
+ 'H2': makeList,
686
+ 'H3': makeList,
687
+ 'H4': makeList,
688
+ 'H5': makeList,
689
+ 'H6': makeList,
690
+ 'P': makeList,
691
+ 'BODY': makeList,
692
+ 'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
693
+ defaultAction: wrapList,
694
+ elements: this.selectedBlocks()
695
+ };
696
+ } else {
697
+ actions = {
698
+ defaultAction: convertListItemToParagraph,
699
+ elements: this.selectedBlocks()
700
+ };
701
+ }
702
+ this.process(actions);
703
+ },
704
+
705
+ indent: function() {
706
+ var ed = this.ed, dom = ed.dom, indented = [];
707
+
708
+ function createWrapItem(element) {
709
+ var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
710
+ dom.insertAfter(wrapItem, element);
711
+ return wrapItem;
712
+ }
713
+
714
+ function createWrapList(element) {
715
+ var wrapItem = createWrapItem(element),
716
+ list = dom.getParent(element, 'ol,ul'),
717
+ listType = list.tagName,
718
+ listStyle = dom.getStyle(list, 'list-style-type'),
719
+ attrs = {},
720
+ wrapList;
721
+ if (listStyle !== '') {
722
+ attrs.style = 'list-style-type: ' + listStyle + ';';
723
+ }
724
+ wrapList = dom.create(listType, attrs);
725
+ wrapItem.appendChild(wrapList);
726
+ return wrapList;
727
+ }
728
+
729
+ function indentLI(element) {
730
+ if (!hasParentInList(ed, element, indented)) {
731
+ element = splitNestedLists(element, dom);
732
+ var wrapList = createWrapList(element);
733
+ wrapList.appendChild(element);
734
+ attemptMergeWithAdjacent(wrapList.parentNode, false);
735
+ attemptMergeWithAdjacent(wrapList, false);
736
+ indented.push(element);
737
+ }
738
+ }
739
+
740
+ this.process({
741
+ 'LI': indentLI,
742
+ defaultAction: this.adjustPaddingFunction(true),
743
+ elements: this.selectedBlocks()
744
+ });
745
+
746
+ },
747
+
748
+ outdent: function(ui, elements) {
749
+ var t = this, ed = t.ed, dom = ed.dom, outdented = [];
750
+
751
+ function outdentLI(element) {
752
+ var listElement, targetParent, align;
753
+ if (!hasParentInList(ed, element, outdented)) {
754
+ if (dom.getStyle(element, 'margin-left') !== '' || dom.getStyle(element, 'padding-left') !== '') {
755
+ return t.adjustPaddingFunction(false)(element);
756
+ }
757
+ align = dom.getStyle(element, 'text-align', true);
758
+ if (align === 'center' || align === 'right') {
759
+ dom.setStyle(element, 'text-align', 'left');
760
+ return;
761
+ }
762
+ element = splitNestedLists(element, dom);
763
+ listElement = element.parentNode;
764
+ targetParent = element.parentNode.parentNode;
765
+ if (targetParent.tagName === 'P') {
766
+ dom.split(targetParent, element.parentNode);
767
+ } else {
768
+ dom.split(listElement, element);
769
+ if (targetParent.tagName === 'LI') {
770
+ // Nested list, need to split the LI and go back out to the OL/UL element.
771
+ dom.split(targetParent, element);
772
+ } else if (!dom.is(targetParent, 'ol,ul')) {
773
+ dom.rename(element, 'p');
774
+ }
775
+ }
776
+ outdented.push(element);
777
+ }
778
+ }
779
+
780
+ var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks();
781
+ this.process({
782
+ 'LI': outdentLI,
783
+ defaultAction: this.adjustPaddingFunction(false),
784
+ elements: listElements
785
+ });
786
+
787
+ each(outdented, attemptMergeWithAdjacent);
788
+ },
789
+
790
+ process: function(actions) {
791
+ var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
792
+
793
+ function isEmptyElement(element) {
794
+ var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) {
795
+ return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark'
796
+ || n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == ''));
797
+ });
798
+ return excludeBrsAndBookmarks.length === 0;
799
+ }
800
+
801
+ function processElement(element) {
802
+ dom.removeClass(element, '_mce_act_on');
803
+ if (!element || element.nodeType !== 1 || selectedBlocks.length > 1 && isEmptyElement(element)) {
804
+ return;
805
+ }
806
+ element = findItemToOperateOn(element, dom);
807
+ var action = actions[element.tagName];
808
+ if (!action) {
809
+ action = actions.defaultAction;
810
+ }
811
+ action(element);
812
+ }
813
+
814
+ function recurse(element) {
815
+ t.splitSafeEach(element.childNodes, processElement);
816
+ }
817
+
818
+ function brAtEdgeOfSelection(container, offset) {
819
+ return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
820
+ container.childNodes[offset].tagName === 'BR';
821
+ }
822
+
823
+ function isInTable() {
824
+ var n = sel.getNode();
825
+ var p = dom.getParent(n, 'td');
826
+ return p !== null;
827
+ }
828
+
829
+ selectedBlocks = actions.elements;
830
+
831
+ r = sel.getRng(true);
832
+ if (!r.collapsed) {
833
+ if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
834
+ r.setEnd(r.endContainer, r.endOffset - 1);
835
+ sel.setRng(r);
836
+ }
837
+ if (brAtEdgeOfSelection(r.startContainer, r.startOffset)) {
838
+ r.setStart(r.startContainer, r.startOffset + 1);
839
+ sel.setRng(r);
840
+ }
841
+ }
842
+
843
+
844
+ if (tinymce.isIE8) {
845
+ // append a zero sized nbsp so that caret is restored correctly using bookmark
846
+ var s = t.ed.selection.getNode();
847
+ if (s.tagName === 'LI' && !(s.parentNode.lastChild === s)) {
848
+ var i = t.ed.getDoc().createTextNode('\uFEFF');
849
+ s.appendChild(i);
850
+ }
851
+ }
852
+
853
+ bookmark = sel.getBookmark();
854
+ actions.OL = actions.UL = recurse;
855
+ t.splitSafeEach(selectedBlocks, processElement);
856
+ sel.moveToBookmark(bookmark);
857
+ bookmark = null;
858
+
859
+ // we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6
860
+ if (!isInTable()) {
861
+ // Avoids table or image handles being left behind in Firefox.
862
+ t.ed.execCommand('mceRepaint');
863
+ }
864
+ },
865
+
866
+ splitSafeEach: function(elements, f) {
867
+ if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
868
+ /Firefox\/3\.[0-4]/.test(navigator.userAgent))) {
869
+ this.classBasedEach(elements, f);
870
+ } else {
871
+ each(elements, f);
872
+ }
873
+ },
874
+
875
+ classBasedEach: function(elements, f) {
876
+ var dom = this.ed.dom, nodes, element;
877
+ // Mark nodes
878
+ each(elements, function(element) {
879
+ dom.addClass(element, '_mce_act_on');
880
+ });
881
+ nodes = dom.select('._mce_act_on');
882
+ while (nodes.length > 0) {
883
+ element = nodes.shift();
884
+ dom.removeClass(element, '_mce_act_on');
885
+ f(element);
886
+ nodes = dom.select('._mce_act_on');
887
+ }
888
+ },
889
+
890
+ adjustPaddingFunction: function(isIndent) {
891
+ var indentAmount, indentUnits, ed = this.ed;
892
+ indentAmount = ed.settings.indentation;
893
+ indentUnits = /[a-z%]+/i.exec(indentAmount);
894
+ indentAmount = parseInt(indentAmount, 10);
895
+ return function(element) {
896
+ var currentIndent, newIndentAmount;
897
+ currentIndent = parseInt(ed.dom.getStyle(element, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(element, 'padding-left') || 0, 10);
898
+ if (isIndent) {
899
+ newIndentAmount = currentIndent + indentAmount;
900
+ } else {
901
+ newIndentAmount = currentIndent - indentAmount;
902
+ }
903
+ ed.dom.setStyle(element, 'padding-left', '');
904
+ ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
905
+ };
906
+ },
907
+
908
+ selectedBlocks: function() {
909
+ var ed = this.ed
910
+ var selectedBlocks = ed.selection.getSelectedBlocks();
911
+ return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks;
912
+ },
913
+
914
+ getInfo: function() {
915
+ return {
916
+ longname : 'Lists',
917
+ author : 'Moxiecode Systems AB',
918
+ authorurl : 'http://tinymce.moxiecode.com',
919
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists',
920
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
921
+ };
922
+ }
923
+ });
924
+ tinymce.PluginManager.add("lists", tinymce.plugins.Lists);
925
+ }());