cable 0.1.0 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/cable_settings_controller.rb +20 -0
- data/app/controllers/{cable/admin_controller.rb → admin_controller.rb} +1 -2
- data/app/controllers/attachable_assets_controller.rb +81 -0
- data/app/controllers/attachable_documents_controller.rb +22 -0
- data/app/controllers/attachable_images_controller.rb +22 -0
- data/app/controllers/cable/cable_admin_controller.rb +8 -0
- data/app/helpers/admin/menus_helper.rb +24 -0
- data/app/helpers/admin_helper.rb +2 -2
- data/app/models/attachable_asset.rb +11 -0
- data/app/models/attachable_document.rb +2 -0
- data/app/models/attachable_image.rb +5 -0
- data/app/views/admin/_admin_user_login.html.erb +5 -0
- data/app/views/admin/cable_settings/_cable_setting.html.erb +4 -0
- data/app/views/admin/cable_settings/edit.html.erb +1 -0
- data/app/views/admin/cable_settings/index.html.erb +47 -0
- data/app/views/admin/index.html.erb +10 -0
- data/app/views/attachable_assets/index.html.erb +4 -0
- data/app/views/attachable_assets/new.html.erb +7 -0
- data/app/views/attachable_assets/show.html.erb +2 -0
- data/app/views/{cable/layouts → layouts}/_messages.html.erb +0 -0
- data/app/views/layouts/admin.html.erb +56 -0
- data/config/admin_navigation.rb +18 -0
- data/config/navigation.rb +0 -0
- data/config/routes.rb +5 -1
- data/lib/cable.rb +88 -1
- data/lib/cable/acts_as_cable.rb +36 -0
- data/lib/cable/base.rb +19 -0
- data/lib/cable/block.rb +46 -0
- data/lib/cable/capistrano.rb +12 -0
- data/lib/cable/controllers/cable_controller_helpers.rb +27 -0
- data/lib/cable/engine.rb +6 -1
- data/lib/cable/errors/resource_association_error.rb +4 -0
- data/lib/cable/media/acts_as_attachable.rb +44 -0
- data/lib/cable/media/asset.rb +3 -0
- data/lib/cable/menu.rb +3 -0
- data/lib/cable/menu/acts_as_cable_menu.rb +46 -0
- data/lib/cable/menu/base.rb +166 -0
- data/lib/cable/menu/simple_navigation_methods.rb +24 -0
- data/lib/cable/menu/url_helper.rb +17 -0
- data/lib/cable/orm/active_record.rb +29 -0
- data/lib/cable/page.rb +3 -0
- data/lib/cable/rails/routes.rb +49 -0
- data/lib/cable/railtie.rb +32 -0
- data/lib/cable/schema.rb +52 -0
- data/lib/cable/setting.rb +3 -0
- data/lib/cable/special_action.rb +19 -0
- data/lib/generators/cable/install_generator.rb +61 -21
- data/lib/generators/cable/media/media_generator.rb +41 -0
- data/lib/generators/cable/media/templates/migration.rb +19 -0
- data/lib/generators/cable/media/templates/model.rb +3 -0
- data/lib/generators/cable/menu/menu_generator.rb +83 -0
- data/lib/generators/cable/menu/templates/controller.rb +118 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu.html.erb +31 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_children_table.html.erb +60 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_tree.html.erb +10 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_vitals.html.erb +30 -0
- data/lib/generators/cable/menu/templates/erb/menus/_resource.html.erb +29 -0
- data/lib/generators/cable/menu/templates/erb/menus/_resource_fields.html.erb +10 -0
- data/lib/generators/cable/menu/templates/erb/menus/_tree.html.erb +16 -0
- data/lib/generators/cable/menu/templates/erb/menus/edit.html.erb +1 -0
- data/lib/generators/cable/menu/templates/erb/menus/index.html.erb +28 -0
- data/lib/generators/cable/menu/templates/erb/menus/move.html.erb +41 -0
- data/lib/generators/cable/menu/templates/erb/menus/new.html.erb +1 -0
- data/lib/generators/cable/menu/templates/erb/menus/show.html.erb +16 -0
- data/lib/generators/cable/menu/templates/erb/menus/table.html.erb +9 -0
- data/lib/generators/cable/menu/templates/erb/partials/_menu_fields.html.erb +12 -0
- data/lib/generators/cable/menu/templates/migration.rb +24 -0
- data/lib/generators/cable/menu/templates/model.rb +4 -0
- data/lib/generators/cable/orm_helpers.rb +18 -0
- data/lib/generators/cable/override_generator.rb +33 -0
- data/lib/generators/cable/resource/resource_generator.rb +70 -0
- data/lib/generators/cable/resource/templates/controller.rb +52 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/_form.html.erb +30 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/edit.html.erb +6 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/index.html.erb +54 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/new.html.erb +5 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/show.html.erb +12 -0
- data/lib/generators/cable/resource/templates/migration.rb +14 -0
- data/lib/generators/cable/resource/templates/model.rb +3 -0
- data/lib/generators/templates/block.rb +3 -0
- data/lib/generators/templates/create_blocks.rb +27 -0
- data/lib/generators/templates/create_cable_settings.rb +25 -0
- data/lib/generators/templates/initializer.rb +18 -0
- data/lib/generators/templates/partials/_block.html.erb +10 -0
- data/lib/generators/templates/partials/_block_form.html.erb +24 -0
- data/lib/railties/tasks.rake +6 -1
- data/public/images/cable/background.png +0 -0
- data/public/images/cable/delete.png +0 -0
- data/public/images/cable/event-icon.png +0 -0
- data/public/images/cable/new-window.png +0 -0
- data/public/images/cable/nil-icon.png +0 -0
- data/public/images/cable/page-icon.png +0 -0
- data/public/images/cable/product-icon.jpg +0 -0
- data/public/images/cable/story-icon.jpg +0 -0
- data/public/images/iphone-style-checkboxes/off.png +0 -0
- data/public/images/iphone-style-checkboxes/on.png +0 -0
- data/public/images/iphone-style-checkboxes/slider.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_center.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_left.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_right.png +0 -0
- data/public/javascripts/admin.js +35 -0
- data/public/javascripts/iphone-style-checkboxes.js +224 -0
- data/public/javascripts/jquery.columnview.js +84 -0
- data/public/javascripts/jquery.tablesorter.min.js +4 -0
- data/public/javascripts/jquery.tagsinput.js +195 -0
- data/public/javascripts/jstree/_lib/jquery.cookie.js +96 -0
- data/public/javascripts/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/javascripts/jstree/_lib/jquery.js +6240 -0
- data/public/javascripts/jstree/jquery.jstree.js +4526 -0
- data/public/javascripts/jstree/themes/apple/bg.jpg +0 -0
- data/public/javascripts/jstree/themes/apple/d.png +0 -0
- data/public/javascripts/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/javascripts/jstree/themes/apple/style.css +61 -0
- data/public/javascripts/jstree/themes/apple/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/classic/d.png +0 -0
- data/public/javascripts/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/javascripts/jstree/themes/classic/style.css +59 -0
- data/public/javascripts/jstree/themes/classic/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/d.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/d.png +0 -0
- data/public/javascripts/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/style.css +83 -0
- data/public/javascripts/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/default/d.gif +0 -0
- data/public/javascripts/jstree/themes/default/d.png +0 -0
- data/public/javascripts/jstree/themes/default/style.css +73 -0
- data/public/javascripts/jstree/themes/default/throbber.gif +0 -0
- data/public/javascripts/tinymce/jquery.tinymce.js +1 -0
- data/public/javascripts/tinymce/langs/en.js +170 -0
- data/public/javascripts/tinymce/license.txt +504 -0
- data/public/javascripts/tinymce/plugins/advhr/css/advhr.css +5 -0
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +57 -0
- data/public/javascripts/tinymce/plugins/advhr/js/rule.js +43 -0
- data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +5 -0
- data/public/javascripts/tinymce/plugins/advhr/rule.htm +57 -0
- data/public/javascripts/tinymce/plugins/advimage/css/advimage.css +13 -0
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +50 -0
- data/public/javascripts/tinymce/plugins/advimage/image.htm +232 -0
- data/public/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
- data/public/javascripts/tinymce/plugins/advimage/js/image.js +443 -0
- data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +43 -0
- data/public/javascripts/tinymce/plugins/advlink/css/advlink.css +8 -0
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +61 -0
- data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +528 -0
- data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +52 -0
- data/public/javascripts/tinymce/plugins/advlink/link.htm +333 -0
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +154 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +119 -0
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +422 -0
- data/public/javascripts/tinymce/plugins/autosave/langs/en.js +4 -0
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +147 -0
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +82 -0
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +43 -0
- data/public/javascripts/tinymce/plugins/emotions/emotions.htm +40 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/js/emotions.js +22 -0
- data/public/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +20 -0
- data/public/javascripts/tinymce/plugins/example/dialog.htm +22 -0
- data/public/javascripts/tinymce/plugins/example/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/example/editor_plugin_src.js +84 -0
- data/public/javascripts/tinymce/plugins/example/img/example.gif +0 -0
- data/public/javascripts/tinymce/plugins/example/js/dialog.js +19 -0
- data/public/javascripts/tinymce/plugins/example/langs/en.js +3 -0
- data/public/javascripts/tinymce/plugins/example/langs/en_dlg.js +3 -0
- data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +182 -0
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +153 -0
- data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +571 -0
- data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +471 -0
- data/public/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +151 -0
- data/public/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +109 -0
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +54 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +635 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +100 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/template.htm +387 -0
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +212 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/public/javascripts/tinymce/plugins/media/css/content.css +6 -0
- data/public/javascripts/tinymce/plugins/media/css/media.css +16 -0
- data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +414 -0
- data/public/javascripts/tinymce/plugins/media/img/flash.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/flv_player.swf +0 -0
- data/public/javascripts/tinymce/plugins/media/img/quicktime.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/realmedia.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/shockwave.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/trans.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/windowsmedia.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/js/embed.js +73 -0
- data/public/javascripts/tinymce/plugins/media/js/media.js +630 -0
- data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +103 -0
- data/public/javascripts/tinymce/plugins/media/media.htm +817 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/public/javascripts/tinymce/plugins/pagebreak/css/content.css +1 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/public/javascripts/tinymce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/public/javascripts/tinymce/plugins/pagebreak/img/trans.gif +0 -0
- data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +952 -0
- data/public/javascripts/tinymce/plugins/paste/js/pastetext.js +36 -0
- data/public/javascripts/tinymce/plugins/paste/js/pasteword.js +51 -0
- data/public/javascripts/tinymce/plugins/paste/langs/en_dlg.js +5 -0
- data/public/javascripts/tinymce/plugins/paste/pastetext.htm +27 -0
- data/public/javascripts/tinymce/plugins/paste/pasteword.htm +21 -0
- data/public/javascripts/tinymce/plugins/pdw/editor_plugin.js +4 -0
- data/public/javascripts/tinymce/plugins/pdw/editor_plugin_src.js +158 -0
- data/public/javascripts/tinymce/plugins/pdw/img/toolbars.gif +0 -0
- data/public/javascripts/tinymce/plugins/pdw/langs/en.js +3 -0
- data/public/javascripts/tinymce/plugins/pdw/langs/nl.js +3 -0
- data/public/javascripts/tinymce/plugins/preview/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/preview/editor_plugin_src.js +53 -0
- data/public/javascripts/tinymce/plugins/preview/example.html +28 -0
- data/public/javascripts/tinymce/plugins/preview/jscripts/embed.js +73 -0
- data/public/javascripts/tinymce/plugins/preview/preview.html +17 -0
- data/public/javascripts/tinymce/plugins/print/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/print/editor_plugin_src.js +34 -0
- data/public/javascripts/tinymce/plugins/save/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/save/editor_plugin_src.js +101 -0
- data/public/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +138 -0
- data/public/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +99 -0
- data/public/javascripts/tinymce/plugins/spellchecker/css/content.css +1 -0
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +417 -0
- data/public/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/javascripts/tinymce/plugins/style/css/props.css +13 -0
- data/public/javascripts/tinymce/plugins/style/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/style/editor_plugin_src.js +55 -0
- data/public/javascripts/tinymce/plugins/style/js/props.js +641 -0
- data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +63 -0
- data/public/javascripts/tinymce/plugins/style/props.htm +723 -0
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +112 -0
- data/public/javascripts/tinymce/plugins/table/cell.htm +178 -0
- data/public/javascripts/tinymce/plugins/table/css/cell.css +17 -0
- data/public/javascripts/tinymce/plugins/table/css/row.css +25 -0
- data/public/javascripts/tinymce/plugins/table/css/table.css +13 -0
- data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +1139 -0
- data/public/javascripts/tinymce/plugins/table/js/cell.js +286 -0
- data/public/javascripts/tinymce/plugins/table/js/merge_cells.js +27 -0
- data/public/javascripts/tinymce/plugins/table/js/row.js +237 -0
- data/public/javascripts/tinymce/plugins/table/js/table.js +454 -0
- data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +74 -0
- data/public/javascripts/tinymce/plugins/table/merge_cells.htm +32 -0
- data/public/javascripts/tinymce/plugins/table/row.htm +155 -0
- data/public/javascripts/tinymce/plugins/table/table.htm +187 -0
- data/public/javascripts/tinymce/plugins/template/blank.htm +12 -0
- data/public/javascripts/tinymce/plugins/template/css/template.css +23 -0
- data/public/javascripts/tinymce/plugins/template/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/template/editor_plugin_src.js +159 -0
- data/public/javascripts/tinymce/plugins/template/js/template.js +106 -0
- data/public/javascripts/tinymce/plugins/template/langs/en_dlg.js +15 -0
- data/public/javascripts/tinymce/plugins/template/template.htm +31 -0
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +83 -0
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +148 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +161 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +161 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +53 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +52 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/public/javascripts/tinymce/themes/advanced/about.htm +54 -0
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -0
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +52 -0
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +73 -0
- data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -0
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1229 -0
- data/public/javascripts/tinymce/themes/advanced/image.htm +80 -0
- data/public/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/js/about.js +72 -0
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +37 -0
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +335 -0
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +253 -0
- data/public/javascripts/tinymce/themes/advanced/js/image.js +245 -0
- data/public/javascripts/tinymce/themes/advanced/js/link.js +156 -0
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -0
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +62 -0
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +51 -0
- data/public/javascripts/tinymce/themes/advanced/link.htm +58 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +36 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/dialog.css +117 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +213 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +36 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -0
- data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -0
- data/public/javascripts/tinymce/themes/simple/editor_template_src.js +85 -0
- data/public/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/simple/langs/en.js +11 -0
- data/public/javascripts/tinymce/themes/simple/skins/default/content.css +25 -0
- data/public/javascripts/tinymce/themes/simple/skins/default/ui.css +32 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/content.css +17 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +35 -0
- data/public/javascripts/tinymce/tiny_mce.js +1 -0
- data/public/javascripts/tinymce/tiny_mce_popup.js +5 -0
- data/public/javascripts/tinymce/tiny_mce_src.js +13394 -0
- data/public/javascripts/tinymce/utils/editable_selects.js +70 -0
- data/public/javascripts/tinymce/utils/form_utils.js +200 -0
- data/public/javascripts/tinymce/utils/mctabs.js +77 -0
- data/public/javascripts/tinymce/utils/validate.js +220 -0
- data/public/stylesheets/cable.css +862 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/ie.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/key.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/fancy-type/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/fancy-type/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/rtl/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/rtl/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/print.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/forms.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/grid.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/grid.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/ie.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/print.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/reset.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/typography.css +0 -0
- data/public/stylesheets/columnview.css +61 -0
- data/public/stylesheets/formtastic.css +148 -0
- data/public/stylesheets/formtastic_changes.css +66 -0
- data/public/stylesheets/iphone_checkboxes.css +76 -0
- data/public/stylesheets/ui/aristo/aristo.css +524 -0
- data/public/stylesheets/ui/aristo/icons.psd +0 -0
- data/public/stylesheets/ui/aristo/images/button_bg.png +0 -0
- data/public/stylesheets/ui/aristo/images/datepicker.gif +0 -0
- data/public/stylesheets/ui/aristo/images/icon_sprite.png +0 -0
- data/public/stylesheets/ui/aristo/images/progress_bar.gif +0 -0
- data/public/stylesheets/ui/aristo/images/right-arrow.png +0 -0
- data/public/stylesheets/ui/aristo/images/slider_h_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/slider_handles.png +0 -0
- data/public/stylesheets/ui/aristo/images/slider_v_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/tab_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/the_gradient.gif +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/ui/images/sprite-aristo.png +0 -0
- data/public/stylesheets/ui/images/uniform/sprite.png +0 -0
- data/public/stylesheets/ui/uniform/uniform.aristo.css +470 -0
- data/public/stylesheets/ui/uniform/uniform.default.css +477 -0
- metadata +473 -131
- data/app/models/cable/global_setting.rb +0 -3
- data/app/views/cable/admin/index.html.erb +0 -2
- data/app/views/cable/layouts/admin.html.erb +0 -49
- data/lib/generators/cable/controllers_generator.rb +0 -21
- data/lib/generators/cable/templates/admin_navigation.rb +0 -5
- data/lib/generators/cable/templates/javascripts/admin.js +0 -24
- data/lib/generators/cable/templates/javascripts/wymeditor/GPL-license.txt +0 -278
- data/lib/generators/cable/templates/javascripts/wymeditor/MIT-license.txt +0 -20
- data/lib/generators/cable/templates/javascripts/wymeditor/README +0 -33
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-p.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.css +0 -93
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.html +0 -26
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.js +0 -4724
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.min.js +0 -1
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.pack.js +0 -1
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/bg.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ca.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/cs.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/cy.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/de.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/en.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/es.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fa.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fi.js +0 -44
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/gl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/he.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/hr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/hu.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/it.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ja.js +0 -44
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nb.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nn.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt-br.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ru.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/sv.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/tr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/zh_cn.js +0 -47
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/embed/jquery.wymeditor.embed.js +0 -52
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +0 -127
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +0 -57
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/browser.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/jquery.wymeditor.mediabrowser.js +0 -115
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +0 -91
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/readme.txt +0 -124
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/README +0 -19
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +0 -82
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/tidy.php +0 -36
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/wand.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.css +0 -134
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.js +0 -35
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.css +0 -158
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.js +0 -40
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.header.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.css +0 -131
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.js +0 -30
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/COPYING +0 -674
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/README +0 -27
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.header.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/icons.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.css +0 -297
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.js +0 -61
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.css +0 -134
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.js +0 -39
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/wymeditor_icon.png +0 -0
- data/lib/generators/cable/templates/stylesheets/admin.css +0 -417
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span _mce_bogus="1" class="mceItemHidden mceItemNbsp"> </span>':" ")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(tinymce.isIE&&f.keyCode==9){d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");tinymce.dom.Event.cancel(f)}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
|
@@ -0,0 +1,53 @@
|
|
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
|
+
tinymce.create('tinymce.plugins.Nonbreaking', {
|
13
|
+
init : function(ed, url) {
|
14
|
+
var t = this;
|
15
|
+
|
16
|
+
t.editor = ed;
|
17
|
+
|
18
|
+
// Register commands
|
19
|
+
ed.addCommand('mceNonBreaking', function() {
|
20
|
+
ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span _mce_bogus="1" class="mceItemHidden mceItemNbsp"> </span>' : ' ');
|
21
|
+
});
|
22
|
+
|
23
|
+
// Register buttons
|
24
|
+
ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
|
25
|
+
|
26
|
+
if (ed.getParam('nonbreaking_force_tab')) {
|
27
|
+
ed.onKeyDown.add(function(ed, e) {
|
28
|
+
if (tinymce.isIE && e.keyCode == 9) {
|
29
|
+
ed.execCommand('mceNonBreaking');
|
30
|
+
ed.execCommand('mceNonBreaking');
|
31
|
+
ed.execCommand('mceNonBreaking');
|
32
|
+
tinymce.dom.Event.cancel(e);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
getInfo : function() {
|
39
|
+
return {
|
40
|
+
longname : 'Nonbreaking space',
|
41
|
+
author : 'Moxiecode Systems AB',
|
42
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
43
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
|
44
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
// Private methods
|
49
|
+
});
|
50
|
+
|
51
|
+
// Register plugin
|
52
|
+
tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
|
53
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var a=tinymce.dom.Event;tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(d,e){var f=this,c,b;f.editor=d;c=d.getParam("noneditable_editable_class","mceEditable");b=d.getParam("noneditable_noneditable_class","mceNonEditable");d.onNodeChange.addToTop(function(h,g,k){var j,i;j=h.dom.getParent(h.selection.getStart(),function(l){return h.dom.hasClass(l,b)});i=h.dom.getParent(h.selection.getEnd(),function(l){return h.dom.hasClass(l,b)});if(j||i){f._setDisabled(1);return false}else{f._setDisabled(0)}})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_block:function(c,d){var b=d.keyCode;if((b>32&&b<41)||(b>111&&b<124)){return}return a.cancel(d)},_setDisabled:function(d){var c=this,b=c.editor;tinymce.each(b.controlManager.controls,function(e){e.setDisabled(d)});if(d!==c.disabled){if(d){b.onKeyDown.addToTop(c._block);b.onKeyPress.addToTop(c._block);b.onKeyUp.addToTop(c._block);b.onPaste.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
|
@@ -0,0 +1,90 @@
|
|
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 Event = tinymce.dom.Event;
|
13
|
+
|
14
|
+
tinymce.create('tinymce.plugins.NonEditablePlugin', {
|
15
|
+
init : function(ed, url) {
|
16
|
+
var t = this, editClass, nonEditClass;
|
17
|
+
|
18
|
+
t.editor = ed;
|
19
|
+
editClass = ed.getParam("noneditable_editable_class", "mceEditable");
|
20
|
+
nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");
|
21
|
+
|
22
|
+
ed.onNodeChange.addToTop(function(ed, cm, n) {
|
23
|
+
var sc, ec;
|
24
|
+
|
25
|
+
// Block if start or end is inside a non editable element
|
26
|
+
sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
|
27
|
+
return ed.dom.hasClass(n, nonEditClass);
|
28
|
+
});
|
29
|
+
|
30
|
+
ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
|
31
|
+
return ed.dom.hasClass(n, nonEditClass);
|
32
|
+
});
|
33
|
+
|
34
|
+
// Block or unblock
|
35
|
+
if (sc || ec) {
|
36
|
+
t._setDisabled(1);
|
37
|
+
return false;
|
38
|
+
} else
|
39
|
+
t._setDisabled(0);
|
40
|
+
});
|
41
|
+
},
|
42
|
+
|
43
|
+
getInfo : function() {
|
44
|
+
return {
|
45
|
+
longname : 'Non editable elements',
|
46
|
+
author : 'Moxiecode Systems AB',
|
47
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
48
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
|
49
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
50
|
+
};
|
51
|
+
},
|
52
|
+
|
53
|
+
_block : function(ed, e) {
|
54
|
+
var k = e.keyCode;
|
55
|
+
|
56
|
+
// Don't block arrow keys, pg up/down, and F1-F12
|
57
|
+
if ((k > 32 && k < 41) || (k > 111 && k < 124))
|
58
|
+
return;
|
59
|
+
|
60
|
+
return Event.cancel(e);
|
61
|
+
},
|
62
|
+
|
63
|
+
_setDisabled : function(s) {
|
64
|
+
var t = this, ed = t.editor;
|
65
|
+
|
66
|
+
tinymce.each(ed.controlManager.controls, function(c) {
|
67
|
+
c.setDisabled(s);
|
68
|
+
});
|
69
|
+
|
70
|
+
if (s !== t.disabled) {
|
71
|
+
if (s) {
|
72
|
+
ed.onKeyDown.addToTop(t._block);
|
73
|
+
ed.onKeyPress.addToTop(t._block);
|
74
|
+
ed.onKeyUp.addToTop(t._block);
|
75
|
+
ed.onPaste.addToTop(t._block);
|
76
|
+
} else {
|
77
|
+
ed.onKeyDown.remove(t._block);
|
78
|
+
ed.onKeyPress.remove(t._block);
|
79
|
+
ed.onKeyUp.remove(t._block);
|
80
|
+
ed.onPaste.remove(t._block);
|
81
|
+
}
|
82
|
+
|
83
|
+
t.disabled = s;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// Register plugin
|
89
|
+
tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin);
|
90
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../img/pagebreak.gif) no-repeat center top;}
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+d+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
|
@@ -0,0 +1,77 @@
|
|
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
|
+
tinymce.create('tinymce.plugins.PageBreakPlugin', {
|
13
|
+
init : function(ed, url) {
|
14
|
+
var pb = '<img src="' + url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;
|
15
|
+
|
16
|
+
pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
|
17
|
+
|
18
|
+
// Register commands
|
19
|
+
ed.addCommand('mcePageBreak', function() {
|
20
|
+
ed.execCommand('mceInsertContent', 0, pb);
|
21
|
+
});
|
22
|
+
|
23
|
+
// Register buttons
|
24
|
+
ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});
|
25
|
+
|
26
|
+
ed.onInit.add(function() {
|
27
|
+
if (ed.settings.content_css !== false)
|
28
|
+
ed.dom.loadCSS(url + "/css/content.css");
|
29
|
+
|
30
|
+
if (ed.theme.onResolveName) {
|
31
|
+
ed.theme.onResolveName.add(function(th, o) {
|
32
|
+
if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
|
33
|
+
o.name = 'pagebreak';
|
34
|
+
});
|
35
|
+
}
|
36
|
+
});
|
37
|
+
|
38
|
+
ed.onClick.add(function(ed, e) {
|
39
|
+
e = e.target;
|
40
|
+
|
41
|
+
if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
|
42
|
+
ed.selection.select(e);
|
43
|
+
});
|
44
|
+
|
45
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
46
|
+
cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
|
47
|
+
});
|
48
|
+
|
49
|
+
ed.onBeforeSetContent.add(function(ed, o) {
|
50
|
+
o.content = o.content.replace(pbRE, pb);
|
51
|
+
});
|
52
|
+
|
53
|
+
ed.onPostProcess.add(function(ed, o) {
|
54
|
+
if (o.get)
|
55
|
+
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
56
|
+
if (im.indexOf('class="mcePageBreak') !== -1)
|
57
|
+
im = sep;
|
58
|
+
|
59
|
+
return im;
|
60
|
+
});
|
61
|
+
});
|
62
|
+
},
|
63
|
+
|
64
|
+
getInfo : function() {
|
65
|
+
return {
|
66
|
+
longname : 'PageBreak',
|
67
|
+
author : 'Moxiecode Systems AB',
|
68
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
69
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
|
70
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
71
|
+
};
|
72
|
+
}
|
73
|
+
});
|
74
|
+
|
75
|
+
// Register plugin
|
76
|
+
tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
|
77
|
+
})();
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var c=tinymce.each,d=null,a={paste_auto_cleanup_on_paste:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(e,f){return e.getParam(f,a[f])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(e,f){var g=this;g.editor=e;g.url=f;g.onPreProcess=new tinymce.util.Dispatcher(g);g.onPostProcess=new tinymce.util.Dispatcher(g);g.onPreProcess.add(g._preProcess);g.onPostProcess.add(g._postProcess);g.onPreProcess.add(function(j,k){e.execCallback("paste_preprocess",j,k)});g.onPostProcess.add(function(j,k){e.execCallback("paste_postprocess",j,k)});e.pasteAsPlainText=false;function i(l,j){var k=e.dom;g.onPreProcess.dispatch(g,l);l.node=k.create("div",0,l.content);g.onPostProcess.dispatch(g,l);l.content=e.serializer.serialize(l.node,{getInner:1});if((!j)&&(e.pasteAsPlainText)){g._insertPlainText(e,k,l.content);if(!b(e,"paste_text_sticky")){e.pasteAsPlainText=false;e.controlManager.setActive("pastetext",false)}}else{if(/<(p|h[1-6]|ul|ol)/.test(l.content)){g._insertBlockContent(e,k,l.content)}else{g._insert(l.content)}}}e.addCommand("mceInsertClipboardContent",function(j,k){i(k,true)});if(!b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(k,j){var l=tinymce.util.Cookie;e.pasteAsPlainText=!e.pasteAsPlainText;e.controlManager.setActive("pastetext",e.pasteAsPlainText);if((e.pasteAsPlainText)&&(!l.get("tinymcePasteText"))){if(b(e,"paste_text_sticky")){e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}else{e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}if(!b(e,"paste_text_notifyalways")){l.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}e.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});e.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function h(s){var m,q,k,l=e.selection,p=e.dom,r=e.getBody(),j;if(e.pasteAsPlainText&&(s.clipboardData||p.doc.dataTransfer)){s.preventDefault();i({content:(s.clipboardData||p.doc.dataTransfer).getData("Text").replace(/\r?\n/g,"<br />")});return}if(p.get("_mcePaste")){return}m=p.add(r,"div",{id:"_mcePaste","class":"mcePaste"},'\uFEFF<br _mce_bogus="1">');if(r!=e.getDoc().body){j=p.getPos(e.selection.getStart(),r).y}else{j=r.scrollTop}p.setStyles(m,{position:"absolute",left:-10000,top:j,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){k=p.doc.body.createTextRange();k.moveToElementText(m);k.execCommand("Paste");p.remove(m);if(m.innerHTML==="\uFEFF"){e.execCommand("mcePasteWord");s.preventDefault();return}i({content:m.innerHTML});return tinymce.dom.Event.cancel(s)}else{function o(n){n.preventDefault()}p.bind(e.getDoc(),"mousedown",o);p.bind(e.getDoc(),"keydown",o);q=e.selection.getRng();m=m.firstChild;k=e.getDoc().createRange();k.setStart(m,0);k.setEnd(m,1);l.setRng(k);window.setTimeout(function(){var t="",n=p.select("div.mcePaste");c(n,function(v){var u=v.firstChild;if(u&&u.nodeName=="DIV"&&u.style.marginTop&&u.style.backgroundColor){p.remove(u,1)}c(p.select("div.mcePaste",v),function(w){p.remove(w,1)});c(p.select("span.Apple-style-span",v),function(w){p.remove(w,1)});c(p.select("br[_mce_bogus]",v),function(w){p.remove(w)});t+=v.innerHTML});c(n,function(u){p.remove(u)});if(q){l.setRng(q)}i({content:t});p.unbind(e.getDoc(),"mousedown",o);p.unbind(e.getDoc(),"keydown",o)},0)}}if(b(e,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){e.onKeyDown.add(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){h(k)}})}else{e.onPaste.addToTop(function(j,k){return h(k)})}}if(b(e,"paste_block_drop")){e.onInit.add(function(){e.dom.bind(e.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(j){j.preventDefault();j.stopPropagation();return false})})}g._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(i,f){var l=this.editor,k=f.content,q=tinymce.grep,p=tinymce.explode,g=tinymce.trim,m,j;function e(h){c(h,function(o){if(o.constructor==RegExp){k=k.replace(o,"")}else{k=k.replace(o[0],o[1])}})}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(k)||f.wordContent){f.wordContent=true;e([/^\s*( )+/gi,/( |<br[^>]*>)+\s*$/gi]);if(b(l,"paste_convert_headers_to_strong")){k=k.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(l,"paste_convert_middot_lists")){e([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"]])}e([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"]]);do{m=k.length;k=k.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(m!=k.length);if(b(l,"paste_retain_style_properties").replace(/^none$/i,"").length==0){k=k.replace(/<\/?span[^>]*>/gi,"")}else{e([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(u,h,t){var v=[],o=0,r=p(g(t).replace(/"/gi,"'"),";");c(r,function(s){var w,y,z=p(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":v[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":v[o++]="text-align:"+y;return;case"vert-align":v[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":v[o++]="color:"+y;return;case"mso-background":case"mso-highlight":v[o++]="background:"+y;return;case"mso-default-height":v[o++]="min-height:"+x(y);return;case"mso-default-width":v[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":v[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){v[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){v[o++]="display:none"}return}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(w)){return}v[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+v.join(";")+'"'}else{return h}}]])}}if(b(l,"paste_convert_headers_to_strong")){e([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}j=b(l,"paste_strip_class_attributes");if(j!=="none"){function n(r,o){if(j==="all"){return""}var h=q(p(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(s){return(/^(?!mso)/i.test(s))});return h.length?' class="'+h.join(" ")+'"':""}k=k.replace(/ class="([^"]+)"/gi,n);k=k.replace(/ class=(\w+)/gi,n)}if(b(l,"paste_remove_spans")){k=k.replace(/<\/?span[^>]*>/gi,"")}f.content=k},_postProcess:function(h,j){var g=this,f=g.editor,i=f.dom,e;if(j.wordContent){c(i.select("a",j.node),function(k){if(!k.href||k.href.indexOf("#_Toc")!=-1){i.remove(k,1)}});if(b(f,"paste_convert_middot_lists")){g._convertLists(h,j)}e=b(f,"paste_retain_style_properties");if((tinymce.is(e,"string"))&&(e!=="all")&&(e!=="*")){e=tinymce.explode(e.replace(/^none$/i,""));c(i.select("*",j.node),function(n){var o={},l=0,m,p,k;if(e){for(m=0;m<e.length;m++){p=e[m];k=i.getStyle(n,p);if(k){o[p]=k;l++}}}i.setAttrib(n,"style","");if(e&&l>0){i.setStyles(n,o)}else{if(n.nodeName=="SPAN"&&!n.className){i.remove(n,true)}}})}}if(b(f,"paste_remove_styles")||(b(f,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(i.select("*[style]",j.node),function(k){k.removeAttribute("style");k.removeAttribute("_mce_style")})}else{if(tinymce.isWebKit){c(i.select("*",j.node),function(k){k.removeAttribute("_mce_style")})}}},_convertLists:function(h,f){var j=h.editor.dom,i,m,e=-1,g,n=[],l,k;c(j.select("p",f.node),function(u){var r,v="",t,s,o,q;for(r=u.firstChild;r&&r.nodeType==3;r=r.nextSibling){v+=r.nodeValue}v=u.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(v)){t="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(v)){t="ol"}if(t){g=parseFloat(u.style.marginLeft||0);if(g>e){n.push(g)}if(!i||t!=l){i=j.create(t);j.insertAfter(i,u)}else{if(g>e){i=m.appendChild(j.create(t))}else{if(g<e){o=tinymce.inArray(n,g);q=j.getParents(i.parentNode,t);i=q[q.length-1-o]||i}}}c(j.select("span",u),function(w){var p=w.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(t=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){j.remove(w)}else{if(/^[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){j.remove(w)}}});s=u.innerHTML;if(t=="ul"){s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/,"")}else{s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.( |\u00a0)+\s*/,"")}m=i.appendChild(j.create("li",0,s));j.remove(u);e=g;l=t}else{i=e=0}});k=f.node.innerHTML;if(k.indexOf("__MCE_ITEM__")!=-1){f.node.innerHTML=k.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(l,h,m){var f,j,g=l.selection,q,n,e,o,i,k="mce_marker";function p(t){var s;if(tinymce.isIE){s=l.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(false);s.select()}else{g.select(t,1);g.collapse(false)}}this._insert('<span id="'+k+'"></span>',1);j=h.get(k);f=h.getParent(j,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(f&&!/TD|TH/.test(f.nodeName)){j=h.split(f,j);c(h.create("div",0,m).childNodes,function(r){q=j.parentNode.insertBefore(r.cloneNode(true),j)});p(q)}else{h.setOuterHTML(j,m);g.select(l.getBody(),1);g.collapse(0)}while(n=h.get(k)){h.remove(n)}n=g.getStart();e=h.getViewPort(l.getWin());o=l.dom.getPos(n).y;i=n.clientHeight;if(o<e.y||o+i>e.y+e.h){l.getDoc().body.scrollTop=o<e.y?o:o-e.h+25}},_insert:function(g,e){var f=this.editor,i=f.selection.getRng();if(!f.selection.isCollapsed()&&i.startContainer!=i.endContainer){f.getDoc().execCommand("Delete",false,null)}f.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,g,{skip_undo:e})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(h){c(h,function(i){if(i.constructor==RegExp){v=v.replace(i,"")}else{v=v.replace(i[0],i[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(!d){d=("34,quot,38,amp,39,apos,60,lt,62,gt,"+j.serializer.settings.entities).split(",")}if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/ /gi," "],[/&(#\d+|[a-z0-9]{1,10});/gi,function(i,h){if(h.charAt(0)==="#"){return String.fromCharCode(h.slice(1))}else{return((i=y(d,h))>0)?String.fromCharCode(d[i-1]):" "}}],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.encode(v);if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker"> </span>');window.setTimeout(function(){var h=x.get("_plain_text_marker"),B,i,A,w;s.select(h,false);z.execCommand("Delete",false,null);h=null;B=s.getStart();i=x.getViewPort(n);A=x.getPos(B).y;w=B.clientHeight;if((A<i.y)||(A+w>i.y+i.h)){z.body.scrollTop=A<i.y?A:A-i.h+25}},0)}},_legacySupport:function(){var f=this,e=f.editor;e.addCommand("mcePasteWord",function(){e.windowManager.open({file:f.url+"/pasteword.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})});if(b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(){e.windowManager.open({file:f.url+"/pastetext.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})})}e.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
|
@@ -0,0 +1,952 @@
|
|
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(ed.translate('paste.plaintext_mode_sticky'));
|
117
|
+
} else {
|
118
|
+
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
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
|
+
// Check if browser supports direct plaintext access
|
138
|
+
if (ed.pasteAsPlainText && (e.clipboardData || dom.doc.dataTransfer)) {
|
139
|
+
e.preventDefault();
|
140
|
+
process({content : (e.clipboardData || dom.doc.dataTransfer).getData('Text').replace(/\r?\n/g, '<br />')});
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
|
144
|
+
if (dom.get('_mcePaste'))
|
145
|
+
return;
|
146
|
+
|
147
|
+
// Create container to paste into
|
148
|
+
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF<br _mce_bogus="1">');
|
149
|
+
|
150
|
+
// If contentEditable mode we need to find out the position of the closest element
|
151
|
+
if (body != ed.getDoc().body)
|
152
|
+
posY = dom.getPos(ed.selection.getStart(), body).y;
|
153
|
+
else
|
154
|
+
posY = body.scrollTop;
|
155
|
+
|
156
|
+
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
157
|
+
dom.setStyles(n, {
|
158
|
+
position : 'absolute',
|
159
|
+
left : -10000,
|
160
|
+
top : posY,
|
161
|
+
width : 1,
|
162
|
+
height : 1,
|
163
|
+
overflow : 'hidden'
|
164
|
+
});
|
165
|
+
|
166
|
+
if (tinymce.isIE) {
|
167
|
+
// Select the container
|
168
|
+
rng = dom.doc.body.createTextRange();
|
169
|
+
rng.moveToElementText(n);
|
170
|
+
rng.execCommand('Paste');
|
171
|
+
|
172
|
+
// Remove container
|
173
|
+
dom.remove(n);
|
174
|
+
|
175
|
+
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
176
|
+
// to IE security settings so we pass the junk though better than nothing right
|
177
|
+
if (n.innerHTML === '\uFEFF') {
|
178
|
+
ed.execCommand('mcePasteWord');
|
179
|
+
e.preventDefault();
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
|
183
|
+
// Process contents
|
184
|
+
process({content : n.innerHTML});
|
185
|
+
|
186
|
+
// Block the real paste event
|
187
|
+
return tinymce.dom.Event.cancel(e);
|
188
|
+
} else {
|
189
|
+
function block(e) {
|
190
|
+
e.preventDefault();
|
191
|
+
};
|
192
|
+
|
193
|
+
// Block mousedown and click to prevent selection change
|
194
|
+
dom.bind(ed.getDoc(), 'mousedown', block);
|
195
|
+
dom.bind(ed.getDoc(), 'keydown', block);
|
196
|
+
|
197
|
+
or = ed.selection.getRng();
|
198
|
+
|
199
|
+
// Move caret into hidden div
|
200
|
+
n = n.firstChild;
|
201
|
+
rng = ed.getDoc().createRange();
|
202
|
+
rng.setStart(n, 0);
|
203
|
+
rng.setEnd(n, 1);
|
204
|
+
sel.setRng(rng);
|
205
|
+
|
206
|
+
// Wait a while and grab the pasted contents
|
207
|
+
window.setTimeout(function() {
|
208
|
+
var h = '', nl = dom.select('div.mcePaste');
|
209
|
+
|
210
|
+
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
211
|
+
each(nl, function(n) {
|
212
|
+
var child = n.firstChild;
|
213
|
+
|
214
|
+
// WebKit inserts a DIV container with lots of odd styles
|
215
|
+
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
|
216
|
+
dom.remove(child, 1);
|
217
|
+
}
|
218
|
+
|
219
|
+
// WebKit duplicates the divs so we need to remove them
|
220
|
+
each(dom.select('div.mcePaste', n), function(n) {
|
221
|
+
dom.remove(n, 1);
|
222
|
+
});
|
223
|
+
|
224
|
+
// Remove apply style spans
|
225
|
+
each(dom.select('span.Apple-style-span', n), function(n) {
|
226
|
+
dom.remove(n, 1);
|
227
|
+
});
|
228
|
+
|
229
|
+
// Remove bogus br elements
|
230
|
+
each(dom.select('br[_mce_bogus]', n), function(n) {
|
231
|
+
dom.remove(n);
|
232
|
+
});
|
233
|
+
|
234
|
+
h += n.innerHTML;
|
235
|
+
});
|
236
|
+
|
237
|
+
// Remove the nodes
|
238
|
+
each(nl, function(n) {
|
239
|
+
dom.remove(n);
|
240
|
+
});
|
241
|
+
|
242
|
+
// Restore the old selection
|
243
|
+
if (or)
|
244
|
+
sel.setRng(or);
|
245
|
+
|
246
|
+
process({content : h});
|
247
|
+
|
248
|
+
// Unblock events ones we got the contents
|
249
|
+
dom.unbind(ed.getDoc(), 'mousedown', block);
|
250
|
+
dom.unbind(ed.getDoc(), 'keydown', block);
|
251
|
+
}, 0);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
// Check if we should use the new auto process method
|
256
|
+
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
257
|
+
// Is it's Opera or older FF use key handler
|
258
|
+
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
259
|
+
ed.onKeyDown.add(function(ed, e) {
|
260
|
+
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
261
|
+
grabContent(e);
|
262
|
+
});
|
263
|
+
} else {
|
264
|
+
// Grab contents on paste event on Gecko and WebKit
|
265
|
+
ed.onPaste.addToTop(function(ed, e) {
|
266
|
+
return grabContent(e);
|
267
|
+
});
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
// Block all drag/drop events
|
272
|
+
if (getParam(ed, "paste_block_drop")) {
|
273
|
+
ed.onInit.add(function() {
|
274
|
+
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
|
275
|
+
e.preventDefault();
|
276
|
+
e.stopPropagation();
|
277
|
+
|
278
|
+
return false;
|
279
|
+
});
|
280
|
+
});
|
281
|
+
}
|
282
|
+
|
283
|
+
// Add legacy support
|
284
|
+
t._legacySupport();
|
285
|
+
},
|
286
|
+
|
287
|
+
getInfo : function() {
|
288
|
+
return {
|
289
|
+
longname : 'Paste text/word',
|
290
|
+
author : 'Moxiecode Systems AB',
|
291
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
292
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
293
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
294
|
+
};
|
295
|
+
},
|
296
|
+
|
297
|
+
_preProcess : function(pl, o) {
|
298
|
+
//console.log('Before preprocess:' + o.content);
|
299
|
+
|
300
|
+
var ed = this.editor,
|
301
|
+
h = o.content,
|
302
|
+
grep = tinymce.grep,
|
303
|
+
explode = tinymce.explode,
|
304
|
+
trim = tinymce.trim,
|
305
|
+
len, stripClass;
|
306
|
+
|
307
|
+
function process(items) {
|
308
|
+
each(items, function(v) {
|
309
|
+
// Remove or replace
|
310
|
+
if (v.constructor == RegExp)
|
311
|
+
h = h.replace(v, '');
|
312
|
+
else
|
313
|
+
h = h.replace(v[0], v[1]);
|
314
|
+
});
|
315
|
+
}
|
316
|
+
|
317
|
+
// Detect Word content and process it more aggressive
|
318
|
+
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
319
|
+
o.wordContent = true; // Mark the pasted contents as word specific content
|
320
|
+
//console.log('Word contents detected.');
|
321
|
+
|
322
|
+
// Process away some basic content
|
323
|
+
process([
|
324
|
+
/^\s*( )+/gi, // entities at the start of contents
|
325
|
+
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
326
|
+
]);
|
327
|
+
|
328
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
329
|
+
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
330
|
+
}
|
331
|
+
|
332
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
333
|
+
process([
|
334
|
+
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
335
|
+
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol spans to item markers
|
336
|
+
]);
|
337
|
+
}
|
338
|
+
|
339
|
+
process([
|
340
|
+
// Word comments like conditional comments etc
|
341
|
+
/<!--[\s\S]+?-->/gi,
|
342
|
+
|
343
|
+
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
344
|
+
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
345
|
+
|
346
|
+
// Convert <s> into <strike> for line-though
|
347
|
+
[/<(\/?)s>/gi, "<$1strike>"],
|
348
|
+
|
349
|
+
// Replace nsbp entites to char since it's easier to handle
|
350
|
+
[/ /gi, "\u00a0"]
|
351
|
+
]);
|
352
|
+
|
353
|
+
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
354
|
+
// 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.
|
355
|
+
do {
|
356
|
+
len = h.length;
|
357
|
+
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
358
|
+
} while (len != h.length);
|
359
|
+
|
360
|
+
// Remove all spans if no styles is to be retained
|
361
|
+
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
362
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
363
|
+
} else {
|
364
|
+
// We're keeping styles, so at least clean them up.
|
365
|
+
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
366
|
+
|
367
|
+
process([
|
368
|
+
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
369
|
+
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
370
|
+
function(str, spaces) {
|
371
|
+
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
372
|
+
}
|
373
|
+
],
|
374
|
+
|
375
|
+
// Examine all styles: delete junk, transform some, and keep the rest
|
376
|
+
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
377
|
+
function(str, tag, style) {
|
378
|
+
var n = [],
|
379
|
+
i = 0,
|
380
|
+
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
381
|
+
|
382
|
+
// Examine each style definition within the tag's style attribute
|
383
|
+
each(s, function(v) {
|
384
|
+
var name, value,
|
385
|
+
parts = explode(v, ":");
|
386
|
+
|
387
|
+
function ensureUnits(v) {
|
388
|
+
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
389
|
+
}
|
390
|
+
|
391
|
+
if (parts.length == 2) {
|
392
|
+
name = parts[0].toLowerCase();
|
393
|
+
value = parts[1].toLowerCase();
|
394
|
+
|
395
|
+
// Translate certain MS Office styles into their CSS equivalents
|
396
|
+
switch (name) {
|
397
|
+
case "mso-padding-alt":
|
398
|
+
case "mso-padding-top-alt":
|
399
|
+
case "mso-padding-right-alt":
|
400
|
+
case "mso-padding-bottom-alt":
|
401
|
+
case "mso-padding-left-alt":
|
402
|
+
case "mso-margin-alt":
|
403
|
+
case "mso-margin-top-alt":
|
404
|
+
case "mso-margin-right-alt":
|
405
|
+
case "mso-margin-bottom-alt":
|
406
|
+
case "mso-margin-left-alt":
|
407
|
+
case "mso-table-layout-alt":
|
408
|
+
case "mso-height":
|
409
|
+
case "mso-width":
|
410
|
+
case "mso-vertical-align-alt":
|
411
|
+
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
412
|
+
return;
|
413
|
+
|
414
|
+
case "horiz-align":
|
415
|
+
n[i++] = "text-align:" + value;
|
416
|
+
return;
|
417
|
+
|
418
|
+
case "vert-align":
|
419
|
+
n[i++] = "vertical-align:" + value;
|
420
|
+
return;
|
421
|
+
|
422
|
+
case "font-color":
|
423
|
+
case "mso-foreground":
|
424
|
+
n[i++] = "color:" + value;
|
425
|
+
return;
|
426
|
+
|
427
|
+
case "mso-background":
|
428
|
+
case "mso-highlight":
|
429
|
+
n[i++] = "background:" + value;
|
430
|
+
return;
|
431
|
+
|
432
|
+
case "mso-default-height":
|
433
|
+
n[i++] = "min-height:" + ensureUnits(value);
|
434
|
+
return;
|
435
|
+
|
436
|
+
case "mso-default-width":
|
437
|
+
n[i++] = "min-width:" + ensureUnits(value);
|
438
|
+
return;
|
439
|
+
|
440
|
+
case "mso-padding-between-alt":
|
441
|
+
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
442
|
+
return;
|
443
|
+
|
444
|
+
case "text-line-through":
|
445
|
+
if ((value == "single") || (value == "double")) {
|
446
|
+
n[i++] = "text-decoration:line-through";
|
447
|
+
}
|
448
|
+
return;
|
449
|
+
|
450
|
+
case "mso-zero-height":
|
451
|
+
if (value == "yes") {
|
452
|
+
n[i++] = "display:none";
|
453
|
+
}
|
454
|
+
return;
|
455
|
+
}
|
456
|
+
|
457
|
+
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
458
|
+
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)) {
|
459
|
+
return;
|
460
|
+
}
|
461
|
+
|
462
|
+
// If it reached this point, it must be a valid CSS style
|
463
|
+
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
464
|
+
}
|
465
|
+
});
|
466
|
+
|
467
|
+
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
468
|
+
if (i > 0) {
|
469
|
+
return tag + ' style="' + n.join(';') + '"';
|
470
|
+
} else {
|
471
|
+
return tag;
|
472
|
+
}
|
473
|
+
}
|
474
|
+
]
|
475
|
+
]);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
|
479
|
+
// Replace headers with <strong>
|
480
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
481
|
+
process([
|
482
|
+
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
483
|
+
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
484
|
+
]);
|
485
|
+
}
|
486
|
+
|
487
|
+
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
488
|
+
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
489
|
+
stripClass = getParam(ed, "paste_strip_class_attributes");
|
490
|
+
|
491
|
+
if (stripClass !== "none") {
|
492
|
+
function removeClasses(match, g1) {
|
493
|
+
if (stripClass === "all")
|
494
|
+
return '';
|
495
|
+
|
496
|
+
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
497
|
+
function(v) {
|
498
|
+
return (/^(?!mso)/i.test(v));
|
499
|
+
}
|
500
|
+
);
|
501
|
+
|
502
|
+
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
503
|
+
};
|
504
|
+
|
505
|
+
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
506
|
+
h = h.replace(/ class=(\w+)/gi, removeClasses);
|
507
|
+
}
|
508
|
+
|
509
|
+
// Remove spans option
|
510
|
+
if (getParam(ed, "paste_remove_spans")) {
|
511
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
512
|
+
}
|
513
|
+
|
514
|
+
//console.log('After preprocess:' + h);
|
515
|
+
|
516
|
+
o.content = h;
|
517
|
+
},
|
518
|
+
|
519
|
+
/**
|
520
|
+
* Various post process items.
|
521
|
+
*/
|
522
|
+
_postProcess : function(pl, o) {
|
523
|
+
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
524
|
+
|
525
|
+
if (o.wordContent) {
|
526
|
+
// Remove named anchors or TOC links
|
527
|
+
each(dom.select('a', o.node), function(a) {
|
528
|
+
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
529
|
+
dom.remove(a, 1);
|
530
|
+
});
|
531
|
+
|
532
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
533
|
+
t._convertLists(pl, o);
|
534
|
+
}
|
535
|
+
|
536
|
+
// Process styles
|
537
|
+
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
538
|
+
|
539
|
+
// Process only if a string was specified and not equal to "all" or "*"
|
540
|
+
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
541
|
+
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
542
|
+
|
543
|
+
// Retains some style properties
|
544
|
+
each(dom.select('*', o.node), function(el) {
|
545
|
+
var newStyle = {}, npc = 0, i, sp, sv;
|
546
|
+
|
547
|
+
// Store a subset of the existing styles
|
548
|
+
if (styleProps) {
|
549
|
+
for (i = 0; i < styleProps.length; i++) {
|
550
|
+
sp = styleProps[i];
|
551
|
+
sv = dom.getStyle(el, sp);
|
552
|
+
|
553
|
+
if (sv) {
|
554
|
+
newStyle[sp] = sv;
|
555
|
+
npc++;
|
556
|
+
}
|
557
|
+
}
|
558
|
+
}
|
559
|
+
|
560
|
+
// Remove all of the existing styles
|
561
|
+
dom.setAttrib(el, 'style', '');
|
562
|
+
|
563
|
+
if (styleProps && npc > 0)
|
564
|
+
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
565
|
+
else // Remove empty span tags that do not have class attributes
|
566
|
+
if (el.nodeName == 'SPAN' && !el.className)
|
567
|
+
dom.remove(el, true);
|
568
|
+
});
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
572
|
+
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
573
|
+
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
574
|
+
each(dom.select('*[style]', o.node), function(el) {
|
575
|
+
el.removeAttribute('style');
|
576
|
+
el.removeAttribute('_mce_style');
|
577
|
+
});
|
578
|
+
} else {
|
579
|
+
if (tinymce.isWebKit) {
|
580
|
+
// 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 ..." />
|
581
|
+
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
582
|
+
each(dom.select('*', o.node), function(el) {
|
583
|
+
el.removeAttribute('_mce_style');
|
584
|
+
});
|
585
|
+
}
|
586
|
+
}
|
587
|
+
},
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
591
|
+
*/
|
592
|
+
_convertLists : function(pl, o) {
|
593
|
+
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
594
|
+
|
595
|
+
// Convert middot lists into real semantic lists
|
596
|
+
each(dom.select('p', o.node), function(p) {
|
597
|
+
var sib, val = '', type, html, idx, parents;
|
598
|
+
|
599
|
+
// Get text node value at beginning of paragraph
|
600
|
+
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
601
|
+
val += sib.nodeValue;
|
602
|
+
|
603
|
+
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
604
|
+
|
605
|
+
// Detect unordered lists look for bullets
|
606
|
+
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(val))
|
607
|
+
type = 'ul';
|
608
|
+
|
609
|
+
// Detect ordered lists 1., a. or ixv.
|
610
|
+
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(val))
|
611
|
+
type = 'ol';
|
612
|
+
|
613
|
+
// Check if node value matches the list pattern: o
|
614
|
+
if (type) {
|
615
|
+
margin = parseFloat(p.style.marginLeft || 0);
|
616
|
+
|
617
|
+
if (margin > lastMargin)
|
618
|
+
levels.push(margin);
|
619
|
+
|
620
|
+
if (!listElm || type != lastType) {
|
621
|
+
listElm = dom.create(type);
|
622
|
+
dom.insertAfter(listElm, p);
|
623
|
+
} else {
|
624
|
+
// Nested list element
|
625
|
+
if (margin > lastMargin) {
|
626
|
+
listElm = li.appendChild(dom.create(type));
|
627
|
+
} else if (margin < lastMargin) {
|
628
|
+
// Find parent level based on margin value
|
629
|
+
idx = tinymce.inArray(levels, margin);
|
630
|
+
parents = dom.getParents(listElm.parentNode, type);
|
631
|
+
listElm = parents[parents.length - 1 - idx] || listElm;
|
632
|
+
}
|
633
|
+
}
|
634
|
+
|
635
|
+
// Remove middot or number spans if they exists
|
636
|
+
each(dom.select('span', p), function(span) {
|
637
|
+
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
638
|
+
|
639
|
+
// Remove span with the middot or the number
|
640
|
+
if (type == 'ul' && /^[\u2022\u00b7\u00a7\u00d8o]/.test(html))
|
641
|
+
dom.remove(span);
|
642
|
+
else if (/^[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
643
|
+
dom.remove(span);
|
644
|
+
});
|
645
|
+
|
646
|
+
html = p.innerHTML;
|
647
|
+
|
648
|
+
// Remove middot/list items
|
649
|
+
if (type == 'ul')
|
650
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/, '');
|
651
|
+
else
|
652
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, '');
|
653
|
+
|
654
|
+
// Create li and add paragraph data into the new li
|
655
|
+
li = listElm.appendChild(dom.create('li', 0, html));
|
656
|
+
dom.remove(p);
|
657
|
+
|
658
|
+
lastMargin = margin;
|
659
|
+
lastType = type;
|
660
|
+
} else
|
661
|
+
listElm = lastMargin = 0; // End list element
|
662
|
+
});
|
663
|
+
|
664
|
+
// Remove any left over makers
|
665
|
+
html = o.node.innerHTML;
|
666
|
+
if (html.indexOf('__MCE_ITEM__') != -1)
|
667
|
+
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
668
|
+
},
|
669
|
+
|
670
|
+
/**
|
671
|
+
* This method will split the current block parent and insert the contents inside the split position.
|
672
|
+
* This logic can be improved so text nodes at the start/end remain in the start/end block elements
|
673
|
+
*/
|
674
|
+
_insertBlockContent : function(ed, dom, content) {
|
675
|
+
var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';
|
676
|
+
|
677
|
+
function select(n) {
|
678
|
+
var r;
|
679
|
+
|
680
|
+
if (tinymce.isIE) {
|
681
|
+
r = ed.getDoc().body.createTextRange();
|
682
|
+
r.moveToElementText(n);
|
683
|
+
r.collapse(false);
|
684
|
+
r.select();
|
685
|
+
} else {
|
686
|
+
sel.select(n, 1);
|
687
|
+
sel.collapse(false);
|
688
|
+
}
|
689
|
+
}
|
690
|
+
|
691
|
+
// Insert a marker for the caret position
|
692
|
+
this._insert('<span id="' + markerId + '"></span>', 1);
|
693
|
+
marker = dom.get(markerId);
|
694
|
+
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
|
695
|
+
|
696
|
+
// If it's a parent block but not a table cell
|
697
|
+
if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
|
698
|
+
// Split parent block
|
699
|
+
marker = dom.split(parentBlock, marker);
|
700
|
+
|
701
|
+
// Insert nodes before the marker
|
702
|
+
each(dom.create('div', 0, content).childNodes, function(n) {
|
703
|
+
last = marker.parentNode.insertBefore(n.cloneNode(true), marker);
|
704
|
+
});
|
705
|
+
|
706
|
+
// Move caret after marker
|
707
|
+
select(last);
|
708
|
+
} else {
|
709
|
+
dom.setOuterHTML(marker, content);
|
710
|
+
sel.select(ed.getBody(), 1);
|
711
|
+
sel.collapse(0);
|
712
|
+
}
|
713
|
+
|
714
|
+
// Remove marker if it's left
|
715
|
+
while (elm = dom.get(markerId))
|
716
|
+
dom.remove(elm);
|
717
|
+
|
718
|
+
// Get element, position and height
|
719
|
+
elm = sel.getStart();
|
720
|
+
vp = dom.getViewPort(ed.getWin());
|
721
|
+
y = ed.dom.getPos(elm).y;
|
722
|
+
elmHeight = elm.clientHeight;
|
723
|
+
|
724
|
+
// Is element within viewport if not then scroll it into view
|
725
|
+
if (y < vp.y || y + elmHeight > vp.y + vp.h)
|
726
|
+
ed.getDoc().body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
727
|
+
},
|
728
|
+
|
729
|
+
/**
|
730
|
+
* Inserts the specified contents at the caret position.
|
731
|
+
*/
|
732
|
+
_insert : function(h, skip_undo) {
|
733
|
+
var ed = this.editor, r = ed.selection.getRng();
|
734
|
+
|
735
|
+
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
|
736
|
+
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
|
737
|
+
ed.getDoc().execCommand('Delete', false, null);
|
738
|
+
|
739
|
+
// It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents
|
740
|
+
ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo});
|
741
|
+
},
|
742
|
+
|
743
|
+
/**
|
744
|
+
* Instead of the old plain text method which tried to re-create a paste operation, the
|
745
|
+
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
746
|
+
* This function is passed the same input that the regular paste plugin produces.
|
747
|
+
* It performs additional scrubbing and produces (and inserts) the plain text.
|
748
|
+
* This approach leverages all of the great existing functionality in the paste
|
749
|
+
* plugin, and requires minimal changes to add the new functionality.
|
750
|
+
* Speednet - June 2009
|
751
|
+
*/
|
752
|
+
_insertPlainText : function(ed, dom, h) {
|
753
|
+
var i, len, pos, rpos, node, breakElms, before, after,
|
754
|
+
w = ed.getWin(),
|
755
|
+
d = ed.getDoc(),
|
756
|
+
sel = ed.selection,
|
757
|
+
is = tinymce.is,
|
758
|
+
inArray = tinymce.inArray,
|
759
|
+
linebr = getParam(ed, "paste_text_linebreaktype"),
|
760
|
+
rl = getParam(ed, "paste_text_replacements");
|
761
|
+
|
762
|
+
function process(items) {
|
763
|
+
each(items, function(v) {
|
764
|
+
if (v.constructor == RegExp)
|
765
|
+
h = h.replace(v, "");
|
766
|
+
else
|
767
|
+
h = h.replace(v[0], v[1]);
|
768
|
+
});
|
769
|
+
};
|
770
|
+
|
771
|
+
if ((typeof(h) === "string") && (h.length > 0)) {
|
772
|
+
if (!entities)
|
773
|
+
entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");
|
774
|
+
|
775
|
+
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
776
|
+
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
|
777
|
+
process([
|
778
|
+
/[\n\r]+/g
|
779
|
+
]);
|
780
|
+
} else {
|
781
|
+
// Otherwise just get rid of carriage returns (only need linefeeds)
|
782
|
+
process([
|
783
|
+
/\r+/g
|
784
|
+
]);
|
785
|
+
}
|
786
|
+
|
787
|
+
process([
|
788
|
+
[/<\/(?: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
|
789
|
+
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
790
|
+
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
791
|
+
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
792
|
+
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
793
|
+
[
|
794
|
+
// HTML entity
|
795
|
+
/&(#\d+|[a-z0-9]{1,10});/gi,
|
796
|
+
|
797
|
+
// Replace with actual character
|
798
|
+
function(e, s) {
|
799
|
+
if (s.charAt(0) === "#") {
|
800
|
+
return String.fromCharCode(s.slice(1));
|
801
|
+
}
|
802
|
+
else {
|
803
|
+
return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";
|
804
|
+
}
|
805
|
+
}
|
806
|
+
],
|
807
|
+
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
|
808
|
+
[/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
|
809
|
+
/^\s+|\s+$/g // Trim the front & back
|
810
|
+
]);
|
811
|
+
|
812
|
+
h = dom.encode(h);
|
813
|
+
|
814
|
+
// Delete any highlighted text before pasting
|
815
|
+
if (!sel.isCollapsed()) {
|
816
|
+
d.execCommand("Delete", false, null);
|
817
|
+
}
|
818
|
+
|
819
|
+
// Perform default or custom replacements
|
820
|
+
if (is(rl, "array") || (is(rl, "array"))) {
|
821
|
+
process(rl);
|
822
|
+
}
|
823
|
+
else if (is(rl, "string")) {
|
824
|
+
process(new RegExp(rl, "gi"));
|
825
|
+
}
|
826
|
+
|
827
|
+
// Treat paragraphs as specified in the config
|
828
|
+
if (linebr == "none") {
|
829
|
+
process([
|
830
|
+
[/\n+/g, " "]
|
831
|
+
]);
|
832
|
+
}
|
833
|
+
else if (linebr == "br") {
|
834
|
+
process([
|
835
|
+
[/\n/g, "<br />"]
|
836
|
+
]);
|
837
|
+
}
|
838
|
+
else {
|
839
|
+
process([
|
840
|
+
/^\s+|\s+$/g,
|
841
|
+
[/\n\n/g, "</p><p>"],
|
842
|
+
[/\n/g, "<br />"]
|
843
|
+
]);
|
844
|
+
}
|
845
|
+
|
846
|
+
// This next piece of code handles the situation where we're pasting more than one paragraph of plain
|
847
|
+
// text, and we are pasting the content into the middle of a block node in the editor. The block
|
848
|
+
// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
|
849
|
+
// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
|
850
|
+
// pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
|
851
|
+
// "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
|
852
|
+
// now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
|
853
|
+
// plain text take the same style as the existing paragraph.)
|
854
|
+
if ((pos = h.indexOf("</p><p>")) != -1) {
|
855
|
+
rpos = h.lastIndexOf("</p><p>");
|
856
|
+
node = sel.getNode();
|
857
|
+
breakElms = []; // Get list of elements to break
|
858
|
+
|
859
|
+
do {
|
860
|
+
if (node.nodeType == 1) {
|
861
|
+
// Don't break tables and break at body
|
862
|
+
if (node.nodeName == "TD" || node.nodeName == "BODY") {
|
863
|
+
break;
|
864
|
+
}
|
865
|
+
|
866
|
+
breakElms[breakElms.length] = node;
|
867
|
+
}
|
868
|
+
} while (node = node.parentNode);
|
869
|
+
|
870
|
+
// Are we in the middle of a block node?
|
871
|
+
if (breakElms.length > 0) {
|
872
|
+
before = h.substring(0, pos);
|
873
|
+
after = "";
|
874
|
+
|
875
|
+
for (i=0, len=breakElms.length; i<len; i++) {
|
876
|
+
before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
|
877
|
+
after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
|
878
|
+
}
|
879
|
+
|
880
|
+
if (pos == rpos) {
|
881
|
+
h = before + after + h.substring(pos+7);
|
882
|
+
}
|
883
|
+
else {
|
884
|
+
h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
|
885
|
+
}
|
886
|
+
}
|
887
|
+
}
|
888
|
+
|
889
|
+
// Insert content at the caret, plus add a marker for repositioning the caret
|
890
|
+
ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker"> </span>');
|
891
|
+
|
892
|
+
// Reposition the caret to the marker, which was placed immediately after the inserted content.
|
893
|
+
// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
|
894
|
+
// The second part of the code scrolls the content up if the caret is positioned off-screen.
|
895
|
+
// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
|
896
|
+
window.setTimeout(function() {
|
897
|
+
var marker = dom.get('_plain_text_marker'),
|
898
|
+
elm, vp, y, elmHeight;
|
899
|
+
|
900
|
+
sel.select(marker, false);
|
901
|
+
d.execCommand("Delete", false, null);
|
902
|
+
marker = null;
|
903
|
+
|
904
|
+
// Get element, position and height
|
905
|
+
elm = sel.getStart();
|
906
|
+
vp = dom.getViewPort(w);
|
907
|
+
y = dom.getPos(elm).y;
|
908
|
+
elmHeight = elm.clientHeight;
|
909
|
+
|
910
|
+
// Is element within viewport if not then scroll it into view
|
911
|
+
if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
|
912
|
+
d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
913
|
+
}
|
914
|
+
}, 0);
|
915
|
+
}
|
916
|
+
},
|
917
|
+
|
918
|
+
/**
|
919
|
+
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
920
|
+
*/
|
921
|
+
_legacySupport : function() {
|
922
|
+
var t = this, ed = t.editor;
|
923
|
+
|
924
|
+
// Register command(s) for backwards compatibility
|
925
|
+
ed.addCommand("mcePasteWord", function() {
|
926
|
+
ed.windowManager.open({
|
927
|
+
file: t.url + "/pasteword.htm",
|
928
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
929
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
930
|
+
inline: 1
|
931
|
+
});
|
932
|
+
});
|
933
|
+
|
934
|
+
if (getParam(ed, "paste_text_use_dialog")) {
|
935
|
+
ed.addCommand("mcePasteText", function() {
|
936
|
+
ed.windowManager.open({
|
937
|
+
file : t.url + "/pastetext.htm",
|
938
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
939
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
940
|
+
inline : 1
|
941
|
+
});
|
942
|
+
});
|
943
|
+
}
|
944
|
+
|
945
|
+
// Register button for backwards compatibility
|
946
|
+
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
947
|
+
}
|
948
|
+
});
|
949
|
+
|
950
|
+
// Register plugin
|
951
|
+
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
952
|
+
})();
|