soapbox 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +33 -0
- data/Gemfile.lock +142 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +75 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/controllers/admin/admin_controller.rb +111 -0
- data/app/controllers/admin/analytics_controller.rb +53 -0
- data/app/controllers/admin/attachments_controller.rb +28 -0
- data/app/controllers/admin/categories_controller.rb +2 -0
- data/app/controllers/admin/comments_controller.rb +2 -0
- data/app/controllers/admin/contents_controller.rb +2 -0
- data/app/controllers/admin/galleries_controller.rb +2 -0
- data/app/controllers/admin/gallery_images_controller.rb +29 -0
- data/app/controllers/admin/groups_controller.rb +10 -0
- data/app/controllers/admin/images_controller.rb +3 -0
- data/app/controllers/admin/menu_items_controller.rb +6 -0
- data/app/controllers/admin/menus_controller.rb +2 -0
- data/app/controllers/admin/pages_controller.rb +13 -0
- data/app/controllers/admin/plugins_controller.rb +2 -0
- data/app/controllers/admin/redirects_controller.rb +2 -0
- data/app/controllers/admin/settings_controller.rb +2 -0
- data/app/controllers/admin/users_controller.rb +2 -0
- data/app/controllers/admin/versions_controller.rb +6 -0
- data/app/controllers/application_controller.rb +38 -0
- data/app/controllers/attachments_controller.rb +2 -0
- data/app/controllers/categories_controller.rb +2 -0
- data/app/controllers/comments_controller.rb +2 -0
- data/app/controllers/groups_controller.rb +2 -0
- data/app/controllers/pages_controller.rb +18 -0
- data/app/controllers/plugins_controller.rb +2 -0
- data/app/controllers/redirects_controller.rb +5 -0
- data/app/controllers/settings_controller.rb +2 -0
- data/app/controllers/sitemap_controller.rb +7 -0
- data/app/helpers/content_helper.rb +17 -0
- data/app/helpers/layout_helper.rb +35 -0
- data/app/helpers/menu_helper.rb +26 -0
- data/app/helpers/page_helper.rb +21 -0
- data/app/helpers/plugin_helper.rb +21 -0
- data/app/helpers/soapbox_helper.rb +118 -0
- data/app/mailers/soapbox_mailer.rb +10 -0
- data/app/models/attachment.rb +16 -0
- data/app/models/content.rb +26 -0
- data/app/models/gallery.rb +9 -0
- data/app/models/gallery_image.rb +7 -0
- data/app/models/group.rb +27 -0
- data/app/models/member.rb +14 -0
- data/app/models/membership.rb +6 -0
- data/app/models/menu.rb +4 -0
- data/app/models/menu_item.rb +17 -0
- data/app/models/page.rb +41 -0
- data/app/models/permission.rb +12 -0
- data/app/models/plugin.rb +8 -0
- data/app/models/redirect.rb +3 -0
- data/app/models/setting.rb +16 -0
- data/app/models/user.rb +30 -0
- data/app/views/admin/analytics/index.html.erb +198 -0
- data/app/views/admin/attachments/_image.html.erb +15 -0
- data/app/views/admin/attachments/form.html.erb +26 -0
- data/app/views/admin/attachments/index.html.erb +16 -0
- data/app/views/admin/categories/form.html.erb +27 -0
- data/app/views/admin/categories/index.html.erb +1 -0
- data/app/views/admin/comments/form.html.erb +34 -0
- data/app/views/admin/comments/index.html.erb +1 -0
- data/app/views/admin/galleries/_image.html.erb +8 -0
- data/app/views/admin/galleries/_manager.html.erb +57 -0
- data/app/views/admin/galleries/form.html.erb +18 -0
- data/app/views/admin/galleries/index.html.erb +1 -0
- data/app/views/admin/groups/form.html.erb +81 -0
- data/app/views/admin/groups/index.html.erb +1 -0
- data/app/views/admin/menu_items/form.html.erb +28 -0
- data/app/views/admin/menus/_item.html.erb +5 -0
- data/app/views/admin/menus/form.html.erb +25 -0
- data/app/views/admin/menus/index.html.erb +82 -0
- data/app/views/admin/pages/form.html.erb +68 -0
- data/app/views/admin/pages/index.html.erb +1 -0
- data/app/views/admin/pages/link_list.html.erb +9 -0
- data/app/views/admin/plugins/form.html.erb +30 -0
- data/app/views/admin/plugins/index.html.erb +2 -0
- data/app/views/admin/redirects/form.html.erb +26 -0
- data/app/views/admin/redirects/index.html.erb +1 -0
- data/app/views/admin/settings/form.html.erb +27 -0
- data/app/views/admin/settings/index.html.erb +1 -0
- data/app/views/admin/shared/_form_buttons.html.erb +4 -0
- data/app/views/admin/shared/_form_errors.html.erb +10 -0
- data/app/views/admin/shared/_list.html.erb +68 -0
- data/app/views/admin/shared/_list_footer.html.erb +8 -0
- data/app/views/admin/shared/_list_toolbar.html.erb +22 -0
- data/app/views/admin/shared/_tag_manager.html.erb +20 -0
- data/app/views/admin/shared/order.html.erb +33 -0
- data/app/views/admin/shared/tree.html.erb +49 -0
- data/app/views/admin/shared/wysiwyg.html.erb +17 -0
- data/app/views/admin/users/form.html.erb +28 -0
- data/app/views/admin/users/index.html.erb +1 -0
- data/app/views/admin/versions/index.html.erb +38 -0
- data/app/views/devise/confirmations/new.html.erb +11 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +15 -0
- data/app/views/devise/passwords/new.html.erb +11 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/shared/_links.erb +23 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/galleries/_nivo_slider.html.erb +22 -0
- data/app/views/galleries/_pretty_photo.html.erb +19 -0
- data/app/views/groups/index.html.erb +7 -0
- data/app/views/groups/show.html.erb +16 -0
- data/app/views/layouts/_admin_toolbar.html.erb +29 -0
- data/app/views/layouts/_admin_top_nav.html.erb +19 -0
- data/app/views/layouts/_head.html.erb +31 -0
- data/app/views/layouts/admin.html.erb +11 -0
- data/app/views/layouts/admin_blank.html.erb +9 -0
- data/app/views/layouts/login.html.erb +22 -0
- data/app/views/pages/error_404.html.erb +2 -0
- data/app/views/pages/index.html.erb +7 -0
- data/app/views/pages/templates/default.html.erb +3 -0
- data/app/views/sitemap/sitemap.rxml +9 -0
- data/app/views/soapbox_mailer/email_form.html.erb +13 -0
- data/app/views/soapbox_mailer/email_form.text.erb +8 -0
- data/config/permissions.yml.template +35 -0
- data/config/routes.rb +62 -0
- data/install.rb +8 -0
- data/lib/generators/soapbox_migration/soapbox_migration_generator.rb +22 -0
- data/lib/generators/soapbox_migration/templates/migration.rb +259 -0
- data/lib/generators/soapbox_scaffold/soapbox_scaffold_generator.rb +69 -0
- data/lib/generators/soapbox_scaffold/templates/admin_controller.rb +2 -0
- data/lib/generators/soapbox_scaffold/templates/controller.rb +2 -0
- data/lib/generators/soapbox_scaffold/templates/migration.rb +20 -0
- data/lib/generators/soapbox_scaffold/templates/model.rb +3 -0
- data/lib/generators/soapbox_scaffold/templates/views/admin/form.html.erb +25 -0
- data/lib/generators/soapbox_scaffold/templates/views/admin/index.html.erb +1 -0
- data/lib/generators/soapbox_scaffold/templates/views/index.html.erb +7 -0
- data/lib/generators/soapbox_scaffold/templates/views/show.html.erb +17 -0
- data/lib/soapbox.rb +48 -0
- data/lib/soapbox/engine.rb +17 -0
- data/lib/soapbox/paperclip.rb +31 -0
- data/lib/soapbox/version.rb +4 -0
- data/lib/states.rb +52 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/public/soapbox/images/alert-overlay.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/contentPattern.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/contentPattern.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/default_thumb.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_next.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_prev.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_x.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_y.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternBottom.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternLeft.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternRight.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternTop.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/sprite.png +0 -0
- data/public/soapbox/javascripts/admin.js +119 -0
- data/public/soapbox/javascripts/blogger.js +52 -0
- data/public/soapbox/javascripts/jquery-1.4.2.min.js +154 -0
- data/public/soapbox/javascripts/jquery-1.6.2.min.js +18 -0
- data/public/soapbox/javascripts/jquery-ui-1.8rc3.custom.min.js +374 -0
- data/public/soapbox/javascripts/jquery.fileupload-ui.js +533 -0
- data/public/soapbox/javascripts/jquery.fileupload.js +975 -0
- data/public/soapbox/javascripts/jquery.flot.js +2599 -0
- data/public/soapbox/javascripts/jquery.formtastic.js +45 -0
- data/public/soapbox/javascripts/jquery.nivo.slider.pack.js +67 -0
- data/public/soapbox/javascripts/jquery.prettyPhoto.js +27 -0
- data/public/soapbox/javascripts/jquery.timepicker.js +304 -0
- data/public/soapbox/javascripts/jquery.tools.min.js +116 -0
- data/public/soapbox/javascripts/jquery.ui.nestedSortable.js +356 -0
- data/public/soapbox/javascripts/rails-1.6.js +331 -0
- data/public/soapbox/javascripts/rails.js +143 -0
- data/public/soapbox/javascripts/soapbox.js +27 -0
- data/public/soapbox/javascripts/tiny_mce/init.js +54 -0
- data/public/soapbox/javascripts/tiny_mce/jquery.tinymce.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/langs/en.js +169 -0
- data/public/soapbox/javascripts/tiny_mce/license.txt +504 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/rule.htm +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/image.htm +232 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/link.htm +333 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +117 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +127 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +149 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +148 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +635 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/media.htm +817 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +929 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/example.html +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +130 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +99 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +341 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/props.htm +726 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +112 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1118 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/table.js +449 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/row.htm +155 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/table.htm +187 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/template.htm +32 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +76 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +148 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +161 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +144 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +161 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +63 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/about.htm +54 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/color_picker.htm +73 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1167 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/charmap.js +335 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/content.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/source_editor.htm +26 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce_src.js +13134 -0
- data/public/soapbox/javascripts/tiny_mce/utils/editable_selects.js +70 -0
- data/public/soapbox/javascripts/tiny_mce/utils/form_utils.js +200 -0
- data/public/soapbox/javascripts/tiny_mce/utils/mctabs.js +77 -0
- data/public/soapbox/javascripts/tiny_mce/utils/validate.js +220 -0
- data/public/soapbox/stylesheets/admin.css +599 -0
- data/public/soapbox/stylesheets/admin_toolbar.css +24 -0
- data/public/soapbox/stylesheets/awesome_buttons.css +48 -0
- data/public/soapbox/stylesheets/base/images/ui-anim_basic_16x16.gif +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_222222_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_454545_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_888888_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/jquery.ui.accordion.css +10 -0
- data/public/soapbox/stylesheets/base/jquery.ui.all.css +2 -0
- data/public/soapbox/stylesheets/base/jquery.ui.autocomplete.css +35 -0
- data/public/soapbox/stylesheets/base/jquery.ui.base.css +10 -0
- data/public/soapbox/stylesheets/base/jquery.ui.button.css +35 -0
- data/public/soapbox/stylesheets/base/jquery.ui.core.css +37 -0
- data/public/soapbox/stylesheets/base/jquery.ui.datepicker.css +61 -0
- data/public/soapbox/stylesheets/base/jquery.ui.dialog.css +13 -0
- data/public/soapbox/stylesheets/base/jquery.ui.progressbar.css +4 -0
- data/public/soapbox/stylesheets/base/jquery.ui.resizable.css +13 -0
- data/public/soapbox/stylesheets/base/jquery.ui.slider.css +17 -0
- data/public/soapbox/stylesheets/base/jquery.ui.tabs.css +11 -0
- data/public/soapbox/stylesheets/base/jquery.ui.theme.css +247 -0
- data/public/soapbox/stylesheets/devise.css +0 -0
- data/public/soapbox/stylesheets/formtastic.css +131 -0
- data/public/soapbox/stylesheets/formtastic_changes.css +27 -0
- data/public/soapbox/stylesheets/jquery.fileupload-ui.css +151 -0
- data/public/soapbox/stylesheets/jquery.timepicker.css +104 -0
- data/public/soapbox/stylesheets/nivo-slider.css +89 -0
- data/public/soapbox/stylesheets/nivo-themes/default/arrows.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/default/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/default/default.css +74 -0
- data/public/soapbox/stylesheets/nivo-themes/default/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/arrows.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/orman.css +98 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/readme.txt +1 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/ribbon.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/slider.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/controlnav.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/featured.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/pascal.css +102 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/readme.txt +1 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/ribbon.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/slider.png +0 -0
- data/public/soapbox/stylesheets/pbar-ani.gif +0 -0
- data/public/soapbox/stylesheets/prettyPhoto.css +1 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/jquery-ui-1.8.4.custom.css +572 -0
- data/public/soapbox/stylesheets/standardize.css +127 -0
- data/soapbox.gemspec +617 -0
- data/test/helper.rb +18 -0
- data/test/test_soapbox.rb +7 -0
- metadata +872 -0
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
|
@@ -0,0 +1,112 @@
|
|
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 DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
|
13
|
+
|
14
|
+
tinymce.create('tinymce.plugins.TabFocusPlugin', {
|
15
|
+
init : function(ed, url) {
|
16
|
+
function tabCancel(ed, e) {
|
17
|
+
if (e.keyCode === 9)
|
18
|
+
return Event.cancel(e);
|
19
|
+
};
|
20
|
+
|
21
|
+
function tabHandler(ed, e) {
|
22
|
+
var x, i, f, el, v;
|
23
|
+
|
24
|
+
function find(d) {
|
25
|
+
f = DOM.getParent(ed.id, 'form');
|
26
|
+
el = f.elements;
|
27
|
+
|
28
|
+
if (f) {
|
29
|
+
each(el, function(e, i) {
|
30
|
+
if (e.id == ed.id) {
|
31
|
+
x = i;
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
if (d > 0) {
|
37
|
+
for (i = x + 1; i < el.length; i++) {
|
38
|
+
if (el[i].type != 'hidden')
|
39
|
+
return el[i];
|
40
|
+
}
|
41
|
+
} else {
|
42
|
+
for (i = x - 1; i >= 0; i--) {
|
43
|
+
if (el[i].type != 'hidden')
|
44
|
+
return el[i];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return null;
|
50
|
+
};
|
51
|
+
|
52
|
+
if (e.keyCode === 9) {
|
53
|
+
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
54
|
+
|
55
|
+
if (v.length == 1) {
|
56
|
+
v[1] = v[0];
|
57
|
+
v[0] = ':prev';
|
58
|
+
}
|
59
|
+
|
60
|
+
// Find element to focus
|
61
|
+
if (e.shiftKey) {
|
62
|
+
if (v[0] == ':prev')
|
63
|
+
el = find(-1);
|
64
|
+
else
|
65
|
+
el = DOM.get(v[0]);
|
66
|
+
} else {
|
67
|
+
if (v[1] == ':next')
|
68
|
+
el = find(1);
|
69
|
+
else
|
70
|
+
el = DOM.get(v[1]);
|
71
|
+
}
|
72
|
+
|
73
|
+
if (el) {
|
74
|
+
if (ed = tinymce.get(el.id || el.name))
|
75
|
+
ed.focus();
|
76
|
+
else
|
77
|
+
window.setTimeout(function() {window.focus();el.focus();}, 10);
|
78
|
+
|
79
|
+
return Event.cancel(e);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
ed.onKeyUp.add(tabCancel);
|
85
|
+
|
86
|
+
if (tinymce.isGecko) {
|
87
|
+
ed.onKeyPress.add(tabHandler);
|
88
|
+
ed.onKeyDown.add(tabCancel);
|
89
|
+
} else
|
90
|
+
ed.onKeyDown.add(tabHandler);
|
91
|
+
|
92
|
+
ed.onInit.add(function() {
|
93
|
+
each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {
|
94
|
+
Event.add(n, 'focus', function() {ed.focus();});
|
95
|
+
});
|
96
|
+
});
|
97
|
+
},
|
98
|
+
|
99
|
+
getInfo : function() {
|
100
|
+
return {
|
101
|
+
longname : 'Tabfocus',
|
102
|
+
author : 'Moxiecode Systems AB',
|
103
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
104
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
105
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
106
|
+
};
|
107
|
+
}
|
108
|
+
});
|
109
|
+
|
110
|
+
// Register plugin
|
111
|
+
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
112
|
+
})();
|
@@ -0,0 +1,178 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<title>{#table_dlg.cell_title}</title>
|
5
|
+
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
6
|
+
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
7
|
+
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
8
|
+
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
9
|
+
<script type="text/javascript" src="js/cell.js"></script>
|
10
|
+
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body id="tablecell" style="display: none">
|
13
|
+
<form onsubmit="updateAction();return false;" action="#">
|
14
|
+
<div class="tabs">
|
15
|
+
<ul>
|
16
|
+
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
17
|
+
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="panel_wrapper">
|
22
|
+
<div id="general_panel" class="panel current">
|
23
|
+
<fieldset>
|
24
|
+
<legend>{#table_dlg.general_props}</legend>
|
25
|
+
|
26
|
+
<table border="0" cellpadding="4" cellspacing="0">
|
27
|
+
<tr>
|
28
|
+
<td><label for="align">{#table_dlg.align}</label></td>
|
29
|
+
<td>
|
30
|
+
<select id="align" name="align" class="mceFocus">
|
31
|
+
<option value="">{#not_set}</option>
|
32
|
+
<option value="center">{#table_dlg.align_middle}</option>
|
33
|
+
<option value="left">{#table_dlg.align_left}</option>
|
34
|
+
<option value="right">{#table_dlg.align_right}</option>
|
35
|
+
</select>
|
36
|
+
</td>
|
37
|
+
|
38
|
+
<td><label for="celltype">{#table_dlg.cell_type}</label></td>
|
39
|
+
<td>
|
40
|
+
<select id="celltype" name="celltype">
|
41
|
+
<option value="td">{#table_dlg.td}</option>
|
42
|
+
<option value="th">{#table_dlg.th}</option>
|
43
|
+
</select>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
|
47
|
+
<tr>
|
48
|
+
<td><label for="valign">{#table_dlg.valign}</label></td>
|
49
|
+
<td>
|
50
|
+
<select id="valign" name="valign">
|
51
|
+
<option value="">{#not_set}</option>
|
52
|
+
<option value="top">{#table_dlg.align_top}</option>
|
53
|
+
<option value="middle">{#table_dlg.align_middle}</option>
|
54
|
+
<option value="bottom">{#table_dlg.align_bottom}</option>
|
55
|
+
</select>
|
56
|
+
</td>
|
57
|
+
|
58
|
+
<td><label for="scope">{#table_dlg.scope}</label></td>
|
59
|
+
<td>
|
60
|
+
<select id="scope" name="scope">
|
61
|
+
<option value="">{#not_set}</option>
|
62
|
+
<option value="col">{#table.col}</option>
|
63
|
+
<option value="row">{#table.row}</option>
|
64
|
+
<option value="rowgroup">{#table_dlg.rowgroup}</option>
|
65
|
+
<option value="colgroup">{#table_dlg.colgroup}</option>
|
66
|
+
</select>
|
67
|
+
</td>
|
68
|
+
|
69
|
+
</tr>
|
70
|
+
|
71
|
+
<tr>
|
72
|
+
<td><label for="width">{#table_dlg.width}</label></td>
|
73
|
+
<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
74
|
+
|
75
|
+
<td><label for="height">{#table_dlg.height}</label></td>
|
76
|
+
<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
77
|
+
</tr>
|
78
|
+
|
79
|
+
<tr id="styleSelectRow">
|
80
|
+
<td><label for="class">{#class_name}</label></td>
|
81
|
+
<td colspan="3">
|
82
|
+
<select id="class" name="class" class="mceEditableSelect">
|
83
|
+
<option value="" selected="selected">{#not_set}</option>
|
84
|
+
</select>
|
85
|
+
</td>
|
86
|
+
</tr>
|
87
|
+
</table>
|
88
|
+
</fieldset>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="advanced_panel" class="panel">
|
92
|
+
<fieldset>
|
93
|
+
<legend>{#table_dlg.advanced_props}</legend>
|
94
|
+
|
95
|
+
<table border="0" cellpadding="0" cellspacing="4">
|
96
|
+
<tr>
|
97
|
+
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
98
|
+
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
99
|
+
</tr>
|
100
|
+
|
101
|
+
<tr>
|
102
|
+
<td><label for="style">{#table_dlg.style}</label></td>
|
103
|
+
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
|
104
|
+
</tr>
|
105
|
+
|
106
|
+
<tr>
|
107
|
+
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
108
|
+
<td>
|
109
|
+
<select id="dir" name="dir" style="width: 200px">
|
110
|
+
<option value="">{#not_set}</option>
|
111
|
+
<option value="ltr">{#table_dlg.ltr}</option>
|
112
|
+
<option value="rtl">{#table_dlg.rtl}</option>
|
113
|
+
</select>
|
114
|
+
</td>
|
115
|
+
</tr>
|
116
|
+
|
117
|
+
<tr>
|
118
|
+
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
119
|
+
<td>
|
120
|
+
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
121
|
+
</td>
|
122
|
+
</tr>
|
123
|
+
|
124
|
+
<tr>
|
125
|
+
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
126
|
+
<td>
|
127
|
+
<table border="0" cellpadding="0" cellspacing="0">
|
128
|
+
<tr>
|
129
|
+
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
130
|
+
<td id="backgroundimagebrowsercontainer"> </td>
|
131
|
+
</tr>
|
132
|
+
</table>
|
133
|
+
</td>
|
134
|
+
</tr>
|
135
|
+
|
136
|
+
<tr>
|
137
|
+
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138
|
+
<td>
|
139
|
+
<table border="0" cellpadding="0" cellspacing="0">
|
140
|
+
<tr>
|
141
|
+
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
142
|
+
<td id="bordercolor_pickcontainer"> </td>
|
143
|
+
</tr>
|
144
|
+
</table>
|
145
|
+
</td>
|
146
|
+
</tr>
|
147
|
+
|
148
|
+
<tr>
|
149
|
+
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150
|
+
<td>
|
151
|
+
<table border="0" cellpadding="0" cellspacing="0">
|
152
|
+
<tr>
|
153
|
+
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
154
|
+
<td id="bgcolor_pickcontainer"> </td>
|
155
|
+
</tr>
|
156
|
+
</table>
|
157
|
+
</td>
|
158
|
+
</tr>
|
159
|
+
</table>
|
160
|
+
</fieldset>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div class="mceActionPanel">
|
165
|
+
<div>
|
166
|
+
<select id="action" name="action">
|
167
|
+
<option value="cell">{#table_dlg.cell_cell}</option>
|
168
|
+
<option value="row">{#table_dlg.cell_row}</option>
|
169
|
+
<option value="all">{#table_dlg.cell_all}</option>
|
170
|
+
</select>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<input type="submit" id="insert" name="insert" value="{#update}" />
|
174
|
+
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
175
|
+
</div>
|
176
|
+
</form>
|
177
|
+
</body>
|
178
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/* CSS file for row dialog in the table plugin */
|
2
|
+
|
3
|
+
.panel_wrapper div.current {
|
4
|
+
height: 200px;
|
5
|
+
}
|
6
|
+
|
7
|
+
.advfield {
|
8
|
+
width: 200px;
|
9
|
+
}
|
10
|
+
|
11
|
+
#action {
|
12
|
+
margin-bottom: 3px;
|
13
|
+
}
|
14
|
+
|
15
|
+
#rowtype,#align,#valign,#class,#height {
|
16
|
+
width: 150px;
|
17
|
+
}
|
18
|
+
|
19
|
+
#height {
|
20
|
+
width: 50px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.col2 {
|
24
|
+
padding-left: 20px;
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(b){var c=b.each;function a(E,D,H){var e,I,A,n;r();n=D.getParent(H.getStart(),"th,td");if(n){I=C(n);A=F();n=v(I.x,I.y)}function r(){var J=0;e=[];c(["thead","tbody","tfoot"],function(K){var L=D.select(K+" tr",E);c(L,function(M,N){N+=J;c(D.select("td,th",M),function(T,O){var P,Q,R,S;if(e[N]){while(e[N][O]){O++}}R=g(T,"rowspan");S=g(T,"colspan");for(Q=N;Q<N+R;Q++){if(!e[Q]){e[Q]=[]}for(P=O;P<O+S;P++){e[Q][P]={part:K,real:Q==N&&P==O,elm:T,rowspan:R,colspan:S}}}})});J+=L.length})}function v(J,L){var K;K=e[L];if(K){return K[J]}}function g(K,J){return parseInt(K.getAttribute(J)||1)}function h(J){return D.hasClass(J.elm,"mceSelected")||J==n}function j(){var J=[];c(E.rows,function(K){c(K.cells,function(L){if(D.hasClass(L,"mceSelected")||L==n.elm){J.push(K);return false}})});return J}function q(){var J=D.createRng();J.setStartAfter(E);J.setEndAfter(E);H.setRng(J);D.remove(E)}function d(J){var K;b.walk(J,function(M){var L;if(M.nodeType==3){c(D.getParents(M.parentNode,null,J).reverse(),function(N){N=N.cloneNode(false);if(!K){K=L=N}else{if(L){L.appendChild(N)}}L=N});if(L){L.innerHTML=b.isIE?" ":'<br _mce_bogus="1" />'}return false}},"childNodes");J=J.cloneNode(false);J.rowSpan=J.colSpan=1;if(K){J.appendChild(K)}else{if(!b.isIE){J.innerHTML='<br _mce_bogus="1" />'}}return J}function p(){var J=D.createRng();c(D.select("tr",E),function(K){if(K.cells.length==0){D.remove(K)}});if(D.select("tr",E).length==0){J.setStartAfter(E);J.setEndAfter(E);H.setRng(J);D.remove(E);return}c(D.select("thead,tbody,tfoot",E),function(K){if(K.rows.length==0){D.remove(K)}});r();row=e[Math.min(e.length-1,I.y)];if(row){H.select(row[Math.min(row.length-1,I.x)].elm,true);H.collapse(true)}}function s(P,N,R,O){var M,K,J,L,Q;M=e[N][P].elm.parentNode;for(J=1;J<=R;J++){M=D.getNext(M,"tr");if(M){for(K=P;K>=0;K--){Q=e[N+J][K].elm;if(Q.parentNode==M){for(L=1;L<=O;L++){D.insertAfter(d(Q),Q)}break}}if(K==-1){for(L=1;L<=O;L++){M.insertBefore(d(M.cells[0]),M.cells[0])}}}}}function z(){c(e,function(J,K){c(J,function(M,L){var P,O,Q,N;if(h(M)){M=M.elm;P=g(M,"colspan");O=g(M,"rowspan");if(P>1||O>1){M.colSpan=M.rowSpan=1;for(N=0;N<P-1;N++){D.insertAfter(d(M),M)}s(L,K,O-1,P)}}})})}function o(R,O,U){var M,L,T,S,Q,N,P,J,R,K;if(R){pos=C(R);M=pos.x;L=pos.y;T=M+(O-1);S=L+(U-1)}else{M=I.x;L=I.y;T=A.x;S=A.y}P=v(M,L);J=v(T,S);if(P&&J&&P.part==J.part){z();r();P=v(M,L).elm;P.colSpan=(T-M)+1;P.rowSpan=(S-L)+1;for(N=L;N<=S;N++){for(Q=M;Q<=T;Q++){R=e[N][Q].elm;if(R!=P){K=b.grep(R.childNodes);c(K,function(W,V){if(W.nodeName!="BR"||V!=K.length-1){P.appendChild(W)}});D.remove(R)}}}p()}}function k(M){var J,O,L,N,P,Q,K,R;c(e,function(S,T){c(S,function(V,U){if(h(V)){V=V.elm;P=V.parentNode;Q=P.cloneNode(false);J=T;if(M){return false}}});if(M){return !J}});for(N=0;N<e[0].length;N++){O=e[J][N].elm;if(O!=L){if(!M){rowSpan=g(O,"rowspan");if(rowSpan>1){O.rowSpan=rowSpan+1;continue}}else{if(J>0&&e[J-1][N]){R=e[J-1][N].elm;rowSpan=g(R,"rowspan");if(rowSpan>1){R.rowSpan=rowSpan+1;continue}}}K=d(O);K.colSpan=O.colSpan;Q.appendChild(K);L=O}}if(Q.hasChildNodes()){if(!M){D.insertAfter(Q,P)}else{P.parentNode.insertBefore(Q,P)}}}function f(K){var L,J;c(e,function(M,N){c(M,function(P,O){if(h(P)){L=O;if(K){return false}}});if(K){return !L}});c(e,function(P,Q){var M=P[L].elm,N,O;if(M!=J){O=g(M,"colspan");N=g(M,"rowspan");if(O==1){if(!K){D.insertAfter(d(M),M);s(L,Q,N-1,O)}else{M.parentNode.insertBefore(d(M),M);s(L,Q,N-1,O)}}else{M.colSpan++}J=M}})}function m(){var J=[];c(e,function(K,L){c(K,function(N,M){if(h(N)&&b.inArray(J,M)===-1){c(e,function(Q){var O=Q[M].elm,P;P=g(O,"colspan");if(P>1){O.colSpan=P-1}else{D.remove(O)}});J.push(M)}})});p()}function l(){var K;function J(N){var M,O,L;M=D.getNext(N,"tr");c(N.cells,function(P){var Q=g(P,"rowspan");if(Q>1){P.rowSpan=Q-1;O=C(P);s(O.x,O.y,1,1)}});O=C(N.cells[0]);c(e[O.y],function(P){var Q;P=P.elm;if(P!=L){Q=g(P,"rowspan");if(Q<=1){D.remove(P)}else{P.rowSpan=Q-1}L=P}})}K=j();c(K.reverse(),function(L){J(L)});p()}function B(){var J=j();D.remove(J);p();return J}function G(){var J=j();c(J,function(L,K){J[K]=L.cloneNode(true)});return J}function w(L,K){var M=j(),J=M[K?0:M.length-1],N=J.cells.length;c(e,function(P){var O;N=0;c(P,function(R,Q){if(R.real){N+=R.colspan}if(R.elm.parentNode==J){O=1}});if(O){return false}});if(!K){L.reverse()}c(L,function(Q){var P=Q.cells.length,O;for(i=0;i<P;i++){O=Q.cells[i];O.colSpan=O.rowSpan=1}for(i=P;i<N;i++){Q.appendChild(d(Q.cells[P-1]))}for(i=N;i<P;i++){D.remove(Q.cells[i])}if(K){J.parentNode.insertBefore(Q,J)}else{D.insertAfter(Q,J)}})}function C(J){var K;c(e,function(L,M){c(L,function(O,N){if(O.elm==J){K={x:N,y:M};return false}});return !K});return K}function u(J){I=C(J)}function F(){var L,K,J;K=J=0;c(e,function(M,N){c(M,function(P,O){var R,Q;if(h(P)){P=e[N][O];if(O>K){K=O}if(N>J){J=N}if(P.real){R=P.colspan-1;Q=P.rowspan-1;if(R){if(O+R>K){K=O+R}}if(Q){if(N+Q>J){J=N+Q}}}}})});return{x:K,y:J}}function t(P){var M,L,R,Q,K,J,N,O;A=C(P);if(I&&A){M=Math.min(I.x,A.x);L=Math.min(I.y,A.y);R=Math.max(I.x,A.x);Q=Math.max(I.y,A.y);K=R;J=Q;for(y=L;y<=J;y++){P=e[y][M];if(!P.real){if(M-(P.colspan-1)<M){M-=P.colspan-1}}}for(x=M;x<=K;x++){P=e[L][x];if(!P.real){if(L-(P.rowspan-1)<L){L-=P.rowspan-1}}}for(y=L;y<=Q;y++){for(x=M;x<=R;x++){P=e[y][x];if(P.real){N=P.colspan-1;O=P.rowspan-1;if(N){if(x+N>K){K=x+N}}if(O){if(y+O>J){J=y+O}}}}}D.removeClass(D.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=L;y<=J;y++){for(x=M;x<=K;x++){D.addClass(e[y][x].elm,"mceSelected")}}}}b.extend(this,{deleteTable:q,split:z,merge:o,insertRow:k,insertCol:f,deleteCols:m,deleteRows:l,cutRows:B,copyRows:G,pasteRows:w,getPos:C,setStartCell:u,setEndCell:t})}b.create("tinymce.plugins.TablePlugin",{init:function(e,f){var d,j;function h(m){var l=e.selection,k=e.dom.getParent(m||l.getNode(),"table");if(k){return new a(k,e.dom,l)}}function g(){e.getBody().style.webkitUserSelect="";e.dom.removeClass(e.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}c([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(k){e.addButton(k[0],{title:k[1],cmd:k[2],ui:k[3]})});if(!b.isIE){e.onClick.add(function(k,l){l=l.target;if(l.nodeName==="TABLE"){k.selection.select(l)}})}e.onNodeChange.add(function(l,k,o){var m;o=l.selection.getStart();m=l.dom.getParent(o,"td,th,caption");k.setActive("table",o.nodeName==="TABLE"||!!m);if(m&&m.nodeName==="CAPTION"){m=0}k.setDisabled("delete_table",!m);k.setDisabled("delete_col",!m);k.setDisabled("delete_table",!m);k.setDisabled("delete_row",!m);k.setDisabled("col_after",!m);k.setDisabled("col_before",!m);k.setDisabled("row_after",!m);k.setDisabled("row_before",!m);k.setDisabled("row_props",!m);k.setDisabled("cell_props",!m);k.setDisabled("split_cells",!m);k.setDisabled("merge_cells",!m)});e.onInit.add(function(l){var k,o,p=l.dom,m;d=l.windowManager;l.onMouseDown.add(function(q,r){if(r.button!=2){g();o=p.getParent(r.target,"td,th");k=p.getParent(o,"table")}});p.bind(l.getDoc(),"mouseover",function(t){var r,q,s=t.target;if(o&&(m||s!=o)&&(s.nodeName=="TD"||s.nodeName=="TH")){q=p.getParent(s,"table");if(q==k){if(!m){m=h(q);m.setStartCell(o);l.getBody().style.webkitUserSelect="none"}m.setEndCell(s)}r=l.selection.getSel();if(r.removeAllRanges){r.removeAllRanges()}else{r.empty()}t.preventDefault()}});l.onMouseUp.add(function(z,A){var r,t=z.selection,B,C=t.getSel(),q,u,s,w;if(o){if(m){z.getBody().style.webkitUserSelect=""}function v(D,F){var E=new b.dom.TreeWalker(D,D);do{if(D.nodeType==3&&b.trim(D.nodeValue).length!=0){if(F){r.setStart(D,0)}else{r.setEnd(D,D.nodeValue.length)}return}if(D.nodeName=="BR"){if(F){r.setStartBefore(D)}else{r.setEndBefore(D)}return}}while(D=(F?E.next():E.prev()))}B=p.select("td.mceSelected,th.mceSelected");if(B.length>0){r=p.createRng();u=B[0];w=B[B.length-1];v(u,1);q=new b.dom.TreeWalker(u,p.getParent(B[0],"table"));do{if(u.nodeName=="TD"||u.nodeName=="TH"){if(!p.hasClass(u,"mceSelected")){break}s=u}}while(u=q.next());v(s);t.setRng(r)}z.nodeChanged();o=m=k=null}});l.onKeyUp.add(function(q,r){g()});if(l&&l.plugins.contextmenu){l.plugins.contextmenu.onContextMenu.add(function(s,q,u){var v,t=l.selection,r=t.getNode()||l.getBody();if(l.dom.getParent(u,"td")||l.dom.getParent(u,"th")){q.removeAll();if(r.nodeName=="A"&&!l.dom.getAttrib(r,"name")){q.add({title:"advanced.link_desc",icon:"link",cmd:l.plugins.advlink?"mceAdvLink":"mceLink",ui:true});q.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});q.addSeparator()}if(r.nodeName=="IMG"&&r.className.indexOf("mceItem")==-1){q.add({title:"advanced.image_desc",icon:"image",cmd:l.plugins.advimage?"mceAdvImage":"mceImage",ui:true});q.addSeparator()}q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});q.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});q.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});q.addSeparator();v=q.addMenu({title:"table.cell"});v.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});v.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});v.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});v=q.addMenu({title:"table.row"});v.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});v.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});v.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});v.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});v.addSeparator();v.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});v.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});v.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!j);v.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!j);v=q.addMenu({title:"table.col"});v.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});v.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});v.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!b.isIE){function n(){var q;for(q=l.getBody().lastChild;q&&q.nodeType==3&&!q.nodeValue.length;q=q.previousSibling){}if(q&&q.nodeName=="TABLE"){l.dom.add(l.getBody(),"p",null,'<br mce_bogus="1" />')}}if(b.isGecko){l.onKeyDown.add(function(r,t){var q,s,u=r.dom;if(t.keyCode==37||t.keyCode==38){q=r.selection.getRng();s=u.getParent(q.startContainer,"table");if(s&&r.getBody().firstChild==s){if(isAtStart(q,s)){q=u.createRng();q.setStartBefore(s);q.setEndBefore(s);r.selection.setRng(q);t.preventDefault()}}}})}l.onKeyUp.add(n);l.onSetContent.add(n);l.onVisualAid.add(n);l.onPreProcess.add(function(q,s){var r=s.node.lastChild;if(r&&r.childNodes.length==1&&r.firstChild.nodeName=="BR"){q.dom.remove(r)}});n()}});c({mceTableSplitCells:function(k){k.split()},mceTableMergeCells:function(l){var m,n,k;k=e.dom.getParent(e.selection.getNode(),"th,td");if(k){m=k.rowSpan;n=k.colSpan}if(!e.dom.select("td.mceSelected,th.mceSelected").length){d.open({url:f+"/merge_cells.htm",width:240+parseInt(e.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(e.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:m,cols:n,onaction:function(o){l.merge(k,o.cols,o.rows)},plugin_url:f})}else{l.merge()}},mceTableInsertRowBefore:function(k){k.insertRow(true)},mceTableInsertRowAfter:function(k){k.insertRow()},mceTableInsertColBefore:function(k){k.insertCol(true)},mceTableInsertColAfter:function(k){k.insertCol()},mceTableDeleteCol:function(k){k.deleteCols()},mceTableDeleteRow:function(k){k.deleteRows()},mceTableCutRow:function(k){j=k.cutRows()},mceTableCopyRow:function(k){j=k.copyRows()},mceTablePasteRowBefore:function(k){k.pasteRows(j,true)},mceTablePasteRowAfter:function(k){k.pasteRows(j)},mceTableDelete:function(k){k.deleteTable()}},function(l,k){e.addCommand(k,function(){var m=h();if(m){l(m);e.execCommand("mceRepaint");g()}})});c({mceInsertTable:function(k){d.open({url:f+"/table.htm",width:400+parseInt(e.getLang("table.table_delta_width",0)),height:320+parseInt(e.getLang("table.table_delta_height",0)),inline:1},{plugin_url:f,action:k?k.action:0})},mceTableRowProps:function(){d.open({url:f+"/row.htm",width:400+parseInt(e.getLang("table.rowprops_delta_width",0)),height:295+parseInt(e.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:f})},mceTableCellProps:function(){d.open({url:f+"/cell.htm",width:400+parseInt(e.getLang("table.cellprops_delta_width",0)),height:295+parseInt(e.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:f})}},function(l,k){e.addCommand(k,function(m,n){l(n)})})}});b.PluginManager.add("table",b.plugins.TablePlugin)})(tinymce);
|
@@ -0,0 +1,1118 @@
|
|
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(tinymce) {
|
12
|
+
var each = tinymce.each;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Table Grid class.
|
16
|
+
*/
|
17
|
+
function TableGrid(table, dom, selection) {
|
18
|
+
var grid, startPos, endPos, selectedCell;
|
19
|
+
|
20
|
+
buildGrid();
|
21
|
+
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
22
|
+
if (selectedCell) {
|
23
|
+
startPos = getPos(selectedCell);
|
24
|
+
endPos = findEndPos();
|
25
|
+
selectedCell = getCell(startPos.x, startPos.y);
|
26
|
+
}
|
27
|
+
|
28
|
+
function buildGrid() {
|
29
|
+
var startY = 0;
|
30
|
+
|
31
|
+
grid = [];
|
32
|
+
|
33
|
+
each(['thead', 'tbody', 'tfoot'], function(part) {
|
34
|
+
var rows = dom.select(part + ' tr', table);
|
35
|
+
|
36
|
+
each(rows, function(tr, y) {
|
37
|
+
y += startY;
|
38
|
+
|
39
|
+
each(dom.select('td,th', tr), function(td, x) {
|
40
|
+
var x2, y2, rowspan, colspan;
|
41
|
+
|
42
|
+
// Skip over existing cells produced by rowspan
|
43
|
+
if (grid[y]) {
|
44
|
+
while (grid[y][x])
|
45
|
+
x++;
|
46
|
+
}
|
47
|
+
|
48
|
+
// Get col/rowspan from cell
|
49
|
+
rowspan = getSpanVal(td, 'rowspan');
|
50
|
+
colspan = getSpanVal(td, 'colspan');
|
51
|
+
|
52
|
+
// Fill out rowspan/colspan right and down
|
53
|
+
for (y2 = y; y2 < y + rowspan; y2++) {
|
54
|
+
if (!grid[y2])
|
55
|
+
grid[y2] = [];
|
56
|
+
|
57
|
+
for (x2 = x; x2 < x + colspan; x2++) {
|
58
|
+
grid[y2][x2] = {
|
59
|
+
part : part,
|
60
|
+
real : y2 == y && x2 == x,
|
61
|
+
elm : td,
|
62
|
+
rowspan : rowspan,
|
63
|
+
colspan : colspan
|
64
|
+
};
|
65
|
+
}
|
66
|
+
}
|
67
|
+
});
|
68
|
+
});
|
69
|
+
|
70
|
+
startY += rows.length;
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
function getCell(x, y) {
|
75
|
+
var row;
|
76
|
+
|
77
|
+
row = grid[y];
|
78
|
+
if (row)
|
79
|
+
return row[x];
|
80
|
+
};
|
81
|
+
|
82
|
+
function getSpanVal(td, name) {
|
83
|
+
return parseInt(td.getAttribute(name) || 1);
|
84
|
+
};
|
85
|
+
|
86
|
+
function isCellSelected(cell) {
|
87
|
+
return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
|
88
|
+
};
|
89
|
+
|
90
|
+
function getSelectedRows() {
|
91
|
+
var rows = [];
|
92
|
+
|
93
|
+
each(table.rows, function(row) {
|
94
|
+
each(row.cells, function(cell) {
|
95
|
+
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
96
|
+
rows.push(row);
|
97
|
+
return false;
|
98
|
+
}
|
99
|
+
});
|
100
|
+
});
|
101
|
+
|
102
|
+
return rows;
|
103
|
+
};
|
104
|
+
|
105
|
+
function deleteTable() {
|
106
|
+
var rng = dom.createRng();
|
107
|
+
|
108
|
+
rng.setStartAfter(table);
|
109
|
+
rng.setEndAfter(table);
|
110
|
+
|
111
|
+
selection.setRng(rng);
|
112
|
+
|
113
|
+
dom.remove(table);
|
114
|
+
};
|
115
|
+
|
116
|
+
function cloneCell(cell) {
|
117
|
+
var formatNode;
|
118
|
+
|
119
|
+
// Clone formats
|
120
|
+
tinymce.walk(cell, function(node) {
|
121
|
+
var curNode;
|
122
|
+
|
123
|
+
if (node.nodeType == 3) {
|
124
|
+
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
125
|
+
node = node.cloneNode(false);
|
126
|
+
|
127
|
+
if (!formatNode)
|
128
|
+
formatNode = curNode = node;
|
129
|
+
else if (curNode)
|
130
|
+
curNode.appendChild(node);
|
131
|
+
|
132
|
+
curNode = node;
|
133
|
+
});
|
134
|
+
|
135
|
+
// Add something to the inner node
|
136
|
+
if (curNode)
|
137
|
+
curNode.innerHTML = tinymce.isIE ? ' ' : '<br _mce_bogus="1" />';
|
138
|
+
|
139
|
+
return false;
|
140
|
+
}
|
141
|
+
}, 'childNodes');
|
142
|
+
|
143
|
+
cell = cell.cloneNode(false);
|
144
|
+
cell.rowSpan = cell.colSpan = 1;
|
145
|
+
|
146
|
+
if (formatNode) {
|
147
|
+
cell.appendChild(formatNode);
|
148
|
+
} else {
|
149
|
+
if (!tinymce.isIE)
|
150
|
+
cell.innerHTML = '<br _mce_bogus="1" />';
|
151
|
+
}
|
152
|
+
|
153
|
+
return cell;
|
154
|
+
};
|
155
|
+
|
156
|
+
function cleanup() {
|
157
|
+
var rng = dom.createRng();
|
158
|
+
|
159
|
+
// Empty rows
|
160
|
+
each(dom.select('tr', table), function(tr) {
|
161
|
+
if (tr.cells.length == 0)
|
162
|
+
dom.remove(tr);
|
163
|
+
});
|
164
|
+
|
165
|
+
// Empty table
|
166
|
+
if (dom.select('tr', table).length == 0) {
|
167
|
+
rng.setStartAfter(table);
|
168
|
+
rng.setEndAfter(table);
|
169
|
+
selection.setRng(rng);
|
170
|
+
dom.remove(table);
|
171
|
+
return;
|
172
|
+
}
|
173
|
+
|
174
|
+
// Empty header/body/footer
|
175
|
+
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
176
|
+
if (part.rows.length == 0)
|
177
|
+
dom.remove(part);
|
178
|
+
});
|
179
|
+
|
180
|
+
// Restore selection to start position if it still exists
|
181
|
+
buildGrid();
|
182
|
+
|
183
|
+
// Restore the selection to the closest table position
|
184
|
+
row = grid[Math.min(grid.length - 1, startPos.y)];
|
185
|
+
if (row) {
|
186
|
+
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
187
|
+
selection.collapse(true);
|
188
|
+
}
|
189
|
+
};
|
190
|
+
|
191
|
+
function fillLeftDown(x, y, rows, cols) {
|
192
|
+
var tr, x2, r, c, cell;
|
193
|
+
|
194
|
+
tr = grid[y][x].elm.parentNode;
|
195
|
+
for (r = 1; r <= rows; r++) {
|
196
|
+
tr = dom.getNext(tr, 'tr');
|
197
|
+
|
198
|
+
if (tr) {
|
199
|
+
// Loop left to find real cell
|
200
|
+
for (x2 = x; x2 >= 0; x2--) {
|
201
|
+
cell = grid[y + r][x2].elm;
|
202
|
+
|
203
|
+
if (cell.parentNode == tr) {
|
204
|
+
// Append clones after
|
205
|
+
for (c = 1; c <= cols; c++)
|
206
|
+
dom.insertAfter(cloneCell(cell), cell);
|
207
|
+
|
208
|
+
break;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
if (x2 == -1) {
|
213
|
+
// Insert nodes before first cell
|
214
|
+
for (c = 1; c <= cols; c++)
|
215
|
+
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
};
|
220
|
+
|
221
|
+
function split() {
|
222
|
+
each(grid, function(row, y) {
|
223
|
+
each(row, function(cell, x) {
|
224
|
+
var colSpan, rowSpan, newCell, i;
|
225
|
+
|
226
|
+
if (isCellSelected(cell)) {
|
227
|
+
cell = cell.elm;
|
228
|
+
colSpan = getSpanVal(cell, 'colspan');
|
229
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
230
|
+
|
231
|
+
if (colSpan > 1 || rowSpan > 1) {
|
232
|
+
cell.colSpan = cell.rowSpan = 1;
|
233
|
+
|
234
|
+
// Insert cells right
|
235
|
+
for (i = 0; i < colSpan - 1; i++)
|
236
|
+
dom.insertAfter(cloneCell(cell), cell);
|
237
|
+
|
238
|
+
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
239
|
+
}
|
240
|
+
}
|
241
|
+
});
|
242
|
+
});
|
243
|
+
};
|
244
|
+
|
245
|
+
function merge(cell, cols, rows) {
|
246
|
+
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
|
247
|
+
|
248
|
+
// Use specified cell and cols/rows
|
249
|
+
if (cell) {
|
250
|
+
pos = getPos(cell);
|
251
|
+
startX = pos.x;
|
252
|
+
startY = pos.y;
|
253
|
+
endX = startX + (cols - 1);
|
254
|
+
endY = startY + (rows - 1);
|
255
|
+
} else {
|
256
|
+
// Use selection
|
257
|
+
startX = startPos.x;
|
258
|
+
startY = startPos.y;
|
259
|
+
endX = endPos.x;
|
260
|
+
endY = endPos.y;
|
261
|
+
}
|
262
|
+
|
263
|
+
// Find start/end cells
|
264
|
+
startCell = getCell(startX, startY);
|
265
|
+
endCell = getCell(endX, endY);
|
266
|
+
|
267
|
+
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
268
|
+
if (startCell && endCell && startCell.part == endCell.part) {
|
269
|
+
// Split and rebuild grid
|
270
|
+
split();
|
271
|
+
buildGrid();
|
272
|
+
|
273
|
+
// Set row/col span to start cell
|
274
|
+
startCell = getCell(startX, startY).elm;
|
275
|
+
startCell.colSpan = (endX - startX) + 1;
|
276
|
+
startCell.rowSpan = (endY - startY) + 1;
|
277
|
+
|
278
|
+
// Remove other cells and add it's contents to the start cell
|
279
|
+
for (y = startY; y <= endY; y++) {
|
280
|
+
for (x = startX; x <= endX; x++) {
|
281
|
+
cell = grid[y][x].elm;
|
282
|
+
|
283
|
+
if (cell != startCell) {
|
284
|
+
// Move children to startCell
|
285
|
+
children = tinymce.grep(cell.childNodes);
|
286
|
+
each(children, function(node, i) {
|
287
|
+
// Jump over last BR element
|
288
|
+
if (node.nodeName != 'BR' || i != children.length - 1)
|
289
|
+
startCell.appendChild(node);
|
290
|
+
});
|
291
|
+
|
292
|
+
// Remove cell
|
293
|
+
dom.remove(cell);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
|
298
|
+
// Remove empty rows etc and restore caret location
|
299
|
+
cleanup();
|
300
|
+
}
|
301
|
+
};
|
302
|
+
|
303
|
+
function insertRow(before) {
|
304
|
+
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
|
305
|
+
|
306
|
+
// Find first/last row
|
307
|
+
each(grid, function(row, y) {
|
308
|
+
each(row, function(cell, x) {
|
309
|
+
if (isCellSelected(cell)) {
|
310
|
+
cell = cell.elm;
|
311
|
+
rowElm = cell.parentNode;
|
312
|
+
newRow = rowElm.cloneNode(false);
|
313
|
+
posY = y;
|
314
|
+
|
315
|
+
if (before)
|
316
|
+
return false;
|
317
|
+
}
|
318
|
+
});
|
319
|
+
|
320
|
+
if (before)
|
321
|
+
return !posY;
|
322
|
+
});
|
323
|
+
|
324
|
+
for (x = 0; x < grid[0].length; x++) {
|
325
|
+
cell = grid[posY][x].elm;
|
326
|
+
|
327
|
+
if (cell != lastCell) {
|
328
|
+
if (!before) {
|
329
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
330
|
+
if (rowSpan > 1) {
|
331
|
+
cell.rowSpan = rowSpan + 1;
|
332
|
+
continue;
|
333
|
+
}
|
334
|
+
} else {
|
335
|
+
// Check if cell above can be expanded
|
336
|
+
if (posY > 0 && grid[posY - 1][x]) {
|
337
|
+
otherCell = grid[posY - 1][x].elm;
|
338
|
+
rowSpan = getSpanVal(otherCell, 'rowspan');
|
339
|
+
if (rowSpan > 1) {
|
340
|
+
otherCell.rowSpan = rowSpan + 1;
|
341
|
+
continue;
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
|
346
|
+
// Insert new cell into new row
|
347
|
+
newCell = cloneCell(cell)
|
348
|
+
newCell.colSpan = cell.colSpan;
|
349
|
+
newRow.appendChild(newCell);
|
350
|
+
|
351
|
+
lastCell = cell;
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
if (newRow.hasChildNodes()) {
|
356
|
+
if (!before)
|
357
|
+
dom.insertAfter(newRow, rowElm);
|
358
|
+
else
|
359
|
+
rowElm.parentNode.insertBefore(newRow, rowElm);
|
360
|
+
}
|
361
|
+
};
|
362
|
+
|
363
|
+
function insertCol(before) {
|
364
|
+
var posX, lastCell;
|
365
|
+
|
366
|
+
// Find first/last column
|
367
|
+
each(grid, function(row, y) {
|
368
|
+
each(row, function(cell, x) {
|
369
|
+
if (isCellSelected(cell)) {
|
370
|
+
posX = x;
|
371
|
+
|
372
|
+
if (before)
|
373
|
+
return false;
|
374
|
+
}
|
375
|
+
});
|
376
|
+
|
377
|
+
if (before)
|
378
|
+
return !posX;
|
379
|
+
});
|
380
|
+
|
381
|
+
each(grid, function(row, y) {
|
382
|
+
var cell = row[posX].elm, rowSpan, colSpan;
|
383
|
+
|
384
|
+
if (cell != lastCell) {
|
385
|
+
colSpan = getSpanVal(cell, 'colspan');
|
386
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
387
|
+
|
388
|
+
if (colSpan == 1) {
|
389
|
+
if (!before) {
|
390
|
+
dom.insertAfter(cloneCell(cell), cell);
|
391
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
392
|
+
} else {
|
393
|
+
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
394
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
395
|
+
}
|
396
|
+
} else
|
397
|
+
cell.colSpan++;
|
398
|
+
|
399
|
+
lastCell = cell;
|
400
|
+
}
|
401
|
+
});
|
402
|
+
};
|
403
|
+
|
404
|
+
function deleteCols() {
|
405
|
+
var cols = [];
|
406
|
+
|
407
|
+
// Get selected column indexes
|
408
|
+
each(grid, function(row, y) {
|
409
|
+
each(row, function(cell, x) {
|
410
|
+
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
411
|
+
each(grid, function(row) {
|
412
|
+
var cell = row[x].elm, colSpan;
|
413
|
+
|
414
|
+
colSpan = getSpanVal(cell, 'colspan');
|
415
|
+
|
416
|
+
if (colSpan > 1)
|
417
|
+
cell.colSpan = colSpan - 1;
|
418
|
+
else
|
419
|
+
dom.remove(cell);
|
420
|
+
});
|
421
|
+
|
422
|
+
cols.push(x);
|
423
|
+
}
|
424
|
+
});
|
425
|
+
});
|
426
|
+
|
427
|
+
cleanup();
|
428
|
+
};
|
429
|
+
|
430
|
+
function deleteRows() {
|
431
|
+
var rows;
|
432
|
+
|
433
|
+
function deleteRow(tr) {
|
434
|
+
var nextTr, pos, lastCell;
|
435
|
+
|
436
|
+
nextTr = dom.getNext(tr, 'tr');
|
437
|
+
|
438
|
+
// Move down row spanned cells
|
439
|
+
each(tr.cells, function(cell) {
|
440
|
+
var rowSpan = getSpanVal(cell, 'rowspan');
|
441
|
+
|
442
|
+
if (rowSpan > 1) {
|
443
|
+
cell.rowSpan = rowSpan - 1;
|
444
|
+
pos = getPos(cell);
|
445
|
+
fillLeftDown(pos.x, pos.y, 1, 1);
|
446
|
+
}
|
447
|
+
});
|
448
|
+
|
449
|
+
// Delete cells
|
450
|
+
pos = getPos(tr.cells[0]);
|
451
|
+
each(grid[pos.y], function(cell) {
|
452
|
+
var rowSpan;
|
453
|
+
|
454
|
+
cell = cell.elm;
|
455
|
+
|
456
|
+
if (cell != lastCell) {
|
457
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
458
|
+
|
459
|
+
if (rowSpan <= 1)
|
460
|
+
dom.remove(cell);
|
461
|
+
else
|
462
|
+
cell.rowSpan = rowSpan - 1;
|
463
|
+
|
464
|
+
lastCell = cell;
|
465
|
+
}
|
466
|
+
});
|
467
|
+
};
|
468
|
+
|
469
|
+
// Get selected rows and move selection out of scope
|
470
|
+
rows = getSelectedRows();
|
471
|
+
|
472
|
+
// Delete all selected rows
|
473
|
+
each(rows.reverse(), function(tr) {
|
474
|
+
deleteRow(tr);
|
475
|
+
});
|
476
|
+
|
477
|
+
cleanup();
|
478
|
+
};
|
479
|
+
|
480
|
+
function cutRows() {
|
481
|
+
var rows = getSelectedRows();
|
482
|
+
|
483
|
+
dom.remove(rows);
|
484
|
+
cleanup();
|
485
|
+
|
486
|
+
return rows;
|
487
|
+
};
|
488
|
+
|
489
|
+
function copyRows() {
|
490
|
+
var rows = getSelectedRows();
|
491
|
+
|
492
|
+
each(rows, function(row, i) {
|
493
|
+
rows[i] = row.cloneNode(true);
|
494
|
+
});
|
495
|
+
|
496
|
+
return rows;
|
497
|
+
};
|
498
|
+
|
499
|
+
function pasteRows(rows, before) {
|
500
|
+
var selectedRows = getSelectedRows(),
|
501
|
+
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
502
|
+
targetCellCount = targetRow.cells.length;
|
503
|
+
|
504
|
+
// Calc target cell count
|
505
|
+
each(grid, function(row) {
|
506
|
+
var match;
|
507
|
+
|
508
|
+
targetCellCount = 0;
|
509
|
+
each(row, function(cell, x) {
|
510
|
+
if (cell.real)
|
511
|
+
targetCellCount += cell.colspan;
|
512
|
+
|
513
|
+
if (cell.elm.parentNode == targetRow)
|
514
|
+
match = 1;
|
515
|
+
});
|
516
|
+
|
517
|
+
if (match)
|
518
|
+
return false;
|
519
|
+
});
|
520
|
+
|
521
|
+
if (!before)
|
522
|
+
rows.reverse();
|
523
|
+
|
524
|
+
each(rows, function(row) {
|
525
|
+
var cellCount = row.cells.length, cell;
|
526
|
+
|
527
|
+
// Remove col/rowspans
|
528
|
+
for (i = 0; i < cellCount; i++) {
|
529
|
+
cell = row.cells[i];
|
530
|
+
cell.colSpan = cell.rowSpan = 1;
|
531
|
+
}
|
532
|
+
|
533
|
+
// Needs more cells
|
534
|
+
for (i = cellCount; i < targetCellCount; i++)
|
535
|
+
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
536
|
+
|
537
|
+
// Needs less cells
|
538
|
+
for (i = targetCellCount; i < cellCount; i++)
|
539
|
+
dom.remove(row.cells[i]);
|
540
|
+
|
541
|
+
// Add before/after
|
542
|
+
if (before)
|
543
|
+
targetRow.parentNode.insertBefore(row, targetRow);
|
544
|
+
else
|
545
|
+
dom.insertAfter(row, targetRow);
|
546
|
+
});
|
547
|
+
};
|
548
|
+
|
549
|
+
function getPos(target) {
|
550
|
+
var pos;
|
551
|
+
|
552
|
+
each(grid, function(row, y) {
|
553
|
+
each(row, function(cell, x) {
|
554
|
+
if (cell.elm == target) {
|
555
|
+
pos = {x : x, y : y};
|
556
|
+
return false;
|
557
|
+
}
|
558
|
+
});
|
559
|
+
|
560
|
+
return !pos;
|
561
|
+
});
|
562
|
+
|
563
|
+
return pos;
|
564
|
+
};
|
565
|
+
|
566
|
+
function setStartCell(cell) {
|
567
|
+
startPos = getPos(cell);
|
568
|
+
};
|
569
|
+
|
570
|
+
function findEndPos() {
|
571
|
+
var pos, maxX, maxY;
|
572
|
+
|
573
|
+
maxX = maxY = 0;
|
574
|
+
|
575
|
+
each(grid, function(row, y) {
|
576
|
+
each(row, function(cell, x) {
|
577
|
+
var colSpan, rowSpan;
|
578
|
+
|
579
|
+
if (isCellSelected(cell)) {
|
580
|
+
cell = grid[y][x];
|
581
|
+
|
582
|
+
if (x > maxX)
|
583
|
+
maxX = x;
|
584
|
+
|
585
|
+
if (y > maxY)
|
586
|
+
maxY = y;
|
587
|
+
|
588
|
+
if (cell.real) {
|
589
|
+
colSpan = cell.colspan - 1;
|
590
|
+
rowSpan = cell.rowspan - 1;
|
591
|
+
|
592
|
+
if (colSpan) {
|
593
|
+
if (x + colSpan > maxX)
|
594
|
+
maxX = x + colSpan;
|
595
|
+
}
|
596
|
+
|
597
|
+
if (rowSpan) {
|
598
|
+
if (y + rowSpan > maxY)
|
599
|
+
maxY = y + rowSpan;
|
600
|
+
}
|
601
|
+
}
|
602
|
+
}
|
603
|
+
});
|
604
|
+
});
|
605
|
+
|
606
|
+
return {x : maxX, y : maxY};
|
607
|
+
};
|
608
|
+
|
609
|
+
function setEndCell(cell) {
|
610
|
+
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
611
|
+
|
612
|
+
endPos = getPos(cell);
|
613
|
+
|
614
|
+
if (startPos && endPos) {
|
615
|
+
// Get start/end positions
|
616
|
+
startX = Math.min(startPos.x, endPos.x);
|
617
|
+
startY = Math.min(startPos.y, endPos.y);
|
618
|
+
endX = Math.max(startPos.x, endPos.x);
|
619
|
+
endY = Math.max(startPos.y, endPos.y);
|
620
|
+
|
621
|
+
// Expand end positon to include spans
|
622
|
+
maxX = endX;
|
623
|
+
maxY = endY;
|
624
|
+
|
625
|
+
// Expand startX
|
626
|
+
for (y = startY; y <= maxY; y++) {
|
627
|
+
cell = grid[y][startX];
|
628
|
+
|
629
|
+
if (!cell.real) {
|
630
|
+
if (startX - (cell.colspan - 1) < startX)
|
631
|
+
startX -= cell.colspan - 1;
|
632
|
+
}
|
633
|
+
}
|
634
|
+
|
635
|
+
// Expand startY
|
636
|
+
for (x = startX; x <= maxX; x++) {
|
637
|
+
cell = grid[startY][x];
|
638
|
+
|
639
|
+
if (!cell.real) {
|
640
|
+
if (startY - (cell.rowspan - 1) < startY)
|
641
|
+
startY -= cell.rowspan - 1;
|
642
|
+
}
|
643
|
+
}
|
644
|
+
|
645
|
+
// Find max X, Y
|
646
|
+
for (y = startY; y <= endY; y++) {
|
647
|
+
for (x = startX; x <= endX; x++) {
|
648
|
+
cell = grid[y][x];
|
649
|
+
|
650
|
+
if (cell.real) {
|
651
|
+
colSpan = cell.colspan - 1;
|
652
|
+
rowSpan = cell.rowspan - 1;
|
653
|
+
|
654
|
+
if (colSpan) {
|
655
|
+
if (x + colSpan > maxX)
|
656
|
+
maxX = x + colSpan;
|
657
|
+
}
|
658
|
+
|
659
|
+
if (rowSpan) {
|
660
|
+
if (y + rowSpan > maxY)
|
661
|
+
maxY = y + rowSpan;
|
662
|
+
}
|
663
|
+
}
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
// Remove current selection
|
668
|
+
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
669
|
+
|
670
|
+
// Add new selection
|
671
|
+
for (y = startY; y <= maxY; y++) {
|
672
|
+
for (x = startX; x <= maxX; x++)
|
673
|
+
dom.addClass(grid[y][x].elm, 'mceSelected');
|
674
|
+
}
|
675
|
+
}
|
676
|
+
};
|
677
|
+
|
678
|
+
// Expose to public
|
679
|
+
tinymce.extend(this, {
|
680
|
+
deleteTable : deleteTable,
|
681
|
+
split : split,
|
682
|
+
merge : merge,
|
683
|
+
insertRow : insertRow,
|
684
|
+
insertCol : insertCol,
|
685
|
+
deleteCols : deleteCols,
|
686
|
+
deleteRows : deleteRows,
|
687
|
+
cutRows : cutRows,
|
688
|
+
copyRows : copyRows,
|
689
|
+
pasteRows : pasteRows,
|
690
|
+
getPos : getPos,
|
691
|
+
setStartCell : setStartCell,
|
692
|
+
setEndCell : setEndCell
|
693
|
+
});
|
694
|
+
};
|
695
|
+
|
696
|
+
tinymce.create('tinymce.plugins.TablePlugin', {
|
697
|
+
init : function(ed, url) {
|
698
|
+
var winMan, clipboardRows;
|
699
|
+
|
700
|
+
function createTableGrid(node) {
|
701
|
+
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
702
|
+
|
703
|
+
if (tblElm)
|
704
|
+
return new TableGrid(tblElm, ed.dom, selection);
|
705
|
+
};
|
706
|
+
|
707
|
+
function cleanup() {
|
708
|
+
// Restore selection possibilities
|
709
|
+
ed.getBody().style.webkitUserSelect = '';
|
710
|
+
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
711
|
+
};
|
712
|
+
|
713
|
+
// Register buttons
|
714
|
+
each([
|
715
|
+
['table', 'table.desc', 'mceInsertTable', true],
|
716
|
+
['delete_table', 'table.del', 'mceTableDelete'],
|
717
|
+
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
718
|
+
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
719
|
+
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
720
|
+
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
721
|
+
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
722
|
+
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
723
|
+
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
724
|
+
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
725
|
+
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
726
|
+
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
727
|
+
], function(c) {
|
728
|
+
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
729
|
+
});
|
730
|
+
|
731
|
+
// Select whole table is a table border is clicked
|
732
|
+
if (!tinymce.isIE) {
|
733
|
+
ed.onClick.add(function(ed, e) {
|
734
|
+
e = e.target;
|
735
|
+
|
736
|
+
if (e.nodeName === 'TABLE')
|
737
|
+
ed.selection.select(e);
|
738
|
+
});
|
739
|
+
}
|
740
|
+
|
741
|
+
// Handle node change updates
|
742
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
743
|
+
var p;
|
744
|
+
|
745
|
+
n = ed.selection.getStart();
|
746
|
+
p = ed.dom.getParent(n, 'td,th,caption');
|
747
|
+
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
748
|
+
|
749
|
+
// Disable table tools if we are in caption
|
750
|
+
if (p && p.nodeName === 'CAPTION')
|
751
|
+
p = 0;
|
752
|
+
|
753
|
+
cm.setDisabled('delete_table', !p);
|
754
|
+
cm.setDisabled('delete_col', !p);
|
755
|
+
cm.setDisabled('delete_table', !p);
|
756
|
+
cm.setDisabled('delete_row', !p);
|
757
|
+
cm.setDisabled('col_after', !p);
|
758
|
+
cm.setDisabled('col_before', !p);
|
759
|
+
cm.setDisabled('row_after', !p);
|
760
|
+
cm.setDisabled('row_before', !p);
|
761
|
+
cm.setDisabled('row_props', !p);
|
762
|
+
cm.setDisabled('cell_props', !p);
|
763
|
+
cm.setDisabled('split_cells', !p);
|
764
|
+
cm.setDisabled('merge_cells', !p);
|
765
|
+
});
|
766
|
+
|
767
|
+
ed.onInit.add(function(ed) {
|
768
|
+
var startTable, startCell, dom = ed.dom, tableGrid;
|
769
|
+
|
770
|
+
winMan = ed.windowManager;
|
771
|
+
|
772
|
+
// Add cell selection logic
|
773
|
+
ed.onMouseDown.add(function(ed, e) {
|
774
|
+
if (e.button != 2) {
|
775
|
+
cleanup();
|
776
|
+
|
777
|
+
startCell = dom.getParent(e.target, 'td,th');
|
778
|
+
startTable = dom.getParent(startCell, 'table');
|
779
|
+
}
|
780
|
+
});
|
781
|
+
|
782
|
+
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
783
|
+
var sel, table, target = e.target;
|
784
|
+
|
785
|
+
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
786
|
+
table = dom.getParent(target, 'table');
|
787
|
+
if (table == startTable) {
|
788
|
+
if (!tableGrid) {
|
789
|
+
tableGrid = createTableGrid(table);
|
790
|
+
tableGrid.setStartCell(startCell);
|
791
|
+
|
792
|
+
ed.getBody().style.webkitUserSelect = 'none';
|
793
|
+
}
|
794
|
+
|
795
|
+
tableGrid.setEndCell(target);
|
796
|
+
}
|
797
|
+
|
798
|
+
// Remove current selection
|
799
|
+
sel = ed.selection.getSel();
|
800
|
+
|
801
|
+
if (sel.removeAllRanges)
|
802
|
+
sel.removeAllRanges();
|
803
|
+
else
|
804
|
+
sel.empty();
|
805
|
+
|
806
|
+
e.preventDefault();
|
807
|
+
}
|
808
|
+
});
|
809
|
+
|
810
|
+
ed.onMouseUp.add(function(ed, e) {
|
811
|
+
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
812
|
+
|
813
|
+
// Move selection to startCell
|
814
|
+
if (startCell) {
|
815
|
+
if (tableGrid)
|
816
|
+
ed.getBody().style.webkitUserSelect = '';
|
817
|
+
|
818
|
+
function setPoint(node, start) {
|
819
|
+
var walker = new tinymce.dom.TreeWalker(node, node);
|
820
|
+
|
821
|
+
do {
|
822
|
+
// Text node
|
823
|
+
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
824
|
+
if (start)
|
825
|
+
rng.setStart(node, 0);
|
826
|
+
else
|
827
|
+
rng.setEnd(node, node.nodeValue.length);
|
828
|
+
|
829
|
+
return;
|
830
|
+
}
|
831
|
+
|
832
|
+
// BR element
|
833
|
+
if (node.nodeName == 'BR') {
|
834
|
+
if (start)
|
835
|
+
rng.setStartBefore(node);
|
836
|
+
else
|
837
|
+
rng.setEndBefore(node);
|
838
|
+
|
839
|
+
return;
|
840
|
+
}
|
841
|
+
} while (node = (start ? walker.next() : walker.prev()));
|
842
|
+
};
|
843
|
+
|
844
|
+
// Try to expand text selection as much as we can only Gecko supports cell selection
|
845
|
+
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
846
|
+
if (selectedCells.length > 0) {
|
847
|
+
rng = dom.createRng();
|
848
|
+
node = selectedCells[0];
|
849
|
+
endNode = selectedCells[selectedCells.length - 1];
|
850
|
+
|
851
|
+
setPoint(node, 1);
|
852
|
+
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
853
|
+
|
854
|
+
do {
|
855
|
+
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
856
|
+
if (!dom.hasClass(node, 'mceSelected'))
|
857
|
+
break;
|
858
|
+
|
859
|
+
lastNode = node;
|
860
|
+
}
|
861
|
+
} while (node = walker.next());
|
862
|
+
|
863
|
+
setPoint(lastNode);
|
864
|
+
|
865
|
+
sel.setRng(rng);
|
866
|
+
}
|
867
|
+
|
868
|
+
ed.nodeChanged();
|
869
|
+
startCell = tableGrid = startTable = null;
|
870
|
+
}
|
871
|
+
});
|
872
|
+
|
873
|
+
ed.onKeyUp.add(function(ed, e) {
|
874
|
+
cleanup();
|
875
|
+
});
|
876
|
+
|
877
|
+
// Add context menu
|
878
|
+
if (ed && ed.plugins.contextmenu) {
|
879
|
+
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
880
|
+
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
881
|
+
|
882
|
+
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
|
883
|
+
m.removeAll();
|
884
|
+
|
885
|
+
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
886
|
+
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
887
|
+
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
888
|
+
m.addSeparator();
|
889
|
+
}
|
890
|
+
|
891
|
+
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
892
|
+
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
893
|
+
m.addSeparator();
|
894
|
+
}
|
895
|
+
|
896
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
897
|
+
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
898
|
+
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
899
|
+
m.addSeparator();
|
900
|
+
|
901
|
+
// Cell menu
|
902
|
+
sm = m.addMenu({title : 'table.cell'});
|
903
|
+
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
904
|
+
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
905
|
+
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
906
|
+
|
907
|
+
// Row menu
|
908
|
+
sm = m.addMenu({title : 'table.row'});
|
909
|
+
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
910
|
+
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
911
|
+
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
912
|
+
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
913
|
+
sm.addSeparator();
|
914
|
+
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
915
|
+
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
916
|
+
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
917
|
+
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
918
|
+
|
919
|
+
// Column menu
|
920
|
+
sm = m.addMenu({title : 'table.col'});
|
921
|
+
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
922
|
+
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
923
|
+
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
924
|
+
} else
|
925
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
926
|
+
});
|
927
|
+
}
|
928
|
+
|
929
|
+
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
930
|
+
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
931
|
+
if (!tinymce.isIE) {
|
932
|
+
function fixTableCaretPos() {
|
933
|
+
var last;
|
934
|
+
|
935
|
+
// Skip empty text nodes form the end
|
936
|
+
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
937
|
+
|
938
|
+
if (last && last.nodeName == 'TABLE')
|
939
|
+
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
940
|
+
};
|
941
|
+
|
942
|
+
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
943
|
+
// this fix solves it by detecting when the caret is at the beginning of such a table
|
944
|
+
// and then manually moves the caret infront of the table
|
945
|
+
if (tinymce.isGecko) {
|
946
|
+
ed.onKeyDown.add(function(ed, e) {
|
947
|
+
var rng, table, dom = ed.dom;
|
948
|
+
|
949
|
+
// On gecko it's not possible to place the caret before a table
|
950
|
+
if (e.keyCode == 37 || e.keyCode == 38) {
|
951
|
+
rng = ed.selection.getRng();
|
952
|
+
table = dom.getParent(rng.startContainer, 'table');
|
953
|
+
|
954
|
+
if (table && ed.getBody().firstChild == table) {
|
955
|
+
if (isAtStart(rng, table)) {
|
956
|
+
rng = dom.createRng();
|
957
|
+
|
958
|
+
rng.setStartBefore(table);
|
959
|
+
rng.setEndBefore(table);
|
960
|
+
|
961
|
+
ed.selection.setRng(rng);
|
962
|
+
|
963
|
+
e.preventDefault();
|
964
|
+
}
|
965
|
+
}
|
966
|
+
}
|
967
|
+
});
|
968
|
+
}
|
969
|
+
|
970
|
+
ed.onKeyUp.add(fixTableCaretPos);
|
971
|
+
ed.onSetContent.add(fixTableCaretPos);
|
972
|
+
ed.onVisualAid.add(fixTableCaretPos);
|
973
|
+
|
974
|
+
ed.onPreProcess.add(function(ed, o) {
|
975
|
+
var last = o.node.lastChild;
|
976
|
+
|
977
|
+
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
978
|
+
ed.dom.remove(last);
|
979
|
+
});
|
980
|
+
|
981
|
+
fixTableCaretPos();
|
982
|
+
}
|
983
|
+
});
|
984
|
+
|
985
|
+
// Register action commands
|
986
|
+
each({
|
987
|
+
mceTableSplitCells : function(grid) {
|
988
|
+
grid.split();
|
989
|
+
},
|
990
|
+
|
991
|
+
mceTableMergeCells : function(grid) {
|
992
|
+
var rowSpan, colSpan, cell;
|
993
|
+
|
994
|
+
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
995
|
+
if (cell) {
|
996
|
+
rowSpan = cell.rowSpan;
|
997
|
+
colSpan = cell.colSpan;
|
998
|
+
}
|
999
|
+
|
1000
|
+
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1001
|
+
winMan.open({
|
1002
|
+
url : url + '/merge_cells.htm',
|
1003
|
+
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
1004
|
+
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
1005
|
+
inline : 1
|
1006
|
+
}, {
|
1007
|
+
rows : rowSpan,
|
1008
|
+
cols : colSpan,
|
1009
|
+
onaction : function(data) {
|
1010
|
+
grid.merge(cell, data.cols, data.rows);
|
1011
|
+
},
|
1012
|
+
plugin_url : url
|
1013
|
+
});
|
1014
|
+
} else
|
1015
|
+
grid.merge();
|
1016
|
+
},
|
1017
|
+
|
1018
|
+
mceTableInsertRowBefore : function(grid) {
|
1019
|
+
grid.insertRow(true);
|
1020
|
+
},
|
1021
|
+
|
1022
|
+
mceTableInsertRowAfter : function(grid) {
|
1023
|
+
grid.insertRow();
|
1024
|
+
},
|
1025
|
+
|
1026
|
+
mceTableInsertColBefore : function(grid) {
|
1027
|
+
grid.insertCol(true);
|
1028
|
+
},
|
1029
|
+
|
1030
|
+
mceTableInsertColAfter : function(grid) {
|
1031
|
+
grid.insertCol();
|
1032
|
+
},
|
1033
|
+
|
1034
|
+
mceTableDeleteCol : function(grid) {
|
1035
|
+
grid.deleteCols();
|
1036
|
+
},
|
1037
|
+
|
1038
|
+
mceTableDeleteRow : function(grid) {
|
1039
|
+
grid.deleteRows();
|
1040
|
+
},
|
1041
|
+
|
1042
|
+
mceTableCutRow : function(grid) {
|
1043
|
+
clipboardRows = grid.cutRows();
|
1044
|
+
},
|
1045
|
+
|
1046
|
+
mceTableCopyRow : function(grid) {
|
1047
|
+
clipboardRows = grid.copyRows();
|
1048
|
+
},
|
1049
|
+
|
1050
|
+
mceTablePasteRowBefore : function(grid) {
|
1051
|
+
grid.pasteRows(clipboardRows, true);
|
1052
|
+
},
|
1053
|
+
|
1054
|
+
mceTablePasteRowAfter : function(grid) {
|
1055
|
+
grid.pasteRows(clipboardRows);
|
1056
|
+
},
|
1057
|
+
|
1058
|
+
mceTableDelete : function(grid) {
|
1059
|
+
grid.deleteTable();
|
1060
|
+
}
|
1061
|
+
}, function(func, name) {
|
1062
|
+
ed.addCommand(name, function() {
|
1063
|
+
var grid = createTableGrid();
|
1064
|
+
|
1065
|
+
if (grid) {
|
1066
|
+
func(grid);
|
1067
|
+
ed.execCommand('mceRepaint');
|
1068
|
+
cleanup();
|
1069
|
+
}
|
1070
|
+
});
|
1071
|
+
});
|
1072
|
+
|
1073
|
+
// Register dialog commands
|
1074
|
+
each({
|
1075
|
+
mceInsertTable : function(val) {
|
1076
|
+
winMan.open({
|
1077
|
+
url : url + '/table.htm',
|
1078
|
+
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
1079
|
+
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
1080
|
+
inline : 1
|
1081
|
+
}, {
|
1082
|
+
plugin_url : url,
|
1083
|
+
action : val ? val.action : 0
|
1084
|
+
});
|
1085
|
+
},
|
1086
|
+
|
1087
|
+
mceTableRowProps : function() {
|
1088
|
+
winMan.open({
|
1089
|
+
url : url + '/row.htm',
|
1090
|
+
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
1091
|
+
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
1092
|
+
inline : 1
|
1093
|
+
}, {
|
1094
|
+
plugin_url : url
|
1095
|
+
});
|
1096
|
+
},
|
1097
|
+
|
1098
|
+
mceTableCellProps : function() {
|
1099
|
+
winMan.open({
|
1100
|
+
url : url + '/cell.htm',
|
1101
|
+
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
1102
|
+
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
1103
|
+
inline : 1
|
1104
|
+
}, {
|
1105
|
+
plugin_url : url
|
1106
|
+
});
|
1107
|
+
}
|
1108
|
+
}, function(func, name) {
|
1109
|
+
ed.addCommand(name, function(ui, val) {
|
1110
|
+
func(val);
|
1111
|
+
});
|
1112
|
+
});
|
1113
|
+
}
|
1114
|
+
});
|
1115
|
+
|
1116
|
+
// Register plugin
|
1117
|
+
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
1118
|
+
})(tinymce);
|