glebtv-ckeditor 4.6.0 → 4.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (456) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -22
  3. data/MIT-LICENSE +0 -0
  4. data/README.md +2 -325
  5. data/Rakefile +1 -2
  6. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_add.jpg +0 -0
  7. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_add.png +0 -0
  8. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_del.png +0 -0
  9. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_more.gif +0 -0
  10. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/preloader.gif +0 -0
  11. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/avi.gif +0 -0
  12. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/ckfnothumb.gif +0 -0
  13. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/doc.gif +0 -0
  14. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/docx.gif +0 -0
  15. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/exe.gif +0 -0
  16. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/gz.gif +0 -0
  17. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/htm.gif +0 -0
  18. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/jpg.gif +0 -0
  19. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/mp3.gif +0 -0
  20. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/mpg.gif +0 -0
  21. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/pdf.gif +0 -0
  22. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/psd.gif +0 -0
  23. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/rar.gif +0 -0
  24. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/swf.gif +0 -0
  25. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/tar.gif +0 -0
  26. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/txt.gif +0 -0
  27. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/unknown.gif +0 -0
  28. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/wmv.gif +0 -0
  29. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/xls.gif +0 -0
  30. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/xlsx.gif +0 -0
  31. data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/zip.gif +0 -0
  32. data/app/assets/javascripts/ckeditor/application.js +0 -0
  33. data/app/assets/javascripts/ckeditor/config.js.erb +1 -2
  34. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/{application.js.erb → application.js} +4 -6
  35. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -0
  36. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.endless-scroll.js +0 -0
  37. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.min.js +0 -0
  38. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -0
  39. data/app/assets/javascripts/ckeditor/init.js.erb +0 -0
  40. data/app/assets/stylesheets/ckeditor/application.css +1 -1
  41. data/app/assets/stylesheets/ckeditor/filebrowser/uploader.scss +172 -0
  42. data/app/controllers/ckeditor/application_controller.rb +9 -10
  43. data/app/controllers/ckeditor/attachment_files_controller.rb +11 -12
  44. data/app/controllers/ckeditor/pictures_controller.rb +10 -12
  45. data/app/helpers/ckeditor/application_helper.rb +1 -10
  46. data/app/views/ckeditor/attachment_files/index.html.erb +5 -5
  47. data/app/views/ckeditor/pictures/index.html.erb +5 -5
  48. data/app/views/ckeditor/shared/_asset.html.erb +18 -21
  49. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +17 -20
  50. data/app/views/layouts/ckeditor/application.html.erb +3 -3
  51. data/config/locales/en.ckeditor.yml +0 -0
  52. data/config/locales/ru.ckeditor.yml +0 -0
  53. data/config/routes.rb +2 -2
  54. data/lib/ckeditor.rb +42 -34
  55. data/lib/ckeditor/asset_response.rb +74 -25
  56. data/lib/ckeditor/backend/carrierwave.rb +8 -5
  57. data/lib/ckeditor/backend/dragonfly.rb +5 -3
  58. data/lib/ckeditor/backend/paperclip.rb +15 -22
  59. data/lib/ckeditor/backend/refile.rb +6 -4
  60. data/lib/ckeditor/helpers/controllers.rb +15 -20
  61. data/lib/ckeditor/helpers/form_builder.rb +1 -1
  62. data/lib/ckeditor/helpers/form_helper.rb +0 -0
  63. data/lib/ckeditor/helpers/view_helper.rb +0 -0
  64. data/lib/ckeditor/hooks/cancan.rb +0 -2
  65. data/lib/ckeditor/hooks/formtastic.rb +2 -2
  66. data/lib/ckeditor/hooks/pundit.rb +1 -4
  67. data/lib/ckeditor/hooks/simple_form.rb +9 -14
  68. data/lib/ckeditor/http.rb +9 -11
  69. data/lib/ckeditor/orm/active_record.rb +1 -3
  70. data/lib/ckeditor/orm/base.rb +5 -5
  71. data/lib/ckeditor/orm/mongoid.rb +4 -6
  72. data/lib/ckeditor/paginatable.rb +3 -1
  73. data/lib/ckeditor/rails.rb +39 -0
  74. data/lib/ckeditor/text_area.rb +16 -15
  75. data/lib/ckeditor/utils.rb +45 -39
  76. data/lib/ckeditor/utils/content_type_detector.rb +7 -10
  77. data/lib/ckeditor/utils/javascript_code.rb +8 -3
  78. data/lib/ckeditor/version.rb +2 -2
  79. data/lib/generators/ckeditor/install_generator.rb +52 -30
  80. data/lib/generators/ckeditor/pundit_policy_generator.rb +1 -3
  81. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -2
  82. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +1 -1
  83. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +1 -1
  84. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +6 -10
  85. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration_versioned.rb +22 -0
  86. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +1 -1
  87. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +1 -1
  88. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +4 -4
  89. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +6 -10
  90. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration_versioned.rb +23 -0
  91. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +0 -0
  92. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +3 -3
  93. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +5 -5
  94. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +2 -5
  95. data/lib/generators/ckeditor/templates/active_record/paperclip/migration_versioned.rb +23 -0
  96. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/asset.rb +0 -0
  97. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/attachment_file.rb +0 -0
  98. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +0 -0
  99. data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +7 -12
  100. data/lib/generators/ckeditor/templates/active_record/refile/migration_versioned.rb +23 -0
  101. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +0 -0
  102. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +4 -4
  103. data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +4 -5
  104. data/lib/generators/ckeditor/templates/ckeditor.rb +16 -7
  105. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +2 -2
  106. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +1 -1
  107. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +1 -1
  108. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +0 -0
  109. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +5 -5
  110. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +5 -5
  111. data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +2 -2
  112. data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +2 -2
  113. data/lib/glebtv-ckeditor.rb +0 -0
  114. data/lib/tasks/ckeditor.rake +6 -14
  115. data/test/controllers/attachment_files_controller_test.rb +0 -0
  116. data/test/controllers/pictures_controller_test.rb +0 -0
  117. data/test/dummy/Rakefile +0 -0
  118. data/test/dummy/app/assets/javascripts/application.js +0 -0
  119. data/test/dummy/app/assets/stylesheets/application.css +0 -0
  120. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -0
  121. data/test/dummy/app/controllers/application_controller.rb +0 -0
  122. data/test/dummy/app/controllers/posts_controller.rb +0 -0
  123. data/test/dummy/app/helpers/application_helper.rb +0 -0
  124. data/test/dummy/app/helpers/posts_helper.rb +0 -0
  125. data/test/dummy/app/models/post.rb +0 -0
  126. data/test/dummy/app/views/layouts/application.html.erb +0 -0
  127. data/test/dummy/app/views/posts/_form.html.erb +0 -0
  128. data/test/dummy/app/views/posts/edit.html.erb +0 -0
  129. data/test/dummy/app/views/posts/index.html.erb +0 -0
  130. data/test/dummy/app/views/posts/new.html.erb +0 -0
  131. data/test/dummy/app/views/posts/show.html.erb +0 -0
  132. data/test/dummy/config.ru +0 -0
  133. data/test/dummy/config/application.rb +0 -0
  134. data/test/dummy/config/boot.rb +0 -0
  135. data/test/dummy/config/database.yml +0 -0
  136. data/test/dummy/config/environment.rb +0 -0
  137. data/test/dummy/config/environments/development.rb +0 -0
  138. data/test/dummy/config/environments/production.rb +0 -0
  139. data/test/dummy/config/environments/test.rb +0 -0
  140. data/test/dummy/config/initializers/assets.rb +1 -0
  141. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -0
  142. data/test/dummy/config/initializers/ckeditor.rb +0 -0
  143. data/test/dummy/config/initializers/cookies_serializer.rb +0 -0
  144. data/test/dummy/config/initializers/inflections.rb +0 -0
  145. data/test/dummy/config/initializers/mime_types.rb +0 -0
  146. data/test/dummy/config/initializers/paperclip.rb +3 -0
  147. data/test/dummy/config/initializers/session_store.rb +0 -0
  148. data/test/dummy/config/initializers/wrap_parameters.rb +0 -0
  149. data/test/dummy/config/locales/en.yml +0 -0
  150. data/test/dummy/config/mongoid.yml +0 -0
  151. data/test/dummy/config/routes.rb +0 -0
  152. data/test/dummy/config/secrets.yml +0 -0
  153. data/test/dummy/db/migrate/20110623120047_create_posts.rb +0 -0
  154. data/test/dummy/public/404.html +0 -0
  155. data/test/dummy/public/422.html +0 -0
  156. data/test/dummy/public/500.html +0 -0
  157. data/test/dummy/public/favicon.ico +0 -0
  158. data/test/dummy/script/rails +0 -0
  159. data/test/dummy/test/fixtures/files/rails.png +0 -0
  160. data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
  161. data/test/functional/posts_controller_test.rb +2 -3
  162. data/test/generators/install_generator_test.rb +2 -2
  163. data/test/integration/navigation_test.rb +0 -0
  164. data/test/models/attachment_file_test.rb +3 -8
  165. data/test/models/ckeditor_test.rb +1 -1
  166. data/test/models/picture_test.rb +0 -0
  167. data/test/models/utils_test.rb +6 -6
  168. data/test/orm/active_record.rb +0 -0
  169. data/test/orm/mongoid.rb +0 -0
  170. data/test/support/helpers.rb +0 -0
  171. data/test/support/integration_case.rb +0 -0
  172. data/test/support/raw_post.rb +0 -0
  173. data/test/support/routes.txt +0 -0
  174. data/test/test_helper.rb +1 -1
  175. data/vendor/assets/javascripts/ckeditor/CHANGES.md +1358 -0
  176. data/vendor/assets/javascripts/ckeditor/README.md +39 -0
  177. data/vendor/assets/javascripts/ckeditor/build-config.js +31 -30
  178. data/vendor/assets/javascripts/ckeditor/ckeditor.js +709 -675
  179. data/vendor/assets/javascripts/ckeditor/config.js +10 -0
  180. data/vendor/assets/javascripts/ckeditor/contents.css +208 -0
  181. data/vendor/assets/javascripts/ckeditor/lang/en.js +4 -4
  182. data/vendor/assets/javascripts/ckeditor/lang/ru.js +4 -4
  183. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +5 -5
  184. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +3 -2
  185. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
  186. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  187. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -1
  188. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -1
  189. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  190. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +6 -1
  191. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
  192. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -1
  193. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  194. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -1
  195. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -0
  196. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +230 -74
  197. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +1 -1
  198. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +1 -1
  199. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +1 -1
  200. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +1 -1
  201. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +2 -3
  202. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +1 -1
  203. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +1 -1
  204. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +1 -1
  205. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +1 -1
  206. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +1 -1
  207. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +1 -1
  208. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +3 -3
  209. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +3 -3
  210. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +1 -1
  211. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +0 -2
  212. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +1 -1
  213. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +1 -1
  214. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +1 -1
  215. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +1 -1
  216. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +1 -1
  217. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +1 -1
  218. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +1 -1
  219. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +1 -1
  220. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +1 -1
  221. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +1 -1
  222. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +1 -1
  223. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +1 -1
  224. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +1 -1
  225. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +1 -1
  226. data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +2 -2
  227. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +2 -2
  228. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +2 -2
  229. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  230. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  231. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +1 -1
  232. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +4 -3
  233. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +23 -23
  234. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/hidpi/loremipsum.png +0 -0
  235. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/loremipsum.png +0 -0
  236. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/en.js +0 -0
  237. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +2 -2
  238. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +2 -2
  239. data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +13 -7
  240. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +49 -39
  241. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/dialog.css +23 -0
  242. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +33 -19
  243. data/vendor/assets/javascripts/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +6 -1
  244. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +1 -1
  245. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +4 -1
  246. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +92 -23
  247. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +81 -82
  248. data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon-hdpi.png +0 -0
  249. data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
  250. data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +2 -1
  251. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +448 -448
  252. data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +1632 -0
  253. data/vendor/assets/javascripts/ckeditor/samples/img/github-top.png +0 -0
  254. data/vendor/assets/javascripts/ckeditor/samples/img/header-bg.png +0 -0
  255. data/vendor/assets/javascripts/ckeditor/samples/img/header-separator.png +0 -0
  256. data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
  257. data/vendor/assets/javascripts/ckeditor/samples/img/navigation-tip.png +0 -0
  258. data/vendor/assets/javascripts/ckeditor/samples/index.html +128 -0
  259. data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +53 -0
  260. data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +17 -0
  261. data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +85 -0
  262. data/vendor/assets/javascripts/ckeditor/samples/old/api.html +210 -0
  263. data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +59 -0
  264. data/vendor/assets/javascripts/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
  265. data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +204 -0
  266. data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +59 -0
  267. data/vendor/assets/javascripts/ckeditor/samples/old/assets/sample.jpg +0 -0
  268. data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +7 -0
  269. data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +508 -0
  270. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +48 -0
  271. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +190 -0
  272. data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +144 -0
  273. data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +106 -0
  274. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
  275. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
  276. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/swfobject.js +19 -0
  277. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +283 -0
  278. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +224 -0
  279. data/vendor/assets/javascripts/ckeditor/samples/old/index.html +131 -0
  280. data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +314 -0
  281. data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +124 -0
  282. data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +113 -0
  283. data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +103 -0
  284. data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +209 -0
  285. data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +76 -0
  286. data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +60 -0
  287. data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +59 -0
  288. data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +357 -0
  289. data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +50 -0
  290. data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +16 -0
  291. data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +78 -0
  292. data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +235 -0
  293. data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +72 -0
  294. data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +122 -0
  295. data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +80 -0
  296. data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +234 -0
  297. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/css/fontello.css +55 -0
  298. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +10 -0
  299. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/config.json +28 -0
  300. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
  301. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.svg +14 -0
  302. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
  303. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
  304. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +446 -0
  305. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +13 -0
  306. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +9 -0
  307. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +33 -0
  308. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +14 -0
  309. data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/LICENSE.md → samples/toolbarconfigurator/lib/codemirror/LICENSE} +19 -21
  310. data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/css → samples/toolbarconfigurator/lib/codemirror}/codemirror.css +325 -341
  311. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +288 -0
  312. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +25 -0
  313. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +36 -0
  314. data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/js/addon/hint → samples/toolbarconfigurator/lib/codemirror}/show-hint.css +38 -36
  315. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +16 -0
  316. data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog.css +5 -0
  317. data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie.css +5 -0
  318. data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie7.css +5 -0
  319. data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie8.css +5 -0
  320. data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_iequirks.css +5 -0
  321. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +5 -0
  322. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +5 -0
  323. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +5 -0
  324. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +5 -0
  325. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +5 -0
  326. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +5 -0
  327. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  328. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  329. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/arrow.png +0 -0
  330. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/close.png +0 -0
  331. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/close.png +0 -0
  332. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock-open.png +0 -0
  333. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock.png +0 -0
  334. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/refresh.png +0 -0
  335. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/lock-open.png +0 -0
  336. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/lock.png +0 -0
  337. data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/refresh.png +0 -0
  338. data/vendor/assets/javascripts/ckeditor/skins/minimalist/readme.md +7 -0
  339. data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons16.png +0 -0
  340. data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons16.svg +2374 -0
  341. data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons32.png +0 -0
  342. data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons32.svg +2722 -0
  343. data/vendor/assets/javascripts/ckeditor/skins/moono/dev/locations.json +145 -0
  344. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +1 -1
  345. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +1 -1
  346. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +1 -1
  347. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +1 -1
  348. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +1 -1
  349. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +1 -1
  350. data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
  351. data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
  352. data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +10 -0
  353. data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
  354. metadata +182 -177
  355. data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css.erb +0 -128
  356. data/app/views/rails_admin/main/_form_ck_editor.html.haml +0 -10
  357. data/app/views/rails_admin/main/_form_ck_editorml.html.haml +0 -11
  358. data/config/locales/bg.ckeditor.yml +0 -9
  359. data/config/locales/cs.ckeditor.yml +0 -9
  360. data/config/locales/de.ckeditor.yml +0 -9
  361. data/config/locales/el-GR.cdkeditor.yml +0 -9
  362. data/config/locales/es.ckeditor.yml +0 -9
  363. data/config/locales/fr.ckeditor.yml +0 -9
  364. data/config/locales/hu.ckeditor.yml +0 -9
  365. data/config/locales/it.ckeditor.yml +0 -9
  366. data/config/locales/ja.ckeditor.yml +0 -9
  367. data/config/locales/nb.ckeditor.yml +0 -9
  368. data/config/locales/nl.ckeditor.yml +0 -9
  369. data/config/locales/pl.ckeditor.yml +0 -9
  370. data/config/locales/pt-BR.ckeditor.yml +0 -9
  371. data/config/locales/pt-PT.ckeditor.yml +0 -9
  372. data/config/locales/sv-SE.ckeditor.yml +0 -9
  373. data/config/locales/tr.ckeditor.yml +0 -9
  374. data/config/locales/uk.ckeditor.yml +0 -9
  375. data/config/locales/zh-CN.ckeditor.yml +0 -9
  376. data/config/locales/zh-TW.ckeditor.yml +0 -9
  377. data/lib/ckeditor/engine.rb +0 -46
  378. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -12
  379. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +0 -183
  380. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/comment.js +0 -206
  381. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/continuecomment.js +0 -85
  382. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.css +0 -32
  383. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.js +0 -157
  384. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +0 -202
  385. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +0 -169
  386. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +0 -51
  387. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +0 -122
  388. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchtags.js +0 -66
  389. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/trailingspace.js +0 -27
  390. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/brace-fold.js +0 -105
  391. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/comment-fold.js +0 -59
  392. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldcode.js +0 -150
  393. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.css +0 -20
  394. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.js +0 -146
  395. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/indent-fold.js +0 -44
  396. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/markdown-fold.js +0 -49
  397. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/xml-fold.js +0 -182
  398. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +0 -43
  399. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/formatting.js +0 -226
  400. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/anyword-hint.js +0 -41
  401. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/css-hint.js +0 -60
  402. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/html-hint.js +0 -348
  403. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/javascript-hint.js +0 -155
  404. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.js +0 -438
  405. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/sql-hint.js +0 -271
  406. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/xml-hint.js +0 -110
  407. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/loadmode.js +0 -64
  408. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex.js +0 -123
  409. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex_test.js +0 -33
  410. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/overlay.js +0 -85
  411. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/simple.js +0 -213
  412. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/jump-to-line.js +0 -49
  413. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +0 -165
  414. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.css +0 -8
  415. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.js +0 -97
  416. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/search.js +0 -252
  417. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/searchcursor.js +0 -189
  418. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/active-line.js +0 -74
  419. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/mark-selection.js +0 -118
  420. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/selection-pointer.js +0 -98
  421. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify-html.js +0 -952
  422. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.js +0 -2087
  423. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +0 -9109
  424. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/bbcode.js +0 -137
  425. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/index.html +0 -73
  426. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/bbcodemixed.js +0 -161
  427. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/index.html +0 -128
  428. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/clike.js +0 -785
  429. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/index.html +0 -360
  430. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/scala.html +0 -767
  431. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/test.js +0 -55
  432. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/css.js +0 -825
  433. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss.html +0 -103
  434. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss_test.js +0 -17
  435. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/index.html +0 -75
  436. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less.html +0 -152
  437. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less_test.js +0 -54
  438. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss.html +0 -157
  439. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss_test.js +0 -110
  440. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/test.js +0 -200
  441. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/htmlembedded.js +0 -28
  442. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/index.html +0 -60
  443. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/htmlmixed.js +0 -152
  444. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/index.html +0 -89
  445. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/index.html +0 -114
  446. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/javascript.js +0 -784
  447. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/json-ld.html +0 -72
  448. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/test.js +0 -247
  449. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/typescript.html +0 -61
  450. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/index.html +0 -64
  451. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/php.js +0 -234
  452. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/test.js +0 -154
  453. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/index.html +0 -61
  454. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/test.js +0 -51
  455. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/xml.js +0 -394
  456. data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +0 -15
@@ -1,74 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Because sometimes you need to style the cursor's line.
5
- //
6
- // Adds an option 'styleActiveLine' which, when enabled, gives the
7
- // active line's wrapping <div> the CSS class "CodeMirror-activeline",
8
- // and gives its background <div> the class "CodeMirror-activeline-background".
9
-
10
- (function(mod) {
11
- if (typeof exports == "object" && typeof module == "object") // CommonJS
12
- mod(require("../../lib/codemirror"));
13
- else if (typeof define == "function" && define.amd) // AMD
14
- define(["../../lib/codemirror"], mod);
15
- else // Plain browser env
16
- mod(CodeMirror);
17
- })(function(CodeMirror) {
18
- "use strict";
19
- var WRAP_CLASS = "CodeMirror-activeline";
20
- var BACK_CLASS = "CodeMirror-activeline-background";
21
- var GUTT_CLASS = "CodeMirror-activeline-gutter";
22
-
23
- CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
24
- var prev = old && old != CodeMirror.Init;
25
- if (val && !prev) {
26
- cm.state.activeLines = [];
27
- updateActiveLines(cm, cm.listSelections());
28
- cm.on("beforeSelectionChange", selectionChange);
29
- } else if (!val && prev) {
30
- cm.off("beforeSelectionChange", selectionChange);
31
- clearActiveLines(cm);
32
- delete cm.state.activeLines;
33
- }
34
- });
35
-
36
- function clearActiveLines(cm) {
37
- for (var i = 0; i < cm.state.activeLines.length; i++) {
38
- cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
39
- cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
40
- cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
41
- }
42
- }
43
-
44
- function sameArray(a, b) {
45
- if (a.length != b.length) return false;
46
- for (var i = 0; i < a.length; i++)
47
- if (a[i] != b[i]) return false;
48
- return true;
49
- }
50
-
51
- function updateActiveLines(cm, ranges) {
52
- var active = [];
53
- for (var i = 0; i < ranges.length; i++) {
54
- var range = ranges[i];
55
- if (!range.empty()) continue;
56
- var line = cm.getLineHandleVisualStart(range.head.line);
57
- if (active[active.length - 1] != line) active.push(line);
58
- }
59
- if (sameArray(cm.state.activeLines, active)) return;
60
- cm.operation(function() {
61
- clearActiveLines(cm);
62
- for (var i = 0; i < active.length; i++) {
63
- cm.addLineClass(active[i], "wrap", WRAP_CLASS);
64
- cm.addLineClass(active[i], "background", BACK_CLASS);
65
- cm.addLineClass(active[i], "gutter", GUTT_CLASS);
66
- }
67
- cm.state.activeLines = active;
68
- });
69
- }
70
-
71
- function selectionChange(cm, sel) {
72
- updateActiveLines(cm, sel.ranges);
73
- }
74
- });
@@ -1,118 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Because sometimes you need to mark the selected *text*.
5
- //
6
- // Adds an option 'styleSelectedText' which, when enabled, gives
7
- // selected text the CSS class given as option value, or
8
- // "CodeMirror-selectedtext" when the value is not a string.
9
-
10
- (function(mod) {
11
- if (typeof exports == "object" && typeof module == "object") // CommonJS
12
- mod(require("../../lib/codemirror"));
13
- else if (typeof define == "function" && define.amd) // AMD
14
- define(["../../lib/codemirror"], mod);
15
- else // Plain browser env
16
- mod(CodeMirror);
17
- })(function(CodeMirror) {
18
- "use strict";
19
-
20
- CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
21
- var prev = old && old != CodeMirror.Init;
22
- if (val && !prev) {
23
- cm.state.markedSelection = [];
24
- cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
25
- reset(cm);
26
- cm.on("cursorActivity", onCursorActivity);
27
- cm.on("change", onChange);
28
- } else if (!val && prev) {
29
- cm.off("cursorActivity", onCursorActivity);
30
- cm.off("change", onChange);
31
- clear(cm);
32
- cm.state.markedSelection = cm.state.markedSelectionStyle = null;
33
- }
34
- });
35
-
36
- function onCursorActivity(cm) {
37
- cm.operation(function() { update(cm); });
38
- }
39
-
40
- function onChange(cm) {
41
- if (cm.state.markedSelection.length)
42
- cm.operation(function() { clear(cm); });
43
- }
44
-
45
- var CHUNK_SIZE = 8;
46
- var Pos = CodeMirror.Pos;
47
- var cmp = CodeMirror.cmpPos;
48
-
49
- function coverRange(cm, from, to, addAt) {
50
- if (cmp(from, to) == 0) return;
51
- var array = cm.state.markedSelection;
52
- var cls = cm.state.markedSelectionStyle;
53
- for (var line = from.line;;) {
54
- var start = line == from.line ? from : Pos(line, 0);
55
- var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
56
- var end = atEnd ? to : Pos(endLine, 0);
57
- var mark = cm.markText(start, end, {className: cls});
58
- if (addAt == null) array.push(mark);
59
- else array.splice(addAt++, 0, mark);
60
- if (atEnd) break;
61
- line = endLine;
62
- }
63
- }
64
-
65
- function clear(cm) {
66
- var array = cm.state.markedSelection;
67
- for (var i = 0; i < array.length; ++i) array[i].clear();
68
- array.length = 0;
69
- }
70
-
71
- function reset(cm) {
72
- clear(cm);
73
- var ranges = cm.listSelections();
74
- for (var i = 0; i < ranges.length; i++)
75
- coverRange(cm, ranges[i].from(), ranges[i].to());
76
- }
77
-
78
- function update(cm) {
79
- if (!cm.somethingSelected()) return clear(cm);
80
- if (cm.listSelections().length > 1) return reset(cm);
81
-
82
- var from = cm.getCursor("start"), to = cm.getCursor("end");
83
-
84
- var array = cm.state.markedSelection;
85
- if (!array.length) return coverRange(cm, from, to);
86
-
87
- var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
88
- if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
89
- cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
90
- return reset(cm);
91
-
92
- while (cmp(from, coverStart.from) > 0) {
93
- array.shift().clear();
94
- coverStart = array[0].find();
95
- }
96
- if (cmp(from, coverStart.from) < 0) {
97
- if (coverStart.to.line - from.line < CHUNK_SIZE) {
98
- array.shift().clear();
99
- coverRange(cm, from, coverStart.to, 0);
100
- } else {
101
- coverRange(cm, from, coverStart.from, 0);
102
- }
103
- }
104
-
105
- while (cmp(to, coverEnd.to) < 0) {
106
- array.pop().clear();
107
- coverEnd = array[array.length - 1].find();
108
- }
109
- if (cmp(to, coverEnd.to) > 0) {
110
- if (to.line - coverEnd.from.line < CHUNK_SIZE) {
111
- array.pop().clear();
112
- coverRange(cm, coverEnd.from, to);
113
- } else {
114
- coverRange(cm, coverEnd.to, to);
115
- }
116
- }
117
- }
118
- });
@@ -1,98 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- (function(mod) {
5
- if (typeof exports == "object" && typeof module == "object") // CommonJS
6
- mod(require("../../lib/codemirror"));
7
- else if (typeof define == "function" && define.amd) // AMD
8
- define(["../../lib/codemirror"], mod);
9
- else // Plain browser env
10
- mod(CodeMirror);
11
- })(function(CodeMirror) {
12
- "use strict";
13
-
14
- CodeMirror.defineOption("selectionPointer", false, function(cm, val) {
15
- var data = cm.state.selectionPointer;
16
- if (data) {
17
- CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove);
18
- CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout);
19
- CodeMirror.off(window, "scroll", data.windowScroll);
20
- cm.off("cursorActivity", reset);
21
- cm.off("scroll", reset);
22
- cm.state.selectionPointer = null;
23
- cm.display.lineDiv.style.cursor = "";
24
- }
25
- if (val) {
26
- data = cm.state.selectionPointer = {
27
- value: typeof val == "string" ? val : "default",
28
- mousemove: function(event) { mousemove(cm, event); },
29
- mouseout: function(event) { mouseout(cm, event); },
30
- windowScroll: function() { reset(cm); },
31
- rects: null,
32
- mouseX: null, mouseY: null,
33
- willUpdate: false
34
- };
35
- CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove);
36
- CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout);
37
- CodeMirror.on(window, "scroll", data.windowScroll);
38
- cm.on("cursorActivity", reset);
39
- cm.on("scroll", reset);
40
- }
41
- });
42
-
43
- function mousemove(cm, event) {
44
- var data = cm.state.selectionPointer;
45
- if (event.buttons == null ? event.which : event.buttons) {
46
- data.mouseX = data.mouseY = null;
47
- } else {
48
- data.mouseX = event.clientX;
49
- data.mouseY = event.clientY;
50
- }
51
- scheduleUpdate(cm);
52
- }
53
-
54
- function mouseout(cm, event) {
55
- if (!cm.getWrapperElement().contains(event.relatedTarget)) {
56
- var data = cm.state.selectionPointer;
57
- data.mouseX = data.mouseY = null;
58
- scheduleUpdate(cm);
59
- }
60
- }
61
-
62
- function reset(cm) {
63
- cm.state.selectionPointer.rects = null;
64
- scheduleUpdate(cm);
65
- }
66
-
67
- function scheduleUpdate(cm) {
68
- if (!cm.state.selectionPointer.willUpdate) {
69
- cm.state.selectionPointer.willUpdate = true;
70
- setTimeout(function() {
71
- update(cm);
72
- cm.state.selectionPointer.willUpdate = false;
73
- }, 50);
74
- }
75
- }
76
-
77
- function update(cm) {
78
- var data = cm.state.selectionPointer;
79
- if (!data) return;
80
- if (data.rects == null && data.mouseX != null) {
81
- data.rects = [];
82
- if (cm.somethingSelected()) {
83
- for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling)
84
- data.rects.push(sel.getBoundingClientRect());
85
- }
86
- }
87
- var inside = false;
88
- if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) {
89
- var rect = data.rects[i];
90
- if (rect.left <= data.mouseX && rect.right >= data.mouseX &&
91
- rect.top <= data.mouseY && rect.bottom >= data.mouseY)
92
- inside = true;
93
- }
94
- var cursor = inside ? data.value : "";
95
- if (cm.display.lineDiv.style.cursor != cursor)
96
- cm.display.lineDiv.style.cursor = cursor;
97
- }
98
- });
@@ -1,952 +0,0 @@
1
- /*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */
2
- /*
3
-
4
- The MIT License (MIT)
5
-
6
- Copyright (c) 2007-2013 Einar Lielmanis and contributors.
7
-
8
- Permission is hereby granted, free of charge, to any person
9
- obtaining a copy of this software and associated documentation files
10
- (the "Software"), to deal in the Software without restriction,
11
- including without limitation the rights to use, copy, modify, merge,
12
- publish, distribute, sublicense, and/or sell copies of the Software,
13
- and to permit persons to whom the Software is furnished to do so,
14
- subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be
17
- included in all copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
-
29
- Style HTML
30
- ---------------
31
-
32
- Written by Nochum Sossonko, (nsossonko@hotmail.com)
33
-
34
- Based on code initially developed by: Einar Lielmanis, <einar@jsbeautifier.org>
35
- http://jsbeautifier.org/
36
-
37
- Usage:
38
- style_html(html_source);
39
-
40
- style_html(html_source, options);
41
-
42
- The options are:
43
- indent_inner_html (default false) — indent <head> and <body> sections,
44
- indent_size (default 4) — indentation size,
45
- indent_char (default space) — character to indent with,
46
- wrap_line_length (default 250) - maximum amount of characters per line (0 = disable)
47
- brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none"
48
- put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.
49
- unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
50
- indent_scripts (default normal) - "keep"|"separate"|"normal"
51
- preserve_newlines (default true) - whether existing line breaks before elements should be preserved
52
- Only works before elements, not inside tags or for text.
53
- max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk
54
- indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}}
55
- end_with_newline (false) - end with a newline
56
- extra_liners (default [head,body,/html]) -List of tags that should have an extra newline before them.
57
-
58
- e.g.
59
-
60
- style_html(html_source, {
61
- 'indent_inner_html': false,
62
- 'indent_size': 2,
63
- 'indent_char': ' ',
64
- 'wrap_line_length': 78,
65
- 'brace_style': 'expand',
66
- 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'],
67
- 'preserve_newlines': true,
68
- 'max_preserve_newlines': 5,
69
- 'indent_handlebars': false,
70
- 'extra_liners': ['/html']
71
- });
72
- */
73
-
74
- (function() {
75
-
76
- function trim(s) {
77
- return s.replace(/^\s+|\s+$/g, '');
78
- }
79
-
80
- function ltrim(s) {
81
- return s.replace(/^\s+/g, '');
82
- }
83
-
84
- function rtrim(s) {
85
- return s.replace(/\s+$/g,'');
86
- }
87
-
88
- function style_html(html_source, options, js_beautify, css_beautify) {
89
- //Wrapper function to invoke all the necessary constructors and deal with the output.
90
-
91
- var multi_parser,
92
- indent_inner_html,
93
- indent_size,
94
- indent_character,
95
- wrap_line_length,
96
- brace_style,
97
- unformatted,
98
- preserve_newlines,
99
- max_preserve_newlines,
100
- indent_handlebars,
101
- wrap_attributes,
102
- wrap_attributes_indent_size,
103
- end_with_newline,
104
- extra_liners,
105
- eol;
106
-
107
- options = options || {};
108
-
109
- // backwards compatibility to 1.3.4
110
- if ((options.wrap_line_length === undefined || parseInt(options.wrap_line_length, 10) === 0) &&
111
- (options.max_char !== undefined && parseInt(options.max_char, 10) !== 0)) {
112
- options.wrap_line_length = options.max_char;
113
- }
114
-
115
- indent_inner_html = (options.indent_inner_html === undefined) ? false : options.indent_inner_html;
116
- indent_size = (options.indent_size === undefined) ? 4 : parseInt(options.indent_size, 10);
117
- indent_character = (options.indent_char === undefined) ? ' ' : options.indent_char;
118
- brace_style = (options.brace_style === undefined) ? 'collapse' : options.brace_style;
119
- wrap_line_length = parseInt(options.wrap_line_length, 10) === 0 ? 32786 : parseInt(options.wrap_line_length || 250, 10);
120
- unformatted = options.unformatted || ['a', 'span', 'img', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd',
121
- 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike',
122
- 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
123
- preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;
124
- max_preserve_newlines = preserve_newlines ?
125
- (isNaN(parseInt(options.max_preserve_newlines, 10)) ? 32786 : parseInt(options.max_preserve_newlines, 10))
126
- : 0;
127
- indent_handlebars = (options.indent_handlebars === undefined) ? false : options.indent_handlebars;
128
- wrap_attributes = (options.wrap_attributes === undefined) ? 'auto' : options.wrap_attributes;
129
- wrap_attributes_indent_size = (options.wrap_attributes_indent_size === undefined) ? indent_size : parseInt(options.wrap_attributes_indent_size, 10) || indent_size;
130
- end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
131
- extra_liners = (typeof options.extra_liners == 'object') && options.extra_liners ?
132
- options.extra_liners.concat() : (typeof options.extra_liners === 'string') ?
133
- options.extra_liners.split(',') : 'head,body,/html'.split(',');
134
- eol = options.eol ? options.eol : '\n';
135
-
136
- if(options.indent_with_tabs){
137
- indent_character = '\t';
138
- indent_size = 1;
139
- }
140
-
141
- eol = eol.replace(/\\r/, '\r').replace(/\\n/, '\n')
142
-
143
- function Parser() {
144
-
145
- this.pos = 0; //Parser position
146
- this.token = '';
147
- this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
148
- this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
149
- parent: 'parent1',
150
- parentcount: 1,
151
- parent1: ''
152
- };
153
- this.tag_type = '';
154
- this.token_text = this.last_token = this.last_text = this.token_type = '';
155
- this.newlines = 0;
156
- this.indent_content = indent_inner_html;
157
-
158
- this.Utils = { //Uilities made available to the various functions
159
- whitespace: "\n\r\t ".split(''),
160
- single_token: 'br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed'.split(','), //all the single tags for HTML
161
- extra_liners: extra_liners, //for tags that need a line of whitespace before them
162
- in_array: function(what, arr) {
163
- for (var i = 0; i < arr.length; i++) {
164
- if (what === arr[i]) {
165
- return true;
166
- }
167
- }
168
- return false;
169
- }
170
- };
171
-
172
- // Return true if the given text is composed entirely of whitespace.
173
- this.is_whitespace = function(text) {
174
- for (var n = 0; n < text.length; text++) {
175
- if (!this.Utils.in_array(text.charAt(n), this.Utils.whitespace)) {
176
- return false;
177
- }
178
- }
179
- return true;
180
- };
181
-
182
- this.traverse_whitespace = function() {
183
- var input_char = '';
184
-
185
- input_char = this.input.charAt(this.pos);
186
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
187
- this.newlines = 0;
188
- while (this.Utils.in_array(input_char, this.Utils.whitespace)) {
189
- if (preserve_newlines && input_char === '\n' && this.newlines <= max_preserve_newlines) {
190
- this.newlines += 1;
191
- }
192
-
193
- this.pos++;
194
- input_char = this.input.charAt(this.pos);
195
- }
196
- return true;
197
- }
198
- return false;
199
- };
200
-
201
- // Append a space to the given content (string array) or, if we are
202
- // at the wrap_line_length, append a newline/indentation.
203
- this.space_or_wrap = function(content) {
204
- if (this.line_char_count >= this.wrap_line_length) { //insert a line when the wrap_line_length is reached
205
- this.print_newline(false, content);
206
- this.print_indentation(content);
207
- } else {
208
- this.line_char_count++;
209
- content.push(' ');
210
- }
211
- };
212
-
213
- this.get_content = function() { //function to capture regular content between tags
214
- var input_char = '',
215
- content = [],
216
- space = false; //if a space is needed
217
-
218
- while (this.input.charAt(this.pos) !== '<') {
219
- if (this.pos >= this.input.length) {
220
- return content.length ? content.join('') : ['', 'TK_EOF'];
221
- }
222
-
223
- if (this.traverse_whitespace()) {
224
- this.space_or_wrap(content);
225
- continue;
226
- }
227
-
228
- if (indent_handlebars) {
229
- // Handlebars parsing is complicated.
230
- // {{#foo}} and {{/foo}} are formatted tags.
231
- // {{something}} should get treated as content, except:
232
- // {{else}} specifically behaves like {{#if}} and {{/if}}
233
- var peek3 = this.input.substr(this.pos, 3);
234
- if (peek3 === '{{#' || peek3 === '{{/') {
235
- // These are tags and not content.
236
- break;
237
- } else if (peek3 === '{{!') {
238
- return [this.get_tag(), 'TK_TAG_HANDLEBARS_COMMENT'];
239
- } else if (this.input.substr(this.pos, 2) === '{{') {
240
- if (this.get_tag(true) === '{{else}}') {
241
- break;
242
- }
243
- }
244
- }
245
-
246
- input_char = this.input.charAt(this.pos);
247
- this.pos++;
248
- this.line_char_count++;
249
- content.push(input_char); //letter at-a-time (or string) inserted to an array
250
- }
251
- return content.length ? content.join('') : '';
252
- };
253
-
254
- this.get_contents_to = function(name) { //get the full content of a script or style to pass to js_beautify
255
- if (this.pos === this.input.length) {
256
- return ['', 'TK_EOF'];
257
- }
258
- var input_char = '';
259
- var content = '';
260
- var reg_match = new RegExp('</' + name + '\\s*>', 'igm');
261
- reg_match.lastIndex = this.pos;
262
- var reg_array = reg_match.exec(this.input);
263
- var end_script = reg_array ? reg_array.index : this.input.length; //absolute end of script
264
- if (this.pos < end_script) { //get everything in between the script tags
265
- content = this.input.substring(this.pos, end_script);
266
- this.pos = end_script;
267
- }
268
- return content;
269
- };
270
-
271
- this.record_tag = function(tag) { //function to record a tag and its parent in this.tags Object
272
- if (this.tags[tag + 'count']) { //check for the existence of this tag type
273
- this.tags[tag + 'count']++;
274
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
275
- } else { //otherwise initialize this tag type
276
- this.tags[tag + 'count'] = 1;
277
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
278
- }
279
- this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
280
- this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
281
- };
282
-
283
- this.retrieve_tag = function(tag) { //function to retrieve the opening tag to the corresponding closer
284
- if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
285
- var temp_parent = this.tags.parent; //check to see if it's a closable tag.
286
- while (temp_parent) { //till we reach '' (the initial value);
287
- if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
288
- break;
289
- }
290
- temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
291
- }
292
- if (temp_parent) { //if we caught something
293
- this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
294
- this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
295
- }
296
- delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
297
- delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
298
- if (this.tags[tag + 'count'] === 1) {
299
- delete this.tags[tag + 'count'];
300
- } else {
301
- this.tags[tag + 'count']--;
302
- }
303
- }
304
- };
305
-
306
- this.indent_to_tag = function(tag) {
307
- // Match the indentation level to the last use of this tag, but don't remove it.
308
- if (!this.tags[tag + 'count']) {
309
- return;
310
- }
311
- var temp_parent = this.tags.parent;
312
- while (temp_parent) {
313
- if (tag + this.tags[tag + 'count'] === temp_parent) {
314
- break;
315
- }
316
- temp_parent = this.tags[temp_parent + 'parent'];
317
- }
318
- if (temp_parent) {
319
- this.indent_level = this.tags[tag + this.tags[tag + 'count']];
320
- }
321
- };
322
-
323
- this.get_tag = function(peek) { //function to get a full tag and parse its type
324
- var input_char = '',
325
- content = [],
326
- comment = '',
327
- space = false,
328
- first_attr = true,
329
- tag_start, tag_end,
330
- tag_start_char,
331
- orig_pos = this.pos,
332
- orig_line_char_count = this.line_char_count;
333
-
334
- peek = peek !== undefined ? peek : false;
335
-
336
- do {
337
- if (this.pos >= this.input.length) {
338
- if (peek) {
339
- this.pos = orig_pos;
340
- this.line_char_count = orig_line_char_count;
341
- }
342
- return content.length ? content.join('') : ['', 'TK_EOF'];
343
- }
344
-
345
- input_char = this.input.charAt(this.pos);
346
- this.pos++;
347
-
348
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
349
- space = true;
350
- continue;
351
- }
352
-
353
- if (input_char === "'" || input_char === '"') {
354
- input_char += this.get_unformatted(input_char);
355
- space = true;
356
-
357
- }
358
-
359
- if (input_char === '=') { //no space before =
360
- space = false;
361
- }
362
-
363
- if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {
364
- //no space after = or before >
365
- this.space_or_wrap(content);
366
- space = false;
367
- if (!first_attr && wrap_attributes === 'force' && input_char !== '/') {
368
- this.print_newline(true, content);
369
- this.print_indentation(content);
370
- for (var count = 0; count < wrap_attributes_indent_size; count++) {
371
- content.push(indent_character);
372
- }
373
- }
374
- for (var i = 0; i < content.length; i++) {
375
- if (content[i] === ' ') {
376
- first_attr = false;
377
- break;
378
- }
379
- }
380
- }
381
-
382
- if (indent_handlebars && tag_start_char === '<') {
383
- // When inside an angle-bracket tag, put spaces around
384
- // handlebars not inside of strings.
385
- if ((input_char + this.input.charAt(this.pos)) === '{{') {
386
- input_char += this.get_unformatted('}}');
387
- if (content.length && content[content.length - 1] !== ' ' && content[content.length - 1] !== '<') {
388
- input_char = ' ' + input_char;
389
- }
390
- space = true;
391
- }
392
- }
393
-
394
- if (input_char === '<' && !tag_start_char) {
395
- tag_start = this.pos - 1;
396
- tag_start_char = '<';
397
- }
398
-
399
- if (indent_handlebars && !tag_start_char) {
400
- if (content.length >= 2 && content[content.length - 1] === '{' && content[content.length - 2] === '{') {
401
- if (input_char === '#' || input_char === '/' || input_char === '!') {
402
- tag_start = this.pos - 3;
403
- } else {
404
- tag_start = this.pos - 2;
405
- }
406
- tag_start_char = '{';
407
- }
408
- }
409
-
410
- this.line_char_count++;
411
- content.push(input_char); //inserts character at-a-time (or string)
412
-
413
- if (content[1] && (content[1] === '!' || content[1] === '?' || content[1] === '%')) { //if we're in a comment, do something special
414
- // We treat all comments as literals, even more than preformatted tags
415
- // we just look for the appropriate close tag
416
- content = [this.get_comment(tag_start)];
417
- break;
418
- }
419
-
420
- if (indent_handlebars && content[1] && content[1] === '{' && content[2] && content[2] === '!') { //if we're in a comment, do something special
421
- // We treat all comments as literals, even more than preformatted tags
422
- // we just look for the appropriate close tag
423
- content = [this.get_comment(tag_start)];
424
- break;
425
- }
426
-
427
- if (indent_handlebars && tag_start_char === '{' && content.length > 2 && content[content.length - 2] === '}' && content[content.length - 1] === '}') {
428
- break;
429
- }
430
- } while (input_char !== '>');
431
-
432
- var tag_complete = content.join('');
433
- var tag_index;
434
- var tag_offset;
435
-
436
- if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
437
- tag_index = tag_complete.indexOf(' ');
438
- } else if (tag_complete.charAt(0) === '{') {
439
- tag_index = tag_complete.indexOf('}');
440
- } else { //otherwise go with the tag ending
441
- tag_index = tag_complete.indexOf('>');
442
- }
443
- if (tag_complete.charAt(0) === '<' || !indent_handlebars) {
444
- tag_offset = 1;
445
- } else {
446
- tag_offset = tag_complete.charAt(2) === '#' ? 3 : 2;
447
- }
448
- var tag_check = tag_complete.substring(tag_offset, tag_index).toLowerCase();
449
- if (tag_complete.charAt(tag_complete.length - 2) === '/' ||
450
- this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
451
- if (!peek) {
452
- this.tag_type = 'SINGLE';
453
- }
454
- } else if (indent_handlebars && tag_complete.charAt(0) === '{' && tag_check === 'else') {
455
- if (!peek) {
456
- this.indent_to_tag('if');
457
- this.tag_type = 'HANDLEBARS_ELSE';
458
- this.indent_content = true;
459
- this.traverse_whitespace();
460
- }
461
- } else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
462
- comment = this.get_unformatted('</' + tag_check + '>', tag_complete); //...delegate to get_unformatted function
463
- content.push(comment);
464
- tag_end = this.pos - 1;
465
- this.tag_type = 'SINGLE';
466
- } else if (tag_check === 'script' &&
467
- (tag_complete.search('type') === -1 ||
468
- (tag_complete.search('type') > -1 &&
469
- tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/) > -1))) {
470
- if (!peek) {
471
- this.record_tag(tag_check);
472
- this.tag_type = 'SCRIPT';
473
- }
474
- } else if (tag_check === 'style' &&
475
- (tag_complete.search('type') === -1 ||
476
- (tag_complete.search('type') > -1 && tag_complete.search('text/css') > -1))) {
477
- if (!peek) {
478
- this.record_tag(tag_check);
479
- this.tag_type = 'STYLE';
480
- }
481
- } else if (tag_check.charAt(0) === '!') { //peek for <! comment
482
- // for comments content is already correct.
483
- if (!peek) {
484
- this.tag_type = 'SINGLE';
485
- this.traverse_whitespace();
486
- }
487
- } else if (!peek) {
488
- if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
489
- this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
490
- this.tag_type = 'END';
491
- } else { //otherwise it's a start-tag
492
- this.record_tag(tag_check); //push it on the tag stack
493
- if (tag_check.toLowerCase() !== 'html') {
494
- this.indent_content = true;
495
- }
496
- this.tag_type = 'START';
497
- }
498
-
499
- // Allow preserving of newlines after a start or end tag
500
- if (this.traverse_whitespace()) {
501
- this.space_or_wrap(content);
502
- }
503
-
504
- if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
505
- this.print_newline(false, this.output);
506
- if (this.output.length && this.output[this.output.length - 2] !== '\n') {
507
- this.print_newline(true, this.output);
508
- }
509
- }
510
- }
511
-
512
- if (peek) {
513
- this.pos = orig_pos;
514
- this.line_char_count = orig_line_char_count;
515
- }
516
-
517
- return content.join(''); //returns fully formatted tag
518
- };
519
-
520
- this.get_comment = function(start_pos) { //function to return comment content in its entirety
521
- // this is will have very poor perf, but will work for now.
522
- var comment = '',
523
- delimiter = '>',
524
- matched = false;
525
-
526
- this.pos = start_pos;
527
- input_char = this.input.charAt(this.pos);
528
- this.pos++;
529
-
530
- while (this.pos <= this.input.length) {
531
- comment += input_char;
532
-
533
- // only need to check for the delimiter if the last chars match
534
- if (comment.charAt(comment.length - 1) === delimiter.charAt(delimiter.length - 1) &&
535
- comment.indexOf(delimiter) !== -1) {
536
- break;
537
- }
538
-
539
- // only need to search for custom delimiter for the first few characters
540
- if (!matched && comment.length < 10) {
541
- if (comment.indexOf('<![if') === 0) { //peek for <![if conditional comment
542
- delimiter = '<![endif]>';
543
- matched = true;
544
- } else if (comment.indexOf('<![cdata[') === 0) { //if it's a <[cdata[ comment...
545
- delimiter = ']]>';
546
- matched = true;
547
- } else if (comment.indexOf('<![') === 0) { // some other ![ comment? ...
548
- delimiter = ']>';
549
- matched = true;
550
- } else if (comment.indexOf('<!--') === 0) { // <!-- comment ...
551
- delimiter = '-->';
552
- matched = true;
553
- } else if (comment.indexOf('{{!') === 0) { // {{! handlebars comment
554
- delimiter = '}}';
555
- matched = true;
556
- } else if (comment.indexOf('<?') === 0) { // {{! handlebars comment
557
- delimiter = '?>';
558
- matched = true;
559
- } else if (comment.indexOf('<%') === 0) { // {{! handlebars comment
560
- delimiter = '%>';
561
- matched = true;
562
- }
563
- }
564
-
565
- input_char = this.input.charAt(this.pos);
566
- this.pos++;
567
- }
568
-
569
- return comment;
570
- };
571
-
572
- this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
573
-
574
- if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
575
- return '';
576
- }
577
- var input_char = '';
578
- var content = '';
579
- var min_index = 0;
580
- var space = true;
581
- do {
582
-
583
- if (this.pos >= this.input.length) {
584
- return content;
585
- }
586
-
587
- input_char = this.input.charAt(this.pos);
588
- this.pos++;
589
-
590
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
591
- if (!space) {
592
- this.line_char_count--;
593
- continue;
594
- }
595
- if (input_char === '\n' || input_char === '\r') {
596
- content += '\n';
597
- /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'
598
- for (var i=0; i<this.indent_level; i++) {
599
- content += this.indent_string;
600
- }
601
- space = false; //...and make sure other indentation is erased
602
- */
603
- this.line_char_count = 0;
604
- continue;
605
- }
606
- }
607
- content += input_char;
608
- this.line_char_count++;
609
- space = true;
610
-
611
- if (indent_handlebars && input_char === '{' && content.length && content.charAt(content.length - 2) === '{') {
612
- // Handlebars expressions in strings should also be unformatted.
613
- content += this.get_unformatted('}}');
614
- // These expressions are opaque. Ignore delimiters found in them.
615
- min_index = content.length;
616
- }
617
- } while (content.toLowerCase().indexOf(delimiter, min_index) === -1);
618
- return content;
619
- };
620
-
621
- this.get_token = function() { //initial handler for token-retrieval
622
- var token;
623
-
624
- if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
625
- var type = this.last_token.substr(7);
626
- token = this.get_contents_to(type);
627
- if (typeof token !== 'string') {
628
- return token;
629
- }
630
- return [token, 'TK_' + type];
631
- }
632
- if (this.current_mode === 'CONTENT') {
633
- token = this.get_content();
634
- if (typeof token !== 'string') {
635
- return token;
636
- } else {
637
- return [token, 'TK_CONTENT'];
638
- }
639
- }
640
-
641
- if (this.current_mode === 'TAG') {
642
- token = this.get_tag();
643
- if (typeof token !== 'string') {
644
- return token;
645
- } else {
646
- var tag_name_type = 'TK_TAG_' + this.tag_type;
647
- return [token, tag_name_type];
648
- }
649
- }
650
- };
651
-
652
- this.get_full_indent = function(level) {
653
- level = this.indent_level + level || 0;
654
- if (level < 1) {
655
- return '';
656
- }
657
-
658
- return Array(level + 1).join(this.indent_string);
659
- };
660
-
661
- this.is_unformatted = function(tag_check, unformatted) {
662
- //is this an HTML5 block-level link?
663
- if (!this.Utils.in_array(tag_check, unformatted)) {
664
- return false;
665
- }
666
-
667
- if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)) {
668
- return true;
669
- }
670
-
671
- //at this point we have an tag; is its first child something we want to remain
672
- //unformatted?
673
- var next_tag = this.get_tag(true /* peek. */ );
674
-
675
- // test next_tag to see if it is just html tag (no external content)
676
- var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);
677
-
678
- // if next_tag comes back but is not an isolated tag, then
679
- // let's treat the 'a' tag as having content
680
- // and respect the unformatted option
681
- if (!tag || this.Utils.in_array(tag, unformatted)) {
682
- return true;
683
- } else {
684
- return false;
685
- }
686
- };
687
-
688
- this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
689
-
690
- this.input = js_source || ''; //gets the input for the Parser
691
-
692
- // HACK: newline parsing inconsistent. This brute force normalizes the input.
693
- this.input = this.input.replace(/\r\n|[\r\u2028\u2029]/g, '\n')
694
-
695
- this.output = [];
696
- this.indent_character = indent_character;
697
- this.indent_string = '';
698
- this.indent_size = indent_size;
699
- this.brace_style = brace_style;
700
- this.indent_level = 0;
701
- this.wrap_line_length = wrap_line_length;
702
- this.line_char_count = 0; //count to see if wrap_line_length was exceeded
703
-
704
- for (var i = 0; i < this.indent_size; i++) {
705
- this.indent_string += this.indent_character;
706
- }
707
-
708
- this.print_newline = function(force, arr) {
709
- this.line_char_count = 0;
710
- if (!arr || !arr.length) {
711
- return;
712
- }
713
- if (force || (arr[arr.length - 1] !== '\n')) { //we might want the extra line
714
- if ((arr[arr.length - 1] !== '\n')) {
715
- arr[arr.length - 1] = rtrim(arr[arr.length - 1]);
716
- }
717
- arr.push('\n');
718
- }
719
- };
720
-
721
- this.print_indentation = function(arr) {
722
- for (var i = 0; i < this.indent_level; i++) {
723
- arr.push(this.indent_string);
724
- this.line_char_count += this.indent_string.length;
725
- }
726
- };
727
-
728
- this.print_token = function(text) {
729
- // Avoid printing initial whitespace.
730
- if (this.is_whitespace(text) && !this.output.length) {
731
- return;
732
- }
733
- if (text || text !== '') {
734
- if (this.output.length && this.output[this.output.length - 1] === '\n') {
735
- this.print_indentation(this.output);
736
- text = ltrim(text);
737
- }
738
- }
739
- this.print_token_raw(text);
740
- };
741
-
742
- this.print_token_raw = function(text) {
743
- // If we are going to print newlines, truncate trailing
744
- // whitespace, as the newlines will represent the space.
745
- if (this.newlines > 0) {
746
- text = rtrim(text);
747
- }
748
-
749
- if (text && text !== '') {
750
- if (text.length > 1 && text.charAt(text.length - 1) === '\n') {
751
- // unformatted tags can grab newlines as their last character
752
- this.output.push(text.slice(0, -1));
753
- this.print_newline(false, this.output);
754
- } else {
755
- this.output.push(text);
756
- }
757
- }
758
-
759
- for (var n = 0; n < this.newlines; n++) {
760
- this.print_newline(n > 0, this.output);
761
- }
762
- this.newlines = 0;
763
- };
764
-
765
- this.indent = function() {
766
- this.indent_level++;
767
- };
768
-
769
- this.unindent = function() {
770
- if (this.indent_level > 0) {
771
- this.indent_level--;
772
- }
773
- };
774
- };
775
- return this;
776
- }
777
-
778
- /*_____________________--------------------_____________________*/
779
-
780
- multi_parser = new Parser(); //wrapping functions Parser
781
- multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values
782
-
783
- while (true) {
784
- var t = multi_parser.get_token();
785
- multi_parser.token_text = t[0];
786
- multi_parser.token_type = t[1];
787
-
788
- if (multi_parser.token_type === 'TK_EOF') {
789
- break;
790
- }
791
-
792
- switch (multi_parser.token_type) {
793
- case 'TK_TAG_START':
794
- multi_parser.print_newline(false, multi_parser.output);
795
- multi_parser.print_token(multi_parser.token_text);
796
- if (multi_parser.indent_content) {
797
- multi_parser.indent();
798
- multi_parser.indent_content = false;
799
- }
800
- multi_parser.current_mode = 'CONTENT';
801
- break;
802
- case 'TK_TAG_STYLE':
803
- case 'TK_TAG_SCRIPT':
804
- multi_parser.print_newline(false, multi_parser.output);
805
- multi_parser.print_token(multi_parser.token_text);
806
- multi_parser.current_mode = 'CONTENT';
807
- break;
808
- case 'TK_TAG_END':
809
- //Print new line only if the tag has no content and has child
810
- if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
811
- var tag_name = multi_parser.token_text.match(/\w+/)[0];
812
- var tag_extracted_from_last_output = null;
813
- if (multi_parser.output.length) {
814
- tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length - 1].match(/(?:<|{{#)\s*(\w+)/);
815
- }
816
- if (tag_extracted_from_last_output === null ||
817
- (tag_extracted_from_last_output[1] !== tag_name && !multi_parser.Utils.in_array(tag_extracted_from_last_output[1], unformatted))) {
818
- multi_parser.print_newline(false, multi_parser.output);
819
- }
820
- }
821
- multi_parser.print_token(multi_parser.token_text);
822
- multi_parser.current_mode = 'CONTENT';
823
- break;
824
- case 'TK_TAG_SINGLE':
825
- // Don't add a newline before elements that should remain unformatted.
826
- var tag_check = multi_parser.token_text.match(/^\s*<([a-z-]+)/i);
827
- if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)) {
828
- multi_parser.print_newline(false, multi_parser.output);
829
- }
830
- multi_parser.print_token(multi_parser.token_text);
831
- multi_parser.current_mode = 'CONTENT';
832
- break;
833
- case 'TK_TAG_HANDLEBARS_ELSE':
834
- multi_parser.print_token(multi_parser.token_text);
835
- if (multi_parser.indent_content) {
836
- multi_parser.indent();
837
- multi_parser.indent_content = false;
838
- }
839
- multi_parser.current_mode = 'CONTENT';
840
- break;
841
- case 'TK_TAG_HANDLEBARS_COMMENT':
842
- multi_parser.print_token(multi_parser.token_text);
843
- multi_parser.current_mode = 'TAG';
844
- break;
845
- case 'TK_CONTENT':
846
- multi_parser.print_token(multi_parser.token_text);
847
- multi_parser.current_mode = 'TAG';
848
- break;
849
- case 'TK_STYLE':
850
- case 'TK_SCRIPT':
851
- if (multi_parser.token_text !== '') {
852
- multi_parser.print_newline(false, multi_parser.output);
853
- var text = multi_parser.token_text,
854
- _beautifier,
855
- script_indent_level = 1;
856
- if (multi_parser.token_type === 'TK_SCRIPT') {
857
- _beautifier = typeof js_beautify === 'function' && js_beautify;
858
- } else if (multi_parser.token_type === 'TK_STYLE') {
859
- _beautifier = typeof css_beautify === 'function' && css_beautify;
860
- }
861
-
862
- if (options.indent_scripts === "keep") {
863
- script_indent_level = 0;
864
- } else if (options.indent_scripts === "separate") {
865
- script_indent_level = -multi_parser.indent_level;
866
- }
867
-
868
- var indentation = multi_parser.get_full_indent(script_indent_level);
869
- if (_beautifier) {
870
-
871
- // call the Beautifier if avaliable
872
- var Child_options = function() {
873
- this.eol = '\n';
874
- };
875
- Child_options.prototype = options;
876
- var child_options = new Child_options();
877
- text = _beautifier(text.replace(/^\s*/, indentation), child_options);
878
- } else {
879
- // simply indent the string otherwise
880
- var white = text.match(/^\s*/)[0];
881
- var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
882
- var reindent = multi_parser.get_full_indent(script_indent_level - _level);
883
- text = text.replace(/^\s*/, indentation)
884
- .replace(/\r\n|\r|\n/g, '\n' + reindent)
885
- .replace(/\s+$/, '');
886
- }
887
- if (text) {
888
- multi_parser.print_token_raw(text);
889
- multi_parser.print_newline(true, multi_parser.output);
890
- }
891
- }
892
- multi_parser.current_mode = 'TAG';
893
- break;
894
- default:
895
- // We should not be getting here but we don't want to drop input on the floor
896
- // Just output the text and move on
897
- if (multi_parser.token_text !== '') {
898
- multi_parser.print_token(multi_parser.token_text);
899
- }
900
- break;
901
- }
902
- multi_parser.last_token = multi_parser.token_type;
903
- multi_parser.last_text = multi_parser.token_text;
904
- }
905
- var sweet_code = multi_parser.output.join('').replace(/[\r\n\t ]+$/, '');
906
-
907
- // establish end_with_newline
908
- if (end_with_newline) {
909
- sweet_code += '\n';
910
- }
911
-
912
- if (eol != '\n') {
913
- sweet_code = sweet_code.replace(/[\n]/g, eol);
914
- }
915
-
916
- return sweet_code;
917
- }
918
-
919
- if (typeof define === "function" && define.amd) {
920
- // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
921
- define(["require", "./beautify", "./beautify-css"], function(requireamd) {
922
- var js_beautify = requireamd("./beautify");
923
- var css_beautify = requireamd("./beautify-css");
924
-
925
- return {
926
- html_beautify: function(html_source, options) {
927
- return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);
928
- }
929
- };
930
- });
931
- } else if (typeof exports !== "undefined") {
932
- // Add support for CommonJS. Just put this file somewhere on your require.paths
933
- // and you will be able to `var html_beautify = require("beautify").html_beautify`.
934
- var js_beautify = require('./beautify.js');
935
- var css_beautify = require('./beautify-css.js');
936
-
937
- exports.html_beautify = function(html_source, options) {
938
- return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);
939
- };
940
- } else if (typeof window !== "undefined") {
941
- // If we're running a web page and don't have either of the above, add our one global
942
- window.html_beautify = function(html_source, options) {
943
- return style_html(html_source, options, window.js_beautify, window.css_beautify);
944
- };
945
- } else if (typeof global !== "undefined") {
946
- // If we don't even have window, try global.
947
- global.html_beautify = function(html_source, options) {
948
- return style_html(html_source, options, global.js_beautify, global.css_beautify);
949
- };
950
- }
951
-
952
- }());