kitsune 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. data/Rakefile +1 -1
  2. data/generators/kitsune/kitsune_generator.rb +14 -1
  3. data/generators/kitsune/templates/javascripts/tiny_mce/langs/en.js +154 -0
  4. data/generators/kitsune/templates/javascripts/tiny_mce/license.txt +504 -0
  5. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
  6. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
  7. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +54 -0
  8. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
  9. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
  10. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/rule.htm +62 -0
  11. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
  12. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
  13. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +47 -0
  14. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/image.htm +237 -0
  15. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  16. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
  17. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
  18. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
  19. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
  20. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +58 -0
  21. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
  22. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
  23. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/link.htm +338 -0
  24. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
  25. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +114 -0
  26. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
  27. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +51 -0
  28. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
  29. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +117 -0
  30. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
  31. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +95 -0
  32. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
  33. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +79 -0
  34. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
  35. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +40 -0
  36. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
  37. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
  38. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
  39. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  40. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  41. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
  42. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
  43. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
  44. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  45. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  46. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  47. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  48. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  49. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  50. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
  51. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  52. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
  53. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
  54. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
  55. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/dialog.htm +27 -0
  56. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
  57. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +81 -0
  58. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
  59. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
  60. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
  61. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
  62. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
  63. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
  64. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +146 -0
  65. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +576 -0
  66. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +461 -0
  67. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
  68. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
  69. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +145 -0
  70. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -0
  71. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
  72. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +51 -0
  73. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
  74. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +632 -0
  75. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  76. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  77. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  78. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  79. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  80. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  81. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  82. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  83. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
  84. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
  85. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +80 -0
  86. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
  87. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +209 -0
  88. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
  89. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
  90. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
  91. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +411 -0
  92. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
  93. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
  94. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
  95. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
  96. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
  97. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
  98. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
  99. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
  100. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
  101. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
  102. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/media.htm +822 -0
  103. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
  104. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +50 -0
  105. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
  106. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +87 -0
  107. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
  108. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
  109. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +74 -0
  110. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
  111. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
  112. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
  113. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +531 -0
  114. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
  115. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
  116. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
  117. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/pastetext.htm +33 -0
  118. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/pasteword.htm +27 -0
  119. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
  120. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +50 -0
  121. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/example.html +28 -0
  122. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
  123. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
  124. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
  125. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +31 -0
  126. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/blank.htm +1 -0
  127. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/editor_plugin.js +1 -0
  128. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/editor_plugin_src.js +438 -0
  129. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
  130. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +98 -0
  131. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
  132. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
  133. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +54 -0
  134. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +126 -0
  135. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
  136. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +104 -0
  137. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
  138. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
  139. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +338 -0
  140. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
  141. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
  142. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
  143. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +52 -0
  144. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
  145. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
  146. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/props.htm +730 -0
  147. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
  148. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +109 -0
  149. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/cell.htm +183 -0
  150. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
  151. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
  152. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
  153. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
  154. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1202 -0
  155. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/cell.js +269 -0
  156. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/merge_cells.js +29 -0
  157. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/row.js +212 -0
  158. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/table.js +440 -0
  159. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
  160. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/merge_cells.htm +37 -0
  161. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/row.htm +160 -0
  162. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/table.htm +192 -0
  163. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
  164. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
  165. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
  166. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +156 -0
  167. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
  168. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
  169. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/template.htm +38 -0
  170. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
  171. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +73 -0
  172. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  173. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +95 -0
  174. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +148 -0
  175. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +148 -0
  176. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +153 -0
  177. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +148 -0
  178. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
  179. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
  180. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +169 -0
  181. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  182. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +136 -0
  183. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +169 -0
  184. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +25 -0
  185. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +25 -0
  186. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +123 -0
  187. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +25 -0
  188. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +60 -0
  189. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
  190. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +59 -0
  191. data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  192. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/about.htm +56 -0
  193. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/anchor.htm +31 -0
  194. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
  195. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/color_picker.htm +75 -0
  196. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
  197. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1153 -0
  198. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/image.htm +85 -0
  199. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  200. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  201. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
  202. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
  203. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/charmap.js +325 -0
  204. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
  205. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
  206. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
  207. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
  208. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
  209. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
  210. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/link.htm +63 -0
  211. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/content.css +32 -0
  212. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +116 -0
  213. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  214. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  215. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  216. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  217. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  218. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  219. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -0
  220. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +32 -0
  221. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +115 -0
  222. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  223. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  224. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  225. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
  226. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  227. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  228. data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/source_editor.htm +31 -0
  229. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
  230. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
  231. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
  232. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
  233. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
  234. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
  235. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
  236. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  237. data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
  238. data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce.js +1 -0
  239. data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
  240. data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce_src.js +13231 -0
  241. data/generators/kitsune/templates/javascripts/tiny_mce/utils/editable_selects.js +69 -0
  242. data/generators/kitsune/templates/javascripts/tiny_mce/utils/form_utils.js +199 -0
  243. data/generators/kitsune/templates/javascripts/tiny_mce/utils/mctabs.js +76 -0
  244. data/generators/kitsune/templates/javascripts/tiny_mce/utils/validate.js +219 -0
  245. data/lib/kitsune.rb +1 -1
  246. metadata +243 -2
  247. data/generators/kitsune/templates/javascripts/nicEdit.js +0 -102
@@ -0,0 +1 @@
1
+ (function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
@@ -0,0 +1,109 @@
1
+ /**
2
+ * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $
3
+ *
4
+ * @author Moxiecode
5
+ * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
6
+ */
7
+
8
+ (function() {
9
+ var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
10
+
11
+ tinymce.create('tinymce.plugins.TabFocusPlugin', {
12
+ init : function(ed, url) {
13
+ function tabCancel(ed, e) {
14
+ if (e.keyCode === 9)
15
+ return Event.cancel(e);
16
+ };
17
+
18
+ function tabHandler(ed, e) {
19
+ var x, i, f, el, v;
20
+
21
+ function find(d) {
22
+ f = DOM.getParent(ed.id, 'form');
23
+ el = f.elements;
24
+
25
+ if (f) {
26
+ each(el, function(e, i) {
27
+ if (e.id == ed.id) {
28
+ x = i;
29
+ return false;
30
+ }
31
+ });
32
+
33
+ if (d > 0) {
34
+ for (i = x + 1; i < el.length; i++) {
35
+ if (el[i].type != 'hidden')
36
+ return el[i];
37
+ }
38
+ } else {
39
+ for (i = x - 1; i >= 0; i--) {
40
+ if (el[i].type != 'hidden')
41
+ return el[i];
42
+ }
43
+ }
44
+ }
45
+
46
+ return null;
47
+ };
48
+
49
+ if (e.keyCode === 9) {
50
+ v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
51
+
52
+ if (v.length == 1) {
53
+ v[1] = v[0];
54
+ v[0] = ':prev';
55
+ }
56
+
57
+ // Find element to focus
58
+ if (e.shiftKey) {
59
+ if (v[0] == ':prev')
60
+ el = find(-1);
61
+ else
62
+ el = DOM.get(v[0]);
63
+ } else {
64
+ if (v[1] == ':next')
65
+ el = find(1);
66
+ else
67
+ el = DOM.get(v[1]);
68
+ }
69
+
70
+ if (el) {
71
+ if (ed = tinymce.EditorManager.get(el.id || el.name))
72
+ ed.focus();
73
+ else
74
+ window.setTimeout(function() {window.focus();el.focus();}, 10);
75
+
76
+ return Event.cancel(e);
77
+ }
78
+ }
79
+ };
80
+
81
+ ed.onKeyUp.add(tabCancel);
82
+
83
+ if (tinymce.isGecko) {
84
+ ed.onKeyPress.add(tabHandler);
85
+ ed.onKeyDown.add(tabCancel);
86
+ } else
87
+ ed.onKeyDown.add(tabHandler);
88
+
89
+ ed.onInit.add(function() {
90
+ each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {
91
+ Event.add(n, 'focus', function() {ed.focus();});
92
+ });
93
+ });
94
+ },
95
+
96
+ getInfo : function() {
97
+ return {
98
+ longname : 'Tabfocus',
99
+ author : 'Moxiecode Systems AB',
100
+ authorurl : 'http://tinymce.moxiecode.com',
101
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
102
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
103
+ };
104
+ }
105
+ });
106
+
107
+ // Register plugin
108
+ tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
109
+ })();
@@ -0,0 +1,183 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#table_dlg.cell_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
8
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
9
+ <script type="text/javascript" src="js/cell.js"></script>
10
+ <link href="css/cell.css" rel="stylesheet" type="text/css" />
11
+ </head>
12
+ <body id="tablecell" style="display: none">
13
+ <form onsubmit="updateAction();return false;" action="#">
14
+ <div class="tabs">
15
+ <ul>
16
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
17
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
18
+ </ul>
19
+ </div>
20
+
21
+ <div class="panel_wrapper">
22
+ <div id="general_panel" class="panel current">
23
+ <fieldset>
24
+ <legend>{#table_dlg.general_props}</legend>
25
+
26
+ <table border="0" cellpadding="4" cellspacing="0">
27
+ <tr>
28
+ <td><label for="align">{#table_dlg.align}</label></td>
29
+ <td>
30
+ <select id="align" name="align" class="mceFocus">
31
+ <option value="">{#not_set}</option>
32
+ <option value="center">{#table_dlg.align_middle}</option>
33
+ <option value="left">{#table_dlg.align_left}</option>
34
+ <option value="right">{#table_dlg.align_right}</option>
35
+ </select>
36
+ </td>
37
+
38
+ <td><label for="celltype">{#table_dlg.cell_type}</label></td>
39
+ <td>
40
+ <select id="celltype" name="celltype">
41
+ <option value="td">{#table_dlg.td}</option>
42
+ <option value="th">{#table_dlg.th}</option>
43
+ </select>
44
+ </td>
45
+ </tr>
46
+
47
+ <tr>
48
+ <td><label for="valign">{#table_dlg.valign}</label></td>
49
+ <td>
50
+ <select id="valign" name="valign">
51
+ <option value="">{#not_set}</option>
52
+ <option value="top">{#table_dlg.align_top}</option>
53
+ <option value="middle">{#table_dlg.align_middle}</option>
54
+ <option value="bottom">{#table_dlg.align_bottom}</option>
55
+ </select>
56
+ </td>
57
+
58
+ <td><label for="scope">{#table_dlg.scope}</label></td>
59
+ <td>
60
+ <select id="scope" name="scope">
61
+ <option value="">{#not_set}</option>
62
+ <option value="col">{#table.col}</option>
63
+ <option value="row">{#table.row}</option>
64
+ <option value="rowgroup">{#table_dlg.rowgroup}</option>
65
+ <option value="colgroup">{#table_dlg.colgroup}</option>
66
+ </select>
67
+ </td>
68
+
69
+ </tr>
70
+
71
+ <tr>
72
+ <td><label for="width">{#table_dlg.width}</label></td>
73
+ <td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
74
+
75
+ <td><label for="height">{#table_dlg.height}</label></td>
76
+ <td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
77
+ </tr>
78
+
79
+ <tr id="styleSelectRow">
80
+ <td><label for="class">{#class_name}</label></td>
81
+ <td colspan="3">
82
+ <select id="class" name="class" class="mceEditableSelect">
83
+ <option value="" selected="selected">{#not_set}</option>
84
+ </select>
85
+ </td>
86
+ </tr>
87
+ </table>
88
+ </fieldset>
89
+ </div>
90
+
91
+ <div id="advanced_panel" class="panel">
92
+ <fieldset>
93
+ <legend>{#table_dlg.advanced_props}</legend>
94
+
95
+ <table border="0" cellpadding="0" cellspacing="4">
96
+ <tr>
97
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
98
+ <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
99
+ </tr>
100
+
101
+ <tr>
102
+ <td><label for="style">{#table_dlg.style}</label></td>
103
+ <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
104
+ </tr>
105
+
106
+ <tr>
107
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
108
+ <td>
109
+ <select id="dir" name="dir" style="width: 200px">
110
+ <option value="">{#not_set}</option>
111
+ <option value="ltr">{#table_dlg.ltr}</option>
112
+ <option value="rtl">{#table_dlg.rtl}</option>
113
+ </select>
114
+ </td>
115
+ </tr>
116
+
117
+ <tr>
118
+ <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
119
+ <td>
120
+ <input id="lang" name="lang" type="text" value="" style="width: 200px" />
121
+ </td>
122
+ </tr>
123
+
124
+ <tr>
125
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
126
+ <td>
127
+ <table border="0" cellpadding="0" cellspacing="0">
128
+ <tr>
129
+ <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
130
+ <td id="backgroundimagebrowsercontainer">&nbsp;</td>
131
+ </tr>
132
+ </table>
133
+ </td>
134
+ </tr>
135
+
136
+ <tr>
137
+ <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
138
+ <td>
139
+ <table border="0" cellpadding="0" cellspacing="0">
140
+ <tr>
141
+ <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
142
+ <td id="bordercolor_pickcontainer">&nbsp;</td>
143
+ </tr>
144
+ </table>
145
+ </td>
146
+ </tr>
147
+
148
+ <tr>
149
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
150
+ <td>
151
+ <table border="0" cellpadding="0" cellspacing="0">
152
+ <tr>
153
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
154
+ <td id="bgcolor_pickcontainer">&nbsp;</td>
155
+ </tr>
156
+ </table>
157
+ </td>
158
+ </tr>
159
+ </table>
160
+ </fieldset>
161
+ </div>
162
+ </div>
163
+
164
+ <div class="mceActionPanel">
165
+ <div>
166
+ <select id="action" name="action">
167
+ <option value="cell">{#table_dlg.cell_cell}</option>
168
+ <option value="row">{#table_dlg.cell_row}</option>
169
+ <option value="all">{#table_dlg.cell_all}</option>
170
+ </select>
171
+ </div>
172
+
173
+ <div style="float: left">
174
+ <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
175
+ </div>
176
+
177
+ <div style="float: right">
178
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
179
+ </div>
180
+ </div>
181
+ </form>
182
+ </body>
183
+ </html>
@@ -0,0 +1,17 @@
1
+ /* CSS file for cell dialog in the table plugin */
2
+
3
+ .panel_wrapper div.current {
4
+ height: 200px;
5
+ }
6
+
7
+ .advfield {
8
+ width: 200px;
9
+ }
10
+
11
+ #action {
12
+ margin-bottom: 3px;
13
+ }
14
+
15
+ #class {
16
+ width: 150px;
17
+ }
@@ -0,0 +1,25 @@
1
+ /* CSS file for row dialog in the table plugin */
2
+
3
+ .panel_wrapper div.current {
4
+ height: 200px;
5
+ }
6
+
7
+ .advfield {
8
+ width: 200px;
9
+ }
10
+
11
+ #action {
12
+ margin-bottom: 3px;
13
+ }
14
+
15
+ #rowtype,#align,#valign,#class,#height {
16
+ width: 150px;
17
+ }
18
+
19
+ #height {
20
+ width: 50px;
21
+ }
22
+
23
+ .col2 {
24
+ padding-left: 20px;
25
+ }
@@ -0,0 +1,13 @@
1
+ /* CSS file for table dialog in the table plugin */
2
+
3
+ .panel_wrapper div.current {
4
+ height: 245px;
5
+ }
6
+
7
+ .advfield {
8
+ width: 200px;
9
+ }
10
+
11
+ #class {
12
+ width: 150px;
13
+ }
@@ -0,0 +1 @@
1
+ (function(){var b=tinymce.each;function a(d,e){var f=e.ownerDocument,c=f.createRange(),g;c.setStartBefore(e);c.setEnd(d.endContainer,d.endOffset);g=f.createElement("body");g.appendChild(c.cloneContents());return g.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}tinymce.create("tinymce.plugins.TablePlugin",{init:function(c,d){var e=this;e.editor=c;e.url=d;b([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(f){c.addButton(f[0],{title:f[1],cmd:f[2],ui:f[3]})});if(c.getParam("inline_styles")){c.onPreProcess.add(function(f,h){var g=f.dom;b(g.select("table",h.node),function(j){var i;if(i=g.getAttrib(j,"width")){g.setStyle(j,"width",i);g.setAttrib(j,"width")}if(i=g.getAttrib(j,"height")){g.setStyle(j,"height",i);g.setAttrib(j,"height")}})})}c.onInit.add(function(){if(!tinymce.isIE&&c.getParam("forced_root_block")){function f(){var g=c.getBody().lastChild;if(g&&g.nodeName=="TABLE"){c.dom.add(c.getBody(),"p",null,'<br mce_bogus="1" />')}}if(tinymce.isGecko){c.onKeyDown.add(function(h,j){var g,i,k=h.dom;if(j.keyCode==37||j.keyCode==38){g=h.selection.getRng();i=k.getParent(g.startContainer,"table");if(i&&h.getBody().firstChild==i){if(a(g,i)){g=k.createRng();g.setStartBefore(i);g.setEndBefore(i);h.selection.setRng(g);j.preventDefault()}}}})}c.onKeyUp.add(f);c.onSetContent.add(f);c.onVisualAid.add(f);c.onPreProcess.add(function(g,i){var h=i.node.lastChild;if(h&&h.childNodes.length==1&&h.firstChild.nodeName=="BR"){g.dom.remove(h)}});f()}if(c&&c.plugins.contextmenu){c.plugins.contextmenu.onContextMenu.add(function(i,g,k){var l,j=c.selection,h=j.getNode()||c.getBody();if(c.dom.getParent(k,"td")||c.dom.getParent(k,"th")){g.removeAll();if(h.nodeName=="A"&&!c.dom.getAttrib(h,"name")){g.add({title:"advanced.link_desc",icon:"link",cmd:c.plugins.advlink?"mceAdvLink":"mceLink",ui:true});g.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});g.addSeparator()}if(h.nodeName=="IMG"&&h.className.indexOf("mceItem")==-1){g.add({title:"advanced.image_desc",icon:"image",cmd:c.plugins.advimage?"mceAdvImage":"mceImage",ui:true});g.addSeparator()}g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});g.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});g.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});g.addSeparator();l=g.addMenu({title:"table.cell"});l.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});l.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});l.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});l=g.addMenu({title:"table.row"});l.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});l.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});l.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});l.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});l.addSeparator();l.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});l.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});l.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});l.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});l=g.addMenu({title:"table.col"});l.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});l.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});l.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});c.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(c.getParam("table_selection",true)){c.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}c.onNodeChange.add(function(g,f,i){var h=g.dom.getParent(i,"td,th,caption");f.setActive("table",i.nodeName==="TABLE"||!!h);if(h&&h.nodeName==="CAPTION"){h=null}f.setDisabled("delete_table",!h);f.setDisabled("delete_col",!h);f.setDisabled("delete_table",!h);f.setDisabled("delete_row",!h);f.setDisabled("col_after",!h);f.setDisabled("col_before",!h);f.setDisabled("row_after",!h);f.setDisabled("row_before",!h);f.setDisabled("row_props",!h);f.setDisabled("cell_props",!h);f.setDisabled("split_cells",!h||(parseInt(g.dom.getAttrib(h,"colspan","1"))<2&&parseInt(g.dom.getAttrib(h,"rowspan","1"))<2));f.setDisabled("merge_cells",!h)});if(!tinymce.isIE){c.onBeforeSetContent.add(function(f,g){if(g.initial){g.content=g.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2>&nbsp;</$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(s,aa,af){var W=this.editor,av=W,h=this.url;var o=W.selection.getNode();var X=W.dom.getParent(o,"tr");var ar=W.dom.getParent(o,"td,th");var G=W.dom.getParent(o,"table");var l=W.contentWindow.document;var aw=G?G.getAttribute("border"):"";if(X&&ar==null){ar=X.cells[0]}function aq(y,x){for(var ay=0;ay<y.length;ay++){if(y[ay].length>0&&aq(y[ay],x)){return true}if(y[ay]==x){return true}}return false}function ak(x,i){var y;ae=f(G);x=x||0;i=i||0;x=Math.max(p.cellindex+x,0);i=Math.max(p.rowindex+i,0);W.execCommand("mceRepaint");y=e(ae,i,x);if(y){W.selection.select(y.firstChild||y);W.selection.collapse(1)}}function ai(){var i=l.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function k(y){var x=W.dom.getAttrib(y,"colspan");var i=W.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function am(ay,aA){var i,az;for(az=0;az<ay.length;az++){for(i=0;i<ay[az].length;i++){if(ay[az][i]==aA){return{cellindex:i,rowindex:az}}}}return null}function e(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function B(aD,ay){var aA=[],y=0,aB,az,ay,aC;for(aB=0;aB<aD.rows.length;aB++){for(az=0;az<aD.rows[aB].cells.length;az++,y++){aA[y]=aD.rows[aB].cells[az]}}for(aB=0;aB<aA.length;aB++){if(aA[aB]==ay){if(aC=aA[aB+1]){return aC}}}}function f(aF){var i=[],aG=aF.rows,aD,aC,az,aA,aE,ay,aB;for(aC=0;aC<aG.length;aC++){for(aD=0;aD<aG[aC].cells.length;aD++){az=aG[aC].cells[aD];aA=k(az);for(aE=aD;i[aC]&&i[aC][aE];aE++){}for(aB=aC;aB<aC+aA.rowspan;aB++){if(!i[aB]){i[aB]=[]}for(ay=aE;ay<aE+aA.colspan;ay++){i[aB][ay]=az}}}}return i}function n(aH,aE,az,ay){var y=f(aH),aG=am(y,az);var aI,aD;if(ay.cells.length!=aE.childNodes.length){aI=aE.childNodes;aD=null;for(var aF=0;az=e(y,aG.rowindex,aF);aF++){var aB=true;var aC=k(az);if(aq(aI,az)){ay.childNodes[aF]._delete=true}else{if((aD==null||az!=aD)&&aC.colspan>1){for(var aA=aF;aA<aF+az.colSpan;aA++){ay.childNodes[aA]._delete=true}}}if((aD==null||az!=aD)&&aC.rowspan>1){az.rowSpan=aC.rowspan+1}aD=az}C(G)}}function P(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function ag(ay,az){var x=az.split(",");while((ay=ay.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ay.nodeName.toLowerCase()==x[y].toLowerCase()){return ay}}}return null}function C(ay){if(ay.rows==0){return}var y=ay.rows[0];do{var x=ag(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var az=y.cells[0];if(az.cells>1){do{var i=ag(az,"TD,TH");if(az._delete){az.parentNode.removeChild(az)}}while((az=i)!=null)}}while((y=x)!=null)}function q(ay,aB,aA){ay.rowSpan=1;var x=ag(aB,"TR");for(var az=1;az<aA&&x;az++){var y=l.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ay.cellIndex))}else{x.insertBefore(y,x.cells[ay.cellIndex])}x=ag(x,"TR")}}function T(aG,aI,aC){var y=f(aI);var ay=aC.cloneNode(false);var aH=am(y,aC.cells[0]);var aD=null;var aB=W.dom.getAttrib(aI,"border");var aA=null;for(var aF=0;aA=e(y,aH.rowindex,aF);aF++){var aE=null;if(aD!=aA){for(var az=0;az<aC.cells.length;az++){if(aA==aC.cells[az]){aE=aA.cloneNode(true);break}}}if(aE==null){aE=aG.createElement("td");if(!tinymce.isIE){aE.innerHTML='<br mce_bogus="1"/>'}}aE.colSpan=1;aE.rowSpan=1;ay.appendChild(aE);aD=aA}return ay}switch(s){case"mceTableMoveToNextRow":var M=B(G,ar);if(!M){W.execCommand("mceTableInsertRowAfter",ar);M=B(G,ar)}W.selection.select(M);W.selection.collapse(true);return true;case"mceTableRowProps":if(X==null){return true}if(aa){W.windowManager.open({url:h+"/row.htm",width:400+parseInt(W.getLang("table.rowprops_delta_width",0)),height:295+parseInt(W.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceTableCellProps":if(ar==null){return true}if(aa){W.windowManager.open({url:h+"/cell.htm",width:400+parseInt(W.getLang("table.cellprops_delta_width",0)),height:295+parseInt(W.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceInsertTable":if(aa){W.windowManager.open({url:h+"/table.htm",width:400+parseInt(W.getLang("table.table_delta_width",0)),height:320+parseInt(W.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:af?af.action:0})}return true;case"mceTableDelete":var H=W.dom.getParent(W.selection.getNode(),"table");if(H){H.parentNode.removeChild(H);W.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!G){return true}if(X&&G!=X.parentNode){G=X.parentNode}if(G&&X){switch(s){case"mceTableCutRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);W.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);break;case"mceTablePasteRowBefore":if(!X||!ar){return true}var w=W.tableRowClipboard.cloneNode(true);var j=P(X,"TR");if(j!=null){n(G,j,j.cells[0],w)}X.parentNode.insertBefore(w,X);break;case"mceTablePasteRowAfter":if(!X||!ar){return true}var Y=ag(X,"TR");var w=W.tableRowClipboard.cloneNode(true);n(G,X,ar,w);if(Y==null){X.parentNode.appendChild(w)}else{Y.parentNode.insertBefore(w,Y)}break;case"mceTableInsertRowBefore":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;p.rowindex--;if(p.rowindex<0){p.rowindex=0}for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}X.parentNode.insertBefore(w,X);ak(0,1);break;case"mceTableInsertRowAfter":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}if(w.hasChildNodes()){var Y=ag(X,"TR");if(Y){Y.parentNode.insertBefore(w,Y)}else{G.appendChild(w)}}ak(0,1);break;case"mceTableDeleteRow":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);if(ae.length==1&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}var E=X.cells;var Y=ag(X,"TR");for(var ad=0;ad<E.length;ad++){if(E[ad].rowSpan>1){var K=E[ad].cloneNode(true);var F=k(E[ad]);K.rowSpan=F.rowspan-1;var al=Y.cells[ad];if(al==null){Y.appendChild(K)}else{Y.insertBefore(K,al)}}}var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan>1){ar.rowSpan=F.rowspan-1}else{X=ar.parentNode;if(X.parentNode){X._delete=true}}v=ar}}C(G);ak(0,-1);break;case"mceTableInsertColBefore":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;ar.parentNode.insertBefore(K,ar)}else{ar.colSpan++}v=ar}}ak();break;case"mceTableInsertColAfter":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;var al=ag(ar,"TD,TH");if(al==null){ar.parentNode.appendChild(K)}else{al.parentNode.insertBefore(K,al)}}else{ar.colSpan++}v=ar}}ak(1);break;case"mceTableDeleteCol":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var v=null;if((ae.length>1&&ae[0].length<=1)&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan>1){ar.colSpan=F.colspan-1}else{if(ar.parentNode){ar.parentNode.removeChild(ar)}}v=ar}}ak(-1);break;case"mceTableSplitCells":if(!X||!ar){return true}var m=k(ar);var D=m.colspan;var I=m.rowspan;if(D>1||I>1){ar.colSpan=1;for(var an=1;an<D;an++){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}X.insertBefore(K,ag(ar,"TD,TH"));if(I>1){q(K,X,I)}}q(ar,X,I)}G=W.dom.getParent(W.selection.getNode(),"table");break;case"mceTableMergeCells":var ap=[];var S=W.selection.getSel();var ae=f(G);if(tinymce.isIE||S.rangeCount==1){if(aa){var u=k(ar);W.windowManager.open({url:h+"/merge_cells.htm",width:240+parseInt(W.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(W.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:u.colspan,numrows:u.rowspan,plugin_url:h});return true}else{var V=parseInt(af.numrows);var d=parseInt(af.numcols);var p=am(ae,ar);if((""+V)=="NaN"){V=1}if((""+d)=="NaN"){d=1}var c=G.rows;for(var ab=p.rowindex;ab<ae.length;ab++){var ah=[];for(var ad=p.cellindex;ad<ae[ab].length;ad++){var g=e(ae,ab,ad);if(g&&!aq(ap,g)&&!aq(ah,g)){var O=am(ae,g);if(O.cellindex<p.cellindex+d&&O.rowindex<p.rowindex+V){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}var g=e(ae,p.rowindex,p.cellindex);b(av.dom.select("br",g),function(y,x){if(x>0&&av.dom.getAttrib("mce_bogus")){av.dom.remove(y)}})}}}else{var E=[];var S=W.selection.getSel();var Z=null;var ao=null;var A=-1,ax=-1,z,au;if(S.rangeCount<2){return true}for(var an=0;an<S.rangeCount;an++){var aj=S.getRangeAt(an);var ar=aj.startContainer.childNodes[aj.startOffset];if(!ar){break}if(ar.nodeName=="TD"||ar.nodeName=="TH"){E[E.length]=ar}}var c=G.rows;for(var ab=0;ab<c.length;ab++){var ah=[];for(var ad=0;ad<c[ab].cells.length;ad++){var g=c[ab].cells[ad];for(var an=0;an<E.length;an++){if(g==E[an]){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}}var ao=[];var Z=null;for(var ab=0;ab<ae.length;ab++){for(var ad=0;ad<ae[ab].length;ad++){ae[ab][ad]._selected=false;for(var an=0;an<E.length;an++){if(ae[ab][ad]==E[an]){if(A==-1){A=ad;ax=ab}z=ad;au=ab;ae[ab][ad]._selected=true}}}}for(var ab=ax;ab<=au;ab++){for(var ad=A;ad<=z;ad++){if(!ae[ab][ad]._selected){alert("Invalid selection for merge.");return true}}}}var t=1,r=1;var U=-1;for(var ab=0;ab<ap.length;ab++){var J=0;for(var ad=0;ad<ap[ab].length;ad++){var F=k(ap[ab][ad]);J+=F.colspan;if(U!=-1&&F.rowspan!=U){alert("Invalid selection for merge.");return true}U=F.rowspan}if(J>r){r=J}U=-1}var R=-1;for(var ad=0;ad<ap[0].length;ad++){var N=0;for(var ab=0;ab<ap.length;ab++){var F=k(ap[ab][ad]);N+=F.rowspan;if(R!=-1&&F.colspan!=R){alert("Invalid selection for merge.");return true}R=F.colspan}if(N>t){t=N}R=-1}ar=ap[0][0];ar.rowSpan=t;ar.colSpan=r;for(var ab=0;ab<ap.length;ab++){for(var ad=0;ad<ap[ab].length;ad++){var Q=ap[ab][ad].innerHTML;var L=Q.replace(/[ \t\r\n]/g,"");if(L!="<br/>"&&L!="<br>"&&L!='<br mce_bogus="1"/>'&&(ad+ab>0)){ar.innerHTML+=Q}if(ap[ab][ad]!=ar&&!ap[ab][ad]._deleted){var p=am(ae,ap[ab][ad]);var at=ap[ab][ad].parentNode;at.removeChild(ap[ab][ad]);ap[ab][ad]._deleted=true;if(!at.hasChildNodes()){at.parentNode.removeChild(at);var ac=null;for(var ad=0;cellElm=e(ae,p.rowindex,ad);ad++){if(cellElm!=ac&&cellElm.rowSpan>1){cellElm.rowSpan--}ac=cellElm}if(ar.rowSpan>1){ar.rowSpan--}}}}}b(av.dom.select("br",ar),function(y,x){if(x>0&&av.dom.getAttrib(y,"mce_bogus")){av.dom.remove(y)}});break}G=W.dom.getParent(W.selection.getNode(),"table");W.addVisual(G);W.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})();
@@ -0,0 +1,1202 @@
1
+ /**
2
+ * $Id: editor_plugin_src.js 1209 2009-08-20 12:35:10Z spocke $
3
+ *
4
+ * @author Moxiecode
5
+ * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
6
+ */
7
+
8
+ (function() {
9
+ var each = tinymce.each;
10
+
11
+ // Checks if the selection/caret is at the start of the specified block element
12
+ function isAtStart(rng, par) {
13
+ var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
14
+
15
+ rng2.setStartBefore(par);
16
+ rng2.setEnd(rng.endContainer, rng.endOffset);
17
+
18
+ elm = doc.createElement('body');
19
+ elm.appendChild(rng2.cloneContents());
20
+
21
+ // Check for text characters of other elements that should be treated as content
22
+ return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
23
+ };
24
+
25
+ tinymce.create('tinymce.plugins.TablePlugin', {
26
+ init : function(ed, url) {
27
+ var t = this;
28
+
29
+ t.editor = ed;
30
+ t.url = url;
31
+
32
+ // Register buttons
33
+ each([
34
+ ['table', 'table.desc', 'mceInsertTable', true],
35
+ ['delete_table', 'table.del', 'mceTableDelete'],
36
+ ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
37
+ ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
38
+ ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
39
+ ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
40
+ ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
41
+ ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
42
+ ['row_props', 'table.row_desc', 'mceTableRowProps', true],
43
+ ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
44
+ ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
45
+ ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
46
+ ], function(c) {
47
+ ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
48
+ });
49
+
50
+ if (ed.getParam('inline_styles')) {
51
+ // Force move of attribs to styles in strict mode
52
+ ed.onPreProcess.add(function(ed, o) {
53
+ var dom = ed.dom;
54
+
55
+ each(dom.select('table', o.node), function(n) {
56
+ var v;
57
+
58
+ if (v = dom.getAttrib(n, 'width')) {
59
+ dom.setStyle(n, 'width', v);
60
+ dom.setAttrib(n, 'width');
61
+ }
62
+
63
+ if (v = dom.getAttrib(n, 'height')) {
64
+ dom.setStyle(n, 'height', v);
65
+ dom.setAttrib(n, 'height');
66
+ }
67
+ });
68
+ });
69
+ }
70
+
71
+ ed.onInit.add(function() {
72
+ // Fixes an issue on Gecko where it's impossible to place the caret behind a table
73
+ // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
74
+ if (!tinymce.isIE && ed.getParam('forced_root_block')) {
75
+ function fixTableCaretPos() {
76
+ var last = ed.getBody().lastChild;
77
+
78
+ if (last && last.nodeName == 'TABLE')
79
+ ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
80
+ };
81
+
82
+ // Fixes an bug where it's impossible to place the caret before a table in Gecko
83
+ // this fix solves it by detecting when the caret is at the beginning of such a table
84
+ // and then manually moves the caret infront of the table
85
+ if (tinymce.isGecko) {
86
+ ed.onKeyDown.add(function(ed, e) {
87
+ var rng, table, dom = ed.dom;
88
+
89
+ // On gecko it's not possible to place the caret before a table
90
+ if (e.keyCode == 37 || e.keyCode == 38) {
91
+ rng = ed.selection.getRng();
92
+ table = dom.getParent(rng.startContainer, 'table');
93
+
94
+ if (table && ed.getBody().firstChild == table) {
95
+ if (isAtStart(rng, table)) {
96
+ rng = dom.createRng();
97
+
98
+ rng.setStartBefore(table);
99
+ rng.setEndBefore(table);
100
+
101
+ ed.selection.setRng(rng);
102
+
103
+ e.preventDefault();
104
+ }
105
+ }
106
+ }
107
+ });
108
+ }
109
+
110
+ ed.onKeyUp.add(fixTableCaretPos);
111
+ ed.onSetContent.add(fixTableCaretPos);
112
+ ed.onVisualAid.add(fixTableCaretPos);
113
+
114
+ ed.onPreProcess.add(function(ed, o) {
115
+ var last = o.node.lastChild;
116
+
117
+ if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
118
+ ed.dom.remove(last);
119
+ });
120
+
121
+ fixTableCaretPos();
122
+ }
123
+
124
+ if (ed && ed.plugins.contextmenu) {
125
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
126
+ var sm, se = ed.selection, el = se.getNode() || ed.getBody();
127
+
128
+ if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
129
+ m.removeAll();
130
+
131
+ if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
132
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
133
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
134
+ m.addSeparator();
135
+ }
136
+
137
+ if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
138
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
139
+ m.addSeparator();
140
+ }
141
+
142
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}});
143
+ m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true});
144
+ m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
145
+ m.addSeparator();
146
+
147
+ // Cell menu
148
+ sm = m.addMenu({title : 'table.cell'});
149
+ sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
150
+ sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
151
+ sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
152
+
153
+ // Row menu
154
+ sm = m.addMenu({title : 'table.row'});
155
+ sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true});
156
+ sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
157
+ sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
158
+ sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
159
+ sm.addSeparator();
160
+ sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
161
+ sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
162
+ sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
163
+ sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
164
+
165
+ // Column menu
166
+ sm = m.addMenu({title : 'table.col'});
167
+ sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
168
+ sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
169
+ sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
170
+ } else
171
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
172
+ });
173
+ }
174
+ });
175
+
176
+ // Add undo level when new rows are created using the tab key
177
+ ed.onKeyDown.add(function(ed, e) {
178
+ if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) {
179
+ if (!tinymce.isGecko && !tinymce.isOpera) {
180
+ tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true);
181
+ return tinymce.dom.Event.cancel(e);
182
+ }
183
+
184
+ ed.undoManager.add();
185
+ }
186
+ });
187
+
188
+ // Select whole table is a table border is clicked
189
+ if (!tinymce.isIE) {
190
+ if (ed.getParam('table_selection', true)) {
191
+ ed.onClick.add(function(ed, e) {
192
+ e = e.target;
193
+
194
+ if (e.nodeName === 'TABLE')
195
+ ed.selection.select(e);
196
+ });
197
+ }
198
+ }
199
+
200
+ ed.onNodeChange.add(function(ed, cm, n) {
201
+ var p = ed.dom.getParent(n, 'td,th,caption');
202
+
203
+ cm.setActive('table', n.nodeName === 'TABLE' || !!p);
204
+ if (p && p.nodeName === 'CAPTION')
205
+ p = null;
206
+
207
+ cm.setDisabled('delete_table', !p);
208
+ cm.setDisabled('delete_col', !p);
209
+ cm.setDisabled('delete_table', !p);
210
+ cm.setDisabled('delete_row', !p);
211
+ cm.setDisabled('col_after', !p);
212
+ cm.setDisabled('col_before', !p);
213
+ cm.setDisabled('row_after', !p);
214
+ cm.setDisabled('row_before', !p);
215
+ cm.setDisabled('row_props', !p);
216
+ cm.setDisabled('cell_props', !p);
217
+ cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
218
+ cm.setDisabled('merge_cells', !p);
219
+ });
220
+
221
+ // Padd empty table cells
222
+ if (!tinymce.isIE) {
223
+ ed.onBeforeSetContent.add(function(ed, o) {
224
+ if (o.initial)
225
+ o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2>&nbsp;</$1>' : '<$1$2><br mce_bogus="1" /></$1>');
226
+ });
227
+ }
228
+ },
229
+
230
+ execCommand : function(cmd, ui, val) {
231
+ var ed = this.editor, b;
232
+
233
+ // Is table command
234
+ switch (cmd) {
235
+ case "mceTableMoveToNextRow":
236
+ case "mceInsertTable":
237
+ case "mceTableRowProps":
238
+ case "mceTableCellProps":
239
+ case "mceTableSplitCells":
240
+ case "mceTableMergeCells":
241
+ case "mceTableInsertRowBefore":
242
+ case "mceTableInsertRowAfter":
243
+ case "mceTableDeleteRow":
244
+ case "mceTableInsertColBefore":
245
+ case "mceTableInsertColAfter":
246
+ case "mceTableDeleteCol":
247
+ case "mceTableCutRow":
248
+ case "mceTableCopyRow":
249
+ case "mceTablePasteRowBefore":
250
+ case "mceTablePasteRowAfter":
251
+ case "mceTableDelete":
252
+ ed.execCommand('mceBeginUndoLevel');
253
+ this._doExecCommand(cmd, ui, val);
254
+ ed.execCommand('mceEndUndoLevel');
255
+
256
+ return true;
257
+ }
258
+
259
+ // Pass to next handler in chain
260
+ return false;
261
+ },
262
+
263
+ getInfo : function() {
264
+ return {
265
+ longname : 'Tables',
266
+ author : 'Moxiecode Systems AB',
267
+ authorurl : 'http://tinymce.moxiecode.com',
268
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
269
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
270
+ };
271
+ },
272
+
273
+ // Private plugin internal methods
274
+
275
+ /**
276
+ * Executes the table commands.
277
+ */
278
+ _doExecCommand : function(command, user_interface, value) {
279
+ var inst = this.editor, ed = inst, url = this.url;
280
+ var focusElm = inst.selection.getNode();
281
+ var trElm = inst.dom.getParent(focusElm, "tr");
282
+ var tdElm = inst.dom.getParent(focusElm, "td,th");
283
+ var tableElm = inst.dom.getParent(focusElm, "table");
284
+ var doc = inst.contentWindow.document;
285
+ var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
286
+
287
+ // Get first TD if no TD found
288
+ if (trElm && tdElm == null)
289
+ tdElm = trElm.cells[0];
290
+
291
+ function inArray(ar, v) {
292
+ for (var i=0; i<ar.length; i++) {
293
+ // Is array
294
+ if (ar[i].length > 0 && inArray(ar[i], v))
295
+ return true;
296
+
297
+ // Found value
298
+ if (ar[i] == v)
299
+ return true;
300
+ }
301
+
302
+ return false;
303
+ }
304
+
305
+ function select(dx, dy) {
306
+ var td;
307
+
308
+ grid = getTableGrid(tableElm);
309
+ dx = dx || 0;
310
+ dy = dy || 0;
311
+ dx = Math.max(cpos.cellindex + dx, 0);
312
+ dy = Math.max(cpos.rowindex + dy, 0);
313
+
314
+ // Recalculate grid and select
315
+ inst.execCommand('mceRepaint');
316
+ td = getCell(grid, dy, dx);
317
+
318
+ if (td) {
319
+ inst.selection.select(td.firstChild || td);
320
+ inst.selection.collapse(1);
321
+ }
322
+ };
323
+
324
+ function makeTD() {
325
+ var newTD = doc.createElement("td");
326
+
327
+ if (!tinymce.isIE)
328
+ newTD.innerHTML = '<br mce_bogus="1"/>';
329
+ }
330
+
331
+ function getColRowSpan(td) {
332
+ var colspan = inst.dom.getAttrib(td, "colspan");
333
+ var rowspan = inst.dom.getAttrib(td, "rowspan");
334
+
335
+ colspan = colspan == "" ? 1 : parseInt(colspan);
336
+ rowspan = rowspan == "" ? 1 : parseInt(rowspan);
337
+
338
+ return {colspan : colspan, rowspan : rowspan};
339
+ }
340
+
341
+ function getCellPos(grid, td) {
342
+ var x, y;
343
+
344
+ for (y=0; y<grid.length; y++) {
345
+ for (x=0; x<grid[y].length; x++) {
346
+ if (grid[y][x] == td)
347
+ return {cellindex : x, rowindex : y};
348
+ }
349
+ }
350
+
351
+ return null;
352
+ }
353
+
354
+ function getCell(grid, row, col) {
355
+ if (grid[row] && grid[row][col])
356
+ return grid[row][col];
357
+
358
+ return null;
359
+ }
360
+
361
+ function getNextCell(table, cell) {
362
+ var cells = [], x = 0, i, j, cell, nextCell;
363
+
364
+ for (i = 0; i < table.rows.length; i++)
365
+ for (j = 0; j < table.rows[i].cells.length; j++, x++)
366
+ cells[x] = table.rows[i].cells[j];
367
+
368
+ for (i = 0; i < cells.length; i++)
369
+ if (cells[i] == cell)
370
+ if (nextCell = cells[i+1])
371
+ return nextCell;
372
+ }
373
+
374
+ function getTableGrid(table) {
375
+ var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2;
376
+
377
+ for (y=0; y<rows.length; y++) {
378
+ for (x=0; x<rows[y].cells.length; x++) {
379
+ td = rows[y].cells[x];
380
+ sd = getColRowSpan(td);
381
+
382
+ // All ready filled
383
+ for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
384
+
385
+ // Fill box
386
+ for (y2=y; y2<y+sd['rowspan']; y2++) {
387
+ if (!grid[y2])
388
+ grid[y2] = [];
389
+
390
+ for (x2=xstart; x2<xstart+sd['colspan']; x2++)
391
+ grid[y2][x2] = td;
392
+ }
393
+ }
394
+ }
395
+
396
+ return grid;
397
+ }
398
+
399
+ function trimRow(table, tr, td, new_tr) {
400
+ var grid = getTableGrid(table), cpos = getCellPos(grid, td);
401
+ var cells, lastElm;
402
+
403
+ // Time to crop away some
404
+ if (new_tr.cells.length != tr.childNodes.length) {
405
+ cells = tr.childNodes;
406
+ lastElm = null;
407
+
408
+ for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
409
+ var remove = true;
410
+ var sd = getColRowSpan(td);
411
+
412
+ // Remove due to rowspan
413
+ if (inArray(cells, td)) {
414
+ new_tr.childNodes[x]._delete = true;
415
+ } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
416
+ for (var i=x; i<x+td.colSpan; i++)
417
+ new_tr.childNodes[i]._delete = true;
418
+ }
419
+
420
+ if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
421
+ td.rowSpan = sd.rowspan + 1;
422
+
423
+ lastElm = td;
424
+ }
425
+
426
+ deleteMarked(tableElm);
427
+ }
428
+ }
429
+
430
+ function prevElm(node, name) {
431
+ while ((node = node.previousSibling) != null) {
432
+ if (node.nodeName == name)
433
+ return node;
434
+ }
435
+
436
+ return null;
437
+ }
438
+
439
+ function nextElm(node, names) {
440
+ var namesAr = names.split(',');
441
+
442
+ while ((node = node.nextSibling) != null) {
443
+ for (var i=0; i<namesAr.length; i++) {
444
+ if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
445
+ return node;
446
+ }
447
+ }
448
+
449
+ return null;
450
+ }
451
+
452
+ function deleteMarked(tbl) {
453
+ if (tbl.rows == 0)
454
+ return;
455
+
456
+ var tr = tbl.rows[0];
457
+ do {
458
+ var next = nextElm(tr, "TR");
459
+
460
+ // Delete row
461
+ if (tr._delete) {
462
+ tr.parentNode.removeChild(tr);
463
+ continue;
464
+ }
465
+
466
+ // Delete cells
467
+ var td = tr.cells[0];
468
+ if (td.cells > 1) {
469
+ do {
470
+ var nexttd = nextElm(td, "TD,TH");
471
+
472
+ if (td._delete)
473
+ td.parentNode.removeChild(td);
474
+ } while ((td = nexttd) != null);
475
+ }
476
+ } while ((tr = next) != null);
477
+ }
478
+
479
+ function addRows(td_elm, tr_elm, rowspan) {
480
+ // Add rows
481
+ td_elm.rowSpan = 1;
482
+ var trNext = nextElm(tr_elm, "TR");
483
+ for (var i=1; i<rowspan && trNext; i++) {
484
+ var newTD = doc.createElement("td");
485
+
486
+ if (!tinymce.isIE)
487
+ newTD.innerHTML = '<br mce_bogus="1"/>';
488
+
489
+ if (tinymce.isIE)
490
+ trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
491
+ else
492
+ trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
493
+
494
+ trNext = nextElm(trNext, "TR");
495
+ }
496
+ }
497
+
498
+ function copyRow(doc, table, tr) {
499
+ var grid = getTableGrid(table);
500
+ var newTR = tr.cloneNode(false);
501
+ var cpos = getCellPos(grid, tr.cells[0]);
502
+ var lastCell = null;
503
+ var tableBorder = inst.dom.getAttrib(table, "border");
504
+ var tdElm = null;
505
+
506
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
507
+ var newTD = null;
508
+
509
+ if (lastCell != tdElm) {
510
+ for (var i=0; i<tr.cells.length; i++) {
511
+ if (tdElm == tr.cells[i]) {
512
+ newTD = tdElm.cloneNode(true);
513
+ break;
514
+ }
515
+ }
516
+ }
517
+
518
+ if (newTD == null) {
519
+ newTD = doc.createElement("td");
520
+
521
+ if (!tinymce.isIE)
522
+ newTD.innerHTML = '<br mce_bogus="1"/>';
523
+ }
524
+
525
+ // Reset col/row span
526
+ newTD.colSpan = 1;
527
+ newTD.rowSpan = 1;
528
+
529
+ newTR.appendChild(newTD);
530
+
531
+ lastCell = tdElm;
532
+ }
533
+
534
+ return newTR;
535
+ }
536
+
537
+ // ---- Commands -----
538
+
539
+ // Handle commands
540
+ switch (command) {
541
+ case "mceTableMoveToNextRow":
542
+ var nextCell = getNextCell(tableElm, tdElm);
543
+
544
+ if (!nextCell) {
545
+ inst.execCommand("mceTableInsertRowAfter", tdElm);
546
+ nextCell = getNextCell(tableElm, tdElm);
547
+ }
548
+
549
+ inst.selection.select(nextCell);
550
+ inst.selection.collapse(true);
551
+
552
+ return true;
553
+
554
+ case "mceTableRowProps":
555
+ if (trElm == null)
556
+ return true;
557
+
558
+ if (user_interface) {
559
+ inst.windowManager.open({
560
+ url : url + '/row.htm',
561
+ width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
562
+ height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
563
+ inline : 1
564
+ }, {
565
+ plugin_url : url
566
+ });
567
+ }
568
+
569
+ return true;
570
+
571
+ case "mceTableCellProps":
572
+ if (tdElm == null)
573
+ return true;
574
+
575
+ if (user_interface) {
576
+ inst.windowManager.open({
577
+ url : url + '/cell.htm',
578
+ width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
579
+ height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
580
+ inline : 1
581
+ }, {
582
+ plugin_url : url
583
+ });
584
+ }
585
+
586
+ return true;
587
+
588
+ case "mceInsertTable":
589
+ if (user_interface) {
590
+ inst.windowManager.open({
591
+ url : url + '/table.htm',
592
+ width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
593
+ height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
594
+ inline : 1
595
+ }, {
596
+ plugin_url : url,
597
+ action : value ? value.action : 0
598
+ });
599
+ }
600
+
601
+ return true;
602
+
603
+ case "mceTableDelete":
604
+ var table = inst.dom.getParent(inst.selection.getNode(), "table");
605
+ if (table) {
606
+ table.parentNode.removeChild(table);
607
+ inst.execCommand('mceRepaint');
608
+ }
609
+ return true;
610
+
611
+ case "mceTableSplitCells":
612
+ case "mceTableMergeCells":
613
+ case "mceTableInsertRowBefore":
614
+ case "mceTableInsertRowAfter":
615
+ case "mceTableDeleteRow":
616
+ case "mceTableInsertColBefore":
617
+ case "mceTableInsertColAfter":
618
+ case "mceTableDeleteCol":
619
+ case "mceTableCutRow":
620
+ case "mceTableCopyRow":
621
+ case "mceTablePasteRowBefore":
622
+ case "mceTablePasteRowAfter":
623
+ // No table just return (invalid command)
624
+ if (!tableElm)
625
+ return true;
626
+
627
+ // Table has a tbody use that reference
628
+ // Changed logic by ApTest 2005.07.12 (www.aptest.com)
629
+ // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
630
+ if (trElm && tableElm != trElm.parentNode)
631
+ tableElm = trElm.parentNode;
632
+
633
+ if (tableElm && trElm) {
634
+ switch (command) {
635
+ case "mceTableCutRow":
636
+ if (!trElm || !tdElm)
637
+ return true;
638
+
639
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
640
+ inst.execCommand("mceTableDeleteRow");
641
+ break;
642
+
643
+ case "mceTableCopyRow":
644
+ if (!trElm || !tdElm)
645
+ return true;
646
+
647
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
648
+ break;
649
+
650
+ case "mceTablePasteRowBefore":
651
+ if (!trElm || !tdElm)
652
+ return true;
653
+
654
+ var newTR = inst.tableRowClipboard.cloneNode(true);
655
+
656
+ var prevTR = prevElm(trElm, "TR");
657
+ if (prevTR != null)
658
+ trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
659
+
660
+ trElm.parentNode.insertBefore(newTR, trElm);
661
+ break;
662
+
663
+ case "mceTablePasteRowAfter":
664
+ if (!trElm || !tdElm)
665
+ return true;
666
+
667
+ var nextTR = nextElm(trElm, "TR");
668
+ var newTR = inst.tableRowClipboard.cloneNode(true);
669
+
670
+ trimRow(tableElm, trElm, tdElm, newTR);
671
+
672
+ if (nextTR == null)
673
+ trElm.parentNode.appendChild(newTR);
674
+ else
675
+ nextTR.parentNode.insertBefore(newTR, nextTR);
676
+
677
+ break;
678
+
679
+ case "mceTableInsertRowBefore":
680
+ if (!trElm || !tdElm)
681
+ return true;
682
+
683
+ var grid = getTableGrid(tableElm);
684
+ var cpos = getCellPos(grid, tdElm);
685
+ var newTR = doc.createElement("tr");
686
+ var lastTDElm = null;
687
+
688
+ cpos.rowindex--;
689
+ if (cpos.rowindex < 0)
690
+ cpos.rowindex = 0;
691
+
692
+ // Create cells
693
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
694
+ if (tdElm != lastTDElm) {
695
+ var sd = getColRowSpan(tdElm);
696
+
697
+ if (sd['rowspan'] == 1) {
698
+ var newTD = doc.createElement("td");
699
+
700
+ if (!tinymce.isIE)
701
+ newTD.innerHTML = '<br mce_bogus="1"/>';
702
+
703
+ newTD.colSpan = tdElm.colSpan;
704
+
705
+ newTR.appendChild(newTD);
706
+ } else
707
+ tdElm.rowSpan = sd['rowspan'] + 1;
708
+
709
+ lastTDElm = tdElm;
710
+ }
711
+ }
712
+
713
+ trElm.parentNode.insertBefore(newTR, trElm);
714
+ select(0, 1);
715
+ break;
716
+
717
+ case "mceTableInsertRowAfter":
718
+ if (!trElm || !tdElm)
719
+ return true;
720
+
721
+ var grid = getTableGrid(tableElm);
722
+ var cpos = getCellPos(grid, tdElm);
723
+ var newTR = doc.createElement("tr");
724
+ var lastTDElm = null;
725
+
726
+ // Create cells
727
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
728
+ if (tdElm != lastTDElm) {
729
+ var sd = getColRowSpan(tdElm);
730
+
731
+ if (sd['rowspan'] == 1) {
732
+ var newTD = doc.createElement("td");
733
+
734
+ if (!tinymce.isIE)
735
+ newTD.innerHTML = '<br mce_bogus="1"/>';
736
+
737
+ newTD.colSpan = tdElm.colSpan;
738
+
739
+ newTR.appendChild(newTD);
740
+ } else
741
+ tdElm.rowSpan = sd['rowspan'] + 1;
742
+
743
+ lastTDElm = tdElm;
744
+ }
745
+ }
746
+
747
+ if (newTR.hasChildNodes()) {
748
+ var nextTR = nextElm(trElm, "TR");
749
+ if (nextTR)
750
+ nextTR.parentNode.insertBefore(newTR, nextTR);
751
+ else
752
+ tableElm.appendChild(newTR);
753
+ }
754
+
755
+ select(0, 1);
756
+ break;
757
+
758
+ case "mceTableDeleteRow":
759
+ if (!trElm || !tdElm)
760
+ return true;
761
+
762
+ var grid = getTableGrid(tableElm);
763
+ var cpos = getCellPos(grid, tdElm);
764
+
765
+ // Only one row, remove whole table
766
+ if (grid.length == 1 && tableElm.nodeName == 'TBODY') {
767
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
768
+ return true;
769
+ }
770
+
771
+ // Move down row spanned cells
772
+ var cells = trElm.cells;
773
+ var nextTR = nextElm(trElm, "TR");
774
+ for (var x=0; x<cells.length; x++) {
775
+ if (cells[x].rowSpan > 1) {
776
+ var newTD = cells[x].cloneNode(true);
777
+ var sd = getColRowSpan(cells[x]);
778
+
779
+ newTD.rowSpan = sd.rowspan - 1;
780
+
781
+ var nextTD = nextTR.cells[x];
782
+
783
+ if (nextTD == null)
784
+ nextTR.appendChild(newTD);
785
+ else
786
+ nextTR.insertBefore(newTD, nextTD);
787
+ }
788
+ }
789
+
790
+ // Delete cells
791
+ var lastTDElm = null;
792
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
793
+ if (tdElm != lastTDElm) {
794
+ var sd = getColRowSpan(tdElm);
795
+
796
+ if (sd.rowspan > 1) {
797
+ tdElm.rowSpan = sd.rowspan - 1;
798
+ } else {
799
+ trElm = tdElm.parentNode;
800
+
801
+ if (trElm.parentNode)
802
+ trElm._delete = true;
803
+ }
804
+
805
+ lastTDElm = tdElm;
806
+ }
807
+ }
808
+
809
+ deleteMarked(tableElm);
810
+
811
+ select(0, -1);
812
+ break;
813
+
814
+ case "mceTableInsertColBefore":
815
+ if (!trElm || !tdElm)
816
+ return true;
817
+
818
+ var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
819
+ var cpos = getCellPos(grid, tdElm);
820
+ var lastTDElm = null;
821
+
822
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
823
+ if (tdElm != lastTDElm) {
824
+ var sd = getColRowSpan(tdElm);
825
+
826
+ if (sd['colspan'] == 1) {
827
+ var newTD = doc.createElement(tdElm.nodeName);
828
+
829
+ if (!tinymce.isIE)
830
+ newTD.innerHTML = '<br mce_bogus="1"/>';
831
+
832
+ newTD.rowSpan = tdElm.rowSpan;
833
+
834
+ tdElm.parentNode.insertBefore(newTD, tdElm);
835
+ } else
836
+ tdElm.colSpan++;
837
+
838
+ lastTDElm = tdElm;
839
+ }
840
+ }
841
+
842
+ select();
843
+ break;
844
+
845
+ case "mceTableInsertColAfter":
846
+ if (!trElm || !tdElm)
847
+ return true;
848
+
849
+ var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
850
+ var cpos = getCellPos(grid, tdElm);
851
+ var lastTDElm = null;
852
+
853
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
854
+ if (tdElm != lastTDElm) {
855
+ var sd = getColRowSpan(tdElm);
856
+
857
+ if (sd['colspan'] == 1) {
858
+ var newTD = doc.createElement(tdElm.nodeName);
859
+
860
+ if (!tinymce.isIE)
861
+ newTD.innerHTML = '<br mce_bogus="1"/>';
862
+
863
+ newTD.rowSpan = tdElm.rowSpan;
864
+
865
+ var nextTD = nextElm(tdElm, "TD,TH");
866
+ if (nextTD == null)
867
+ tdElm.parentNode.appendChild(newTD);
868
+ else
869
+ nextTD.parentNode.insertBefore(newTD, nextTD);
870
+ } else
871
+ tdElm.colSpan++;
872
+
873
+ lastTDElm = tdElm;
874
+ }
875
+ }
876
+
877
+ select(1);
878
+ break;
879
+
880
+ case "mceTableDeleteCol":
881
+ if (!trElm || !tdElm)
882
+ return true;
883
+
884
+ var grid = getTableGrid(tableElm);
885
+ var cpos = getCellPos(grid, tdElm);
886
+ var lastTDElm = null;
887
+
888
+ // Only one col, remove whole table
889
+ if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') {
890
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
891
+ return true;
892
+ }
893
+
894
+ // Delete cells
895
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
896
+ if (tdElm != lastTDElm) {
897
+ var sd = getColRowSpan(tdElm);
898
+
899
+ if (sd['colspan'] > 1)
900
+ tdElm.colSpan = sd['colspan'] - 1;
901
+ else {
902
+ if (tdElm.parentNode)
903
+ tdElm.parentNode.removeChild(tdElm);
904
+ }
905
+
906
+ lastTDElm = tdElm;
907
+ }
908
+ }
909
+
910
+ select(-1);
911
+ break;
912
+
913
+ case "mceTableSplitCells":
914
+ if (!trElm || !tdElm)
915
+ return true;
916
+
917
+ var spandata = getColRowSpan(tdElm);
918
+
919
+ var colspan = spandata["colspan"];
920
+ var rowspan = spandata["rowspan"];
921
+
922
+ // Needs splitting
923
+ if (colspan > 1 || rowspan > 1) {
924
+ // Generate cols
925
+ tdElm.colSpan = 1;
926
+ for (var i=1; i<colspan; i++) {
927
+ var newTD = doc.createElement("td");
928
+
929
+ if (!tinymce.isIE)
930
+ newTD.innerHTML = '<br mce_bogus="1"/>';
931
+
932
+ trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
933
+
934
+ if (rowspan > 1)
935
+ addRows(newTD, trElm, rowspan);
936
+ }
937
+
938
+ addRows(tdElm, trElm, rowspan);
939
+ }
940
+
941
+ // Apply visual aids
942
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
943
+ break;
944
+
945
+ case "mceTableMergeCells":
946
+ var rows = [];
947
+ var sel = inst.selection.getSel();
948
+ var grid = getTableGrid(tableElm);
949
+
950
+ if (tinymce.isIE || sel.rangeCount == 1) {
951
+ if (user_interface) {
952
+ // Setup template
953
+ var sp = getColRowSpan(tdElm);
954
+
955
+ inst.windowManager.open({
956
+ url : url + '/merge_cells.htm',
957
+ width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
958
+ height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
959
+ inline : 1
960
+ }, {
961
+ action : "update",
962
+ numcols : sp.colspan,
963
+ numrows : sp.rowspan,
964
+ plugin_url : url
965
+ });
966
+
967
+ return true;
968
+ } else {
969
+ var numRows = parseInt(value['numrows']);
970
+ var numCols = parseInt(value['numcols']);
971
+ var cpos = getCellPos(grid, tdElm);
972
+
973
+ if (("" + numRows) == "NaN")
974
+ numRows = 1;
975
+
976
+ if (("" + numCols) == "NaN")
977
+ numCols = 1;
978
+
979
+ // Get rows and cells
980
+ var tRows = tableElm.rows;
981
+ for (var y=cpos.rowindex; y<grid.length; y++) {
982
+ var rowCells = [];
983
+
984
+ for (var x=cpos.cellindex; x<grid[y].length; x++) {
985
+ var td = getCell(grid, y, x);
986
+
987
+ if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
988
+ var cp = getCellPos(grid, td);
989
+
990
+ // Within range
991
+ if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
992
+ rowCells[rowCells.length] = td;
993
+ }
994
+ }
995
+
996
+ if (rowCells.length > 0)
997
+ rows[rows.length] = rowCells;
998
+
999
+ var td = getCell(grid, cpos.rowindex, cpos.cellindex);
1000
+ each(ed.dom.select('br', td), function(e, i) {
1001
+ if (i > 0 && ed.dom.getAttrib('mce_bogus'))
1002
+ ed.dom.remove(e);
1003
+ });
1004
+ }
1005
+
1006
+ //return true;
1007
+ }
1008
+ } else {
1009
+ var cells = [];
1010
+ var sel = inst.selection.getSel();
1011
+ var lastTR = null;
1012
+ var curRow = null;
1013
+ var x1 = -1, y1 = -1, x2, y2;
1014
+
1015
+ // Only one cell selected, whats the point?
1016
+ if (sel.rangeCount < 2)
1017
+ return true;
1018
+
1019
+ // Get all selected cells
1020
+ for (var i=0; i<sel.rangeCount; i++) {
1021
+ var rng = sel.getRangeAt(i);
1022
+ var tdElm = rng.startContainer.childNodes[rng.startOffset];
1023
+
1024
+ if (!tdElm)
1025
+ break;
1026
+
1027
+ if (tdElm.nodeName == "TD" || tdElm.nodeName == "TH")
1028
+ cells[cells.length] = tdElm;
1029
+ }
1030
+
1031
+ // Get rows and cells
1032
+ var tRows = tableElm.rows;
1033
+ for (var y=0; y<tRows.length; y++) {
1034
+ var rowCells = [];
1035
+
1036
+ for (var x=0; x<tRows[y].cells.length; x++) {
1037
+ var td = tRows[y].cells[x];
1038
+
1039
+ for (var i=0; i<cells.length; i++) {
1040
+ if (td == cells[i]) {
1041
+ rowCells[rowCells.length] = td;
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ if (rowCells.length > 0)
1047
+ rows[rows.length] = rowCells;
1048
+ }
1049
+
1050
+ // Find selected cells in grid and box
1051
+ var curRow = [];
1052
+ var lastTR = null;
1053
+ for (var y=0; y<grid.length; y++) {
1054
+ for (var x=0; x<grid[y].length; x++) {
1055
+ grid[y][x]._selected = false;
1056
+
1057
+ for (var i=0; i<cells.length; i++) {
1058
+ if (grid[y][x] == cells[i]) {
1059
+ // Get start pos
1060
+ if (x1 == -1) {
1061
+ x1 = x;
1062
+ y1 = y;
1063
+ }
1064
+
1065
+ // Get end pos
1066
+ x2 = x;
1067
+ y2 = y;
1068
+
1069
+ grid[y][x]._selected = true;
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+
1075
+ // Is there gaps, if so deny
1076
+ for (var y=y1; y<=y2; y++) {
1077
+ for (var x=x1; x<=x2; x++) {
1078
+ if (!grid[y][x]._selected) {
1079
+ alert("Invalid selection for merge.");
1080
+ return true;
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+
1086
+ // Validate selection and get total rowspan and colspan
1087
+ var rowSpan = 1, colSpan = 1;
1088
+
1089
+ // Validate horizontal and get total colspan
1090
+ var lastRowSpan = -1;
1091
+ for (var y=0; y<rows.length; y++) {
1092
+ var rowColSpan = 0;
1093
+
1094
+ for (var x=0; x<rows[y].length; x++) {
1095
+ var sd = getColRowSpan(rows[y][x]);
1096
+
1097
+ rowColSpan += sd['colspan'];
1098
+
1099
+ if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
1100
+ alert("Invalid selection for merge.");
1101
+ return true;
1102
+ }
1103
+
1104
+ lastRowSpan = sd['rowspan'];
1105
+ }
1106
+
1107
+ if (rowColSpan > colSpan)
1108
+ colSpan = rowColSpan;
1109
+
1110
+ lastRowSpan = -1;
1111
+ }
1112
+
1113
+ // Validate vertical and get total rowspan
1114
+ var lastColSpan = -1;
1115
+ for (var x=0; x<rows[0].length; x++) {
1116
+ var colRowSpan = 0;
1117
+
1118
+ for (var y=0; y<rows.length; y++) {
1119
+ var sd = getColRowSpan(rows[y][x]);
1120
+
1121
+ colRowSpan += sd['rowspan'];
1122
+
1123
+ if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
1124
+ alert("Invalid selection for merge.");
1125
+ return true;
1126
+ }
1127
+
1128
+ lastColSpan = sd['colspan'];
1129
+ }
1130
+
1131
+ if (colRowSpan > rowSpan)
1132
+ rowSpan = colRowSpan;
1133
+
1134
+ lastColSpan = -1;
1135
+ }
1136
+
1137
+ // Setup td
1138
+ tdElm = rows[0][0];
1139
+ tdElm.rowSpan = rowSpan;
1140
+ tdElm.colSpan = colSpan;
1141
+
1142
+ // Merge cells
1143
+ for (var y=0; y<rows.length; y++) {
1144
+ for (var x=0; x<rows[y].length; x++) {
1145
+ var html = rows[y][x].innerHTML;
1146
+ var chk = html.replace(/[ \t\r\n]/g, "");
1147
+
1148
+ if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0))
1149
+ tdElm.innerHTML += html;
1150
+
1151
+ // Not current cell
1152
+ if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
1153
+ var cpos = getCellPos(grid, rows[y][x]);
1154
+ var tr = rows[y][x].parentNode;
1155
+
1156
+ tr.removeChild(rows[y][x]);
1157
+ rows[y][x]._deleted = true;
1158
+
1159
+ // Empty TR, remove it
1160
+ if (!tr.hasChildNodes()) {
1161
+ tr.parentNode.removeChild(tr);
1162
+
1163
+ var lastCell = null;
1164
+ for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
1165
+ if (cellElm != lastCell && cellElm.rowSpan > 1)
1166
+ cellElm.rowSpan--;
1167
+
1168
+ lastCell = cellElm;
1169
+ }
1170
+
1171
+ if (tdElm.rowSpan > 1)
1172
+ tdElm.rowSpan--;
1173
+ }
1174
+ }
1175
+ }
1176
+ }
1177
+
1178
+ // Remove all but one bogus br
1179
+ each(ed.dom.select('br', tdElm), function(e, i) {
1180
+ if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus'))
1181
+ ed.dom.remove(e);
1182
+ });
1183
+
1184
+ break;
1185
+ }
1186
+
1187
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
1188
+ inst.addVisual(tableElm);
1189
+ inst.nodeChanged();
1190
+ }
1191
+
1192
+ return true;
1193
+ }
1194
+
1195
+ // Pass to next handler in chain
1196
+ return false;
1197
+ }
1198
+ });
1199
+
1200
+ // Register plugin
1201
+ tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
1202
+ })();