glebtv-ckeditor 4.4.7.4 → 4.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +38 -0
- data/MIT-LICENSE +1 -1
- data/README.md +124 -84
- data/Rakefile +1 -25
- data/app/assets/javascripts/ckeditor/application.js +0 -1
- data/app/assets/javascripts/ckeditor/config.js.erb +5 -59
- data/app/assets/javascripts/ckeditor/config_orig.js +58 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.jpg +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.png +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/gal_del.png +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/gal_more.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/preloader.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/avi.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/ckfnothumb.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/doc.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/docx.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/exe.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/gz.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/htm.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/jpg.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/mp3.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/mpg.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/pdf.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/psd.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/rar.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/swf.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/tar.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/txt.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/unknown.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/wmv.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/xls.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/xlsx.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/zip.gif +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/application.js.erb +58 -56
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.endless-scroll.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.min.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css.erb +12 -6
- data/app/assets/javascripts/ckeditor/init.js.erb +6 -1
- data/app/assets/stylesheets/ckcontent.css +0 -0
- data/app/assets/stylesheets/ckeditor/application.css +0 -0
- data/app/controllers/ckeditor/application_controller.rb +6 -17
- data/app/controllers/ckeditor/attachment_files_controller.rb +10 -3
- data/app/controllers/ckeditor/pictures_controller.rb +9 -2
- data/app/helpers/ckeditor/application_helper.rb +0 -0
- data/app/views/ckeditor/attachment_files/index.html.erb +3 -3
- data/app/views/ckeditor/pictures/index.html.erb +3 -3
- data/app/views/ckeditor/shared/_asset.html.erb +0 -0
- data/app/views/ckeditor/shared/_asset_tmpl.html.erb +0 -0
- data/app/views/layouts/ckeditor/application.html.erb +3 -2
- data/app/views/rails_admin/main/_form_ck_editor.html.haml +1 -1
- data/app/views/rails_admin/main/_form_ck_editorml.html.haml +1 -1
- data/config/locales/bg.ckeditor.yml +9 -0
- data/config/locales/cs.ckeditor.yml +0 -0
- data/config/locales/de.ckeditor.yml +0 -0
- data/config/locales/el-GR.cdkeditor.yml +0 -0
- data/config/locales/en.ckeditor.yml +0 -0
- data/config/locales/es.ckeditor.yml +0 -0
- data/config/locales/fr.ckeditor.yml +0 -0
- data/config/locales/hu.ckeditor.yml +0 -0
- data/config/locales/it.ckeditor.yml +0 -0
- data/config/locales/ja.ckeditor.yml +9 -0
- data/config/locales/nb.ckeditor.yml +9 -0
- data/config/locales/nl.ckeditor.yml +0 -0
- data/config/locales/pl.ckeditor.yml +0 -0
- data/config/locales/pt-BR.ckeditor.yml +0 -0
- data/config/locales/pt-PT.ckeditor.yml +0 -0
- data/config/locales/ru.ckeditor.yml +0 -0
- data/config/locales/sv-SE.ckeditor.yml +0 -0
- data/config/locales/tr.ckeditor.yml +9 -0
- data/config/locales/uk.ckeditor.yml +0 -0
- data/config/locales/zh-CN.ckeditor.yml +1 -1
- data/config/locales/zh-TW.ckeditor.yml +9 -0
- data/config/routes.rb +0 -0
- data/lib/ckeditor.rb +39 -5
- data/lib/ckeditor/asset_response.rb +59 -0
- data/lib/ckeditor/backend/carrierwave.rb +1 -8
- data/lib/ckeditor/backend/dragonfly.rb +8 -6
- data/lib/ckeditor/backend/paperclip.rb +7 -11
- data/lib/ckeditor/backend/refile.rb +37 -0
- data/lib/ckeditor/engine.rb +4 -0
- data/lib/ckeditor/helpers/controllers.rb +0 -0
- data/lib/ckeditor/helpers/form_builder.rb +0 -0
- data/lib/ckeditor/helpers/form_helper.rb +0 -0
- data/lib/ckeditor/helpers/view_helper.rb +0 -0
- data/lib/ckeditor/hooks/cancan.rb +4 -1
- data/lib/ckeditor/hooks/formtastic.rb +0 -0
- data/lib/ckeditor/hooks/pundit.rb +0 -0
- data/lib/ckeditor/hooks/simple_form.rb +1 -1
- data/lib/ckeditor/http.rb +1 -3
- data/lib/ckeditor/orm/active_record.rb +0 -0
- data/lib/ckeditor/orm/base.rb +0 -0
- data/lib/ckeditor/orm/mongoid.rb +0 -0
- data/lib/ckeditor/paginatable.rb +0 -0
- data/lib/ckeditor/text_area.rb +2 -1
- data/lib/ckeditor/utils.rb +26 -23
- data/lib/ckeditor/utils/content_type_detector.rb +41 -0
- data/lib/ckeditor/utils/javascript_code.rb +10 -0
- data/lib/ckeditor/version.rb +4 -2
- data/lib/generators/ckeditor/install_generator.rb +1 -1
- data/lib/generators/ckeditor/pundit_policy_generator.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +3 -5
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +3 -5
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +7 -7
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/asset.rb +4 -0
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/attachment_file.rb +7 -0
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +11 -0
- data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +28 -0
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +2 -0
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +0 -0
- data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +13 -19
- data/lib/generators/ckeditor/templates/ckeditor.rb +23 -0
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +0 -0
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +0 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +3 -6
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +3 -5
- data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +3 -3
- data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +3 -3
- data/lib/glebtv-ckeditor.rb +0 -0
- data/lib/tasks/ckeditor.rake +26 -0
- data/test/controllers/attachment_files_controller_test.rb +2 -2
- data/test/controllers/pictures_controller_test.rb +3 -4
- data/test/dummy/Rakefile +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -1
- data/test/dummy/app/assets/stylesheets/application.css +0 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -1
- data/test/dummy/app/controllers/posts_controller.rb +0 -0
- data/test/dummy/app/helpers/application_helper.rb +0 -0
- data/test/dummy/app/helpers/posts_helper.rb +0 -0
- data/test/dummy/app/models/post.rb +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +2 -2
- data/test/dummy/app/views/posts/_form.html.erb +0 -0
- data/test/dummy/app/views/posts/edit.html.erb +0 -0
- data/test/dummy/app/views/posts/index.html.erb +0 -0
- data/test/dummy/app/views/posts/new.html.erb +0 -0
- data/test/dummy/app/views/posts/show.html.erb +0 -0
- data/test/dummy/config.ru +0 -0
- data/test/dummy/config/application.rb +15 -15
- data/test/dummy/config/boot.rb +0 -0
- data/test/dummy/config/database.yml +0 -0
- data/test/dummy/config/environment.rb +0 -0
- data/test/dummy/config/environments/development.rb +0 -0
- data/test/dummy/config/environments/production.rb +0 -0
- data/test/dummy/config/environments/test.rb +7 -5
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/test/dummy/config/initializers/ckeditor.rb +0 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/inflections.rb +0 -0
- data/test/dummy/config/initializers/mime_types.rb +0 -0
- data/test/dummy/config/initializers/session_store.rb +0 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/test/dummy/config/locales/en.yml +0 -0
- data/test/dummy/config/mongoid.yml +135 -1
- data/test/dummy/config/routes.rb +3 -3
- data/test/dummy/config/secrets.yml +8 -0
- data/test/dummy/db/migrate/20110623120047_create_posts.rb +1 -1
- data/test/dummy/public/404.html +0 -0
- data/test/dummy/public/422.html +0 -0
- data/test/dummy/public/500.html +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -0
- data/test/dummy/test/fixtures/files/rails.png +0 -0
- data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
- data/test/functional/posts_controller_test.rb +6 -6
- data/test/generators/install_generator_test.rb +14 -0
- data/test/integration/navigation_test.rb +0 -0
- data/test/models/attachment_file_test.rb +2 -2
- data/test/{ckeditor_test.rb → models/ckeditor_test.rb} +35 -0
- data/test/models/picture_test.rb +6 -1
- data/test/models/utils_test.rb +6 -6
- data/test/orm/active_record.rb +0 -0
- data/test/orm/mongoid.rb +0 -0
- data/test/support/helpers.rb +0 -0
- data/test/support/integration_case.rb +0 -0
- data/test/support/raw_post.rb +0 -0
- data/test/support/routes.txt +0 -0
- data/test/test_helper.rb +3 -5
- data/vendor/assets/javascripts/ckeditor/LICENSE.md +159 -3
- data/vendor/assets/javascripts/ckeditor/README.md +39 -0
- data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +7 -7
- data/vendor/assets/javascripts/ckeditor/build-config.js +4 -3
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +1028 -964
- data/vendor/assets/javascripts/ckeditor/config.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/en.js +3 -3
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +9 -8
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autocomplete.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/commentselectedrange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcode.min.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +49 -29
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +7 -8
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +3 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +4 -2
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +3 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +3 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +65 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -0
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +10 -10
- data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +8 -8
- data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +16 -16
- data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +14 -14
- data/vendor/assets/javascripts/ckeditor/plugins/flash/images/placeholder.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +6 -5
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +15 -15
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +6 -5
- data/vendor/assets/javascripts/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +29 -34
- data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +41 -40
- data/vendor/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/LICENSE +22 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/README.md +2 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/en.js +3 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +3 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +81 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/readme.txt +30 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +20 -20
- data/vendor/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +7 -7
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/hidpi/loremipsum.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/loremipsum.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/en.js +8 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +8 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +131 -0
- data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/icon-rtl.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +7 -0
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +7 -0
- data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +923 -0
- data/vendor/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +29 -28
- data/vendor/assets/javascripts/ckeditor/plugins/preview/preview.html +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +20 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +28 -28
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +25 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +19 -17
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +8 -7
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +10 -10
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +9 -3
- data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +17 -17
- data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +12 -12
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +7 -7
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +4 -2
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +4 -2
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +286 -145
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +88 -70
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc_ie.js +7 -7
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +388 -388
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/arrow.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/spinner.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +49 -0
- data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
- metadata +105 -130
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.min.js +0 -4
- data/app/assets/javascripts/ckeditor/override.js.erb +0 -21
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/support/controller_hooks.rb +0 -27
- data/vendor/assets/javascripts/ckeditor/plugins/ipsum/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/ipsum/plugin.js +0 -63
- data/vendor/assets/javascripts/ckeditor/plugins/map/example_usage.js +0 -30
- data/vendor/assets/javascripts/ckeditor/plugins/map/map.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/map/plugin.js +0 -187
- data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/icons/hidpi/mediaembed.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/icons/mediaembed.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/plugin.js +0 -64
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css.scss +0 -771
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css.scss +0 -812
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css.scss +0 -844
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css.scss +0 -825
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css.scss +0 -816
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css.scss +0 -2136
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css.scss +0 -2145
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css.scss +0 -2194
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css.scss +0 -2362
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css.scss +0 -2206
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css.scss +0 -2254
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'mime/types'
|
2
1
|
require 'mini_magick'
|
3
2
|
|
4
3
|
module Ckeditor
|
@@ -38,13 +37,7 @@ module Ckeditor
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def extract_content_type
|
41
|
-
|
42
|
-
content_type = MIME::Types.type_for(original_filename).first
|
43
|
-
else
|
44
|
-
content_type = file.content_type
|
45
|
-
end
|
46
|
-
|
47
|
-
model.data_content_type = content_type.to_s
|
40
|
+
model.data_content_type = Utils::ContentTypeDetector.new(file.path).detect
|
48
41
|
end
|
49
42
|
|
50
43
|
def set_size
|
@@ -2,24 +2,26 @@ module Ckeditor
|
|
2
2
|
module Backend
|
3
3
|
module Dragonfly
|
4
4
|
def self.included(base)
|
5
|
-
base.send(:
|
5
|
+
base.send(:extend, ::Dragonfly::Model)
|
6
|
+
base.send(:extend, ::Dragonfly::Model::Validations)
|
6
7
|
base.send(:extend, ClassMethods)
|
8
|
+
base.send(:include, InstanceMethods)
|
7
9
|
end
|
8
10
|
|
9
11
|
module ClassMethods
|
10
12
|
def attachment_file_types
|
11
|
-
@attachment_file_types ||= Ckeditor.attachment_file_types.map(&:
|
13
|
+
@attachment_file_types ||= Ckeditor.attachment_file_types.map(&:to_s).tap do |formats|
|
12
14
|
# This is not ideal but Dragonfly doesn't return double
|
13
15
|
# extensions. Having said that, the other backends
|
14
16
|
# currently don't use attachment_file_types at all.
|
15
|
-
[
|
16
|
-
formats << f if formats.include?("tar.#{f}"
|
17
|
+
[ 'bz2', 'gz', 'lzma', 'xz' ].each do |f|
|
18
|
+
formats << f if formats.include?("tar.#{f}")
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
23
|
def image_file_types
|
22
|
-
@image_file_types ||= Ckeditor.image_file_types.map(&:
|
24
|
+
@image_file_types ||= Ckeditor.image_file_types.map(&:to_s)
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -27,7 +29,7 @@ module Ckeditor
|
|
27
29
|
delegate :url, :path, :size, :image?, :width, :height, :to => :data
|
28
30
|
|
29
31
|
alias_attribute :data_file_name, :data_name
|
30
|
-
alias_attribute :data_content_type, :
|
32
|
+
alias_attribute :data_content_type, :"data.mime_type"
|
31
33
|
alias_attribute :data_file_size, :data_size
|
32
34
|
|
33
35
|
private
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'mime/types'
|
2
|
-
|
3
1
|
module Ckeditor
|
4
2
|
module Backend
|
5
3
|
module Paperclip
|
@@ -21,14 +19,15 @@ module Ckeditor
|
|
21
19
|
|
22
20
|
module InstanceMethods
|
23
21
|
def geometry
|
24
|
-
@geometry ||=
|
25
|
-
file = data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
|
26
|
-
::Paperclip::Geometry.from_file(file)
|
27
|
-
end
|
22
|
+
@geometry ||= ::Paperclip::Geometry.from_file(file)
|
28
23
|
end
|
29
24
|
|
30
25
|
protected
|
31
26
|
|
27
|
+
def file
|
28
|
+
@file ||= data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
|
29
|
+
end
|
30
|
+
|
32
31
|
def parameterize_filename
|
33
32
|
unless data_file_name.blank?
|
34
33
|
filename = Ckeditor::Utils.parameterize_filename(data_file_name)
|
@@ -43,12 +42,9 @@ module Ckeditor
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
# Extract content_type from filename using mime/types gem
|
47
45
|
def extract_content_type
|
48
|
-
|
49
|
-
|
50
|
-
self.data_content_type = content_types.first.to_s unless content_types.empty?
|
51
|
-
end
|
46
|
+
path = file.nil? ? nil : file.path
|
47
|
+
self.data_content_type = Utils::ContentTypeDetector.new(path).detect
|
52
48
|
end
|
53
49
|
end
|
54
50
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ckeditor
|
2
|
+
module Backend
|
3
|
+
module Refile
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
validates :data, presence: true
|
8
|
+
delegate :rewind, :download, :to_io, :exists?, :delete, :size, :close, :eof?, :read, to: :data
|
9
|
+
alias_attribute :data_file_name, :data_filename
|
10
|
+
alias_attribute :data_file_size, :data_size
|
11
|
+
end
|
12
|
+
|
13
|
+
class_methods do
|
14
|
+
def attachment_file_types
|
15
|
+
@attachment_file_types ||= Ckeditor.attachment_file_types.map(&:to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
def image_file_types
|
19
|
+
@image_file_types ||= Ckeditor.image_file_types.map(&:to_s)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def url(*attrs)
|
24
|
+
::Refile.attachment_url(self, :data, *attrs)
|
25
|
+
end
|
26
|
+
|
27
|
+
def read_dimensions
|
28
|
+
if model.image? && model.has_dimensions?
|
29
|
+
magick = MiniMagick::Image.open(model.to_io)
|
30
|
+
model.width = magick.width
|
31
|
+
model.height = magick.height
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/ckeditor/engine.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -19,7 +19,10 @@ module Ckeditor
|
|
19
19
|
# action as a symbol (:create, :destroy, etc.). The second argument is the actual model
|
20
20
|
# instance if it is available.
|
21
21
|
def authorize(action, model_object = nil)
|
22
|
-
|
22
|
+
if action
|
23
|
+
@controller.instance_variable_set(:@_authorized, true)
|
24
|
+
@controller.current_ability.authorize!(action.to_sym, model_object)
|
25
|
+
end
|
23
26
|
end
|
24
27
|
|
25
28
|
# This method is called primarily from the view to determine whether the given user
|
File without changes
|
File without changes
|
data/lib/ckeditor/http.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'digest/sha1'
|
3
|
-
require 'mime/types'
|
4
3
|
|
5
4
|
module Ckeditor
|
6
5
|
module Http
|
@@ -61,8 +60,7 @@ module Ckeditor
|
|
61
60
|
end
|
62
61
|
|
63
62
|
def content_type
|
64
|
-
|
65
|
-
types.empty? ? @request.content_type : types.first.to_s
|
63
|
+
@request.content_type
|
66
64
|
end
|
67
65
|
|
68
66
|
def body
|
File without changes
|
data/lib/ckeditor/orm/base.rb
CHANGED
File without changes
|
data/lib/ckeditor/orm/mongoid.rb
CHANGED
File without changes
|
data/lib/ckeditor/paginatable.rb
CHANGED
File without changes
|
data/lib/ckeditor/text_area.rb
CHANGED
@@ -14,6 +14,7 @@ module Ckeditor
|
|
14
14
|
@template = template
|
15
15
|
@options = options.stringify_keys
|
16
16
|
@ck_options = (@options.delete('ckeditor') || {}).stringify_keys
|
17
|
+
@ck_options['customConfig'] ||= Ckeditor.js_config_url if Ckeditor.cdn_enabled?
|
17
18
|
end
|
18
19
|
|
19
20
|
def render_instance_tag(object_name, method)
|
@@ -49,4 +50,4 @@ module Ckeditor
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
52
|
-
end
|
53
|
+
end
|
data/lib/ckeditor/utils.rb
CHANGED
@@ -3,6 +3,9 @@ require 'active_support/json/encoding'
|
|
3
3
|
|
4
4
|
module Ckeditor
|
5
5
|
module Utils
|
6
|
+
autoload :JavascriptCode, 'ckeditor/utils/javascript_code'
|
7
|
+
autoload :ContentTypeDetector, 'ckeditor/utils/content_type_detector'
|
8
|
+
|
6
9
|
class << self
|
7
10
|
def escape_single_quotes(str)
|
8
11
|
str.gsub('\\','\0\0').gsub('</','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
|
@@ -18,16 +21,16 @@ module Ckeditor
|
|
18
21
|
end
|
19
22
|
|
20
23
|
def js_replace(dom_id, options = nil)
|
21
|
-
js = ["if (typeof CKEDITOR != 'undefined') {"]
|
24
|
+
js = ["(function() { if (typeof CKEDITOR != 'undefined') {"]
|
22
25
|
|
23
26
|
if options && !options.keys.empty?
|
24
27
|
js_options = ActiveSupport::JSON.encode(options)
|
25
|
-
js << "CKEDITOR.replace('#{dom_id}', #{js_options});"
|
28
|
+
js << "if (CKEDITOR.instances['#{dom_id}'] == undefined) { CKEDITOR.replace('#{dom_id}', #{js_options}); }"
|
26
29
|
else
|
27
|
-
js << "CKEDITOR.replace('#{dom_id}');"
|
30
|
+
js << "if (CKEDITOR.instances['#{dom_id}'] == undefined) { CKEDITOR.replace('#{dom_id}'); }"
|
28
31
|
end
|
29
32
|
|
30
|
-
js << "}"
|
33
|
+
js << "} else { setTimeout(arguments.callee, 50); } })();"
|
31
34
|
js.join(" ").html_safe
|
32
35
|
end
|
33
36
|
|
@@ -36,17 +39,18 @@ module Ckeditor
|
|
36
39
|
|
37
40
|
case uploader_type.to_s.downcase
|
38
41
|
when "image" then
|
39
|
-
options[:action] = "EDITOR.config.filebrowserImageUploadUrl"
|
42
|
+
options[:action] = JavascriptCode.new("EDITOR.config.filebrowserImageUploadUrl")
|
40
43
|
options[:allowedExtensions] = Ckeditor.image_file_types
|
41
44
|
when "flash" then
|
42
|
-
options[:action] = "EDITOR.config.filebrowserFlashUploadUrl"
|
45
|
+
options[:action] = JavascriptCode.new("EDITOR.config.filebrowserFlashUploadUrl")
|
43
46
|
options[:allowedExtensions] = ["swf"]
|
44
47
|
else
|
45
|
-
options[:action] = "EDITOR.config.filebrowserUploadUrl"
|
48
|
+
options[:action] = JavascriptCode.new("EDITOR.config.filebrowserUploadUrl")
|
46
49
|
options[:allowedExtensions] = Ckeditor.attachment_file_types
|
47
50
|
end
|
48
51
|
|
49
|
-
js_options = ActiveSupport::JSON.encode(options)
|
52
|
+
js_options = ActiveSupport::JSON.encode(options)
|
53
|
+
js_options.gsub!(/"(EDITOR\.config\.filebrowser(Image|Flash|)UploadUrl)"/, '\1')
|
50
54
|
|
51
55
|
"(function() { new qq.FileUploaderInput(#{js_options}); }).call(this);".html_safe
|
52
56
|
end
|
@@ -64,14 +68,15 @@ module Ckeditor
|
|
64
68
|
end
|
65
69
|
|
66
70
|
def select_assets(path, relative_path)
|
67
|
-
relative_folder = Ckeditor.root_path.join
|
68
|
-
folder = relative_folder.join
|
69
|
-
extensions = '*.{js,css,png,gif,jpg
|
71
|
+
relative_folder = Ckeditor.root_path.join(relative_path)
|
72
|
+
folder = relative_folder.join(path)
|
73
|
+
extensions = '*.{js,css,png,gif,jpg}'
|
74
|
+
languages = (Ckeditor.assets_languages || [])
|
70
75
|
|
71
76
|
# Files at root
|
72
77
|
files = Dir[folder.join(extensions)]
|
73
78
|
|
74
|
-
#
|
79
|
+
# Filter plugins
|
75
80
|
if Ckeditor.assets_plugins.nil?
|
76
81
|
files += Dir[folder.join('plugins', '**', extensions)]
|
77
82
|
else
|
@@ -83,22 +88,20 @@ module Ckeditor
|
|
83
88
|
# Other folders
|
84
89
|
Dir[folder.join('*/')].each do |subfolder|
|
85
90
|
path = Pathname.new(subfolder)
|
86
|
-
|
87
|
-
|
88
|
-
end
|
91
|
+
next if ['plugins'].include?(path.basename.to_s)
|
92
|
+
files += Dir[path.join('**', extensions)]
|
89
93
|
end
|
90
94
|
|
91
|
-
|
95
|
+
files.inject([]) do |items, name|
|
96
|
+
file = Pathname.new(name)
|
97
|
+
base = file.basename('.*').to_s
|
92
98
|
|
93
|
-
|
94
|
-
|
95
|
-
paths.select! do |path|
|
96
|
-
path.dirname.basename.to_s != 'lang' ||
|
97
|
-
Ckeditor.assets_languages.include?(path.basename.to_s.split('.')[0])
|
99
|
+
if !name.include?('/lang/') || languages.include?(base)
|
100
|
+
items << file.relative_path_from(relative_folder).to_s
|
98
101
|
end
|
99
|
-
end
|
100
102
|
|
101
|
-
|
103
|
+
items
|
104
|
+
end
|
102
105
|
end
|
103
106
|
end
|
104
107
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'cocaine'
|
3
|
+
|
4
|
+
module Ckeditor
|
5
|
+
module Utils
|
6
|
+
class ContentTypeDetector
|
7
|
+
EMPTY_CONTENT_TYPE = 'inode/x-empty'
|
8
|
+
DEFAULT_CONTENT_TYPE = 'application/octet-stream'
|
9
|
+
|
10
|
+
def initialize(file_path)
|
11
|
+
@file_path = file_path
|
12
|
+
end
|
13
|
+
|
14
|
+
# content type detection strategy:
|
15
|
+
#
|
16
|
+
# 1. empty file: returns 'inode/x-empty'
|
17
|
+
# 2. nonempty file: if the file is not empty then returns the content type using file command
|
18
|
+
# 3. invalid file: file command raises error and returns 'application/octet-stream'
|
19
|
+
|
20
|
+
def detect
|
21
|
+
empty_file? ? EMPTY_CONTENT_TYPE : content_type_from_file_command
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def empty_file?
|
27
|
+
return true if @file_path.blank?
|
28
|
+
File.exists?(@file_path) && File.size(@file_path) == 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def content_type_from_file_command
|
32
|
+
type = begin
|
33
|
+
Cocaine::CommandLine.new('file', '-b --mime-type :file').run(file: @file_path)
|
34
|
+
rescue Cocaine::CommandLineError => e
|
35
|
+
# TODO: log command failure
|
36
|
+
DEFAULT_CONTENT_TYPE
|
37
|
+
end.strip
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/ckeditor/version.rb
CHANGED
@@ -13,7 +13,7 @@ module Ckeditor
|
|
13
13
|
:desc => "Backend processor for upload support"
|
14
14
|
|
15
15
|
class_option :backend, :type => :string, :default => 'paperclip',
|
16
|
-
:desc => "paperclip (default), carrierwave, or dragonfly"
|
16
|
+
:desc => "paperclip (default), carrierwave, refile or dragonfly"
|
17
17
|
|
18
18
|
def self.source_root
|
19
19
|
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
File without changes
|
File without changes
|
data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
-
validates_property :
|
2
|
+
validates_property :ext, :of => :data, :in => attachment_file_types unless attachment_file_types.empty?
|
3
3
|
|
4
4
|
def url_thumb
|
5
5
|
Ckeditor::Utils.filethumb(filename)
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,12 +2,10 @@ class Ckeditor::AttachmentFile < Ckeditor::Asset
|
|
2
2
|
has_attached_file :data,
|
3
3
|
:url => "/ckeditor_assets/attachments/:id/:filename",
|
4
4
|
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
|
5
|
-
|
6
|
-
if respond_to?(:do_not_validate_attachment_file_type)
|
7
|
-
do_not_validate_attachment_file_type :data, if: :data?
|
8
|
-
end
|
9
|
-
validates_attachment_size :data, :less_than => 100.megabytes
|
5
|
+
|
10
6
|
validates_attachment_presence :data
|
7
|
+
validates_attachment_size :data, :less_than => 100.megabytes
|
8
|
+
do_not_validate_attachment_file_type :data
|
11
9
|
|
12
10
|
def url_thumb
|
13
11
|
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
|