cable 0.9.16 → 0.9.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/admin_controller.rb +1 -1
  3. data/app/views/layouts/admin.html.erb +3 -1
  4. data/lib/generators/cable/install_generator.rb +1 -0
  5. data/lib/generators/cable/menu/templates/erb/menus/_menu.html.erb +1 -1
  6. data/lib/generators/cable/menu/templates/erb/menus/_resources.html.erb +1 -1
  7. data/lib/generators/cable/menu/templates/erb/menus/show.html.erb +1 -1
  8. data/public/javascripts/admin.js +16 -16
  9. metadata +2 -254
  10. data/public/javascripts/tinymce/jquery.tinymce.js +0 -1
  11. data/public/javascripts/tinymce/langs/en.js +0 -222
  12. data/public/javascripts/tinymce/license.txt +0 -504
  13. data/public/javascripts/tinymce/plugins/advhr/css/advhr.css +0 -5
  14. data/public/javascripts/tinymce/plugins/advhr/editor_plugin.js +0 -1
  15. data/public/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +0 -57
  16. data/public/javascripts/tinymce/plugins/advhr/js/rule.js +0 -43
  17. data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +0 -7
  18. data/public/javascripts/tinymce/plugins/advhr/rule.htm +0 -58
  19. data/public/javascripts/tinymce/plugins/advimage/css/advimage.css +0 -13
  20. data/public/javascripts/tinymce/plugins/advimage/editor_plugin.js +0 -1
  21. data/public/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +0 -50
  22. data/public/javascripts/tinymce/plugins/advimage/image.htm +0 -235
  23. data/public/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
  24. data/public/javascripts/tinymce/plugins/advimage/js/image.js +0 -445
  25. data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +0 -45
  26. data/public/javascripts/tinymce/plugins/advlink/css/advlink.css +0 -8
  27. data/public/javascripts/tinymce/plugins/advlink/editor_plugin.js +0 -1
  28. data/public/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +0 -61
  29. data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +0 -523
  30. data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +0 -54
  31. data/public/javascripts/tinymce/plugins/advlink/link.htm +0 -338
  32. data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +0 -1
  33. data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +0 -154
  34. data/public/javascripts/tinymce/plugins/autolink/editor_plugin.js +0 -1
  35. data/public/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +0 -169
  36. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +0 -1
  37. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +0 -119
  38. data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +0 -1
  39. data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +0 -431
  40. data/public/javascripts/tinymce/plugins/autosave/langs/en.js +0 -4
  41. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +0 -1
  42. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +0 -120
  43. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +0 -1
  44. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +0 -156
  45. data/public/javascripts/tinymce/plugins/directionality/editor_plugin.js +0 -1
  46. data/public/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +0 -82
  47. data/public/javascripts/tinymce/plugins/emotions/editor_plugin.js +0 -1
  48. data/public/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +0 -43
  49. data/public/javascripts/tinymce/plugins/emotions/emotions.htm +0 -41
  50. data/public/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
  51. data/public/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
  52. data/public/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  53. data/public/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  54. data/public/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
  55. data/public/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
  56. data/public/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
  57. data/public/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
  58. data/public/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  59. data/public/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
  60. data/public/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
  61. data/public/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
  62. data/public/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  63. data/public/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
  64. data/public/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
  65. data/public/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
  66. data/public/javascripts/tinymce/plugins/emotions/js/emotions.js +0 -22
  67. data/public/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +0 -20
  68. data/public/javascripts/tinymce/plugins/example/dialog.htm +0 -22
  69. data/public/javascripts/tinymce/plugins/example/editor_plugin.js +0 -1
  70. data/public/javascripts/tinymce/plugins/example/editor_plugin_src.js +0 -84
  71. data/public/javascripts/tinymce/plugins/example/img/example.gif +0 -0
  72. data/public/javascripts/tinymce/plugins/example/js/dialog.js +0 -19
  73. data/public/javascripts/tinymce/plugins/example/langs/en.js +0 -3
  74. data/public/javascripts/tinymce/plugins/example/langs/en_dlg.js +0 -3
  75. data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +0 -184
  76. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +0 -1
  77. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +0 -198
  78. data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +0 -571
  79. data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +0 -497
  80. data/public/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +0 -85
  81. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +0 -1
  82. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +0 -159
  83. data/public/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +0 -109
  84. data/public/javascripts/tinymce/plugins/iespell/editor_plugin.js +0 -1
  85. data/public/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +0 -54
  86. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +0 -1
  87. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +0 -696
  88. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  89. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  90. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  91. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  92. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  93. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  94. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  95. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
  96. data/public/javascripts/tinymce/plugins/inlinepopups/template.htm +0 -387
  97. data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +0 -1
  98. data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +0 -83
  99. data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +0 -1
  100. data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +0 -214
  101. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +0 -1
  102. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +0 -139
  103. data/public/javascripts/tinymce/plugins/lists/editor_plugin.js +0 -1
  104. data/public/javascripts/tinymce/plugins/lists/editor_plugin_src.js +0 -617
  105. data/public/javascripts/tinymce/plugins/media/css/media.css +0 -17
  106. data/public/javascripts/tinymce/plugins/media/editor_plugin.js +0 -1
  107. data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +0 -770
  108. data/public/javascripts/tinymce/plugins/media/js/embed.js +0 -73
  109. data/public/javascripts/tinymce/plugins/media/js/media.js +0 -354
  110. data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +0 -109
  111. data/public/javascripts/tinymce/plugins/media/media.htm +0 -812
  112. data/public/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
  113. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +0 -1
  114. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +0 -53
  115. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +0 -1
  116. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +0 -90
  117. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +0 -1
  118. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +0 -74
  119. data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +0 -1
  120. data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +0 -930
  121. data/public/javascripts/tinymce/plugins/paste/js/pastetext.js +0 -36
  122. data/public/javascripts/tinymce/plugins/paste/js/pasteword.js +0 -51
  123. data/public/javascripts/tinymce/plugins/paste/langs/en_dlg.js +0 -5
  124. data/public/javascripts/tinymce/plugins/paste/pastetext.htm +0 -27
  125. data/public/javascripts/tinymce/plugins/paste/pasteword.htm +0 -21
  126. data/public/javascripts/tinymce/plugins/preview/editor_plugin.js +0 -1
  127. data/public/javascripts/tinymce/plugins/preview/editor_plugin_src.js +0 -53
  128. data/public/javascripts/tinymce/plugins/preview/example.html +0 -28
  129. data/public/javascripts/tinymce/plugins/preview/jscripts/embed.js +0 -73
  130. data/public/javascripts/tinymce/plugins/preview/preview.html +0 -17
  131. data/public/javascripts/tinymce/plugins/print/editor_plugin.js +0 -1
  132. data/public/javascripts/tinymce/plugins/print/editor_plugin_src.js +0 -34
  133. data/public/javascripts/tinymce/plugins/save/editor_plugin.js +0 -1
  134. data/public/javascripts/tinymce/plugins/save/editor_plugin_src.js +0 -101
  135. data/public/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +0 -6
  136. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +0 -1
  137. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +0 -61
  138. data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +0 -142
  139. data/public/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +0 -16
  140. data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +0 -100
  141. data/public/javascripts/tinymce/plugins/spellchecker/css/content.css +0 -1
  142. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +0 -1
  143. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +0 -435
  144. data/public/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
  145. data/public/javascripts/tinymce/plugins/style/css/props.css +0 -13
  146. data/public/javascripts/tinymce/plugins/style/editor_plugin.js +0 -1
  147. data/public/javascripts/tinymce/plugins/style/editor_plugin_src.js +0 -55
  148. data/public/javascripts/tinymce/plugins/style/js/props.js +0 -635
  149. data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +0 -70
  150. data/public/javascripts/tinymce/plugins/style/props.htm +0 -838
  151. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +0 -1
  152. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +0 -114
  153. data/public/javascripts/tinymce/plugins/table/cell.htm +0 -178
  154. data/public/javascripts/tinymce/plugins/table/css/cell.css +0 -17
  155. data/public/javascripts/tinymce/plugins/table/css/row.css +0 -25
  156. data/public/javascripts/tinymce/plugins/table/css/table.css +0 -13
  157. data/public/javascripts/tinymce/plugins/table/editor_plugin.js +0 -1
  158. data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +0 -1198
  159. data/public/javascripts/tinymce/plugins/table/js/cell.js +0 -284
  160. data/public/javascripts/tinymce/plugins/table/js/merge_cells.js +0 -27
  161. data/public/javascripts/tinymce/plugins/table/js/row.js +0 -232
  162. data/public/javascripts/tinymce/plugins/table/js/table.js +0 -450
  163. data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +0 -74
  164. data/public/javascripts/tinymce/plugins/table/merge_cells.htm +0 -32
  165. data/public/javascripts/tinymce/plugins/table/row.htm +0 -157
  166. data/public/javascripts/tinymce/plugins/table/table.htm +0 -188
  167. data/public/javascripts/tinymce/plugins/template/blank.htm +0 -12
  168. data/public/javascripts/tinymce/plugins/template/css/template.css +0 -23
  169. data/public/javascripts/tinymce/plugins/template/editor_plugin.js +0 -1
  170. data/public/javascripts/tinymce/plugins/template/editor_plugin_src.js +0 -159
  171. data/public/javascripts/tinymce/plugins/template/js/template.js +0 -106
  172. data/public/javascripts/tinymce/plugins/template/langs/en_dlg.js +0 -15
  173. data/public/javascripts/tinymce/plugins/template/template.htm +0 -31
  174. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +0 -1
  175. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +0 -83
  176. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +0 -1
  177. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +0 -114
  178. data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +0 -142
  179. data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +0 -142
  180. data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +0 -149
  181. data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +0 -142
  182. data/public/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +0 -11
  183. data/public/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +0 -9
  184. data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +0 -162
  185. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +0 -1
  186. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +0 -132
  187. data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +0 -162
  188. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +0 -28
  189. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +0 -28
  190. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +0 -125
  191. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +0 -28
  192. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +0 -53
  193. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +0 -229
  194. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +0 -53
  195. data/public/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +0 -32
  196. data/public/javascripts/tinymce/themes/advanced/about.htm +0 -52
  197. data/public/javascripts/tinymce/themes/advanced/anchor.htm +0 -26
  198. data/public/javascripts/tinymce/themes/advanced/charmap.htm +0 -51
  199. data/public/javascripts/tinymce/themes/advanced/color_picker.htm +0 -74
  200. data/public/javascripts/tinymce/themes/advanced/editor_template.js +0 -1
  201. data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +0 -1360
  202. data/public/javascripts/tinymce/themes/advanced/image.htm +0 -80
  203. data/public/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
  204. data/public/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
  205. data/public/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
  206. data/public/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
  207. data/public/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
  208. data/public/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
  209. data/public/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
  210. data/public/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
  211. data/public/javascripts/tinymce/themes/advanced/img/trans.gif +0 -0
  212. data/public/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
  213. data/public/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
  214. data/public/javascripts/tinymce/themes/advanced/js/about.js +0 -73
  215. data/public/javascripts/tinymce/themes/advanced/js/anchor.js +0 -42
  216. data/public/javascripts/tinymce/themes/advanced/js/charmap.js +0 -355
  217. data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +0 -329
  218. data/public/javascripts/tinymce/themes/advanced/js/image.js +0 -247
  219. data/public/javascripts/tinymce/themes/advanced/js/link.js +0 -153
  220. data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +0 -56
  221. data/public/javascripts/tinymce/themes/advanced/langs/en.js +0 -68
  222. data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +0 -54
  223. data/public/javascripts/tinymce/themes/advanced/link.htm +0 -57
  224. data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +0 -47
  225. data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +0 -47
  226. data/public/javascripts/tinymce/themes/advanced/skins/default/dialog.css +0 -117
  227. data/public/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
  228. data/public/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
  229. data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  230. data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  231. data/public/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
  232. data/public/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
  233. data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +0 -213
  234. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +0 -23
  235. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +0 -105
  236. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +0 -101
  237. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +0 -46
  238. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +0 -117
  239. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  240. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  241. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  242. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +0 -216
  243. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +0 -8
  244. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
  245. data/public/javascripts/tinymce/themes/advanced/source_editor.htm +0 -25
  246. data/public/javascripts/tinymce/themes/simple/editor_template.js +0 -1
  247. data/public/javascripts/tinymce/themes/simple/editor_template_src.js +0 -84
  248. data/public/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
  249. data/public/javascripts/tinymce/themes/simple/langs/en.js +0 -11
  250. data/public/javascripts/tinymce/themes/simple/skins/default/content.css +0 -25
  251. data/public/javascripts/tinymce/themes/simple/skins/default/ui.css +0 -32
  252. data/public/javascripts/tinymce/themes/simple/skins/o2k7/content.css +0 -17
  253. data/public/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  254. data/public/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +0 -35
  255. data/public/javascripts/tinymce/tiny_mce.js +0 -1
  256. data/public/javascripts/tinymce/tiny_mce_popup.js +0 -5
  257. data/public/javascripts/tinymce/tiny_mce_src.js +0 -15752
  258. data/public/javascripts/tinymce/utils/editable_selects.js +0 -70
  259. data/public/javascripts/tinymce/utils/form_utils.js +0 -210
  260. data/public/javascripts/tinymce/utils/mctabs.js +0 -162
  261. data/public/javascripts/tinymce/utils/validate.js +0 -252
@@ -1 +0,0 @@
1
- (function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>':"&nbsp;")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(tinymce.isIE&&f.keyCode==9){d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");tinymce.dom.Event.cancel(f)}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
@@ -1,53 +0,0 @@
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
- tinymce.create('tinymce.plugins.Nonbreaking', {
13
- init : function(ed, url) {
14
- var t = this;
15
-
16
- t.editor = ed;
17
-
18
- // Register commands
19
- ed.addCommand('mceNonBreaking', function() {
20
- ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');
21
- });
22
-
23
- // Register buttons
24
- ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
25
-
26
- if (ed.getParam('nonbreaking_force_tab')) {
27
- ed.onKeyDown.add(function(ed, e) {
28
- if (tinymce.isIE && e.keyCode == 9) {
29
- ed.execCommand('mceNonBreaking');
30
- ed.execCommand('mceNonBreaking');
31
- ed.execCommand('mceNonBreaking');
32
- tinymce.dom.Event.cancel(e);
33
- }
34
- });
35
- }
36
- },
37
-
38
- getInfo : function() {
39
- return {
40
- longname : 'Nonbreaking space',
41
- author : 'Moxiecode Systems AB',
42
- authorurl : 'http://tinymce.moxiecode.com',
43
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
44
- version : tinymce.majorVersion + "." + tinymce.minorVersion
45
- };
46
- }
47
-
48
- // Private methods
49
- });
50
-
51
- // Register plugin
52
- tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
53
- })();
@@ -1 +0,0 @@
1
- (function(){var a=tinymce.dom.Event;tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(d,e){var f=this,c,b;f.editor=d;c=d.getParam("noneditable_editable_class","mceEditable");b=d.getParam("noneditable_noneditable_class","mceNonEditable");d.onNodeChange.addToTop(function(h,g,k){var j,i;j=h.dom.getParent(h.selection.getStart(),function(l){return h.dom.hasClass(l,b)});i=h.dom.getParent(h.selection.getEnd(),function(l){return h.dom.hasClass(l,b)});if(j||i){f._setDisabled(1);return false}else{f._setDisabled(0)}})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_block:function(c,d){var b=d.keyCode;if((b>32&&b<41)||(b>111&&b<124)){return}return a.cancel(d)},_setDisabled:function(d){var c=this,b=c.editor;tinymce.each(b.controlManager.controls,function(e){e.setDisabled(d)});if(d!==c.disabled){if(d){b.onKeyDown.addToTop(c._block);b.onKeyPress.addToTop(c._block);b.onKeyUp.addToTop(c._block);b.onPaste.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
@@ -1,90 +0,0 @@
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 Event = tinymce.dom.Event;
13
-
14
- tinymce.create('tinymce.plugins.NonEditablePlugin', {
15
- init : function(ed, url) {
16
- var t = this, editClass, nonEditClass;
17
-
18
- t.editor = ed;
19
- editClass = ed.getParam("noneditable_editable_class", "mceEditable");
20
- nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");
21
-
22
- ed.onNodeChange.addToTop(function(ed, cm, n) {
23
- var sc, ec;
24
-
25
- // Block if start or end is inside a non editable element
26
- sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
27
- return ed.dom.hasClass(n, nonEditClass);
28
- });
29
-
30
- ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
31
- return ed.dom.hasClass(n, nonEditClass);
32
- });
33
-
34
- // Block or unblock
35
- if (sc || ec) {
36
- t._setDisabled(1);
37
- return false;
38
- } else
39
- t._setDisabled(0);
40
- });
41
- },
42
-
43
- getInfo : function() {
44
- return {
45
- longname : 'Non editable elements',
46
- author : 'Moxiecode Systems AB',
47
- authorurl : 'http://tinymce.moxiecode.com',
48
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
49
- version : tinymce.majorVersion + "." + tinymce.minorVersion
50
- };
51
- },
52
-
53
- _block : function(ed, e) {
54
- var k = e.keyCode;
55
-
56
- // Don't block arrow keys, pg up/down, and F1-F12
57
- if ((k > 32 && k < 41) || (k > 111 && k < 124))
58
- return;
59
-
60
- return Event.cancel(e);
61
- },
62
-
63
- _setDisabled : function(s) {
64
- var t = this, ed = t.editor;
65
-
66
- tinymce.each(ed.controlManager.controls, function(c) {
67
- c.setDisabled(s);
68
- });
69
-
70
- if (s !== t.disabled) {
71
- if (s) {
72
- ed.onKeyDown.addToTop(t._block);
73
- ed.onKeyPress.addToTop(t._block);
74
- ed.onKeyUp.addToTop(t._block);
75
- ed.onPaste.addToTop(t._block);
76
- } else {
77
- ed.onKeyDown.remove(t._block);
78
- ed.onKeyPress.remove(t._block);
79
- ed.onKeyUp.remove(t._block);
80
- ed.onPaste.remove(t._block);
81
- }
82
-
83
- t.disabled = s;
84
- }
85
- }
86
- });
87
-
88
- // Register plugin
89
- tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin);
90
- })();
@@ -1 +0,0 @@
1
- (function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+b.theme.url+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
@@ -1,74 +0,0 @@
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
- tinymce.create('tinymce.plugins.PageBreakPlugin', {
13
- init : function(ed, url) {
14
- var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;
15
-
16
- pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
17
-
18
- // Register commands
19
- ed.addCommand('mcePageBreak', function() {
20
- ed.execCommand('mceInsertContent', 0, pb);
21
- });
22
-
23
- // Register buttons
24
- ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});
25
-
26
- ed.onInit.add(function() {
27
- if (ed.theme.onResolveName) {
28
- ed.theme.onResolveName.add(function(th, o) {
29
- if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
30
- o.name = 'pagebreak';
31
- });
32
- }
33
- });
34
-
35
- ed.onClick.add(function(ed, e) {
36
- e = e.target;
37
-
38
- if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
39
- ed.selection.select(e);
40
- });
41
-
42
- ed.onNodeChange.add(function(ed, cm, n) {
43
- cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
44
- });
45
-
46
- ed.onBeforeSetContent.add(function(ed, o) {
47
- o.content = o.content.replace(pbRE, pb);
48
- });
49
-
50
- ed.onPostProcess.add(function(ed, o) {
51
- if (o.get)
52
- o.content = o.content.replace(/<img[^>]+>/g, function(im) {
53
- if (im.indexOf('class="mcePageBreak') !== -1)
54
- im = sep;
55
-
56
- return im;
57
- });
58
- });
59
- },
60
-
61
- getInfo : function() {
62
- return {
63
- longname : 'PageBreak',
64
- author : 'Moxiecode Systems AB',
65
- authorurl : 'http://tinymce.moxiecode.com',
66
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
67
- version : tinymce.majorVersion + "." + tinymce.minorVersion
68
- };
69
- }
70
- });
71
-
72
- // Register plugin
73
- tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
74
- })();
@@ -1 +0,0 @@
1
- (function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=false;function h(m,k){var l=d.dom,i,j;f.onPreProcess.dispatch(f,m);m.node=l.create("div",0,m.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){j=l.select("p,h1,h2,h3,h4,h5,h6,pre",m.node);if(j.length==1&&m.content.indexOf("__MCE_ITEM__")===-1){l.remove(j.reverse(),true)}}}f.onPostProcess.dispatch(f,m);m.content=d.serializer.serialize(m.node,{getInner:1});if((!k)&&(d.pasteAsPlainText)){f._insertPlainText(d,l,m.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(m.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:r.replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},'\uFEFF\uFEFF<br data-mce-bogus="1">');if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort().y}o.setStyles(l,{position:"absolute",left:-10000,top:i,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,1);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<pre>"+o.encode(r).replace(/\r?\n/g,"<br />")+"</pre>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}if(b(d,"paste_block_drop")){d.onInit.add(function(){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})})}f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){d([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g,"$1"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/&quot;/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(d){c(d,function(h){if(h.constructor==RegExp){v=v.replace(h,"")}else{v=v.replace(h[0],h[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.decode(tinymce.html.Entities.encodeRaw(v));if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker">&nbsp;</span>');window.setTimeout(function(){var d=x.get("_plain_text_marker"),A,h,w,i;s.select(d,false);z.execCommand("Delete",false,null);d=null;A=s.getStart();h=x.getViewPort(n);w=x.getPos(A).y;i=A.clientHeight;if((w<h.y)||(w+i>h.y+h.h)){z.body.scrollTop=w<h.y?w:w-h.h+25}},0)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
@@ -1,930 +0,0 @@
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 each = tinymce.each,
13
- defs = {
14
- paste_auto_cleanup_on_paste : true,
15
- paste_enable_default_filters : true,
16
- paste_block_drop : false,
17
- paste_retain_style_properties : "none",
18
- paste_strip_class_attributes : "mso",
19
- paste_remove_spans : false,
20
- paste_remove_styles : false,
21
- paste_remove_styles_if_webkit : true,
22
- paste_convert_middot_lists : true,
23
- paste_convert_headers_to_strong : false,
24
- paste_dialog_width : "450",
25
- paste_dialog_height : "400",
26
- paste_text_use_dialog : false,
27
- paste_text_sticky : false,
28
- paste_text_notifyalways : false,
29
- paste_text_linebreaktype : "p",
30
- paste_text_replacements : [
31
- [/\u2026/g, "..."],
32
- [/[\x93\x94\u201c\u201d]/g, '"'],
33
- [/[\x60\x91\x92\u2018\u2019]/g, "'"]
34
- ]
35
- };
36
-
37
- function getParam(ed, name) {
38
- return ed.getParam(name, defs[name]);
39
- }
40
-
41
- tinymce.create('tinymce.plugins.PastePlugin', {
42
- init : function(ed, url) {
43
- var t = this;
44
-
45
- t.editor = ed;
46
- t.url = url;
47
-
48
- // Setup plugin events
49
- t.onPreProcess = new tinymce.util.Dispatcher(t);
50
- t.onPostProcess = new tinymce.util.Dispatcher(t);
51
-
52
- // Register default handlers
53
- t.onPreProcess.add(t._preProcess);
54
- t.onPostProcess.add(t._postProcess);
55
-
56
- // Register optional preprocess handler
57
- t.onPreProcess.add(function(pl, o) {
58
- ed.execCallback('paste_preprocess', pl, o);
59
- });
60
-
61
- // Register optional postprocess
62
- t.onPostProcess.add(function(pl, o) {
63
- ed.execCallback('paste_postprocess', pl, o);
64
- });
65
-
66
- ed.onKeyDown.addToTop(function(ed, e) {
67
- // Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
68
- if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
69
- return false; // Stop other listeners
70
- });
71
-
72
- // Initialize plain text flag
73
- ed.pasteAsPlainText = false;
74
-
75
- // This function executes the process handlers and inserts the contents
76
- // force_rich overrides plain text mode set by user, important for pasting with execCommand
77
- function process(o, force_rich) {
78
- var dom = ed.dom, rng, nodes;
79
-
80
- // Execute pre process handlers
81
- t.onPreProcess.dispatch(t, o);
82
-
83
- // Create DOM structure
84
- o.node = dom.create('div', 0, o.content);
85
-
86
- // If pasting inside the same element and the contents is only one block
87
- // remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
88
- if (tinymce.isGecko) {
89
- rng = ed.selection.getRng(true);
90
- if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
91
- nodes = dom.select('p,h1,h2,h3,h4,h5,h6,pre', o.node);
92
-
93
- // Is only one block node and it doesn't contain word stuff
94
- if (nodes.length == 1 && o.content.indexOf('__MCE_ITEM__') === -1)
95
- dom.remove(nodes.reverse(), true);
96
- }
97
- }
98
-
99
- // Execute post process handlers
100
- t.onPostProcess.dispatch(t, o);
101
-
102
- // Serialize content
103
- o.content = ed.serializer.serialize(o.node, {getInner : 1});
104
-
105
- // Plain text option active?
106
- if ((!force_rich) && (ed.pasteAsPlainText)) {
107
- t._insertPlainText(ed, dom, o.content);
108
-
109
- if (!getParam(ed, "paste_text_sticky")) {
110
- ed.pasteAsPlainText = false;
111
- ed.controlManager.setActive("pastetext", false);
112
- }
113
- } else {
114
- t._insert(o.content);
115
- }
116
- }
117
-
118
- // Add command for external usage
119
- ed.addCommand('mceInsertClipboardContent', function(u, o) {
120
- process(o, true);
121
- });
122
-
123
- if (!getParam(ed, "paste_text_use_dialog")) {
124
- ed.addCommand('mcePasteText', function(u, v) {
125
- var cookie = tinymce.util.Cookie;
126
-
127
- ed.pasteAsPlainText = !ed.pasteAsPlainText;
128
- ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
129
-
130
- if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
131
- if (getParam(ed, "paste_text_sticky")) {
132
- ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
133
- } else {
134
- ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
135
- }
136
-
137
- if (!getParam(ed, "paste_text_notifyalways")) {
138
- cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
139
- }
140
- }
141
- });
142
- }
143
-
144
- ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
145
- ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
146
-
147
- // This function grabs the contents from the clipboard by adding a
148
- // hidden div and placing the caret inside it and after the browser paste
149
- // is done it grabs that contents and processes that
150
- function grabContent(e) {
151
- var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
152
-
153
- // Check if browser supports direct plaintext access
154
- if (e.clipboardData || dom.doc.dataTransfer) {
155
- textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
156
-
157
- if (ed.pasteAsPlainText) {
158
- e.preventDefault();
159
- process({content : textContent.replace(/\r?\n/g, '<br />')});
160
- return;
161
- }
162
- }
163
-
164
- if (dom.get('_mcePaste'))
165
- return;
166
-
167
- // Create container to paste into
168
- n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF<br data-mce-bogus="1">');
169
-
170
- // If contentEditable mode we need to find out the position of the closest element
171
- if (body != ed.getDoc().body)
172
- posY = dom.getPos(ed.selection.getStart(), body).y;
173
- else
174
- posY = body.scrollTop + dom.getViewPort().y;
175
-
176
- // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
177
- dom.setStyles(n, {
178
- position : 'absolute',
179
- left : -10000,
180
- top : posY,
181
- width : 1,
182
- height : 1,
183
- overflow : 'hidden'
184
- });
185
-
186
- if (tinymce.isIE) {
187
- // Store away the old range
188
- oldRng = sel.getRng();
189
-
190
- // Select the container
191
- rng = dom.doc.body.createTextRange();
192
- rng.moveToElementText(n);
193
- rng.execCommand('Paste');
194
-
195
- // Remove container
196
- dom.remove(n);
197
-
198
- // Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
199
- // to IE security settings so we pass the junk though better than nothing right
200
- if (n.innerHTML === '\uFEFF') {
201
- ed.execCommand('mcePasteWord');
202
- e.preventDefault();
203
- return;
204
- }
205
-
206
- // Restore the old range and clear the contents before pasting
207
- sel.setRng(oldRng);
208
- sel.setContent('');
209
-
210
- // For some odd reason we need to detach the the mceInsertContent call from the paste event
211
- // It's like IE has a reference to the parent element that you paste in and the selection gets messed up
212
- // when it tries to restore the selection
213
- setTimeout(function() {
214
- // Process contents
215
- process({content : n.innerHTML});
216
- }, 0);
217
-
218
- // Block the real paste event
219
- return tinymce.dom.Event.cancel(e);
220
- } else {
221
- function block(e) {
222
- e.preventDefault();
223
- };
224
-
225
- // Block mousedown and click to prevent selection change
226
- dom.bind(ed.getDoc(), 'mousedown', block);
227
- dom.bind(ed.getDoc(), 'keydown', block);
228
-
229
- or = ed.selection.getRng();
230
-
231
- // Move caret into hidden div
232
- n = n.firstChild;
233
- rng = ed.getDoc().createRange();
234
- rng.setStart(n, 0);
235
- rng.setEnd(n, 1);
236
- sel.setRng(rng);
237
-
238
- // Wait a while and grab the pasted contents
239
- window.setTimeout(function() {
240
- var h = '', nl;
241
-
242
- // Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
243
- if (!dom.select('div.mcePaste > div.mcePaste').length) {
244
- nl = dom.select('div.mcePaste');
245
-
246
- // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
247
- each(nl, function(n) {
248
- var child = n.firstChild;
249
-
250
- // WebKit inserts a DIV container with lots of odd styles
251
- if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
252
- dom.remove(child, 1);
253
- }
254
-
255
- // Remove apply style spans
256
- each(dom.select('span.Apple-style-span', n), function(n) {
257
- dom.remove(n, 1);
258
- });
259
-
260
- // Remove bogus br elements
261
- each(dom.select('br[data-mce-bogus]', n), function(n) {
262
- dom.remove(n);
263
- });
264
-
265
- // WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
266
- if (n.parentNode.className != 'mcePaste')
267
- h += n.innerHTML;
268
- });
269
- } else {
270
- // Found WebKit weirdness so force the content into plain text mode
271
- h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>';
272
- }
273
-
274
- // Remove the nodes
275
- each(dom.select('div.mcePaste'), function(n) {
276
- dom.remove(n);
277
- });
278
-
279
- // Restore the old selection
280
- if (or)
281
- sel.setRng(or);
282
-
283
- process({content : h});
284
-
285
- // Unblock events ones we got the contents
286
- dom.unbind(ed.getDoc(), 'mousedown', block);
287
- dom.unbind(ed.getDoc(), 'keydown', block);
288
- }, 0);
289
- }
290
- }
291
-
292
- // Check if we should use the new auto process method
293
- if (getParam(ed, "paste_auto_cleanup_on_paste")) {
294
- // Is it's Opera or older FF use key handler
295
- if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
296
- ed.onKeyDown.addToTop(function(ed, e) {
297
- if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
298
- grabContent(e);
299
- });
300
- } else {
301
- // Grab contents on paste event on Gecko and WebKit
302
- ed.onPaste.addToTop(function(ed, e) {
303
- return grabContent(e);
304
- });
305
- }
306
- }
307
-
308
- // Block all drag/drop events
309
- if (getParam(ed, "paste_block_drop")) {
310
- ed.onInit.add(function() {
311
- ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
312
- e.preventDefault();
313
- e.stopPropagation();
314
-
315
- return false;
316
- });
317
- });
318
- }
319
-
320
- // Add legacy support
321
- t._legacySupport();
322
- },
323
-
324
- getInfo : function() {
325
- return {
326
- longname : 'Paste text/word',
327
- author : 'Moxiecode Systems AB',
328
- authorurl : 'http://tinymce.moxiecode.com',
329
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
330
- version : tinymce.majorVersion + "." + tinymce.minorVersion
331
- };
332
- },
333
-
334
- _preProcess : function(pl, o) {
335
- var ed = this.editor,
336
- h = o.content,
337
- grep = tinymce.grep,
338
- explode = tinymce.explode,
339
- trim = tinymce.trim,
340
- len, stripClass;
341
-
342
- //console.log('Before preprocess:' + o.content);
343
-
344
- function process(items) {
345
- each(items, function(v) {
346
- // Remove or replace
347
- if (v.constructor == RegExp)
348
- h = h.replace(v, '');
349
- else
350
- h = h.replace(v[0], v[1]);
351
- });
352
- }
353
-
354
- if (ed.settings.paste_enable_default_filters == false) {
355
- return;
356
- }
357
-
358
- // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
359
- if (tinymce.isIE && document.documentMode >= 9)
360
- process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
361
-
362
- // Detect Word content and process it more aggressive
363
- if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
364
- o.wordContent = true; // Mark the pasted contents as word specific content
365
- //console.log('Word contents detected.');
366
-
367
- // Process away some basic content
368
- process([
369
- /^\s*(&nbsp;)+/gi, // &nbsp; entities at the start of contents
370
- /(&nbsp;|<br[^>]*>)+\s*$/gi // &nbsp; entities at the end of contents
371
- ]);
372
-
373
- if (getParam(ed, "paste_convert_headers_to_strong")) {
374
- h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
375
- }
376
-
377
- if (getParam(ed, "paste_convert_middot_lists")) {
378
- process([
379
- [/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
380
- [/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
381
- [/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
382
- ]);
383
- }
384
-
385
- process([
386
- // Word comments like conditional comments etc
387
- /<!--[\s\S]+?-->/gi,
388
-
389
- // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
390
- /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
391
-
392
- // Convert <s> into <strike> for line-though
393
- [/<(\/?)s>/gi, "<$1strike>"],
394
-
395
- // Replace nsbp entites to char since it's easier to handle
396
- [/&nbsp;/gi, "\u00a0"]
397
- ]);
398
-
399
- // Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
400
- // If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
401
- do {
402
- len = h.length;
403
- h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
404
- } while (len != h.length);
405
-
406
- // Remove all spans if no styles is to be retained
407
- if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
408
- h = h.replace(/<\/?span[^>]*>/gi, "");
409
- } else {
410
- // We're keeping styles, so at least clean them up.
411
- // CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
412
-
413
- process([
414
- // Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
415
- [/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
416
- function(str, spaces) {
417
- return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
418
- }
419
- ],
420
-
421
- // Examine all styles: delete junk, transform some, and keep the rest
422
- [/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
423
- function(str, tag, style) {
424
- var n = [],
425
- i = 0,
426
- s = explode(trim(style).replace(/&quot;/gi, "'"), ";");
427
-
428
- // Examine each style definition within the tag's style attribute
429
- each(s, function(v) {
430
- var name, value,
431
- parts = explode(v, ":");
432
-
433
- function ensureUnits(v) {
434
- return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
435
- }
436
-
437
- if (parts.length == 2) {
438
- name = parts[0].toLowerCase();
439
- value = parts[1].toLowerCase();
440
-
441
- // Translate certain MS Office styles into their CSS equivalents
442
- switch (name) {
443
- case "mso-padding-alt":
444
- case "mso-padding-top-alt":
445
- case "mso-padding-right-alt":
446
- case "mso-padding-bottom-alt":
447
- case "mso-padding-left-alt":
448
- case "mso-margin-alt":
449
- case "mso-margin-top-alt":
450
- case "mso-margin-right-alt":
451
- case "mso-margin-bottom-alt":
452
- case "mso-margin-left-alt":
453
- case "mso-table-layout-alt":
454
- case "mso-height":
455
- case "mso-width":
456
- case "mso-vertical-align-alt":
457
- n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
458
- return;
459
-
460
- case "horiz-align":
461
- n[i++] = "text-align:" + value;
462
- return;
463
-
464
- case "vert-align":
465
- n[i++] = "vertical-align:" + value;
466
- return;
467
-
468
- case "font-color":
469
- case "mso-foreground":
470
- n[i++] = "color:" + value;
471
- return;
472
-
473
- case "mso-background":
474
- case "mso-highlight":
475
- n[i++] = "background:" + value;
476
- return;
477
-
478
- case "mso-default-height":
479
- n[i++] = "min-height:" + ensureUnits(value);
480
- return;
481
-
482
- case "mso-default-width":
483
- n[i++] = "min-width:" + ensureUnits(value);
484
- return;
485
-
486
- case "mso-padding-between-alt":
487
- n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
488
- return;
489
-
490
- case "text-line-through":
491
- if ((value == "single") || (value == "double")) {
492
- n[i++] = "text-decoration:line-through";
493
- }
494
- return;
495
-
496
- case "mso-zero-height":
497
- if (value == "yes") {
498
- n[i++] = "display:none";
499
- }
500
- return;
501
- }
502
-
503
- // Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
504
- if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
505
- return;
506
- }
507
-
508
- // If it reached this point, it must be a valid CSS style
509
- n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
510
- }
511
- });
512
-
513
- // If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
514
- if (i > 0) {
515
- return tag + ' style="' + n.join(';') + '"';
516
- } else {
517
- return tag;
518
- }
519
- }
520
- ]
521
- ]);
522
- }
523
- }
524
-
525
- // Replace headers with <strong>
526
- if (getParam(ed, "paste_convert_headers_to_strong")) {
527
- process([
528
- [/<h[1-6][^>]*>/gi, "<p><strong>"],
529
- [/<\/h[1-6][^>]*>/gi, "</strong></p>"]
530
- ]);
531
- }
532
-
533
- process([
534
- // Copy paste from Java like Open Office will produce this junk on FF
535
- [/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
536
- ]);
537
-
538
- // Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
539
- // Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
540
- stripClass = getParam(ed, "paste_strip_class_attributes");
541
-
542
- if (stripClass !== "none") {
543
- function removeClasses(match, g1) {
544
- if (stripClass === "all")
545
- return '';
546
-
547
- var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
548
- function(v) {
549
- return (/^(?!mso)/i.test(v));
550
- }
551
- );
552
-
553
- return cls.length ? ' class="' + cls.join(" ") + '"' : '';
554
- };
555
-
556
- h = h.replace(/ class="([^"]+)"/gi, removeClasses);
557
- h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
558
- }
559
-
560
- // Remove spans option
561
- if (getParam(ed, "paste_remove_spans")) {
562
- h = h.replace(/<\/?span[^>]*>/gi, "");
563
- }
564
-
565
- //console.log('After preprocess:' + h);
566
-
567
- o.content = h;
568
- },
569
-
570
- /**
571
- * Various post process items.
572
- */
573
- _postProcess : function(pl, o) {
574
- var t = this, ed = t.editor, dom = ed.dom, styleProps;
575
-
576
- if (ed.settings.paste_enable_default_filters == false) {
577
- return;
578
- }
579
-
580
- if (o.wordContent) {
581
- // Remove named anchors or TOC links
582
- each(dom.select('a', o.node), function(a) {
583
- if (!a.href || a.href.indexOf('#_Toc') != -1)
584
- dom.remove(a, 1);
585
- });
586
-
587
- if (getParam(ed, "paste_convert_middot_lists")) {
588
- t._convertLists(pl, o);
589
- }
590
-
591
- // Process styles
592
- styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
593
-
594
- // Process only if a string was specified and not equal to "all" or "*"
595
- if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
596
- styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
597
-
598
- // Retains some style properties
599
- each(dom.select('*', o.node), function(el) {
600
- var newStyle = {}, npc = 0, i, sp, sv;
601
-
602
- // Store a subset of the existing styles
603
- if (styleProps) {
604
- for (i = 0; i < styleProps.length; i++) {
605
- sp = styleProps[i];
606
- sv = dom.getStyle(el, sp);
607
-
608
- if (sv) {
609
- newStyle[sp] = sv;
610
- npc++;
611
- }
612
- }
613
- }
614
-
615
- // Remove all of the existing styles
616
- dom.setAttrib(el, 'style', '');
617
-
618
- if (styleProps && npc > 0)
619
- dom.setStyles(el, newStyle); // Add back the stored subset of styles
620
- else // Remove empty span tags that do not have class attributes
621
- if (el.nodeName == 'SPAN' && !el.className)
622
- dom.remove(el, true);
623
- });
624
- }
625
- }
626
-
627
- // Remove all style information or only specifically on WebKit to avoid the style bug on that browser
628
- if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
629
- each(dom.select('*[style]', o.node), function(el) {
630
- el.removeAttribute('style');
631
- el.removeAttribute('data-mce-style');
632
- });
633
- } else {
634
- if (tinymce.isWebKit) {
635
- // We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
636
- // Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
637
- each(dom.select('*', o.node), function(el) {
638
- el.removeAttribute('data-mce-style');
639
- });
640
- }
641
- }
642
- },
643
-
644
- /**
645
- * Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
646
- */
647
- _convertLists : function(pl, o) {
648
- var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
649
-
650
- // Convert middot lists into real semantic lists
651
- each(dom.select('p', o.node), function(p) {
652
- var sib, val = '', type, html, idx, parents;
653
-
654
- // Get text node value at beginning of paragraph
655
- for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
656
- val += sib.nodeValue;
657
-
658
- val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');
659
-
660
- // Detect unordered lists look for bullets
661
- if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
662
- type = 'ul';
663
-
664
- // Detect ordered lists 1., a. or ixv.
665
- if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
666
- type = 'ol';
667
-
668
- // Check if node value matches the list pattern: o&nbsp;&nbsp;
669
- if (type) {
670
- margin = parseFloat(p.style.marginLeft || 0);
671
-
672
- if (margin > lastMargin)
673
- levels.push(margin);
674
-
675
- if (!listElm || type != lastType) {
676
- listElm = dom.create(type);
677
- dom.insertAfter(listElm, p);
678
- } else {
679
- // Nested list element
680
- if (margin > lastMargin) {
681
- listElm = li.appendChild(dom.create(type));
682
- } else if (margin < lastMargin) {
683
- // Find parent level based on margin value
684
- idx = tinymce.inArray(levels, margin);
685
- parents = dom.getParents(listElm.parentNode, type);
686
- listElm = parents[parents.length - 1 - idx] || listElm;
687
- }
688
- }
689
-
690
- // Remove middot or number spans if they exists
691
- each(dom.select('span', p), function(span) {
692
- var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
693
-
694
- // Remove span with the middot or the number
695
- if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
696
- dom.remove(span);
697
- else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))
698
- dom.remove(span);
699
- });
700
-
701
- html = p.innerHTML;
702
-
703
- // Remove middot/list items
704
- if (type == 'ul')
705
- html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');
706
- else
707
- html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');
708
-
709
- // Create li and add paragraph data into the new li
710
- li = listElm.appendChild(dom.create('li', 0, html));
711
- dom.remove(p);
712
-
713
- lastMargin = margin;
714
- lastType = type;
715
- } else
716
- listElm = lastMargin = 0; // End list element
717
- });
718
-
719
- // Remove any left over makers
720
- html = o.node.innerHTML;
721
- if (html.indexOf('__MCE_ITEM__') != -1)
722
- o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
723
- },
724
-
725
- /**
726
- * Inserts the specified contents at the caret position.
727
- */
728
- _insert : function(h, skip_undo) {
729
- var ed = this.editor, r = ed.selection.getRng();
730
-
731
- // First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
732
- if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
733
- ed.getDoc().execCommand('Delete', false, null);
734
-
735
- ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
736
- },
737
-
738
- /**
739
- * Instead of the old plain text method which tried to re-create a paste operation, the
740
- * new approach adds a plain text mode toggle switch that changes the behavior of paste.
741
- * This function is passed the same input that the regular paste plugin produces.
742
- * It performs additional scrubbing and produces (and inserts) the plain text.
743
- * This approach leverages all of the great existing functionality in the paste
744
- * plugin, and requires minimal changes to add the new functionality.
745
- * Speednet - June 2009
746
- */
747
- _insertPlainText : function(ed, dom, h) {
748
- var i, len, pos, rpos, node, breakElms, before, after,
749
- w = ed.getWin(),
750
- d = ed.getDoc(),
751
- sel = ed.selection,
752
- is = tinymce.is,
753
- inArray = tinymce.inArray,
754
- linebr = getParam(ed, "paste_text_linebreaktype"),
755
- rl = getParam(ed, "paste_text_replacements");
756
-
757
- function process(items) {
758
- each(items, function(v) {
759
- if (v.constructor == RegExp)
760
- h = h.replace(v, "");
761
- else
762
- h = h.replace(v[0], v[1]);
763
- });
764
- };
765
-
766
- if ((typeof(h) === "string") && (h.length > 0)) {
767
- // If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
768
- if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
769
- process([
770
- /[\n\r]+/g
771
- ]);
772
- } else {
773
- // Otherwise just get rid of carriage returns (only need linefeeds)
774
- process([
775
- /\r+/g
776
- ]);
777
- }
778
-
779
- process([
780
- [/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
781
- [/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
782
- [/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
783
- /<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
784
- [/&nbsp;/gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
785
- [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
786
- [/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
787
- /^\s+|\s+$/g // Trim the front & back
788
- ]);
789
-
790
- h = dom.decode(tinymce.html.Entities.encodeRaw(h));
791
-
792
- // Delete any highlighted text before pasting
793
- if (!sel.isCollapsed()) {
794
- d.execCommand("Delete", false, null);
795
- }
796
-
797
- // Perform default or custom replacements
798
- if (is(rl, "array") || (is(rl, "array"))) {
799
- process(rl);
800
- }
801
- else if (is(rl, "string")) {
802
- process(new RegExp(rl, "gi"));
803
- }
804
-
805
- // Treat paragraphs as specified in the config
806
- if (linebr == "none") {
807
- process([
808
- [/\n+/g, " "]
809
- ]);
810
- }
811
- else if (linebr == "br") {
812
- process([
813
- [/\n/g, "<br />"]
814
- ]);
815
- }
816
- else {
817
- process([
818
- /^\s+|\s+$/g,
819
- [/\n\n/g, "</p><p>"],
820
- [/\n/g, "<br />"]
821
- ]);
822
- }
823
-
824
- // This next piece of code handles the situation where we're pasting more than one paragraph of plain
825
- // text, and we are pasting the content into the middle of a block node in the editor. The block
826
- // node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
827
- // The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
828
- // pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
829
- // "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
830
- // now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
831
- // plain text take the same style as the existing paragraph.)
832
- if ((pos = h.indexOf("</p><p>")) != -1) {
833
- rpos = h.lastIndexOf("</p><p>");
834
- node = sel.getNode();
835
- breakElms = []; // Get list of elements to break
836
-
837
- do {
838
- if (node.nodeType == 1) {
839
- // Don't break tables and break at body
840
- if (node.nodeName == "TD" || node.nodeName == "BODY") {
841
- break;
842
- }
843
-
844
- breakElms[breakElms.length] = node;
845
- }
846
- } while (node = node.parentNode);
847
-
848
- // Are we in the middle of a block node?
849
- if (breakElms.length > 0) {
850
- before = h.substring(0, pos);
851
- after = "";
852
-
853
- for (i=0, len=breakElms.length; i<len; i++) {
854
- before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
855
- after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
856
- }
857
-
858
- if (pos == rpos) {
859
- h = before + after + h.substring(pos+7);
860
- }
861
- else {
862
- h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
863
- }
864
- }
865
- }
866
-
867
- // Insert content at the caret, plus add a marker for repositioning the caret
868
- ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker">&nbsp;</span>');
869
-
870
- // Reposition the caret to the marker, which was placed immediately after the inserted content.
871
- // Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
872
- // The second part of the code scrolls the content up if the caret is positioned off-screen.
873
- // This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
874
- window.setTimeout(function() {
875
- var marker = dom.get('_plain_text_marker'),
876
- elm, vp, y, elmHeight;
877
-
878
- sel.select(marker, false);
879
- d.execCommand("Delete", false, null);
880
- marker = null;
881
-
882
- // Get element, position and height
883
- elm = sel.getStart();
884
- vp = dom.getViewPort(w);
885
- y = dom.getPos(elm).y;
886
- elmHeight = elm.clientHeight;
887
-
888
- // Is element within viewport if not then scroll it into view
889
- if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
890
- d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
891
- }
892
- }, 0);
893
- }
894
- },
895
-
896
- /**
897
- * This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
898
- */
899
- _legacySupport : function() {
900
- var t = this, ed = t.editor;
901
-
902
- // Register command(s) for backwards compatibility
903
- ed.addCommand("mcePasteWord", function() {
904
- ed.windowManager.open({
905
- file: t.url + "/pasteword.htm",
906
- width: parseInt(getParam(ed, "paste_dialog_width")),
907
- height: parseInt(getParam(ed, "paste_dialog_height")),
908
- inline: 1
909
- });
910
- });
911
-
912
- if (getParam(ed, "paste_text_use_dialog")) {
913
- ed.addCommand("mcePasteText", function() {
914
- ed.windowManager.open({
915
- file : t.url + "/pastetext.htm",
916
- width: parseInt(getParam(ed, "paste_dialog_width")),
917
- height: parseInt(getParam(ed, "paste_dialog_height")),
918
- inline : 1
919
- });
920
- });
921
- }
922
-
923
- // Register button for backwards compatibility
924
- ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
925
- }
926
- });
927
-
928
- // Register plugin
929
- tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
930
- })();