glebtv-ckeditor 4.7.3 → 4.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +13 -12
  3. data/README.md +358 -2
  4. data/Rakefile +17 -17
  5. data/app/assets/javascripts/ckeditor/config.js.erb +3 -3
  6. data/app/controllers/ckeditor/application_controller.rb +3 -0
  7. data/app/controllers/ckeditor/attachment_files_controller.rb +2 -0
  8. data/app/controllers/ckeditor/pictures_controller.rb +2 -0
  9. data/app/helpers/ckeditor/application_helper.rb +2 -0
  10. data/config/locales/bg.ckeditor.yml +9 -0
  11. data/config/locales/cs.ckeditor.yml +9 -0
  12. data/config/locales/da.ckeditor.yml +9 -0
  13. data/config/locales/de.ckeditor.yml +9 -0
  14. data/config/locales/el-GR.cdkeditor.yml +9 -0
  15. data/config/locales/es.ckeditor.yml +9 -0
  16. data/config/locales/fr.ckeditor.yml +9 -0
  17. data/config/locales/hu.ckeditor.yml +9 -0
  18. data/config/locales/it.ckeditor.yml +9 -0
  19. data/config/locales/ja.ckeditor.yml +9 -0
  20. data/config/locales/nb.ckeditor.yml +9 -0
  21. data/config/locales/nl.ckeditor.yml +9 -0
  22. data/config/locales/pl.ckeditor.yml +9 -0
  23. data/config/locales/pt-BR.ckeditor.yml +9 -0
  24. data/config/locales/pt-PT.ckeditor.yml +9 -0
  25. data/config/locales/pt.ckeditor.yml +9 -0
  26. data/config/locales/sq.ckeditor.yml +9 -0
  27. data/config/locales/sv-SE.ckeditor.yml +9 -0
  28. data/config/locales/tr.ckeditor.yml +9 -0
  29. data/config/locales/uk.ckeditor.yml +9 -0
  30. data/config/locales/zh-CN.ckeditor.yml +9 -0
  31. data/config/locales/zh-TW.ckeditor.yml +9 -0
  32. data/config/routes.rb +2 -0
  33. data/lib/ckeditor.rb +13 -16
  34. data/lib/ckeditor/asset_response.rb +15 -4
  35. data/lib/ckeditor/backend/active_storage.rb +68 -0
  36. data/lib/ckeditor/backend/carrierwave.rb +2 -12
  37. data/lib/ckeditor/backend/dragonfly.rb +2 -0
  38. data/lib/ckeditor/backend/paperclip.rb +2 -15
  39. data/lib/ckeditor/backend/shrine.rb +29 -0
  40. data/lib/ckeditor/helpers/controllers.rb +2 -0
  41. data/lib/ckeditor/helpers/form_builder.rb +2 -0
  42. data/lib/ckeditor/helpers/form_helper.rb +2 -0
  43. data/lib/ckeditor/helpers/view_helper.rb +2 -0
  44. data/lib/ckeditor/hooks/cancan.rb +4 -1
  45. data/lib/ckeditor/hooks/formtastic.rb +2 -0
  46. data/lib/ckeditor/hooks/pundit.rb +2 -0
  47. data/lib/ckeditor/hooks/simple_form.rb +2 -0
  48. data/lib/ckeditor/http.rb +8 -5
  49. data/lib/ckeditor/orm/active_record.rb +2 -0
  50. data/lib/ckeditor/orm/base.rb +11 -2
  51. data/lib/ckeditor/orm/mongoid.rb +2 -0
  52. data/lib/ckeditor/paginatable.rb +2 -0
  53. data/lib/ckeditor/rails.rb +2 -0
  54. data/lib/ckeditor/rails_admin/field.rb +16 -3
  55. data/lib/ckeditor/text_area.rb +2 -0
  56. data/lib/ckeditor/utils.rb +3 -16
  57. data/lib/ckeditor/utils/javascript_code.rb +1 -1
  58. data/lib/ckeditor/version.rb +4 -2
  59. data/lib/generators/ckeditor/install_generator.rb +16 -19
  60. data/lib/generators/ckeditor/pundit_policy_generator.rb +2 -0
  61. data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/asset.rb +10 -0
  62. data/lib/generators/ckeditor/templates/active_record/{refile → active_storage}/ckeditor/attachment_file.rb +3 -1
  63. data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb +13 -0
  64. data/lib/generators/ckeditor/templates/active_record/{carrierwave/migration_versioned.rb → active_storage/migration.rb} +8 -5
  65. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -0
  66. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +2 -0
  67. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +2 -0
  68. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +7 -5
  69. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +2 -0
  70. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +2 -0
  71. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +2 -0
  72. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +7 -5
  73. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +2 -0
  74. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +2 -0
  75. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +2 -0
  76. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +8 -6
  77. data/lib/generators/ckeditor/templates/active_record/{refile → shrine}/ckeditor/asset.rb +3 -1
  78. data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/attachment_file.rb +21 -0
  79. data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/picture.rb +49 -0
  80. data/lib/generators/ckeditor/templates/active_record/shrine/migration.rb +22 -0
  81. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +2 -1
  82. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +2 -3
  83. data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +2 -0
  84. data/lib/generators/ckeditor/templates/base/shrine/initializer.rb +25 -0
  85. data/lib/generators/ckeditor/templates/ckeditor.rb +3 -6
  86. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +2 -0
  87. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +2 -0
  88. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +2 -0
  89. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +2 -0
  90. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +2 -0
  91. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +2 -0
  92. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/asset.rb +8 -0
  93. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb +21 -0
  94. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb +47 -0
  95. data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +2 -0
  96. data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +2 -0
  97. data/lib/tasks/ckeditor.rake +2 -0
  98. data/test/controllers/attachment_files_controller_test.rb +17 -15
  99. data/test/controllers/pictures_controller_test.rb +17 -15
  100. data/test/dummy/Rakefile +2 -0
  101. data/test/dummy/app/assets/javascripts/application.js +0 -2
  102. data/test/dummy/app/controllers/application_controller.rb +2 -0
  103. data/test/dummy/app/controllers/posts_controller.rb +2 -0
  104. data/test/dummy/app/helpers/application_helper.rb +2 -0
  105. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  106. data/test/dummy/app/models/post.rb +2 -0
  107. data/test/dummy/app/views/posts/index.html.erb +0 -3
  108. data/test/dummy/app/views/posts/show.html.erb +3 -0
  109. data/test/dummy/config.ru +2 -0
  110. data/test/dummy/config/application.rb +5 -1
  111. data/test/dummy/config/boot.rb +2 -0
  112. data/test/dummy/config/environment.rb +2 -0
  113. data/test/dummy/config/environments/development.rb +2 -0
  114. data/test/dummy/config/environments/production.rb +2 -0
  115. data/test/dummy/config/environments/test.rb +5 -3
  116. data/test/dummy/config/initializers/assets.rb +2 -0
  117. data/test/dummy/config/initializers/backtrace_silencers.rb +2 -0
  118. data/test/dummy/config/initializers/ckeditor.rb +2 -0
  119. data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
  120. data/test/dummy/config/initializers/inflections.rb +2 -0
  121. data/test/dummy/config/initializers/mime_types.rb +2 -0
  122. data/test/dummy/config/initializers/paperclip.rb +2 -0
  123. data/test/dummy/config/initializers/session_store.rb +2 -0
  124. data/test/dummy/config/initializers/wrap_parameters.rb +2 -0
  125. data/test/dummy/config/routes.rb +2 -0
  126. data/test/dummy/config/storage.yml +3 -0
  127. data/test/dummy/db/migrate/20110623120047_create_posts.rb +5 -3
  128. data/test/dummy/db/migrate/20170806125915_create_active_storage_tables.rb +26 -0
  129. data/test/dummy/script/rails +2 -0
  130. data/test/functional/posts_controller_test.rb +18 -16
  131. data/test/generators/install_generator_test.rb +58 -56
  132. data/test/integration/navigation_test.rb +2 -0
  133. data/test/models/attachment_file_test.rb +4 -4
  134. data/test/models/ckeditor_test.rb +3 -21
  135. data/test/models/picture_test.rb +12 -10
  136. data/test/models/utils_test.rb +2 -0
  137. data/test/orm/active_record.rb +11 -1
  138. data/test/orm/mongoid.rb +2 -0
  139. data/test/support/helpers.rb +2 -0
  140. data/test/support/integration_case.rb +2 -0
  141. data/test/test_helper.rb +15 -9
  142. data/vendor/assets/javascripts/ckeditor/CHANGES.md +1404 -859
  143. data/vendor/assets/javascripts/ckeditor/LICENSE.md +8 -7
  144. data/vendor/assets/javascripts/ckeditor/README.md +5 -5
  145. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +7 -7
  146. data/vendor/assets/javascripts/ckeditor/build-config.js +12 -6
  147. data/vendor/assets/javascripts/ckeditor/ckeditor.js +1090 -907
  148. data/vendor/assets/javascripts/ckeditor/config.js +2 -2
  149. data/vendor/assets/javascripts/ckeditor/contents.css +7 -7
  150. data/vendor/assets/javascripts/ckeditor/lang/en.js +3 -3
  151. data/vendor/assets/javascripts/ckeditor/lang/ru.js +3 -3
  152. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +7 -7
  153. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +2 -2
  154. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
  155. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +5 -5
  156. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
  157. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  158. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  159. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  160. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
  161. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
  162. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
  163. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/autocomplete.png +0 -0
  164. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/autoformat.png +0 -0
  165. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/commentselectedrange.png +0 -0
  166. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/searchcode.png +0 -0
  167. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/uncommentselectedrange.png +0 -0
  168. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -2
  169. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -2
  170. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  171. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -6
  172. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
  173. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -0
  174. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
  175. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  176. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -3
  177. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
  178. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +236 -218
  179. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +1 -1
  180. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +51 -0
  181. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +37 -0
  182. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +42 -0
  183. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +2 -2
  184. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -0
  185. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -0
  186. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/nord.css +42 -0
  187. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -0
  188. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +1 -1
  189. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -0
  190. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +0 -1
  191. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -0
  192. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +1 -1
  193. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yonce.css +59 -0
  194. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +2 -2
  195. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +12 -12
  196. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +2 -2
  197. data/vendor/assets/javascripts/ckeditor/plugins/dialog/styles/dialog.css +18 -0
  198. data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -8
  199. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +23 -23
  200. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +17 -17
  201. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +6 -6
  202. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +5 -5
  203. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +3 -3
  204. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +5 -5
  205. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +7 -7
  206. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +17 -16
  207. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +7 -6
  208. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +9 -9
  209. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  210. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  211. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +9 -8
  212. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +1271 -44
  213. data/vendor/assets/javascripts/ckeditor/plugins/image/icons/hidpi/image.png +0 -0
  214. data/vendor/assets/javascripts/ckeditor/plugins/image/icons/image.png +0 -0
  215. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/en.js +25 -0
  216. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/ru.js +25 -0
  217. data/vendor/assets/javascripts/ckeditor/plugins/image/plugin.js +184 -0
  218. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  219. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  220. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +35 -0
  221. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +339 -0
  222. data/vendor/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +553 -0
  223. data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  224. data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/image.png +0 -0
  225. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/en.js +21 -0
  226. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +21 -0
  227. data/vendor/assets/javascripts/ckeditor/plugins/image2/plugin.js +1783 -0
  228. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  229. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  230. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +69 -0
  231. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +1 -1
  232. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +5 -5
  233. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +27 -25
  234. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +8 -8
  235. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/fr.js +8 -0
  236. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +2 -2
  237. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +41 -51
  238. data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/common.js +22 -0
  239. data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/image.js +6 -0
  240. data/vendor/assets/javascripts/ckeditor/plugins/preview/images/pagebreak.gif +0 -0
  241. data/vendor/assets/javascripts/ckeditor/plugins/preview/styles/screen.css +10 -0
  242. data/vendor/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +1 -17
  243. data/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +63 -7
  244. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -33
  245. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +2 -2
  246. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +2 -2
  247. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +2 -2
  248. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +12 -12
  249. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +10 -10
  250. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +8 -7
  251. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +20 -19
  252. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +16 -15
  253. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +2 -2
  254. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +2 -2
  255. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +2 -2
  256. data/vendor/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
  257. data/vendor/assets/javascripts/ckeditor/{samples/toolbarconfigurator/lib/codemirror/LICENSE → plugins/wordcount/LICENSE.md} +21 -19
  258. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/README.md +106 -0
  259. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +1 -0
  260. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +2 -1
  261. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +475 -378
  262. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/maxParagraphs.html +26 -0
  263. data/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +62 -7
  264. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
  265. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +82 -82
  266. data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +15 -0
  267. data/vendor/assets/javascripts/ckeditor/plugins/youtube/README.md +156 -0
  268. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +8 -7
  269. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +1 -1
  270. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +1 -1
  271. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +1 -1
  272. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +1 -1
  273. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +1 -1
  274. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +1 -1
  275. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  276. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  277. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +3 -3
  278. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +3 -3
  279. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +3 -3
  280. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +3 -3
  281. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +3 -3
  282. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +3 -3
  283. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +3 -3
  284. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +3 -3
  285. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +3 -3
  286. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +3 -3
  287. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +2 -2
  288. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +3 -3
  289. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +3 -3
  290. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +3 -3
  291. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +3 -3
  292. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +3 -3
  293. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +3 -3
  294. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +3 -3
  295. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +3 -3
  296. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +3 -3
  297. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +3 -3
  298. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +3 -3
  299. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +5 -5
  300. data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +2 -2
  301. data/vendor/assets/javascripts/ckeditor/styles.js +4 -4
  302. data/vendor/assets/javascripts/ckeditor/vendor/promise.js +13 -0
  303. metadata +143 -138
  304. data/lib/ckeditor/backend/refile.rb +0 -39
  305. data/lib/ckeditor/utils/content_type_detector.rb +0 -38
  306. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration_versioned.rb +0 -23
  307. data/lib/generators/ckeditor/templates/active_record/paperclip/migration_versioned.rb +0 -23
  308. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +0 -11
  309. data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +0 -23
  310. data/lib/generators/ckeditor/templates/active_record/refile/migration_versioned.rb +0 -23
  311. data/test/support/raw_post.rb +0 -9
  312. data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -169
  313. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +0 -3
  314. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +0 -8
  315. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +0 -7
  316. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +0 -7
  317. data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +0 -929
  318. data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +0 -1632
  319. data/vendor/assets/javascripts/ckeditor/samples/img/github-top.png +0 -0
  320. data/vendor/assets/javascripts/ckeditor/samples/img/header-bg.png +0 -0
  321. data/vendor/assets/javascripts/ckeditor/samples/img/header-separator.png +0 -0
  322. data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
  323. data/vendor/assets/javascripts/ckeditor/samples/img/navigation-tip.png +0 -0
  324. data/vendor/assets/javascripts/ckeditor/samples/index.html +0 -128
  325. data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +0 -53
  326. data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +0 -17
  327. data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +0 -85
  328. data/vendor/assets/javascripts/ckeditor/samples/old/api.html +0 -210
  329. data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +0 -59
  330. data/vendor/assets/javascripts/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
  331. data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +0 -204
  332. data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +0 -59
  333. data/vendor/assets/javascripts/ckeditor/samples/old/assets/sample.jpg +0 -0
  334. data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +0 -7
  335. data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +0 -508
  336. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +0 -48
  337. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +0 -190
  338. data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +0 -144
  339. data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +0 -106
  340. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
  341. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
  342. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/swfobject.js +0 -19
  343. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +0 -283
  344. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +0 -224
  345. data/vendor/assets/javascripts/ckeditor/samples/old/index.html +0 -131
  346. data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +0 -314
  347. data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +0 -124
  348. data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +0 -113
  349. data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +0 -103
  350. data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +0 -209
  351. data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +0 -76
  352. data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +0 -60
  353. data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +0 -59
  354. data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +0 -357
  355. data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +0 -50
  356. data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +0 -16
  357. data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +0 -78
  358. data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +0 -235
  359. data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +0 -72
  360. data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +0 -122
  361. data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +0 -80
  362. data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +0 -234
  363. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/css/fontello.css +0 -55
  364. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +0 -10
  365. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/config.json +0 -28
  366. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
  367. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.svg +0 -14
  368. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
  369. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
  370. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +0 -446
  371. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +0 -13
  372. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +0 -9
  373. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +0 -33
  374. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +0 -14
  375. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +0 -325
  376. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +0 -288
  377. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +0 -25
  378. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +0 -36
  379. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css +0 -38
  380. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +0 -16
@@ -0,0 +1,553 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview Image plugin based on Widgets API
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ CKEDITOR.dialog.add( 'image2', function( editor ) {
13
+
14
+ // RegExp: 123, 123px, empty string ""
15
+ var regexGetSizeOrEmpty = /(^\s*(\d+)(px)?\s*$)|^$/i,
16
+
17
+ lockButtonId = CKEDITOR.tools.getNextId(),
18
+ resetButtonId = CKEDITOR.tools.getNextId(),
19
+
20
+ lang = editor.lang.image2,
21
+ commonLang = editor.lang.common,
22
+
23
+ lockResetStyle = 'margin-top:18px;width:40px;height:20px;',
24
+ lockResetHtml = new CKEDITOR.template(
25
+ '<div>' +
26
+ '<a href="javascript:void(0)" tabindex="-1" title="' + lang.lockRatio + '" class="cke_btn_locked" id="{lockButtonId}" role="checkbox">' +
27
+ '<span class="cke_icon"></span>' +
28
+ '<span class="cke_label">' + lang.lockRatio + '</span>' +
29
+ '</a>' +
30
+
31
+ '<a href="javascript:void(0)" tabindex="-1" title="' + lang.resetSize + '" class="cke_btn_reset" id="{resetButtonId}" role="button">' +
32
+ '<span class="cke_label">' + lang.resetSize + '</span>' +
33
+ '</a>' +
34
+ '</div>' ).output( {
35
+ lockButtonId: lockButtonId,
36
+ resetButtonId: resetButtonId
37
+ } ),
38
+
39
+ helpers = CKEDITOR.plugins.image2,
40
+
41
+ // Editor instance configuration.
42
+ config = editor.config,
43
+
44
+ hasFileBrowser = !!( config.filebrowserImageBrowseUrl || config.filebrowserBrowseUrl ),
45
+
46
+ // Content restrictions defined by the widget which
47
+ // impact on dialog structure and presence of fields.
48
+ features = editor.widgets.registered.image.features,
49
+
50
+ // Functions inherited from image2 plugin.
51
+ getNatural = helpers.getNatural,
52
+
53
+ // Global variables referring to the dialog's context.
54
+ doc, widget, image,
55
+
56
+ // Global variable referring to this dialog's image pre-loader.
57
+ preLoader,
58
+
59
+ // Global variables holding the original size of the image.
60
+ domWidth, domHeight,
61
+
62
+ // Global variables related to image pre-loading.
63
+ preLoadedWidth, preLoadedHeight, srcChanged,
64
+
65
+ // Global variables related to size locking.
66
+ lockRatio, userDefinedLock,
67
+
68
+ // Global variables referring to dialog fields and elements.
69
+ lockButton, resetButton, widthField, heightField,
70
+
71
+ natural;
72
+
73
+ // Validates dimension. Allowed values are:
74
+ // "123px", "123", "" (empty string)
75
+ function validateDimension() {
76
+ var match = this.getValue().match( regexGetSizeOrEmpty ),
77
+ isValid = !!( match && parseInt( match[ 1 ], 10 ) !== 0 );
78
+
79
+ if ( !isValid )
80
+ alert( commonLang[ 'invalidLength' ].replace( '%1', commonLang[ this.id ] ).replace( '%2', 'px' ) ); // jshint ignore:line
81
+
82
+ return isValid;
83
+ }
84
+
85
+ // Creates a function that pre-loads images. The callback function passes
86
+ // [image, width, height] or null if loading failed.
87
+ //
88
+ // @returns {Function}
89
+ function createPreLoader() {
90
+ var image = doc.createElement( 'img' ),
91
+ listeners = [];
92
+
93
+ function addListener( event, callback ) {
94
+ listeners.push( image.once( event, function( evt ) {
95
+ removeListeners();
96
+ callback( evt );
97
+ } ) );
98
+ }
99
+
100
+ function removeListeners() {
101
+ var l;
102
+
103
+ while ( ( l = listeners.pop() ) )
104
+ l.removeListener();
105
+ }
106
+
107
+ // @param {String} src.
108
+ // @param {Function} callback.
109
+ return function( src, callback, scope ) {
110
+ addListener( 'load', function() {
111
+ // Don't use image.$.(width|height) since it's buggy in IE9-10 (https://dev.ckeditor.com/ticket/11159)
112
+ var dimensions = getNatural( image );
113
+
114
+ callback.call( scope, image, dimensions.width, dimensions.height );
115
+ } );
116
+
117
+ addListener( 'error', function() {
118
+ callback( null );
119
+ } );
120
+
121
+ addListener( 'abort', function() {
122
+ callback( null );
123
+ } );
124
+
125
+ image.setAttribute( 'src',
126
+ ( config.baseHref || '' ) + src + '?' + Math.random().toString( 16 ).substring( 2 ) );
127
+ };
128
+ }
129
+
130
+ // This function updates width and height fields once the
131
+ // "src" field is altered. Along with dimensions, also the
132
+ // dimensions lock is adjusted.
133
+ function onChangeSrc() {
134
+ var value = this.getValue();
135
+
136
+ toggleDimensions( false );
137
+
138
+ // Remember that src is different than default.
139
+ if ( value !== widget.data.src ) {
140
+ // Update dimensions of the image once it's preloaded.
141
+ preLoader( value, function( image, width, height ) {
142
+ // Re-enable width and height fields.
143
+ toggleDimensions( true );
144
+
145
+ // There was problem loading the image. Unlock ratio.
146
+ if ( !image )
147
+ return toggleLockRatio( false );
148
+
149
+ // Fill width field with the width of the new image.
150
+ widthField.setValue( editor.config.image2_prefillDimensions === false ? 0 : width );
151
+
152
+ // Fill height field with the height of the new image.
153
+ heightField.setValue( editor.config.image2_prefillDimensions === false ? 0 : height );
154
+
155
+ // Cache the new width and update initial cache (#1348).
156
+ preLoadedWidth = domWidth = width;
157
+
158
+ // Cache the new height and update initial cache (#1348).
159
+ preLoadedHeight = domHeight = height;
160
+
161
+ // Check for new lock value if image exist.
162
+ toggleLockRatio( helpers.checkHasNaturalRatio( image ) );
163
+ } );
164
+
165
+ srcChanged = true;
166
+ }
167
+
168
+ // Value is the same as in widget data but is was
169
+ // modified back in time. Roll back dimensions when restoring
170
+ // default src.
171
+ else if ( srcChanged ) {
172
+ // Re-enable width and height fields.
173
+ toggleDimensions( true );
174
+
175
+ // Restore width field with cached width.
176
+ widthField.setValue( domWidth );
177
+
178
+ // Restore height field with cached height.
179
+ heightField.setValue( domHeight );
180
+
181
+ // Src equals default one back again.
182
+ srcChanged = false;
183
+ }
184
+
185
+ // Value is the same as in widget data and it hadn't
186
+ // been modified.
187
+ else {
188
+ // Re-enable width and height fields.
189
+ toggleDimensions( true );
190
+ }
191
+ }
192
+
193
+ function onChangeDimension() {
194
+ // If ratio is un-locked, then we don't care what's next.
195
+ if ( !lockRatio )
196
+ return;
197
+
198
+ var value = this.getValue();
199
+
200
+ // No reason to auto-scale or unlock if the field is empty.
201
+ if ( !value )
202
+ return;
203
+
204
+ // If the value of the field is invalid (e.g. with %), unlock ratio.
205
+ if ( !value.match( regexGetSizeOrEmpty ) )
206
+ toggleLockRatio( false );
207
+
208
+ // No automatic re-scale when dimension is '0'.
209
+ if ( value === '0' )
210
+ return;
211
+
212
+ var isWidth = this.id == 'width',
213
+ // If dialog opened for the new image, domWidth and domHeight
214
+ // will be empty. Use dimensions from pre-loader in such case instead.
215
+ width = domWidth || preLoadedWidth,
216
+ height = domHeight || preLoadedHeight;
217
+
218
+ // If changing width, then auto-scale height.
219
+ if ( isWidth )
220
+ value = Math.round( height * ( value / width ) );
221
+
222
+ // If changing height, then auto-scale width.
223
+ else
224
+ value = Math.round( width * ( value / height ) );
225
+
226
+ // If the value is a number, apply it to the other field.
227
+ if ( !isNaN( value ) )
228
+ ( isWidth ? heightField : widthField ).setValue( value );
229
+ }
230
+
231
+ // Set-up function for lock and reset buttons:
232
+ // * Adds lock and reset buttons to focusables. Check if button exist first
233
+ // because it may be disabled e.g. due to ACF restrictions.
234
+ // * Register mouseover and mouseout event listeners for UI manipulations.
235
+ // * Register click event listeners for buttons.
236
+ function onLoadLockReset() {
237
+ var dialog = this.getDialog();
238
+
239
+ function setupMouseClasses( el ) {
240
+ el.on( 'mouseover', function() {
241
+ this.addClass( 'cke_btn_over' );
242
+ }, el );
243
+
244
+ el.on( 'mouseout', function() {
245
+ this.removeClass( 'cke_btn_over' );
246
+ }, el );
247
+ }
248
+
249
+ // Create references to lock and reset buttons for this dialog instance.
250
+ lockButton = doc.getById( lockButtonId );
251
+ resetButton = doc.getById( resetButtonId );
252
+
253
+ // Activate (Un)LockRatio button
254
+ if ( lockButton ) {
255
+ // Consider that there's an additional focusable field
256
+ // in the dialog when the "browse" button is visible.
257
+ dialog.addFocusable( lockButton, 4 + hasFileBrowser );
258
+
259
+ lockButton.on( 'click', function( evt ) {
260
+ toggleLockRatio();
261
+ evt.data && evt.data.preventDefault();
262
+ }, this.getDialog() );
263
+
264
+ setupMouseClasses( lockButton );
265
+ }
266
+
267
+ // Activate the reset size button.
268
+ if ( resetButton ) {
269
+ // Consider that there's an additional focusable field
270
+ // in the dialog when the "browse" button is visible.
271
+ dialog.addFocusable( resetButton, 5 + hasFileBrowser );
272
+
273
+ // Fills width and height fields with the original dimensions of the
274
+ // image (stored in widget#data since widget#init).
275
+ resetButton.on( 'click', function( evt ) {
276
+ // If there's a new image loaded, reset button should revert
277
+ // cached dimensions of pre-loaded DOM element.
278
+ if ( srcChanged ) {
279
+ widthField.setValue( preLoadedWidth );
280
+ heightField.setValue( preLoadedHeight );
281
+ }
282
+
283
+ // If the old image remains, reset button should revert
284
+ // dimensions as loaded when the dialog was first shown.
285
+ else {
286
+ widthField.setValue( domWidth );
287
+ heightField.setValue( domHeight );
288
+ }
289
+
290
+ evt.data && evt.data.preventDefault();
291
+ }, this );
292
+
293
+ setupMouseClasses( resetButton );
294
+ }
295
+ }
296
+
297
+ function toggleLockRatio( enable ) {
298
+ // No locking if there's no radio (i.e. due to ACF).
299
+ if ( !lockButton )
300
+ return;
301
+
302
+ if ( typeof enable == 'boolean' ) {
303
+ // If user explicitly wants to decide whether
304
+ // to lock or not, don't do anything.
305
+ if ( userDefinedLock )
306
+ return;
307
+
308
+ lockRatio = enable;
309
+ }
310
+
311
+ // Undefined. User changed lock value.
312
+ else {
313
+ var width = widthField.getValue(),
314
+ height;
315
+
316
+ userDefinedLock = true;
317
+ lockRatio = !lockRatio;
318
+
319
+ // Automatically adjust height to width to match
320
+ // the original ratio (based on dom- dimensions).
321
+ if ( lockRatio && width ) {
322
+ height = domHeight / domWidth * width;
323
+
324
+ if ( !isNaN( height ) )
325
+ heightField.setValue( Math.round( height ) );
326
+ }
327
+ }
328
+
329
+ lockButton[ lockRatio ? 'removeClass' : 'addClass' ]( 'cke_btn_unlocked' );
330
+ lockButton.setAttribute( 'aria-checked', lockRatio );
331
+
332
+ // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE
333
+ if ( CKEDITOR.env.hc ) {
334
+ var icon = lockButton.getChild( 0 );
335
+ icon.setHtml( lockRatio ? CKEDITOR.env.ie ? '\u25A0' : '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' );
336
+ }
337
+ }
338
+
339
+ function toggleDimensions( enable ) {
340
+ var method = enable ? 'enable' : 'disable';
341
+
342
+ widthField[ method ]();
343
+ heightField[ method ]();
344
+ }
345
+
346
+ var srcBoxChildren = [
347
+ {
348
+ id: 'src',
349
+ type: 'text',
350
+ label: commonLang.url,
351
+ onKeyup: onChangeSrc,
352
+ onChange: onChangeSrc,
353
+ setup: function( widget ) {
354
+ this.setValue( widget.data.src );
355
+ },
356
+ commit: function( widget ) {
357
+ widget.setData( 'src', this.getValue() );
358
+ },
359
+ validate: CKEDITOR.dialog.validate.notEmpty( lang.urlMissing )
360
+ }
361
+ ];
362
+
363
+ // Render the "Browse" button on demand to avoid an "empty" (hidden child)
364
+ // space in dialog layout that distorts the UI.
365
+ if ( hasFileBrowser ) {
366
+ srcBoxChildren.push( {
367
+ type: 'button',
368
+ id: 'browse',
369
+ // v-align with the 'txtUrl' field.
370
+ // TODO: We need something better than a fixed size here.
371
+ style: 'display:inline-block;margin-top:14px;',
372
+ align: 'center',
373
+ label: editor.lang.common.browseServer,
374
+ hidden: true,
375
+ filebrowser: 'info:src'
376
+ } );
377
+ }
378
+
379
+ return {
380
+ title: lang.title,
381
+ minWidth: 250,
382
+ minHeight: 100,
383
+ onLoad: function() {
384
+ // Create a "global" reference to the document for this dialog instance.
385
+ doc = this._.element.getDocument();
386
+
387
+ // Create a pre-loader used for determining dimensions of new images.
388
+ preLoader = createPreLoader();
389
+ },
390
+ onShow: function() {
391
+ // Create a "global" reference to edited widget.
392
+ widget = this.getModel();
393
+
394
+ // Create a "global" reference to widget's image.
395
+ image = widget.parts.image;
396
+
397
+ // Reset global variables.
398
+ srcChanged = userDefinedLock = lockRatio = false;
399
+
400
+ // Natural dimensions of the image.
401
+ natural = getNatural( image );
402
+
403
+ // Get the natural width of the image.
404
+ preLoadedWidth = domWidth = natural.width;
405
+
406
+ // Get the natural height of the image.
407
+ preLoadedHeight = domHeight = natural.height;
408
+ },
409
+ contents: [
410
+ {
411
+ id: 'info',
412
+ label: lang.infoTab,
413
+ elements: [
414
+ {
415
+ type: 'vbox',
416
+ padding: 0,
417
+ children: [
418
+ {
419
+ type: 'hbox',
420
+ widths: [ '100%' ],
421
+ className: 'cke_dialog_image_url',
422
+ children: srcBoxChildren
423
+ }
424
+ ]
425
+ },
426
+ {
427
+ id: 'alt',
428
+ type: 'text',
429
+ label: lang.alt,
430
+ setup: function( widget ) {
431
+ this.setValue( widget.data.alt );
432
+ },
433
+ commit: function( widget ) {
434
+ widget.setData( 'alt', this.getValue() );
435
+ },
436
+ validate: editor.config.image2_altRequired === true ? CKEDITOR.dialog.validate.notEmpty( lang.altMissing ) : null
437
+ },
438
+ {
439
+ type: 'hbox',
440
+ widths: [ '25%', '25%', '50%' ],
441
+ requiredContent: features.dimension.requiredContent,
442
+ children: [
443
+ {
444
+ type: 'text',
445
+ width: '45px',
446
+ id: 'width',
447
+ label: commonLang.width,
448
+ validate: validateDimension,
449
+ onKeyUp: onChangeDimension,
450
+ onLoad: function() {
451
+ widthField = this;
452
+ },
453
+ setup: function( widget ) {
454
+ this.setValue( widget.data.width );
455
+ },
456
+ commit: function( widget ) {
457
+ widget.setData( 'width', this.getValue() );
458
+ }
459
+ },
460
+ {
461
+ type: 'text',
462
+ id: 'height',
463
+ width: '45px',
464
+ label: commonLang.height,
465
+ validate: validateDimension,
466
+ onKeyUp: onChangeDimension,
467
+ onLoad: function() {
468
+ heightField = this;
469
+ },
470
+ setup: function( widget ) {
471
+ this.setValue( widget.data.height );
472
+ },
473
+ commit: function( widget ) {
474
+ widget.setData( 'height', this.getValue() );
475
+ }
476
+ },
477
+ {
478
+ id: 'lock',
479
+ type: 'html',
480
+ style: lockResetStyle,
481
+ onLoad: onLoadLockReset,
482
+ setup: function( widget ) {
483
+ toggleLockRatio( widget.data.lock );
484
+ },
485
+ commit: function( widget ) {
486
+ widget.setData( 'lock', lockRatio );
487
+ },
488
+ html: lockResetHtml
489
+ }
490
+ ]
491
+ },
492
+ {
493
+ type: 'hbox',
494
+ id: 'alignment',
495
+ requiredContent: features.align.requiredContent,
496
+ children: [
497
+ {
498
+ id: 'align',
499
+ type: 'radio',
500
+ items: [
501
+ [ commonLang.alignNone, 'none' ],
502
+ [ commonLang.left, 'left' ],
503
+ [ commonLang.center, 'center' ],
504
+ [ commonLang.right, 'right' ]
505
+ ],
506
+ label: commonLang.align,
507
+ setup: function( widget ) {
508
+ this.setValue( widget.data.align );
509
+ },
510
+ commit: function( widget ) {
511
+ widget.setData( 'align', this.getValue() );
512
+ }
513
+ }
514
+ ]
515
+ },
516
+ {
517
+ id: 'hasCaption',
518
+ type: 'checkbox',
519
+ label: lang.captioned,
520
+ requiredContent: features.caption.requiredContent,
521
+ setup: function( widget ) {
522
+ this.setValue( widget.data.hasCaption );
523
+ },
524
+ commit: function( widget ) {
525
+ widget.setData( 'hasCaption', this.getValue() );
526
+ }
527
+ }
528
+ ]
529
+ },
530
+ {
531
+ id: 'Upload',
532
+ hidden: true,
533
+ filebrowser: 'uploadButton',
534
+ label: lang.uploadTab,
535
+ elements: [
536
+ {
537
+ type: 'file',
538
+ id: 'upload',
539
+ label: lang.btnUpload,
540
+ style: 'height:40px'
541
+ },
542
+ {
543
+ type: 'fileButton',
544
+ id: 'uploadButton',
545
+ filebrowser: 'info:src',
546
+ label: lang.btnUpload,
547
+ 'for': [ 'Upload', 'upload' ]
548
+ }
549
+ ]
550
+ }
551
+ ]
552
+ };
553
+ } );