glebtv-ckeditor 4.7.3 → 4.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +13 -12
- data/README.md +358 -2
- data/Rakefile +17 -17
- data/app/assets/javascripts/ckeditor/config.js.erb +3 -3
- data/app/controllers/ckeditor/application_controller.rb +3 -0
- data/app/controllers/ckeditor/attachment_files_controller.rb +2 -0
- data/app/controllers/ckeditor/pictures_controller.rb +2 -0
- data/app/helpers/ckeditor/application_helper.rb +2 -0
- data/config/locales/bg.ckeditor.yml +9 -0
- data/config/locales/cs.ckeditor.yml +9 -0
- data/config/locales/da.ckeditor.yml +9 -0
- data/config/locales/de.ckeditor.yml +9 -0
- data/config/locales/el-GR.cdkeditor.yml +9 -0
- data/config/locales/es.ckeditor.yml +9 -0
- data/config/locales/fr.ckeditor.yml +9 -0
- data/config/locales/hu.ckeditor.yml +9 -0
- data/config/locales/it.ckeditor.yml +9 -0
- data/config/locales/ja.ckeditor.yml +9 -0
- data/config/locales/nb.ckeditor.yml +9 -0
- data/config/locales/nl.ckeditor.yml +9 -0
- data/config/locales/pl.ckeditor.yml +9 -0
- data/config/locales/pt-BR.ckeditor.yml +9 -0
- data/config/locales/pt-PT.ckeditor.yml +9 -0
- data/config/locales/pt.ckeditor.yml +9 -0
- data/config/locales/sq.ckeditor.yml +9 -0
- data/config/locales/sv-SE.ckeditor.yml +9 -0
- data/config/locales/tr.ckeditor.yml +9 -0
- data/config/locales/uk.ckeditor.yml +9 -0
- data/config/locales/zh-CN.ckeditor.yml +9 -0
- data/config/locales/zh-TW.ckeditor.yml +9 -0
- data/config/routes.rb +2 -0
- data/lib/ckeditor.rb +13 -16
- data/lib/ckeditor/asset_response.rb +15 -4
- data/lib/ckeditor/backend/active_storage.rb +68 -0
- data/lib/ckeditor/backend/carrierwave.rb +2 -12
- data/lib/ckeditor/backend/dragonfly.rb +2 -0
- data/lib/ckeditor/backend/paperclip.rb +2 -15
- data/lib/ckeditor/backend/shrine.rb +29 -0
- data/lib/ckeditor/helpers/controllers.rb +2 -0
- data/lib/ckeditor/helpers/form_builder.rb +2 -0
- data/lib/ckeditor/helpers/form_helper.rb +2 -0
- data/lib/ckeditor/helpers/view_helper.rb +2 -0
- data/lib/ckeditor/hooks/cancan.rb +4 -1
- data/lib/ckeditor/hooks/formtastic.rb +2 -0
- data/lib/ckeditor/hooks/pundit.rb +2 -0
- data/lib/ckeditor/hooks/simple_form.rb +2 -0
- data/lib/ckeditor/http.rb +8 -5
- data/lib/ckeditor/orm/active_record.rb +2 -0
- data/lib/ckeditor/orm/base.rb +11 -2
- data/lib/ckeditor/orm/mongoid.rb +2 -0
- data/lib/ckeditor/paginatable.rb +2 -0
- data/lib/ckeditor/rails.rb +2 -0
- data/lib/ckeditor/rails_admin/field.rb +16 -3
- data/lib/ckeditor/text_area.rb +2 -0
- data/lib/ckeditor/utils.rb +3 -16
- data/lib/ckeditor/utils/javascript_code.rb +1 -1
- data/lib/ckeditor/version.rb +4 -2
- data/lib/generators/ckeditor/install_generator.rb +16 -19
- data/lib/generators/ckeditor/pundit_policy_generator.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/asset.rb +10 -0
- data/lib/generators/ckeditor/templates/active_record/{refile → active_storage}/ckeditor/attachment_file.rb +3 -1
- data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb +13 -0
- data/lib/generators/ckeditor/templates/active_record/{carrierwave/migration_versioned.rb → active_storage/migration.rb} +8 -5
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +7 -5
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +7 -5
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +2 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +8 -6
- data/lib/generators/ckeditor/templates/active_record/{refile → shrine}/ckeditor/asset.rb +3 -1
- data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/attachment_file.rb +21 -0
- data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/picture.rb +49 -0
- data/lib/generators/ckeditor/templates/active_record/shrine/migration.rb +22 -0
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +2 -1
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +2 -3
- data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +2 -0
- data/lib/generators/ckeditor/templates/base/shrine/initializer.rb +25 -0
- data/lib/generators/ckeditor/templates/ckeditor.rb +3 -6
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +2 -0
- data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/asset.rb +8 -0
- data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb +21 -0
- data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb +47 -0
- data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +2 -0
- data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +2 -0
- data/lib/tasks/ckeditor.rake +2 -0
- data/test/controllers/attachment_files_controller_test.rb +17 -15
- data/test/controllers/pictures_controller_test.rb +17 -15
- data/test/dummy/Rakefile +2 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -2
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/posts_controller.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/app/views/posts/index.html.erb +0 -3
- data/test/dummy/app/views/posts/show.html.erb +3 -0
- data/test/dummy/config.ru +2 -0
- data/test/dummy/config/application.rb +5 -1
- data/test/dummy/config/boot.rb +2 -0
- data/test/dummy/config/environment.rb +2 -0
- data/test/dummy/config/environments/development.rb +2 -0
- data/test/dummy/config/environments/production.rb +2 -0
- data/test/dummy/config/environments/test.rb +5 -3
- data/test/dummy/config/initializers/assets.rb +2 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +2 -0
- data/test/dummy/config/initializers/ckeditor.rb +2 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
- data/test/dummy/config/initializers/inflections.rb +2 -0
- data/test/dummy/config/initializers/mime_types.rb +2 -0
- data/test/dummy/config/initializers/paperclip.rb +2 -0
- data/test/dummy/config/initializers/session_store.rb +2 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/dummy/config/storage.yml +3 -0
- data/test/dummy/db/migrate/20110623120047_create_posts.rb +5 -3
- data/test/dummy/db/migrate/20170806125915_create_active_storage_tables.rb +26 -0
- data/test/dummy/script/rails +2 -0
- data/test/functional/posts_controller_test.rb +18 -16
- data/test/generators/install_generator_test.rb +58 -56
- data/test/integration/navigation_test.rb +2 -0
- data/test/models/attachment_file_test.rb +4 -4
- data/test/models/ckeditor_test.rb +3 -21
- data/test/models/picture_test.rb +12 -10
- data/test/models/utils_test.rb +2 -0
- data/test/orm/active_record.rb +11 -1
- data/test/orm/mongoid.rb +2 -0
- data/test/support/helpers.rb +2 -0
- data/test/support/integration_case.rb +2 -0
- data/test/test_helper.rb +15 -9
- data/vendor/assets/javascripts/ckeditor/CHANGES.md +1404 -859
- data/vendor/assets/javascripts/ckeditor/LICENSE.md +8 -7
- data/vendor/assets/javascripts/ckeditor/README.md +5 -5
- data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +7 -7
- data/vendor/assets/javascripts/ckeditor/build-config.js +12 -6
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +1090 -907
- data/vendor/assets/javascripts/ckeditor/config.js +2 -2
- data/vendor/assets/javascripts/ckeditor/contents.css +7 -7
- 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 +7 -7
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +5 -5
- 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 +11 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.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/images/autocomplete.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/autoformat.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/commentselectedrange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/searchcode.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/uncommentselectedrange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -2
- 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 -6
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
- 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 +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +236 -218
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +51 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +37 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +42 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/nord.css +42 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +0 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yonce.css +59 -0
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +12 -12
- data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/dialog/styles/dialog.css +18 -0
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -8
- data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +23 -23
- data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +17 -17
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +7 -7
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +17 -16
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +7 -6
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +9 -9
- 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 +9 -8
- data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +1271 -44
- data/vendor/assets/javascripts/ckeditor/plugins/image/icons/hidpi/image.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/icons/image.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/lang/en.js +25 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/lang/ru.js +25 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/plugin.js +184 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +35 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +339 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +553 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/image.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/en.js +21 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +21 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/plugin.js +1783 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +69 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +27 -25
- data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +8 -8
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/fr.js +8 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +41 -51
- data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/common.js +22 -0
- data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/image.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/preview/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/preview/styles/screen.css +10 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +1 -17
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +63 -7
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -33
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +12 -12
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +10 -10
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +8 -7
- data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +20 -19
- data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +16 -15
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
- data/vendor/assets/javascripts/ckeditor/{samples/toolbarconfigurator/lib/codemirror/LICENSE → plugins/wordcount/LICENSE.md} +21 -19
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/README.md +106 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +475 -378
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/maxParagraphs.html +26 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +62 -7
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +82 -82
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +15 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/README.md +156 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +8 -7
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +3 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +5 -5
- data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +2 -2
- data/vendor/assets/javascripts/ckeditor/styles.js +4 -4
- data/vendor/assets/javascripts/ckeditor/vendor/promise.js +13 -0
- metadata +143 -138
- data/lib/ckeditor/backend/refile.rb +0 -39
- data/lib/ckeditor/utils/content_type_detector.rb +0 -38
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration_versioned.rb +0 -23
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration_versioned.rb +0 -23
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +0 -11
- data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +0 -23
- data/lib/generators/ckeditor/templates/active_record/refile/migration_versioned.rb +0 -23
- data/test/support/raw_post.rb +0 -9
- data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -169
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +0 -3
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +0 -7
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +0 -7
- data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +0 -929
- data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +0 -1632
- data/vendor/assets/javascripts/ckeditor/samples/img/github-top.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/header-bg.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/header-separator.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/navigation-tip.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/index.html +0 -128
- data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +0 -53
- data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +0 -17
- data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +0 -85
- data/vendor/assets/javascripts/ckeditor/samples/old/api.html +0 -210
- data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +0 -59
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +0 -204
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +0 -59
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/sample.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +0 -7
- data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +0 -508
- data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +0 -48
- data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +0 -190
- data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +0 -144
- data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +0 -106
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/swfobject.js +0 -19
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +0 -283
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +0 -224
- data/vendor/assets/javascripts/ckeditor/samples/old/index.html +0 -131
- data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +0 -314
- data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +0 -124
- data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +0 -113
- data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +0 -103
- data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +0 -209
- data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +0 -76
- data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +0 -60
- data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +0 -59
- data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +0 -357
- data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +0 -50
- data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +0 -16
- data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +0 -78
- data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +0 -235
- data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +0 -72
- data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +0 -122
- data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +0 -80
- data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +0 -234
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/css/fontello.css +0 -55
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +0 -10
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/config.json +0 -28
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.svg +0 -14
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +0 -446
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +0 -13
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +0 -9
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +0 -33
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +0 -14
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +0 -325
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +0 -288
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +0 -25
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +0 -36
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css +0 -38
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2ceee960c9a284ebcf8086c7c9b2442d0a6946862344f3ae80a2f00ecc952a4f
|
4
|
+
data.tar.gz: a340d36b03217366a817b91cdece0f997eff9b4599cb5d889995eb81868cdf48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3d303846ed8ffa00b73a39acf956a9780cad943ede37c7435656f377e77c6d2f79fcfe398bc64fdffda3718b01f2cc3c6a14f51d1e2a38aaa1fdaa67c78db9
|
7
|
+
data.tar.gz: 9d74b6c9c27762e70f218fd09e4b7b68faf803b8a264f673b742bfcd02bd75071213403432a0aa2cd20b65c3bb809e430529272355cf86ac427889618e533057
|
data/Gemfile
CHANGED
@@ -1,35 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'http://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
gem 'rails', '
|
7
|
+
gem 'rails', '5.2.2.1'
|
6
8
|
|
7
9
|
platforms :ruby do
|
8
|
-
gem 'sqlite3'
|
9
10
|
gem 'sass'
|
10
|
-
|
11
|
-
group :development do
|
12
|
-
gem 'unicorn', '~> 4.0.1'
|
13
|
-
end
|
11
|
+
gem 'sqlite3', '~> 1.3.6'
|
14
12
|
|
15
13
|
group :development, :test do
|
16
|
-
gem 'jquery-rails', '~> 4.0.4'
|
17
14
|
gem 'capybara', '>= 0.4.0'
|
15
|
+
gem 'jquery-rails', '~> 4.3.3'
|
18
16
|
gem 'mynyml-redgreen', '~> 0.7.1', require: 'redgreen'
|
17
|
+
gem 'rails-controller-testing'
|
19
18
|
end
|
20
19
|
|
21
20
|
group :active_record do
|
22
|
-
gem 'paperclip'
|
23
21
|
gem 'carrierwave'
|
24
22
|
gem 'dragonfly'
|
25
23
|
gem 'mini_magick'
|
26
|
-
gem '
|
27
|
-
gem 'refile-mini_magick'
|
24
|
+
gem 'paperclip', '~> 6.1.0'
|
28
25
|
end
|
29
26
|
|
30
27
|
group :mongoid do
|
31
|
-
gem '
|
32
|
-
gem 'mongoid-paperclip', require: 'mongoid_paperclip'
|
28
|
+
gem 'bson_ext'
|
33
29
|
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
|
30
|
+
gem 'mongoid', '~> 7.0.2'
|
31
|
+
gem 'mongoid-paperclip', require: 'mongoid_paperclip'
|
32
|
+
gem 'shrine'
|
33
|
+
gem 'shrine-mongoid'
|
34
|
+
gem 'image_processing'
|
34
35
|
end
|
35
36
|
end
|
data/README.md
CHANGED
@@ -1,3 +1,359 @@
|
|
1
|
-
#
|
1
|
+
# Ckeditor
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://semaphoreci.com/api/v1/igor-galeta/ckeditor/branches/master/shields_badge.svg)](https://semaphoreci.com/igor-galeta/ckeditor)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/galetahub/ckeditor/badges/gpa.svg)](https://codeclimate.com/github/galetahub/ckeditor)
|
5
|
+
|
6
|
+
CKEditor is a WYSIWYG text editor designed to simplify web content creation. It brings common word processing features directly to your web pages. Enhance your website experience with our community maintained editor. Currently this gem supports [ckeditor 4](https://ckeditor.com/ckeditor-4/) only.
|
7
|
+
|
8
|
+
## Features
|
9
|
+
|
10
|
+
* CKEditor version 4.x (https://ckeditor.com/ckeditor-4/)
|
11
|
+
* Rails 5.x, 4.2.x integration
|
12
|
+
* Files browser
|
13
|
+
* HTML5 file uploader
|
14
|
+
* Hooks for formtastic and simple_form forms generators
|
15
|
+
* Integrated with authorization frameworks [CanCanCan](https://github.com/CanCanCommunity/cancancan) and [Pundit](https://github.com/varvet/pundit)
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
For basic usage just include the ckeditor gem:
|
20
|
+
|
21
|
+
```
|
22
|
+
gem 'ckeditor'
|
23
|
+
```
|
24
|
+
|
25
|
+
or if you'd like to use the latest version from Github:
|
26
|
+
|
27
|
+
```
|
28
|
+
gem 'ckeditor', github: 'galetahub/ckeditor'
|
29
|
+
```
|
30
|
+
|
31
|
+
The last version works with Rails 3.2.x is 4.1.3
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
gem 'ckeditor', '4.1.3'
|
35
|
+
```
|
36
|
+
|
37
|
+
Include this inside your `config/initializers/assets.rb`:
|
38
|
+
|
39
|
+
```
|
40
|
+
Rails.application.config.assets.precompile += %w[ckeditor/config.js]
|
41
|
+
```
|
42
|
+
|
43
|
+
For file upload support, you must generate the necessary file storage models.
|
44
|
+
The currently supported backends are:
|
45
|
+
|
46
|
+
* ActiveRecord (paperclip, carrierwave, dragonfly)
|
47
|
+
* Mongoid (paperclip, carrierwave, dragonfly)
|
48
|
+
|
49
|
+
### How to generate models to store uploaded files
|
50
|
+
|
51
|
+
#### ActiveRecord + paperclip
|
52
|
+
|
53
|
+
To use the active_record orm with paperclip (i.e. the default settings):
|
54
|
+
|
55
|
+
```
|
56
|
+
gem 'paperclip'
|
57
|
+
|
58
|
+
rails generate ckeditor:install --orm=active_record --backend=paperclip
|
59
|
+
```
|
60
|
+
|
61
|
+
#### ActiveRecord + active_storage
|
62
|
+
|
63
|
+
```
|
64
|
+
gem "mini_magick"
|
65
|
+
|
66
|
+
rails active_storage:install # if you not install active_storage yet
|
67
|
+
rails generate ckeditor:install --orm=active_record --backend=active_storage
|
68
|
+
```
|
69
|
+
|
70
|
+
#### ActiveRecord + carrierwave
|
71
|
+
|
72
|
+
```
|
73
|
+
gem 'carrierwave'
|
74
|
+
gem 'mini_magick'
|
75
|
+
|
76
|
+
rails generate ckeditor:install --orm=active_record --backend=carrierwave
|
77
|
+
```
|
78
|
+
|
79
|
+
#### ActiveRecord + dragonfly
|
80
|
+
|
81
|
+
Requires Dragonfly 1.0 or greater.
|
82
|
+
|
83
|
+
```
|
84
|
+
gem 'dragonfly'
|
85
|
+
|
86
|
+
rails generate ckeditor:install --orm=active_record --backend=dragonfly
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Mongoid + paperclip
|
90
|
+
|
91
|
+
```
|
92
|
+
gem 'mongoid-paperclip', require: 'mongoid_paperclip'
|
93
|
+
|
94
|
+
rails generate ckeditor:install --orm=mongoid --backend=paperclip
|
95
|
+
```
|
96
|
+
|
97
|
+
#### Mongoid + active_storage
|
98
|
+
|
99
|
+
Active Storage support **only** Active Record, see for [more info](https://github.com/rails/rails/issues/31408#issuecomment-351128111)
|
100
|
+
|
101
|
+
#### Mongoid + carrierwave
|
102
|
+
|
103
|
+
```
|
104
|
+
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
|
105
|
+
gem 'mini_magick'
|
106
|
+
|
107
|
+
rails generate ckeditor:install --orm=mongoid --backend=carrierwave
|
108
|
+
```
|
109
|
+
|
110
|
+
#### Load generated models
|
111
|
+
|
112
|
+
All ckeditor models will be generated in the app/models/ckeditor directory.
|
113
|
+
Models are autoloaded in Rails 4. For earlier Rails versions, you need to add them to the autoload path (in application.rb):
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
config.autoload_paths += %w(#{config.root}/app/models/ckeditor)
|
117
|
+
```
|
118
|
+
|
119
|
+
Mount the Ckeditor::Engine in your routes (config/routes.rb):
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
mount Ckeditor::Engine => '/ckeditor'
|
123
|
+
```
|
124
|
+
|
125
|
+
## Usage
|
126
|
+
|
127
|
+
### Load editor via CKEditor CDN
|
128
|
+
|
129
|
+
Setup editor version to load (more info here http://cdn.ckeditor.com/)
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
# in config/initializers/ckeditor.rb
|
133
|
+
|
134
|
+
Ckeditor.setup do |config|
|
135
|
+
# //cdn.ckeditor.com/<version.number>/<distribution>/ckeditor.js
|
136
|
+
config.cdn_url = "//cdn.ckeditor.com/4.6.1/basic/ckeditor.js"
|
137
|
+
end
|
138
|
+
```
|
139
|
+
|
140
|
+
In view template include ckeditor CDN:
|
141
|
+
|
142
|
+
```slim
|
143
|
+
= javascript_include_tag Ckeditor.cdn_url
|
144
|
+
```
|
145
|
+
|
146
|
+
Precompile ckeditor/config.js:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
# in config/initializers/assets.rb
|
150
|
+
|
151
|
+
Rails.application.config.assets.precompile += %w[ckeditor/config.js]
|
152
|
+
```
|
153
|
+
|
154
|
+
### Form helpers
|
155
|
+
|
156
|
+
```slim
|
157
|
+
= form_for @page do |form|
|
158
|
+
= form.cktext_area :notes, class: 'someclass', ckeditor: { language: 'uk'}
|
159
|
+
= form.cktext_area :content, value: 'Default value', id: 'sometext'
|
160
|
+
= cktext_area :page, :info, cols: 40, ckeditor: { uiColor: '#AADC6E', toolbar: 'mini' }
|
161
|
+
```
|
162
|
+
|
163
|
+
*It also works with bootstrap-form*
|
164
|
+
|
165
|
+
```slim
|
166
|
+
= bootstrap_form_for resource do |form|
|
167
|
+
= form.cktext_area :text, ckeditor: { language: 'uk'}
|
168
|
+
```
|
169
|
+
|
170
|
+
### Customize ckeditor
|
171
|
+
|
172
|
+
All ckeditor options can be found [here](http://docs.ckeditor.com/#!/api/CKEDITOR.config)
|
173
|
+
|
174
|
+
In order to configure the ckeditor default options, create the following files:
|
175
|
+
|
176
|
+
```
|
177
|
+
app/assets/javascripts/ckeditor/config.js
|
178
|
+
|
179
|
+
app/assets/javascripts/ckeditor/contents.css
|
180
|
+
```
|
181
|
+
|
182
|
+
#### Custom toolbars example
|
183
|
+
|
184
|
+
Adding a custom toolbar:
|
185
|
+
|
186
|
+
```javascript
|
187
|
+
# in app/assets/javascripts/ckeditor/config.js
|
188
|
+
|
189
|
+
CKEDITOR.editorConfig = function (config) {
|
190
|
+
// ... other configuration ...
|
191
|
+
|
192
|
+
config.toolbar_mini = [
|
193
|
+
["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
|
194
|
+
];
|
195
|
+
config.toolbar = "mini";
|
196
|
+
|
197
|
+
// ... rest of the original config.js ...
|
198
|
+
}
|
199
|
+
```
|
200
|
+
|
201
|
+
When overriding the default `config.js` file, you must set all configuration options yourself as the bundled `config.js` will not be loaded. To see the default configuration, run `bundle open ckeditor`, copy `app/assets/javascripts/ckeditor/config.js` into your project and customize it to your needs.
|
202
|
+
|
203
|
+
#### Install additional plugins
|
204
|
+
|
205
|
+
You should download necessary plugins with all dependencies and extract them in `app/assets/javascripts/ckeditor/plugins/`.
|
206
|
+
After that you can include your plugins in `app/assets/javascripts/ckeditor/config.js` in this way:
|
207
|
+
|
208
|
+
```javascript
|
209
|
+
CKEDITOR.editorConfig = function (config) {
|
210
|
+
config.extraPlugins = 'eqneditor,autosave,';
|
211
|
+
}
|
212
|
+
```
|
213
|
+
|
214
|
+
### AJAX
|
215
|
+
|
216
|
+
jQuery sample:
|
217
|
+
|
218
|
+
```html
|
219
|
+
<script type='text/javascript' charset='UTF-8'>
|
220
|
+
$(document).ready(function(){
|
221
|
+
$('form[data-remote]').bind('ajax:before', function(){
|
222
|
+
for (instance in CKEDITOR.instances){
|
223
|
+
CKEDITOR.instances[instance].updateElement();
|
224
|
+
}
|
225
|
+
});
|
226
|
+
});
|
227
|
+
</script>
|
228
|
+
```
|
229
|
+
|
230
|
+
### Formtastic integration
|
231
|
+
|
232
|
+
```slim
|
233
|
+
= form.input :content, as: :ckeditor
|
234
|
+
= form.input :content, as: :ckeditor, input_html: { ckeditor: { height: 400 } }
|
235
|
+
```
|
236
|
+
|
237
|
+
### SimpleForm integration
|
238
|
+
Note that the toolbar option should match the case specified in the config. If the config is not found it defaults to all available toolbar items.
|
239
|
+
|
240
|
+
i.e. config.toolbar_mini becomes {toolbar: 'mini'} in the form.
|
241
|
+
|
242
|
+
```slim
|
243
|
+
= form.input :content, as: :ckeditor, input_html: { ckeditor: { toolbar: 'Full' } }
|
244
|
+
```
|
245
|
+
|
246
|
+
### Turbolink integration
|
247
|
+
Create a file app/assets/javascripts/init_ckeditor.coffee
|
248
|
+
|
249
|
+
```coffee
|
250
|
+
ready = ->
|
251
|
+
$('.ckeditor').each ->
|
252
|
+
CKEDITOR.replace $(this).attr('id')
|
253
|
+
|
254
|
+
$(document).ready(ready)
|
255
|
+
$(document).on('page:load', ready)
|
256
|
+
```
|
257
|
+
Make sure the file is loaded from your app/assets/javascripts/application.js
|
258
|
+
|
259
|
+
### CanCanCan integration
|
260
|
+
|
261
|
+
To use cancan with Ckeditor, add this to an initializer:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
# in config/initializers/ckeditor.rb
|
265
|
+
|
266
|
+
Ckeditor.setup do |config|
|
267
|
+
config.authorize_with :cancancan
|
268
|
+
end
|
269
|
+
```
|
270
|
+
|
271
|
+
At this point, all authorization will fail and no one will be able to access the filebrowser pages.
|
272
|
+
To grant access, add the following abilities (usually `ability.rb`)
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
# Always performed
|
276
|
+
can :access, :ckeditor # needed to access Ckeditor filebrowser
|
277
|
+
|
278
|
+
# Performed checks for actions:
|
279
|
+
can [:read, :create, :destroy], Ckeditor::Picture
|
280
|
+
can [:read, :create, :destroy], Ckeditor::AttachmentFile
|
281
|
+
```
|
282
|
+
|
283
|
+
### Pundit integration
|
284
|
+
|
285
|
+
Just like CanCanCan, you can write this code in your config/initializers/ckeditor.rb file:
|
286
|
+
|
287
|
+
```ruby
|
288
|
+
Ckeditor.setup do |config|
|
289
|
+
config.authorize_with :pundit
|
290
|
+
end
|
291
|
+
```
|
292
|
+
|
293
|
+
Then, generate the policy files for model **Picture** and **AttachmentFile**
|
294
|
+
|
295
|
+
```
|
296
|
+
$ rails g ckeditor:pundit_policy
|
297
|
+
```
|
298
|
+
By this command, you will got two files:
|
299
|
+
> app/policies/ckeditor/picture_policy.rb
|
300
|
+
app/policies/ckeditor/attachment_file_policy.rb
|
301
|
+
|
302
|
+
By default, only the user that logged in can access the models (with actions *index* and *create*) and only the owner of the asset can **destroy** the resource.
|
303
|
+
|
304
|
+
You can customize these two policy files as you like.
|
305
|
+
|
306
|
+
## Engine configuration
|
307
|
+
|
308
|
+
* To override the default CKEditor routes create a [config.js](https://github.com/galetahub/ckeditor/blob/master/app/assets/javascripts/ckeditor/config.js) file within the host application at `app/assets/javascripts/ckeditor/config.js`
|
309
|
+
|
310
|
+
* By default, the engine inherits from `ApplicationController`. To override the default parent controller:
|
311
|
+
```
|
312
|
+
# in config/initializers/ckeditor.rb
|
313
|
+
|
314
|
+
Ckeditor.setup do |config|
|
315
|
+
config.parent_controller = 'MyCKEditorBaseController'
|
316
|
+
end
|
317
|
+
```
|
318
|
+
|
319
|
+
Based on this, if you want to secure CKEditor controller actions and you can't authenticate in ApplicationController, you could do so with a custom controller after configuring the override above, like so:
|
320
|
+
|
321
|
+
```
|
322
|
+
class MyCKEditorBaseController < ActionController::Base
|
323
|
+
|
324
|
+
before_action :authenticate_user! # or some other auth/permission logic here, like Pundit
|
325
|
+
|
326
|
+
end
|
327
|
+
```
|
328
|
+
|
329
|
+
## I18n
|
330
|
+
|
331
|
+
```yml
|
332
|
+
en:
|
333
|
+
ckeditor:
|
334
|
+
page_title: 'CKEditor Files Manager'
|
335
|
+
confirm_delete: 'Delete file?'
|
336
|
+
buttons:
|
337
|
+
cancel: 'Cancel'
|
338
|
+
upload: 'Upload'
|
339
|
+
delete: 'Delete'
|
340
|
+
next: 'Next'
|
341
|
+
```
|
342
|
+
|
343
|
+
## Tests
|
344
|
+
|
345
|
+
```bash
|
346
|
+
$> rake test CKEDITOR_BACKEND=paperclip
|
347
|
+
$> rake test CKEDITOR_BACKEND=active_storage
|
348
|
+
$> rake test CKEDITOR_BACKEND=carrierwave
|
349
|
+
$> rake test CKEDITOR_BACKEND=dragonfly
|
350
|
+
$> rake test CKEDITOR_BACKEND=shrine
|
351
|
+
$> rake test CKEDITOR_ORM=mongoid
|
352
|
+
|
353
|
+
$> rake test:controllers
|
354
|
+
$> rake test:generators
|
355
|
+
$> rake test:integration
|
356
|
+
$> rake test:models
|
357
|
+
```
|
358
|
+
|
359
|
+
This project rocks and uses the MIT-LICENSE.
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'rubygems'
|
3
4
|
begin
|
4
5
|
require 'bundler/setup'
|
@@ -7,58 +8,57 @@ rescue LoadError
|
|
7
8
|
end
|
8
9
|
|
9
10
|
require 'rake'
|
10
|
-
require 'rdoc/task'
|
11
|
-
require 'bundler/gem_tasks'
|
12
11
|
require 'rake/testtask'
|
13
12
|
|
13
|
+
require 'bundler/gem_tasks'
|
14
|
+
|
15
|
+
task default: :test
|
16
|
+
|
14
17
|
Rake::TestTask.new(:test) do |t|
|
15
18
|
t.libs << 'lib'
|
16
19
|
t.libs << 'test'
|
17
20
|
t.pattern = 'test/**/*_test.rb'
|
18
21
|
t.verbose = false
|
22
|
+
t.warning = false
|
19
23
|
end
|
20
24
|
|
21
|
-
Rake::TestTask.new(
|
25
|
+
Rake::TestTask.new('test:controllers') do |t|
|
22
26
|
t.libs << 'lib'
|
23
27
|
t.libs << 'test'
|
24
28
|
t.pattern = 'test/controllers/*_test.rb'
|
25
29
|
t.verbose = false
|
30
|
+
t.warning = false
|
26
31
|
end
|
27
32
|
|
28
|
-
Rake::TestTask.new(
|
33
|
+
Rake::TestTask.new('test:generators') do |t|
|
29
34
|
t.libs << 'lib'
|
30
35
|
t.libs << 'test'
|
31
36
|
t.pattern = 'test/generators/*_test.rb'
|
32
37
|
t.verbose = false
|
38
|
+
t.warning = false
|
33
39
|
end
|
34
40
|
|
35
|
-
Rake::TestTask.new(
|
41
|
+
Rake::TestTask.new('test:integration') do |t|
|
36
42
|
t.libs << 'lib'
|
37
43
|
t.libs << 'test'
|
38
44
|
t.pattern = 'test/integration/*_test.rb'
|
39
45
|
t.verbose = false
|
46
|
+
t.warning = false
|
40
47
|
end
|
41
48
|
|
42
|
-
Rake::TestTask.new(
|
49
|
+
Rake::TestTask.new('test:models') do |t|
|
43
50
|
t.libs << 'lib'
|
44
51
|
t.libs << 'test'
|
45
52
|
t.pattern = 'test/models/*_test.rb'
|
46
53
|
t.verbose = false
|
54
|
+
t.warning = false
|
47
55
|
end
|
48
56
|
|
49
|
-
Rake::TestTask.new(
|
57
|
+
Rake::TestTask.new('test:functional') do |t|
|
50
58
|
t.libs << 'lib'
|
51
59
|
t.libs << 'test'
|
52
60
|
t.pattern = 'test/functional/*_test.rb'
|
53
61
|
t.verbose = false
|
62
|
+
t.warning = false
|
54
63
|
end
|
55
64
|
|
56
|
-
task :default => :test
|
57
|
-
|
58
|
-
RDoc::Task.new do |rdoc|
|
59
|
-
rdoc.rdoc_dir = 'rdoc'
|
60
|
-
rdoc.title = 'Ckeditor'
|
61
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
62
|
-
rdoc.rdoc_files.include('README.rdoc')
|
63
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
64
|
-
end
|