tinymce-rails 3.4.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. data/README.md +57 -0
  2. data/Rakefile +52 -0
  3. data/assets/integration/tinymce.jquery.js +3 -0
  4. data/assets/integration/tinymce.js +2 -0
  5. data/assets/integration/tinymce.preinit.js.erb +1 -0
  6. data/assets/vendor/tinymce/jquery.tinymce.js +1 -0
  7. data/assets/vendor/tinymce/langs/en.js +223 -0
  8. data/assets/vendor/tinymce/license.txt +504 -0
  9. data/assets/vendor/tinymce/plugins/advhr/css/advhr.css +5 -0
  10. data/assets/vendor/tinymce/plugins/advhr/editor_plugin.js +57 -0
  11. data/assets/vendor/tinymce/plugins/advhr/js/rule.js +43 -0
  12. data/assets/vendor/tinymce/plugins/advhr/langs/en_dlg.js +7 -0
  13. data/assets/vendor/tinymce/plugins/advhr/rule.htm +58 -0
  14. data/assets/vendor/tinymce/plugins/advimage/css/advimage.css +13 -0
  15. data/assets/vendor/tinymce/plugins/advimage/editor_plugin.js +50 -0
  16. data/assets/vendor/tinymce/plugins/advimage/image.htm +235 -0
  17. data/assets/vendor/tinymce/plugins/advimage/img/sample.gif +0 -0
  18. data/assets/vendor/tinymce/plugins/advimage/js/image.js +458 -0
  19. data/assets/vendor/tinymce/plugins/advimage/langs/en_dlg.js +45 -0
  20. data/assets/vendor/tinymce/plugins/advlink/css/advlink.css +8 -0
  21. data/assets/vendor/tinymce/plugins/advlink/editor_plugin.js +61 -0
  22. data/assets/vendor/tinymce/plugins/advlink/js/advlink.js +532 -0
  23. data/assets/vendor/tinymce/plugins/advlink/langs/en_dlg.js +54 -0
  24. data/assets/vendor/tinymce/plugins/advlink/link.htm +338 -0
  25. data/assets/vendor/tinymce/plugins/advlist/editor_plugin.js +176 -0
  26. data/assets/vendor/tinymce/plugins/autolink/editor_plugin.js +172 -0
  27. data/assets/vendor/tinymce/plugins/autoresize/editor_plugin.js +137 -0
  28. data/assets/vendor/tinymce/plugins/autosave/editor_plugin.js +431 -0
  29. data/assets/vendor/tinymce/plugins/autosave/langs/en.js +4 -0
  30. data/assets/vendor/tinymce/plugins/bbcode/editor_plugin.js +120 -0
  31. data/assets/vendor/tinymce/plugins/contextmenu/editor_plugin.js +160 -0
  32. data/assets/vendor/tinymce/plugins/directionality/editor_plugin.js +82 -0
  33. data/assets/vendor/tinymce/plugins/emotions/editor_plugin.js +43 -0
  34. data/assets/vendor/tinymce/plugins/emotions/emotions.htm +41 -0
  35. data/assets/vendor/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
  36. data/assets/vendor/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
  37. data/assets/vendor/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  38. data/assets/vendor/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  39. data/assets/vendor/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
  40. data/assets/vendor/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
  41. data/assets/vendor/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
  42. data/assets/vendor/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
  43. data/assets/vendor/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  44. data/assets/vendor/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
  45. data/assets/vendor/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
  46. data/assets/vendor/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
  47. data/assets/vendor/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  48. data/assets/vendor/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
  49. data/assets/vendor/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
  50. data/assets/vendor/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
  51. data/assets/vendor/tinymce/plugins/emotions/js/emotions.js +22 -0
  52. data/assets/vendor/tinymce/plugins/emotions/langs/en_dlg.js +20 -0
  53. data/assets/vendor/tinymce/plugins/example/dialog.htm +22 -0
  54. data/assets/vendor/tinymce/plugins/example/editor_plugin.js +84 -0
  55. data/assets/vendor/tinymce/plugins/example/img/example.gif +0 -0
  56. data/assets/vendor/tinymce/plugins/example/js/dialog.js +19 -0
  57. data/assets/vendor/tinymce/plugins/example/langs/en.js +3 -0
  58. data/assets/vendor/tinymce/plugins/example/langs/en_dlg.js +3 -0
  59. data/assets/vendor/tinymce/plugins/example_dependency/editor_plugin.js +50 -0
  60. data/assets/vendor/tinymce/plugins/fullpage/css/fullpage.css +143 -0
  61. data/assets/vendor/tinymce/plugins/fullpage/editor_plugin.js +399 -0
  62. data/assets/vendor/tinymce/plugins/fullpage/fullpage.htm +259 -0
  63. data/assets/vendor/tinymce/plugins/fullpage/js/fullpage.js +232 -0
  64. data/assets/vendor/tinymce/plugins/fullpage/langs/en_dlg.js +85 -0
  65. data/assets/vendor/tinymce/plugins/fullscreen/editor_plugin.js +159 -0
  66. data/assets/vendor/tinymce/plugins/fullscreen/fullscreen.htm +109 -0
  67. data/assets/vendor/tinymce/plugins/iespell/editor_plugin.js +54 -0
  68. data/assets/vendor/tinymce/plugins/inlinepopups/editor_plugin.js +696 -0
  69. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  70. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  71. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  72. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  73. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  74. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  75. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  76. data/assets/vendor/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  77. data/assets/vendor/tinymce/plugins/inlinepopups/template.htm +387 -0
  78. data/assets/vendor/tinymce/plugins/insertdatetime/editor_plugin.js +83 -0
  79. data/assets/vendor/tinymce/plugins/layer/editor_plugin.js +214 -0
  80. data/assets/vendor/tinymce/plugins/legacyoutput/editor_plugin.js +139 -0
  81. data/assets/vendor/tinymce/plugins/lists/editor_plugin.js +688 -0
  82. data/assets/vendor/tinymce/plugins/media/css/media.css +17 -0
  83. data/assets/vendor/tinymce/plugins/media/editor_plugin.js +777 -0
  84. data/assets/vendor/tinymce/plugins/media/js/embed.js +73 -0
  85. data/assets/vendor/tinymce/plugins/media/js/media.js +355 -0
  86. data/assets/vendor/tinymce/plugins/media/langs/en_dlg.js +109 -0
  87. data/assets/vendor/tinymce/plugins/media/media.htm +812 -0
  88. data/assets/vendor/tinymce/plugins/media/moxieplayer.swf +0 -0
  89. data/assets/vendor/tinymce/plugins/nonbreaking/editor_plugin.js +53 -0
  90. data/assets/vendor/tinymce/plugins/noneditable/editor_plugin.js +95 -0
  91. data/assets/vendor/tinymce/plugins/pagebreak/editor_plugin.js +74 -0
  92. data/assets/vendor/tinymce/plugins/paste/editor_plugin.js +942 -0
  93. data/assets/vendor/tinymce/plugins/paste/js/pastetext.js +36 -0
  94. data/assets/vendor/tinymce/plugins/paste/js/pasteword.js +51 -0
  95. data/assets/vendor/tinymce/plugins/paste/langs/en_dlg.js +5 -0
  96. data/assets/vendor/tinymce/plugins/paste/pastetext.htm +27 -0
  97. data/assets/vendor/tinymce/plugins/paste/pasteword.htm +21 -0
  98. data/assets/vendor/tinymce/plugins/preview/editor_plugin.js +53 -0
  99. data/assets/vendor/tinymce/plugins/preview/example.html +28 -0
  100. data/assets/vendor/tinymce/plugins/preview/jscripts/embed.js +73 -0
  101. data/assets/vendor/tinymce/plugins/preview/preview.html +17 -0
  102. data/assets/vendor/tinymce/plugins/print/editor_plugin.js +34 -0
  103. data/assets/vendor/tinymce/plugins/save/editor_plugin.js +101 -0
  104. data/assets/vendor/tinymce/plugins/searchreplace/css/searchreplace.css +6 -0
  105. data/assets/vendor/tinymce/plugins/searchreplace/editor_plugin.js +61 -0
  106. data/assets/vendor/tinymce/plugins/searchreplace/js/searchreplace.js +142 -0
  107. data/assets/vendor/tinymce/plugins/searchreplace/langs/en_dlg.js +16 -0
  108. data/assets/vendor/tinymce/plugins/searchreplace/searchreplace.htm +100 -0
  109. data/assets/vendor/tinymce/plugins/spellchecker/css/content.css +1 -0
  110. data/assets/vendor/tinymce/plugins/spellchecker/editor_plugin.js +434 -0
  111. data/assets/vendor/tinymce/plugins/spellchecker/img/wline.gif +0 -0
  112. data/assets/vendor/tinymce/plugins/style/css/props.css +13 -0
  113. data/assets/vendor/tinymce/plugins/style/editor_plugin.js +55 -0
  114. data/assets/vendor/tinymce/plugins/style/js/props.js +635 -0
  115. data/assets/vendor/tinymce/plugins/style/langs/en_dlg.js +70 -0
  116. data/assets/vendor/tinymce/plugins/style/props.htm +838 -0
  117. data/assets/vendor/tinymce/plugins/tabfocus/editor_plugin.js +114 -0
  118. data/assets/vendor/tinymce/plugins/table/cell.htm +180 -0
  119. data/assets/vendor/tinymce/plugins/table/css/cell.css +17 -0
  120. data/assets/vendor/tinymce/plugins/table/css/row.css +25 -0
  121. data/assets/vendor/tinymce/plugins/table/css/table.css +13 -0
  122. data/assets/vendor/tinymce/plugins/table/editor_plugin.js +1263 -0
  123. data/assets/vendor/tinymce/plugins/table/js/cell.js +319 -0
  124. data/assets/vendor/tinymce/plugins/table/js/merge_cells.js +27 -0
  125. data/assets/vendor/tinymce/plugins/table/js/row.js +237 -0
  126. data/assets/vendor/tinymce/plugins/table/js/table.js +450 -0
  127. data/assets/vendor/tinymce/plugins/table/langs/en_dlg.js +75 -0
  128. data/assets/vendor/tinymce/plugins/table/merge_cells.htm +32 -0
  129. data/assets/vendor/tinymce/plugins/table/row.htm +158 -0
  130. data/assets/vendor/tinymce/plugins/table/table.htm +188 -0
  131. data/assets/vendor/tinymce/plugins/template/blank.htm +12 -0
  132. data/assets/vendor/tinymce/plugins/template/css/template.css +23 -0
  133. data/assets/vendor/tinymce/plugins/template/editor_plugin.js +159 -0
  134. data/assets/vendor/tinymce/plugins/template/js/template.js +106 -0
  135. data/assets/vendor/tinymce/plugins/template/langs/en_dlg.js +15 -0
  136. data/assets/vendor/tinymce/plugins/template/template.htm +31 -0
  137. data/assets/vendor/tinymce/plugins/visualchars/editor_plugin.js +83 -0
  138. data/assets/vendor/tinymce/plugins/wordcount/editor_plugin.js +114 -0
  139. data/assets/vendor/tinymce/plugins/xhtmlxtras/abbr.htm +142 -0
  140. data/assets/vendor/tinymce/plugins/xhtmlxtras/acronym.htm +142 -0
  141. data/assets/vendor/tinymce/plugins/xhtmlxtras/attributes.htm +149 -0
  142. data/assets/vendor/tinymce/plugins/xhtmlxtras/cite.htm +142 -0
  143. data/assets/vendor/tinymce/plugins/xhtmlxtras/css/attributes.css +11 -0
  144. data/assets/vendor/tinymce/plugins/xhtmlxtras/css/popup.css +9 -0
  145. data/assets/vendor/tinymce/plugins/xhtmlxtras/del.htm +162 -0
  146. data/assets/vendor/tinymce/plugins/xhtmlxtras/editor_plugin.js +132 -0
  147. data/assets/vendor/tinymce/plugins/xhtmlxtras/ins.htm +162 -0
  148. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/abbr.js +28 -0
  149. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/acronym.js +28 -0
  150. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/attributes.js +111 -0
  151. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/cite.js +28 -0
  152. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/del.js +53 -0
  153. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/element_common.js +229 -0
  154. data/assets/vendor/tinymce/plugins/xhtmlxtras/js/ins.js +53 -0
  155. data/assets/vendor/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  156. data/assets/vendor/tinymce/themes/advanced/about.htm +52 -0
  157. data/assets/vendor/tinymce/themes/advanced/anchor.htm +26 -0
  158. data/assets/vendor/tinymce/themes/advanced/charmap.htm +51 -0
  159. data/assets/vendor/tinymce/themes/advanced/color_picker.htm +74 -0
  160. data/assets/vendor/tinymce/themes/advanced/editor_template.js +1358 -0
  161. data/assets/vendor/tinymce/themes/advanced/image.htm +80 -0
  162. data/assets/vendor/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
  163. data/assets/vendor/tinymce/themes/advanced/img/flash.gif +0 -0
  164. data/assets/vendor/tinymce/themes/advanced/img/icons.gif +0 -0
  165. data/assets/vendor/tinymce/themes/advanced/img/iframe.gif +0 -0
  166. data/assets/vendor/tinymce/themes/advanced/img/pagebreak.gif +0 -0
  167. data/assets/vendor/tinymce/themes/advanced/img/quicktime.gif +0 -0
  168. data/assets/vendor/tinymce/themes/advanced/img/realmedia.gif +0 -0
  169. data/assets/vendor/tinymce/themes/advanced/img/shockwave.gif +0 -0
  170. data/assets/vendor/tinymce/themes/advanced/img/trans.gif +0 -0
  171. data/assets/vendor/tinymce/themes/advanced/img/video.gif +0 -0
  172. data/assets/vendor/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
  173. data/assets/vendor/tinymce/themes/advanced/js/about.js +73 -0
  174. data/assets/vendor/tinymce/themes/advanced/js/anchor.js +42 -0
  175. data/assets/vendor/tinymce/themes/advanced/js/charmap.js +355 -0
  176. data/assets/vendor/tinymce/themes/advanced/js/color_picker.js +329 -0
  177. data/assets/vendor/tinymce/themes/advanced/js/image.js +247 -0
  178. data/assets/vendor/tinymce/themes/advanced/js/link.js +153 -0
  179. data/assets/vendor/tinymce/themes/advanced/js/source_editor.js +56 -0
  180. data/assets/vendor/tinymce/themes/advanced/langs/en.js +68 -0
  181. data/assets/vendor/tinymce/themes/advanced/langs/en_dlg.js +54 -0
  182. data/assets/vendor/tinymce/themes/advanced/link.htm +57 -0
  183. data/assets/vendor/tinymce/themes/advanced/shortcuts.htm +47 -0
  184. data/assets/vendor/tinymce/themes/advanced/skins/default/content.css +47 -0
  185. data/assets/vendor/tinymce/themes/advanced/skins/default/dialog.css +117 -0
  186. data/assets/vendor/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
  187. data/assets/vendor/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
  188. data/assets/vendor/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  189. data/assets/vendor/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  190. data/assets/vendor/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
  191. data/assets/vendor/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
  192. data/assets/vendor/tinymce/themes/advanced/skins/default/ui.css +214 -0
  193. data/assets/vendor/tinymce/themes/advanced/skins/highcontrast/content.css +23 -0
  194. data/assets/vendor/tinymce/themes/advanced/skins/highcontrast/dialog.css +105 -0
  195. data/assets/vendor/tinymce/themes/advanced/skins/highcontrast/ui.css +102 -0
  196. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/content.css +46 -0
  197. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/dialog.css +117 -0
  198. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  199. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  200. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  201. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/ui.css +217 -0
  202. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  203. data/assets/vendor/tinymce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  204. data/assets/vendor/tinymce/themes/advanced/source_editor.htm +25 -0
  205. data/assets/vendor/tinymce/themes/simple/editor_template.js +84 -0
  206. data/assets/vendor/tinymce/themes/simple/img/icons.gif +0 -0
  207. data/assets/vendor/tinymce/themes/simple/langs/en.js +11 -0
  208. data/assets/vendor/tinymce/themes/simple/skins/default/content.css +25 -0
  209. data/assets/vendor/tinymce/themes/simple/skins/default/ui.css +32 -0
  210. data/assets/vendor/tinymce/themes/simple/skins/o2k7/content.css +17 -0
  211. data/assets/vendor/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  212. data/assets/vendor/tinymce/themes/simple/skins/o2k7/ui.css +35 -0
  213. data/assets/vendor/tinymce/tiny_mce.js +15338 -0
  214. data/assets/vendor/tinymce/tiny_mce_popup.js +5 -0
  215. data/assets/vendor/tinymce/utils/editable_selects.js +70 -0
  216. data/assets/vendor/tinymce/utils/form_utils.js +210 -0
  217. data/assets/vendor/tinymce/utils/mctabs.js +162 -0
  218. data/assets/vendor/tinymce/utils/validate.js +252 -0
  219. data/lib/tinymce-rails.rb +2 -0
  220. data/lib/tinymce/railtie.rb +17 -0
  221. data/lib/tinymce/version.rb +3 -0
  222. metadata +300 -0
@@ -0,0 +1,319 @@
1
+ tinyMCEPopup.requireLangPack();
2
+
3
+ var ed;
4
+
5
+ function init() {
6
+ ed = tinyMCEPopup.editor;
7
+ tinyMCEPopup.resizeToInnerSize();
8
+
9
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
10
+ document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
11
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
12
+
13
+ var inst = ed;
14
+ var tdElm = ed.dom.getParent(ed.selection.getStart(), "td,th");
15
+ var formObj = document.forms[0];
16
+ var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
17
+
18
+ // Get table cell data
19
+ var celltype = tdElm.nodeName.toLowerCase();
20
+ var align = ed.dom.getAttrib(tdElm, 'align');
21
+ var valign = ed.dom.getAttrib(tdElm, 'valign');
22
+ var width = trimSize(getStyle(tdElm, 'width', 'width'));
23
+ var height = trimSize(getStyle(tdElm, 'height', 'height'));
24
+ var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
25
+ var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
26
+ var className = ed.dom.getAttrib(tdElm, 'class');
27
+ var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
28
+ var id = ed.dom.getAttrib(tdElm, 'id');
29
+ var lang = ed.dom.getAttrib(tdElm, 'lang');
30
+ var dir = ed.dom.getAttrib(tdElm, 'dir');
31
+ var scope = ed.dom.getAttrib(tdElm, 'scope');
32
+
33
+ // Setup form
34
+ addClassesToList('class', 'table_cell_styles');
35
+ TinyMCE_EditableSelects.init();
36
+
37
+ if (!ed.dom.hasClass(tdElm, 'mceSelected')) {
38
+ formObj.bordercolor.value = bordercolor;
39
+ formObj.bgcolor.value = bgcolor;
40
+ formObj.backgroundimage.value = backgroundimage;
41
+ formObj.width.value = width;
42
+ formObj.height.value = height;
43
+ formObj.id.value = id;
44
+ formObj.lang.value = lang;
45
+ formObj.style.value = ed.dom.serializeStyle(st);
46
+ selectByValue(formObj, 'align', align);
47
+ selectByValue(formObj, 'valign', valign);
48
+ selectByValue(formObj, 'class', className, true, true);
49
+ selectByValue(formObj, 'celltype', celltype);
50
+ selectByValue(formObj, 'dir', dir);
51
+ selectByValue(formObj, 'scope', scope);
52
+
53
+ // Resize some elements
54
+ if (isVisible('backgroundimagebrowser'))
55
+ document.getElementById('backgroundimage').style.width = '180px';
56
+
57
+ updateColor('bordercolor_pick', 'bordercolor');
58
+ updateColor('bgcolor_pick', 'bgcolor');
59
+ } else
60
+ tinyMCEPopup.dom.hide('action');
61
+ }
62
+
63
+ function updateAction() {
64
+ var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
65
+
66
+ if (!AutoValidator.validate(formObj)) {
67
+ tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
68
+ return false;
69
+ }
70
+
71
+ tinyMCEPopup.restoreSelection();
72
+ el = ed.selection.getStart();
73
+ tdElm = ed.dom.getParent(el, "td,th");
74
+ trElm = ed.dom.getParent(el, "tr");
75
+ tableElm = ed.dom.getParent(el, "table");
76
+
77
+ // Cell is selected
78
+ if (ed.dom.hasClass(tdElm, 'mceSelected')) {
79
+ // Update all selected sells
80
+ tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) {
81
+ updateCell(td);
82
+ });
83
+
84
+ ed.addVisual();
85
+ ed.nodeChanged();
86
+ inst.execCommand('mceEndUndoLevel');
87
+ tinyMCEPopup.close();
88
+ return;
89
+ }
90
+
91
+ switch (getSelectValue(formObj, 'action')) {
92
+ case "cell":
93
+ var celltype = getSelectValue(formObj, 'celltype');
94
+ var scope = getSelectValue(formObj, 'scope');
95
+
96
+ function doUpdate(s) {
97
+ if (s) {
98
+ updateCell(tdElm);
99
+
100
+ ed.addVisual();
101
+ ed.nodeChanged();
102
+ inst.execCommand('mceEndUndoLevel');
103
+ tinyMCEPopup.close();
104
+ }
105
+ };
106
+
107
+ if (ed.getParam("accessibility_warnings", 1)) {
108
+ if (celltype == "th" && scope == "")
109
+ tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
110
+ else
111
+ doUpdate(1);
112
+
113
+ return;
114
+ }
115
+
116
+ updateCell(tdElm);
117
+ break;
118
+
119
+ case "row":
120
+ var cell = trElm.firstChild;
121
+
122
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
123
+ cell = nextCell(cell);
124
+
125
+ do {
126
+ cell = updateCell(cell, true);
127
+ } while ((cell = nextCell(cell)) != null);
128
+
129
+ break;
130
+
131
+ case "col":
132
+ var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");
133
+
134
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
135
+ cell = nextCell(cell);
136
+
137
+ do {
138
+ if (cell == tdElm)
139
+ break;
140
+ col += cell.getAttribute("colspan");
141
+ } while ((cell = nextCell(cell)) != null);
142
+
143
+ for (var i=0; i<rows.length; i++) {
144
+ cell = rows[i].firstChild;
145
+
146
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
147
+ cell = nextCell(cell);
148
+
149
+ curr = 0;
150
+ do {
151
+ if (curr == col) {
152
+ cell = updateCell(cell, true);
153
+ break;
154
+ }
155
+ curr += cell.getAttribute("colspan");
156
+ } while ((cell = nextCell(cell)) != null);
157
+ }
158
+
159
+ break;
160
+
161
+ case "all":
162
+ var rows = tableElm.getElementsByTagName("tr");
163
+
164
+ for (var i=0; i<rows.length; i++) {
165
+ var cell = rows[i].firstChild;
166
+
167
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
168
+ cell = nextCell(cell);
169
+
170
+ do {
171
+ cell = updateCell(cell, true);
172
+ } while ((cell = nextCell(cell)) != null);
173
+ }
174
+
175
+ break;
176
+ }
177
+
178
+ ed.addVisual();
179
+ ed.nodeChanged();
180
+ inst.execCommand('mceEndUndoLevel');
181
+ tinyMCEPopup.close();
182
+ }
183
+
184
+ function nextCell(elm) {
185
+ while ((elm = elm.nextSibling) != null) {
186
+ if (elm.nodeName == "TD" || elm.nodeName == "TH")
187
+ return elm;
188
+ }
189
+
190
+ return null;
191
+ }
192
+
193
+ function updateCell(td, skip_id) {
194
+ var inst = ed;
195
+ var formObj = document.forms[0];
196
+ var curCellType = td.nodeName.toLowerCase();
197
+ var celltype = getSelectValue(formObj, 'celltype');
198
+ var doc = inst.getDoc();
199
+ var dom = ed.dom;
200
+
201
+ if (!skip_id)
202
+ dom.setAttrib(td, 'id', formObj.id.value);
203
+
204
+ dom.setAttrib(td, 'align', formObj.align.value);
205
+ dom.setAttrib(td, 'vAlign', formObj.valign.value);
206
+ dom.setAttrib(td, 'lang', formObj.lang.value);
207
+ dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
208
+ dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
209
+ dom.setAttrib(td, 'scope', formObj.scope.value);
210
+ dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
211
+
212
+ // Clear deprecated attributes
213
+ ed.dom.setAttrib(td, 'width', '');
214
+ ed.dom.setAttrib(td, 'height', '');
215
+ ed.dom.setAttrib(td, 'bgColor', '');
216
+ ed.dom.setAttrib(td, 'borderColor', '');
217
+ ed.dom.setAttrib(td, 'background', '');
218
+
219
+ // Set styles
220
+ td.style.width = getCSSSize(formObj.width.value);
221
+ td.style.height = getCSSSize(formObj.height.value);
222
+ if (formObj.bordercolor.value != "") {
223
+ td.style.borderColor = formObj.bordercolor.value;
224
+ td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
225
+ td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
226
+ } else
227
+ td.style.borderColor = '';
228
+
229
+ td.style.backgroundColor = formObj.bgcolor.value;
230
+
231
+ if (formObj.backgroundimage.value != "")
232
+ td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
233
+ else
234
+ td.style.backgroundImage = '';
235
+
236
+ if (curCellType != celltype) {
237
+ // changing to a different node type
238
+ var newCell = doc.createElement(celltype);
239
+
240
+ for (var c=0; c<td.childNodes.length; c++)
241
+ newCell.appendChild(td.childNodes[c].cloneNode(1));
242
+
243
+ for (var a=0; a<td.attributes.length; a++)
244
+ ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
245
+
246
+ td.parentNode.replaceChild(newCell, td);
247
+ td = newCell;
248
+ }
249
+
250
+ dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
251
+
252
+ return td;
253
+ }
254
+
255
+ function changedBackgroundImage() {
256
+ var formObj = document.forms[0];
257
+ var st = ed.dom.parseStyle(formObj.style.value);
258
+
259
+ st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
260
+
261
+ formObj.style.value = ed.dom.serializeStyle(st);
262
+ }
263
+
264
+ function changedSize() {
265
+ var formObj = document.forms[0];
266
+ var st = ed.dom.parseStyle(formObj.style.value);
267
+
268
+ var width = formObj.width.value;
269
+ if (width != "")
270
+ st['width'] = getCSSSize(width);
271
+ else
272
+ st['width'] = "";
273
+
274
+ var height = formObj.height.value;
275
+ if (height != "")
276
+ st['height'] = getCSSSize(height);
277
+ else
278
+ st['height'] = "";
279
+
280
+ formObj.style.value = ed.dom.serializeStyle(st);
281
+ }
282
+
283
+ function changedColor() {
284
+ var formObj = document.forms[0];
285
+ var st = ed.dom.parseStyle(formObj.style.value);
286
+
287
+ st['background-color'] = formObj.bgcolor.value;
288
+ st['border-color'] = formObj.bordercolor.value;
289
+
290
+ formObj.style.value = ed.dom.serializeStyle(st);
291
+ }
292
+
293
+ function changedStyle() {
294
+ var formObj = document.forms[0];
295
+ var st = ed.dom.parseStyle(formObj.style.value);
296
+
297
+ if (st['background-image'])
298
+ formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
299
+ else
300
+ formObj.backgroundimage.value = '';
301
+
302
+ if (st['width'])
303
+ formObj.width.value = trimSize(st['width']);
304
+
305
+ if (st['height'])
306
+ formObj.height.value = trimSize(st['height']);
307
+
308
+ if (st['background-color']) {
309
+ formObj.bgcolor.value = st['background-color'];
310
+ updateColor('bgcolor_pick','bgcolor');
311
+ }
312
+
313
+ if (st['border-color']) {
314
+ formObj.bordercolor.value = st['border-color'];
315
+ updateColor('bordercolor_pick','bordercolor');
316
+ }
317
+ }
318
+
319
+ tinyMCEPopup.onInit.add(init);
@@ -0,0 +1,27 @@
1
+ tinyMCEPopup.requireLangPack();
2
+
3
+ var MergeCellsDialog = {
4
+ init : function() {
5
+ var f = document.forms[0];
6
+
7
+ f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);
8
+ f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);
9
+ },
10
+
11
+ merge : function() {
12
+ var func, f = document.forms[0];
13
+
14
+ tinyMCEPopup.restoreSelection();
15
+
16
+ func = tinyMCEPopup.getWindowArg('onaction');
17
+
18
+ func({
19
+ cols : f.numcols.value,
20
+ rows : f.numrows.value
21
+ });
22
+
23
+ tinyMCEPopup.close();
24
+ }
25
+ };
26
+
27
+ tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);
@@ -0,0 +1,237 @@
1
+ tinyMCEPopup.requireLangPack();
2
+
3
+ function init() {
4
+ tinyMCEPopup.resizeToInnerSize();
5
+
6
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
7
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
8
+
9
+ var inst = tinyMCEPopup.editor;
10
+ var dom = inst.dom;
11
+ var trElm = dom.getParent(inst.selection.getStart(), "tr");
12
+ var formObj = document.forms[0];
13
+ var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
14
+
15
+ // Get table row data
16
+ var rowtype = trElm.parentNode.nodeName.toLowerCase();
17
+ var align = dom.getAttrib(trElm, 'align');
18
+ var valign = dom.getAttrib(trElm, 'valign');
19
+ var height = trimSize(getStyle(trElm, 'height', 'height'));
20
+ var className = dom.getAttrib(trElm, 'class');
21
+ var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
22
+ var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
23
+ var id = dom.getAttrib(trElm, 'id');
24
+ var lang = dom.getAttrib(trElm, 'lang');
25
+ var dir = dom.getAttrib(trElm, 'dir');
26
+
27
+ selectByValue(formObj, 'rowtype', rowtype);
28
+
29
+ // Any cells selected
30
+ if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {
31
+ // Setup form
32
+ addClassesToList('class', 'table_row_styles');
33
+ TinyMCE_EditableSelects.init();
34
+
35
+ formObj.bgcolor.value = bgcolor;
36
+ formObj.backgroundimage.value = backgroundimage;
37
+ formObj.height.value = height;
38
+ formObj.id.value = id;
39
+ formObj.lang.value = lang;
40
+ formObj.style.value = dom.serializeStyle(st);
41
+ selectByValue(formObj, 'align', align);
42
+ selectByValue(formObj, 'valign', valign);
43
+ selectByValue(formObj, 'class', className, true, true);
44
+ selectByValue(formObj, 'dir', dir);
45
+
46
+ // Resize some elements
47
+ if (isVisible('backgroundimagebrowser'))
48
+ document.getElementById('backgroundimage').style.width = '180px';
49
+
50
+ updateColor('bgcolor_pick', 'bgcolor');
51
+ } else
52
+ tinyMCEPopup.dom.hide('action');
53
+ }
54
+
55
+ function updateAction() {
56
+ var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
57
+ var action = getSelectValue(formObj, 'action');
58
+
59
+ if (!AutoValidator.validate(formObj)) {
60
+ tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
61
+ return false;
62
+ }
63
+
64
+ tinyMCEPopup.restoreSelection();
65
+ trElm = dom.getParent(inst.selection.getStart(), "tr");
66
+ tableElm = dom.getParent(inst.selection.getStart(), "table");
67
+
68
+ // Update all selected rows
69
+ if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) {
70
+ tinymce.each(tableElm.rows, function(tr) {
71
+ var i;
72
+
73
+ for (i = 0; i < tr.cells.length; i++) {
74
+ if (dom.hasClass(tr.cells[i], 'mceSelected')) {
75
+ updateRow(tr, true);
76
+ return;
77
+ }
78
+ }
79
+ });
80
+
81
+ inst.addVisual();
82
+ inst.nodeChanged();
83
+ inst.execCommand('mceEndUndoLevel');
84
+ tinyMCEPopup.close();
85
+ return;
86
+ }
87
+
88
+ switch (action) {
89
+ case "row":
90
+ updateRow(trElm);
91
+ break;
92
+
93
+ case "all":
94
+ var rows = tableElm.getElementsByTagName("tr");
95
+
96
+ for (var i=0; i<rows.length; i++)
97
+ updateRow(rows[i], true);
98
+
99
+ break;
100
+
101
+ case "odd":
102
+ case "even":
103
+ var rows = tableElm.getElementsByTagName("tr");
104
+
105
+ for (var i=0; i<rows.length; i++) {
106
+ if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))
107
+ updateRow(rows[i], true, true);
108
+ }
109
+
110
+ break;
111
+ }
112
+
113
+ inst.addVisual();
114
+ inst.nodeChanged();
115
+ inst.execCommand('mceEndUndoLevel');
116
+ tinyMCEPopup.close();
117
+ }
118
+
119
+ function updateRow(tr_elm, skip_id, skip_parent) {
120
+ var inst = tinyMCEPopup.editor;
121
+ var formObj = document.forms[0];
122
+ var dom = inst.dom;
123
+ var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
124
+ var rowtype = getSelectValue(formObj, 'rowtype');
125
+ var doc = inst.getDoc();
126
+
127
+ // Update row element
128
+ if (!skip_id)
129
+ dom.setAttrib(tr_elm, 'id', formObj.id.value);
130
+
131
+ dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));
132
+ dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));
133
+ dom.setAttrib(tr_elm, 'lang', formObj.lang.value);
134
+ dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));
135
+ dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
136
+ dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
137
+
138
+ // Clear deprecated attributes
139
+ dom.setAttrib(tr_elm, 'background', '');
140
+ dom.setAttrib(tr_elm, 'bgColor', '');
141
+ dom.setAttrib(tr_elm, 'height', '');
142
+
143
+ // Set styles
144
+ tr_elm.style.height = getCSSSize(formObj.height.value);
145
+ tr_elm.style.backgroundColor = formObj.bgcolor.value;
146
+
147
+ if (formObj.backgroundimage.value != "")
148
+ tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
149
+ else
150
+ tr_elm.style.backgroundImage = '';
151
+
152
+ // Setup new rowtype
153
+ if (curRowType != rowtype && !skip_parent) {
154
+ // first, clone the node we are working on
155
+ var newRow = tr_elm.cloneNode(1);
156
+
157
+ // next, find the parent of its new destination (creating it if necessary)
158
+ var theTable = dom.getParent(tr_elm, "table");
159
+ var dest = rowtype;
160
+ var newParent = null;
161
+ for (var i = 0; i < theTable.childNodes.length; i++) {
162
+ if (theTable.childNodes[i].nodeName.toLowerCase() == dest)
163
+ newParent = theTable.childNodes[i];
164
+ }
165
+
166
+ if (newParent == null) {
167
+ newParent = doc.createElement(dest);
168
+
169
+ if (theTable.firstChild.nodeName == 'CAPTION')
170
+ inst.dom.insertAfter(newParent, theTable.firstChild);
171
+ else
172
+ theTable.insertBefore(newParent, theTable.firstChild);
173
+ }
174
+
175
+ // append the row to the new parent
176
+ newParent.appendChild(newRow);
177
+
178
+ // remove the original
179
+ tr_elm.parentNode.removeChild(tr_elm);
180
+
181
+ // set tr_elm to the new node
182
+ tr_elm = newRow;
183
+ }
184
+
185
+ dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
186
+ }
187
+
188
+ function changedBackgroundImage() {
189
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
190
+ var st = dom.parseStyle(formObj.style.value);
191
+
192
+ st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
193
+
194
+ formObj.style.value = dom.serializeStyle(st);
195
+ }
196
+
197
+ function changedStyle() {
198
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
199
+ var st = dom.parseStyle(formObj.style.value);
200
+
201
+ if (st['background-image'])
202
+ formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
203
+ else
204
+ formObj.backgroundimage.value = '';
205
+
206
+ if (st['height'])
207
+ formObj.height.value = trimSize(st['height']);
208
+
209
+ if (st['background-color']) {
210
+ formObj.bgcolor.value = st['background-color'];
211
+ updateColor('bgcolor_pick','bgcolor');
212
+ }
213
+ }
214
+
215
+ function changedSize() {
216
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
217
+ var st = dom.parseStyle(formObj.style.value);
218
+
219
+ var height = formObj.height.value;
220
+ if (height != "")
221
+ st['height'] = getCSSSize(height);
222
+ else
223
+ st['height'] = "";
224
+
225
+ formObj.style.value = dom.serializeStyle(st);
226
+ }
227
+
228
+ function changedColor() {
229
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
230
+ var st = dom.parseStyle(formObj.style.value);
231
+
232
+ st['background-color'] = formObj.bgcolor.value;
233
+
234
+ formObj.style.value = dom.serializeStyle(st);
235
+ }
236
+
237
+ tinyMCEPopup.onInit.add(init);