noodall-ui 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +29 -0
- data/Gemfile +29 -0
- data/Gemfile.lock +205 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +17 -0
- data/app/controllers/noodall/admin/assets_controller.rb +241 -0
- data/app/controllers/noodall/admin/base_controller.rb +8 -0
- data/app/controllers/noodall/admin/components_controller.rb +22 -0
- data/app/controllers/noodall/admin/groups_controller.rb +11 -0
- data/app/controllers/noodall/admin/nodes_controller.rb +159 -0
- data/app/controllers/noodall/nodes_controller.rb +41 -0
- data/app/helpers/noodall/admin/assets_helper.rb +15 -0
- data/app/helpers/noodall/admin/base_helper.rb +14 -0
- data/app/helpers/noodall/admin/nodes_helper.rb +37 -0
- data/app/helpers/noodall/components_helper.rb +38 -0
- data/app/helpers/noodall/layout_helper.rb +25 -0
- data/app/helpers/noodall/nodes_helper.rb +72 -0
- data/app/models/asset.rb +103 -0
- data/app/views/layouts/noodall_admin.html.erb +66 -0
- data/app/views/noodall/admin/assets/_browser.html.erb +28 -0
- data/app/views/noodall/admin/assets/_form.html.erb +54 -0
- data/app/views/noodall/admin/assets/_menu.html.erb +8 -0
- data/app/views/noodall/admin/assets/_show.html.erb +48 -0
- data/app/views/noodall/admin/assets/_tags.html.erb +13 -0
- data/app/views/noodall/admin/assets/add.html.erb +10 -0
- data/app/views/noodall/admin/assets/form.html.erb +12 -0
- data/app/views/noodall/admin/assets/form.js.erb +2 -0
- data/app/views/noodall/admin/assets/index.html.erb +65 -0
- data/app/views/noodall/admin/assets/index.js.erb +1 -0
- data/app/views/noodall/admin/assets/show.html.erb +3 -0
- data/app/views/noodall/admin/assets/show.js.erb +1 -0
- data/app/views/noodall/admin/assets/tags.html.erb +3 -0
- data/app/views/noodall/admin/assets/tags.js.erb +1 -0
- data/app/views/noodall/admin/components/_component.erb +0 -0
- data/app/views/noodall/admin/nodes/_body.html.erb +5 -0
- data/app/views/noodall/admin/nodes/_branch.html.erb +10 -0
- data/app/views/noodall/admin/nodes/_home.html.erb +27 -0
- data/app/views/noodall/admin/nodes/_slot_form.html.erb +16 -0
- data/app/views/noodall/admin/nodes/change_template.html.erb +38 -0
- data/app/views/noodall/admin/nodes/index.html.erb +69 -0
- data/app/views/noodall/admin/nodes/new.html.erb +30 -0
- data/app/views/noodall/admin/nodes/show.html.erb +144 -0
- data/app/views/noodall/admin/nodes/tree.html.erb +3 -0
- data/app/views/noodall/admin/nodes/tree.js.erb +2 -0
- data/app/views/noodall/components/_component.erb +0 -0
- data/app/views/noodall/nodes/search.html.erb +14 -0
- data/app/views/noodall/nodes/sitemap.html.erb +3 -0
- data/app/views/noodall/nodes/sitemap.xml.rxml +22 -0
- data/config/application.rb +29 -0
- data/config/boot.rb +13 -0
- data/config/cucumber.yml +8 -0
- data/config/database.yml +14 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +30 -0
- data/config/environments/production.rb +50 -0
- data/config/environments/test.rb +35 -0
- data/config/locales/en.yml +5 -0
- data/config.ru +4 -0
- data/demo/controllers/application_controller.rb +22 -0
- data/demo/initializers/dragonfly.rb +1 -0
- data/demo/initializers/mongo_mapper.rb +13 -0
- data/demo/initializers/noodall.rb +2 -0
- data/demo/initializers/secret_token.rb +7 -0
- data/demo/initializers/session_store.rb +8 -0
- data/demo/models/gallery.rb +17 -0
- data/demo/models/page_a.rb +9 -0
- data/demo/models/page_b.rb +4 -0
- data/demo/models/page_c.rb +7 -0
- data/demo/models/promo.rb +22 -0
- data/demo/models/user.rb +12 -0
- data/demo/routes.rb +3 -0
- data/demo/seeds.rb +8 -0
- data/demo/views/admin/components/_gallery.html.erb +49 -0
- data/demo/views/admin/components/_promo.html.erb +34 -0
- data/demo/views/admin/nodes/_page_a.html.erb +47 -0
- data/demo/views/admin/nodes/_page_b.html.erb +35 -0
- data/demo/views/admin/nodes/_page_c.html.erb +35 -0
- data/demo/views/components/_gallery.html.erb +23 -0
- data/demo/views/components/_promo.html.erb +5 -0
- data/demo/views/layouts/application.html.erb +121 -0
- data/demo/views/nodes/page_a.html.erb +14 -0
- data/demo/views/nodes/page_b.html.erb +9 -0
- data/demo/views/nodes/page_c.html.erb +12 -0
- data/features/change_templates.feature +25 -0
- data/features/content_templates.feature +18 -0
- data/features/gallery_component.feature +22 -0
- data/features/manage_assets.feature +28 -0
- data/features/manage_content_tree.feature +42 -0
- data/features/preview.feature +8 -0
- data/features/promo_component.feature +18 -0
- data/features/publish_content.feature +28 -0
- data/features/search.feature +12 -0
- data/features/sitemap.feature +9 -0
- data/features/step_definitions/asset_steps.rb +66 -0
- data/features/step_definitions/cms_node_steps.rb +126 -0
- data/features/step_definitions/component_steps.rb +137 -0
- data/features/step_definitions/content_steps.rb +187 -0
- data/features/step_definitions/date_select_steps.rb +39 -0
- data/features/step_definitions/groups_access_steps.rb +92 -0
- data/features/step_definitions/node_steps.rb +25 -0
- data/features/step_definitions/preview_steps.rb +7 -0
- data/features/step_definitions/pubish_content_steps.rb +45 -0
- data/features/step_definitions/search_steps.rb +21 -0
- data/features/step_definitions/sign_in_steps.rb +3 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +52 -0
- data/features/support/logo.png +0 -0
- data/features/support/paths.rb +56 -0
- data/generators/component/USAGE +8 -0
- data/generators/component/component_generator.rb +35 -0
- data/generators/component/lib/insert_commands.rb +61 -0
- data/generators/component/templates/admin_template.html.erb +50 -0
- data/generators/component/templates/factory.rb +5 -0
- data/generators/component/templates/model.rb +8 -0
- data/generators/component/templates/template.html.erb +41 -0
- data/generators/node/USAGE +8 -0
- data/generators/node/lib/insert_commands.rb +47 -0
- data/generators/node/node_generator.rb +35 -0
- data/generators/node/templates/admin_template.html.erb +49 -0
- data/generators/node/templates/factory.rb +5 -0
- data/generators/node/templates/model.rb +11 -0
- data/generators/node/templates/template.html.erb +41 -0
- data/generators/node_features/USAGE +8 -0
- data/generators/node_features/node_features_generator.rb +16 -0
- data/lib/generators/noodall/node/USAGE +8 -0
- data/lib/generators/noodall/node/node_generator.rb +21 -0
- data/lib/generators/noodall/node/templates/admin_template.html.erb +52 -0
- data/lib/generators/noodall/node/templates/factory.rb +8 -0
- data/lib/generators/noodall/node/templates/model.rb +13 -0
- data/lib/generators/noodall/node/templates/template.html.erb +12 -0
- data/lib/noodall/canable.rb +1 -0
- data/lib/noodall/dragonfly.rb +23 -0
- data/lib/noodall/engine.rb +13 -0
- data/lib/noodall/permalinks.rb +12 -0
- data/lib/noodall/routes.rb +45 -0
- data/lib/noodall/ui/version.rb +5 -0
- data/lib/noodall/ui.rb +17 -0
- data/lib/noodall/video_thumbnail_encoder.rb +31 -0
- data/lib/noodall-ui.rb +6 -0
- data/lib/tasks/cucumber.rake +53 -0
- data/log/.gitignore +0 -0
- data/noodall-ui.gemspec +28 -0
- data/public/favicon.ico +0 -0
- data/public/images/admin/add-small.png +0 -0
- data/public/images/admin/add.png +0 -0
- data/public/images/admin/add_file.gif +0 -0
- data/public/images/admin/advanced.gif +0 -0
- data/public/images/admin/back.png +0 -0
- data/public/images/admin/cancel-small.gif +0 -0
- data/public/images/admin/cancel.gif +0 -0
- data/public/images/admin/change-bg.gif +0 -0
- data/public/images/admin/change.gif +0 -0
- data/public/images/admin/check.png +0 -0
- data/public/images/admin/clear.gif +0 -0
- data/public/images/admin/close.png +0 -0
- data/public/images/admin/create.gif +0 -0
- data/public/images/admin/delete.gif +0 -0
- data/public/images/admin/delete.png +0 -0
- data/public/images/admin/doc-icon.png +0 -0
- data/public/images/admin/document.png +0 -0
- data/public/images/admin/down.png +0 -0
- data/public/images/admin/download.png +0 -0
- data/public/images/admin/draft.gif +0 -0
- data/public/images/admin/draft.png +0 -0
- data/public/images/admin/edit.gif +0 -0
- data/public/images/admin/edit.png +0 -0
- data/public/images/admin/image.png +0 -0
- data/public/images/admin/image_small.png +0 -0
- data/public/images/admin/info-white.png +0 -0
- data/public/images/admin/info.png +0 -0
- data/public/images/admin/media.gif +0 -0
- data/public/images/admin/nav-2.gif +0 -0
- data/public/images/admin/nav.gif +0 -0
- data/public/images/admin/next.png +0 -0
- data/public/images/admin/no-type-icon.png +0 -0
- data/public/images/admin/pagination.gif +0 -0
- data/public/images/admin/pdf-icon.png +0 -0
- data/public/images/admin/prev.png +0 -0
- data/public/images/admin/preview.gif +0 -0
- data/public/images/admin/publish.gif +0 -0
- data/public/images/admin/remove.gif +0 -0
- data/public/images/admin/reset.gif +0 -0
- data/public/images/admin/select_image.gif +0 -0
- data/public/images/admin/select_images.gif +0 -0
- data/public/images/admin/set.gif +0 -0
- data/public/images/admin/sort.png +0 -0
- data/public/images/admin/tag.png +0 -0
- data/public/images/admin/templates/article-page.gif +0 -0
- data/public/images/admin/templates/articles-list.gif +0 -0
- data/public/images/admin/templates/course-page.gif +0 -0
- data/public/images/admin/templates/event-page.gif +0 -0
- data/public/images/admin/templates/events-list.gif +0 -0
- data/public/images/admin/templates/home.gif +0 -0
- data/public/images/admin/templates/landing-page.gif +0 -0
- data/public/images/admin/templates/page-a.gif +0 -0
- data/public/images/admin/templates/page-b.gif +0 -0
- data/public/images/admin/templates/school-landing-page.gif +0 -0
- data/public/images/admin/templates/study-landing-page.gif +0 -0
- data/public/images/admin/top-level.png +0 -0
- data/public/images/admin/top-level_small.png +0 -0
- data/public/images/admin/txt-icon.png +0 -0
- data/public/images/admin/uncheck.png +0 -0
- data/public/images/admin/up.png +0 -0
- data/public/images/admin/update.gif +0 -0
- data/public/images/admin/upload.png +0 -0
- data/public/images/admin/video.png +0 -0
- data/public/images/admin/view.png +0 -0
- data/public/images/admin/xls-icon.png +0 -0
- data/public/images/fancybox/blank.gif +0 -0
- data/public/images/fancybox/fancy_close.png +0 -0
- data/public/images/fancybox/fancy_loading.png +0 -0
- data/public/images/fancybox/fancy_nav_left.png +0 -0
- data/public/images/fancybox/fancy_nav_right.png +0 -0
- data/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/public/images/fancybox/fancy_title_left.png +0 -0
- data/public/images/fancybox/fancy_title_main.png +0 -0
- data/public/images/fancybox/fancy_title_over.png +0 -0
- data/public/images/fancybox/fancy_title_right.png +0 -0
- data/public/images/fancybox/fancybox-x.png +0 -0
- data/public/images/fancybox/fancybox-y.png +0 -0
- data/public/images/fancybox/fancybox.png +0 -0
- data/public/images/plupload/backgrounds.gif +0 -0
- data/public/images/plupload/buttons-disabled.png +0 -0
- data/public/images/plupload/buttons.png +0 -0
- data/public/images/plupload/delete.gif +0 -0
- data/public/images/plupload/done.gif +0 -0
- data/public/images/plupload/error.gif +0 -0
- data/public/images/plupload/throbber.gif +0 -0
- data/public/images/plupload/transp50.png +0 -0
- data/public/javascripts/admin/application.js +586 -0
- data/public/javascripts/admin/asset_edit.js +30 -0
- data/public/javascripts/admin/assets.js +98 -0
- data/public/javascripts/admin/gotham.font.js +20 -0
- data/public/javascripts/admin/jquery.jqtransform.js +366 -0
- data/public/javascripts/admin/nodes.js +30 -0
- data/public/javascripts/admin/tiny_mce_config.js +118 -0
- data/public/javascripts/ajaxify.js +20 -0
- data/public/javascripts/application.js +37 -0
- data/public/javascripts/carousel.lite.js +1 -0
- data/public/javascripts/cufon-yui.js +8 -0
- data/public/javascripts/fancybox.js +1078 -0
- data/public/javascripts/plupload/gears_init.js +86 -0
- data/public/javascripts/plupload/jquery.plupload.queue.min.js +1 -0
- data/public/javascripts/plupload/plupload.flash.swf +0 -0
- data/public/javascripts/plupload/plupload.full.min.js +1 -0
- data/public/javascripts/plupload/plupload.silverlight.xap +0 -0
- data/public/javascripts/rails.js +132 -0
- data/public/javascripts/tiny_mce/jquery.tinymce.js +1 -0
- data/public/javascripts/tiny_mce/langs/en.js +169 -0
- data/public/javascripts/tiny_mce/license.txt +504 -0
- data/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
- data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
- data/public/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
- data/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
- data/public/javascripts/tiny_mce/plugins/advhr/rule.htm +57 -0
- data/public/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
- data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
- data/public/javascripts/tiny_mce/plugins/advimage/image.htm +232 -0
- data/public/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
- data/public/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
- data/public/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
- data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
- data/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
- data/public/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
- data/public/javascripts/tiny_mce/plugins/advlink/link.htm +333 -0
- data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
- data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +117 -0
- data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
- data/public/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
- data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +127 -0
- data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
- data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
- data/public/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
- data/public/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
- data/public/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
- data/public/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
- data/public/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
- data/public/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
- data/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +149 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
- data/public/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +148 -0
- data/public/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
- data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +635 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
- data/public/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
- data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/public/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
- data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/public/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
- data/public/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
- data/public/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
- data/public/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
- data/public/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
- data/public/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
- data/public/javascripts/tiny_mce/plugins/media/media.htm +817 -0
- data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
- data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +929 -0
- data/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
- data/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
- data/public/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
- data/public/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
- data/public/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
- data/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
- data/public/javascripts/tiny_mce/plugins/preview/example.html +28 -0
- data/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
- data/public/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
- data/public/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
- data/public/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +130 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/public/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +99 -0
- data/public/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
- data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +341 -0
- data/public/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
- data/public/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
- data/public/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
- data/public/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
- data/public/javascripts/tiny_mce/plugins/style/props.htm +726 -0
- data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +112 -0
- data/public/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
- data/public/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
- data/public/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
- data/public/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
- data/public/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1118 -0
- data/public/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
- data/public/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
- data/public/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
- data/public/javascripts/tiny_mce/plugins/table/js/table.js +449 -0
- data/public/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
- data/public/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
- data/public/javascripts/tiny_mce/plugins/table/row.htm +155 -0
- data/public/javascripts/tiny_mce/plugins/table/table.htm +187 -0
- data/public/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
- data/public/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
- data/public/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
- data/public/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
- data/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
- data/public/javascripts/tiny_mce/plugins/template/template.htm +32 -0
- data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +76 -0
- data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +141 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +141 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +148 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +141 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +161 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +144 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +161 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +63 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +62 -0
- data/public/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/public/javascripts/tiny_mce/themes/advanced/about.htm +54 -0
- data/public/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
- data/public/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
- data/public/javascripts/tiny_mce/themes/advanced/color_picker.htm +73 -0
- data/public/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
- data/public/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1167 -0
- data/public/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
- data/public/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/charmap.js +335 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
- data/public/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
- data/public/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
- data/public/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
- data/public/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/content.css +35 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +35 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/public/javascripts/tiny_mce/themes/advanced/source_editor.htm +26 -0
- data/public/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
- data/public/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
- data/public/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/public/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
- data/public/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
- data/public/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
- data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
- data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
- data/public/javascripts/tiny_mce/tiny_mce.js +1 -0
- data/public/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
- data/public/javascripts/tiny_mce/tiny_mce_src.js +13134 -0
- data/public/javascripts/tiny_mce/utils/editable_selects.js +70 -0
- data/public/javascripts/tiny_mce/utils/form_utils.js +200 -0
- data/public/javascripts/tiny_mce/utils/mctabs.js +77 -0
- data/public/javascripts/tiny_mce/utils/validate.js +220 -0
- data/public/stylesheets/admin/fancybox.css +341 -0
- data/public/stylesheets/admin/forms.css +520 -0
- data/public/stylesheets/admin/handheld.css +6 -0
- data/public/stylesheets/admin/ie.css +118 -0
- data/public/stylesheets/admin/ie6.css +23 -0
- data/public/stylesheets/admin/ie8.css +16 -0
- data/public/stylesheets/admin/layout.css +723 -0
- data/public/stylesheets/admin/print.css +27 -0
- data/public/stylesheets/admin/reset.css +81 -0
- data/public/stylesheets/admin/skin.css +698 -0
- data/public/stylesheets/admin/tinymce.css +2 -0
- data/public/stylesheets/admin/typography.css +207 -0
- data/public/stylesheets/ellipsis.xml +15 -0
- data/public/stylesheets/fancybox.css +313 -0
- data/public/stylesheets/forms.css +7 -0
- data/public/stylesheets/ie.css +12 -0
- data/public/stylesheets/ie8.css +8 -0
- data/public/stylesheets/layout.css +31 -0
- data/public/stylesheets/plupload.queue.css +181 -0
- data/public/stylesheets/reset.css +84 -0
- data/public/stylesheets/sass/forms.scss +7 -0
- data/public/stylesheets/sass/ie.scss +12 -0
- data/public/stylesheets/sass/ie8.scss +8 -0
- data/public/stylesheets/sass/layout.scss +45 -0
- data/public/stylesheets/sass/skin.scss +35 -0
- data/public/stylesheets/sass/typography.scss +162 -0
- data/public/stylesheets/skin.css +22 -0
- data/public/stylesheets/typography.css +162 -0
- data/script/cucumber +10 -0
- data/script/rails +6 -0
- data/spec/factories/asset.rb +16 -0
- data/spec/factories/component.rb +9 -0
- data/spec/factories/node.rb +15 -0
- data/spec/factories/user.rb +5 -0
- data/spec/files/beef.png +0 -0
- data/spec/files/get_video.flv +0 -0
- data/spec/files/test.pdf +0 -0
- data/spec/noodall-ui_spec.rb +9 -0
- data/spec/spec_helper.rb +4 -0
- data/tmp/.gitignore +0 -0
- metadata +685 -0
@@ -0,0 +1,929 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2009, Moxiecode Systems AB
|
5
|
+
* Released under LGPL License.
|
6
|
+
*
|
7
|
+
* License: http://tinymce.moxiecode.com/license
|
8
|
+
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function() {
|
12
|
+
var each = tinymce.each,
|
13
|
+
entities = null,
|
14
|
+
defs = {
|
15
|
+
paste_auto_cleanup_on_paste : true,
|
16
|
+
paste_block_drop : false,
|
17
|
+
paste_retain_style_properties : "none",
|
18
|
+
paste_strip_class_attributes : "mso",
|
19
|
+
paste_remove_spans : false,
|
20
|
+
paste_remove_styles : false,
|
21
|
+
paste_remove_styles_if_webkit : true,
|
22
|
+
paste_convert_middot_lists : true,
|
23
|
+
paste_convert_headers_to_strong : false,
|
24
|
+
paste_dialog_width : "450",
|
25
|
+
paste_dialog_height : "400",
|
26
|
+
paste_text_use_dialog : false,
|
27
|
+
paste_text_sticky : false,
|
28
|
+
paste_text_notifyalways : false,
|
29
|
+
paste_text_linebreaktype : "p",
|
30
|
+
paste_text_replacements : [
|
31
|
+
[/\u2026/g, "..."],
|
32
|
+
[/[\x93\x94\u201c\u201d]/g, '"'],
|
33
|
+
[/[\x60\x91\x92\u2018\u2019]/g, "'"]
|
34
|
+
]
|
35
|
+
};
|
36
|
+
|
37
|
+
function getParam(ed, name) {
|
38
|
+
return ed.getParam(name, defs[name]);
|
39
|
+
}
|
40
|
+
|
41
|
+
tinymce.create('tinymce.plugins.PastePlugin', {
|
42
|
+
init : function(ed, url) {
|
43
|
+
var t = this;
|
44
|
+
|
45
|
+
t.editor = ed;
|
46
|
+
t.url = url;
|
47
|
+
|
48
|
+
// Setup plugin events
|
49
|
+
t.onPreProcess = new tinymce.util.Dispatcher(t);
|
50
|
+
t.onPostProcess = new tinymce.util.Dispatcher(t);
|
51
|
+
|
52
|
+
// Register default handlers
|
53
|
+
t.onPreProcess.add(t._preProcess);
|
54
|
+
t.onPostProcess.add(t._postProcess);
|
55
|
+
|
56
|
+
// Register optional preprocess handler
|
57
|
+
t.onPreProcess.add(function(pl, o) {
|
58
|
+
ed.execCallback('paste_preprocess', pl, o);
|
59
|
+
});
|
60
|
+
|
61
|
+
// Register optional postprocess
|
62
|
+
t.onPostProcess.add(function(pl, o) {
|
63
|
+
ed.execCallback('paste_postprocess', pl, o);
|
64
|
+
});
|
65
|
+
|
66
|
+
// Initialize plain text flag
|
67
|
+
ed.pasteAsPlainText = false;
|
68
|
+
|
69
|
+
// This function executes the process handlers and inserts the contents
|
70
|
+
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
71
|
+
function process(o, force_rich) {
|
72
|
+
var dom = ed.dom;
|
73
|
+
|
74
|
+
// Execute pre process handlers
|
75
|
+
t.onPreProcess.dispatch(t, o);
|
76
|
+
|
77
|
+
// Create DOM structure
|
78
|
+
o.node = dom.create('div', 0, o.content);
|
79
|
+
|
80
|
+
// Execute post process handlers
|
81
|
+
t.onPostProcess.dispatch(t, o);
|
82
|
+
|
83
|
+
// Serialize content
|
84
|
+
o.content = ed.serializer.serialize(o.node, {getInner : 1});
|
85
|
+
|
86
|
+
// Plain text option active?
|
87
|
+
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
88
|
+
t._insertPlainText(ed, dom, o.content);
|
89
|
+
|
90
|
+
if (!getParam(ed, "paste_text_sticky")) {
|
91
|
+
ed.pasteAsPlainText = false;
|
92
|
+
ed.controlManager.setActive("pastetext", false);
|
93
|
+
}
|
94
|
+
} else if (/<(p|h[1-6]|ul|ol)/.test(o.content)) {
|
95
|
+
// Handle insertion of contents containing block elements separately
|
96
|
+
t._insertBlockContent(ed, dom, o.content);
|
97
|
+
} else {
|
98
|
+
t._insert(o.content);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
// Add command for external usage
|
103
|
+
ed.addCommand('mceInsertClipboardContent', function(u, o) {
|
104
|
+
process(o, true);
|
105
|
+
});
|
106
|
+
|
107
|
+
if (!getParam(ed, "paste_text_use_dialog")) {
|
108
|
+
ed.addCommand('mcePasteText', function(u, v) {
|
109
|
+
var cookie = tinymce.util.Cookie;
|
110
|
+
|
111
|
+
ed.pasteAsPlainText = !ed.pasteAsPlainText;
|
112
|
+
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
|
113
|
+
|
114
|
+
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
|
115
|
+
if (getParam(ed, "paste_text_sticky")) {
|
116
|
+
ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.");
|
117
|
+
} else {
|
118
|
+
ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode.");
|
119
|
+
}
|
120
|
+
|
121
|
+
if (!getParam(ed, "paste_text_notifyalways")) {
|
122
|
+
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
|
123
|
+
}
|
124
|
+
}
|
125
|
+
});
|
126
|
+
}
|
127
|
+
|
128
|
+
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
|
129
|
+
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
|
130
|
+
|
131
|
+
// This function grabs the contents from the clipboard by adding a
|
132
|
+
// hidden div and placing the caret inside it and after the browser paste
|
133
|
+
// is done it grabs that contents and processes that
|
134
|
+
function grabContent(e) {
|
135
|
+
var n, or, rng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY;
|
136
|
+
|
137
|
+
if (dom.get('_mcePaste'))
|
138
|
+
return;
|
139
|
+
|
140
|
+
// Create container to paste into
|
141
|
+
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF');
|
142
|
+
|
143
|
+
// If contentEditable mode we need to find out the position of the closest element
|
144
|
+
if (body != ed.getDoc().body)
|
145
|
+
posY = dom.getPos(ed.selection.getStart(), body).y;
|
146
|
+
else
|
147
|
+
posY = body.scrollTop;
|
148
|
+
|
149
|
+
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
150
|
+
dom.setStyles(n, {
|
151
|
+
position : 'absolute',
|
152
|
+
left : -10000,
|
153
|
+
top : posY,
|
154
|
+
width : 1,
|
155
|
+
height : 1,
|
156
|
+
overflow : 'hidden'
|
157
|
+
});
|
158
|
+
|
159
|
+
if (tinymce.isIE) {
|
160
|
+
// Select the container
|
161
|
+
rng = dom.doc.body.createTextRange();
|
162
|
+
rng.moveToElementText(n);
|
163
|
+
rng.execCommand('Paste');
|
164
|
+
|
165
|
+
// Remove container
|
166
|
+
dom.remove(n);
|
167
|
+
|
168
|
+
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
169
|
+
// to IE security settings so we pass the junk though better than nothing right
|
170
|
+
if (n.innerHTML === '\uFEFF') {
|
171
|
+
ed.execCommand('mcePasteWord');
|
172
|
+
e.preventDefault();
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
// Process contents
|
177
|
+
process({content : n.innerHTML});
|
178
|
+
|
179
|
+
// Block the real paste event
|
180
|
+
return tinymce.dom.Event.cancel(e);
|
181
|
+
} else {
|
182
|
+
function block(e) {
|
183
|
+
e.preventDefault();
|
184
|
+
};
|
185
|
+
|
186
|
+
// Block mousedown and click to prevent selection change
|
187
|
+
dom.bind(ed.getDoc(), 'mousedown', block);
|
188
|
+
dom.bind(ed.getDoc(), 'keydown', block);
|
189
|
+
|
190
|
+
or = ed.selection.getRng();
|
191
|
+
|
192
|
+
// Move caret into hidden div
|
193
|
+
n = n.firstChild;
|
194
|
+
rng = ed.getDoc().createRange();
|
195
|
+
rng.setStart(n, 0);
|
196
|
+
rng.setEnd(n, 1);
|
197
|
+
sel.setRng(rng);
|
198
|
+
|
199
|
+
// Wait a while and grab the pasted contents
|
200
|
+
window.setTimeout(function() {
|
201
|
+
var h = '', nl = dom.select('div.mcePaste');
|
202
|
+
|
203
|
+
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
204
|
+
each(nl, function(n) {
|
205
|
+
// WebKit duplicates the divs so we need to remove them
|
206
|
+
each(dom.select('div.mcePaste', n), function(n) {
|
207
|
+
dom.remove(n, 1);
|
208
|
+
});
|
209
|
+
|
210
|
+
// Contents in WebKit is sometimes wrapped in a apple style span so we need to grab it from that one
|
211
|
+
h += (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
|
212
|
+
});
|
213
|
+
|
214
|
+
// Remove the nodes
|
215
|
+
each(nl, function(n) {
|
216
|
+
dom.remove(n);
|
217
|
+
});
|
218
|
+
|
219
|
+
// Restore the old selection
|
220
|
+
if (or)
|
221
|
+
sel.setRng(or);
|
222
|
+
|
223
|
+
process({content : h});
|
224
|
+
|
225
|
+
// Unblock events ones we got the contents
|
226
|
+
dom.unbind(ed.getDoc(), 'mousedown', block);
|
227
|
+
dom.unbind(ed.getDoc(), 'keydown', block);
|
228
|
+
}, 0);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
// Check if we should use the new auto process method
|
233
|
+
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
234
|
+
// Is it's Opera or older FF use key handler
|
235
|
+
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
236
|
+
ed.onKeyDown.add(function(ed, e) {
|
237
|
+
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
238
|
+
grabContent(e);
|
239
|
+
});
|
240
|
+
} else {
|
241
|
+
// Grab contents on paste event on Gecko and WebKit
|
242
|
+
ed.onPaste.addToTop(function(ed, e) {
|
243
|
+
return grabContent(e);
|
244
|
+
});
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
// Block all drag/drop events
|
249
|
+
if (getParam(ed, "paste_block_drop")) {
|
250
|
+
ed.onInit.add(function() {
|
251
|
+
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
|
252
|
+
e.preventDefault();
|
253
|
+
e.stopPropagation();
|
254
|
+
|
255
|
+
return false;
|
256
|
+
});
|
257
|
+
});
|
258
|
+
}
|
259
|
+
|
260
|
+
// Add legacy support
|
261
|
+
t._legacySupport();
|
262
|
+
},
|
263
|
+
|
264
|
+
getInfo : function() {
|
265
|
+
return {
|
266
|
+
longname : 'Paste text/word',
|
267
|
+
author : 'Moxiecode Systems AB',
|
268
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
269
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
270
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
271
|
+
};
|
272
|
+
},
|
273
|
+
|
274
|
+
_preProcess : function(pl, o) {
|
275
|
+
//console.log('Before preprocess:' + o.content);
|
276
|
+
|
277
|
+
var ed = this.editor,
|
278
|
+
h = o.content,
|
279
|
+
grep = tinymce.grep,
|
280
|
+
explode = tinymce.explode,
|
281
|
+
trim = tinymce.trim,
|
282
|
+
len, stripClass;
|
283
|
+
|
284
|
+
function process(items) {
|
285
|
+
each(items, function(v) {
|
286
|
+
// Remove or replace
|
287
|
+
if (v.constructor == RegExp)
|
288
|
+
h = h.replace(v, '');
|
289
|
+
else
|
290
|
+
h = h.replace(v[0], v[1]);
|
291
|
+
});
|
292
|
+
}
|
293
|
+
|
294
|
+
// Detect Word content and process it more aggressive
|
295
|
+
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
296
|
+
o.wordContent = true; // Mark the pasted contents as word specific content
|
297
|
+
//console.log('Word contents detected.');
|
298
|
+
|
299
|
+
// Process away some basic content
|
300
|
+
process([
|
301
|
+
/^\s*( )+/gi, // entities at the start of contents
|
302
|
+
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
303
|
+
]);
|
304
|
+
|
305
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
306
|
+
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
307
|
+
}
|
308
|
+
|
309
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
310
|
+
process([
|
311
|
+
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
312
|
+
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol spans to item markers
|
313
|
+
]);
|
314
|
+
}
|
315
|
+
|
316
|
+
process([
|
317
|
+
// Word comments like conditional comments etc
|
318
|
+
/<!--[\s\S]+?-->/gi,
|
319
|
+
|
320
|
+
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
321
|
+
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
322
|
+
|
323
|
+
// Convert <s> into <strike> for line-though
|
324
|
+
[/<(\/?)s>/gi, "<$1strike>"],
|
325
|
+
|
326
|
+
// Replace nsbp entites to char since it's easier to handle
|
327
|
+
[/ /gi, "\u00a0"]
|
328
|
+
]);
|
329
|
+
|
330
|
+
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
331
|
+
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
|
332
|
+
do {
|
333
|
+
len = h.length;
|
334
|
+
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
335
|
+
} while (len != h.length);
|
336
|
+
|
337
|
+
// Remove all spans if no styles is to be retained
|
338
|
+
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
339
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
340
|
+
} else {
|
341
|
+
// We're keeping styles, so at least clean them up.
|
342
|
+
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
343
|
+
|
344
|
+
process([
|
345
|
+
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
346
|
+
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
347
|
+
function(str, spaces) {
|
348
|
+
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
349
|
+
}
|
350
|
+
],
|
351
|
+
|
352
|
+
// Examine all styles: delete junk, transform some, and keep the rest
|
353
|
+
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
354
|
+
function(str, tag, style) {
|
355
|
+
var n = [],
|
356
|
+
i = 0,
|
357
|
+
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
358
|
+
|
359
|
+
// Examine each style definition within the tag's style attribute
|
360
|
+
each(s, function(v) {
|
361
|
+
var name, value,
|
362
|
+
parts = explode(v, ":");
|
363
|
+
|
364
|
+
function ensureUnits(v) {
|
365
|
+
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
366
|
+
}
|
367
|
+
|
368
|
+
if (parts.length == 2) {
|
369
|
+
name = parts[0].toLowerCase();
|
370
|
+
value = parts[1].toLowerCase();
|
371
|
+
|
372
|
+
// Translate certain MS Office styles into their CSS equivalents
|
373
|
+
switch (name) {
|
374
|
+
case "mso-padding-alt":
|
375
|
+
case "mso-padding-top-alt":
|
376
|
+
case "mso-padding-right-alt":
|
377
|
+
case "mso-padding-bottom-alt":
|
378
|
+
case "mso-padding-left-alt":
|
379
|
+
case "mso-margin-alt":
|
380
|
+
case "mso-margin-top-alt":
|
381
|
+
case "mso-margin-right-alt":
|
382
|
+
case "mso-margin-bottom-alt":
|
383
|
+
case "mso-margin-left-alt":
|
384
|
+
case "mso-table-layout-alt":
|
385
|
+
case "mso-height":
|
386
|
+
case "mso-width":
|
387
|
+
case "mso-vertical-align-alt":
|
388
|
+
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
389
|
+
return;
|
390
|
+
|
391
|
+
case "horiz-align":
|
392
|
+
n[i++] = "text-align:" + value;
|
393
|
+
return;
|
394
|
+
|
395
|
+
case "vert-align":
|
396
|
+
n[i++] = "vertical-align:" + value;
|
397
|
+
return;
|
398
|
+
|
399
|
+
case "font-color":
|
400
|
+
case "mso-foreground":
|
401
|
+
n[i++] = "color:" + value;
|
402
|
+
return;
|
403
|
+
|
404
|
+
case "mso-background":
|
405
|
+
case "mso-highlight":
|
406
|
+
n[i++] = "background:" + value;
|
407
|
+
return;
|
408
|
+
|
409
|
+
case "mso-default-height":
|
410
|
+
n[i++] = "min-height:" + ensureUnits(value);
|
411
|
+
return;
|
412
|
+
|
413
|
+
case "mso-default-width":
|
414
|
+
n[i++] = "min-width:" + ensureUnits(value);
|
415
|
+
return;
|
416
|
+
|
417
|
+
case "mso-padding-between-alt":
|
418
|
+
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
419
|
+
return;
|
420
|
+
|
421
|
+
case "text-line-through":
|
422
|
+
if ((value == "single") || (value == "double")) {
|
423
|
+
n[i++] = "text-decoration:line-through";
|
424
|
+
}
|
425
|
+
return;
|
426
|
+
|
427
|
+
case "mso-zero-height":
|
428
|
+
if (value == "yes") {
|
429
|
+
n[i++] = "display:none";
|
430
|
+
}
|
431
|
+
return;
|
432
|
+
}
|
433
|
+
|
434
|
+
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
435
|
+
if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
|
436
|
+
return;
|
437
|
+
}
|
438
|
+
|
439
|
+
// If it reached this point, it must be a valid CSS style
|
440
|
+
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
441
|
+
}
|
442
|
+
});
|
443
|
+
|
444
|
+
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
445
|
+
if (i > 0) {
|
446
|
+
return tag + ' style="' + n.join(';') + '"';
|
447
|
+
} else {
|
448
|
+
return tag;
|
449
|
+
}
|
450
|
+
}
|
451
|
+
]
|
452
|
+
]);
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
// Replace headers with <strong>
|
457
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
458
|
+
process([
|
459
|
+
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
460
|
+
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
461
|
+
]);
|
462
|
+
}
|
463
|
+
|
464
|
+
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
465
|
+
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
466
|
+
stripClass = getParam(ed, "paste_strip_class_attributes");
|
467
|
+
|
468
|
+
if (stripClass !== "none") {
|
469
|
+
function removeClasses(match, g1) {
|
470
|
+
if (stripClass === "all")
|
471
|
+
return '';
|
472
|
+
|
473
|
+
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
474
|
+
function(v) {
|
475
|
+
return (/^(?!mso)/i.test(v));
|
476
|
+
}
|
477
|
+
);
|
478
|
+
|
479
|
+
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
480
|
+
};
|
481
|
+
|
482
|
+
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
483
|
+
h = h.replace(/ class=(\w+)/gi, removeClasses);
|
484
|
+
}
|
485
|
+
|
486
|
+
// Remove spans option
|
487
|
+
if (getParam(ed, "paste_remove_spans")) {
|
488
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
489
|
+
}
|
490
|
+
|
491
|
+
//console.log('After preprocess:' + h);
|
492
|
+
|
493
|
+
o.content = h;
|
494
|
+
},
|
495
|
+
|
496
|
+
/**
|
497
|
+
* Various post process items.
|
498
|
+
*/
|
499
|
+
_postProcess : function(pl, o) {
|
500
|
+
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
501
|
+
|
502
|
+
if (o.wordContent) {
|
503
|
+
// Remove named anchors or TOC links
|
504
|
+
each(dom.select('a', o.node), function(a) {
|
505
|
+
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
506
|
+
dom.remove(a, 1);
|
507
|
+
});
|
508
|
+
|
509
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
510
|
+
t._convertLists(pl, o);
|
511
|
+
}
|
512
|
+
|
513
|
+
// Process styles
|
514
|
+
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
515
|
+
|
516
|
+
// Process only if a string was specified and not equal to "all" or "*"
|
517
|
+
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
518
|
+
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
519
|
+
|
520
|
+
// Retains some style properties
|
521
|
+
each(dom.select('*', o.node), function(el) {
|
522
|
+
var newStyle = {}, npc = 0, i, sp, sv;
|
523
|
+
|
524
|
+
// Store a subset of the existing styles
|
525
|
+
if (styleProps) {
|
526
|
+
for (i = 0; i < styleProps.length; i++) {
|
527
|
+
sp = styleProps[i];
|
528
|
+
sv = dom.getStyle(el, sp);
|
529
|
+
|
530
|
+
if (sv) {
|
531
|
+
newStyle[sp] = sv;
|
532
|
+
npc++;
|
533
|
+
}
|
534
|
+
}
|
535
|
+
}
|
536
|
+
|
537
|
+
// Remove all of the existing styles
|
538
|
+
dom.setAttrib(el, 'style', '');
|
539
|
+
|
540
|
+
if (styleProps && npc > 0)
|
541
|
+
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
542
|
+
else // Remove empty span tags that do not have class attributes
|
543
|
+
if (el.nodeName == 'SPAN' && !el.className)
|
544
|
+
dom.remove(el, true);
|
545
|
+
});
|
546
|
+
}
|
547
|
+
}
|
548
|
+
|
549
|
+
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
550
|
+
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
551
|
+
each(dom.select('*[style]', o.node), function(el) {
|
552
|
+
el.removeAttribute('style');
|
553
|
+
el.removeAttribute('_mce_style');
|
554
|
+
});
|
555
|
+
} else {
|
556
|
+
if (tinymce.isWebKit) {
|
557
|
+
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
|
558
|
+
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
559
|
+
each(dom.select('*', o.node), function(el) {
|
560
|
+
el.removeAttribute('_mce_style');
|
561
|
+
});
|
562
|
+
}
|
563
|
+
}
|
564
|
+
},
|
565
|
+
|
566
|
+
/**
|
567
|
+
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
568
|
+
*/
|
569
|
+
_convertLists : function(pl, o) {
|
570
|
+
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
571
|
+
|
572
|
+
// Convert middot lists into real semantic lists
|
573
|
+
each(dom.select('p', o.node), function(p) {
|
574
|
+
var sib, val = '', type, html, idx, parents;
|
575
|
+
|
576
|
+
// Get text node value at beginning of paragraph
|
577
|
+
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
578
|
+
val += sib.nodeValue;
|
579
|
+
|
580
|
+
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
581
|
+
|
582
|
+
// Detect unordered lists look for bullets
|
583
|
+
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(val))
|
584
|
+
type = 'ul';
|
585
|
+
|
586
|
+
// Detect ordered lists 1., a. or ixv.
|
587
|
+
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(val))
|
588
|
+
type = 'ol';
|
589
|
+
|
590
|
+
// Check if node value matches the list pattern: o
|
591
|
+
if (type) {
|
592
|
+
margin = parseFloat(p.style.marginLeft || 0);
|
593
|
+
|
594
|
+
if (margin > lastMargin)
|
595
|
+
levels.push(margin);
|
596
|
+
|
597
|
+
if (!listElm || type != lastType) {
|
598
|
+
listElm = dom.create(type);
|
599
|
+
dom.insertAfter(listElm, p);
|
600
|
+
} else {
|
601
|
+
// Nested list element
|
602
|
+
if (margin > lastMargin) {
|
603
|
+
listElm = li.appendChild(dom.create(type));
|
604
|
+
} else if (margin < lastMargin) {
|
605
|
+
// Find parent level based on margin value
|
606
|
+
idx = tinymce.inArray(levels, margin);
|
607
|
+
parents = dom.getParents(listElm.parentNode, type);
|
608
|
+
listElm = parents[parents.length - 1 - idx] || listElm;
|
609
|
+
}
|
610
|
+
}
|
611
|
+
|
612
|
+
// Remove middot or number spans if they exists
|
613
|
+
each(dom.select('span', p), function(span) {
|
614
|
+
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
615
|
+
|
616
|
+
// Remove span with the middot or the number
|
617
|
+
if (type == 'ul' && /^[\u2022\u00b7\u00a7\u00d8o]/.test(html))
|
618
|
+
dom.remove(span);
|
619
|
+
else if (/^[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
620
|
+
dom.remove(span);
|
621
|
+
});
|
622
|
+
|
623
|
+
html = p.innerHTML;
|
624
|
+
|
625
|
+
// Remove middot/list items
|
626
|
+
if (type == 'ul')
|
627
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/, '');
|
628
|
+
else
|
629
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, '');
|
630
|
+
|
631
|
+
// Create li and add paragraph data into the new li
|
632
|
+
li = listElm.appendChild(dom.create('li', 0, html));
|
633
|
+
dom.remove(p);
|
634
|
+
|
635
|
+
lastMargin = margin;
|
636
|
+
lastType = type;
|
637
|
+
} else
|
638
|
+
listElm = lastMargin = 0; // End list element
|
639
|
+
});
|
640
|
+
|
641
|
+
// Remove any left over makers
|
642
|
+
html = o.node.innerHTML;
|
643
|
+
if (html.indexOf('__MCE_ITEM__') != -1)
|
644
|
+
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
645
|
+
},
|
646
|
+
|
647
|
+
/**
|
648
|
+
* This method will split the current block parent and insert the contents inside the split position.
|
649
|
+
* This logic can be improved so text nodes at the start/end remain in the start/end block elements
|
650
|
+
*/
|
651
|
+
_insertBlockContent : function(ed, dom, content) {
|
652
|
+
var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';
|
653
|
+
|
654
|
+
function select(n) {
|
655
|
+
var r;
|
656
|
+
|
657
|
+
if (tinymce.isIE) {
|
658
|
+
r = ed.getDoc().body.createTextRange();
|
659
|
+
r.moveToElementText(n);
|
660
|
+
r.collapse(false);
|
661
|
+
r.select();
|
662
|
+
} else {
|
663
|
+
sel.select(n, 1);
|
664
|
+
sel.collapse(false);
|
665
|
+
}
|
666
|
+
}
|
667
|
+
|
668
|
+
// Insert a marker for the caret position
|
669
|
+
this._insert('<span id="' + markerId + '"> </span>', 1);
|
670
|
+
marker = dom.get(markerId);
|
671
|
+
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
|
672
|
+
|
673
|
+
// If it's a parent block but not a table cell
|
674
|
+
if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
|
675
|
+
// Split parent block
|
676
|
+
marker = dom.split(parentBlock, marker);
|
677
|
+
|
678
|
+
// Insert nodes before the marker
|
679
|
+
each(dom.create('div', 0, content).childNodes, function(n) {
|
680
|
+
last = marker.parentNode.insertBefore(n.cloneNode(true), marker);
|
681
|
+
});
|
682
|
+
|
683
|
+
// Move caret after marker
|
684
|
+
select(last);
|
685
|
+
} else {
|
686
|
+
dom.setOuterHTML(marker, content);
|
687
|
+
sel.select(ed.getBody(), 1);
|
688
|
+
sel.collapse(0);
|
689
|
+
}
|
690
|
+
|
691
|
+
// Remove marker if it's left
|
692
|
+
while (elm = dom.get(markerId))
|
693
|
+
dom.remove(elm);
|
694
|
+
|
695
|
+
// Get element, position and height
|
696
|
+
elm = sel.getStart();
|
697
|
+
vp = dom.getViewPort(ed.getWin());
|
698
|
+
y = ed.dom.getPos(elm).y;
|
699
|
+
elmHeight = elm.clientHeight;
|
700
|
+
|
701
|
+
// Is element within viewport if not then scroll it into view
|
702
|
+
if (y < vp.y || y + elmHeight > vp.y + vp.h)
|
703
|
+
ed.getDoc().body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
704
|
+
},
|
705
|
+
|
706
|
+
/**
|
707
|
+
* Inserts the specified contents at the caret position.
|
708
|
+
*/
|
709
|
+
_insert : function(h, skip_undo) {
|
710
|
+
var ed = this.editor;
|
711
|
+
|
712
|
+
// First delete the contents seems to work better on WebKit
|
713
|
+
if (!ed.selection.isCollapsed())
|
714
|
+
ed.getDoc().execCommand('Delete', false, null);
|
715
|
+
|
716
|
+
// It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents
|
717
|
+
ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo});
|
718
|
+
},
|
719
|
+
|
720
|
+
/**
|
721
|
+
* Instead of the old plain text method which tried to re-create a paste operation, the
|
722
|
+
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
723
|
+
* This function is passed the same input that the regular paste plugin produces.
|
724
|
+
* It performs additional scrubbing and produces (and inserts) the plain text.
|
725
|
+
* This approach leverages all of the great existing functionality in the paste
|
726
|
+
* plugin, and requires minimal changes to add the new functionality.
|
727
|
+
* Speednet - June 2009
|
728
|
+
*/
|
729
|
+
_insertPlainText : function(ed, dom, h) {
|
730
|
+
var i, len, pos, rpos, node, breakElms, before, after,
|
731
|
+
w = ed.getWin(),
|
732
|
+
d = ed.getDoc(),
|
733
|
+
sel = ed.selection,
|
734
|
+
is = tinymce.is,
|
735
|
+
inArray = tinymce.inArray,
|
736
|
+
linebr = getParam(ed, "paste_text_linebreaktype"),
|
737
|
+
rl = getParam(ed, "paste_text_replacements");
|
738
|
+
|
739
|
+
function process(items) {
|
740
|
+
each(items, function(v) {
|
741
|
+
if (v.constructor == RegExp)
|
742
|
+
h = h.replace(v, "");
|
743
|
+
else
|
744
|
+
h = h.replace(v[0], v[1]);
|
745
|
+
});
|
746
|
+
};
|
747
|
+
|
748
|
+
if ((typeof(h) === "string") && (h.length > 0)) {
|
749
|
+
if (!entities)
|
750
|
+
entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");
|
751
|
+
|
752
|
+
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
753
|
+
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
|
754
|
+
process([
|
755
|
+
/[\n\r]+/g
|
756
|
+
]);
|
757
|
+
} else {
|
758
|
+
// Otherwise just get rid of carriage returns (only need linefeeds)
|
759
|
+
process([
|
760
|
+
/\r+/g
|
761
|
+
]);
|
762
|
+
}
|
763
|
+
|
764
|
+
process([
|
765
|
+
[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
|
766
|
+
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
767
|
+
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
768
|
+
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
769
|
+
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
770
|
+
[
|
771
|
+
// HTML entity
|
772
|
+
/&(#\d+|[a-z0-9]{1,10});/gi,
|
773
|
+
|
774
|
+
// Replace with actual character
|
775
|
+
function(e, s) {
|
776
|
+
if (s.charAt(0) === "#") {
|
777
|
+
return String.fromCharCode(s.slice(1));
|
778
|
+
}
|
779
|
+
else {
|
780
|
+
return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";
|
781
|
+
}
|
782
|
+
}
|
783
|
+
],
|
784
|
+
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
|
785
|
+
[/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
|
786
|
+
/^\s+|\s+$/g // Trim the front & back
|
787
|
+
]);
|
788
|
+
|
789
|
+
h = dom.encode(h);
|
790
|
+
|
791
|
+
// Delete any highlighted text before pasting
|
792
|
+
if (!sel.isCollapsed()) {
|
793
|
+
d.execCommand("Delete", false, null);
|
794
|
+
}
|
795
|
+
|
796
|
+
// Perform default or custom replacements
|
797
|
+
if (is(rl, "array") || (is(rl, "array"))) {
|
798
|
+
process(rl);
|
799
|
+
}
|
800
|
+
else if (is(rl, "string")) {
|
801
|
+
process(new RegExp(rl, "gi"));
|
802
|
+
}
|
803
|
+
|
804
|
+
// Treat paragraphs as specified in the config
|
805
|
+
if (linebr == "none") {
|
806
|
+
process([
|
807
|
+
[/\n+/g, " "]
|
808
|
+
]);
|
809
|
+
}
|
810
|
+
else if (linebr == "br") {
|
811
|
+
process([
|
812
|
+
[/\n/g, "<br />"]
|
813
|
+
]);
|
814
|
+
}
|
815
|
+
else {
|
816
|
+
process([
|
817
|
+
/^\s+|\s+$/g,
|
818
|
+
[/\n\n/g, "</p><p>"],
|
819
|
+
[/\n/g, "<br />"]
|
820
|
+
]);
|
821
|
+
}
|
822
|
+
|
823
|
+
// This next piece of code handles the situation where we're pasting more than one paragraph of plain
|
824
|
+
// text, and we are pasting the content into the middle of a block node in the editor. The block
|
825
|
+
// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
|
826
|
+
// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
|
827
|
+
// pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
|
828
|
+
// "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
|
829
|
+
// now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
|
830
|
+
// plain text take the same style as the existing paragraph.)
|
831
|
+
if ((pos = h.indexOf("</p><p>")) != -1) {
|
832
|
+
rpos = h.lastIndexOf("</p><p>");
|
833
|
+
node = sel.getNode();
|
834
|
+
breakElms = []; // Get list of elements to break
|
835
|
+
|
836
|
+
do {
|
837
|
+
if (node.nodeType == 1) {
|
838
|
+
// Don't break tables and break at body
|
839
|
+
if (node.nodeName == "TD" || node.nodeName == "BODY") {
|
840
|
+
break;
|
841
|
+
}
|
842
|
+
|
843
|
+
breakElms[breakElms.length] = node;
|
844
|
+
}
|
845
|
+
} while (node = node.parentNode);
|
846
|
+
|
847
|
+
// Are we in the middle of a block node?
|
848
|
+
if (breakElms.length > 0) {
|
849
|
+
before = h.substring(0, pos);
|
850
|
+
after = "";
|
851
|
+
|
852
|
+
for (i=0, len=breakElms.length; i<len; i++) {
|
853
|
+
before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
|
854
|
+
after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
|
855
|
+
}
|
856
|
+
|
857
|
+
if (pos == rpos) {
|
858
|
+
h = before + after + h.substring(pos+7);
|
859
|
+
}
|
860
|
+
else {
|
861
|
+
h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
|
862
|
+
}
|
863
|
+
}
|
864
|
+
}
|
865
|
+
|
866
|
+
// Insert content at the caret, plus add a marker for repositioning the caret
|
867
|
+
ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker"> </span>');
|
868
|
+
|
869
|
+
// Reposition the caret to the marker, which was placed immediately after the inserted content.
|
870
|
+
// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
|
871
|
+
// The second part of the code scrolls the content up if the caret is positioned off-screen.
|
872
|
+
// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
|
873
|
+
window.setTimeout(function() {
|
874
|
+
var marker = dom.get('_plain_text_marker'),
|
875
|
+
elm, vp, y, elmHeight;
|
876
|
+
|
877
|
+
sel.select(marker, false);
|
878
|
+
d.execCommand("Delete", false, null);
|
879
|
+
marker = null;
|
880
|
+
|
881
|
+
// Get element, position and height
|
882
|
+
elm = sel.getStart();
|
883
|
+
vp = dom.getViewPort(w);
|
884
|
+
y = dom.getPos(elm).y;
|
885
|
+
elmHeight = elm.clientHeight;
|
886
|
+
|
887
|
+
// Is element within viewport if not then scroll it into view
|
888
|
+
if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
|
889
|
+
d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
890
|
+
}
|
891
|
+
}, 0);
|
892
|
+
}
|
893
|
+
},
|
894
|
+
|
895
|
+
/**
|
896
|
+
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
897
|
+
*/
|
898
|
+
_legacySupport : function() {
|
899
|
+
var t = this, ed = t.editor;
|
900
|
+
|
901
|
+
// Register command(s) for backwards compatibility
|
902
|
+
ed.addCommand("mcePasteWord", function() {
|
903
|
+
ed.windowManager.open({
|
904
|
+
file: t.url + "/pasteword.htm",
|
905
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
906
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
907
|
+
inline: 1
|
908
|
+
});
|
909
|
+
});
|
910
|
+
|
911
|
+
if (getParam(ed, "paste_text_use_dialog")) {
|
912
|
+
ed.addCommand("mcePasteText", function() {
|
913
|
+
ed.windowManager.open({
|
914
|
+
file : t.url + "/pastetext.htm",
|
915
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
916
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
917
|
+
inline : 1
|
918
|
+
});
|
919
|
+
});
|
920
|
+
}
|
921
|
+
|
922
|
+
// Register button for backwards compatibility
|
923
|
+
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
924
|
+
}
|
925
|
+
});
|
926
|
+
|
927
|
+
// Register plugin
|
928
|
+
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
929
|
+
})();
|