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
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,923 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @fileOverview The "Notification" plugin.
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
CKEDITOR.plugins.add( 'notification', {
|
14
|
+
lang: 'cs,da,de,de-ch,en,eo,eu,fr,gl,id,it,ko,ku,nb,nl,pl,pt-br,ru,sv,tr,ug,uk,zh,zh-cn', // %REMOVE_LINE_CORE%
|
15
|
+
requires: 'toolbar',
|
16
|
+
|
17
|
+
init: function( editor ) {
|
18
|
+
editor._.notificationArea = new Area( editor );
|
19
|
+
|
20
|
+
// Overwrites default `editor.showNotification`.
|
21
|
+
editor.showNotification = function( message, type, progressOrDuration ) {
|
22
|
+
var progress, duration;
|
23
|
+
|
24
|
+
if ( type == 'progress' ) {
|
25
|
+
progress = progressOrDuration;
|
26
|
+
} else {
|
27
|
+
duration = progressOrDuration;
|
28
|
+
}
|
29
|
+
|
30
|
+
var notification = new CKEDITOR.plugins.notification( editor, {
|
31
|
+
message: message,
|
32
|
+
type: type,
|
33
|
+
progress: progress,
|
34
|
+
duration: duration
|
35
|
+
} );
|
36
|
+
|
37
|
+
notification.show();
|
38
|
+
|
39
|
+
return notification;
|
40
|
+
};
|
41
|
+
|
42
|
+
// Close the last notification on ESC.
|
43
|
+
editor.on( 'key', function( evt ) {
|
44
|
+
if ( evt.data.keyCode == 27 ) { /* ESC */
|
45
|
+
var notifications = editor._.notificationArea.notifications;
|
46
|
+
|
47
|
+
if ( !notifications.length ) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
// As long as this is not a common practice to inform screen-reader users about actions, in this case
|
52
|
+
// this is the best solution (unfortunately there is no standard for accessibility for notifications).
|
53
|
+
// Notification has an `alert` aria role what means that it does not get a focus nor is needed to be
|
54
|
+
// closed (unlike `alertdialog`). However notification will capture ESC key so we need to inform user
|
55
|
+
// why it does not do other actions.
|
56
|
+
say( editor.lang.notification.closed );
|
57
|
+
|
58
|
+
// Hide last.
|
59
|
+
notifications[ notifications.length - 1 ].hide();
|
60
|
+
|
61
|
+
evt.cancel();
|
62
|
+
}
|
63
|
+
} );
|
64
|
+
|
65
|
+
// Send the message to the screen readers.
|
66
|
+
function say( text ) {
|
67
|
+
var message = new CKEDITOR.dom.element( 'div' );
|
68
|
+
message.setStyles( {
|
69
|
+
position: 'fixed',
|
70
|
+
'margin-left': '-9999px'
|
71
|
+
} );
|
72
|
+
message.setAttributes( {
|
73
|
+
'aria-live': 'assertive',
|
74
|
+
'aria-atomic': 'true'
|
75
|
+
} );
|
76
|
+
message.setText( text );
|
77
|
+
|
78
|
+
CKEDITOR.document.getBody().append( message );
|
79
|
+
|
80
|
+
setTimeout( function() {
|
81
|
+
message.remove();
|
82
|
+
}, 100 );
|
83
|
+
}
|
84
|
+
}
|
85
|
+
} );
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Notification class. Notifications are used to display short messages to the user. They might be used to show the result of
|
89
|
+
* asynchronous actions or information about changes in the editor content. It is recommended to use them instead of
|
90
|
+
* alert dialogs. They should **not** be used if a user response is required nor with dialog windows (e.g. in dialog validation).
|
91
|
+
*
|
92
|
+
* There are four types of notifications available, see the {@link #type} property.
|
93
|
+
*
|
94
|
+
* Note that the notification constructor only creates a notification instance. To show it, use the {@link #show} method:
|
95
|
+
*
|
96
|
+
* var notification = new CKEDITOR.plugins.notification( editor, { message: 'Foo' } );
|
97
|
+
* notification.show();
|
98
|
+
*
|
99
|
+
* You can also use the {@link CKEDITOR.editor#showNotification} method:
|
100
|
+
*
|
101
|
+
* editor.showNotification( 'Foo' );
|
102
|
+
*
|
103
|
+
* All of the notification actions: ({@link #show}, {@link #update} and {@link #hide}) fire cancelable events
|
104
|
+
* on the related {@link CKEDITOR.editor} instance so you can integrate editor notifications with your website notifications.
|
105
|
+
*
|
106
|
+
* Refer to the [Notifications](http://docs.ckeditor.com/#!/guide/dev_notifications) article for more information about this feature.
|
107
|
+
*
|
108
|
+
* @since 4.5
|
109
|
+
* @class CKEDITOR.plugins.notification
|
110
|
+
* @constructor Create a notification object. Call {@link #show} to show the created notification.
|
111
|
+
* @param {CKEDITOR.editor} editor The editor instance.
|
112
|
+
* @param {Object} options
|
113
|
+
* @param {String} options.message The message displayed in the notification.
|
114
|
+
* @param {String} [options.type='info'] Notification type, see {@link #type}.
|
115
|
+
* @param {Number} [options.progress=0] If the type is `progress` this may be a progress from 0 to 1.
|
116
|
+
* @param {Number} [options.duration] How long the notification will be visible, see {@link #duration}.
|
117
|
+
*/
|
118
|
+
function Notification( editor, options ) {
|
119
|
+
CKEDITOR.tools.extend( this, options, {
|
120
|
+
editor: editor,
|
121
|
+
id: 'cke-' + CKEDITOR.tools.getUniqueId(),
|
122
|
+
area: editor._.notificationArea
|
123
|
+
} );
|
124
|
+
|
125
|
+
if ( !options.type ) {
|
126
|
+
this.type = 'info';
|
127
|
+
}
|
128
|
+
|
129
|
+
this.element = this._createElement();
|
130
|
+
|
131
|
+
// Don't allow dragging on notification (#13184).
|
132
|
+
editor.plugins.clipboard && CKEDITOR.plugins.clipboard.preventDefaultDropOnElement( this.element );
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* The editor instance.
|
137
|
+
*
|
138
|
+
* @readonly
|
139
|
+
* @property {CKEDITOR.editor} editor
|
140
|
+
*/
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Message displayed in the notification.
|
144
|
+
*
|
145
|
+
* @readonly
|
146
|
+
* @property {String} message
|
147
|
+
*/
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Notification type. There are four types available:
|
151
|
+
*
|
152
|
+
* * `info` (default) – Information for the user (e.g. "File is uploading.", "ACF modified content."),
|
153
|
+
* * `warning` – Warning or error message (e.g. "This type of file is not supported.",
|
154
|
+
* "You cannot paste the script."),
|
155
|
+
* * `success` – Information that an operation finished successfully (e.g. "File uploaded.", "Data imported.").
|
156
|
+
* * `progress` – Information about the progress of an operation. When the operation is done, the notification
|
157
|
+
* type should be changed to `success`.
|
158
|
+
*
|
159
|
+
* @readonly
|
160
|
+
* @property {String} type
|
161
|
+
*/
|
162
|
+
|
163
|
+
/**
|
164
|
+
* If the notification {@link #type} is `'progress'`, this is the progress from `0` to `1`.
|
165
|
+
*
|
166
|
+
* @readonly
|
167
|
+
* @property {Number} progress
|
168
|
+
*/
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Notification duration. Determines after how many milliseconds the notification should close automatically.
|
172
|
+
* `0` means that the notification will not close automatically and that the user needs to close it manually.
|
173
|
+
* The default value for `warning` and `progress` notifications is `0`. For `info` and `success` the value can
|
174
|
+
* either be set through the {@link CKEDITOR.config#notification_duration} configuration option or equals `5000`
|
175
|
+
* if the configuration option is not set.
|
176
|
+
*
|
177
|
+
* @readonly
|
178
|
+
* @property {Number} duration
|
179
|
+
*/
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Unique notification ID.
|
183
|
+
*
|
184
|
+
* @readonly
|
185
|
+
* @property {Number} id
|
186
|
+
*/
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Notification DOM element. There is one element per notification. It is created when the notification is created,
|
190
|
+
* even if it is not shown. If the notification is hidden, the element is detached from the document but not deleted.
|
191
|
+
* It will be reused if the notification is shown again.
|
192
|
+
*
|
193
|
+
* @readonly
|
194
|
+
* @property {CKEDITOR.dom.element} element
|
195
|
+
*/
|
196
|
+
|
197
|
+
/**
|
198
|
+
* {@link CKEDITOR.plugins.notification.area Notification area} reference.
|
199
|
+
*
|
200
|
+
* @readonly
|
201
|
+
* @property {CKEDITOR.plugins.notification.area} area
|
202
|
+
*/
|
203
|
+
|
204
|
+
Notification.prototype = {
|
205
|
+
/**
|
206
|
+
* Adds the notification element to the notification area. The notification will be hidden automatically if
|
207
|
+
* {@link #duration} is set.
|
208
|
+
*
|
209
|
+
* Fires the {@link CKEDITOR.editor#notificationShow} event.
|
210
|
+
*/
|
211
|
+
show: function() {
|
212
|
+
if ( this.editor.fire( 'notificationShow', { notification: this } ) === false ) {
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
|
216
|
+
this.area.add( this );
|
217
|
+
|
218
|
+
this._hideAfterTimeout();
|
219
|
+
},
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Updates the notification object and element.
|
223
|
+
*
|
224
|
+
* Fires the {@link CKEDITOR.editor#notificationUpdate} event.
|
225
|
+
*
|
226
|
+
* @param {Object} options
|
227
|
+
* @param {String} [options.message] {@link #message}
|
228
|
+
* @param {String} [options.type] {@link #type}
|
229
|
+
* @param {Number} [options.progress] {@link #progress}
|
230
|
+
* @param {Number} [options.duration] {@link #duration}
|
231
|
+
* @param {Boolean} [options.important=false] If the update is important, the notification will be shown
|
232
|
+
* if it was hidden and read by screen readers.
|
233
|
+
*/
|
234
|
+
update: function( options ) {
|
235
|
+
var show = true;
|
236
|
+
|
237
|
+
if ( this.editor.fire( 'notificationUpdate', { notification: this, options: options } ) === false ) {
|
238
|
+
// The idea of cancelable event is to let user create his own way of displaying notification, so if
|
239
|
+
// `notificationUpdate` event will be canceled there will be no interaction with notification area, but on
|
240
|
+
// the other hand the logic should work anyway so object will be updated (including `element` property).
|
241
|
+
// Note: we can safely update the element's attributes below, because this element is created inside
|
242
|
+
// the constructor. If the notificatinShow event was canceled as well, the element is detached from DOM.
|
243
|
+
show = false;
|
244
|
+
}
|
245
|
+
|
246
|
+
var element = this.element,
|
247
|
+
messageElement = element.findOne( '.cke_notification_message' ),
|
248
|
+
progressElement = element.findOne( '.cke_notification_progress' ),
|
249
|
+
type = options.type;
|
250
|
+
|
251
|
+
element.removeAttribute( 'role' );
|
252
|
+
|
253
|
+
// Change type to progress if `options.progress` is set.
|
254
|
+
if ( options.progress && this.type != 'progress' ) {
|
255
|
+
type = 'progress';
|
256
|
+
}
|
257
|
+
|
258
|
+
if ( type ) {
|
259
|
+
element.removeClass( this._getClass() );
|
260
|
+
element.removeAttribute( 'aria-label' );
|
261
|
+
|
262
|
+
this.type = type;
|
263
|
+
|
264
|
+
element.addClass( this._getClass() );
|
265
|
+
element.setAttribute( 'aria-label', this.type );
|
266
|
+
|
267
|
+
if ( this.type == 'progress' && !progressElement ) {
|
268
|
+
progressElement = this._createProgressElement();
|
269
|
+
progressElement.insertBefore( messageElement );
|
270
|
+
} else if ( this.type != 'progress' && progressElement ) {
|
271
|
+
progressElement.remove();
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
if ( options.message !== undefined ) {
|
276
|
+
this.message = options.message;
|
277
|
+
messageElement.setHtml( this.message );
|
278
|
+
}
|
279
|
+
|
280
|
+
if ( options.progress !== undefined ) {
|
281
|
+
this.progress = options.progress;
|
282
|
+
|
283
|
+
if ( progressElement ) {
|
284
|
+
progressElement.setStyle( 'width', this._getPercentageProgress() );
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
if ( show && options.important ) {
|
289
|
+
element.setAttribute( 'role', 'alert' );
|
290
|
+
|
291
|
+
if ( !this.isVisible() ) {
|
292
|
+
this.area.add( this );
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
// Overwrite even if it is undefined.
|
297
|
+
this.duration = options.duration;
|
298
|
+
|
299
|
+
this._hideAfterTimeout();
|
300
|
+
},
|
301
|
+
|
302
|
+
/**
|
303
|
+
* Removes the notification element from the notification area.
|
304
|
+
*
|
305
|
+
* Fires the {@link CKEDITOR.editor#notificationHide} event.
|
306
|
+
*/
|
307
|
+
hide: function() {
|
308
|
+
if ( this.editor.fire( 'notificationHide', { notification: this } ) === false ) {
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
|
312
|
+
this.area.remove( this );
|
313
|
+
},
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Returns `true` if the notification is in the notification area.
|
317
|
+
*
|
318
|
+
* @returns {Boolean} `true` if the notification is in the notification area.
|
319
|
+
*/
|
320
|
+
isVisible: function() {
|
321
|
+
return CKEDITOR.tools.indexOf( this.area.notifications, this ) >= 0;
|
322
|
+
},
|
323
|
+
|
324
|
+
/**
|
325
|
+
* Creates the notification DOM element.
|
326
|
+
*
|
327
|
+
* @private
|
328
|
+
* @returns {CKEDITOR.dom.element} Notification DOM element.
|
329
|
+
*/
|
330
|
+
_createElement: function() {
|
331
|
+
var notification = this,
|
332
|
+
notificationElement, notificationMessageElement, notificationCloseElement,
|
333
|
+
close = this.editor.lang.common.close;
|
334
|
+
|
335
|
+
notificationElement = new CKEDITOR.dom.element( 'div' );
|
336
|
+
notificationElement.addClass( 'cke_notification' );
|
337
|
+
notificationElement.addClass( this._getClass() );
|
338
|
+
notificationElement.setAttributes( {
|
339
|
+
id: this.id,
|
340
|
+
role: 'alert',
|
341
|
+
'aria-label': this.type
|
342
|
+
} );
|
343
|
+
|
344
|
+
if ( this.type == 'progress' )
|
345
|
+
notificationElement.append( this._createProgressElement() );
|
346
|
+
|
347
|
+
notificationMessageElement = new CKEDITOR.dom.element( 'p' );
|
348
|
+
notificationMessageElement.addClass( 'cke_notification_message' );
|
349
|
+
notificationMessageElement.setHtml( this.message );
|
350
|
+
notificationElement.append( notificationMessageElement );
|
351
|
+
|
352
|
+
notificationCloseElement = CKEDITOR.dom.element.createFromHtml(
|
353
|
+
'<a class="cke_notification_close" href="javascript:void(0)" title="' + close + '" role="button" tabindex="-1">' +
|
354
|
+
'<span class="cke_label">X</span>' +
|
355
|
+
'</a>' );
|
356
|
+
notificationElement.append( notificationCloseElement );
|
357
|
+
|
358
|
+
notificationCloseElement.on( 'click', function() {
|
359
|
+
// Focus editor on close (#12865)
|
360
|
+
notification.editor.focus();
|
361
|
+
|
362
|
+
notification.hide();
|
363
|
+
} );
|
364
|
+
|
365
|
+
return notificationElement;
|
366
|
+
},
|
367
|
+
|
368
|
+
/**
|
369
|
+
* Gets the notification CSS class.
|
370
|
+
*
|
371
|
+
* @private
|
372
|
+
* @returns {String} Notification CSS class.
|
373
|
+
*/
|
374
|
+
_getClass: function() {
|
375
|
+
return ( this.type == 'progress' ) ?
|
376
|
+
'cke_notification_info' :
|
377
|
+
( 'cke_notification_' + this.type );
|
378
|
+
},
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Creates a progress element for the notification element.
|
382
|
+
*
|
383
|
+
* @private
|
384
|
+
* @returns {CKEDITOR.dom.element} Progress element for the notification element.
|
385
|
+
*/
|
386
|
+
_createProgressElement: function() {
|
387
|
+
var element = new CKEDITOR.dom.element( 'span' );
|
388
|
+
element.addClass( 'cke_notification_progress' );
|
389
|
+
element.setStyle( 'width', this._getPercentageProgress() );
|
390
|
+
return element;
|
391
|
+
},
|
392
|
+
|
393
|
+
/**
|
394
|
+
* Gets the progress as a percentage (ex. `0.3` -> `30%`).
|
395
|
+
*
|
396
|
+
* @private
|
397
|
+
* @returns {String} Progress as a percentage.
|
398
|
+
*/
|
399
|
+
_getPercentageProgress: function() {
|
400
|
+
return Math.round( ( this.progress || 0 ) * 100 ) + '%';
|
401
|
+
},
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Hides the notification after a timeout.
|
405
|
+
*
|
406
|
+
* @private
|
407
|
+
*/
|
408
|
+
_hideAfterTimeout: function() {
|
409
|
+
var notification = this,
|
410
|
+
duration;
|
411
|
+
|
412
|
+
if ( this._hideTimeoutId ) {
|
413
|
+
clearTimeout( this._hideTimeoutId );
|
414
|
+
}
|
415
|
+
|
416
|
+
if ( typeof this.duration == 'number' ) {
|
417
|
+
duration = this.duration;
|
418
|
+
} else if ( this.type == 'info' || this.type == 'success' ) {
|
419
|
+
duration = ( typeof this.editor.config.notification_duration == 'number' ) ?
|
420
|
+
this.editor.config.notification_duration :
|
421
|
+
5000;
|
422
|
+
}
|
423
|
+
|
424
|
+
if ( duration ) {
|
425
|
+
notification._hideTimeoutId = setTimeout( function() {
|
426
|
+
notification.hide();
|
427
|
+
}, duration );
|
428
|
+
}
|
429
|
+
}
|
430
|
+
};
|
431
|
+
|
432
|
+
/**
|
433
|
+
* Notification area is an area where all notifications are put. The area is laid out dynamically.
|
434
|
+
* When the first notification is added, the area is shown and all listeners are added.
|
435
|
+
* When the last notification is removed, the area is hidden and all listeners are removed.
|
436
|
+
*
|
437
|
+
* @since 4.5
|
438
|
+
* @private
|
439
|
+
* @class CKEDITOR.plugins.notification.area
|
440
|
+
* @constructor
|
441
|
+
* @param {CKEDITOR.editor} editor The editor instance.
|
442
|
+
*/
|
443
|
+
function Area( editor ) {
|
444
|
+
var that = this;
|
445
|
+
|
446
|
+
this.editor = editor;
|
447
|
+
this.notifications = [];
|
448
|
+
this.element = this._createElement();
|
449
|
+
this._uiBuffer = CKEDITOR.tools.eventsBuffer( 10, this._layout, this );
|
450
|
+
this._changeBuffer = CKEDITOR.tools.eventsBuffer( 500, this._layout, this );
|
451
|
+
|
452
|
+
editor.on( 'destroy', function() {
|
453
|
+
that._removeListeners();
|
454
|
+
that.element.remove();
|
455
|
+
} );
|
456
|
+
}
|
457
|
+
|
458
|
+
/**
|
459
|
+
* The editor instance.
|
460
|
+
*
|
461
|
+
* @readonly
|
462
|
+
* @property {CKEDITOR.editor} editor
|
463
|
+
*/
|
464
|
+
|
465
|
+
/**
|
466
|
+
* The array of added notifications.
|
467
|
+
*
|
468
|
+
* @readonly
|
469
|
+
* @property {Array} notifications
|
470
|
+
*/
|
471
|
+
|
472
|
+
/**
|
473
|
+
* Notification area DOM element. This element is created when the area object is created. It will be attached to the document
|
474
|
+
* when the first notification is added and removed when the last notification is removed.
|
475
|
+
*
|
476
|
+
* @readonly
|
477
|
+
* @property {CKEDITOR.dom.element} element
|
478
|
+
*/
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Notification width. Cached for performance reasons.
|
482
|
+
*
|
483
|
+
* @private
|
484
|
+
* @property {CKEDITOR.dom.element} _notificationWidth
|
485
|
+
*/
|
486
|
+
|
487
|
+
/**
|
488
|
+
* Notification margin. Cached for performance reasons.
|
489
|
+
*
|
490
|
+
* @private
|
491
|
+
* @property {CKEDITOR.dom.element} _notificationMargin
|
492
|
+
*/
|
493
|
+
|
494
|
+
/**
|
495
|
+
* Event buffer object for UI events to optimize performance.
|
496
|
+
*
|
497
|
+
* @private
|
498
|
+
* @property {Object} _uiBuffer
|
499
|
+
*/
|
500
|
+
|
501
|
+
/**
|
502
|
+
* Event buffer object for editor change events to optimize performance.
|
503
|
+
*
|
504
|
+
* @private
|
505
|
+
* @property {Object} _changeBuffer
|
506
|
+
*/
|
507
|
+
|
508
|
+
Area.prototype = {
|
509
|
+
/**
|
510
|
+
* Adds the notification to the notification area. If it is the first notification, the area will also be attached to
|
511
|
+
* the document and listeners will be attached.
|
512
|
+
*
|
513
|
+
* Note that the proper way to show a notification is to call the {@link CKEDITOR.plugins.notification#show} method.
|
514
|
+
*
|
515
|
+
* @param {CKEDITOR.plugins.notification} notification Notification to add.
|
516
|
+
*/
|
517
|
+
add: function( notification ) {
|
518
|
+
this.notifications.push( notification );
|
519
|
+
|
520
|
+
this.element.append( notification.element );
|
521
|
+
|
522
|
+
if ( this.element.getChildCount() == 1 ) {
|
523
|
+
CKEDITOR.document.getBody().append( this.element );
|
524
|
+
this._attachListeners();
|
525
|
+
}
|
526
|
+
|
527
|
+
this._layout();
|
528
|
+
},
|
529
|
+
|
530
|
+
/**
|
531
|
+
* Removes the notification from the notification area. If it is the last notification, the area will also be
|
532
|
+
* detached from the document and listeners will be detached.
|
533
|
+
*
|
534
|
+
* Note that the proper way to hide a notification is to call the {@link CKEDITOR.plugins.notification#hide} method.
|
535
|
+
*
|
536
|
+
* @param {CKEDITOR.plugins.notification} notification Notification to remove.
|
537
|
+
*/
|
538
|
+
remove: function( notification ) {
|
539
|
+
var i = CKEDITOR.tools.indexOf( this.notifications, notification );
|
540
|
+
|
541
|
+
if ( i < 0 ) {
|
542
|
+
return;
|
543
|
+
}
|
544
|
+
|
545
|
+
this.notifications.splice( i, 1 );
|
546
|
+
|
547
|
+
notification.element.remove();
|
548
|
+
|
549
|
+
if ( !this.element.getChildCount() ) {
|
550
|
+
this._removeListeners();
|
551
|
+
this.element.remove();
|
552
|
+
}
|
553
|
+
},
|
554
|
+
|
555
|
+
/**
|
556
|
+
* Creates the notification area element.
|
557
|
+
*
|
558
|
+
* @private
|
559
|
+
* @returns {CKEDITOR.dom.element} Notification area element.
|
560
|
+
*/
|
561
|
+
_createElement: function() {
|
562
|
+
var editor = this.editor,
|
563
|
+
config = editor.config,
|
564
|
+
notificationArea = new CKEDITOR.dom.element( 'div' );
|
565
|
+
|
566
|
+
notificationArea.addClass( 'cke_notifications_area' );
|
567
|
+
notificationArea.setAttribute( 'id', 'cke_notifications_area_' + editor.name );
|
568
|
+
notificationArea.setStyle( 'z-index', config.baseFloatZIndex - 2 );
|
569
|
+
|
570
|
+
return notificationArea;
|
571
|
+
},
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Attaches listeners to the notification area.
|
575
|
+
*
|
576
|
+
* @private
|
577
|
+
*/
|
578
|
+
_attachListeners: function() {
|
579
|
+
var win = CKEDITOR.document.getWindow(),
|
580
|
+
editor = this.editor;
|
581
|
+
|
582
|
+
win.on( 'scroll', this._uiBuffer.input );
|
583
|
+
win.on( 'resize', this._uiBuffer.input );
|
584
|
+
editor.on( 'change', this._changeBuffer.input );
|
585
|
+
editor.on( 'floatingSpaceLayout', this._layout, this, null, 20 );
|
586
|
+
editor.on( 'blur', this._layout, this, null, 20 );
|
587
|
+
},
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Detaches listeners from the notification area.
|
591
|
+
*
|
592
|
+
* @private
|
593
|
+
*/
|
594
|
+
_removeListeners: function() {
|
595
|
+
var win = CKEDITOR.document.getWindow(),
|
596
|
+
editor = this.editor;
|
597
|
+
|
598
|
+
win.removeListener( 'scroll', this._uiBuffer.input );
|
599
|
+
win.removeListener( 'resize', this._uiBuffer.input );
|
600
|
+
editor.removeListener( 'change', this._changeBuffer.input );
|
601
|
+
editor.removeListener( 'floatingSpaceLayout', this._layout );
|
602
|
+
editor.removeListener( 'blur', this._layout );
|
603
|
+
},
|
604
|
+
|
605
|
+
/**
|
606
|
+
* Sets the position of the notification area based on the editor content, toolbar as well as
|
607
|
+
* viewport position and dimensions.
|
608
|
+
*
|
609
|
+
* @private
|
610
|
+
*/
|
611
|
+
_layout: function() {
|
612
|
+
var area = this.element,
|
613
|
+
editor = this.editor,
|
614
|
+
contentsRect = editor.ui.contentsElement.getClientRect(),
|
615
|
+
contentsPos = editor.ui.contentsElement.getDocumentPosition(),
|
616
|
+
top = editor.ui.space( 'top' ),
|
617
|
+
topRect = top.getClientRect(),
|
618
|
+
areaRect = area.getClientRect(),
|
619
|
+
notification,
|
620
|
+
notificationWidth = this._notificationWidth,
|
621
|
+
notificationMargin = this._notificationMargin,
|
622
|
+
win = CKEDITOR.document.getWindow(),
|
623
|
+
scrollPos = win.getScrollPosition(),
|
624
|
+
viewRect = win.getViewPaneSize(),
|
625
|
+
body = CKEDITOR.document.getBody(),
|
626
|
+
bodyPos = body.getDocumentPosition(),
|
627
|
+
cssLength = CKEDITOR.tools.cssLength;
|
628
|
+
|
629
|
+
// Cache for optimization
|
630
|
+
if ( !notificationWidth || !notificationMargin ) {
|
631
|
+
notification = this.element.getChild( 0 );
|
632
|
+
notificationWidth = this._notificationWidth = notification.getClientRect().width;
|
633
|
+
notificationMargin = this._notificationMargin =
|
634
|
+
parseInt( notification.getComputedStyle( 'margin-left' ), 10 ) +
|
635
|
+
parseInt( notification.getComputedStyle( 'margin-right' ), 10 );
|
636
|
+
}
|
637
|
+
|
638
|
+
// --------------------------------------- Horizontal layout ----------------------------------------
|
639
|
+
|
640
|
+
// +---Viewport-------------------------------+ +---Viewport-------------------------------+
|
641
|
+
// | | | |
|
642
|
+
// | +---Toolbar----------------------------+ | | +---Content----------------------------+ |
|
643
|
+
// | | | | | | | |
|
644
|
+
// | +---Content----------------------------+ | | | | |
|
645
|
+
// | | | | | +---Toolbar----------------------+ | |
|
646
|
+
// | | +------Notification------+ | | | | | | |
|
647
|
+
// | | | | OR | +--------------------------------+ | |
|
648
|
+
// | | | | | | | |
|
649
|
+
// | | | | | | +------Notification------+ | |
|
650
|
+
// | | | | | | | |
|
651
|
+
// | | | | | | | |
|
652
|
+
// | +--------------------------------------+ | | +--------------------------------------+ |
|
653
|
+
// +------------------------------------------+ +------------------------------------------+
|
654
|
+
if ( top.isVisible() &&
|
655
|
+
topRect.bottom > contentsRect.top &&
|
656
|
+
topRect.bottom < contentsRect.bottom - areaRect.height ) {
|
657
|
+
setBelowToolbar();
|
658
|
+
|
659
|
+
// +---Viewport-------------------------------+
|
660
|
+
// | |
|
661
|
+
// | +---Content----------------------------+ |
|
662
|
+
// | | | |
|
663
|
+
// | | +------Notification------+ | |
|
664
|
+
// | | | |
|
665
|
+
// | | | |
|
666
|
+
// | | | |
|
667
|
+
// | +--------------------------------------+ |
|
668
|
+
// | |
|
669
|
+
// +------------------------------------------+
|
670
|
+
} else if ( contentsRect.top > 0 ) {
|
671
|
+
setTopStandard();
|
672
|
+
|
673
|
+
// +---Content----------------------------+
|
674
|
+
// | |
|
675
|
+
// +---Viewport-------------------------------+
|
676
|
+
// | | | |
|
677
|
+
// | | +------Notification------+ | |
|
678
|
+
// | | | |
|
679
|
+
// | | | |
|
680
|
+
// | | | |
|
681
|
+
// | +--------------------------------------+ |
|
682
|
+
// | |
|
683
|
+
// +------------------------------------------+
|
684
|
+
} else if ( contentsPos.y + contentsRect.height - areaRect.height > scrollPos.y ) {
|
685
|
+
setTopFixed();
|
686
|
+
|
687
|
+
// +---Content----------------------------+ +---Content----------------------------+
|
688
|
+
// | | | |
|
689
|
+
// | | | |
|
690
|
+
// | | | +------Notification------+ |
|
691
|
+
// | | | |
|
692
|
+
// | | OR +--------------------------------------+
|
693
|
+
// +---Viewport-------------------------------+
|
694
|
+
// | | +------Notification------+ | | +---Viewport-------------------------------+
|
695
|
+
// | | | | | |
|
696
|
+
// | +--------------------------------------+ | | |
|
697
|
+
// | | | |
|
698
|
+
// +------------------------------------------+ +------------------------------------------+
|
699
|
+
} else {
|
700
|
+
setBottom();
|
701
|
+
}
|
702
|
+
|
703
|
+
function setTopStandard() {
|
704
|
+
area.setStyles( {
|
705
|
+
position: 'absolute',
|
706
|
+
top: cssLength( contentsPos.y )
|
707
|
+
} );
|
708
|
+
}
|
709
|
+
|
710
|
+
function setBelowToolbar() {
|
711
|
+
area.setStyles( {
|
712
|
+
position: 'fixed',
|
713
|
+
top: cssLength( topRect.bottom )
|
714
|
+
} );
|
715
|
+
}
|
716
|
+
|
717
|
+
function setTopFixed() {
|
718
|
+
area.setStyles( {
|
719
|
+
position: 'fixed',
|
720
|
+
top: 0
|
721
|
+
} );
|
722
|
+
}
|
723
|
+
|
724
|
+
function setBottom() {
|
725
|
+
area.setStyles( {
|
726
|
+
position: 'absolute',
|
727
|
+
top: cssLength( contentsPos.y + contentsRect.height - areaRect.height )
|
728
|
+
} );
|
729
|
+
}
|
730
|
+
|
731
|
+
// ---------------------------------------- Vertical layout -----------------------------------------
|
732
|
+
|
733
|
+
var leftBase = area.getStyle( 'position' ) == 'fixed' ?
|
734
|
+
contentsRect.left :
|
735
|
+
body.getComputedStyle( 'position' ) != 'static' ? contentsPos.x - bodyPos.x : contentsPos.x;
|
736
|
+
|
737
|
+
// Content is narrower than notification
|
738
|
+
if ( contentsRect.width < notificationWidth + notificationMargin ) {
|
739
|
+
|
740
|
+
// +---Viewport-------------------------------+
|
741
|
+
// | |
|
742
|
+
// | +---Content------------+ |
|
743
|
+
// | | | |
|
744
|
+
// | +------Notification------+ | |
|
745
|
+
// | | | |
|
746
|
+
// | +----------------------+ |
|
747
|
+
// | |
|
748
|
+
// +------------------------------------------+
|
749
|
+
if ( contentsPos.x + notificationWidth + notificationMargin > scrollPos.x + viewRect.width ) {
|
750
|
+
setRight();
|
751
|
+
|
752
|
+
// +---Viewport-------------------------------+ +---Viewport--------------------------+
|
753
|
+
// | | | |
|
754
|
+
// | +---Content------------+ | +---Content------------+ |
|
755
|
+
// | | | | | | | |
|
756
|
+
// | | +------Notification------+ | OR | +------Notification------+ |
|
757
|
+
// | | | | | | | |
|
758
|
+
// | +----------------------+ | +----------------------+ |
|
759
|
+
// | | | |
|
760
|
+
// +------------------------------------------+ +-------------------------------------+
|
761
|
+
} else {
|
762
|
+
setLeft();
|
763
|
+
}
|
764
|
+
|
765
|
+
// Content is wider than notification.
|
766
|
+
} else {
|
767
|
+
|
768
|
+
// +--+Viewport+------------------------+
|
769
|
+
// | |
|
770
|
+
// | +---Content-----------------------------------------+
|
771
|
+
// | | | |
|
772
|
+
// | | +-----+Notification+-----+ |
|
773
|
+
// | | | |
|
774
|
+
// | | | |
|
775
|
+
// | | | |
|
776
|
+
// | +---------------------------------------------------+
|
777
|
+
// | |
|
778
|
+
// +------------------------------------+
|
779
|
+
if ( contentsPos.x + notificationWidth + notificationMargin > scrollPos.x + viewRect.width ) {
|
780
|
+
setLeft();
|
781
|
+
|
782
|
+
// +---Viewport-------------------------+
|
783
|
+
// | |
|
784
|
+
// | +---Content----------------------------------------------+
|
785
|
+
// | | | |
|
786
|
+
// | | +------Notification------+ | |
|
787
|
+
// | | | |
|
788
|
+
// | | | |
|
789
|
+
// | +--------------------------------------------------------+
|
790
|
+
// | |
|
791
|
+
// +------------------------------------+
|
792
|
+
} else if ( contentsPos.x + contentsRect.width / 2 +
|
793
|
+
notificationWidth / 2 + notificationMargin > scrollPos.x + viewRect.width ) {
|
794
|
+
setRightFixed();
|
795
|
+
|
796
|
+
// +---Viewport-------------------------+
|
797
|
+
// | |
|
798
|
+
// +---Content----------------------------+ |
|
799
|
+
// | | | |
|
800
|
+
// | +------Notification------+ | |
|
801
|
+
// | | | |
|
802
|
+
// | | | |
|
803
|
+
// +--------------------------------------+ |
|
804
|
+
// | |
|
805
|
+
// +------------------------------------+
|
806
|
+
} else if ( contentsRect.left + contentsRect.width - notificationWidth - notificationMargin < 0 ) {
|
807
|
+
setRight();
|
808
|
+
|
809
|
+
// +---Viewport-------------------------+
|
810
|
+
// | |
|
811
|
+
// +---Content---------------------------------------------+ |
|
812
|
+
// | | | |
|
813
|
+
// | | +------Notification------+ | |
|
814
|
+
// | | | |
|
815
|
+
// | | | |
|
816
|
+
// +-------------------------------------------------------+ |
|
817
|
+
// | |
|
818
|
+
// +------------------------------------+
|
819
|
+
} else if ( contentsRect.left + contentsRect.width / 2 - notificationWidth / 2 < 0 ) {
|
820
|
+
setLeftFixed();
|
821
|
+
|
822
|
+
// +---Viewport-------------------------+
|
823
|
+
// | |
|
824
|
+
// | +---Content----------------------+ |
|
825
|
+
// | | | |
|
826
|
+
// | | +-----Notification-----+ | |
|
827
|
+
// | | | |
|
828
|
+
// | | | |
|
829
|
+
// | +--------------------------------+ |
|
830
|
+
// | |
|
831
|
+
// +------------------------------------+
|
832
|
+
} else {
|
833
|
+
setCenter();
|
834
|
+
}
|
835
|
+
}
|
836
|
+
|
837
|
+
function setLeft() {
|
838
|
+
area.setStyle( 'left', cssLength( leftBase ) );
|
839
|
+
}
|
840
|
+
|
841
|
+
function setLeftFixed() {
|
842
|
+
area.setStyle( 'left', cssLength( leftBase - contentsPos.x + scrollPos.x ) );
|
843
|
+
}
|
844
|
+
|
845
|
+
function setCenter() {
|
846
|
+
area.setStyle( 'left', cssLength( leftBase + contentsRect.width / 2 - notificationWidth / 2 - notificationMargin / 2 ) );
|
847
|
+
}
|
848
|
+
|
849
|
+
function setRight() {
|
850
|
+
area.setStyle( 'left', cssLength( leftBase + contentsRect.width - notificationWidth - notificationMargin ) );
|
851
|
+
}
|
852
|
+
|
853
|
+
function setRightFixed() {
|
854
|
+
area.setStyle( 'left', cssLength( leftBase - contentsPos.x + scrollPos.x + viewRect.width -
|
855
|
+
notificationWidth - notificationMargin ) );
|
856
|
+
}
|
857
|
+
}
|
858
|
+
};
|
859
|
+
|
860
|
+
CKEDITOR.plugins.notification = Notification;
|
861
|
+
|
862
|
+
/**
|
863
|
+
* After how many milliseconds the notification of the `info` and `success`
|
864
|
+
* {@link CKEDITOR.plugins.notification#type type} should close automatically.
|
865
|
+
* `0` means that notifications will not close automatically.
|
866
|
+
* Note that `warning` and `progress` notifications will never close automatically.
|
867
|
+
*
|
868
|
+
* Refer to the [Notifications](http://docs.ckeditor.com/#!/guide/dev_notifications) article
|
869
|
+
* for more information about this feature.
|
870
|
+
*
|
871
|
+
* @since 4.5
|
872
|
+
* @cfg {Number} [notification_duration=5000]
|
873
|
+
* @member CKEDITOR.config
|
874
|
+
*/
|
875
|
+
|
876
|
+
/**
|
877
|
+
* Event fired when the {@link CKEDITOR.plugins.notification#show} method is called, before the
|
878
|
+
* notification is shown. If this event is canceled, the notification will not be shown.
|
879
|
+
*
|
880
|
+
* Using this event allows you to fully customize how a notification will be shown. It may be used to integrate
|
881
|
+
* the CKEditor notification system with your web page notifications.
|
882
|
+
*
|
883
|
+
* @since 4.5
|
884
|
+
* @event notificationShow
|
885
|
+
* @member CKEDITOR.editor
|
886
|
+
* @param data
|
887
|
+
* @param {CKEDITOR.plugins.notification} data.notification Notification which will be shown.
|
888
|
+
* @param {CKEDITOR.editor} editor The editor instance.
|
889
|
+
*/
|
890
|
+
|
891
|
+
/**
|
892
|
+
* Event fired when the {@link CKEDITOR.plugins.notification#update} method is called, before the
|
893
|
+
* notification is updated. If this event is canceled, the notification will not be shown even if the update was important,
|
894
|
+
* but the object will be updated anyway. Note that canceling this event does not prevent updating {@link #element}
|
895
|
+
* attributes, but if {@link #notificationShow} was canceled as well, this element is detached from the DOM.
|
896
|
+
*
|
897
|
+
* Using this event allows you to fully customize how a notification will be updated. It may be used to integrate
|
898
|
+
* the CKEditor notification system with your web page notifications.
|
899
|
+
*
|
900
|
+
* @since 4.5
|
901
|
+
* @event notificationUpdate
|
902
|
+
* @member CKEDITOR.editor
|
903
|
+
* @param data
|
904
|
+
* @param {CKEDITOR.plugins.notification} data.notification Notification which will be updated.
|
905
|
+
* Note that it contains the data that has not been updated yet.
|
906
|
+
* @param {Object} data.options Update options, see {@link CKEDITOR.plugins.notification#update}.
|
907
|
+
* @param {CKEDITOR.editor} editor The editor instance.
|
908
|
+
*/
|
909
|
+
|
910
|
+
/**
|
911
|
+
* Event fired when the {@link CKEDITOR.plugins.notification#hide} method is called, before the
|
912
|
+
* notification is hidden. If this event is canceled, the notification will not be hidden.
|
913
|
+
*
|
914
|
+
* Using this event allows you to fully customize how a notification will be hidden. It may be used to integrate
|
915
|
+
* the CKEditor notification system with your web page notifications.
|
916
|
+
*
|
917
|
+
* @since 4.5
|
918
|
+
* @event notificationHide
|
919
|
+
* @member CKEDITOR.editor
|
920
|
+
* @param data
|
921
|
+
* @param {CKEDITOR.plugins.notification} data.notification Notification which will be hidden.
|
922
|
+
* @param {CKEDITOR.editor} editor The editor instance.
|
923
|
+
*/
|