tinymce_rails 3.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/README.md +14 -0
  4. data/Rakefile +1 -0
  5. data/lib/tinymce_rails.rb +11 -0
  6. data/lib/tinymce_rails/version.rb +3 -0
  7. data/tinymce_rails.gemspec +24 -0
  8. data/vendor/assets/javascripts/tiny_mce/jquery.tinymce.js +1 -0
  9. data/vendor/assets/javascripts/tiny_mce/langs/en.js +218 -0
  10. data/vendor/assets/javascripts/tiny_mce/license.txt +504 -0
  11. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
  12. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
  13. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
  14. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
  15. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +7 -0
  16. data/vendor/assets/javascripts/tiny_mce/plugins/advhr/rule.htm +58 -0
  17. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
  18. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
  19. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
  20. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/image.htm +235 -0
  21. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  22. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js +445 -0
  23. data/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +45 -0
  24. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
  25. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
  26. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
  27. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
  28. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +54 -0
  29. data/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm +338 -0
  30. data/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
  31. data/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
  32. data/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js +1 -0
  33. data/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js +156 -0
  34. data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
  35. data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +119 -0
  36. data/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
  37. data/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
  38. data/vendor/assets/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
  39. data/vendor/assets/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
  40. data/vendor/assets/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
  41. data/vendor/assets/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
  42. data/vendor/assets/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +156 -0
  43. data/vendor/assets/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
  44. data/vendor/assets/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
  45. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
  46. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
  47. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/emotions.htm +41 -0
  48. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
  49. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
  50. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  51. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  52. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
  53. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
  54. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
  55. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  56. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  57. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  58. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  59. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  60. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  61. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
  62. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  63. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
  64. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
  65. data/vendor/assets/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
  66. data/vendor/assets/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
  67. data/vendor/assets/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
  68. data/vendor/assets/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
  69. data/vendor/assets/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
  70. data/vendor/assets/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
  71. data/vendor/assets/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
  72. data/vendor/assets/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
  73. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
  74. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
  75. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +182 -0
  76. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
  77. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
  78. data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
  79. data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
  80. data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +151 -0
  81. data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
  82. data/vendor/assets/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
  83. data/vendor/assets/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
  84. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
  85. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +696 -0
  86. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  87. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  88. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  89. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  90. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  91. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  92. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  93. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +100 -0
  94. data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
  95. data/vendor/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
  96. data/vendor/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  97. data/vendor/assets/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
  98. data/vendor/assets/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
  99. data/vendor/assets/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
  100. data/vendor/assets/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
  101. data/vendor/assets/javascripts/tiny_mce/plugins/lists/editor_plugin.js +1 -0
  102. data/vendor/assets/javascripts/tiny_mce/plugins/lists/editor_plugin_src.js +617 -0
  103. data/vendor/assets/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
  104. data/vendor/assets/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
  105. data/vendor/assets/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
  106. data/vendor/assets/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
  107. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
  108. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
  109. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
  110. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
  111. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
  112. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
  113. data/vendor/assets/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
  114. data/vendor/assets/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
  115. data/vendor/assets/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
  116. data/vendor/assets/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
  117. data/vendor/assets/javascripts/tiny_mce/plugins/media/media.htm +818 -0
  118. data/vendor/assets/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
  119. data/vendor/assets/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
  120. data/vendor/assets/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
  121. data/vendor/assets/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
  122. data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
  123. data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
  124. data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
  125. data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
  126. data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
  127. data/vendor/assets/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
  128. data/vendor/assets/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +1035 -0
  129. data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
  130. data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
  131. data/vendor/assets/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
  132. data/vendor/assets/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
  133. data/vendor/assets/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
  134. data/vendor/assets/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
  135. data/vendor/assets/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
  136. data/vendor/assets/javascripts/tiny_mce/plugins/preview/example.html +28 -0
  137. data/vendor/assets/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
  138. data/vendor/assets/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
  139. data/vendor/assets/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
  140. data/vendor/assets/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
  141. data/vendor/assets/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
  142. data/vendor/assets/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
  143. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
  144. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
  145. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
  146. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +140 -0
  147. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
  148. data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +100 -0
  149. data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
  150. data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
  151. data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +417 -0
  152. data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
  153. data/vendor/assets/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
  154. data/vendor/assets/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
  155. data/vendor/assets/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
  156. data/vendor/assets/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
  157. data/vendor/assets/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +70 -0
  158. data/vendor/assets/javascripts/tiny_mce/plugins/style/props.htm +838 -0
  159. data/vendor/assets/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
  160. data/vendor/assets/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +114 -0
  161. data/vendor/assets/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
  162. data/vendor/assets/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
  163. data/vendor/assets/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
  164. data/vendor/assets/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
  165. data/vendor/assets/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
  166. data/vendor/assets/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1139 -0
  167. data/vendor/assets/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
  168. data/vendor/assets/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
  169. data/vendor/assets/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
  170. data/vendor/assets/javascripts/tiny_mce/plugins/table/js/table.js +454 -0
  171. data/vendor/assets/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
  172. data/vendor/assets/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
  173. data/vendor/assets/javascripts/tiny_mce/plugins/table/row.htm +157 -0
  174. data/vendor/assets/javascripts/tiny_mce/plugins/table/table.htm +188 -0
  175. data/vendor/assets/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
  176. data/vendor/assets/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
  177. data/vendor/assets/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
  178. data/vendor/assets/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
  179. data/vendor/assets/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
  180. data/vendor/assets/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
  181. data/vendor/assets/javascripts/tiny_mce/plugins/template/template.htm +31 -0
  182. data/vendor/assets/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
  183. data/vendor/assets/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +83 -0
  184. data/vendor/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  185. data/vendor/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
  186. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +142 -0
  187. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +142 -0
  188. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +149 -0
  189. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +142 -0
  190. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
  191. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
  192. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +162 -0
  193. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  194. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
  195. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +162 -0
  196. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
  197. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
  198. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
  199. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
  200. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +53 -0
  201. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
  202. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +52 -0
  203. data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  204. data/vendor/assets/javascripts/tiny_mce/themes/advanced/about.htm +48 -0
  205. data/vendor/assets/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
  206. data/vendor/assets/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
  207. data/vendor/assets/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -0
  208. data/vendor/assets/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
  209. data/vendor/assets/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1326 -0
  210. data/vendor/assets/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
  211. data/vendor/assets/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  212. data/vendor/assets/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  213. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/about.js +73 -0
  214. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
  215. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/charmap.js +353 -0
  216. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -0
  217. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/image.js +247 -0
  218. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
  219. data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -0
  220. data/vendor/assets/javascripts/tiny_mce/themes/advanced/langs/en.js +68 -0
  221. data/vendor/assets/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +53 -0
  222. data/vendor/assets/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
  223. data/vendor/assets/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -0
  224. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/content.css +37 -0
  225. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
  226. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  227. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  228. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  229. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  230. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  231. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  232. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
  233. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/content.css +23 -0
  234. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +105 -0
  235. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css +101 -0
  236. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +36 -0
  237. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
  238. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  239. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  240. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  241. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
  242. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  243. data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  244. data/vendor/assets/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -0
  245. data/vendor/assets/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
  246. data/vendor/assets/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
  247. data/vendor/assets/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
  248. data/vendor/assets/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
  249. data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
  250. data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
  251. data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
  252. data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  253. data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
  254. data/vendor/assets/javascripts/tiny_mce/tiny_mce.js +1 -0
  255. data/vendor/assets/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
  256. data/vendor/assets/javascripts/tiny_mce/tiny_mce_src.js +13913 -0
  257. data/vendor/assets/javascripts/tiny_mce/utils/editable_selects.js +70 -0
  258. data/vendor/assets/javascripts/tiny_mce/utils/form_utils.js +206 -0
  259. data/vendor/assets/javascripts/tiny_mce/utils/mctabs.js +151 -0
  260. data/vendor/assets/javascripts/tiny_mce/utils/validate.js +252 -0
  261. metadata +305 -0
@@ -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(r){n=c.select(":input:enabled,*[tabindex]");function i(s){return s.type!="hidden"&&s.tabIndex!="-1"&&!(n[m].style.display=="none")&&!(n[m].style.visibility=="hidden")}d(n,function(t,s){if(t.id==l.id){j=s;return false}});if(r>0){for(m=j+1;m<n.length;m++){if(i(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(i(n[m])){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(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){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)}},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,114 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2009, 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 DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
13
+
14
+ tinymce.create('tinymce.plugins.TabFocusPlugin', {
15
+ init : function(ed, url) {
16
+ function tabCancel(ed, e) {
17
+ if (e.keyCode === 9)
18
+ return Event.cancel(e);
19
+ };
20
+
21
+ function tabHandler(ed, e) {
22
+ var x, i, f, el, v;
23
+
24
+ function find(d) {
25
+ el = DOM.select(':input:enabled,*[tabindex]');
26
+ function canSelect(e) {
27
+ return e.type != 'hidden' &&
28
+ e.tabIndex != '-1' &&
29
+ !(el[i].style.display == "none") &&
30
+ !(el[i].style.visibility == "hidden");
31
+ }
32
+
33
+ each(el, function(e, i) {
34
+ if (e.id == ed.id) {
35
+ x = i;
36
+ return false;
37
+ }
38
+ });
39
+
40
+ if (d > 0) {
41
+ for (i = x + 1; i < el.length; i++) {
42
+ if (canSelect(el[i]))
43
+ return el[i];
44
+ }
45
+ } else {
46
+ for (i = x - 1; i >= 0; i--) {
47
+ if (canSelect(el[i]))
48
+ return el[i];
49
+ }
50
+ }
51
+
52
+ return null;
53
+ };
54
+
55
+ if (e.keyCode === 9) {
56
+ v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
57
+
58
+ if (v.length == 1) {
59
+ v[1] = v[0];
60
+ v[0] = ':prev';
61
+ }
62
+
63
+ // Find element to focus
64
+ if (e.shiftKey) {
65
+ if (v[0] == ':prev')
66
+ el = find(-1);
67
+ else
68
+ el = DOM.get(v[0]);
69
+ } else {
70
+ if (v[1] == ':next')
71
+ el = find(1);
72
+ else
73
+ el = DOM.get(v[1]);
74
+ }
75
+
76
+ if (el) {
77
+ if (el.id && (ed = tinymce.get(el.id || el.name)))
78
+ ed.focus();
79
+ else
80
+ window.setTimeout(function() {
81
+ if (!tinymce.isWebKit)
82
+ window.focus();
83
+ el.focus();
84
+ }, 10);
85
+
86
+ return Event.cancel(e);
87
+ }
88
+ }
89
+ };
90
+
91
+ ed.onKeyUp.add(tabCancel);
92
+
93
+ if (tinymce.isGecko) {
94
+ ed.onKeyPress.add(tabHandler);
95
+ ed.onKeyDown.add(tabCancel);
96
+ } else
97
+ ed.onKeyDown.add(tabHandler);
98
+
99
+ },
100
+
101
+ getInfo : function() {
102
+ return {
103
+ longname : 'Tabfocus',
104
+ author : 'Moxiecode Systems AB',
105
+ authorurl : 'http://tinymce.moxiecode.com',
106
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
107
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
108
+ };
109
+ }
110
+ });
111
+
112
+ // Register plugin
113
+ tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
114
+ })();
@@ -0,0 +1,178 @@
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" role="application">
13
+ <form onsubmit="updateAction();return false;" action="#">
14
+ <div class="tabs">
15
+ <ul>
16
+ <li id="general_tab" class="current" aria-controls="general_panel"><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" aria-controls="advanced_panel"><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 role="presentation" 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 role="presentation" 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 role="presentation" 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 role="group" aria-labelledby="bordercolor_label">
137
+ <td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
138
+ <td>
139
+ <table role="presentation" 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 role="group" aria-labelledby="bgcolor_label">
149
+ <td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
150
+ <td>
151
+ <table role="presentation" 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
+ <input type="submit" id="insert" name="insert" value="{#update}" />
174
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
175
+ </div>
176
+ </form>
177
+ </body>
178
+ </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(c){var d=c.each;function b(f,g){var h=g.ownerDocument,e=h.createRange(),j;e.setStartBefore(g);e.setEnd(f.endContainer,f.endOffset);j=h.createElement("body");j.appendChild(e.cloneContents());return j.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(G,F,J){var f,K,C,o;s();o=F.getParent(J.getStart(),"th,td");if(o){K=E(o);C=H();o=w(K.x,K.y)}function z(M,L){M=M.cloneNode(L);M.removeAttribute("id");return M}function s(){var L=0;f=[];d(["thead","tbody","tfoot"],function(M){var N=F.select("> "+M+" tr",G);d(N,function(O,P){P+=L;d(F.select("> td, > th",O),function(V,Q){var R,S,T,U;if(f[P]){while(f[P][Q]){Q++}}T=h(V,"rowspan");U=h(V,"colspan");for(S=P;S<P+T;S++){if(!f[S]){f[S]=[]}for(R=Q;R<Q+U;R++){f[S][R]={part:M,real:S==P&&R==Q,elm:V,rowspan:T,colspan:U}}}})});L+=N.length})}function w(L,N){var M;M=f[N];if(M){return M[L]}}function h(M,L){return parseInt(M.getAttribute(L)||1)}function j(L){return F.hasClass(L.elm,"mceSelected")||L==o}function k(){var L=[];d(G.rows,function(M){d(M.cells,function(N){if(F.hasClass(N,"mceSelected")||N==o.elm){L.push(M);return false}})});return L}function r(){var L=F.createRng();L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G)}function e(L){var M;c.walk(L,function(O){var N;if(O.nodeType==3){d(F.getParents(O.parentNode,null,L).reverse(),function(P){P=z(P,false);if(!M){M=N=P}else{if(N){N.appendChild(P)}}N=P});if(N){N.innerHTML=c.isIE?"&nbsp;":'<br _mce_bogus="1" />'}return false}},"childNodes");L=z(L,false);L.rowSpan=L.colSpan=1;if(M){L.appendChild(M)}else{if(!c.isIE){L.innerHTML='<br _mce_bogus="1" />'}}return L}function q(){var L=F.createRng();d(F.select("tr",G),function(M){if(M.cells.length==0){F.remove(M)}});if(F.select("tr",G).length==0){L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G);return}d(F.select("thead,tbody,tfoot",G),function(M){if(M.rows.length==0){F.remove(M)}});s();row=f[Math.min(f.length-1,K.y)];if(row){J.select(row[Math.min(row.length-1,K.x)].elm,true);J.collapse(true)}}function t(R,P,T,Q){var O,M,L,N,S;O=f[P][R].elm.parentNode;for(L=1;L<=T;L++){O=F.getNext(O,"tr");if(O){for(M=R;M>=0;M--){S=f[P+L][M].elm;if(S.parentNode==O){for(N=1;N<=Q;N++){F.insertAfter(e(S),S)}break}}if(M==-1){for(N=1;N<=Q;N++){O.insertBefore(e(O.cells[0]),O.cells[0])}}}}}function B(){d(f,function(L,M){d(L,function(O,N){var R,Q,S,P;if(j(O)){O=O.elm;R=h(O,"colspan");Q=h(O,"rowspan");if(R>1||Q>1){O.colSpan=O.rowSpan=1;for(P=0;P<R-1;P++){F.insertAfter(e(O),O)}t(N,M,Q-1,R)}}})})}function p(T,Q,W){var O,N,V,U,S,P,R,L,T,M;if(T){pos=E(T);O=pos.x;N=pos.y;V=O+(Q-1);U=N+(W-1)}else{O=K.x;N=K.y;V=C.x;U=C.y}R=w(O,N);L=w(V,U);if(R&&L&&R.part==L.part){B();s();R=w(O,N).elm;R.colSpan=(V-O)+1;R.rowSpan=(U-N)+1;for(P=N;P<=U;P++){for(S=O;S<=V;S++){T=f[P][S].elm;if(T!=R){M=c.grep(T.childNodes);d(M,function(Y,X){if(Y.nodeName!="BR"||X!=M.length-1){R.appendChild(Y)}});F.remove(T)}}}q()}}function l(O){var L,Q,N,P,R,S,M,T;d(f,function(U,V){d(U,function(X,W){if(j(X)){X=X.elm;R=X.parentNode;S=z(R,false);L=V;if(O){return false}}});if(O){return !L}});for(P=0;P<f[0].length;P++){Q=f[L][P].elm;if(Q!=N){if(!O){rowSpan=h(Q,"rowspan");if(rowSpan>1){Q.rowSpan=rowSpan+1;continue}}else{if(L>0&&f[L-1][P]){T=f[L-1][P].elm;rowSpan=h(T,"rowspan");if(rowSpan>1){T.rowSpan=rowSpan+1;continue}}}M=e(Q);M.colSpan=Q.colSpan;S.appendChild(M);N=Q}}if(S.hasChildNodes()){if(!O){F.insertAfter(S,R)}else{R.parentNode.insertBefore(S,R)}}}function g(M){var N,L;d(f,function(O,P){d(O,function(R,Q){if(j(R)){N=Q;if(M){return false}}});if(M){return !N}});d(f,function(R,S){var O=R[N].elm,P,Q;if(O!=L){Q=h(O,"colspan");P=h(O,"rowspan");if(Q==1){if(!M){F.insertAfter(e(O),O);t(N,S,P-1,Q)}else{O.parentNode.insertBefore(e(O),O);t(N,S,P-1,Q)}}else{O.colSpan++}L=O}})}function n(){var L=[];d(f,function(M,N){d(M,function(P,O){if(j(P)&&c.inArray(L,O)===-1){d(f,function(S){var Q=S[O].elm,R;R=h(Q,"colspan");if(R>1){Q.colSpan=R-1}else{F.remove(Q)}});L.push(O)}})});q()}function m(){var M;function L(P){var O,Q,N;O=F.getNext(P,"tr");d(P.cells,function(R){var S=h(R,"rowspan");if(S>1){R.rowSpan=S-1;Q=E(R);t(Q.x,Q.y,1,1)}});Q=E(P.cells[0]);d(f[Q.y],function(R){var S;R=R.elm;if(R!=N){S=h(R,"rowspan");if(S<=1){F.remove(R)}else{R.rowSpan=S-1}N=R}})}M=k();d(M.reverse(),function(N){L(N)});q()}function D(){var L=k();F.remove(L);q();return L}function I(){var L=k();d(L,function(N,M){L[M]=z(N,true)});return L}function A(N,M){var O=k(),L=O[M?0:O.length-1],P=L.cells.length;d(f,function(R){var Q;P=0;d(R,function(T,S){if(T.real){P+=T.colspan}if(T.elm.parentNode==L){Q=1}});if(Q){return false}});if(!M){N.reverse()}d(N,function(S){var R=S.cells.length,Q;for(i=0;i<R;i++){Q=S.cells[i];Q.colSpan=Q.rowSpan=1}for(i=R;i<P;i++){S.appendChild(e(S.cells[R-1]))}for(i=P;i<R;i++){F.remove(S.cells[i])}if(M){L.parentNode.insertBefore(S,L)}else{F.insertAfter(S,L)}})}function E(L){var M;d(f,function(N,O){d(N,function(Q,P){if(Q.elm==L){M={x:P,y:O};return false}});return !M});return M}function v(L){K=E(L)}function H(){var N,M,L;M=L=0;d(f,function(O,P){d(O,function(R,Q){var T,S;if(j(R)){R=f[P][Q];if(Q>M){M=Q}if(P>L){L=P}if(R.real){T=R.colspan-1;S=R.rowspan-1;if(T){if(Q+T>M){M=Q+T}}if(S){if(P+S>L){L=P+S}}}}})});return{x:M,y:L}}function u(R){var O,N,T,S,M,L,P,Q;C=E(R);if(K&&C){O=Math.min(K.x,C.x);N=Math.min(K.y,C.y);T=Math.max(K.x,C.x);S=Math.max(K.y,C.y);M=T;L=S;for(y=N;y<=L;y++){R=f[y][O];if(!R.real){if(O-(R.colspan-1)<O){O-=R.colspan-1}}}for(x=O;x<=M;x++){R=f[N][x];if(!R.real){if(N-(R.rowspan-1)<N){N-=R.rowspan-1}}}for(y=N;y<=S;y++){for(x=O;x<=T;x++){R=f[y][x];if(R.real){P=R.colspan-1;Q=R.rowspan-1;if(P){if(x+P>M){M=x+P}}if(Q){if(y+Q>L){L=y+Q}}}}}F.removeClass(F.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=N;y<=L;y++){for(x=O;x<=M;x++){F.addClass(f[y][x].elm,"mceSelected")}}}}c.extend(this,{deleteTable:r,split:B,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:D,copyRows:I,pasteRows:A,getPos:E,setStartCell:v,setEndCell:u})}c.create("tinymce.plugins.TablePlugin",{init:function(f,g){var e,k;function j(n){var m=f.selection,l=f.dom.getParent(n||m.getNode(),"table");if(l){return new a(l,f.dom,m)}}function h(){f.getBody().style.webkitUserSelect="";f.dom.removeClass(f.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}d([["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(l){f.addButton(l[0],{title:l[1],cmd:l[2],ui:l[3]})});if(!c.isIE){f.onClick.add(function(l,m){m=m.target;if(m.nodeName==="TABLE"){l.selection.select(m)}})}f.onNodeChange.add(function(m,l,q){var o;q=m.selection.getStart();o=m.dom.getParent(q,"td,th,caption");l.setActive("table",q.nodeName==="TABLE"||!!o);if(o&&o.nodeName==="CAPTION"){o=0}l.setDisabled("delete_table",!o);l.setDisabled("delete_col",!o);l.setDisabled("delete_table",!o);l.setDisabled("delete_row",!o);l.setDisabled("col_after",!o);l.setDisabled("col_before",!o);l.setDisabled("row_after",!o);l.setDisabled("row_before",!o);l.setDisabled("row_props",!o);l.setDisabled("cell_props",!o);l.setDisabled("split_cells",!o);l.setDisabled("merge_cells",!o)});f.onInit.add(function(m){var l,p,q=m.dom,n;e=m.windowManager;m.onMouseDown.add(function(r,s){if(s.button!=2){h();p=q.getParent(s.target,"td,th");l=q.getParent(p,"table")}});q.bind(m.getDoc(),"mouseover",function(u){var s,r,t=u.target;if(p&&(n||t!=p)&&(t.nodeName=="TD"||t.nodeName=="TH")){r=q.getParent(t,"table");if(r==l){if(!n){n=j(r);n.setStartCell(p);m.getBody().style.webkitUserSelect="none"}n.setEndCell(t)}s=m.selection.getSel();if(s.removeAllRanges){s.removeAllRanges()}else{s.empty()}u.preventDefault()}});m.onMouseUp.add(function(A,B){var s,u=A.selection,C,D=u.getSel(),r,v,t,z;if(p){if(n){A.getBody().style.webkitUserSelect=""}function w(E,G){var F=new c.dom.TreeWalker(E,E);do{if(E.nodeType==3&&c.trim(E.nodeValue).length!=0){if(G){s.setStart(E,0)}else{s.setEnd(E,E.nodeValue.length)}return}if(E.nodeName=="BR"){if(G){s.setStartBefore(E)}else{s.setEndBefore(E)}return}}while(E=(G?F.next():F.prev()))}C=q.select("td.mceSelected,th.mceSelected");if(C.length>0){s=q.createRng();v=C[0];z=C[C.length-1];w(v,1);r=new c.dom.TreeWalker(v,q.getParent(C[0],"table"));do{if(v.nodeName=="TD"||v.nodeName=="TH"){if(!q.hasClass(v,"mceSelected")){break}t=v}}while(v=r.next());w(t);u.setRng(s)}A.nodeChanged();p=n=l=null}});m.onKeyUp.add(function(r,s){h()});if(m&&m.plugins.contextmenu){m.plugins.contextmenu.onContextMenu.add(function(t,r,v){var w,u=m.selection,s=u.getNode()||m.getBody();if(m.dom.getParent(v,"td")||m.dom.getParent(v,"th")||m.dom.select("td.mceSelected,th.mceSelected").length){r.removeAll();if(s.nodeName=="A"&&!m.dom.getAttrib(s,"name")){r.add({title:"advanced.link_desc",icon:"link",cmd:m.plugins.advlink?"mceAdvLink":"mceLink",ui:true});r.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});r.addSeparator()}if(s.nodeName=="IMG"&&s.className.indexOf("mceItem")==-1){r.add({title:"advanced.image_desc",icon:"image",cmd:m.plugins.advimage?"mceAdvImage":"mceImage",ui:true});r.addSeparator()}r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});r.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});r.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});r.addSeparator();w=r.addMenu({title:"table.cell"});w.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});w.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});w.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});w=r.addMenu({title:"table.row"});w.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});w.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});w.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});w.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});w.addSeparator();w.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});w.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});w.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!k);w.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!k);w=r.addMenu({title:"table.col"});w.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});w.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});w.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!c.isIE){function o(){var r;for(r=m.getBody().lastChild;r&&r.nodeType==3&&!r.nodeValue.length;r=r.previousSibling){}if(r&&r.nodeName=="TABLE"){m.dom.add(m.getBody(),"p",null,'<br mce_bogus="1" />')}}if(c.isGecko){m.onKeyDown.add(function(s,u){var r,t,v=s.dom;if(u.keyCode==37||u.keyCode==38){r=s.selection.getRng();t=v.getParent(r.startContainer,"table");if(t&&s.getBody().firstChild==t){if(b(r,t)){r=v.createRng();r.setStartBefore(t);r.setEndBefore(t);s.selection.setRng(r);u.preventDefault()}}}})}m.onKeyUp.add(o);m.onSetContent.add(o);m.onVisualAid.add(o);m.onPreProcess.add(function(r,t){var s=t.node.lastChild;if(s&&s.childNodes.length==1&&s.firstChild.nodeName=="BR"){r.dom.remove(s)}});o()}});d({mceTableSplitCells:function(l){l.split()},mceTableMergeCells:function(m){var n,o,l;l=f.dom.getParent(f.selection.getNode(),"th,td");if(l){n=l.rowSpan;o=l.colSpan}if(!f.dom.select("td.mceSelected,th.mceSelected").length){e.open({url:g+"/merge_cells.htm",width:240+parseInt(f.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(f.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:n,cols:o,onaction:function(p){m.merge(l,p.cols,p.rows)},plugin_url:g})}else{m.merge()}},mceTableInsertRowBefore:function(l){l.insertRow(true)},mceTableInsertRowAfter:function(l){l.insertRow()},mceTableInsertColBefore:function(l){l.insertCol(true)},mceTableInsertColAfter:function(l){l.insertCol()},mceTableDeleteCol:function(l){l.deleteCols()},mceTableDeleteRow:function(l){l.deleteRows()},mceTableCutRow:function(l){k=l.cutRows()},mceTableCopyRow:function(l){k=l.copyRows()},mceTablePasteRowBefore:function(l){l.pasteRows(k,true)},mceTablePasteRowAfter:function(l){l.pasteRows(k)},mceTableDelete:function(l){l.deleteTable()}},function(m,l){f.addCommand(l,function(){var n=j();if(n){m(n);f.execCommand("mceRepaint");h()}})});d({mceInsertTable:function(l){e.open({url:g+"/table.htm",width:400+parseInt(f.getLang("table.table_delta_width",0)),height:320+parseInt(f.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:l?l.action:0})},mceTableRowProps:function(){e.open({url:g+"/row.htm",width:400+parseInt(f.getLang("table.rowprops_delta_width",0)),height:295+parseInt(f.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})},mceTableCellProps:function(){e.open({url:g+"/cell.htm",width:400+parseInt(f.getLang("table.cellprops_delta_width",0)),height:295+parseInt(f.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}},function(m,l){f.addCommand(l,function(n,o){m(o)})})}});c.PluginManager.add("table",c.plugins.TablePlugin)})(tinymce);
@@ -0,0 +1,1139 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2009, 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(tinymce) {
12
+ var each = tinymce.each;
13
+
14
+ // Checks if the selection/caret is at the start of the specified block element
15
+ function isAtStart(rng, par) {
16
+ var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
17
+
18
+ rng2.setStartBefore(par);
19
+ rng2.setEnd(rng.endContainer, rng.endOffset);
20
+
21
+ elm = doc.createElement('body');
22
+ elm.appendChild(rng2.cloneContents());
23
+
24
+ // Check for text characters of other elements that should be treated as content
25
+ return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
26
+ };
27
+
28
+ /**
29
+ * Table Grid class.
30
+ */
31
+ function TableGrid(table, dom, selection) {
32
+ var grid, startPos, endPos, selectedCell;
33
+
34
+ buildGrid();
35
+ selectedCell = dom.getParent(selection.getStart(), 'th,td');
36
+ if (selectedCell) {
37
+ startPos = getPos(selectedCell);
38
+ endPos = findEndPos();
39
+ selectedCell = getCell(startPos.x, startPos.y);
40
+ }
41
+
42
+ function cloneNode(node, children) {
43
+ node = node.cloneNode(children);
44
+ node.removeAttribute('id');
45
+
46
+ return node;
47
+ }
48
+
49
+ function buildGrid() {
50
+ var startY = 0;
51
+
52
+ grid = [];
53
+
54
+ each(['thead', 'tbody', 'tfoot'], function(part) {
55
+ var rows = dom.select('> ' + part + ' tr', table);
56
+
57
+ each(rows, function(tr, y) {
58
+ y += startY;
59
+
60
+ each(dom.select('> td, > th', tr), function(td, x) {
61
+ var x2, y2, rowspan, colspan;
62
+
63
+ // Skip over existing cells produced by rowspan
64
+ if (grid[y]) {
65
+ while (grid[y][x])
66
+ x++;
67
+ }
68
+
69
+ // Get col/rowspan from cell
70
+ rowspan = getSpanVal(td, 'rowspan');
71
+ colspan = getSpanVal(td, 'colspan');
72
+
73
+ // Fill out rowspan/colspan right and down
74
+ for (y2 = y; y2 < y + rowspan; y2++) {
75
+ if (!grid[y2])
76
+ grid[y2] = [];
77
+
78
+ for (x2 = x; x2 < x + colspan; x2++) {
79
+ grid[y2][x2] = {
80
+ part : part,
81
+ real : y2 == y && x2 == x,
82
+ elm : td,
83
+ rowspan : rowspan,
84
+ colspan : colspan
85
+ };
86
+ }
87
+ }
88
+ });
89
+ });
90
+
91
+ startY += rows.length;
92
+ });
93
+ };
94
+
95
+ function getCell(x, y) {
96
+ var row;
97
+
98
+ row = grid[y];
99
+ if (row)
100
+ return row[x];
101
+ };
102
+
103
+ function getSpanVal(td, name) {
104
+ return parseInt(td.getAttribute(name) || 1);
105
+ };
106
+
107
+ function isCellSelected(cell) {
108
+ return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
109
+ };
110
+
111
+ function getSelectedRows() {
112
+ var rows = [];
113
+
114
+ each(table.rows, function(row) {
115
+ each(row.cells, function(cell) {
116
+ if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
117
+ rows.push(row);
118
+ return false;
119
+ }
120
+ });
121
+ });
122
+
123
+ return rows;
124
+ };
125
+
126
+ function deleteTable() {
127
+ var rng = dom.createRng();
128
+
129
+ rng.setStartAfter(table);
130
+ rng.setEndAfter(table);
131
+
132
+ selection.setRng(rng);
133
+
134
+ dom.remove(table);
135
+ };
136
+
137
+ function cloneCell(cell) {
138
+ var formatNode;
139
+
140
+ // Clone formats
141
+ tinymce.walk(cell, function(node) {
142
+ var curNode;
143
+
144
+ if (node.nodeType == 3) {
145
+ each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
146
+ node = cloneNode(node, false);
147
+
148
+ if (!formatNode)
149
+ formatNode = curNode = node;
150
+ else if (curNode)
151
+ curNode.appendChild(node);
152
+
153
+ curNode = node;
154
+ });
155
+
156
+ // Add something to the inner node
157
+ if (curNode)
158
+ curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br _mce_bogus="1" />';
159
+
160
+ return false;
161
+ }
162
+ }, 'childNodes');
163
+
164
+ cell = cloneNode(cell, false);
165
+ cell.rowSpan = cell.colSpan = 1;
166
+
167
+ if (formatNode) {
168
+ cell.appendChild(formatNode);
169
+ } else {
170
+ if (!tinymce.isIE)
171
+ cell.innerHTML = '<br _mce_bogus="1" />';
172
+ }
173
+
174
+ return cell;
175
+ };
176
+
177
+ function cleanup() {
178
+ var rng = dom.createRng();
179
+
180
+ // Empty rows
181
+ each(dom.select('tr', table), function(tr) {
182
+ if (tr.cells.length == 0)
183
+ dom.remove(tr);
184
+ });
185
+
186
+ // Empty table
187
+ if (dom.select('tr', table).length == 0) {
188
+ rng.setStartAfter(table);
189
+ rng.setEndAfter(table);
190
+ selection.setRng(rng);
191
+ dom.remove(table);
192
+ return;
193
+ }
194
+
195
+ // Empty header/body/footer
196
+ each(dom.select('thead,tbody,tfoot', table), function(part) {
197
+ if (part.rows.length == 0)
198
+ dom.remove(part);
199
+ });
200
+
201
+ // Restore selection to start position if it still exists
202
+ buildGrid();
203
+
204
+ // Restore the selection to the closest table position
205
+ row = grid[Math.min(grid.length - 1, startPos.y)];
206
+ if (row) {
207
+ selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
208
+ selection.collapse(true);
209
+ }
210
+ };
211
+
212
+ function fillLeftDown(x, y, rows, cols) {
213
+ var tr, x2, r, c, cell;
214
+
215
+ tr = grid[y][x].elm.parentNode;
216
+ for (r = 1; r <= rows; r++) {
217
+ tr = dom.getNext(tr, 'tr');
218
+
219
+ if (tr) {
220
+ // Loop left to find real cell
221
+ for (x2 = x; x2 >= 0; x2--) {
222
+ cell = grid[y + r][x2].elm;
223
+
224
+ if (cell.parentNode == tr) {
225
+ // Append clones after
226
+ for (c = 1; c <= cols; c++)
227
+ dom.insertAfter(cloneCell(cell), cell);
228
+
229
+ break;
230
+ }
231
+ }
232
+
233
+ if (x2 == -1) {
234
+ // Insert nodes before first cell
235
+ for (c = 1; c <= cols; c++)
236
+ tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
237
+ }
238
+ }
239
+ }
240
+ };
241
+
242
+ function split() {
243
+ each(grid, function(row, y) {
244
+ each(row, function(cell, x) {
245
+ var colSpan, rowSpan, newCell, i;
246
+
247
+ if (isCellSelected(cell)) {
248
+ cell = cell.elm;
249
+ colSpan = getSpanVal(cell, 'colspan');
250
+ rowSpan = getSpanVal(cell, 'rowspan');
251
+
252
+ if (colSpan > 1 || rowSpan > 1) {
253
+ cell.colSpan = cell.rowSpan = 1;
254
+
255
+ // Insert cells right
256
+ for (i = 0; i < colSpan - 1; i++)
257
+ dom.insertAfter(cloneCell(cell), cell);
258
+
259
+ fillLeftDown(x, y, rowSpan - 1, colSpan);
260
+ }
261
+ }
262
+ });
263
+ });
264
+ };
265
+
266
+ function merge(cell, cols, rows) {
267
+ var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
268
+
269
+ // Use specified cell and cols/rows
270
+ if (cell) {
271
+ pos = getPos(cell);
272
+ startX = pos.x;
273
+ startY = pos.y;
274
+ endX = startX + (cols - 1);
275
+ endY = startY + (rows - 1);
276
+ } else {
277
+ // Use selection
278
+ startX = startPos.x;
279
+ startY = startPos.y;
280
+ endX = endPos.x;
281
+ endY = endPos.y;
282
+ }
283
+
284
+ // Find start/end cells
285
+ startCell = getCell(startX, startY);
286
+ endCell = getCell(endX, endY);
287
+
288
+ // Check if the cells exists and if they are of the same part for example tbody = tbody
289
+ if (startCell && endCell && startCell.part == endCell.part) {
290
+ // Split and rebuild grid
291
+ split();
292
+ buildGrid();
293
+
294
+ // Set row/col span to start cell
295
+ startCell = getCell(startX, startY).elm;
296
+ startCell.colSpan = (endX - startX) + 1;
297
+ startCell.rowSpan = (endY - startY) + 1;
298
+
299
+ // Remove other cells and add it's contents to the start cell
300
+ for (y = startY; y <= endY; y++) {
301
+ for (x = startX; x <= endX; x++) {
302
+ cell = grid[y][x].elm;
303
+
304
+ if (cell != startCell) {
305
+ // Move children to startCell
306
+ children = tinymce.grep(cell.childNodes);
307
+ each(children, function(node, i) {
308
+ // Jump over last BR element
309
+ if (node.nodeName != 'BR' || i != children.length - 1)
310
+ startCell.appendChild(node);
311
+ });
312
+
313
+ // Remove cell
314
+ dom.remove(cell);
315
+ }
316
+ }
317
+ }
318
+
319
+ // Remove empty rows etc and restore caret location
320
+ cleanup();
321
+ }
322
+ };
323
+
324
+ function insertRow(before) {
325
+ var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
326
+
327
+ // Find first/last row
328
+ each(grid, function(row, y) {
329
+ each(row, function(cell, x) {
330
+ if (isCellSelected(cell)) {
331
+ cell = cell.elm;
332
+ rowElm = cell.parentNode;
333
+ newRow = cloneNode(rowElm, false);
334
+ posY = y;
335
+
336
+ if (before)
337
+ return false;
338
+ }
339
+ });
340
+
341
+ if (before)
342
+ return !posY;
343
+ });
344
+
345
+ for (x = 0; x < grid[0].length; x++) {
346
+ cell = grid[posY][x].elm;
347
+
348
+ if (cell != lastCell) {
349
+ if (!before) {
350
+ rowSpan = getSpanVal(cell, 'rowspan');
351
+ if (rowSpan > 1) {
352
+ cell.rowSpan = rowSpan + 1;
353
+ continue;
354
+ }
355
+ } else {
356
+ // Check if cell above can be expanded
357
+ if (posY > 0 && grid[posY - 1][x]) {
358
+ otherCell = grid[posY - 1][x].elm;
359
+ rowSpan = getSpanVal(otherCell, 'rowspan');
360
+ if (rowSpan > 1) {
361
+ otherCell.rowSpan = rowSpan + 1;
362
+ continue;
363
+ }
364
+ }
365
+ }
366
+
367
+ // Insert new cell into new row
368
+ newCell = cloneCell(cell)
369
+ newCell.colSpan = cell.colSpan;
370
+ newRow.appendChild(newCell);
371
+
372
+ lastCell = cell;
373
+ }
374
+ }
375
+
376
+ if (newRow.hasChildNodes()) {
377
+ if (!before)
378
+ dom.insertAfter(newRow, rowElm);
379
+ else
380
+ rowElm.parentNode.insertBefore(newRow, rowElm);
381
+ }
382
+ };
383
+
384
+ function insertCol(before) {
385
+ var posX, lastCell;
386
+
387
+ // Find first/last column
388
+ each(grid, function(row, y) {
389
+ each(row, function(cell, x) {
390
+ if (isCellSelected(cell)) {
391
+ posX = x;
392
+
393
+ if (before)
394
+ return false;
395
+ }
396
+ });
397
+
398
+ if (before)
399
+ return !posX;
400
+ });
401
+
402
+ each(grid, function(row, y) {
403
+ var cell = row[posX].elm, rowSpan, colSpan;
404
+
405
+ if (cell != lastCell) {
406
+ colSpan = getSpanVal(cell, 'colspan');
407
+ rowSpan = getSpanVal(cell, 'rowspan');
408
+
409
+ if (colSpan == 1) {
410
+ if (!before) {
411
+ dom.insertAfter(cloneCell(cell), cell);
412
+ fillLeftDown(posX, y, rowSpan - 1, colSpan);
413
+ } else {
414
+ cell.parentNode.insertBefore(cloneCell(cell), cell);
415
+ fillLeftDown(posX, y, rowSpan - 1, colSpan);
416
+ }
417
+ } else
418
+ cell.colSpan++;
419
+
420
+ lastCell = cell;
421
+ }
422
+ });
423
+ };
424
+
425
+ function deleteCols() {
426
+ var cols = [];
427
+
428
+ // Get selected column indexes
429
+ each(grid, function(row, y) {
430
+ each(row, function(cell, x) {
431
+ if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
432
+ each(grid, function(row) {
433
+ var cell = row[x].elm, colSpan;
434
+
435
+ colSpan = getSpanVal(cell, 'colspan');
436
+
437
+ if (colSpan > 1)
438
+ cell.colSpan = colSpan - 1;
439
+ else
440
+ dom.remove(cell);
441
+ });
442
+
443
+ cols.push(x);
444
+ }
445
+ });
446
+ });
447
+
448
+ cleanup();
449
+ };
450
+
451
+ function deleteRows() {
452
+ var rows;
453
+
454
+ function deleteRow(tr) {
455
+ var nextTr, pos, lastCell;
456
+
457
+ nextTr = dom.getNext(tr, 'tr');
458
+
459
+ // Move down row spanned cells
460
+ each(tr.cells, function(cell) {
461
+ var rowSpan = getSpanVal(cell, 'rowspan');
462
+
463
+ if (rowSpan > 1) {
464
+ cell.rowSpan = rowSpan - 1;
465
+ pos = getPos(cell);
466
+ fillLeftDown(pos.x, pos.y, 1, 1);
467
+ }
468
+ });
469
+
470
+ // Delete cells
471
+ pos = getPos(tr.cells[0]);
472
+ each(grid[pos.y], function(cell) {
473
+ var rowSpan;
474
+
475
+ cell = cell.elm;
476
+
477
+ if (cell != lastCell) {
478
+ rowSpan = getSpanVal(cell, 'rowspan');
479
+
480
+ if (rowSpan <= 1)
481
+ dom.remove(cell);
482
+ else
483
+ cell.rowSpan = rowSpan - 1;
484
+
485
+ lastCell = cell;
486
+ }
487
+ });
488
+ };
489
+
490
+ // Get selected rows and move selection out of scope
491
+ rows = getSelectedRows();
492
+
493
+ // Delete all selected rows
494
+ each(rows.reverse(), function(tr) {
495
+ deleteRow(tr);
496
+ });
497
+
498
+ cleanup();
499
+ };
500
+
501
+ function cutRows() {
502
+ var rows = getSelectedRows();
503
+
504
+ dom.remove(rows);
505
+ cleanup();
506
+
507
+ return rows;
508
+ };
509
+
510
+ function copyRows() {
511
+ var rows = getSelectedRows();
512
+
513
+ each(rows, function(row, i) {
514
+ rows[i] = cloneNode(row, true);
515
+ });
516
+
517
+ return rows;
518
+ };
519
+
520
+ function pasteRows(rows, before) {
521
+ var selectedRows = getSelectedRows(),
522
+ targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
523
+ targetCellCount = targetRow.cells.length;
524
+
525
+ // Calc target cell count
526
+ each(grid, function(row) {
527
+ var match;
528
+
529
+ targetCellCount = 0;
530
+ each(row, function(cell, x) {
531
+ if (cell.real)
532
+ targetCellCount += cell.colspan;
533
+
534
+ if (cell.elm.parentNode == targetRow)
535
+ match = 1;
536
+ });
537
+
538
+ if (match)
539
+ return false;
540
+ });
541
+
542
+ if (!before)
543
+ rows.reverse();
544
+
545
+ each(rows, function(row) {
546
+ var cellCount = row.cells.length, cell;
547
+
548
+ // Remove col/rowspans
549
+ for (i = 0; i < cellCount; i++) {
550
+ cell = row.cells[i];
551
+ cell.colSpan = cell.rowSpan = 1;
552
+ }
553
+
554
+ // Needs more cells
555
+ for (i = cellCount; i < targetCellCount; i++)
556
+ row.appendChild(cloneCell(row.cells[cellCount - 1]));
557
+
558
+ // Needs less cells
559
+ for (i = targetCellCount; i < cellCount; i++)
560
+ dom.remove(row.cells[i]);
561
+
562
+ // Add before/after
563
+ if (before)
564
+ targetRow.parentNode.insertBefore(row, targetRow);
565
+ else
566
+ dom.insertAfter(row, targetRow);
567
+ });
568
+ };
569
+
570
+ function getPos(target) {
571
+ var pos;
572
+
573
+ each(grid, function(row, y) {
574
+ each(row, function(cell, x) {
575
+ if (cell.elm == target) {
576
+ pos = {x : x, y : y};
577
+ return false;
578
+ }
579
+ });
580
+
581
+ return !pos;
582
+ });
583
+
584
+ return pos;
585
+ };
586
+
587
+ function setStartCell(cell) {
588
+ startPos = getPos(cell);
589
+ };
590
+
591
+ function findEndPos() {
592
+ var pos, maxX, maxY;
593
+
594
+ maxX = maxY = 0;
595
+
596
+ each(grid, function(row, y) {
597
+ each(row, function(cell, x) {
598
+ var colSpan, rowSpan;
599
+
600
+ if (isCellSelected(cell)) {
601
+ cell = grid[y][x];
602
+
603
+ if (x > maxX)
604
+ maxX = x;
605
+
606
+ if (y > maxY)
607
+ maxY = y;
608
+
609
+ if (cell.real) {
610
+ colSpan = cell.colspan - 1;
611
+ rowSpan = cell.rowspan - 1;
612
+
613
+ if (colSpan) {
614
+ if (x + colSpan > maxX)
615
+ maxX = x + colSpan;
616
+ }
617
+
618
+ if (rowSpan) {
619
+ if (y + rowSpan > maxY)
620
+ maxY = y + rowSpan;
621
+ }
622
+ }
623
+ }
624
+ });
625
+ });
626
+
627
+ return {x : maxX, y : maxY};
628
+ };
629
+
630
+ function setEndCell(cell) {
631
+ var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
632
+
633
+ endPos = getPos(cell);
634
+
635
+ if (startPos && endPos) {
636
+ // Get start/end positions
637
+ startX = Math.min(startPos.x, endPos.x);
638
+ startY = Math.min(startPos.y, endPos.y);
639
+ endX = Math.max(startPos.x, endPos.x);
640
+ endY = Math.max(startPos.y, endPos.y);
641
+
642
+ // Expand end positon to include spans
643
+ maxX = endX;
644
+ maxY = endY;
645
+
646
+ // Expand startX
647
+ for (y = startY; y <= maxY; y++) {
648
+ cell = grid[y][startX];
649
+
650
+ if (!cell.real) {
651
+ if (startX - (cell.colspan - 1) < startX)
652
+ startX -= cell.colspan - 1;
653
+ }
654
+ }
655
+
656
+ // Expand startY
657
+ for (x = startX; x <= maxX; x++) {
658
+ cell = grid[startY][x];
659
+
660
+ if (!cell.real) {
661
+ if (startY - (cell.rowspan - 1) < startY)
662
+ startY -= cell.rowspan - 1;
663
+ }
664
+ }
665
+
666
+ // Find max X, Y
667
+ for (y = startY; y <= endY; y++) {
668
+ for (x = startX; x <= endX; x++) {
669
+ cell = grid[y][x];
670
+
671
+ if (cell.real) {
672
+ colSpan = cell.colspan - 1;
673
+ rowSpan = cell.rowspan - 1;
674
+
675
+ if (colSpan) {
676
+ if (x + colSpan > maxX)
677
+ maxX = x + colSpan;
678
+ }
679
+
680
+ if (rowSpan) {
681
+ if (y + rowSpan > maxY)
682
+ maxY = y + rowSpan;
683
+ }
684
+ }
685
+ }
686
+ }
687
+
688
+ // Remove current selection
689
+ dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
690
+
691
+ // Add new selection
692
+ for (y = startY; y <= maxY; y++) {
693
+ for (x = startX; x <= maxX; x++)
694
+ dom.addClass(grid[y][x].elm, 'mceSelected');
695
+ }
696
+ }
697
+ };
698
+
699
+ // Expose to public
700
+ tinymce.extend(this, {
701
+ deleteTable : deleteTable,
702
+ split : split,
703
+ merge : merge,
704
+ insertRow : insertRow,
705
+ insertCol : insertCol,
706
+ deleteCols : deleteCols,
707
+ deleteRows : deleteRows,
708
+ cutRows : cutRows,
709
+ copyRows : copyRows,
710
+ pasteRows : pasteRows,
711
+ getPos : getPos,
712
+ setStartCell : setStartCell,
713
+ setEndCell : setEndCell
714
+ });
715
+ };
716
+
717
+ tinymce.create('tinymce.plugins.TablePlugin', {
718
+ init : function(ed, url) {
719
+ var winMan, clipboardRows;
720
+
721
+ function createTableGrid(node) {
722
+ var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
723
+
724
+ if (tblElm)
725
+ return new TableGrid(tblElm, ed.dom, selection);
726
+ };
727
+
728
+ function cleanup() {
729
+ // Restore selection possibilities
730
+ ed.getBody().style.webkitUserSelect = '';
731
+ ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
732
+ };
733
+
734
+ // Register buttons
735
+ each([
736
+ ['table', 'table.desc', 'mceInsertTable', true],
737
+ ['delete_table', 'table.del', 'mceTableDelete'],
738
+ ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
739
+ ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
740
+ ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
741
+ ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
742
+ ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
743
+ ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
744
+ ['row_props', 'table.row_desc', 'mceTableRowProps', true],
745
+ ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
746
+ ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
747
+ ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
748
+ ], function(c) {
749
+ ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
750
+ });
751
+
752
+ // Select whole table is a table border is clicked
753
+ if (!tinymce.isIE) {
754
+ ed.onClick.add(function(ed, e) {
755
+ e = e.target;
756
+
757
+ if (e.nodeName === 'TABLE')
758
+ ed.selection.select(e);
759
+ });
760
+ }
761
+
762
+ // Handle node change updates
763
+ ed.onNodeChange.add(function(ed, cm, n) {
764
+ var p;
765
+
766
+ n = ed.selection.getStart();
767
+ p = ed.dom.getParent(n, 'td,th,caption');
768
+ cm.setActive('table', n.nodeName === 'TABLE' || !!p);
769
+
770
+ // Disable table tools if we are in caption
771
+ if (p && p.nodeName === 'CAPTION')
772
+ p = 0;
773
+
774
+ cm.setDisabled('delete_table', !p);
775
+ cm.setDisabled('delete_col', !p);
776
+ cm.setDisabled('delete_table', !p);
777
+ cm.setDisabled('delete_row', !p);
778
+ cm.setDisabled('col_after', !p);
779
+ cm.setDisabled('col_before', !p);
780
+ cm.setDisabled('row_after', !p);
781
+ cm.setDisabled('row_before', !p);
782
+ cm.setDisabled('row_props', !p);
783
+ cm.setDisabled('cell_props', !p);
784
+ cm.setDisabled('split_cells', !p);
785
+ cm.setDisabled('merge_cells', !p);
786
+ });
787
+
788
+ ed.onInit.add(function(ed) {
789
+ var startTable, startCell, dom = ed.dom, tableGrid;
790
+
791
+ winMan = ed.windowManager;
792
+
793
+ // Add cell selection logic
794
+ ed.onMouseDown.add(function(ed, e) {
795
+ if (e.button != 2) {
796
+ cleanup();
797
+
798
+ startCell = dom.getParent(e.target, 'td,th');
799
+ startTable = dom.getParent(startCell, 'table');
800
+ }
801
+ });
802
+
803
+ dom.bind(ed.getDoc(), 'mouseover', function(e) {
804
+ var sel, table, target = e.target;
805
+
806
+ if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
807
+ table = dom.getParent(target, 'table');
808
+ if (table == startTable) {
809
+ if (!tableGrid) {
810
+ tableGrid = createTableGrid(table);
811
+ tableGrid.setStartCell(startCell);
812
+
813
+ ed.getBody().style.webkitUserSelect = 'none';
814
+ }
815
+
816
+ tableGrid.setEndCell(target);
817
+ }
818
+
819
+ // Remove current selection
820
+ sel = ed.selection.getSel();
821
+
822
+ if (sel.removeAllRanges)
823
+ sel.removeAllRanges();
824
+ else
825
+ sel.empty();
826
+
827
+ e.preventDefault();
828
+ }
829
+ });
830
+
831
+ ed.onMouseUp.add(function(ed, e) {
832
+ var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
833
+
834
+ // Move selection to startCell
835
+ if (startCell) {
836
+ if (tableGrid)
837
+ ed.getBody().style.webkitUserSelect = '';
838
+
839
+ function setPoint(node, start) {
840
+ var walker = new tinymce.dom.TreeWalker(node, node);
841
+
842
+ do {
843
+ // Text node
844
+ if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
845
+ if (start)
846
+ rng.setStart(node, 0);
847
+ else
848
+ rng.setEnd(node, node.nodeValue.length);
849
+
850
+ return;
851
+ }
852
+
853
+ // BR element
854
+ if (node.nodeName == 'BR') {
855
+ if (start)
856
+ rng.setStartBefore(node);
857
+ else
858
+ rng.setEndBefore(node);
859
+
860
+ return;
861
+ }
862
+ } while (node = (start ? walker.next() : walker.prev()));
863
+ };
864
+
865
+ // Try to expand text selection as much as we can only Gecko supports cell selection
866
+ selectedCells = dom.select('td.mceSelected,th.mceSelected');
867
+ if (selectedCells.length > 0) {
868
+ rng = dom.createRng();
869
+ node = selectedCells[0];
870
+ endNode = selectedCells[selectedCells.length - 1];
871
+
872
+ setPoint(node, 1);
873
+ walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
874
+
875
+ do {
876
+ if (node.nodeName == 'TD' || node.nodeName == 'TH') {
877
+ if (!dom.hasClass(node, 'mceSelected'))
878
+ break;
879
+
880
+ lastNode = node;
881
+ }
882
+ } while (node = walker.next());
883
+
884
+ setPoint(lastNode);
885
+
886
+ sel.setRng(rng);
887
+ }
888
+
889
+ ed.nodeChanged();
890
+ startCell = tableGrid = startTable = null;
891
+ }
892
+ });
893
+
894
+ ed.onKeyUp.add(function(ed, e) {
895
+ cleanup();
896
+ });
897
+
898
+ // Add context menu
899
+ if (ed && ed.plugins.contextmenu) {
900
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
901
+ var sm, se = ed.selection, el = se.getNode() || ed.getBody();
902
+
903
+ if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
904
+ m.removeAll();
905
+
906
+ if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
907
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
908
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
909
+ m.addSeparator();
910
+ }
911
+
912
+ if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
913
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
914
+ m.addSeparator();
915
+ }
916
+
917
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
918
+ m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
919
+ m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
920
+ m.addSeparator();
921
+
922
+ // Cell menu
923
+ sm = m.addMenu({title : 'table.cell'});
924
+ sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
925
+ sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
926
+ sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
927
+
928
+ // Row menu
929
+ sm = m.addMenu({title : 'table.row'});
930
+ sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
931
+ sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
932
+ sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
933
+ sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
934
+ sm.addSeparator();
935
+ sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
936
+ sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
937
+ sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
938
+ sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
939
+
940
+ // Column menu
941
+ sm = m.addMenu({title : 'table.col'});
942
+ sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
943
+ sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
944
+ sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
945
+ } else
946
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
947
+ });
948
+ }
949
+
950
+ // Fixes an issue on Gecko where it's impossible to place the caret behind a table
951
+ // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
952
+ if (!tinymce.isIE) {
953
+ function fixTableCaretPos() {
954
+ var last;
955
+
956
+ // Skip empty text nodes form the end
957
+ for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
958
+
959
+ if (last && last.nodeName == 'TABLE')
960
+ ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
961
+ };
962
+
963
+ // Fixes an bug where it's impossible to place the caret before a table in Gecko
964
+ // this fix solves it by detecting when the caret is at the beginning of such a table
965
+ // and then manually moves the caret infront of the table
966
+ if (tinymce.isGecko) {
967
+ ed.onKeyDown.add(function(ed, e) {
968
+ var rng, table, dom = ed.dom;
969
+
970
+ // On gecko it's not possible to place the caret before a table
971
+ if (e.keyCode == 37 || e.keyCode == 38) {
972
+ rng = ed.selection.getRng();
973
+ table = dom.getParent(rng.startContainer, 'table');
974
+
975
+ if (table && ed.getBody().firstChild == table) {
976
+ if (isAtStart(rng, table)) {
977
+ rng = dom.createRng();
978
+
979
+ rng.setStartBefore(table);
980
+ rng.setEndBefore(table);
981
+
982
+ ed.selection.setRng(rng);
983
+
984
+ e.preventDefault();
985
+ }
986
+ }
987
+ }
988
+ });
989
+ }
990
+
991
+ ed.onKeyUp.add(fixTableCaretPos);
992
+ ed.onSetContent.add(fixTableCaretPos);
993
+ ed.onVisualAid.add(fixTableCaretPos);
994
+
995
+ ed.onPreProcess.add(function(ed, o) {
996
+ var last = o.node.lastChild;
997
+
998
+ if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
999
+ ed.dom.remove(last);
1000
+ });
1001
+
1002
+ fixTableCaretPos();
1003
+ }
1004
+ });
1005
+
1006
+ // Register action commands
1007
+ each({
1008
+ mceTableSplitCells : function(grid) {
1009
+ grid.split();
1010
+ },
1011
+
1012
+ mceTableMergeCells : function(grid) {
1013
+ var rowSpan, colSpan, cell;
1014
+
1015
+ cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
1016
+ if (cell) {
1017
+ rowSpan = cell.rowSpan;
1018
+ colSpan = cell.colSpan;
1019
+ }
1020
+
1021
+ if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
1022
+ winMan.open({
1023
+ url : url + '/merge_cells.htm',
1024
+ width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
1025
+ height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
1026
+ inline : 1
1027
+ }, {
1028
+ rows : rowSpan,
1029
+ cols : colSpan,
1030
+ onaction : function(data) {
1031
+ grid.merge(cell, data.cols, data.rows);
1032
+ },
1033
+ plugin_url : url
1034
+ });
1035
+ } else
1036
+ grid.merge();
1037
+ },
1038
+
1039
+ mceTableInsertRowBefore : function(grid) {
1040
+ grid.insertRow(true);
1041
+ },
1042
+
1043
+ mceTableInsertRowAfter : function(grid) {
1044
+ grid.insertRow();
1045
+ },
1046
+
1047
+ mceTableInsertColBefore : function(grid) {
1048
+ grid.insertCol(true);
1049
+ },
1050
+
1051
+ mceTableInsertColAfter : function(grid) {
1052
+ grid.insertCol();
1053
+ },
1054
+
1055
+ mceTableDeleteCol : function(grid) {
1056
+ grid.deleteCols();
1057
+ },
1058
+
1059
+ mceTableDeleteRow : function(grid) {
1060
+ grid.deleteRows();
1061
+ },
1062
+
1063
+ mceTableCutRow : function(grid) {
1064
+ clipboardRows = grid.cutRows();
1065
+ },
1066
+
1067
+ mceTableCopyRow : function(grid) {
1068
+ clipboardRows = grid.copyRows();
1069
+ },
1070
+
1071
+ mceTablePasteRowBefore : function(grid) {
1072
+ grid.pasteRows(clipboardRows, true);
1073
+ },
1074
+
1075
+ mceTablePasteRowAfter : function(grid) {
1076
+ grid.pasteRows(clipboardRows);
1077
+ },
1078
+
1079
+ mceTableDelete : function(grid) {
1080
+ grid.deleteTable();
1081
+ }
1082
+ }, function(func, name) {
1083
+ ed.addCommand(name, function() {
1084
+ var grid = createTableGrid();
1085
+
1086
+ if (grid) {
1087
+ func(grid);
1088
+ ed.execCommand('mceRepaint');
1089
+ cleanup();
1090
+ }
1091
+ });
1092
+ });
1093
+
1094
+ // Register dialog commands
1095
+ each({
1096
+ mceInsertTable : function(val) {
1097
+ winMan.open({
1098
+ url : url + '/table.htm',
1099
+ width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
1100
+ height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
1101
+ inline : 1
1102
+ }, {
1103
+ plugin_url : url,
1104
+ action : val ? val.action : 0
1105
+ });
1106
+ },
1107
+
1108
+ mceTableRowProps : function() {
1109
+ winMan.open({
1110
+ url : url + '/row.htm',
1111
+ width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
1112
+ height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
1113
+ inline : 1
1114
+ }, {
1115
+ plugin_url : url
1116
+ });
1117
+ },
1118
+
1119
+ mceTableCellProps : function() {
1120
+ winMan.open({
1121
+ url : url + '/cell.htm',
1122
+ width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
1123
+ height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
1124
+ inline : 1
1125
+ }, {
1126
+ plugin_url : url
1127
+ });
1128
+ }
1129
+ }, function(func, name) {
1130
+ ed.addCommand(name, function(ui, val) {
1131
+ func(val);
1132
+ });
1133
+ });
1134
+ }
1135
+ });
1136
+
1137
+ // Register plugin
1138
+ tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
1139
+ })(tinymce);