cable 0.1.0 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/cable_settings_controller.rb +20 -0
- data/app/controllers/{cable/admin_controller.rb → admin_controller.rb} +1 -2
- data/app/controllers/attachable_assets_controller.rb +81 -0
- data/app/controllers/attachable_documents_controller.rb +22 -0
- data/app/controllers/attachable_images_controller.rb +22 -0
- data/app/controllers/cable/cable_admin_controller.rb +8 -0
- data/app/helpers/admin/menus_helper.rb +24 -0
- data/app/helpers/admin_helper.rb +2 -2
- data/app/models/attachable_asset.rb +11 -0
- data/app/models/attachable_document.rb +2 -0
- data/app/models/attachable_image.rb +5 -0
- data/app/views/admin/_admin_user_login.html.erb +5 -0
- data/app/views/admin/cable_settings/_cable_setting.html.erb +4 -0
- data/app/views/admin/cable_settings/edit.html.erb +1 -0
- data/app/views/admin/cable_settings/index.html.erb +47 -0
- data/app/views/admin/index.html.erb +10 -0
- data/app/views/attachable_assets/index.html.erb +4 -0
- data/app/views/attachable_assets/new.html.erb +7 -0
- data/app/views/attachable_assets/show.html.erb +2 -0
- data/app/views/{cable/layouts → layouts}/_messages.html.erb +0 -0
- data/app/views/layouts/admin.html.erb +56 -0
- data/config/admin_navigation.rb +18 -0
- data/config/navigation.rb +0 -0
- data/config/routes.rb +5 -1
- data/lib/cable.rb +88 -1
- data/lib/cable/acts_as_cable.rb +36 -0
- data/lib/cable/base.rb +19 -0
- data/lib/cable/block.rb +46 -0
- data/lib/cable/capistrano.rb +12 -0
- data/lib/cable/controllers/cable_controller_helpers.rb +27 -0
- data/lib/cable/engine.rb +6 -1
- data/lib/cable/errors/resource_association_error.rb +4 -0
- data/lib/cable/media/acts_as_attachable.rb +44 -0
- data/lib/cable/media/asset.rb +3 -0
- data/lib/cable/menu.rb +3 -0
- data/lib/cable/menu/acts_as_cable_menu.rb +46 -0
- data/lib/cable/menu/base.rb +166 -0
- data/lib/cable/menu/simple_navigation_methods.rb +24 -0
- data/lib/cable/menu/url_helper.rb +17 -0
- data/lib/cable/orm/active_record.rb +29 -0
- data/lib/cable/page.rb +3 -0
- data/lib/cable/rails/routes.rb +49 -0
- data/lib/cable/railtie.rb +32 -0
- data/lib/cable/schema.rb +52 -0
- data/lib/cable/setting.rb +3 -0
- data/lib/cable/special_action.rb +19 -0
- data/lib/generators/cable/install_generator.rb +61 -21
- data/lib/generators/cable/media/media_generator.rb +41 -0
- data/lib/generators/cable/media/templates/migration.rb +19 -0
- data/lib/generators/cable/media/templates/model.rb +3 -0
- data/lib/generators/cable/menu/menu_generator.rb +83 -0
- data/lib/generators/cable/menu/templates/controller.rb +118 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu.html.erb +31 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_children_table.html.erb +60 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_tree.html.erb +10 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu_vitals.html.erb +30 -0
- data/lib/generators/cable/menu/templates/erb/menus/_resource.html.erb +29 -0
- data/lib/generators/cable/menu/templates/erb/menus/_resource_fields.html.erb +10 -0
- data/lib/generators/cable/menu/templates/erb/menus/_tree.html.erb +16 -0
- data/lib/generators/cable/menu/templates/erb/menus/edit.html.erb +1 -0
- data/lib/generators/cable/menu/templates/erb/menus/index.html.erb +28 -0
- data/lib/generators/cable/menu/templates/erb/menus/move.html.erb +41 -0
- data/lib/generators/cable/menu/templates/erb/menus/new.html.erb +1 -0
- data/lib/generators/cable/menu/templates/erb/menus/show.html.erb +16 -0
- data/lib/generators/cable/menu/templates/erb/menus/table.html.erb +9 -0
- data/lib/generators/cable/menu/templates/erb/partials/_menu_fields.html.erb +12 -0
- data/lib/generators/cable/menu/templates/migration.rb +24 -0
- data/lib/generators/cable/menu/templates/model.rb +4 -0
- data/lib/generators/cable/orm_helpers.rb +18 -0
- data/lib/generators/cable/override_generator.rb +33 -0
- data/lib/generators/cable/resource/resource_generator.rb +70 -0
- data/lib/generators/cable/resource/templates/controller.rb +52 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/_form.html.erb +30 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/edit.html.erb +6 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/index.html.erb +54 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/new.html.erb +5 -0
- data/lib/generators/cable/resource/templates/erb/scaffold/show.html.erb +12 -0
- data/lib/generators/cable/resource/templates/migration.rb +14 -0
- data/lib/generators/cable/resource/templates/model.rb +3 -0
- data/lib/generators/templates/block.rb +3 -0
- data/lib/generators/templates/create_blocks.rb +27 -0
- data/lib/generators/templates/create_cable_settings.rb +25 -0
- data/lib/generators/templates/initializer.rb +18 -0
- data/lib/generators/templates/partials/_block.html.erb +10 -0
- data/lib/generators/templates/partials/_block_form.html.erb +24 -0
- data/lib/railties/tasks.rake +6 -1
- data/public/images/cable/background.png +0 -0
- data/public/images/cable/delete.png +0 -0
- data/public/images/cable/event-icon.png +0 -0
- data/public/images/cable/new-window.png +0 -0
- data/public/images/cable/nil-icon.png +0 -0
- data/public/images/cable/page-icon.png +0 -0
- data/public/images/cable/product-icon.jpg +0 -0
- data/public/images/cable/story-icon.jpg +0 -0
- data/public/images/iphone-style-checkboxes/off.png +0 -0
- data/public/images/iphone-style-checkboxes/on.png +0 -0
- data/public/images/iphone-style-checkboxes/slider.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_center.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_left.png +0 -0
- data/public/images/iphone-style-checkboxes/slider_right.png +0 -0
- data/public/javascripts/admin.js +35 -0
- data/public/javascripts/iphone-style-checkboxes.js +224 -0
- data/public/javascripts/jquery.columnview.js +84 -0
- data/public/javascripts/jquery.tablesorter.min.js +4 -0
- data/public/javascripts/jquery.tagsinput.js +195 -0
- data/public/javascripts/jstree/_lib/jquery.cookie.js +96 -0
- data/public/javascripts/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/javascripts/jstree/_lib/jquery.js +6240 -0
- data/public/javascripts/jstree/jquery.jstree.js +4526 -0
- data/public/javascripts/jstree/themes/apple/bg.jpg +0 -0
- data/public/javascripts/jstree/themes/apple/d.png +0 -0
- data/public/javascripts/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/javascripts/jstree/themes/apple/style.css +61 -0
- data/public/javascripts/jstree/themes/apple/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/classic/d.png +0 -0
- data/public/javascripts/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/javascripts/jstree/themes/classic/style.css +59 -0
- data/public/javascripts/jstree/themes/classic/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/d.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/d.png +0 -0
- data/public/javascripts/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/javascripts/jstree/themes/default-rtl/style.css +83 -0
- data/public/javascripts/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/javascripts/jstree/themes/default/d.gif +0 -0
- data/public/javascripts/jstree/themes/default/d.png +0 -0
- data/public/javascripts/jstree/themes/default/style.css +73 -0
- data/public/javascripts/jstree/themes/default/throbber.gif +0 -0
- data/public/javascripts/tinymce/jquery.tinymce.js +1 -0
- data/public/javascripts/tinymce/langs/en.js +170 -0
- data/public/javascripts/tinymce/license.txt +504 -0
- data/public/javascripts/tinymce/plugins/advhr/css/advhr.css +5 -0
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +57 -0
- data/public/javascripts/tinymce/plugins/advhr/js/rule.js +43 -0
- data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +5 -0
- data/public/javascripts/tinymce/plugins/advhr/rule.htm +57 -0
- data/public/javascripts/tinymce/plugins/advimage/css/advimage.css +13 -0
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +50 -0
- data/public/javascripts/tinymce/plugins/advimage/image.htm +232 -0
- data/public/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
- data/public/javascripts/tinymce/plugins/advimage/js/image.js +443 -0
- data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +43 -0
- data/public/javascripts/tinymce/plugins/advlink/css/advlink.css +8 -0
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +61 -0
- data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +528 -0
- data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +52 -0
- data/public/javascripts/tinymce/plugins/advlink/link.htm +333 -0
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +154 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +119 -0
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +422 -0
- data/public/javascripts/tinymce/plugins/autosave/langs/en.js +4 -0
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +147 -0
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +82 -0
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +43 -0
- data/public/javascripts/tinymce/plugins/emotions/emotions.htm +40 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/js/emotions.js +22 -0
- data/public/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +20 -0
- data/public/javascripts/tinymce/plugins/example/dialog.htm +22 -0
- data/public/javascripts/tinymce/plugins/example/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/example/editor_plugin_src.js +84 -0
- data/public/javascripts/tinymce/plugins/example/img/example.gif +0 -0
- data/public/javascripts/tinymce/plugins/example/js/dialog.js +19 -0
- data/public/javascripts/tinymce/plugins/example/langs/en.js +3 -0
- data/public/javascripts/tinymce/plugins/example/langs/en_dlg.js +3 -0
- data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +182 -0
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +153 -0
- data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +571 -0
- data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +471 -0
- data/public/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +151 -0
- data/public/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +109 -0
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +54 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +635 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +100 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/template.htm +387 -0
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +212 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/public/javascripts/tinymce/plugins/media/css/content.css +6 -0
- data/public/javascripts/tinymce/plugins/media/css/media.css +16 -0
- data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +414 -0
- data/public/javascripts/tinymce/plugins/media/img/flash.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/flv_player.swf +0 -0
- data/public/javascripts/tinymce/plugins/media/img/quicktime.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/realmedia.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/shockwave.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/trans.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/img/windowsmedia.gif +0 -0
- data/public/javascripts/tinymce/plugins/media/js/embed.js +73 -0
- data/public/javascripts/tinymce/plugins/media/js/media.js +630 -0
- data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +103 -0
- data/public/javascripts/tinymce/plugins/media/media.htm +817 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/public/javascripts/tinymce/plugins/pagebreak/css/content.css +1 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/public/javascripts/tinymce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/public/javascripts/tinymce/plugins/pagebreak/img/trans.gif +0 -0
- data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +952 -0
- data/public/javascripts/tinymce/plugins/paste/js/pastetext.js +36 -0
- data/public/javascripts/tinymce/plugins/paste/js/pasteword.js +51 -0
- data/public/javascripts/tinymce/plugins/paste/langs/en_dlg.js +5 -0
- data/public/javascripts/tinymce/plugins/paste/pastetext.htm +27 -0
- data/public/javascripts/tinymce/plugins/paste/pasteword.htm +21 -0
- data/public/javascripts/tinymce/plugins/pdw/editor_plugin.js +4 -0
- data/public/javascripts/tinymce/plugins/pdw/editor_plugin_src.js +158 -0
- data/public/javascripts/tinymce/plugins/pdw/img/toolbars.gif +0 -0
- data/public/javascripts/tinymce/plugins/pdw/langs/en.js +3 -0
- data/public/javascripts/tinymce/plugins/pdw/langs/nl.js +3 -0
- data/public/javascripts/tinymce/plugins/preview/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/preview/editor_plugin_src.js +53 -0
- data/public/javascripts/tinymce/plugins/preview/example.html +28 -0
- data/public/javascripts/tinymce/plugins/preview/jscripts/embed.js +73 -0
- data/public/javascripts/tinymce/plugins/preview/preview.html +17 -0
- data/public/javascripts/tinymce/plugins/print/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/print/editor_plugin_src.js +34 -0
- data/public/javascripts/tinymce/plugins/save/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/save/editor_plugin_src.js +101 -0
- data/public/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +138 -0
- data/public/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +99 -0
- data/public/javascripts/tinymce/plugins/spellchecker/css/content.css +1 -0
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +417 -0
- data/public/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/javascripts/tinymce/plugins/style/css/props.css +13 -0
- data/public/javascripts/tinymce/plugins/style/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/style/editor_plugin_src.js +55 -0
- data/public/javascripts/tinymce/plugins/style/js/props.js +641 -0
- data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +63 -0
- data/public/javascripts/tinymce/plugins/style/props.htm +723 -0
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +112 -0
- data/public/javascripts/tinymce/plugins/table/cell.htm +178 -0
- data/public/javascripts/tinymce/plugins/table/css/cell.css +17 -0
- data/public/javascripts/tinymce/plugins/table/css/row.css +25 -0
- data/public/javascripts/tinymce/plugins/table/css/table.css +13 -0
- data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +1139 -0
- data/public/javascripts/tinymce/plugins/table/js/cell.js +286 -0
- data/public/javascripts/tinymce/plugins/table/js/merge_cells.js +27 -0
- data/public/javascripts/tinymce/plugins/table/js/row.js +237 -0
- data/public/javascripts/tinymce/plugins/table/js/table.js +454 -0
- data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +74 -0
- data/public/javascripts/tinymce/plugins/table/merge_cells.htm +32 -0
- data/public/javascripts/tinymce/plugins/table/row.htm +155 -0
- data/public/javascripts/tinymce/plugins/table/table.htm +187 -0
- data/public/javascripts/tinymce/plugins/template/blank.htm +12 -0
- data/public/javascripts/tinymce/plugins/template/css/template.css +23 -0
- data/public/javascripts/tinymce/plugins/template/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/template/editor_plugin_src.js +159 -0
- data/public/javascripts/tinymce/plugins/template/js/template.js +106 -0
- data/public/javascripts/tinymce/plugins/template/langs/en_dlg.js +15 -0
- data/public/javascripts/tinymce/plugins/template/template.htm +31 -0
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +83 -0
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +148 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +141 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +161 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +161 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +53 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +52 -0
- data/public/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/public/javascripts/tinymce/themes/advanced/about.htm +54 -0
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -0
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +52 -0
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +73 -0
- data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -0
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1229 -0
- data/public/javascripts/tinymce/themes/advanced/image.htm +80 -0
- data/public/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/js/about.js +72 -0
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +37 -0
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +335 -0
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +253 -0
- data/public/javascripts/tinymce/themes/advanced/js/image.js +245 -0
- data/public/javascripts/tinymce/themes/advanced/js/link.js +156 -0
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -0
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +62 -0
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +51 -0
- data/public/javascripts/tinymce/themes/advanced/link.htm +58 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +36 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/dialog.css +117 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +213 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +36 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -0
- data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -0
- data/public/javascripts/tinymce/themes/simple/editor_template_src.js +85 -0
- data/public/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/simple/langs/en.js +11 -0
- data/public/javascripts/tinymce/themes/simple/skins/default/content.css +25 -0
- data/public/javascripts/tinymce/themes/simple/skins/default/ui.css +32 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/content.css +17 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +35 -0
- data/public/javascripts/tinymce/tiny_mce.js +1 -0
- data/public/javascripts/tinymce/tiny_mce_popup.js +5 -0
- data/public/javascripts/tinymce/tiny_mce_src.js +13394 -0
- data/public/javascripts/tinymce/utils/editable_selects.js +70 -0
- data/public/javascripts/tinymce/utils/form_utils.js +200 -0
- data/public/javascripts/tinymce/utils/mctabs.js +77 -0
- data/public/javascripts/tinymce/utils/validate.js +220 -0
- data/public/stylesheets/cable.css +862 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/ie.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/key.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/buttons/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/fancy-type/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/fancy-type/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/link-icons/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/rtl/readme.txt +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/plugins/rtl/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/print.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/screen.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/forms.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/grid.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/grid.png +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/ie.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/print.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/reset.css +0 -0
- data/{lib/generators/cable/templates/stylesheets/admin → public/stylesheets/cable}/blueprint/src/typography.css +0 -0
- data/public/stylesheets/columnview.css +61 -0
- data/public/stylesheets/formtastic.css +148 -0
- data/public/stylesheets/formtastic_changes.css +66 -0
- data/public/stylesheets/iphone_checkboxes.css +76 -0
- data/public/stylesheets/ui/aristo/aristo.css +524 -0
- data/public/stylesheets/ui/aristo/icons.psd +0 -0
- data/public/stylesheets/ui/aristo/images/button_bg.png +0 -0
- data/public/stylesheets/ui/aristo/images/datepicker.gif +0 -0
- data/public/stylesheets/ui/aristo/images/icon_sprite.png +0 -0
- data/public/stylesheets/ui/aristo/images/progress_bar.gif +0 -0
- data/public/stylesheets/ui/aristo/images/right-arrow.png +0 -0
- data/public/stylesheets/ui/aristo/images/slider_h_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/slider_handles.png +0 -0
- data/public/stylesheets/ui/aristo/images/slider_v_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/tab_bg.gif +0 -0
- data/public/stylesheets/ui/aristo/images/the_gradient.gif +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/stylesheets/ui/aristo/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/ui/images/sprite-aristo.png +0 -0
- data/public/stylesheets/ui/images/uniform/sprite.png +0 -0
- data/public/stylesheets/ui/uniform/uniform.aristo.css +470 -0
- data/public/stylesheets/ui/uniform/uniform.default.css +477 -0
- metadata +473 -131
- data/app/models/cable/global_setting.rb +0 -3
- data/app/views/cable/admin/index.html.erb +0 -2
- data/app/views/cable/layouts/admin.html.erb +0 -49
- data/lib/generators/cable/controllers_generator.rb +0 -21
- data/lib/generators/cable/templates/admin_navigation.rb +0 -5
- data/lib/generators/cable/templates/javascripts/admin.js +0 -24
- data/lib/generators/cable/templates/javascripts/wymeditor/GPL-license.txt +0 -278
- data/lib/generators/cable/templates/javascripts/wymeditor/MIT-license.txt +0 -20
- data/lib/generators/cable/templates/javascripts/wymeditor/README +0 -33
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-p.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.css +0 -93
- data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.html +0 -26
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.js +0 -4724
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.min.js +0 -1
- data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.pack.js +0 -1
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/bg.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ca.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/cs.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/cy.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/de.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/en.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/es.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fa.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fi.js +0 -44
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/fr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/gl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/he.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/hr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/hu.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/it.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ja.js +0 -44
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nb.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/nn.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pl.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt-br.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/ru.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/sv.js +0 -46
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/tr.js +0 -45
- data/lib/generators/cable/templates/javascripts/wymeditor/lang/zh_cn.js +0 -47
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/embed/jquery.wymeditor.embed.js +0 -52
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +0 -127
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +0 -57
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/browser.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/jquery.wymeditor.mediabrowser.js +0 -115
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +0 -91
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/readme.txt +0 -124
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/README +0 -19
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +0 -82
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/tidy.php +0 -36
- data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/wand.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.css +0 -134
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.js +0 -35
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.css +0 -158
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.js +0 -40
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.header.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.css +0 -131
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.js +0 -30
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/COPYING +0 -674
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/README +0 -27
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.header.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/icons.silver.gif +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.css +0 -297
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.js +0 -61
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/icons.png +0 -0
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.css +0 -134
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.js +0 -39
- data/lib/generators/cable/templates/javascripts/wymeditor/skins/wymeditor_icon.png +0 -0
- data/lib/generators/cable/templates/stylesheets/admin.css +0 -417
@@ -0,0 +1 @@
|
|
1
|
+
(function(){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(c){var d=c.each;function b(f,g){var h=g.ownerDocument,e=h.createRange(),j;e.setStartBefore(g);e.setEnd(f.endContainer,f.endOffset);j=h.createElement("body");j.appendChild(e.cloneContents());return j.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(G,F,J){var f,K,C,o;s();o=F.getParent(J.getStart(),"th,td");if(o){K=E(o);C=H();o=w(K.x,K.y)}function z(M,L){M=M.cloneNode(L);M.removeAttribute("id");return M}function s(){var L=0;f=[];d(["thead","tbody","tfoot"],function(M){var N=F.select("> "+M+" tr",G);d(N,function(O,P){P+=L;d(F.select("> td, > th",O),function(V,Q){var R,S,T,U;if(f[P]){while(f[P][Q]){Q++}}T=h(V,"rowspan");U=h(V,"colspan");for(S=P;S<P+T;S++){if(!f[S]){f[S]=[]}for(R=Q;R<Q+U;R++){f[S][R]={part:M,real:S==P&&R==Q,elm:V,rowspan:T,colspan:U}}}})});L+=N.length})}function w(L,N){var M;M=f[N];if(M){return M[L]}}function h(M,L){return parseInt(M.getAttribute(L)||1)}function j(L){return F.hasClass(L.elm,"mceSelected")||L==o}function k(){var L=[];d(G.rows,function(M){d(M.cells,function(N){if(F.hasClass(N,"mceSelected")||N==o.elm){L.push(M);return false}})});return L}function r(){var L=F.createRng();L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G)}function e(L){var M;c.walk(L,function(O){var N;if(O.nodeType==3){d(F.getParents(O.parentNode,null,L).reverse(),function(P){P=z(P,false);if(!M){M=N=P}else{if(N){N.appendChild(P)}}N=P});if(N){N.innerHTML=c.isIE?" ":'<br _mce_bogus="1" />'}return false}},"childNodes");L=z(L,false);L.rowSpan=L.colSpan=1;if(M){L.appendChild(M)}else{if(!c.isIE){L.innerHTML='<br _mce_bogus="1" />'}}return L}function q(){var L=F.createRng();d(F.select("tr",G),function(M){if(M.cells.length==0){F.remove(M)}});if(F.select("tr",G).length==0){L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G);return}d(F.select("thead,tbody,tfoot",G),function(M){if(M.rows.length==0){F.remove(M)}});s();row=f[Math.min(f.length-1,K.y)];if(row){J.select(row[Math.min(row.length-1,K.x)].elm,true);J.collapse(true)}}function t(R,P,T,Q){var O,M,L,N,S;O=f[P][R].elm.parentNode;for(L=1;L<=T;L++){O=F.getNext(O,"tr");if(O){for(M=R;M>=0;M--){S=f[P+L][M].elm;if(S.parentNode==O){for(N=1;N<=Q;N++){F.insertAfter(e(S),S)}break}}if(M==-1){for(N=1;N<=Q;N++){O.insertBefore(e(O.cells[0]),O.cells[0])}}}}}function B(){d(f,function(L,M){d(L,function(O,N){var R,Q,S,P;if(j(O)){O=O.elm;R=h(O,"colspan");Q=h(O,"rowspan");if(R>1||Q>1){O.colSpan=O.rowSpan=1;for(P=0;P<R-1;P++){F.insertAfter(e(O),O)}t(N,M,Q-1,R)}}})})}function p(T,Q,W){var O,N,V,U,S,P,R,L,T,M;if(T){pos=E(T);O=pos.x;N=pos.y;V=O+(Q-1);U=N+(W-1)}else{O=K.x;N=K.y;V=C.x;U=C.y}R=w(O,N);L=w(V,U);if(R&&L&&R.part==L.part){B();s();R=w(O,N).elm;R.colSpan=(V-O)+1;R.rowSpan=(U-N)+1;for(P=N;P<=U;P++){for(S=O;S<=V;S++){T=f[P][S].elm;if(T!=R){M=c.grep(T.childNodes);d(M,function(Y,X){if(Y.nodeName!="BR"||X!=M.length-1){R.appendChild(Y)}});F.remove(T)}}}q()}}function l(O){var L,Q,N,P,R,S,M,T;d(f,function(U,V){d(U,function(X,W){if(j(X)){X=X.elm;R=X.parentNode;S=z(R,false);L=V;if(O){return false}}});if(O){return !L}});for(P=0;P<f[0].length;P++){Q=f[L][P].elm;if(Q!=N){if(!O){rowSpan=h(Q,"rowspan");if(rowSpan>1){Q.rowSpan=rowSpan+1;continue}}else{if(L>0&&f[L-1][P]){T=f[L-1][P].elm;rowSpan=h(T,"rowspan");if(rowSpan>1){T.rowSpan=rowSpan+1;continue}}}M=e(Q);M.colSpan=Q.colSpan;S.appendChild(M);N=Q}}if(S.hasChildNodes()){if(!O){F.insertAfter(S,R)}else{R.parentNode.insertBefore(S,R)}}}function g(M){var N,L;d(f,function(O,P){d(O,function(R,Q){if(j(R)){N=Q;if(M){return false}}});if(M){return !N}});d(f,function(R,S){var O=R[N].elm,P,Q;if(O!=L){Q=h(O,"colspan");P=h(O,"rowspan");if(Q==1){if(!M){F.insertAfter(e(O),O);t(N,S,P-1,Q)}else{O.parentNode.insertBefore(e(O),O);t(N,S,P-1,Q)}}else{O.colSpan++}L=O}})}function n(){var L=[];d(f,function(M,N){d(M,function(P,O){if(j(P)&&c.inArray(L,O)===-1){d(f,function(S){var Q=S[O].elm,R;R=h(Q,"colspan");if(R>1){Q.colSpan=R-1}else{F.remove(Q)}});L.push(O)}})});q()}function m(){var M;function L(P){var O,Q,N;O=F.getNext(P,"tr");d(P.cells,function(R){var S=h(R,"rowspan");if(S>1){R.rowSpan=S-1;Q=E(R);t(Q.x,Q.y,1,1)}});Q=E(P.cells[0]);d(f[Q.y],function(R){var S;R=R.elm;if(R!=N){S=h(R,"rowspan");if(S<=1){F.remove(R)}else{R.rowSpan=S-1}N=R}})}M=k();d(M.reverse(),function(N){L(N)});q()}function D(){var L=k();F.remove(L);q();return L}function I(){var L=k();d(L,function(N,M){L[M]=z(N,true)});return L}function A(N,M){var O=k(),L=O[M?0:O.length-1],P=L.cells.length;d(f,function(R){var Q;P=0;d(R,function(T,S){if(T.real){P+=T.colspan}if(T.elm.parentNode==L){Q=1}});if(Q){return false}});if(!M){N.reverse()}d(N,function(S){var R=S.cells.length,Q;for(i=0;i<R;i++){Q=S.cells[i];Q.colSpan=Q.rowSpan=1}for(i=R;i<P;i++){S.appendChild(e(S.cells[R-1]))}for(i=P;i<R;i++){F.remove(S.cells[i])}if(M){L.parentNode.insertBefore(S,L)}else{F.insertAfter(S,L)}})}function E(L){var M;d(f,function(N,O){d(N,function(Q,P){if(Q.elm==L){M={x:P,y:O};return false}});return !M});return M}function v(L){K=E(L)}function H(){var N,M,L;M=L=0;d(f,function(O,P){d(O,function(R,Q){var T,S;if(j(R)){R=f[P][Q];if(Q>M){M=Q}if(P>L){L=P}if(R.real){T=R.colspan-1;S=R.rowspan-1;if(T){if(Q+T>M){M=Q+T}}if(S){if(P+S>L){L=P+S}}}}})});return{x:M,y:L}}function u(R){var O,N,T,S,M,L,P,Q;C=E(R);if(K&&C){O=Math.min(K.x,C.x);N=Math.min(K.y,C.y);T=Math.max(K.x,C.x);S=Math.max(K.y,C.y);M=T;L=S;for(y=N;y<=L;y++){R=f[y][O];if(!R.real){if(O-(R.colspan-1)<O){O-=R.colspan-1}}}for(x=O;x<=M;x++){R=f[N][x];if(!R.real){if(N-(R.rowspan-1)<N){N-=R.rowspan-1}}}for(y=N;y<=S;y++){for(x=O;x<=T;x++){R=f[y][x];if(R.real){P=R.colspan-1;Q=R.rowspan-1;if(P){if(x+P>M){M=x+P}}if(Q){if(y+Q>L){L=y+Q}}}}}F.removeClass(F.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=N;y<=L;y++){for(x=O;x<=M;x++){F.addClass(f[y][x].elm,"mceSelected")}}}}c.extend(this,{deleteTable:r,split:B,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:D,copyRows:I,pasteRows:A,getPos:E,setStartCell:v,setEndCell:u})}c.create("tinymce.plugins.TablePlugin",{init:function(f,g){var e,k;function j(n){var m=f.selection,l=f.dom.getParent(n||m.getNode(),"table");if(l){return new a(l,f.dom,m)}}function h(){f.getBody().style.webkitUserSelect="";f.dom.removeClass(f.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}d([["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(l){f.addButton(l[0],{title:l[1],cmd:l[2],ui:l[3]})});if(!c.isIE){f.onClick.add(function(l,m){m=m.target;if(m.nodeName==="TABLE"){l.selection.select(m)}})}f.onNodeChange.add(function(m,l,q){var o;q=m.selection.getStart();o=m.dom.getParent(q,"td,th,caption");l.setActive("table",q.nodeName==="TABLE"||!!o);if(o&&o.nodeName==="CAPTION"){o=0}l.setDisabled("delete_table",!o);l.setDisabled("delete_col",!o);l.setDisabled("delete_table",!o);l.setDisabled("delete_row",!o);l.setDisabled("col_after",!o);l.setDisabled("col_before",!o);l.setDisabled("row_after",!o);l.setDisabled("row_before",!o);l.setDisabled("row_props",!o);l.setDisabled("cell_props",!o);l.setDisabled("split_cells",!o);l.setDisabled("merge_cells",!o)});f.onInit.add(function(m){var l,p,q=m.dom,n;e=m.windowManager;m.onMouseDown.add(function(r,s){if(s.button!=2){h();p=q.getParent(s.target,"td,th");l=q.getParent(p,"table")}});q.bind(m.getDoc(),"mouseover",function(u){var s,r,t=u.target;if(p&&(n||t!=p)&&(t.nodeName=="TD"||t.nodeName=="TH")){r=q.getParent(t,"table");if(r==l){if(!n){n=j(r);n.setStartCell(p);m.getBody().style.webkitUserSelect="none"}n.setEndCell(t)}s=m.selection.getSel();if(s.removeAllRanges){s.removeAllRanges()}else{s.empty()}u.preventDefault()}});m.onMouseUp.add(function(A,B){var s,u=A.selection,C,D=u.getSel(),r,v,t,z;if(p){if(n){A.getBody().style.webkitUserSelect=""}function w(E,G){var F=new c.dom.TreeWalker(E,E);do{if(E.nodeType==3&&c.trim(E.nodeValue).length!=0){if(G){s.setStart(E,0)}else{s.setEnd(E,E.nodeValue.length)}return}if(E.nodeName=="BR"){if(G){s.setStartBefore(E)}else{s.setEndBefore(E)}return}}while(E=(G?F.next():F.prev()))}C=q.select("td.mceSelected,th.mceSelected");if(C.length>0){s=q.createRng();v=C[0];z=C[C.length-1];w(v,1);r=new c.dom.TreeWalker(v,q.getParent(C[0],"table"));do{if(v.nodeName=="TD"||v.nodeName=="TH"){if(!q.hasClass(v,"mceSelected")){break}t=v}}while(v=r.next());w(t);u.setRng(s)}A.nodeChanged();p=n=l=null}});m.onKeyUp.add(function(r,s){h()});if(m&&m.plugins.contextmenu){m.plugins.contextmenu.onContextMenu.add(function(t,r,v){var w,u=m.selection,s=u.getNode()||m.getBody();if(m.dom.getParent(v,"td")||m.dom.getParent(v,"th")||m.dom.select("td.mceSelected,th.mceSelected").length){r.removeAll();if(s.nodeName=="A"&&!m.dom.getAttrib(s,"name")){r.add({title:"advanced.link_desc",icon:"link",cmd:m.plugins.advlink?"mceAdvLink":"mceLink",ui:true});r.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});r.addSeparator()}if(s.nodeName=="IMG"&&s.className.indexOf("mceItem")==-1){r.add({title:"advanced.image_desc",icon:"image",cmd:m.plugins.advimage?"mceAdvImage":"mceImage",ui:true});r.addSeparator()}r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});r.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});r.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});r.addSeparator();w=r.addMenu({title:"table.cell"});w.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});w.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});w.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});w=r.addMenu({title:"table.row"});w.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});w.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});w.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});w.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});w.addSeparator();w.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});w.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});w.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!k);w.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!k);w=r.addMenu({title:"table.col"});w.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});w.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});w.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!c.isIE){function o(){var r;for(r=m.getBody().lastChild;r&&r.nodeType==3&&!r.nodeValue.length;r=r.previousSibling){}if(r&&r.nodeName=="TABLE"){m.dom.add(m.getBody(),"p",null,'<br mce_bogus="1" />')}}if(c.isGecko){m.onKeyDown.add(function(s,u){var r,t,v=s.dom;if(u.keyCode==37||u.keyCode==38){r=s.selection.getRng();t=v.getParent(r.startContainer,"table");if(t&&s.getBody().firstChild==t){if(b(r,t)){r=v.createRng();r.setStartBefore(t);r.setEndBefore(t);s.selection.setRng(r);u.preventDefault()}}}})}m.onKeyUp.add(o);m.onSetContent.add(o);m.onVisualAid.add(o);m.onPreProcess.add(function(r,t){var s=t.node.lastChild;if(s&&s.childNodes.length==1&&s.firstChild.nodeName=="BR"){r.dom.remove(s)}});o()}});d({mceTableSplitCells:function(l){l.split()},mceTableMergeCells:function(m){var n,o,l;l=f.dom.getParent(f.selection.getNode(),"th,td");if(l){n=l.rowSpan;o=l.colSpan}if(!f.dom.select("td.mceSelected,th.mceSelected").length){e.open({url:g+"/merge_cells.htm",width:240+parseInt(f.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(f.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:n,cols:o,onaction:function(p){m.merge(l,p.cols,p.rows)},plugin_url:g})}else{m.merge()}},mceTableInsertRowBefore:function(l){l.insertRow(true)},mceTableInsertRowAfter:function(l){l.insertRow()},mceTableInsertColBefore:function(l){l.insertCol(true)},mceTableInsertColAfter:function(l){l.insertCol()},mceTableDeleteCol:function(l){l.deleteCols()},mceTableDeleteRow:function(l){l.deleteRows()},mceTableCutRow:function(l){k=l.cutRows()},mceTableCopyRow:function(l){k=l.copyRows()},mceTablePasteRowBefore:function(l){l.pasteRows(k,true)},mceTablePasteRowAfter:function(l){l.pasteRows(k)},mceTableDelete:function(l){l.deleteTable()}},function(m,l){f.addCommand(l,function(){var n=j();if(n){m(n);f.execCommand("mceRepaint");h()}})});d({mceInsertTable:function(l){e.open({url:g+"/table.htm",width:400+parseInt(f.getLang("table.table_delta_width",0)),height:320+parseInt(f.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:l?l.action:0})},mceTableRowProps:function(){e.open({url:g+"/row.htm",width:400+parseInt(f.getLang("table.rowprops_delta_width",0)),height:295+parseInt(f.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})},mceTableCellProps:function(){e.open({url:g+"/cell.htm",width:400+parseInt(f.getLang("table.cellprops_delta_width",0)),height:295+parseInt(f.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}},function(m,l){f.addCommand(l,function(n,o){m(o)})})}});c.PluginManager.add("table",c.plugins.TablePlugin)})(tinymce);
|
@@ -0,0 +1,1139 @@
|
|
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
|
+
// Checks if the selection/caret is at the start of the specified block element
|
15
|
+
function isAtStart(rng, par) {
|
16
|
+
var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
|
17
|
+
|
18
|
+
rng2.setStartBefore(par);
|
19
|
+
rng2.setEnd(rng.endContainer, rng.endOffset);
|
20
|
+
|
21
|
+
elm = doc.createElement('body');
|
22
|
+
elm.appendChild(rng2.cloneContents());
|
23
|
+
|
24
|
+
// Check for text characters of other elements that should be treated as content
|
25
|
+
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
|
26
|
+
};
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Table Grid class.
|
30
|
+
*/
|
31
|
+
function TableGrid(table, dom, selection) {
|
32
|
+
var grid, startPos, endPos, selectedCell;
|
33
|
+
|
34
|
+
buildGrid();
|
35
|
+
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
36
|
+
if (selectedCell) {
|
37
|
+
startPos = getPos(selectedCell);
|
38
|
+
endPos = findEndPos();
|
39
|
+
selectedCell = getCell(startPos.x, startPos.y);
|
40
|
+
}
|
41
|
+
|
42
|
+
function cloneNode(node, children) {
|
43
|
+
node = node.cloneNode(children);
|
44
|
+
node.removeAttribute('id');
|
45
|
+
|
46
|
+
return node;
|
47
|
+
}
|
48
|
+
|
49
|
+
function buildGrid() {
|
50
|
+
var startY = 0;
|
51
|
+
|
52
|
+
grid = [];
|
53
|
+
|
54
|
+
each(['thead', 'tbody', 'tfoot'], function(part) {
|
55
|
+
var rows = dom.select('> ' + part + ' tr', table);
|
56
|
+
|
57
|
+
each(rows, function(tr, y) {
|
58
|
+
y += startY;
|
59
|
+
|
60
|
+
each(dom.select('> td, > th', tr), function(td, x) {
|
61
|
+
var x2, y2, rowspan, colspan;
|
62
|
+
|
63
|
+
// Skip over existing cells produced by rowspan
|
64
|
+
if (grid[y]) {
|
65
|
+
while (grid[y][x])
|
66
|
+
x++;
|
67
|
+
}
|
68
|
+
|
69
|
+
// Get col/rowspan from cell
|
70
|
+
rowspan = getSpanVal(td, 'rowspan');
|
71
|
+
colspan = getSpanVal(td, 'colspan');
|
72
|
+
|
73
|
+
// Fill out rowspan/colspan right and down
|
74
|
+
for (y2 = y; y2 < y + rowspan; y2++) {
|
75
|
+
if (!grid[y2])
|
76
|
+
grid[y2] = [];
|
77
|
+
|
78
|
+
for (x2 = x; x2 < x + colspan; x2++) {
|
79
|
+
grid[y2][x2] = {
|
80
|
+
part : part,
|
81
|
+
real : y2 == y && x2 == x,
|
82
|
+
elm : td,
|
83
|
+
rowspan : rowspan,
|
84
|
+
colspan : colspan
|
85
|
+
};
|
86
|
+
}
|
87
|
+
}
|
88
|
+
});
|
89
|
+
});
|
90
|
+
|
91
|
+
startY += rows.length;
|
92
|
+
});
|
93
|
+
};
|
94
|
+
|
95
|
+
function getCell(x, y) {
|
96
|
+
var row;
|
97
|
+
|
98
|
+
row = grid[y];
|
99
|
+
if (row)
|
100
|
+
return row[x];
|
101
|
+
};
|
102
|
+
|
103
|
+
function getSpanVal(td, name) {
|
104
|
+
return parseInt(td.getAttribute(name) || 1);
|
105
|
+
};
|
106
|
+
|
107
|
+
function isCellSelected(cell) {
|
108
|
+
return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
|
109
|
+
};
|
110
|
+
|
111
|
+
function getSelectedRows() {
|
112
|
+
var rows = [];
|
113
|
+
|
114
|
+
each(table.rows, function(row) {
|
115
|
+
each(row.cells, function(cell) {
|
116
|
+
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
117
|
+
rows.push(row);
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
});
|
121
|
+
});
|
122
|
+
|
123
|
+
return rows;
|
124
|
+
};
|
125
|
+
|
126
|
+
function deleteTable() {
|
127
|
+
var rng = dom.createRng();
|
128
|
+
|
129
|
+
rng.setStartAfter(table);
|
130
|
+
rng.setEndAfter(table);
|
131
|
+
|
132
|
+
selection.setRng(rng);
|
133
|
+
|
134
|
+
dom.remove(table);
|
135
|
+
};
|
136
|
+
|
137
|
+
function cloneCell(cell) {
|
138
|
+
var formatNode;
|
139
|
+
|
140
|
+
// Clone formats
|
141
|
+
tinymce.walk(cell, function(node) {
|
142
|
+
var curNode;
|
143
|
+
|
144
|
+
if (node.nodeType == 3) {
|
145
|
+
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
146
|
+
node = cloneNode(node, false);
|
147
|
+
|
148
|
+
if (!formatNode)
|
149
|
+
formatNode = curNode = node;
|
150
|
+
else if (curNode)
|
151
|
+
curNode.appendChild(node);
|
152
|
+
|
153
|
+
curNode = node;
|
154
|
+
});
|
155
|
+
|
156
|
+
// Add something to the inner node
|
157
|
+
if (curNode)
|
158
|
+
curNode.innerHTML = tinymce.isIE ? ' ' : '<br _mce_bogus="1" />';
|
159
|
+
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
}, 'childNodes');
|
163
|
+
|
164
|
+
cell = cloneNode(cell, false);
|
165
|
+
cell.rowSpan = cell.colSpan = 1;
|
166
|
+
|
167
|
+
if (formatNode) {
|
168
|
+
cell.appendChild(formatNode);
|
169
|
+
} else {
|
170
|
+
if (!tinymce.isIE)
|
171
|
+
cell.innerHTML = '<br _mce_bogus="1" />';
|
172
|
+
}
|
173
|
+
|
174
|
+
return cell;
|
175
|
+
};
|
176
|
+
|
177
|
+
function cleanup() {
|
178
|
+
var rng = dom.createRng();
|
179
|
+
|
180
|
+
// Empty rows
|
181
|
+
each(dom.select('tr', table), function(tr) {
|
182
|
+
if (tr.cells.length == 0)
|
183
|
+
dom.remove(tr);
|
184
|
+
});
|
185
|
+
|
186
|
+
// Empty table
|
187
|
+
if (dom.select('tr', table).length == 0) {
|
188
|
+
rng.setStartAfter(table);
|
189
|
+
rng.setEndAfter(table);
|
190
|
+
selection.setRng(rng);
|
191
|
+
dom.remove(table);
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
|
195
|
+
// Empty header/body/footer
|
196
|
+
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
197
|
+
if (part.rows.length == 0)
|
198
|
+
dom.remove(part);
|
199
|
+
});
|
200
|
+
|
201
|
+
// Restore selection to start position if it still exists
|
202
|
+
buildGrid();
|
203
|
+
|
204
|
+
// Restore the selection to the closest table position
|
205
|
+
row = grid[Math.min(grid.length - 1, startPos.y)];
|
206
|
+
if (row) {
|
207
|
+
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
208
|
+
selection.collapse(true);
|
209
|
+
}
|
210
|
+
};
|
211
|
+
|
212
|
+
function fillLeftDown(x, y, rows, cols) {
|
213
|
+
var tr, x2, r, c, cell;
|
214
|
+
|
215
|
+
tr = grid[y][x].elm.parentNode;
|
216
|
+
for (r = 1; r <= rows; r++) {
|
217
|
+
tr = dom.getNext(tr, 'tr');
|
218
|
+
|
219
|
+
if (tr) {
|
220
|
+
// Loop left to find real cell
|
221
|
+
for (x2 = x; x2 >= 0; x2--) {
|
222
|
+
cell = grid[y + r][x2].elm;
|
223
|
+
|
224
|
+
if (cell.parentNode == tr) {
|
225
|
+
// Append clones after
|
226
|
+
for (c = 1; c <= cols; c++)
|
227
|
+
dom.insertAfter(cloneCell(cell), cell);
|
228
|
+
|
229
|
+
break;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
if (x2 == -1) {
|
234
|
+
// Insert nodes before first cell
|
235
|
+
for (c = 1; c <= cols; c++)
|
236
|
+
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}
|
240
|
+
};
|
241
|
+
|
242
|
+
function split() {
|
243
|
+
each(grid, function(row, y) {
|
244
|
+
each(row, function(cell, x) {
|
245
|
+
var colSpan, rowSpan, newCell, i;
|
246
|
+
|
247
|
+
if (isCellSelected(cell)) {
|
248
|
+
cell = cell.elm;
|
249
|
+
colSpan = getSpanVal(cell, 'colspan');
|
250
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
251
|
+
|
252
|
+
if (colSpan > 1 || rowSpan > 1) {
|
253
|
+
cell.colSpan = cell.rowSpan = 1;
|
254
|
+
|
255
|
+
// Insert cells right
|
256
|
+
for (i = 0; i < colSpan - 1; i++)
|
257
|
+
dom.insertAfter(cloneCell(cell), cell);
|
258
|
+
|
259
|
+
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
});
|
263
|
+
});
|
264
|
+
};
|
265
|
+
|
266
|
+
function merge(cell, cols, rows) {
|
267
|
+
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
|
268
|
+
|
269
|
+
// Use specified cell and cols/rows
|
270
|
+
if (cell) {
|
271
|
+
pos = getPos(cell);
|
272
|
+
startX = pos.x;
|
273
|
+
startY = pos.y;
|
274
|
+
endX = startX + (cols - 1);
|
275
|
+
endY = startY + (rows - 1);
|
276
|
+
} else {
|
277
|
+
// Use selection
|
278
|
+
startX = startPos.x;
|
279
|
+
startY = startPos.y;
|
280
|
+
endX = endPos.x;
|
281
|
+
endY = endPos.y;
|
282
|
+
}
|
283
|
+
|
284
|
+
// Find start/end cells
|
285
|
+
startCell = getCell(startX, startY);
|
286
|
+
endCell = getCell(endX, endY);
|
287
|
+
|
288
|
+
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
289
|
+
if (startCell && endCell && startCell.part == endCell.part) {
|
290
|
+
// Split and rebuild grid
|
291
|
+
split();
|
292
|
+
buildGrid();
|
293
|
+
|
294
|
+
// Set row/col span to start cell
|
295
|
+
startCell = getCell(startX, startY).elm;
|
296
|
+
startCell.colSpan = (endX - startX) + 1;
|
297
|
+
startCell.rowSpan = (endY - startY) + 1;
|
298
|
+
|
299
|
+
// Remove other cells and add it's contents to the start cell
|
300
|
+
for (y = startY; y <= endY; y++) {
|
301
|
+
for (x = startX; x <= endX; x++) {
|
302
|
+
cell = grid[y][x].elm;
|
303
|
+
|
304
|
+
if (cell != startCell) {
|
305
|
+
// Move children to startCell
|
306
|
+
children = tinymce.grep(cell.childNodes);
|
307
|
+
each(children, function(node, i) {
|
308
|
+
// Jump over last BR element
|
309
|
+
if (node.nodeName != 'BR' || i != children.length - 1)
|
310
|
+
startCell.appendChild(node);
|
311
|
+
});
|
312
|
+
|
313
|
+
// Remove cell
|
314
|
+
dom.remove(cell);
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
|
319
|
+
// Remove empty rows etc and restore caret location
|
320
|
+
cleanup();
|
321
|
+
}
|
322
|
+
};
|
323
|
+
|
324
|
+
function insertRow(before) {
|
325
|
+
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
|
326
|
+
|
327
|
+
// Find first/last row
|
328
|
+
each(grid, function(row, y) {
|
329
|
+
each(row, function(cell, x) {
|
330
|
+
if (isCellSelected(cell)) {
|
331
|
+
cell = cell.elm;
|
332
|
+
rowElm = cell.parentNode;
|
333
|
+
newRow = cloneNode(rowElm, false);
|
334
|
+
posY = y;
|
335
|
+
|
336
|
+
if (before)
|
337
|
+
return false;
|
338
|
+
}
|
339
|
+
});
|
340
|
+
|
341
|
+
if (before)
|
342
|
+
return !posY;
|
343
|
+
});
|
344
|
+
|
345
|
+
for (x = 0; x < grid[0].length; x++) {
|
346
|
+
cell = grid[posY][x].elm;
|
347
|
+
|
348
|
+
if (cell != lastCell) {
|
349
|
+
if (!before) {
|
350
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
351
|
+
if (rowSpan > 1) {
|
352
|
+
cell.rowSpan = rowSpan + 1;
|
353
|
+
continue;
|
354
|
+
}
|
355
|
+
} else {
|
356
|
+
// Check if cell above can be expanded
|
357
|
+
if (posY > 0 && grid[posY - 1][x]) {
|
358
|
+
otherCell = grid[posY - 1][x].elm;
|
359
|
+
rowSpan = getSpanVal(otherCell, 'rowspan');
|
360
|
+
if (rowSpan > 1) {
|
361
|
+
otherCell.rowSpan = rowSpan + 1;
|
362
|
+
continue;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
// Insert new cell into new row
|
368
|
+
newCell = cloneCell(cell)
|
369
|
+
newCell.colSpan = cell.colSpan;
|
370
|
+
newRow.appendChild(newCell);
|
371
|
+
|
372
|
+
lastCell = cell;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
if (newRow.hasChildNodes()) {
|
377
|
+
if (!before)
|
378
|
+
dom.insertAfter(newRow, rowElm);
|
379
|
+
else
|
380
|
+
rowElm.parentNode.insertBefore(newRow, rowElm);
|
381
|
+
}
|
382
|
+
};
|
383
|
+
|
384
|
+
function insertCol(before) {
|
385
|
+
var posX, lastCell;
|
386
|
+
|
387
|
+
// Find first/last column
|
388
|
+
each(grid, function(row, y) {
|
389
|
+
each(row, function(cell, x) {
|
390
|
+
if (isCellSelected(cell)) {
|
391
|
+
posX = x;
|
392
|
+
|
393
|
+
if (before)
|
394
|
+
return false;
|
395
|
+
}
|
396
|
+
});
|
397
|
+
|
398
|
+
if (before)
|
399
|
+
return !posX;
|
400
|
+
});
|
401
|
+
|
402
|
+
each(grid, function(row, y) {
|
403
|
+
var cell = row[posX].elm, rowSpan, colSpan;
|
404
|
+
|
405
|
+
if (cell != lastCell) {
|
406
|
+
colSpan = getSpanVal(cell, 'colspan');
|
407
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
408
|
+
|
409
|
+
if (colSpan == 1) {
|
410
|
+
if (!before) {
|
411
|
+
dom.insertAfter(cloneCell(cell), cell);
|
412
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
413
|
+
} else {
|
414
|
+
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
415
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
416
|
+
}
|
417
|
+
} else
|
418
|
+
cell.colSpan++;
|
419
|
+
|
420
|
+
lastCell = cell;
|
421
|
+
}
|
422
|
+
});
|
423
|
+
};
|
424
|
+
|
425
|
+
function deleteCols() {
|
426
|
+
var cols = [];
|
427
|
+
|
428
|
+
// Get selected column indexes
|
429
|
+
each(grid, function(row, y) {
|
430
|
+
each(row, function(cell, x) {
|
431
|
+
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
432
|
+
each(grid, function(row) {
|
433
|
+
var cell = row[x].elm, colSpan;
|
434
|
+
|
435
|
+
colSpan = getSpanVal(cell, 'colspan');
|
436
|
+
|
437
|
+
if (colSpan > 1)
|
438
|
+
cell.colSpan = colSpan - 1;
|
439
|
+
else
|
440
|
+
dom.remove(cell);
|
441
|
+
});
|
442
|
+
|
443
|
+
cols.push(x);
|
444
|
+
}
|
445
|
+
});
|
446
|
+
});
|
447
|
+
|
448
|
+
cleanup();
|
449
|
+
};
|
450
|
+
|
451
|
+
function deleteRows() {
|
452
|
+
var rows;
|
453
|
+
|
454
|
+
function deleteRow(tr) {
|
455
|
+
var nextTr, pos, lastCell;
|
456
|
+
|
457
|
+
nextTr = dom.getNext(tr, 'tr');
|
458
|
+
|
459
|
+
// Move down row spanned cells
|
460
|
+
each(tr.cells, function(cell) {
|
461
|
+
var rowSpan = getSpanVal(cell, 'rowspan');
|
462
|
+
|
463
|
+
if (rowSpan > 1) {
|
464
|
+
cell.rowSpan = rowSpan - 1;
|
465
|
+
pos = getPos(cell);
|
466
|
+
fillLeftDown(pos.x, pos.y, 1, 1);
|
467
|
+
}
|
468
|
+
});
|
469
|
+
|
470
|
+
// Delete cells
|
471
|
+
pos = getPos(tr.cells[0]);
|
472
|
+
each(grid[pos.y], function(cell) {
|
473
|
+
var rowSpan;
|
474
|
+
|
475
|
+
cell = cell.elm;
|
476
|
+
|
477
|
+
if (cell != lastCell) {
|
478
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
479
|
+
|
480
|
+
if (rowSpan <= 1)
|
481
|
+
dom.remove(cell);
|
482
|
+
else
|
483
|
+
cell.rowSpan = rowSpan - 1;
|
484
|
+
|
485
|
+
lastCell = cell;
|
486
|
+
}
|
487
|
+
});
|
488
|
+
};
|
489
|
+
|
490
|
+
// Get selected rows and move selection out of scope
|
491
|
+
rows = getSelectedRows();
|
492
|
+
|
493
|
+
// Delete all selected rows
|
494
|
+
each(rows.reverse(), function(tr) {
|
495
|
+
deleteRow(tr);
|
496
|
+
});
|
497
|
+
|
498
|
+
cleanup();
|
499
|
+
};
|
500
|
+
|
501
|
+
function cutRows() {
|
502
|
+
var rows = getSelectedRows();
|
503
|
+
|
504
|
+
dom.remove(rows);
|
505
|
+
cleanup();
|
506
|
+
|
507
|
+
return rows;
|
508
|
+
};
|
509
|
+
|
510
|
+
function copyRows() {
|
511
|
+
var rows = getSelectedRows();
|
512
|
+
|
513
|
+
each(rows, function(row, i) {
|
514
|
+
rows[i] = cloneNode(row, true);
|
515
|
+
});
|
516
|
+
|
517
|
+
return rows;
|
518
|
+
};
|
519
|
+
|
520
|
+
function pasteRows(rows, before) {
|
521
|
+
var selectedRows = getSelectedRows(),
|
522
|
+
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
523
|
+
targetCellCount = targetRow.cells.length;
|
524
|
+
|
525
|
+
// Calc target cell count
|
526
|
+
each(grid, function(row) {
|
527
|
+
var match;
|
528
|
+
|
529
|
+
targetCellCount = 0;
|
530
|
+
each(row, function(cell, x) {
|
531
|
+
if (cell.real)
|
532
|
+
targetCellCount += cell.colspan;
|
533
|
+
|
534
|
+
if (cell.elm.parentNode == targetRow)
|
535
|
+
match = 1;
|
536
|
+
});
|
537
|
+
|
538
|
+
if (match)
|
539
|
+
return false;
|
540
|
+
});
|
541
|
+
|
542
|
+
if (!before)
|
543
|
+
rows.reverse();
|
544
|
+
|
545
|
+
each(rows, function(row) {
|
546
|
+
var cellCount = row.cells.length, cell;
|
547
|
+
|
548
|
+
// Remove col/rowspans
|
549
|
+
for (i = 0; i < cellCount; i++) {
|
550
|
+
cell = row.cells[i];
|
551
|
+
cell.colSpan = cell.rowSpan = 1;
|
552
|
+
}
|
553
|
+
|
554
|
+
// Needs more cells
|
555
|
+
for (i = cellCount; i < targetCellCount; i++)
|
556
|
+
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
557
|
+
|
558
|
+
// Needs less cells
|
559
|
+
for (i = targetCellCount; i < cellCount; i++)
|
560
|
+
dom.remove(row.cells[i]);
|
561
|
+
|
562
|
+
// Add before/after
|
563
|
+
if (before)
|
564
|
+
targetRow.parentNode.insertBefore(row, targetRow);
|
565
|
+
else
|
566
|
+
dom.insertAfter(row, targetRow);
|
567
|
+
});
|
568
|
+
};
|
569
|
+
|
570
|
+
function getPos(target) {
|
571
|
+
var pos;
|
572
|
+
|
573
|
+
each(grid, function(row, y) {
|
574
|
+
each(row, function(cell, x) {
|
575
|
+
if (cell.elm == target) {
|
576
|
+
pos = {x : x, y : y};
|
577
|
+
return false;
|
578
|
+
}
|
579
|
+
});
|
580
|
+
|
581
|
+
return !pos;
|
582
|
+
});
|
583
|
+
|
584
|
+
return pos;
|
585
|
+
};
|
586
|
+
|
587
|
+
function setStartCell(cell) {
|
588
|
+
startPos = getPos(cell);
|
589
|
+
};
|
590
|
+
|
591
|
+
function findEndPos() {
|
592
|
+
var pos, maxX, maxY;
|
593
|
+
|
594
|
+
maxX = maxY = 0;
|
595
|
+
|
596
|
+
each(grid, function(row, y) {
|
597
|
+
each(row, function(cell, x) {
|
598
|
+
var colSpan, rowSpan;
|
599
|
+
|
600
|
+
if (isCellSelected(cell)) {
|
601
|
+
cell = grid[y][x];
|
602
|
+
|
603
|
+
if (x > maxX)
|
604
|
+
maxX = x;
|
605
|
+
|
606
|
+
if (y > maxY)
|
607
|
+
maxY = y;
|
608
|
+
|
609
|
+
if (cell.real) {
|
610
|
+
colSpan = cell.colspan - 1;
|
611
|
+
rowSpan = cell.rowspan - 1;
|
612
|
+
|
613
|
+
if (colSpan) {
|
614
|
+
if (x + colSpan > maxX)
|
615
|
+
maxX = x + colSpan;
|
616
|
+
}
|
617
|
+
|
618
|
+
if (rowSpan) {
|
619
|
+
if (y + rowSpan > maxY)
|
620
|
+
maxY = y + rowSpan;
|
621
|
+
}
|
622
|
+
}
|
623
|
+
}
|
624
|
+
});
|
625
|
+
});
|
626
|
+
|
627
|
+
return {x : maxX, y : maxY};
|
628
|
+
};
|
629
|
+
|
630
|
+
function setEndCell(cell) {
|
631
|
+
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
632
|
+
|
633
|
+
endPos = getPos(cell);
|
634
|
+
|
635
|
+
if (startPos && endPos) {
|
636
|
+
// Get start/end positions
|
637
|
+
startX = Math.min(startPos.x, endPos.x);
|
638
|
+
startY = Math.min(startPos.y, endPos.y);
|
639
|
+
endX = Math.max(startPos.x, endPos.x);
|
640
|
+
endY = Math.max(startPos.y, endPos.y);
|
641
|
+
|
642
|
+
// Expand end positon to include spans
|
643
|
+
maxX = endX;
|
644
|
+
maxY = endY;
|
645
|
+
|
646
|
+
// Expand startX
|
647
|
+
for (y = startY; y <= maxY; y++) {
|
648
|
+
cell = grid[y][startX];
|
649
|
+
|
650
|
+
if (!cell.real) {
|
651
|
+
if (startX - (cell.colspan - 1) < startX)
|
652
|
+
startX -= cell.colspan - 1;
|
653
|
+
}
|
654
|
+
}
|
655
|
+
|
656
|
+
// Expand startY
|
657
|
+
for (x = startX; x <= maxX; x++) {
|
658
|
+
cell = grid[startY][x];
|
659
|
+
|
660
|
+
if (!cell.real) {
|
661
|
+
if (startY - (cell.rowspan - 1) < startY)
|
662
|
+
startY -= cell.rowspan - 1;
|
663
|
+
}
|
664
|
+
}
|
665
|
+
|
666
|
+
// Find max X, Y
|
667
|
+
for (y = startY; y <= endY; y++) {
|
668
|
+
for (x = startX; x <= endX; x++) {
|
669
|
+
cell = grid[y][x];
|
670
|
+
|
671
|
+
if (cell.real) {
|
672
|
+
colSpan = cell.colspan - 1;
|
673
|
+
rowSpan = cell.rowspan - 1;
|
674
|
+
|
675
|
+
if (colSpan) {
|
676
|
+
if (x + colSpan > maxX)
|
677
|
+
maxX = x + colSpan;
|
678
|
+
}
|
679
|
+
|
680
|
+
if (rowSpan) {
|
681
|
+
if (y + rowSpan > maxY)
|
682
|
+
maxY = y + rowSpan;
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}
|
686
|
+
}
|
687
|
+
|
688
|
+
// Remove current selection
|
689
|
+
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
690
|
+
|
691
|
+
// Add new selection
|
692
|
+
for (y = startY; y <= maxY; y++) {
|
693
|
+
for (x = startX; x <= maxX; x++)
|
694
|
+
dom.addClass(grid[y][x].elm, 'mceSelected');
|
695
|
+
}
|
696
|
+
}
|
697
|
+
};
|
698
|
+
|
699
|
+
// Expose to public
|
700
|
+
tinymce.extend(this, {
|
701
|
+
deleteTable : deleteTable,
|
702
|
+
split : split,
|
703
|
+
merge : merge,
|
704
|
+
insertRow : insertRow,
|
705
|
+
insertCol : insertCol,
|
706
|
+
deleteCols : deleteCols,
|
707
|
+
deleteRows : deleteRows,
|
708
|
+
cutRows : cutRows,
|
709
|
+
copyRows : copyRows,
|
710
|
+
pasteRows : pasteRows,
|
711
|
+
getPos : getPos,
|
712
|
+
setStartCell : setStartCell,
|
713
|
+
setEndCell : setEndCell
|
714
|
+
});
|
715
|
+
};
|
716
|
+
|
717
|
+
tinymce.create('tinymce.plugins.TablePlugin', {
|
718
|
+
init : function(ed, url) {
|
719
|
+
var winMan, clipboardRows;
|
720
|
+
|
721
|
+
function createTableGrid(node) {
|
722
|
+
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
723
|
+
|
724
|
+
if (tblElm)
|
725
|
+
return new TableGrid(tblElm, ed.dom, selection);
|
726
|
+
};
|
727
|
+
|
728
|
+
function cleanup() {
|
729
|
+
// Restore selection possibilities
|
730
|
+
ed.getBody().style.webkitUserSelect = '';
|
731
|
+
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
732
|
+
};
|
733
|
+
|
734
|
+
// Register buttons
|
735
|
+
each([
|
736
|
+
['table', 'table.desc', 'mceInsertTable', true],
|
737
|
+
['delete_table', 'table.del', 'mceTableDelete'],
|
738
|
+
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
739
|
+
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
740
|
+
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
741
|
+
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
742
|
+
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
743
|
+
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
744
|
+
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
745
|
+
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
746
|
+
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
747
|
+
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
748
|
+
], function(c) {
|
749
|
+
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
750
|
+
});
|
751
|
+
|
752
|
+
// Select whole table is a table border is clicked
|
753
|
+
if (!tinymce.isIE) {
|
754
|
+
ed.onClick.add(function(ed, e) {
|
755
|
+
e = e.target;
|
756
|
+
|
757
|
+
if (e.nodeName === 'TABLE')
|
758
|
+
ed.selection.select(e);
|
759
|
+
});
|
760
|
+
}
|
761
|
+
|
762
|
+
// Handle node change updates
|
763
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
764
|
+
var p;
|
765
|
+
|
766
|
+
n = ed.selection.getStart();
|
767
|
+
p = ed.dom.getParent(n, 'td,th,caption');
|
768
|
+
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
769
|
+
|
770
|
+
// Disable table tools if we are in caption
|
771
|
+
if (p && p.nodeName === 'CAPTION')
|
772
|
+
p = 0;
|
773
|
+
|
774
|
+
cm.setDisabled('delete_table', !p);
|
775
|
+
cm.setDisabled('delete_col', !p);
|
776
|
+
cm.setDisabled('delete_table', !p);
|
777
|
+
cm.setDisabled('delete_row', !p);
|
778
|
+
cm.setDisabled('col_after', !p);
|
779
|
+
cm.setDisabled('col_before', !p);
|
780
|
+
cm.setDisabled('row_after', !p);
|
781
|
+
cm.setDisabled('row_before', !p);
|
782
|
+
cm.setDisabled('row_props', !p);
|
783
|
+
cm.setDisabled('cell_props', !p);
|
784
|
+
cm.setDisabled('split_cells', !p);
|
785
|
+
cm.setDisabled('merge_cells', !p);
|
786
|
+
});
|
787
|
+
|
788
|
+
ed.onInit.add(function(ed) {
|
789
|
+
var startTable, startCell, dom = ed.dom, tableGrid;
|
790
|
+
|
791
|
+
winMan = ed.windowManager;
|
792
|
+
|
793
|
+
// Add cell selection logic
|
794
|
+
ed.onMouseDown.add(function(ed, e) {
|
795
|
+
if (e.button != 2) {
|
796
|
+
cleanup();
|
797
|
+
|
798
|
+
startCell = dom.getParent(e.target, 'td,th');
|
799
|
+
startTable = dom.getParent(startCell, 'table');
|
800
|
+
}
|
801
|
+
});
|
802
|
+
|
803
|
+
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
804
|
+
var sel, table, target = e.target;
|
805
|
+
|
806
|
+
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
807
|
+
table = dom.getParent(target, 'table');
|
808
|
+
if (table == startTable) {
|
809
|
+
if (!tableGrid) {
|
810
|
+
tableGrid = createTableGrid(table);
|
811
|
+
tableGrid.setStartCell(startCell);
|
812
|
+
|
813
|
+
ed.getBody().style.webkitUserSelect = 'none';
|
814
|
+
}
|
815
|
+
|
816
|
+
tableGrid.setEndCell(target);
|
817
|
+
}
|
818
|
+
|
819
|
+
// Remove current selection
|
820
|
+
sel = ed.selection.getSel();
|
821
|
+
|
822
|
+
if (sel.removeAllRanges)
|
823
|
+
sel.removeAllRanges();
|
824
|
+
else
|
825
|
+
sel.empty();
|
826
|
+
|
827
|
+
e.preventDefault();
|
828
|
+
}
|
829
|
+
});
|
830
|
+
|
831
|
+
ed.onMouseUp.add(function(ed, e) {
|
832
|
+
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
833
|
+
|
834
|
+
// Move selection to startCell
|
835
|
+
if (startCell) {
|
836
|
+
if (tableGrid)
|
837
|
+
ed.getBody().style.webkitUserSelect = '';
|
838
|
+
|
839
|
+
function setPoint(node, start) {
|
840
|
+
var walker = new tinymce.dom.TreeWalker(node, node);
|
841
|
+
|
842
|
+
do {
|
843
|
+
// Text node
|
844
|
+
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
845
|
+
if (start)
|
846
|
+
rng.setStart(node, 0);
|
847
|
+
else
|
848
|
+
rng.setEnd(node, node.nodeValue.length);
|
849
|
+
|
850
|
+
return;
|
851
|
+
}
|
852
|
+
|
853
|
+
// BR element
|
854
|
+
if (node.nodeName == 'BR') {
|
855
|
+
if (start)
|
856
|
+
rng.setStartBefore(node);
|
857
|
+
else
|
858
|
+
rng.setEndBefore(node);
|
859
|
+
|
860
|
+
return;
|
861
|
+
}
|
862
|
+
} while (node = (start ? walker.next() : walker.prev()));
|
863
|
+
};
|
864
|
+
|
865
|
+
// Try to expand text selection as much as we can only Gecko supports cell selection
|
866
|
+
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
867
|
+
if (selectedCells.length > 0) {
|
868
|
+
rng = dom.createRng();
|
869
|
+
node = selectedCells[0];
|
870
|
+
endNode = selectedCells[selectedCells.length - 1];
|
871
|
+
|
872
|
+
setPoint(node, 1);
|
873
|
+
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
874
|
+
|
875
|
+
do {
|
876
|
+
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
877
|
+
if (!dom.hasClass(node, 'mceSelected'))
|
878
|
+
break;
|
879
|
+
|
880
|
+
lastNode = node;
|
881
|
+
}
|
882
|
+
} while (node = walker.next());
|
883
|
+
|
884
|
+
setPoint(lastNode);
|
885
|
+
|
886
|
+
sel.setRng(rng);
|
887
|
+
}
|
888
|
+
|
889
|
+
ed.nodeChanged();
|
890
|
+
startCell = tableGrid = startTable = null;
|
891
|
+
}
|
892
|
+
});
|
893
|
+
|
894
|
+
ed.onKeyUp.add(function(ed, e) {
|
895
|
+
cleanup();
|
896
|
+
});
|
897
|
+
|
898
|
+
// Add context menu
|
899
|
+
if (ed && ed.plugins.contextmenu) {
|
900
|
+
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
901
|
+
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
902
|
+
|
903
|
+
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
904
|
+
m.removeAll();
|
905
|
+
|
906
|
+
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
907
|
+
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
908
|
+
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
909
|
+
m.addSeparator();
|
910
|
+
}
|
911
|
+
|
912
|
+
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
913
|
+
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
914
|
+
m.addSeparator();
|
915
|
+
}
|
916
|
+
|
917
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
918
|
+
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
919
|
+
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
920
|
+
m.addSeparator();
|
921
|
+
|
922
|
+
// Cell menu
|
923
|
+
sm = m.addMenu({title : 'table.cell'});
|
924
|
+
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
925
|
+
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
926
|
+
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
927
|
+
|
928
|
+
// Row menu
|
929
|
+
sm = m.addMenu({title : 'table.row'});
|
930
|
+
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
931
|
+
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
932
|
+
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
933
|
+
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
934
|
+
sm.addSeparator();
|
935
|
+
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
936
|
+
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
937
|
+
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
938
|
+
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
939
|
+
|
940
|
+
// Column menu
|
941
|
+
sm = m.addMenu({title : 'table.col'});
|
942
|
+
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
943
|
+
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
944
|
+
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
945
|
+
} else
|
946
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
947
|
+
});
|
948
|
+
}
|
949
|
+
|
950
|
+
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
951
|
+
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
952
|
+
if (!tinymce.isIE) {
|
953
|
+
function fixTableCaretPos() {
|
954
|
+
var last;
|
955
|
+
|
956
|
+
// Skip empty text nodes form the end
|
957
|
+
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
958
|
+
|
959
|
+
if (last && last.nodeName == 'TABLE')
|
960
|
+
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
961
|
+
};
|
962
|
+
|
963
|
+
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
964
|
+
// this fix solves it by detecting when the caret is at the beginning of such a table
|
965
|
+
// and then manually moves the caret infront of the table
|
966
|
+
if (tinymce.isGecko) {
|
967
|
+
ed.onKeyDown.add(function(ed, e) {
|
968
|
+
var rng, table, dom = ed.dom;
|
969
|
+
|
970
|
+
// On gecko it's not possible to place the caret before a table
|
971
|
+
if (e.keyCode == 37 || e.keyCode == 38) {
|
972
|
+
rng = ed.selection.getRng();
|
973
|
+
table = dom.getParent(rng.startContainer, 'table');
|
974
|
+
|
975
|
+
if (table && ed.getBody().firstChild == table) {
|
976
|
+
if (isAtStart(rng, table)) {
|
977
|
+
rng = dom.createRng();
|
978
|
+
|
979
|
+
rng.setStartBefore(table);
|
980
|
+
rng.setEndBefore(table);
|
981
|
+
|
982
|
+
ed.selection.setRng(rng);
|
983
|
+
|
984
|
+
e.preventDefault();
|
985
|
+
}
|
986
|
+
}
|
987
|
+
}
|
988
|
+
});
|
989
|
+
}
|
990
|
+
|
991
|
+
ed.onKeyUp.add(fixTableCaretPos);
|
992
|
+
ed.onSetContent.add(fixTableCaretPos);
|
993
|
+
ed.onVisualAid.add(fixTableCaretPos);
|
994
|
+
|
995
|
+
ed.onPreProcess.add(function(ed, o) {
|
996
|
+
var last = o.node.lastChild;
|
997
|
+
|
998
|
+
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
999
|
+
ed.dom.remove(last);
|
1000
|
+
});
|
1001
|
+
|
1002
|
+
fixTableCaretPos();
|
1003
|
+
}
|
1004
|
+
});
|
1005
|
+
|
1006
|
+
// Register action commands
|
1007
|
+
each({
|
1008
|
+
mceTableSplitCells : function(grid) {
|
1009
|
+
grid.split();
|
1010
|
+
},
|
1011
|
+
|
1012
|
+
mceTableMergeCells : function(grid) {
|
1013
|
+
var rowSpan, colSpan, cell;
|
1014
|
+
|
1015
|
+
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
1016
|
+
if (cell) {
|
1017
|
+
rowSpan = cell.rowSpan;
|
1018
|
+
colSpan = cell.colSpan;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1022
|
+
winMan.open({
|
1023
|
+
url : url + '/merge_cells.htm',
|
1024
|
+
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
1025
|
+
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
1026
|
+
inline : 1
|
1027
|
+
}, {
|
1028
|
+
rows : rowSpan,
|
1029
|
+
cols : colSpan,
|
1030
|
+
onaction : function(data) {
|
1031
|
+
grid.merge(cell, data.cols, data.rows);
|
1032
|
+
},
|
1033
|
+
plugin_url : url
|
1034
|
+
});
|
1035
|
+
} else
|
1036
|
+
grid.merge();
|
1037
|
+
},
|
1038
|
+
|
1039
|
+
mceTableInsertRowBefore : function(grid) {
|
1040
|
+
grid.insertRow(true);
|
1041
|
+
},
|
1042
|
+
|
1043
|
+
mceTableInsertRowAfter : function(grid) {
|
1044
|
+
grid.insertRow();
|
1045
|
+
},
|
1046
|
+
|
1047
|
+
mceTableInsertColBefore : function(grid) {
|
1048
|
+
grid.insertCol(true);
|
1049
|
+
},
|
1050
|
+
|
1051
|
+
mceTableInsertColAfter : function(grid) {
|
1052
|
+
grid.insertCol();
|
1053
|
+
},
|
1054
|
+
|
1055
|
+
mceTableDeleteCol : function(grid) {
|
1056
|
+
grid.deleteCols();
|
1057
|
+
},
|
1058
|
+
|
1059
|
+
mceTableDeleteRow : function(grid) {
|
1060
|
+
grid.deleteRows();
|
1061
|
+
},
|
1062
|
+
|
1063
|
+
mceTableCutRow : function(grid) {
|
1064
|
+
clipboardRows = grid.cutRows();
|
1065
|
+
},
|
1066
|
+
|
1067
|
+
mceTableCopyRow : function(grid) {
|
1068
|
+
clipboardRows = grid.copyRows();
|
1069
|
+
},
|
1070
|
+
|
1071
|
+
mceTablePasteRowBefore : function(grid) {
|
1072
|
+
grid.pasteRows(clipboardRows, true);
|
1073
|
+
},
|
1074
|
+
|
1075
|
+
mceTablePasteRowAfter : function(grid) {
|
1076
|
+
grid.pasteRows(clipboardRows);
|
1077
|
+
},
|
1078
|
+
|
1079
|
+
mceTableDelete : function(grid) {
|
1080
|
+
grid.deleteTable();
|
1081
|
+
}
|
1082
|
+
}, function(func, name) {
|
1083
|
+
ed.addCommand(name, function() {
|
1084
|
+
var grid = createTableGrid();
|
1085
|
+
|
1086
|
+
if (grid) {
|
1087
|
+
func(grid);
|
1088
|
+
ed.execCommand('mceRepaint');
|
1089
|
+
cleanup();
|
1090
|
+
}
|
1091
|
+
});
|
1092
|
+
});
|
1093
|
+
|
1094
|
+
// Register dialog commands
|
1095
|
+
each({
|
1096
|
+
mceInsertTable : function(val) {
|
1097
|
+
winMan.open({
|
1098
|
+
url : url + '/table.htm',
|
1099
|
+
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
1100
|
+
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
1101
|
+
inline : 1
|
1102
|
+
}, {
|
1103
|
+
plugin_url : url,
|
1104
|
+
action : val ? val.action : 0
|
1105
|
+
});
|
1106
|
+
},
|
1107
|
+
|
1108
|
+
mceTableRowProps : function() {
|
1109
|
+
winMan.open({
|
1110
|
+
url : url + '/row.htm',
|
1111
|
+
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
1112
|
+
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
1113
|
+
inline : 1
|
1114
|
+
}, {
|
1115
|
+
plugin_url : url
|
1116
|
+
});
|
1117
|
+
},
|
1118
|
+
|
1119
|
+
mceTableCellProps : function() {
|
1120
|
+
winMan.open({
|
1121
|
+
url : url + '/cell.htm',
|
1122
|
+
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
1123
|
+
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
1124
|
+
inline : 1
|
1125
|
+
}, {
|
1126
|
+
plugin_url : url
|
1127
|
+
});
|
1128
|
+
}
|
1129
|
+
}, function(func, name) {
|
1130
|
+
ed.addCommand(name, function(ui, val) {
|
1131
|
+
func(val);
|
1132
|
+
});
|
1133
|
+
});
|
1134
|
+
}
|
1135
|
+
});
|
1136
|
+
|
1137
|
+
// Register plugin
|
1138
|
+
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
1139
|
+
})(tinymce);
|