spree_editor 0.30.1 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +4 -10
  3. data/app/controllers/admin/editor_settings_controller.rb +14 -0
  4. data/app/views/admin/editor_settings/edit.html.erb +23 -0
  5. data/app/views/admin/editor_settings/show.html.erb +20 -0
  6. data/app/views/shared/_rich_editor_javascript.html.erb +8 -0
  7. data/app/views/shared/editor_engines/_tiny_mce.html.erb +56 -0
  8. data/app/views/shared/editor_engines/_wym_editor.html.erb +8 -0
  9. data/app/views/shared/editor_engines/_yui_rich_editor.html.erb +172 -0
  10. data/config/locales/en.yml +36 -11
  11. data/config/locales/ru.yml +41 -16
  12. data/config/routes.rb +3 -1
  13. data/lib/editor_configuration.rb +5 -0
  14. data/lib/spree/editor/config.rb +22 -0
  15. data/lib/spree_editor.rb +1 -5
  16. data/lib/spree_editor_hooks.rb +16 -1
  17. data/public/javascripts/jquery.ocupload.js +7 -6
  18. data/public/javascripts/tinymce/jquery.tinymce.js +1 -0
  19. data/public/javascripts/tinymce/langs/en.js +170 -0
  20. data/public/javascripts/tinymce/license.txt +504 -0
  21. data/public/javascripts/tinymce/plugins/advhr/css/advhr.css +5 -0
  22. data/public/javascripts/tinymce/plugins/advhr/editor_plugin.js +1 -0
  23. data/public/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +57 -0
  24. data/public/javascripts/tinymce/plugins/advhr/js/rule.js +43 -0
  25. data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +5 -0
  26. data/public/javascripts/tinymce/plugins/advhr/rule.htm +57 -0
  27. data/public/javascripts/tinymce/plugins/advimage/css/advimage.css +13 -0
  28. data/public/javascripts/tinymce/plugins/advimage/editor_plugin.js +1 -0
  29. data/public/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +50 -0
  30. data/public/javascripts/tinymce/plugins/advimage/image.htm +232 -0
  31. data/public/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
  32. data/public/javascripts/tinymce/plugins/advimage/js/image.js +443 -0
  33. data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +43 -0
  34. data/public/javascripts/tinymce/plugins/advlink/css/advlink.css +8 -0
  35. data/public/javascripts/tinymce/plugins/advlink/editor_plugin.js +1 -0
  36. data/public/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +61 -0
  37. data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +528 -0
  38. data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +52 -0
  39. data/public/javascripts/tinymce/plugins/advlink/link.htm +333 -0
  40. data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -0
  41. data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +154 -0
  42. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -0
  43. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +119 -0
  44. data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -0
  45. data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +422 -0
  46. data/public/javascripts/tinymce/plugins/autosave/langs/en.js +4 -0
  47. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -0
  48. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +120 -0
  49. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -0
  50. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +147 -0
  51. data/public/javascripts/tinymce/plugins/directionality/editor_plugin.js +1 -0
  52. data/public/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +82 -0
  53. data/public/javascripts/tinymce/plugins/emotions/editor_plugin.js +1 -0
  54. data/public/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +43 -0
  55. data/public/javascripts/tinymce/plugins/emotions/emotions.htm +40 -0
  56. data/public/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
  57. data/public/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
  58. data/public/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  59. data/public/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  60. data/public/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
  61. data/public/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
  62. data/public/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
  63. data/public/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
  64. data/public/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  65. data/public/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
  66. data/public/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
  67. data/public/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
  68. data/public/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  69. data/public/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
  70. data/public/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
  71. data/public/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
  72. data/public/javascripts/tinymce/plugins/emotions/js/emotions.js +22 -0
  73. data/public/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +20 -0
  74. data/public/javascripts/tinymce/plugins/example/dialog.htm +22 -0
  75. data/public/javascripts/tinymce/plugins/example/editor_plugin.js +1 -0
  76. data/public/javascripts/tinymce/plugins/example/editor_plugin_src.js +84 -0
  77. data/public/javascripts/tinymce/plugins/example/img/example.gif +0 -0
  78. data/public/javascripts/tinymce/plugins/example/js/dialog.js +19 -0
  79. data/public/javascripts/tinymce/plugins/example/langs/en.js +3 -0
  80. data/public/javascripts/tinymce/plugins/example/langs/en_dlg.js +3 -0
  81. data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +182 -0
  82. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -0
  83. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +153 -0
  84. data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +571 -0
  85. data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +471 -0
  86. data/public/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +85 -0
  87. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -0
  88. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +151 -0
  89. data/public/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +109 -0
  90. data/public/javascripts/tinymce/plugins/iespell/editor_plugin.js +1 -0
  91. data/public/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +54 -0
  92. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -0
  93. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +635 -0
  94. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  95. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  96. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  97. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  98. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  99. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  100. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  101. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +100 -0
  102. data/public/javascripts/tinymce/plugins/inlinepopups/template.htm +387 -0
  103. data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +1 -0
  104. data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  105. data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -0
  106. data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +212 -0
  107. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -0
  108. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +136 -0
  109. data/public/javascripts/tinymce/plugins/media/css/content.css +6 -0
  110. data/public/javascripts/tinymce/plugins/media/css/media.css +16 -0
  111. data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -0
  112. data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +414 -0
  113. data/public/javascripts/tinymce/plugins/media/img/flash.gif +0 -0
  114. data/public/javascripts/tinymce/plugins/media/img/flv_player.swf +0 -0
  115. data/public/javascripts/tinymce/plugins/media/img/quicktime.gif +0 -0
  116. data/public/javascripts/tinymce/plugins/media/img/realmedia.gif +0 -0
  117. data/public/javascripts/tinymce/plugins/media/img/shockwave.gif +0 -0
  118. data/public/javascripts/tinymce/plugins/media/img/trans.gif +0 -0
  119. data/public/javascripts/tinymce/plugins/media/img/windowsmedia.gif +0 -0
  120. data/public/javascripts/tinymce/plugins/media/js/embed.js +73 -0
  121. data/public/javascripts/tinymce/plugins/media/js/media.js +630 -0
  122. data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +103 -0
  123. data/public/javascripts/tinymce/plugins/media/media.htm +817 -0
  124. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -0
  125. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +53 -0
  126. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -0
  127. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +90 -0
  128. data/public/javascripts/tinymce/plugins/pagebreak/css/content.css +1 -0
  129. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -0
  130. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +77 -0
  131. data/public/javascripts/tinymce/plugins/pagebreak/img/pagebreak.gif +0 -0
  132. data/public/javascripts/tinymce/plugins/pagebreak/img/trans.gif +0 -0
  133. data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -0
  134. data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +952 -0
  135. data/public/javascripts/tinymce/plugins/paste/js/pastetext.js +36 -0
  136. data/public/javascripts/tinymce/plugins/paste/js/pasteword.js +51 -0
  137. data/public/javascripts/tinymce/plugins/paste/langs/en_dlg.js +5 -0
  138. data/public/javascripts/tinymce/plugins/paste/pastetext.htm +27 -0
  139. data/public/javascripts/tinymce/plugins/paste/pasteword.htm +21 -0
  140. data/public/javascripts/tinymce/plugins/preview/editor_plugin.js +1 -0
  141. data/public/javascripts/tinymce/plugins/preview/editor_plugin_src.js +53 -0
  142. data/public/javascripts/tinymce/plugins/preview/example.html +28 -0
  143. data/public/javascripts/tinymce/plugins/preview/jscripts/embed.js +73 -0
  144. data/public/javascripts/tinymce/plugins/preview/preview.html +17 -0
  145. data/public/javascripts/tinymce/plugins/print/editor_plugin.js +1 -0
  146. data/public/javascripts/tinymce/plugins/print/editor_plugin_src.js +34 -0
  147. data/public/javascripts/tinymce/plugins/save/editor_plugin.js +1 -0
  148. data/public/javascripts/tinymce/plugins/save/editor_plugin_src.js +101 -0
  149. data/public/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +6 -0
  150. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -0
  151. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +57 -0
  152. data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +138 -0
  153. data/public/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +16 -0
  154. data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +99 -0
  155. data/public/javascripts/tinymce/plugins/spellchecker/css/content.css +1 -0
  156. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -0
  157. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +417 -0
  158. data/public/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
  159. data/public/javascripts/tinymce/plugins/style/css/props.css +13 -0
  160. data/public/javascripts/tinymce/plugins/style/editor_plugin.js +1 -0
  161. data/public/javascripts/tinymce/plugins/style/editor_plugin_src.js +55 -0
  162. data/public/javascripts/tinymce/plugins/style/js/props.js +641 -0
  163. data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +63 -0
  164. data/public/javascripts/tinymce/plugins/style/props.htm +723 -0
  165. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -0
  166. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +112 -0
  167. data/public/javascripts/tinymce/plugins/table/cell.htm +178 -0
  168. data/public/javascripts/tinymce/plugins/table/css/cell.css +17 -0
  169. data/public/javascripts/tinymce/plugins/table/css/row.css +25 -0
  170. data/public/javascripts/tinymce/plugins/table/css/table.css +13 -0
  171. data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -0
  172. data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +1139 -0
  173. data/public/javascripts/tinymce/plugins/table/js/cell.js +286 -0
  174. data/public/javascripts/tinymce/plugins/table/js/merge_cells.js +27 -0
  175. data/public/javascripts/tinymce/plugins/table/js/row.js +237 -0
  176. data/public/javascripts/tinymce/plugins/table/js/table.js +454 -0
  177. data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +74 -0
  178. data/public/javascripts/tinymce/plugins/table/merge_cells.htm +32 -0
  179. data/public/javascripts/tinymce/plugins/table/row.htm +155 -0
  180. data/public/javascripts/tinymce/plugins/table/table.htm +187 -0
  181. data/public/javascripts/tinymce/plugins/template/blank.htm +12 -0
  182. data/public/javascripts/tinymce/plugins/template/css/template.css +23 -0
  183. data/public/javascripts/tinymce/plugins/template/editor_plugin.js +1 -0
  184. data/public/javascripts/tinymce/plugins/template/editor_plugin_src.js +159 -0
  185. data/public/javascripts/tinymce/plugins/template/js/template.js +106 -0
  186. data/public/javascripts/tinymce/plugins/template/langs/en_dlg.js +15 -0
  187. data/public/javascripts/tinymce/plugins/template/template.htm +31 -0
  188. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -0
  189. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +83 -0
  190. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -0
  191. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +98 -0
  192. data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +141 -0
  193. data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +141 -0
  194. data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +148 -0
  195. data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +141 -0
  196. data/public/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +11 -0
  197. data/public/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +9 -0
  198. data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +161 -0
  199. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  200. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
  201. data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +161 -0
  202. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +28 -0
  203. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +28 -0
  204. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +126 -0
  205. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +28 -0
  206. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +53 -0
  207. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +231 -0
  208. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +52 -0
  209. data/public/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  210. data/public/javascripts/tinymce/themes/advanced/about.htm +54 -0
  211. data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -0
  212. data/public/javascripts/tinymce/themes/advanced/charmap.htm +52 -0
  213. data/public/javascripts/tinymce/themes/advanced/color_picker.htm +73 -0
  214. data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -0
  215. data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1229 -0
  216. data/public/javascripts/tinymce/themes/advanced/image.htm +80 -0
  217. data/public/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
  218. data/public/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
  219. data/public/javascripts/tinymce/themes/advanced/js/about.js +72 -0
  220. data/public/javascripts/tinymce/themes/advanced/js/anchor.js +37 -0
  221. data/public/javascripts/tinymce/themes/advanced/js/charmap.js +335 -0
  222. data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +253 -0
  223. data/public/javascripts/tinymce/themes/advanced/js/image.js +245 -0
  224. data/public/javascripts/tinymce/themes/advanced/js/link.js +156 -0
  225. data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -0
  226. data/public/javascripts/tinymce/themes/advanced/langs/en.js +62 -0
  227. data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +51 -0
  228. data/public/javascripts/tinymce/themes/advanced/link.htm +58 -0
  229. data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +36 -0
  230. data/public/javascripts/tinymce/themes/advanced/skins/default/dialog.css +117 -0
  231. data/public/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
  232. data/public/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
  233. data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  234. data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  235. data/public/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
  236. data/public/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
  237. data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +213 -0
  238. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +36 -0
  239. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +116 -0
  240. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  241. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  242. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  243. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +215 -0
  244. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  245. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  246. data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -0
  247. data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -0
  248. data/public/javascripts/tinymce/themes/simple/editor_template_src.js +85 -0
  249. data/public/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
  250. data/public/javascripts/tinymce/themes/simple/langs/en.js +11 -0
  251. data/public/javascripts/tinymce/themes/simple/skins/default/content.css +25 -0
  252. data/public/javascripts/tinymce/themes/simple/skins/default/ui.css +32 -0
  253. data/public/javascripts/tinymce/themes/simple/skins/o2k7/content.css +17 -0
  254. data/public/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  255. data/public/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +35 -0
  256. data/public/javascripts/tinymce/tiny_mce.js +1 -0
  257. data/public/javascripts/tinymce/tiny_mce_popup.js +5 -0
  258. data/public/javascripts/tinymce/tiny_mce_src.js +13394 -0
  259. data/public/javascripts/tinymce/utils/editable_selects.js +70 -0
  260. data/public/javascripts/tinymce/utils/form_utils.js +200 -0
  261. data/public/javascripts/tinymce/utils/mctabs.js +77 -0
  262. data/public/javascripts/tinymce/utils/validate.js +220 -0
  263. data/public/javascripts/wymeditor/iframe/default/lbl-blockquote.png +0 -0
  264. data/public/javascripts/wymeditor/iframe/default/lbl-h1.png +0 -0
  265. data/public/javascripts/wymeditor/iframe/default/lbl-h2.png +0 -0
  266. data/public/javascripts/wymeditor/iframe/default/lbl-h3.png +0 -0
  267. data/public/javascripts/wymeditor/iframe/default/lbl-h4.png +0 -0
  268. data/public/javascripts/wymeditor/iframe/default/lbl-h5.png +0 -0
  269. data/public/javascripts/wymeditor/iframe/default/lbl-h6.png +0 -0
  270. data/public/javascripts/wymeditor/iframe/default/lbl-p.png +0 -0
  271. data/public/javascripts/wymeditor/iframe/default/lbl-pre.png +0 -0
  272. data/public/javascripts/wymeditor/iframe/default/wymiframe.css +90 -0
  273. data/public/javascripts/wymeditor/iframe/default/wymiframe.html +26 -0
  274. data/public/javascripts/wymeditor/jquery.wymeditor.js +4688 -0
  275. data/public/javascripts/wymeditor/jquery.wymeditor.min.js +1 -0
  276. data/public/javascripts/wymeditor/jquery.wymeditor.pack.js +1 -0
  277. data/public/javascripts/wymeditor/lang/bg.js +45 -0
  278. data/public/javascripts/wymeditor/lang/ca.js +45 -0
  279. data/public/javascripts/wymeditor/lang/cs.js +45 -0
  280. data/public/javascripts/wymeditor/lang/cy.js +45 -0
  281. data/public/javascripts/wymeditor/lang/de.js +45 -0
  282. data/public/javascripts/wymeditor/lang/en.js +45 -0
  283. data/public/javascripts/wymeditor/lang/es.js +45 -0
  284. data/public/javascripts/wymeditor/lang/fa.js +46 -0
  285. data/public/javascripts/wymeditor/lang/fi.js +44 -0
  286. data/public/javascripts/wymeditor/lang/fr.js +45 -0
  287. data/public/javascripts/wymeditor/lang/gl.js +45 -0
  288. data/public/javascripts/wymeditor/lang/he.js +45 -0
  289. data/public/javascripts/wymeditor/lang/hr.js +45 -0
  290. data/public/javascripts/wymeditor/lang/hu.js +45 -0
  291. data/public/javascripts/wymeditor/lang/it.js +45 -0
  292. data/public/javascripts/wymeditor/lang/nb.js +45 -0
  293. data/public/javascripts/wymeditor/lang/nl.js +45 -0
  294. data/public/javascripts/wymeditor/lang/nn.js +45 -0
  295. data/public/javascripts/wymeditor/lang/pl.js +45 -0
  296. data/public/javascripts/wymeditor/lang/pt-br.js +45 -0
  297. data/public/javascripts/wymeditor/lang/pt.js +45 -0
  298. data/public/javascripts/wymeditor/lang/ru.js +45 -0
  299. data/public/javascripts/wymeditor/lang/sv.js +45 -0
  300. data/public/javascripts/wymeditor/lang/tr.js +45 -0
  301. data/public/javascripts/wymeditor/lang/zh_cn.js +47 -0
  302. data/public/javascripts/wymeditor/plugins/embed/jquery.wymeditor.embed.js +52 -0
  303. data/public/javascripts/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
  304. data/public/javascripts/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +127 -0
  305. data/public/javascripts/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +57 -0
  306. data/public/javascripts/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
  307. data/public/javascripts/wymeditor/plugins/resizable/readme.txt +124 -0
  308. data/public/javascripts/wymeditor/plugins/tidy/README +19 -0
  309. data/public/javascripts/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +82 -0
  310. data/public/javascripts/wymeditor/plugins/tidy/tidy.php +36 -0
  311. data/public/javascripts/wymeditor/plugins/tidy/wand.png +0 -0
  312. data/public/javascripts/wymeditor/skins/compact/icons.png +0 -0
  313. data/public/javascripts/wymeditor/skins/compact/skin.css +134 -0
  314. data/public/javascripts/wymeditor/skins/compact/skin.js +35 -0
  315. data/public/javascripts/wymeditor/skins/default/icons.png +0 -0
  316. data/public/javascripts/wymeditor/skins/default/skin.css +133 -0
  317. data/public/javascripts/wymeditor/skins/default/skin.js +40 -0
  318. data/public/javascripts/wymeditor/skins/minimal/images/bg.header.gif +0 -0
  319. data/public/javascripts/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
  320. data/public/javascripts/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
  321. data/public/javascripts/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
  322. data/public/javascripts/wymeditor/skins/minimal/skin.css +131 -0
  323. data/public/javascripts/wymeditor/skins/minimal/skin.js +30 -0
  324. data/public/javascripts/wymeditor/skins/silver/COPYING +674 -0
  325. data/public/javascripts/wymeditor/skins/silver/README +27 -0
  326. data/public/javascripts/wymeditor/skins/silver/images/bg.header.gif +0 -0
  327. data/public/javascripts/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
  328. data/public/javascripts/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
  329. data/public/javascripts/wymeditor/skins/silver/images/icons.silver.gif +0 -0
  330. data/public/javascripts/wymeditor/skins/silver/skin.css +297 -0
  331. data/public/javascripts/wymeditor/skins/silver/skin.js +61 -0
  332. data/public/javascripts/wymeditor/skins/twopanels/icons.png +0 -0
  333. data/public/javascripts/wymeditor/skins/twopanels/skin.css +134 -0
  334. data/public/javascripts/wymeditor/skins/twopanels/skin.js +39 -0
  335. data/public/javascripts/wymeditor/skins/wymeditor_icon.png +0 -0
  336. data/public/stylesheets/editor.css +10 -2
  337. data/spree_editor.gemspec +6 -6
  338. metadata +338 -11
  339. data/app/views/shared/_editor.html.erb +0 -208
  340. data/lib/helpers/editor_helper.rb +0 -10
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  tmp
8
8
  nbproject
9
9
  *.swp
10
+ *.gem
data/README.md CHANGED
@@ -1,16 +1,10 @@
1
1
  SpreeEditor
2
2
  ===========
3
3
 
4
- Rich editor for Spree. Uses Yahoo UI Editor with Image and File uploading.
5
- Can be used with any model.
6
-
7
-
8
- Example
9
- =======
10
-
11
- In _form.html.erb:
12
-
13
- <%= rich_editor(:id => 'page_body', :object => @page) %>
4
+ Rich editor for Spree. It implements different types of Rich Editors:
14
5
 
6
+ - YUI Rich Editor
7
+ - WYM Editor
8
+ - TinyMCE
15
9
 
16
10
  Copyright (c) 2010 [divineforest], released under the New BSD License
@@ -0,0 +1,14 @@
1
+ class Admin::EditorSettingsController < Admin::BaseController
2
+ def update
3
+ preferences = params[:preferences] || {}
4
+ enable_editor = preferences[:enabled].nil? ? false : true;
5
+ preferences.update(:enabled => enable_editor)
6
+ Spree::Editor::Config.set(preferences)
7
+
8
+ respond_to do |format|
9
+ format.html {
10
+ redirect_to admin_editor_settings_path
11
+ }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t('rich_editor') %></h1>
4
+
5
+ <%= form_tag(admin_editor_settings_path, :method => :put) do %>
6
+ <p>
7
+ <label><%= t('enable_rich_editor') %>:</label>
8
+ <%= check_box_tag('preferences[enabled]', '1', Spree::Editor::Config[:enabled]) %>
9
+ </p>
10
+ <p>
11
+ <label><%= t('rich_editor_engine') %>:</label>
12
+ <%= select_tag 'preferences[current_editor]', options_for_select(SpreeEditor::EditorEngines, Spree::Editor::Config[:current_editor]) %>
13
+ </p>
14
+ <p>
15
+ <label><%= t('rich_editor_ids') %>:</label>
16
+ <%= text_field_tag 'preferences[ids]', Spree::Editor::Config[:ids] %>
17
+ <small><%= t('rich_editor_ids_description') %></small>
18
+ </p>
19
+ <p class="form-buttons">
20
+ <%= button t('update') %>
21
+ <%= t("or") %> <%= link_to t("cancel"), admin_editor_settings_url %>
22
+ </p>
23
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t("rich_editor") %></h1>
4
+
5
+ <table>
6
+ <tr>
7
+ <td><%= t('enable_rich_editor') %>:</td>
8
+ <td><%= Spree::Editor::Config[:enabled] ? t('yes') : t('no') %></td>
9
+ </tr>
10
+ <tr>
11
+ <td><%= t('rich_editor_engine') %>:</td>
12
+ <td><%= Spree::Editor::Config[:current_editor] %></td>
13
+ </tr>
14
+ <tr>
15
+ <td><%= t('rich_editor_ids') %>:</td>
16
+ <td><%= Spree::Editor::Config[:ids] %></td>
17
+ </tr>
18
+ </table>
19
+
20
+ <p><%= link_to_with_icon 'edit', t("edit"), edit_admin_editor_settings_path %></p>
@@ -0,0 +1,8 @@
1
+ <% is_enabled = Spree::Editor::Config[:enabled] %>
2
+ <% current_editor = Spree::Editor::Config[:current_editor] %>
3
+ <% ids = Spree::Editor::Config[:ids].split %>
4
+
5
+ <% if is_enabled and ids.any? %>
6
+ <%= render :partial => "shared/editor_engines/#{Spree::Editor::Config[:current_editor].underscore}",
7
+ :locals => { :ids => ids } %>
8
+ <% end %>
@@ -0,0 +1,56 @@
1
+ <script type="text/javascript" src="/javascripts/tinymce/tiny_mce.js"></script>
2
+ <script type="text/javascript" src="/javascripts/tinymce/jquery.tinymce.js"></script>
3
+
4
+ <script type="text/javascript">
5
+ $(function() {
6
+ var myConfig = { dompath: true };
7
+ var ids = [<%= ids.map{|id| "'#{id}'"}.join(', ') %>]
8
+ $.each(ids, function(index, id) {
9
+ if ($('textarea#' + id)) {
10
+ tinyMCE.init({
11
+ // General options
12
+ element : id,
13
+ mode : "textareas",
14
+ theme : "advanced",
15
+ plugins : "table,inlinepopups",
16
+
17
+ // Theme options
18
+ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat,code",
19
+ theme_advanced_buttons2 : "",
20
+ theme_advanced_buttons3 : "",
21
+ theme_advanced_buttons4 : "",
22
+ theme_advanced_toolbar_location : "top",
23
+ theme_advanced_toolbar_align : "left",
24
+ theme_advanced_statusbar_location : "bottom",
25
+ theme_advanced_resizing : true,
26
+
27
+ // Example content CSS (should be your site CSS)
28
+ content_css : "/js/tinymce/examples/css/content.css",
29
+
30
+ // Style formats
31
+ style_formats : [
32
+ {title : 'Bold text', inline : 'b'},
33
+ {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
34
+ {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
35
+ {title : 'Example 1', inline : 'span', classes : 'example1'},
36
+ {title : 'Example 2', inline : 'span', classes : 'example2'},
37
+ {title : 'Table styles'},
38
+ {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
39
+ ],
40
+
41
+ formats : {
42
+ alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},
43
+ aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},
44
+ alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},
45
+ alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},
46
+ bold : {inline : 'span', 'classes' : 'bold'},
47
+ italic : {inline : 'span', 'classes' : 'italic'},
48
+ underline : {inline : 'span', 'classes' : 'underline', exact : true},
49
+ strikethrough : {inline : 'del'},
50
+ customformat : {inline : 'span', styles : {color : '#00ff00', fontSize : '20px'}, attributes : {title : 'My custom format'}}
51
+ }
52
+ });
53
+ }
54
+ });
55
+ });
56
+ </script>
@@ -0,0 +1,8 @@
1
+ <script type="text/javascript" src="/javascripts/wymeditor/jquery.wymeditor.min.js"></script>
2
+
3
+ <script type="text/javascript">
4
+ $(function() {
5
+ var ids = [<%= ids.map{|id| "'textarea##{id}'"}.join(', ') %>]
6
+ $(ids.join(', ')).wymeditor();
7
+ });
8
+ </script>
@@ -0,0 +1,172 @@
1
+ <div class="editor-mask-container">
2
+ <div class="editor-mask"></div>
3
+ <div class="editor-mask-label"><%= t("editor.loading") %></div>
4
+ </div>
5
+
6
+ <!-- Skin CSS file -->
7
+
8
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/editor/assets/skins/sam/editor.css"/>
9
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/menu/assets/skins/sam/menu.css"/>
10
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/button/assets/skins/sam/button.css"/>
11
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/container/assets/skins/sam/container.css"/>
12
+ <%= stylesheet_link_tag 'editor' %>
13
+
14
+ <!-- Utility Dependencies -->
15
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
16
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/element/element-min.js"></script>
17
+ <!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
18
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/container/container_core-min.js"></script>
19
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/menu/menu-min.js"></script>
20
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/button/button-min.js"></script>
21
+ <!-- Source file for Rich Text Editor-->
22
+ <script src="http://yui.yahooapis.com/2.8.2r1/build/editor/editor-min.js"></script>
23
+
24
+ <%= javascript_include_tag 'jquery.ocupload' %>
25
+
26
+ <script type="text/javascript">
27
+ $(function() {
28
+ var myConfig = { dompath: true };
29
+ var ids = [<%= ids.map{|id| "'#{id}'"}.join(', ') %>];
30
+ $.each(ids, function(index, id) {
31
+ if ($('textarea#' + id)) {
32
+ window[id + '_editor'] = new YAHOO.widget.Editor(id, {
33
+ height: '350px',
34
+ width: 'auto',
35
+ animate: true,
36
+ handleSubmit: true,
37
+ toolbar: {
38
+ collapse: true,
39
+ titlebar: false,
40
+ draggable: false,
41
+ buttonType: 'advanced',
42
+ buttons: [
43
+ { group: 'fontstyle', label: '<%= t("editor.font_name_and_size") %>',
44
+ buttons: [
45
+ { type: 'select', label: 'Arial', value: 'fontname', disabled: true,
46
+ menu: [
47
+ { text: 'Arial', checked: true },
48
+ { text: 'Arial Black' },
49
+ { text: 'Comic Sans MS' },
50
+ { text: 'Courier New' },
51
+ { text: 'Lucida Console' },
52
+ { text: 'Tahoma' },
53
+ { text: 'Times New Roman' },
54
+ { text: 'Trebuchet MS' },
55
+ { text: 'Verdana' }
56
+ ]
57
+ },
58
+ { type: 'spin', label: '13', value: 'fontsize', range: [ 9, 75 ], disabled: true }
59
+ ]
60
+ },
61
+ { type: 'separator' },
62
+ { group: 'textstyle', label: '<%= t("editor.font_style") %> ',
63
+ buttons: [
64
+ { type: 'push', label: '<%= t("editor.bold") %> CTRL + SHIFT + B', value: 'bold' },
65
+ { type: 'push', label: '<%= t("editor.italic") %> CTRL + SHIFT + I', value: 'italic' },
66
+ { type: 'push', label: '<%= t("editor.underline") %> CTRL + SHIFT + U', value: 'underline' },
67
+ { type: 'separator' },
68
+ { type: 'push', label: '<%= t("editor.subscript") %>', value: 'subscript', disabled: true },
69
+ { type: 'push', label: '<%= t("editor.superscript") %>', value: 'superscript', disabled: true },
70
+ { type: 'separator' },
71
+ { type: 'color', label: '<%= t("editor.font_color") %>', value: 'forecolor', disabled: true },
72
+ { type: 'color', label: '<%= t("editor.background_color") %>', value: 'backcolor', disabled: true },
73
+ { type: 'separator' },
74
+ { type: 'push', label: '<%= t("editor.remove_formatting") %>', value: 'removeformat', disabled: true },
75
+ { type: 'push', label: '<%= t("editor.show_and_hide_hidden_elements") %>', value: 'hiddenelements' }
76
+ ]
77
+ },
78
+ { type: 'separator' },
79
+ { group: 'alignment', label: '<%= t("editor.alignment") %>',
80
+ buttons: [
81
+ { type: 'push', label: '<%= t("editor.align_left") %> CTRL + SHIFT + [', value: 'justifyleft' },
82
+ { type: 'push', label: '<%= t("editor.align_center") %> CTRL + SHIFT + |', value: 'justifycenter' },
83
+ { type: 'push', label: '<%= t("editor.align_right") %> CTRL + SHIFT + ]', value: 'justifyright' },
84
+ { type: 'push', label: '<%= t("editor.justify") %>', value: 'justifyfull' }
85
+ ]
86
+ },
87
+ { type: 'separator' },
88
+ { group: 'parastyle', label: '<%= t("editor.paragraph_style") %>',
89
+ buttons: [
90
+ { type: 'select', label: '<%= t("editor.normal") %>', value: 'heading', disabled: true,
91
+ menu: [
92
+ { text: '<%= t("editor.normal") %>', value: 'none', checked: true },
93
+ { text: '<%= t("editor.header") %> 1', value: 'h1' },
94
+ { text: '<%= t("editor.header") %> 2', value: 'h2' },
95
+ { text: '<%= t("editor.header") %> 3', value: 'h3' },
96
+ { text: '<%= t("editor.header") %> 4', value: 'h4' },
97
+ { text: '<%= t("editor.header") %> 5', value: 'h5' },
98
+ { text: '<%= t("editor.header") %> 6', value: 'h6' }
99
+ ]
100
+ }
101
+ ]
102
+ },
103
+ { type: 'separator' },
104
+ { group: 'indentlist', label: '<%= t("editor.indenting_and_lists") %>',
105
+ buttons: [
106
+ { type: 'push', label: '<%= t("editor.indent") %>', value: 'indent', disabled: true },
107
+ { type: 'push', label: '<%= t("editor.outdent") %>', value: 'outdent', disabled: true },
108
+ { type: 'push', label: '<%= t("editor.create_an_unordered_list") %>', value: 'insertunorderedlist' },
109
+ { type: 'push', label: '<%= t("editor.create_an_ordered_list") %>', value: 'insertorderedlist' }
110
+ ]
111
+ },
112
+ { type: 'separator' },
113
+ { group: 'insertitem', label: '<%= t("editor.insert_item") %>',
114
+ buttons: [
115
+ { type: 'push', label: '<%= t("editor.html_link") %> CTRL + SHIFT + L', value: 'createlink', disabled: true },
116
+ { type: 'push', label: '<%= t("editor.insert_image") %>', value: 'insertimage' }
117
+ ]
118
+ },
119
+ { type: 'separator' },
120
+ { group: 'uploaditem', label: '<%= t("editor.upload") %>',
121
+ buttons: [
122
+ { type: 'push', label: '<%= t("editor.upload_image") %>', value: 'imageUpload' },
123
+ { type: 'push', label: '<%= t("editor.upload_file") %>', value: 'fileUpload' }
124
+ ]
125
+ }
126
+
127
+ ]
128
+ }
129
+ });
130
+
131
+ window[id + '_editor'].addListener('editorContentLoaded', function() {
132
+ $(".yui-toolbar-imageUpload").upload({
133
+ name: 'content_image[attachment]',
134
+ action: '/content_images',
135
+ enctype: 'multipart/form-data',
136
+ //params: {'content_image[viewable_type]': '<%# object.class.name %>', 'content_image[viewable_id]': '<%# object.id %>'},
137
+ autoSubmit: true,
138
+ onSubmit: function() {
139
+ $(".editor-mask-container").addClass("active");
140
+ },
141
+ onComplete: function(image_src) {
142
+ var img_html = "<img src='" + image_src + "'/>";
143
+ window[id + '_editor'].execCommand('inserthtml', img_html);
144
+ $(".editor-mask-container").removeClass("active");
145
+ }
146
+ });
147
+
148
+ $(".yui-toolbar-fileUpload").upload({
149
+ name: 'content_file[attachment]',
150
+ action: '/content_files',
151
+ enctype: 'multipart/form-data',
152
+ //params: {'content_file[viewable_type]': '<%# object.class.name %>', 'content_file[viewable_id]': '<%# @object.id %>'},
153
+ autoSubmit: true,
154
+ onSubmit: function() {
155
+ $(".editor-mask-container").addClass("active");
156
+ },
157
+ onComplete: function(file_url_and_name) {
158
+ var file_url = file_url_and_name.split(",")[0];
159
+ var file_name_original = file_url_and_name.split(",")[1];
160
+ $(".editor-mask-container").removeClass("active");
161
+ var file_name = prompt('<%= t("editor.enter_file_name") %>', file_name_original);
162
+ var link_html = "<a href='" + file_url + "'/>" + file_name + "</a>";
163
+ window[id + '_editor'].execCommand('inserthtml', link_html);
164
+ }
165
+ });
166
+ });
167
+
168
+ window[id + '_editor'].render();
169
+ }
170
+ });
171
+ });
172
+ </script>
@@ -1,21 +1,46 @@
1
1
  ---
2
2
  en:
3
3
  editor:
4
- loading: Loading
4
+ align_center: Align Center
5
+ align_left: Align Left
6
+ align_right: Align Right
7
+ alignment: Alignment
8
+ background_color: Background Color
9
+ bold: Bold
10
+ create_an_ordered_list: Create an Ordered List
11
+ create_an_unordered_list: Create an Unordered List
12
+ enter_file_name: Enter file name
5
13
  font_name_and_size: Font Name and Size
14
+ font_color: Font Color
6
15
  font_style: Font Style
7
- alignment: Alignment
8
- paragraph_style: Paragraph Style
16
+ footer: Footer
17
+ header: Header
18
+ hide_more_fields: Hide more fields
19
+ html_link: HTML Link
9
20
  indenting_and_lists: "Indenting/Lists"
10
21
  insert_item: Insert Item
11
22
  insert_image: Insert Image
12
- upload_image: Upload Image
13
- upload_file: Upload File
23
+ indent: Indent
24
+ italic: Italic
25
+ justify: Justify
26
+ loading: Loading
27
+ normal: Normal
28
+ outdent: Outdent
29
+ paragraph_style: Paragraph Style
30
+ remove_formatting: Remove Formatting
31
+ show_hide_hidden_elements: "Show/Hide Hidden Elements"
14
32
  show_more_fields: Show more fields
15
- hide_more_fields: Hide more fields
16
- switch_simple: Switch to Simple Editor
17
- switch_rich: Switch to Rich Editor
18
33
  sidebar: Sidebar
19
- header: Header
20
- footer: Footer
21
- enter_file_name: Enter file name
34
+ subscript: Subscript
35
+ superscript: Superscript
36
+ underline: Underline
37
+ upload: Upload
38
+ upload_image: Upload Image
39
+ upload_file: Upload File
40
+
41
+ enable_rich_editor: "Enable Rich Editor"
42
+ rich_editor: "Rich Editor"
43
+ rich_editor_description: "Configure Rich Editor settings."
44
+ rich_editor_engine: "Rich Editor engine"
45
+ rich_editor_ids: "Rich Editor Identificators"
46
+ rich_editor_ids_description: "List textarea's ids splitted by spaces here"
@@ -1,20 +1,45 @@
1
+ ---
1
2
  ru:
2
3
  editor:
3
- loading: Загружается
4
- font_name_and_size: Шрифт и размер
5
- font_style: Стиль
4
+ align_center: Выровнять по центру
5
+ align_left: Выровнять по левому краю
6
+ align_right: Выровнять по правому краю
6
7
  alignment: Выравнивание
7
- paragraph_style: Стиль
8
- indenting_and_lists: "Отступы/списки"
9
- insert_item: Вставка
10
- insert_image: Вставить картинки по адресу
11
- upload_image: Загрузить картинку
12
- upload_file: Загрузить файл
13
- show_more_fields: Показать дополнительные поля
14
- hide_more_fields: Скрыть дополнительные поля
15
- switch_simple: Переключиться на простой редактор
16
- switch_rich: Переключиться на расширенный
17
- sidebar: Боковое меню
18
- header: Верхнее меню
19
- footer: Нижнее меню
8
+ background_color: Цвет фона
9
+ bold: Полужирный
10
+ create_an_ordered_list: Нумерованный список
11
+ create_an_unordered_list: Ненумерованный список
20
12
  enter_file_name: Введите имя файла
13
+ font_name_and_size: Шрифт и размер
14
+ font_color: Цвет шрифта
15
+ font_style: Стиль шрифта
16
+ header: Заголовок
17
+ hide_more_fields: Скрыть дополнительные поля
18
+ html_link: HTML ссылка
19
+ indenting_and_lists: "Отступы/Списки"
20
+ insert_item: Вставить
21
+ insert_image: Вставить изображение
22
+ indent: Увеличить отступ
23
+ italic: Курсив
24
+ justify: Выключить строку
25
+ loading: Загрузка
26
+ normal: Нормальный
27
+ outdent: Уменьшить отступ
28
+ paragraph_style: Стиль параграфа
29
+ remove_formatting: Убрать форматирование
30
+ show_and_hide_hidden_elements: "Показать/Спрятать скрытые элементы"
31
+ show_more_fields: Показать больше полей
32
+ sidebar: Боковая панель
33
+ subscript: Нижний индекс
34
+ superscript: Верхний индекс
35
+ underline: Подчеркнутый
36
+ upload: Загрузить
37
+ upload_image: Загрузить изображение
38
+ upload_file: Загрузить файл
39
+
40
+ enable_rich_editor: "Включить Визуальный Редактор"
41
+ rich_editor: "Визуальный Редактор"
42
+ rich_editor_description: "Настройка Визуального Редактора."
43
+ rich_editor_engine: "Реализация Визуального Редактора"
44
+ rich_editor_ids: "Идентификаторы"
45
+ rich_editor_ids_description: "Перечислите идентификаторы элементов textarea через пробел"
data/config/routes.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  Rails.application.routes.draw do
2
+ namespace :admin do
3
+ resource :editor_settings, :only => ['show', 'update', 'edit']
4
+ end
2
5
 
3
6
  resources :content_images, :only => [:create]
4
7
  resources :content_files, :only => [:create]
5
-
6
8
  end
@@ -0,0 +1,5 @@
1
+ class EditorConfiguration < Configuration
2
+ preference :enabled, :boolean, :default => true
3
+ preference :current_editor, :string, :default => 'YUIRichEditor'
4
+ preference :ids, :string, :default => 'product_description page_body'
5
+ end
@@ -0,0 +1,22 @@
1
+ module Spree
2
+ module Editor
3
+ # Singleton class to access the advanced cart configuration object (EditorConfiguration.first by default) and it's preferences.
4
+ #
5
+ # Usage:
6
+ # Spree::Editor::Config[:foo] # Returns the foo preference
7
+ # Spree::Editor::Config[] # Returns a Hash with all the google base preferences
8
+ # Spree::Editor::Config.instance # Returns the configuration object (EditorConfiguration.first)
9
+ # Spree::Editor::Config.set(preferences_hash) # Set the advanced cart preferences as especified in +preference_hash+
10
+ class Config
11
+ include Singleton
12
+ include PreferenceAccess
13
+
14
+ class << self
15
+ def instance
16
+ return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
17
+ EditorConfiguration.find_or_create_by_name("Editor configuration")
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
data/lib/spree_editor.rb CHANGED
@@ -1,10 +1,8 @@
1
1
  require 'spree_core'
2
2
  require 'spree_editor_hooks'
3
- require 'helpers/editor_helper'
4
3
 
5
4
  module SpreeEditor
6
5
  class Engine < Rails::Engine
7
-
8
6
  config.autoload_paths += %W(#{config.root}/lib)
9
7
 
10
8
  def self.activate
@@ -15,8 +13,6 @@ module SpreeEditor
15
13
 
16
14
  config.to_prepare &method(:activate).to_proc
17
15
  end
18
- end
19
16
 
20
- ActionView::Base.class_eval do
21
- include EditorHelper
17
+ EditorEngines = %w(YUIRichEditor WYMEditor TinyMCE)
22
18
  end
@@ -1,3 +1,18 @@
1
1
  class SpreeEditorHooks < Spree::ThemeSupport::HookListener
2
- # custom hooks go here
2
+ # Admin configuration
3
+ insert_after :admin_configurations_menu do
4
+ %(<tr>
5
+ <td><%= link_to t("rich_editor"), admin_editor_settings_path %></td>
6
+ <td><%= t("rich_editor_description") %></td>
7
+ </ tr>)
8
+ end
9
+
10
+ insert_after :admin_configurations_sidebar_menu do
11
+ %(<li<%== ' class="active"' if controller.controller_name == 'editor_settings' %>><%= link_to t("rich_editor"), admin_editor_settings_path %></li>)
12
+ end
13
+
14
+ # Javascript
15
+ insert_after :admin_inside_head do
16
+ %(<%= render :partial => 'shared/rich_editor_javascript' %>)
17
+ end
3
18
  end
@@ -46,7 +46,8 @@
46
46
  '></form>'
47
47
  ).css({
48
48
  margin: 0,
49
- padding: 0
49
+ padding: 0,
50
+ position: 'relative'
50
51
  });
51
52
 
52
53
  /** File Input */
@@ -56,18 +57,18 @@
56
57
  'type="file" '+
57
58
  '/>'
58
59
  ).css({
59
- position: 'relative',
60
+ position: 'absolute',
60
61
  display: 'block',
61
62
  marginLeft: -175+'px',
62
63
  opacity: 0
63
64
  });
64
-
65
+
65
66
  /** Put everything together */
66
67
  element.wrap('<div></div>'); //container
67
68
  form.append(input);
68
69
  element.after(form);
69
70
  element.after(iframe);
70
-
71
+
71
72
  /** Find the container and make it nice and snug */
72
73
  var container = element.parent().css({
73
74
  position: 'relative',
@@ -75,9 +76,9 @@
75
76
  overflow: 'hidden',
76
77
  cursor: 'pointer',
77
78
  margin: 0,
78
- padding: 0
79
+ padding: 0 + ' 2px'
79
80
  });
80
-
81
+
81
82
  /** Put our file input in the right place */
82
83
  input.css('marginTop', -container.height()-10+'px');
83
84
 
@@ -0,0 +1 @@
1
+ (function(b){var e,d,a=[],c=window;b.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);if(v){s.onInit.add(function(){var x,y=v;if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}})}});b.each(r,function(t,s){s.render()})}if(!c.tinymce&&!d&&(g=j.script_url)){d=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}c.tinyMCEPreInit=c.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!c.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");b.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}b.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;d=2;if(j.script_loaded){j.script_loaded()}o();b.each(a,function(q,r){r()})}})}else{if(d===1){a.push(o)}else{o()}}return p};b.extend(b.expr[":"],{tinymce:function(g){return g.id&&!!tinyMCE.get(g.id)}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==e){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(c.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(c.tinymce)&&(l.is(":tinymce")))}var j={};b.each(["text","html","val"],function(n,l){var o=j[l]=b.fn[l],m=(l==="text");b.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==e){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(b(v),q)});return r}}});b.each(["append","prepend"],function(n,m){var o=j[m]=b.fn[m],l=(m==="prepend");b.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==e){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});b.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=b.fn[l];b.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=b.fn.attr;b.fn.attr=function(n,q,o){var m=this;if((!n)||(n!=="value")||(!g(m))){return j.attr.call(m,n,q,o)}if(q!==e){k.call(m.filter(":tinymce"),q);j.attr.call(m.not(":tinymce"),n,q,o);return m}else{var p=m[0],l=h(p);return l?l.getContent():j.attr.call(b(p),n,q,o)}}}})(jQuery);