glebtv-ckeditor 4.4.7.4 → 4.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (443) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +38 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +124 -84
  5. data/Rakefile +1 -25
  6. data/app/assets/javascripts/ckeditor/application.js +0 -1
  7. data/app/assets/javascripts/ckeditor/config.js.erb +5 -59
  8. data/app/assets/javascripts/ckeditor/config_orig.js +58 -0
  9. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.jpg +0 -0
  10. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.png +0 -0
  11. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_del.png +0 -0
  12. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_more.gif +0 -0
  13. data/app/assets/javascripts/ckeditor/filebrowser/images/preloader.gif +0 -0
  14. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/avi.gif +0 -0
  15. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/ckfnothumb.gif +0 -0
  16. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/doc.gif +0 -0
  17. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/docx.gif +0 -0
  18. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/exe.gif +0 -0
  19. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/gz.gif +0 -0
  20. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/htm.gif +0 -0
  21. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/jpg.gif +0 -0
  22. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/mp3.gif +0 -0
  23. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/mpg.gif +0 -0
  24. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/pdf.gif +0 -0
  25. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/psd.gif +0 -0
  26. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/rar.gif +0 -0
  27. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/swf.gif +0 -0
  28. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/tar.gif +0 -0
  29. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/txt.gif +0 -0
  30. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/unknown.gif +0 -0
  31. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/wmv.gif +0 -0
  32. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/xls.gif +0 -0
  33. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/xlsx.gif +0 -0
  34. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/zip.gif +0 -0
  35. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/application.js.erb +58 -56
  36. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -0
  37. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.endless-scroll.js +0 -0
  38. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.min.js +0 -0
  39. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -0
  40. data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css.erb +12 -6
  41. data/app/assets/javascripts/ckeditor/init.js.erb +6 -1
  42. data/app/assets/stylesheets/ckcontent.css +0 -0
  43. data/app/assets/stylesheets/ckeditor/application.css +0 -0
  44. data/app/controllers/ckeditor/application_controller.rb +6 -17
  45. data/app/controllers/ckeditor/attachment_files_controller.rb +10 -3
  46. data/app/controllers/ckeditor/pictures_controller.rb +9 -2
  47. data/app/helpers/ckeditor/application_helper.rb +0 -0
  48. data/app/views/ckeditor/attachment_files/index.html.erb +3 -3
  49. data/app/views/ckeditor/pictures/index.html.erb +3 -3
  50. data/app/views/ckeditor/shared/_asset.html.erb +0 -0
  51. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +0 -0
  52. data/app/views/layouts/ckeditor/application.html.erb +3 -2
  53. data/app/views/rails_admin/main/_form_ck_editor.html.haml +1 -1
  54. data/app/views/rails_admin/main/_form_ck_editorml.html.haml +1 -1
  55. data/config/locales/bg.ckeditor.yml +9 -0
  56. data/config/locales/cs.ckeditor.yml +0 -0
  57. data/config/locales/de.ckeditor.yml +0 -0
  58. data/config/locales/el-GR.cdkeditor.yml +0 -0
  59. data/config/locales/en.ckeditor.yml +0 -0
  60. data/config/locales/es.ckeditor.yml +0 -0
  61. data/config/locales/fr.ckeditor.yml +0 -0
  62. data/config/locales/hu.ckeditor.yml +0 -0
  63. data/config/locales/it.ckeditor.yml +0 -0
  64. data/config/locales/ja.ckeditor.yml +9 -0
  65. data/config/locales/nb.ckeditor.yml +9 -0
  66. data/config/locales/nl.ckeditor.yml +0 -0
  67. data/config/locales/pl.ckeditor.yml +0 -0
  68. data/config/locales/pt-BR.ckeditor.yml +0 -0
  69. data/config/locales/pt-PT.ckeditor.yml +0 -0
  70. data/config/locales/ru.ckeditor.yml +0 -0
  71. data/config/locales/sv-SE.ckeditor.yml +0 -0
  72. data/config/locales/tr.ckeditor.yml +9 -0
  73. data/config/locales/uk.ckeditor.yml +0 -0
  74. data/config/locales/zh-CN.ckeditor.yml +1 -1
  75. data/config/locales/zh-TW.ckeditor.yml +9 -0
  76. data/config/routes.rb +0 -0
  77. data/lib/ckeditor.rb +39 -5
  78. data/lib/ckeditor/asset_response.rb +59 -0
  79. data/lib/ckeditor/backend/carrierwave.rb +1 -8
  80. data/lib/ckeditor/backend/dragonfly.rb +8 -6
  81. data/lib/ckeditor/backend/paperclip.rb +7 -11
  82. data/lib/ckeditor/backend/refile.rb +37 -0
  83. data/lib/ckeditor/engine.rb +4 -0
  84. data/lib/ckeditor/helpers/controllers.rb +0 -0
  85. data/lib/ckeditor/helpers/form_builder.rb +0 -0
  86. data/lib/ckeditor/helpers/form_helper.rb +0 -0
  87. data/lib/ckeditor/helpers/view_helper.rb +0 -0
  88. data/lib/ckeditor/hooks/cancan.rb +4 -1
  89. data/lib/ckeditor/hooks/formtastic.rb +0 -0
  90. data/lib/ckeditor/hooks/pundit.rb +0 -0
  91. data/lib/ckeditor/hooks/simple_form.rb +1 -1
  92. data/lib/ckeditor/http.rb +1 -3
  93. data/lib/ckeditor/orm/active_record.rb +0 -0
  94. data/lib/ckeditor/orm/base.rb +0 -0
  95. data/lib/ckeditor/orm/mongoid.rb +0 -0
  96. data/lib/ckeditor/paginatable.rb +0 -0
  97. data/lib/ckeditor/text_area.rb +2 -1
  98. data/lib/ckeditor/utils.rb +26 -23
  99. data/lib/ckeditor/utils/content_type_detector.rb +41 -0
  100. data/lib/ckeditor/utils/javascript_code.rb +10 -0
  101. data/lib/ckeditor/version.rb +4 -2
  102. data/lib/generators/ckeditor/install_generator.rb +1 -1
  103. data/lib/generators/ckeditor/pundit_policy_generator.rb +0 -0
  104. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +0 -0
  105. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +0 -0
  106. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +0 -0
  107. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +0 -0
  108. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +1 -1
  109. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +1 -1
  110. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +0 -0
  111. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +0 -0
  112. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +0 -0
  113. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +3 -5
  114. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +3 -5
  115. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +7 -7
  116. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/asset.rb +4 -0
  117. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/attachment_file.rb +7 -0
  118. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +11 -0
  119. data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +28 -0
  120. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +2 -0
  121. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +0 -0
  122. data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +13 -19
  123. data/lib/generators/ckeditor/templates/ckeditor.rb +23 -0
  124. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +0 -0
  125. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +0 -0
  126. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +0 -0
  127. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +0 -0
  128. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +3 -6
  129. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +3 -5
  130. data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +3 -3
  131. data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +3 -3
  132. data/lib/glebtv-ckeditor.rb +0 -0
  133. data/lib/tasks/ckeditor.rake +26 -0
  134. data/test/controllers/attachment_files_controller_test.rb +2 -2
  135. data/test/controllers/pictures_controller_test.rb +3 -4
  136. data/test/dummy/Rakefile +0 -0
  137. data/test/dummy/app/assets/javascripts/application.js +0 -1
  138. data/test/dummy/app/assets/stylesheets/application.css +0 -0
  139. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -0
  140. data/test/dummy/app/controllers/application_controller.rb +0 -1
  141. data/test/dummy/app/controllers/posts_controller.rb +0 -0
  142. data/test/dummy/app/helpers/application_helper.rb +0 -0
  143. data/test/dummy/app/helpers/posts_helper.rb +0 -0
  144. data/test/dummy/app/models/post.rb +0 -0
  145. data/test/dummy/app/views/layouts/application.html.erb +2 -2
  146. data/test/dummy/app/views/posts/_form.html.erb +0 -0
  147. data/test/dummy/app/views/posts/edit.html.erb +0 -0
  148. data/test/dummy/app/views/posts/index.html.erb +0 -0
  149. data/test/dummy/app/views/posts/new.html.erb +0 -0
  150. data/test/dummy/app/views/posts/show.html.erb +0 -0
  151. data/test/dummy/config.ru +0 -0
  152. data/test/dummy/config/application.rb +15 -15
  153. data/test/dummy/config/boot.rb +0 -0
  154. data/test/dummy/config/database.yml +0 -0
  155. data/test/dummy/config/environment.rb +0 -0
  156. data/test/dummy/config/environments/development.rb +0 -0
  157. data/test/dummy/config/environments/production.rb +0 -0
  158. data/test/dummy/config/environments/test.rb +7 -5
  159. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -0
  160. data/test/dummy/config/initializers/ckeditor.rb +0 -0
  161. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  162. data/test/dummy/config/initializers/inflections.rb +0 -0
  163. data/test/dummy/config/initializers/mime_types.rb +0 -0
  164. data/test/dummy/config/initializers/session_store.rb +0 -0
  165. data/test/dummy/config/initializers/wrap_parameters.rb +0 -0
  166. data/test/dummy/config/locales/en.yml +0 -0
  167. data/test/dummy/config/mongoid.yml +135 -1
  168. data/test/dummy/config/routes.rb +3 -3
  169. data/test/dummy/config/secrets.yml +8 -0
  170. data/test/dummy/db/migrate/20110623120047_create_posts.rb +1 -1
  171. data/test/dummy/public/404.html +0 -0
  172. data/test/dummy/public/422.html +0 -0
  173. data/test/dummy/public/500.html +0 -0
  174. data/test/dummy/public/favicon.ico +0 -0
  175. data/test/dummy/script/rails +0 -0
  176. data/test/dummy/test/fixtures/files/rails.png +0 -0
  177. data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
  178. data/test/functional/posts_controller_test.rb +6 -6
  179. data/test/generators/install_generator_test.rb +14 -0
  180. data/test/integration/navigation_test.rb +0 -0
  181. data/test/models/attachment_file_test.rb +2 -2
  182. data/test/{ckeditor_test.rb → models/ckeditor_test.rb} +35 -0
  183. data/test/models/picture_test.rb +6 -1
  184. data/test/models/utils_test.rb +6 -6
  185. data/test/orm/active_record.rb +0 -0
  186. data/test/orm/mongoid.rb +0 -0
  187. data/test/support/helpers.rb +0 -0
  188. data/test/support/integration_case.rb +0 -0
  189. data/test/support/raw_post.rb +0 -0
  190. data/test/support/routes.txt +0 -0
  191. data/test/test_helper.rb +3 -5
  192. data/vendor/assets/javascripts/ckeditor/LICENSE.md +159 -3
  193. data/vendor/assets/javascripts/ckeditor/README.md +39 -0
  194. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +7 -7
  195. data/vendor/assets/javascripts/ckeditor/build-config.js +4 -3
  196. data/vendor/assets/javascripts/ckeditor/ckeditor.js +1028 -964
  197. data/vendor/assets/javascripts/ckeditor/config.js +1 -1
  198. data/vendor/assets/javascripts/ckeditor/lang/en.js +3 -3
  199. data/vendor/assets/javascripts/ckeditor/lang/ru.js +3 -3
  200. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +5 -5
  201. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +4 -4
  202. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
  203. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +4 -4
  204. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
  205. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  206. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +9 -8
  207. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  208. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autocomplete.png +0 -0
  209. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
  210. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/commentselectedrange.png +0 -0
  211. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
  212. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
  213. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +1 -1
  214. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -1
  215. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  216. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -1
  217. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcode.min.js +0 -0
  218. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +0 -0
  219. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +1 -1
  220. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  221. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +1 -1
  222. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +0 -0
  223. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +0 -0
  224. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +49 -29
  225. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +2 -0
  226. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +2 -0
  227. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +0 -0
  228. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +7 -8
  229. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +2 -0
  230. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +2 -0
  231. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +2 -0
  232. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +2 -0
  233. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -0
  234. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +0 -0
  235. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +0 -0
  236. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +3 -1
  237. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +4 -2
  238. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -0
  239. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +2 -0
  240. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +3 -1
  241. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +2 -0
  242. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -1
  243. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +0 -0
  244. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +0 -0
  245. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +2 -0
  246. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +2 -0
  247. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +2 -0
  248. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +3 -0
  249. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +2 -0
  250. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +9 -9
  251. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +2 -0
  252. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -0
  253. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +2 -0
  254. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +65 -0
  255. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +2 -0
  256. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +2 -0
  257. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +2 -0
  258. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +0 -0
  259. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -0
  260. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +10 -10
  261. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
  262. data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +8 -8
  263. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +16 -16
  264. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +14 -14
  265. data/vendor/assets/javascripts/ckeditor/plugins/flash/images/placeholder.png +0 -0
  266. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +2 -2
  267. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +4 -3
  268. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +4 -4
  269. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +4 -4
  270. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +6 -5
  271. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +15 -15
  272. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +3 -3
  273. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +6 -5
  274. data/vendor/assets/javascripts/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
  275. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  276. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  277. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +3 -3
  278. data/vendor/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  279. data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +29 -34
  280. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +41 -40
  281. data/vendor/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
  282. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/LICENSE +22 -0
  283. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/README.md +2 -0
  284. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/en.js +3 -0
  285. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +3 -0
  286. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +81 -0
  287. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/readme.txt +30 -0
  288. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +2 -2
  289. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +20 -20
  290. data/vendor/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
  291. data/vendor/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  292. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +7 -7
  293. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/hidpi/loremipsum.png +0 -0
  294. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/loremipsum.png +0 -0
  295. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/en.js +8 -0
  296. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +8 -0
  297. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +131 -0
  298. data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
  299. data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
  300. data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/icon-rtl.png +0 -0
  301. data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
  302. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +7 -0
  303. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +7 -0
  304. data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +923 -0
  305. data/vendor/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  306. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +29 -28
  307. data/vendor/assets/javascripts/ckeditor/plugins/preview/preview.html +0 -0
  308. data/vendor/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +20 -0
  309. data/vendor/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +28 -28
  310. data/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +25 -0
  311. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +19 -17
  312. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -0
  313. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  314. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  315. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  316. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  317. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  318. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  319. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  320. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  321. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  322. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  323. data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  324. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +8 -7
  325. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  326. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
  327. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  328. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
  329. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  330. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
  331. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  332. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
  333. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  334. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
  335. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  336. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
  337. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  338. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
  339. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
  340. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  341. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.png +0 -0
  342. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
  343. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.png +0 -0
  344. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  345. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.png +0 -0
  346. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  347. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
  348. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  349. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
  350. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  351. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
  352. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  353. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
  354. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  355. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
  356. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  357. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
  358. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  359. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
  360. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  361. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
  362. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
  363. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
  364. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  365. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  366. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
  367. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  368. data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
  369. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +1 -1
  370. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
  371. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +10 -10
  372. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +9 -3
  373. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +17 -17
  374. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +12 -12
  375. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
  376. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +7 -7
  377. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +4 -3
  378. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  379. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  380. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  381. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +1 -1
  382. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +4 -2
  383. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +4 -2
  384. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +286 -145
  385. data/vendor/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +0 -0
  386. data/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +0 -0
  387. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +1 -1
  388. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
  389. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +1 -1
  390. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +88 -70
  391. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc_ie.js +7 -7
  392. data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
  393. data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +1 -1
  394. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +388 -388
  395. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +5 -0
  396. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +5 -0
  397. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +5 -0
  398. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +5 -0
  399. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  400. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +5 -0
  401. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +5 -0
  402. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +5 -0
  403. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +5 -0
  404. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +5 -0
  405. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +5 -0
  406. data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
  407. data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
  408. data/vendor/assets/javascripts/ckeditor/skins/moono/images/arrow.png +0 -0
  409. data/vendor/assets/javascripts/ckeditor/skins/moono/images/close.png +0 -0
  410. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  411. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  412. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  413. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  414. data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock-open.png +0 -0
  415. data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock.png +0 -0
  416. data/vendor/assets/javascripts/ckeditor/skins/moono/images/refresh.png +0 -0
  417. data/vendor/assets/javascripts/ckeditor/skins/moono/images/spinner.gif +0 -0
  418. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +49 -0
  419. data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
  420. metadata +105 -130
  421. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.min.js +0 -4
  422. data/app/assets/javascripts/ckeditor/override.js.erb +0 -21
  423. data/test/dummy/config/initializers/secret_token.rb +0 -7
  424. data/test/support/controller_hooks.rb +0 -27
  425. data/vendor/assets/javascripts/ckeditor/plugins/ipsum/icon.png +0 -0
  426. data/vendor/assets/javascripts/ckeditor/plugins/ipsum/plugin.js +0 -63
  427. data/vendor/assets/javascripts/ckeditor/plugins/map/example_usage.js +0 -30
  428. data/vendor/assets/javascripts/ckeditor/plugins/map/map.gif +0 -0
  429. data/vendor/assets/javascripts/ckeditor/plugins/map/plugin.js +0 -187
  430. data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/icons/hidpi/mediaembed.png +0 -0
  431. data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/icons/mediaembed.png +0 -0
  432. data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/plugin.js +0 -64
  433. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css.scss +0 -771
  434. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css.scss +0 -812
  435. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css.scss +0 -844
  436. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css.scss +0 -825
  437. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css.scss +0 -816
  438. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css.scss +0 -2136
  439. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css.scss +0 -2145
  440. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css.scss +0 -2194
  441. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css.scss +0 -2362
  442. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css.scss +0 -2206
  443. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css.scss +0 -2254
@@ -1,4 +1,3 @@
1
- require 'mime/types'
2
1
  require 'mini_magick'
3
2
 
4
3
  module Ckeditor
@@ -38,13 +37,7 @@ module Ckeditor
38
37
  end
39
38
 
40
39
  def extract_content_type
41
- if file.content_type == 'application/octet-stream' || file.content_type.blank?
42
- content_type = MIME::Types.type_for(original_filename).first
43
- else
44
- content_type = file.content_type
45
- end
46
-
47
- model.data_content_type = content_type.to_s
40
+ model.data_content_type = Utils::ContentTypeDetector.new(file.path).detect
48
41
  end
49
42
 
50
43
  def set_size
@@ -2,24 +2,26 @@ module Ckeditor
2
2
  module Backend
3
3
  module Dragonfly
4
4
  def self.included(base)
5
- base.send(:include, InstanceMethods)
5
+ base.send(:extend, ::Dragonfly::Model)
6
+ base.send(:extend, ::Dragonfly::Model::Validations)
6
7
  base.send(:extend, ClassMethods)
8
+ base.send(:include, InstanceMethods)
7
9
  end
8
10
 
9
11
  module ClassMethods
10
12
  def attachment_file_types
11
- @attachment_file_types ||= Ckeditor.attachment_file_types.map(&:to_sym).tap do |formats|
13
+ @attachment_file_types ||= Ckeditor.attachment_file_types.map(&:to_s).tap do |formats|
12
14
  # This is not ideal but Dragonfly doesn't return double
13
15
  # extensions. Having said that, the other backends
14
16
  # currently don't use attachment_file_types at all.
15
- [ :bz2, :gz, :lzma, :xz ].each do |f|
16
- formats << f if formats.include?("tar.#{f}".to_sym)
17
+ [ 'bz2', 'gz', 'lzma', 'xz' ].each do |f|
18
+ formats << f if formats.include?("tar.#{f}")
17
19
  end
18
20
  end
19
21
  end
20
22
 
21
23
  def image_file_types
22
- @image_file_types ||= Ckeditor.image_file_types.map(&:to_sym)
24
+ @image_file_types ||= Ckeditor.image_file_types.map(&:to_s)
23
25
  end
24
26
  end
25
27
 
@@ -27,7 +29,7 @@ module Ckeditor
27
29
  delegate :url, :path, :size, :image?, :width, :height, :to => :data
28
30
 
29
31
  alias_attribute :data_file_name, :data_name
30
- alias_attribute :data_content_type, :data_mime_type
32
+ alias_attribute :data_content_type, :"data.mime_type"
31
33
  alias_attribute :data_file_size, :data_size
32
34
 
33
35
  private
@@ -1,5 +1,3 @@
1
- require 'mime/types'
2
-
3
1
  module Ckeditor
4
2
  module Backend
5
3
  module Paperclip
@@ -21,14 +19,15 @@ module Ckeditor
21
19
 
22
20
  module InstanceMethods
23
21
  def geometry
24
- @geometry ||= begin
25
- file = data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
26
- ::Paperclip::Geometry.from_file(file)
27
- end
22
+ @geometry ||= ::Paperclip::Geometry.from_file(file)
28
23
  end
29
24
 
30
25
  protected
31
26
 
27
+ def file
28
+ @file ||= data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
29
+ end
30
+
32
31
  def parameterize_filename
33
32
  unless data_file_name.blank?
34
33
  filename = Ckeditor::Utils.parameterize_filename(data_file_name)
@@ -43,12 +42,9 @@ module Ckeditor
43
42
  end
44
43
  end
45
44
 
46
- # Extract content_type from filename using mime/types gem
47
45
  def extract_content_type
48
- if data_content_type == "application/octet-stream" && !data_file_name.blank?
49
- content_types = MIME::Types.type_for(data_file_name)
50
- self.data_content_type = content_types.first.to_s unless content_types.empty?
51
- end
46
+ path = file.nil? ? nil : file.path
47
+ self.data_content_type = Utils::ContentTypeDetector.new(path).detect
52
48
  end
53
49
  end
54
50
  end
@@ -0,0 +1,37 @@
1
+ module Ckeditor
2
+ module Backend
3
+ module Refile
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ validates :data, presence: true
8
+ delegate :rewind, :download, :to_io, :exists?, :delete, :size, :close, :eof?, :read, to: :data
9
+ alias_attribute :data_file_name, :data_filename
10
+ alias_attribute :data_file_size, :data_size
11
+ end
12
+
13
+ class_methods do
14
+ def attachment_file_types
15
+ @attachment_file_types ||= Ckeditor.attachment_file_types.map(&:to_s)
16
+ end
17
+
18
+ def image_file_types
19
+ @image_file_types ||= Ckeditor.image_file_types.map(&:to_s)
20
+ end
21
+ end
22
+
23
+ def url(*attrs)
24
+ ::Refile.attachment_url(self, :data, *attrs)
25
+ end
26
+
27
+ def read_dimensions
28
+ if model.image? && model.has_dimensions?
29
+ magick = MiniMagick::Image.open(model.to_io)
30
+ model.width = magick.width
31
+ model.height = magick.height
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -38,5 +38,9 @@ module Ckeditor
38
38
  require "ckeditor/hooks/pundit"
39
39
  end
40
40
  end
41
+
42
+ rake_tasks do
43
+ load Ckeditor.root_path.join("lib/tasks/ckeditor.rake")
44
+ end
41
45
  end
42
46
  end
File without changes
File without changes
File without changes
File without changes
@@ -19,7 +19,10 @@ module Ckeditor
19
19
  # action as a symbol (:create, :destroy, etc.). The second argument is the actual model
20
20
  # instance if it is available.
21
21
  def authorize(action, model_object = nil)
22
- @controller.authorize!(action.to_sym, model_object) if action
22
+ if action
23
+ @controller.instance_variable_set(:@_authorized, true)
24
+ @controller.current_ability.authorize!(action.to_sym, model_object)
25
+ end
23
26
  end
24
27
 
25
28
  # This method is called primarily from the view to determine whether the given user
File without changes
File without changes
@@ -2,7 +2,7 @@ require 'simple_form'
2
2
 
3
3
  module Ckeditor::Hooks::SimpleForm
4
4
  class CkeditorInput < ::SimpleForm::Inputs::Base
5
- def input
5
+ def input(wrapper_options = nil)
6
6
  @builder.cktext_area(attribute_name, input_html_options)
7
7
  end
8
8
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require 'digest/sha1'
3
- require 'mime/types'
4
3
 
5
4
  module Ckeditor
6
5
  module Http
@@ -61,8 +60,7 @@ module Ckeditor
61
60
  end
62
61
 
63
62
  def content_type
64
- types = MIME::Types.type_for(original_filename)
65
- types.empty? ? @request.content_type : types.first.to_s
63
+ @request.content_type
66
64
  end
67
65
 
68
66
  def body
File without changes
File without changes
File without changes
File without changes
@@ -14,6 +14,7 @@ module Ckeditor
14
14
  @template = template
15
15
  @options = options.stringify_keys
16
16
  @ck_options = (@options.delete('ckeditor') || {}).stringify_keys
17
+ @ck_options['customConfig'] ||= Ckeditor.js_config_url if Ckeditor.cdn_enabled?
17
18
  end
18
19
 
19
20
  def render_instance_tag(object_name, method)
@@ -49,4 +50,4 @@ module Ckeditor
49
50
  end
50
51
  end
51
52
  end
52
- end
53
+ end
@@ -3,6 +3,9 @@ require 'active_support/json/encoding'
3
3
 
4
4
  module Ckeditor
5
5
  module Utils
6
+ autoload :JavascriptCode, 'ckeditor/utils/javascript_code'
7
+ autoload :ContentTypeDetector, 'ckeditor/utils/content_type_detector'
8
+
6
9
  class << self
7
10
  def escape_single_quotes(str)
8
11
  str.gsub('\\','\0\0').gsub('</','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
@@ -18,16 +21,16 @@ module Ckeditor
18
21
  end
19
22
 
20
23
  def js_replace(dom_id, options = nil)
21
- js = ["if (typeof CKEDITOR != 'undefined') {"]
24
+ js = ["(function() { if (typeof CKEDITOR != 'undefined') {"]
22
25
 
23
26
  if options && !options.keys.empty?
24
27
  js_options = ActiveSupport::JSON.encode(options)
25
- js << "CKEDITOR.replace('#{dom_id}', #{js_options});"
28
+ js << "if (CKEDITOR.instances['#{dom_id}'] == undefined) { CKEDITOR.replace('#{dom_id}', #{js_options}); }"
26
29
  else
27
- js << "CKEDITOR.replace('#{dom_id}');"
30
+ js << "if (CKEDITOR.instances['#{dom_id}'] == undefined) { CKEDITOR.replace('#{dom_id}'); }"
28
31
  end
29
32
 
30
- js << "}"
33
+ js << "} else { setTimeout(arguments.callee, 50); } })();"
31
34
  js.join(" ").html_safe
32
35
  end
33
36
 
@@ -36,17 +39,18 @@ module Ckeditor
36
39
 
37
40
  case uploader_type.to_s.downcase
38
41
  when "image" then
39
- options[:action] = "EDITOR.config.filebrowserImageUploadUrl"
42
+ options[:action] = JavascriptCode.new("EDITOR.config.filebrowserImageUploadUrl")
40
43
  options[:allowedExtensions] = Ckeditor.image_file_types
41
44
  when "flash" then
42
- options[:action] = "EDITOR.config.filebrowserFlashUploadUrl"
45
+ options[:action] = JavascriptCode.new("EDITOR.config.filebrowserFlashUploadUrl")
43
46
  options[:allowedExtensions] = ["swf"]
44
47
  else
45
- options[:action] = "EDITOR.config.filebrowserUploadUrl"
48
+ options[:action] = JavascriptCode.new("EDITOR.config.filebrowserUploadUrl")
46
49
  options[:allowedExtensions] = Ckeditor.attachment_file_types
47
50
  end
48
51
 
49
- js_options = ActiveSupport::JSON.encode(options).gsub /"EDITOR.config.filebrowser(.*)UploadUrl"/, 'EDITOR.config.filebrowser\1UploadUrl'
52
+ js_options = ActiveSupport::JSON.encode(options)
53
+ js_options.gsub!(/"(EDITOR\.config\.filebrowser(Image|Flash|)UploadUrl)"/, '\1')
50
54
 
51
55
  "(function() { new qq.FileUploaderInput(#{js_options}); }).call(this);".html_safe
52
56
  end
@@ -64,14 +68,15 @@ module Ckeditor
64
68
  end
65
69
 
66
70
  def select_assets(path, relative_path)
67
- relative_folder = Ckeditor.root_path.join relative_path
68
- folder = relative_folder.join path
69
- extensions = '*.{js,css,png,gif,jpg,scss}'
71
+ relative_folder = Ckeditor.root_path.join(relative_path)
72
+ folder = relative_folder.join(path)
73
+ extensions = '*.{js,css,png,gif,jpg}'
74
+ languages = (Ckeditor.assets_languages || [])
70
75
 
71
76
  # Files at root
72
77
  files = Dir[folder.join(extensions)]
73
78
 
74
- # Plugins
79
+ # Filter plugins
75
80
  if Ckeditor.assets_plugins.nil?
76
81
  files += Dir[folder.join('plugins', '**', extensions)]
77
82
  else
@@ -83,22 +88,20 @@ module Ckeditor
83
88
  # Other folders
84
89
  Dir[folder.join('*/')].each do |subfolder|
85
90
  path = Pathname.new(subfolder)
86
- unless path.basename.to_s == 'plugins'
87
- files += Dir[path.join('**', extensions)]
88
- end
91
+ next if ['plugins'].include?(path.basename.to_s)
92
+ files += Dir[path.join('**', extensions)]
89
93
  end
90
94
 
91
- paths = files.map { |file| Pathname.new(file) }
95
+ files.inject([]) do |items, name|
96
+ file = Pathname.new(name)
97
+ base = file.basename('.*').to_s
92
98
 
93
- # Filter languages
94
- if Ckeditor.assets_languages.present?
95
- paths.select! do |path|
96
- path.dirname.basename.to_s != 'lang' ||
97
- Ckeditor.assets_languages.include?(path.basename.to_s.split('.')[0])
99
+ if !name.include?('/lang/') || languages.include?(base)
100
+ items << file.relative_path_from(relative_folder).to_s
98
101
  end
99
- end
100
102
 
101
- paths.map { |path| path.relative_path_from(relative_folder).to_s.gsub('.scss', '') }.select { |path| path != 'ckeditor/ckeditor.js' }
103
+ items
104
+ end
102
105
  end
103
106
  end
104
107
  end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ require 'cocaine'
3
+
4
+ module Ckeditor
5
+ module Utils
6
+ class ContentTypeDetector
7
+ EMPTY_CONTENT_TYPE = 'inode/x-empty'
8
+ DEFAULT_CONTENT_TYPE = 'application/octet-stream'
9
+
10
+ def initialize(file_path)
11
+ @file_path = file_path
12
+ end
13
+
14
+ # content type detection strategy:
15
+ #
16
+ # 1. empty file: returns 'inode/x-empty'
17
+ # 2. nonempty file: if the file is not empty then returns the content type using file command
18
+ # 3. invalid file: file command raises error and returns 'application/octet-stream'
19
+
20
+ def detect
21
+ empty_file? ? EMPTY_CONTENT_TYPE : content_type_from_file_command
22
+ end
23
+
24
+ private
25
+
26
+ def empty_file?
27
+ return true if @file_path.blank?
28
+ File.exists?(@file_path) && File.size(@file_path) == 0
29
+ end
30
+
31
+ def content_type_from_file_command
32
+ type = begin
33
+ Cocaine::CommandLine.new('file', '-b --mime-type :file').run(file: @file_path)
34
+ rescue Cocaine::CommandLineError => e
35
+ # TODO: log command failure
36
+ DEFAULT_CONTENT_TYPE
37
+ end.strip
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ module Ckeditor
4
+ module Utils
5
+ class JavascriptCode < String
6
+ def as_json(options = nil) self end #:nodoc:
7
+ def encode_json(encoder) self end #:nodoc:
8
+ end
9
+ end
10
+ end
@@ -1,4 +1,6 @@
1
1
  module Ckeditor
2
- VERSION="4.4.7.4".freeze
2
+ module Version
3
+ GEM = "4.5.7".freeze
4
+ EDITOR = "4.5.7".freeze
5
+ end
3
6
  end
4
-
@@ -13,7 +13,7 @@ module Ckeditor
13
13
  :desc => "Backend processor for upload support"
14
14
 
15
15
  class_option :backend, :type => :string, :default => 'paperclip',
16
- :desc => "paperclip (default), carrierwave, or dragonfly"
16
+ :desc => "paperclip (default), carrierwave, refile or dragonfly"
17
17
 
18
18
  def self.source_root
19
19
  @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
@@ -2,6 +2,6 @@ class Ckeditor::Asset < ActiveRecord::Base
2
2
  include Ckeditor::Orm::ActiveRecord::AssetBase
3
3
  include Ckeditor::Backend::Dragonfly
4
4
 
5
- ckeditor_file_accessor :data
5
+ dragonfly_accessor :data, app: :ckeditor
6
6
  validates_presence_of :data
7
7
  end
@@ -1,5 +1,5 @@
1
1
  class Ckeditor::AttachmentFile < Ckeditor::Asset
2
- validates_property :format, :of => :data, :in => attachment_file_types unless attachment_file_types.empty?
2
+ validates_property :ext, :of => :data, :in => attachment_file_types unless attachment_file_types.empty?
3
3
 
4
4
  def url_thumb
5
5
  Ckeditor::Utils.filethumb(filename)
@@ -2,12 +2,10 @@ class Ckeditor::AttachmentFile < Ckeditor::Asset
2
2
  has_attached_file :data,
3
3
  :url => "/ckeditor_assets/attachments/:id/:filename",
4
4
  :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
5
-
6
- if respond_to?(:do_not_validate_attachment_file_type)
7
- do_not_validate_attachment_file_type :data, if: :data?
8
- end
9
- validates_attachment_size :data, :less_than => 100.megabytes
5
+
10
6
  validates_attachment_presence :data
7
+ validates_attachment_size :data, :less_than => 100.megabytes
8
+ do_not_validate_attachment_file_type :data
11
9
 
12
10
  def url_thumb
13
11
  @url_thumb ||= Ckeditor::Utils.filethumb(filename)