skylinecms 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/CHANGELOG +51 -1
- data/Gemfile +8 -0
- data/Rakefile +0 -43
- data/app/controllers/skyline/application_controller.rb +30 -26
- data/app/controllers/skyline/articles_controller.rb +8 -28
- data/app/controllers/skyline/authentications_controller.rb +6 -8
- data/app/controllers/skyline/browser/links_controller.rb +12 -8
- data/app/controllers/skyline/browser/tabs/linkables_controller.rb +9 -0
- data/app/controllers/skyline/browser/tabs/media_library/media_files_controller.rb +0 -12
- data/app/controllers/skyline/content/editors/editable_list_controller.rb +0 -4
- data/app/controllers/skyline/content/editors/joinable_list_controller.rb +1 -19
- data/app/controllers/skyline/content_controller.rb +14 -30
- data/app/controllers/skyline/content_items_controller.rb +3 -9
- data/app/controllers/skyline/content_sections_controller.rb +3 -10
- data/app/controllers/skyline/link_section_links_controller.rb +2 -10
- data/app/controllers/skyline/media/data_controller.rb +24 -14
- data/app/controllers/skyline/media/dirs_controller.rb +12 -26
- data/app/controllers/skyline/media/files_controller.rb +12 -28
- data/app/controllers/skyline/publications_controller.rb +0 -12
- data/app/controllers/skyline/published_publications_controller.rb +0 -4
- data/app/controllers/skyline/sections_controller.rb +4 -18
- data/app/controllers/skyline/site/media_files_data_controller.rb +11 -13
- data/app/controllers/skyline/site/pages_controller.rb +4 -3
- data/app/controllers/skyline/skyline2_controller.rb +1 -1
- data/app/controllers/skyline/users_controller.rb +7 -31
- data/app/controllers/skyline/variant_current_editor_controller.rb +5 -5
- data/app/controllers/skyline/variants_controller.rb +3 -3
- data/app/helpers/skyline/application_helper.rb +16 -5
- data/app/helpers/skyline/button_helper.rb +12 -18
- data/app/helpers/skyline/content_helper.rb +11 -11
- data/app/helpers/skyline/dialog_helper.rb +3 -2
- data/app/helpers/skyline/editors/checkable_list.rb +4 -2
- data/app/helpers/skyline/editors/date_time.rb +1 -1
- data/app/helpers/skyline/editors/display.rb +1 -1
- data/app/helpers/skyline/editors/editable_list.rb +13 -8
- data/app/helpers/skyline/editors/editor.rb +10 -10
- data/app/helpers/skyline/editors/list.rb +2 -2
- data/app/helpers/skyline/editors/page_browser.rb +1 -0
- data/app/helpers/skyline/editors/wysiwyg.rb +2 -3
- data/app/helpers/skyline/form_helper.rb +36 -0
- data/app/helpers/skyline/media/files_helper.rb +1 -1
- data/app/helpers/skyline/message_generator.rb +13 -4
- data/app/helpers/skyline/pages_helper.rb +1 -1
- data/app/helpers/skyline/plugin_helper.rb +1 -1
- data/app/helpers/skyline/presenters/presenter.rb +12 -8
- data/app/helpers/skyline/ref_object_helper.rb +9 -7
- data/app/helpers/skyline/translation_helper.rb +1 -1
- data/app/helpers/skyline/tree_helper.rb +1 -3
- data/app/middleware/skyline/flash_session_cookie_middleware.rb +6 -1
- data/app/middleware/skyline/plugins_loader_middleware.rb +1 -1
- data/app/middleware/skyline/sprockets_middleware.rb +1 -1
- data/app/models/skyline/article.rb +94 -26
- data/app/models/skyline/article_version.rb +22 -9
- data/app/models/skyline/image_ref.rb +1 -1
- data/app/models/skyline/inline_ref.rb +78 -62
- data/app/models/skyline/link_ref.rb +1 -1
- data/app/models/skyline/media_cache.rb +4 -2
- data/app/models/skyline/media_file.rb +2 -5
- data/app/models/skyline/media_node.rb +2 -2
- data/app/models/skyline/object_ref.rb +2 -2
- data/app/models/skyline/page.rb +8 -6
- data/app/models/skyline/page_fragment.rb +4 -2
- data/app/models/skyline/publication.rb +1 -1
- data/app/models/skyline/sections/content_collection_section.rb +1 -1
- data/app/models/skyline/sections/link_section.rb +1 -1
- data/app/models/skyline/user.rb +17 -7
- data/app/models/skyline/user_preference.rb +1 -1
- data/app/models/skyline/variant.rb +11 -5
- data/app/templates/skyline/page/default/index.html.erb +1 -1
- data/app/templates/skyline/sections/raw_section/default/index.html.erb +1 -1
- data/app/templates/skyline/sections/wysiwyg_section/default/index.html.erb +1 -1
- data/app/views/skyline/articles/_currently_editing.html.erb +1 -1
- data/app/views/skyline/articles/_meta.html.erb +24 -11
- data/app/views/skyline/articles/_security.html.erb +2 -2
- data/app/views/skyline/articles/_takeover_action.html.erb +1 -1
- data/app/views/skyline/articles/edit.html.erb +29 -16
- data/app/views/skyline/articles/edit_preview_only.html.erb +2 -2
- data/app/views/skyline/articles/index.html.erb +2 -2
- data/app/views/skyline/articles/page/_header.html.erb +1 -1
- data/app/views/skyline/articles/page/_index.html.erb +9 -3
- data/app/views/skyline/articles/page_fragment/_index.html.erb +7 -2
- data/app/views/skyline/articles/update.js.erb +20 -0
- data/app/views/skyline/authentications/new.html.erb +1 -1
- data/app/views/skyline/browser/links/_index.html.erb +2 -0
- data/app/views/skyline/browser/tabs/linkables/_index.html.erb +29 -0
- data/app/views/skyline/browser/tabs/linkables/_show.html.erb +67 -0
- data/app/views/skyline/browser/tabs/linkables/show.js.erb +4 -0
- data/app/views/skyline/browser/tabs/media_library/_index.html.erb +2 -2
- data/app/views/skyline/browser/tabs/media_library/media_files/_index.html.erb +4 -35
- data/app/views/skyline/browser/tabs/media_library/media_files/_show.html.erb +1 -3
- data/app/views/skyline/browser/tabs/media_library/media_files/index.js.erb +1 -0
- data/app/views/skyline/browser/tabs/media_library/media_files/show.js.erb +1 -0
- data/app/views/skyline/browser/tabs/pages/_index.html.erb +1 -1
- data/app/views/skyline/content/_add.rhtml +6 -1
- data/app/views/skyline/content/_filter.rhtml +1 -1
- data/app/views/skyline/content/_import.html.erb +1 -1
- data/app/views/skyline/content/_index.html.erb +2 -2
- data/app/views/skyline/content/_meta.html.erb +2 -2
- data/app/views/skyline/content/create.rhtml +1 -1
- data/app/views/skyline/content/edit.rhtml +1 -1
- data/app/views/skyline/content/editors/editable_list/new.js.erb +2 -0
- data/app/views/skyline/content/editors/joinable_list/_add.html.erb +17 -10
- data/app/views/skyline/content/editors/joinable_list/_list.html.erb +24 -8
- data/app/views/skyline/content/editors/joinable_list/cancel.js.erb +1 -0
- data/app/views/skyline/content/editors/joinable_list/index.js.erb +1 -0
- data/app/views/skyline/content/editors/joinable_list/new.js.erb +5 -0
- data/app/views/skyline/content/field.js.erb +2 -0
- data/app/views/skyline/content/import.js.erb +4 -0
- data/app/views/skyline/content/order.js.erb +6 -0
- data/app/views/skyline/content/presenters/_table.html.erb +1 -1
- data/app/views/skyline/content_items/_content_item.html.erb +2 -2
- data/app/views/skyline/content_items/new.js.erb +6 -0
- data/app/views/skyline/content_sections/_tags.html.erb +2 -2
- data/app/views/skyline/content_sections/new.js.erb +6 -0
- data/app/views/skyline/link_section_links/_form.html.erb +1 -1
- data/app/views/skyline/link_section_links/new.js.erb +4 -0
- data/app/views/skyline/locales/show.js.erb +3 -3
- data/app/views/skyline/media/dirs/_edit.html.erb +9 -7
- data/app/views/skyline/media/dirs/edit.js.erb +1 -0
- data/app/views/skyline/media/dirs/index.html.erb +16 -6
- data/app/views/skyline/media/dirs/index.js.erb +6 -0
- data/app/views/skyline/media/dirs/show.js.erb +5 -0
- data/app/views/skyline/media/files/_edit.html.erb +13 -11
- data/app/views/skyline/media/files/_index.html.erb +2 -2
- data/app/views/skyline/media/files/_new.html.erb +2 -2
- data/app/views/skyline/media/files/edit.js.erb +4 -0
- data/app/views/skyline/media/files/index.js.erb +4 -0
- data/app/views/skyline/media/files/update.js.erb +8 -0
- data/app/views/skyline/publications/_index.html.erb +2 -2
- data/app/views/skyline/publications/index.js.erb +9 -0
- data/app/views/skyline/sections/_content_collection_section.html.erb +6 -6
- data/app/views/skyline/sections/_content_item_section.html.erb +1 -1
- data/app/views/skyline/sections/_form.html.erb +4 -4
- data/app/views/skyline/sections/_link_section.html.erb +6 -1
- data/app/views/skyline/sections/_splitter_section.html.erb +1 -1
- data/app/views/skyline/sections/_wysiwyg_section.html.erb +2 -2
- data/app/views/skyline/sections/new.js.erb +12 -0
- data/app/views/skyline/settings/edit.html.erb +1 -1
- data/app/views/skyline/shared/_head.html.erb +3 -0
- data/app/views/skyline/shared/_header_area.html.erb +5 -5
- data/app/views/skyline/users/_edit.html.erb +1 -1
- data/app/views/skyline/users/_form.html.erb +1 -1
- data/app/views/skyline/users/_new.html.erb +1 -1
- data/app/views/skyline/users/create.js.erb +2 -0
- data/app/views/skyline/users/edit.js.erb +1 -0
- data/app/views/skyline/users/index.html.erb +21 -6
- data/app/views/skyline/users/new.js.erb +1 -0
- data/app/views/skyline/users/update.js.erb +2 -0
- data/config/initializers/dependencies.rb +1 -17
- data/config/initializers/gem_dependencies.rb +10 -0
- data/config/initializers/locales.rb +8 -1
- data/config/initializers/middlewares.rb +7 -3
- data/config/initializers/observers.rb +6 -4
- data/config/locales/en-US.yml +44 -34
- data/config/locales/nl-NL.yml +45 -33
- data/config/routes.rb +65 -74
- data/db/migrate/20090508145820_create_skyline_pages.rb +2 -2
- data/db/migrate/20090508145852_create_skyline_page_versions.rb +2 -2
- data/db/migrate/20090508150149_create_skyline_sections.rb +1 -1
- data/db/migrate/20090610142139_add_skyline_tags_taggable_type.rb +2 -2
- data/db/migrate/20090624154251_create_skyline_link_section_links.rb +1 -1
- data/db/migrate/20100120113953_remove_unused_articles_index.rb +1 -1
- data/db/migrate/20110816080626_add_skyline_test_article_data.rb +13 -0
- data/db/migrate/20111101092405_rename_indexes.rb +24 -0
- data/doc/INSTALL.md +54 -27
- data/doc/MIGRATION.md +27 -2
- data/lib/skyline.rb +2 -1
- data/lib/skyline/authentication/user.rb +80 -0
- data/lib/skyline/belongs_to_referable.rb +1 -1
- data/lib/skyline/cli/init.rb +14 -26
- data/lib/skyline/cli/init/templates/config/initializers/skyline_configuration.rb +0 -1
- data/lib/skyline/configuration.rb +74 -32
- data/lib/skyline/content/content.rb +7 -6
- data/lib/skyline/content/field_meta_data.rb +2 -2
- data/lib/skyline/content/stack.rb +1 -1
- data/lib/skyline/content_item_section_selectable.rb +4 -4
- data/lib/skyline/deprecated/version3_0_8.rb +2 -2
- data/lib/skyline/engine.rb +37 -0
- data/lib/skyline/form_builder.rb +8 -8
- data/lib/skyline/linkable.rb +28 -0
- data/lib/skyline/plugins/manager.rb +77 -0
- data/lib/skyline/plugins/plugin.rb +89 -0
- data/lib/skyline/rendering/helpers/renderer_helper.rb +1 -1
- data/lib/skyline/rendering/renderer.rb +27 -13
- data/lib/skyline/route_constraint.rb +15 -0
- data/lib/skyline/settings.rb +9 -7
- data/lib/skyline/taggable.rb +2 -2
- data/lib/skyline/version.rb +4 -4
- data/lib/skylinecms.rb +5 -3
- data/lib/tasks/database.rake +2 -2
- data/public/skyline/javascripts/src/application.js +5 -4
- data/public/skyline/javascripts/src/rails.js +165 -0
- data/public/skyline/javascripts/src/sections.js +6 -9
- data/public/skyline/javascripts/src/skyline.editor/src/plugins/autoresize/editor_plugin.js +72 -27
- data/public/skyline/javascripts/src/skyline.editor/src/plugins/skylineimage/dialog.js +13 -12
- data/public/skyline/javascripts/src/skyline.editor/src/plugins/skylinelink/dialog.js +7 -7
- data/public/skyline/javascripts/src/skyline.editor/src/skyline.editor.js +4 -3
- data/public/skyline/javascripts/src/skyline.editor/src/theme.js +101 -536
- data/public/skyline/javascripts/src/skyline.editor/test/multiple_editors.html +1 -0
- data/public/skyline/javascripts/src/skyline.editor/test/single.html +56 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/changelog.txt +1410 -1091
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/accessibility.html +101 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/custom_formats.html +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/full.html +12 -12
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/lists/media_list.js +5 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/media/sample.flv +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/menu.html +2 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/skins.html +4 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/word.html +3 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/langs/en.js +1 -170
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en_dlg.js +1 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/rule.htm +30 -29
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/image.htm +34 -31
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js +32 -13
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en_dlg.js +1 -43
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js +21 -17
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en_dlg.js +1 -52
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm +35 -30
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js +31 -9
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin_src.js +172 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +23 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js +14 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +34 -21
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/emotions.htm +15 -14
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en_dlg.js +1 -20
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js +50 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css +3 -42
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +315 -63
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm +18 -330
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js +199 -438
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +1 -85
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +12 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm +2 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +80 -16
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js +2 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +31 -28
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js +781 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/css/media.css +5 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin_src.js +703 -295
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/js/media.js +361 -602
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/langs/en_dlg.js +1 -103
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/media.htm +365 -285
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +4 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +7 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +1 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js +148 -239
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/langs/en_dlg.js +1 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +4 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +18 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +1 -16
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/searchreplace.htm +17 -16
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +55 -38
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/js/props.js +3 -9
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/langs/en_dlg.js +1 -63
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/props.htm +515 -398
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +122 -112
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/cell.htm +16 -14
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js +1364 -1139
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js +44 -11
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/row.js +18 -18
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/table.js +15 -14
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/langs/en_dlg.js +1 -74
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/merge_cells.htm +11 -11
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/row.htm +12 -9
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/table.htm +54 -53
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/js/template.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/langs/en_dlg.js +1 -15
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +36 -20
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +6 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +6 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +6 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/cite.htm +5 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/del.htm +9 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +6 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/ins.htm +11 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +1 -16
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/del.js +2 -12
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +3 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +4 -13
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +1 -32
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/about.htm +3 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/anchor.htm +5 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/charmap.htm +39 -40
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm +10 -9
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js +195 -54
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/image.htm +51 -51
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/flash.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/iframe.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/{plugins/pagebreak → themes/advanced}/img/pagebreak.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/{plugins/media → themes/advanced}/img/realmedia.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/{plugins/media → themes/advanced}/img/trans.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/video.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/{plugins/media → themes/advanced}/img/windowsmedia.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/about.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/anchor.js +5 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/charmap.js +26 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/color_picker.js +108 -32
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/image.js +12 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js +4 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js +6 -12
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en.js +1 -62
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js +1 -51
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/link.htm +27 -28
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/shortcuts.htm +47 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css +14 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/ui.css +5 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/content.css +24 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +105 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css +102 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css +12 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +8 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/source_editor.htm +3 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/editor_template.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js +1 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/langs/en.js +1 -11
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_src.js +7838 -5579
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/editable_selects.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/form_utils.js +14 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/mctabs.js +95 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/validate.js +35 -3
- data/public/skyline/javascripts/src/skyline/src/drag.js +10 -7
- data/public/skyline/javascripts/src/skyline/src/layout.js +13 -12
- data/public/skyline/javascripts/src/skyline/src/menubutton.js +1 -3
- data/public/skyline/javascripts/src/skyline/src/sortable.js +7 -5
- data/public/skyline/javascripts/src/skyline/src/tree.js +8 -4
- data/public/skyline/javascripts/src/skyline/test/sortable.html +73 -12
- data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-core.js +485 -2
- data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-more.js +130 -81
- data/public/skyline/stylesheets/general.css +23 -6
- data/skylinecms.gemspec +45 -0
- data/test/mocks/test_article.rb +11 -0
- data/test/mocks/test_section.rb +1 -1
- data/test/test_helper.rb +2 -1
- data/test/unit/article_test.rb +142 -0
- data/test/unit/inline_ref_test.rb +38 -16
- data/test/unit/test_content_object_test.rb +2 -1
- data/vendor/digitpaint/nested_attributes_positioning.rb +1 -1
- metadata +207 -487
- data/app/helpers/skyline/media_files_helper.rb +0 -7
- data/config/initializers/javascript_generator_methods.rb +0 -4
- data/config/initializers/rails_defaults.rb +0 -6
- data/doc/Bundler.md +0 -76
- data/lib/skyline/plugins_manager.rb +0 -150
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/translate.html +0 -84
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/css/content.css +0 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/css/content.css +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/rails/init.rb +0 -32
- data/vendor/digitpaint/personify/README.md +0 -86
- data/vendor/digitpaint/personify/lib/parser/personify.rb +0 -838
- data/vendor/digitpaint/personify/lib/parser/personify.treetop +0 -126
- data/vendor/digitpaint/personify/lib/parser/personify_node_classes.rb +0 -7
- data/vendor/digitpaint/personify/lib/template.rb +0 -16
- data/vendor/digitpaint/personify/personify.rb +0 -7
- data/vendor/digitpaint/personify/script/generate_parser.rb +0 -6
- data/vendor/digitpaint/personify/test/fixtures/multiple_tags.txt +0 -8
- data/vendor/digitpaint/personify/test/parse_runner.rb +0 -25
- data/vendor/digitpaint/personify/test/parser_test.rb +0 -109
- data/vendor/digitpaint/personify/test/test_helper.rb +0 -16
- data/vendor/digitpaint/personify/vendor/treetop/.gitignore +0 -5
- data/vendor/digitpaint/personify/vendor/treetop/History.txt +0 -9
- data/vendor/digitpaint/personify/vendor/treetop/README +0 -164
- data/vendor/digitpaint/personify/vendor/treetop/Rakefile +0 -20
- data/vendor/digitpaint/personify/vendor/treetop/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +0 -20
- data/vendor/digitpaint/personify/vendor/treetop/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +0 -18
- data/vendor/digitpaint/personify/vendor/treetop/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +0 -251
- data/vendor/digitpaint/personify/vendor/treetop/Treetop.tmbundle/info.plist +0 -10
- data/vendor/digitpaint/personify/vendor/treetop/bin/tt +0 -28
- data/vendor/digitpaint/personify/vendor/treetop/doc/contributing_and_planned_features.markdown +0 -103
- data/vendor/digitpaint/personify/vendor/treetop/doc/grammar_composition.markdown +0 -65
- data/vendor/digitpaint/personify/vendor/treetop/doc/index.markdown +0 -90
- data/vendor/digitpaint/personify/vendor/treetop/doc/pitfalls_and_advanced_techniques.markdown +0 -51
- data/vendor/digitpaint/personify/vendor/treetop/doc/semantic_interpretation.markdown +0 -189
- data/vendor/digitpaint/personify/vendor/treetop/doc/site.rb +0 -110
- data/vendor/digitpaint/personify/vendor/treetop/doc/sitegen.rb +0 -60
- data/vendor/digitpaint/personify/vendor/treetop/doc/syntactic_recognition.markdown +0 -100
- data/vendor/digitpaint/personify/vendor/treetop/doc/using_in_ruby.markdown +0 -21
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/arithmetic.rb +0 -551
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/arithmetic.treetop +0 -97
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/arithmetic_node_classes.rb +0 -7
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/arithmetic_test.rb +0 -54
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/lambda_calculus +0 -0
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/lambda_calculus.rb +0 -718
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/lambda_calculus.treetop +0 -132
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/lambda_calculus_node_classes.rb +0 -5
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/lambda_calculus_test.rb +0 -89
- data/vendor/digitpaint/personify/vendor/treetop/examples/lambda_calculus/test_helper.rb +0 -18
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop.rb +0 -11
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler.rb +0 -6
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -40
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -2955
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -404
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -20
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -22
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime.rb +0 -5
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -95
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
- data/vendor/digitpaint/personify/vendor/treetop/lib/treetop/version.rb +0 -9
- data/vendor/digitpaint/personify/vendor/treetop/script/generate_metagrammar.rb +0 -14
- data/vendor/digitpaint/personify/vendor/treetop/script/svnadd +0 -11
- data/vendor/digitpaint/personify/vendor/treetop/script/svnrm +0 -11
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -52
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/character_class_spec.rb +0 -188
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
- data/vendor/digitpaint/personify/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
- data/vendor/digitpaint/personify/vendor/treetop/spec/composition/a.treetop +0 -11
- data/vendor/digitpaint/personify/vendor/treetop/spec/composition/b.treetop +0 -11
- data/vendor/digitpaint/personify/vendor/treetop/spec/composition/c.treetop +0 -10
- data/vendor/digitpaint/personify/vendor/treetop/spec/composition/d.treetop +0 -10
- data/vendor/digitpaint/personify/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -26
- data/vendor/digitpaint/personify/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
- data/vendor/digitpaint/personify/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
- data/vendor/digitpaint/personify/vendor/treetop/spec/spec_helper.rb +0 -106
- data/vendor/digitpaint/personify/vendor/treetop/spec/spec_suite.rb +0 -4
- data/vendor/digitpaint/personify/vendor/treetop/treetop.gemspec +0 -18
- data/vendor/mootools-on-rails/README +0 -54
- data/vendor/mootools-on-rails/Rakefile +0 -22
- data/vendor/mootools-on-rails/lib/mootools_on_rails.rb +0 -30
- data/vendor/mootools-on-rails/lib/mootools_on_rails/mootools_helper.rb +0 -510
- data/vendor/mootools-on-rails/test/mootools_helper_test.rb +0 -138
- data/vendor/mootools-on-rails/test/test_helper.rb +0 -5
@@ -1 +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(
|
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(t){n=c.select(":input:enabled,*[tabindex]");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){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(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){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)}},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)})();
|
@@ -1,112 +1,122 @@
|
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
+
el = DOM.select(':input:enabled,*[tabindex]');
|
26
|
+
|
27
|
+
function canSelectRecursive(e) {
|
28
|
+
return e.nodeName==="BODY" || (e.type != 'hidden' &&
|
29
|
+
!(e.style.display == "none") &&
|
30
|
+
!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
|
31
|
+
}
|
32
|
+
function canSelectInOldIe(el) {
|
33
|
+
return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
|
34
|
+
}
|
35
|
+
function isOldIe() {
|
36
|
+
return tinymce.isIE6 || tinymce.isIE7;
|
37
|
+
}
|
38
|
+
function canSelect(el) {
|
39
|
+
return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
|
40
|
+
}
|
41
|
+
|
42
|
+
each(el, function(e, i) {
|
43
|
+
if (e.id == ed.id) {
|
44
|
+
x = i;
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
});
|
48
|
+
if (d > 0) {
|
49
|
+
for (i = x + 1; i < el.length; i++) {
|
50
|
+
if (canSelect(el[i]))
|
51
|
+
return el[i];
|
52
|
+
}
|
53
|
+
} else {
|
54
|
+
for (i = x - 1; i >= 0; i--) {
|
55
|
+
if (canSelect(el[i]))
|
56
|
+
return el[i];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
return null;
|
61
|
+
}
|
62
|
+
|
63
|
+
if (e.keyCode === 9) {
|
64
|
+
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
65
|
+
|
66
|
+
if (v.length == 1) {
|
67
|
+
v[1] = v[0];
|
68
|
+
v[0] = ':prev';
|
69
|
+
}
|
70
|
+
|
71
|
+
// Find element to focus
|
72
|
+
if (e.shiftKey) {
|
73
|
+
if (v[0] == ':prev')
|
74
|
+
el = find(-1);
|
75
|
+
else
|
76
|
+
el = DOM.get(v[0]);
|
77
|
+
} else {
|
78
|
+
if (v[1] == ':next')
|
79
|
+
el = find(1);
|
80
|
+
else
|
81
|
+
el = DOM.get(v[1]);
|
82
|
+
}
|
83
|
+
|
84
|
+
if (el) {
|
85
|
+
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
86
|
+
ed.focus();
|
87
|
+
else
|
88
|
+
window.setTimeout(function() {
|
89
|
+
if (!tinymce.isWebKit)
|
90
|
+
window.focus();
|
91
|
+
el.focus();
|
92
|
+
}, 10);
|
93
|
+
|
94
|
+
return Event.cancel(e);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
ed.onKeyUp.add(tabCancel);
|
100
|
+
|
101
|
+
if (tinymce.isGecko) {
|
102
|
+
ed.onKeyPress.add(tabHandler);
|
103
|
+
ed.onKeyDown.add(tabCancel);
|
104
|
+
} else
|
105
|
+
ed.onKeyDown.add(tabHandler);
|
106
|
+
|
107
|
+
},
|
108
|
+
|
109
|
+
getInfo : function() {
|
110
|
+
return {
|
111
|
+
longname : 'Tabfocus',
|
112
|
+
author : 'Moxiecode Systems AB',
|
113
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
114
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
115
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
116
|
+
};
|
117
|
+
}
|
118
|
+
});
|
119
|
+
|
120
|
+
// Register plugin
|
121
|
+
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
122
|
+
})();
|
@@ -5,16 +5,17 @@
|
|
5
5
|
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
6
6
|
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
7
7
|
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
8
|
+
<script type="text/javascript" src="../../utils/validate.js"></script>
|
8
9
|
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
9
10
|
<script type="text/javascript" src="js/cell.js"></script>
|
10
11
|
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
11
12
|
</head>
|
12
|
-
<body id="tablecell" style="display: none">
|
13
|
+
<body id="tablecell" style="display: none" role="application">
|
13
14
|
<form onsubmit="updateAction();return false;" action="#">
|
14
15
|
<div class="tabs">
|
15
16
|
<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>
|
17
|
+
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
18
|
+
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
18
19
|
</ul>
|
19
20
|
</div>
|
20
21
|
|
@@ -23,7 +24,7 @@
|
|
23
24
|
<fieldset>
|
24
25
|
<legend>{#table_dlg.general_props}</legend>
|
25
26
|
|
26
|
-
<table border="0" cellpadding="4" cellspacing="0">
|
27
|
+
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
27
28
|
<tr>
|
28
29
|
<td><label for="align">{#table_dlg.align}</label></td>
|
29
30
|
<td>
|
@@ -70,10 +71,10 @@
|
|
70
71
|
|
71
72
|
<tr>
|
72
73
|
<td><label for="width">{#table_dlg.width}</label></td>
|
73
|
-
<td><input id="width" name="width" type="text" value="" size="
|
74
|
+
<td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
74
75
|
|
75
76
|
<td><label for="height">{#table_dlg.height}</label></td>
|
76
|
-
<td><input id="height" name="height" type="text" value="" size="
|
77
|
+
<td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
77
78
|
</tr>
|
78
79
|
|
79
80
|
<tr id="styleSelectRow">
|
@@ -92,7 +93,7 @@
|
|
92
93
|
<fieldset>
|
93
94
|
<legend>{#table_dlg.advanced_props}</legend>
|
94
95
|
|
95
|
-
<table border="0" cellpadding="0" cellspacing="4">
|
96
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
96
97
|
<tr>
|
97
98
|
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
98
99
|
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
@@ -124,7 +125,7 @@
|
|
124
125
|
<tr>
|
125
126
|
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
126
127
|
<td>
|
127
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
128
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
128
129
|
<tr>
|
129
130
|
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
130
131
|
<td id="backgroundimagebrowsercontainer"> </td>
|
@@ -133,10 +134,10 @@
|
|
133
134
|
</td>
|
134
135
|
</tr>
|
135
136
|
|
136
|
-
<tr>
|
137
|
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
137
|
+
<tr role="group" aria-labelledby="bordercolor_label">
|
138
|
+
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138
139
|
<td>
|
139
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
140
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
140
141
|
<tr>
|
141
142
|
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
142
143
|
<td id="bordercolor_pickcontainer"> </td>
|
@@ -145,10 +146,10 @@
|
|
145
146
|
</td>
|
146
147
|
</tr>
|
147
148
|
|
148
|
-
<tr>
|
149
|
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
149
|
+
<tr role="group" aria-labelledby="bgcolor_label">
|
150
|
+
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150
151
|
<td>
|
151
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
152
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
152
153
|
<tr>
|
153
154
|
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
154
155
|
<td id="bgcolor_pickcontainer"> </td>
|
@@ -166,6 +167,7 @@
|
|
166
167
|
<select id="action" name="action">
|
167
168
|
<option value="cell">{#table_dlg.cell_cell}</option>
|
168
169
|
<option value="row">{#table_dlg.cell_row}</option>
|
170
|
+
<option value="col">{#table_dlg.cell_col}</option>
|
169
171
|
<option value="all">{#table_dlg.cell_all}</option>
|
170
172
|
</select>
|
171
173
|
</div>
|
@@ -1 +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);
|
1
|
+
(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T<Q+U;T++){if(!g[T]){g[T]=[]}for(S=R;S<R+V;S++){g[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=g[O];if(N){return N[M]}}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];e(H.rows,function(N){e(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function f(M){var N;d.walk(M,function(P){var O;if(P.nodeType==3){e(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=d.isIE?" ":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(f(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colSpan",(X-P)+1);s(T,"rowSpan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!g[R]||!g[R][U]){continue}V=g[R][U].elm;if(V!=T){N=d.grep(V.childNodes);e(N,function(Z){T.appendChild(Z)});if(N.length){N=d.grep(T.childNodes);Q=0;e(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;e(g,function(W,X){e(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<g[0].length;R++){if(!g[M][R]){continue}S=g[M][R].elm;if(S!=P){if(!Q){O=a(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colSpan",1);s(R,"rowSpan",1)}for(i=S;i<Q;i++){T.appendChild(f(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}})}function F(M){var N;e(g,function(O,P){e(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;e(g,function(P,Q){e(P,function(S,R){var U,T;if(j(S)){S=g[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=g[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=g[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["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(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(B,M){function F(Q){B.selection.setCursorLocation(Q,0)}function H(R,Q){return R.keyCode==z?Q.previousSibling:Q.nextSibling}function G(R,S){var Q=H(R,S);return Q!==null&&Q.tagName==="TR"?Q:null}function C(Q,R){return Q.dom.getParent(R,"table")}function O(Q){var R=C(B,Q);return H(M,R)}function A(Q){return Q.keyCode==z||Q.keyCode==I}function D(Q){var S=Q.selection.getNode();var R=Q.dom.getParent(S,"tr");return R!==null}function N(R){var Q=0;var S=R;while(S.previousSibling){S=S.previousSibling;Q=Q+a(S,"colspan")}return Q}function E(S,Q){var T=0;var R=0;e(S.children,function(U,V){T=T+a(U,"colspan");R=V;if(T>Q){return false}});return R}function w(S,T,V){var U=N(S.dom.getParent(T,"td,th"));var R=E(V,U);var Q=V.childNodes[R];F(Q)}function L(R,T){var Q=O(R);if(Q!==null){F(Q);return d.dom.Event.cancel(T)}else{var S=T.keyCode==z?R.firstChild:R.lastChild;F(S);return true}}var z=38;var I=40;if(A(M)&&D(B)){var J=B.selection.getNode();var P=B.dom.getParent(J,"tr");var K=G(M,P);if(K==null){return L(P,M)}else{w(B,J,K);d.dom.Event.cancel(M);return true}}}r.onKeyDown.add(v)}if(!d.isIE){function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){r.dom.add(r.getBody(),"p",null,'<br mce_bogus="1" />')}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&z.childNodes.length==1&&z.firstChild.nodeName=="BR"){w.dom.remove(z)}});s();r.startContent=r.getContent({format:"raw"})}});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce);
|
@@ -1,1139 +1,1364 @@
|
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
//
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
};
|
106
|
-
|
107
|
-
function
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
};
|
136
|
-
|
137
|
-
function
|
138
|
-
var
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
if (
|
183
|
-
|
184
|
-
}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
}
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
//
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
}
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
ed.
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
}
|
801
|
-
});
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
ed.
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
}
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
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
|
+
function getSpanVal(td, name) {
|
29
|
+
return parseInt(td.getAttribute(name) || 1);
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Table Grid class.
|
34
|
+
*/
|
35
|
+
function TableGrid(table, dom, selection) {
|
36
|
+
var grid, startPos, endPos, selectedCell;
|
37
|
+
|
38
|
+
buildGrid();
|
39
|
+
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
40
|
+
if (selectedCell) {
|
41
|
+
startPos = getPos(selectedCell);
|
42
|
+
endPos = findEndPos();
|
43
|
+
selectedCell = getCell(startPos.x, startPos.y);
|
44
|
+
}
|
45
|
+
|
46
|
+
function cloneNode(node, children) {
|
47
|
+
node = node.cloneNode(children);
|
48
|
+
node.removeAttribute('id');
|
49
|
+
|
50
|
+
return node;
|
51
|
+
}
|
52
|
+
|
53
|
+
function buildGrid() {
|
54
|
+
var startY = 0;
|
55
|
+
|
56
|
+
grid = [];
|
57
|
+
|
58
|
+
each(['thead', 'tbody', 'tfoot'], function(part) {
|
59
|
+
var rows = dom.select('> ' + part + ' tr', table);
|
60
|
+
|
61
|
+
each(rows, function(tr, y) {
|
62
|
+
y += startY;
|
63
|
+
|
64
|
+
each(dom.select('> td, > th', tr), function(td, x) {
|
65
|
+
var x2, y2, rowspan, colspan;
|
66
|
+
|
67
|
+
// Skip over existing cells produced by rowspan
|
68
|
+
if (grid[y]) {
|
69
|
+
while (grid[y][x])
|
70
|
+
x++;
|
71
|
+
}
|
72
|
+
|
73
|
+
// Get col/rowspan from cell
|
74
|
+
rowspan = getSpanVal(td, 'rowspan');
|
75
|
+
colspan = getSpanVal(td, 'colspan');
|
76
|
+
|
77
|
+
// Fill out rowspan/colspan right and down
|
78
|
+
for (y2 = y; y2 < y + rowspan; y2++) {
|
79
|
+
if (!grid[y2])
|
80
|
+
grid[y2] = [];
|
81
|
+
|
82
|
+
for (x2 = x; x2 < x + colspan; x2++) {
|
83
|
+
grid[y2][x2] = {
|
84
|
+
part : part,
|
85
|
+
real : y2 == y && x2 == x,
|
86
|
+
elm : td,
|
87
|
+
rowspan : rowspan,
|
88
|
+
colspan : colspan
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}
|
92
|
+
});
|
93
|
+
});
|
94
|
+
|
95
|
+
startY += rows.length;
|
96
|
+
});
|
97
|
+
};
|
98
|
+
|
99
|
+
function getCell(x, y) {
|
100
|
+
var row;
|
101
|
+
|
102
|
+
row = grid[y];
|
103
|
+
if (row)
|
104
|
+
return row[x];
|
105
|
+
};
|
106
|
+
|
107
|
+
function setSpanVal(td, name, val) {
|
108
|
+
if (td) {
|
109
|
+
val = parseInt(val);
|
110
|
+
|
111
|
+
if (val === 1)
|
112
|
+
td.removeAttribute(name, 1);
|
113
|
+
else
|
114
|
+
td.setAttribute(name, val, 1);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
function isCellSelected(cell) {
|
119
|
+
return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
|
120
|
+
};
|
121
|
+
|
122
|
+
function getSelectedRows() {
|
123
|
+
var rows = [];
|
124
|
+
|
125
|
+
each(table.rows, function(row) {
|
126
|
+
each(row.cells, function(cell) {
|
127
|
+
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
128
|
+
rows.push(row);
|
129
|
+
return false;
|
130
|
+
}
|
131
|
+
});
|
132
|
+
});
|
133
|
+
|
134
|
+
return rows;
|
135
|
+
};
|
136
|
+
|
137
|
+
function deleteTable() {
|
138
|
+
var rng = dom.createRng();
|
139
|
+
|
140
|
+
rng.setStartAfter(table);
|
141
|
+
rng.setEndAfter(table);
|
142
|
+
|
143
|
+
selection.setRng(rng);
|
144
|
+
|
145
|
+
dom.remove(table);
|
146
|
+
};
|
147
|
+
|
148
|
+
function cloneCell(cell) {
|
149
|
+
var formatNode;
|
150
|
+
|
151
|
+
// Clone formats
|
152
|
+
tinymce.walk(cell, function(node) {
|
153
|
+
var curNode;
|
154
|
+
|
155
|
+
if (node.nodeType == 3) {
|
156
|
+
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
157
|
+
node = cloneNode(node, false);
|
158
|
+
|
159
|
+
if (!formatNode)
|
160
|
+
formatNode = curNode = node;
|
161
|
+
else if (curNode)
|
162
|
+
curNode.appendChild(node);
|
163
|
+
|
164
|
+
curNode = node;
|
165
|
+
});
|
166
|
+
|
167
|
+
// Add something to the inner node
|
168
|
+
if (curNode)
|
169
|
+
curNode.innerHTML = tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />';
|
170
|
+
|
171
|
+
return false;
|
172
|
+
}
|
173
|
+
}, 'childNodes');
|
174
|
+
|
175
|
+
cell = cloneNode(cell, false);
|
176
|
+
setSpanVal(cell, 'rowSpan', 1);
|
177
|
+
setSpanVal(cell, 'colSpan', 1);
|
178
|
+
|
179
|
+
if (formatNode) {
|
180
|
+
cell.appendChild(formatNode);
|
181
|
+
} else {
|
182
|
+
if (!tinymce.isIE)
|
183
|
+
cell.innerHTML = '<br data-mce-bogus="1" />';
|
184
|
+
}
|
185
|
+
|
186
|
+
return cell;
|
187
|
+
};
|
188
|
+
|
189
|
+
function cleanup() {
|
190
|
+
var rng = dom.createRng();
|
191
|
+
|
192
|
+
// Empty rows
|
193
|
+
each(dom.select('tr', table), function(tr) {
|
194
|
+
if (tr.cells.length == 0)
|
195
|
+
dom.remove(tr);
|
196
|
+
});
|
197
|
+
|
198
|
+
// Empty table
|
199
|
+
if (dom.select('tr', table).length == 0) {
|
200
|
+
rng.setStartAfter(table);
|
201
|
+
rng.setEndAfter(table);
|
202
|
+
selection.setRng(rng);
|
203
|
+
dom.remove(table);
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
|
207
|
+
// Empty header/body/footer
|
208
|
+
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
209
|
+
if (part.rows.length == 0)
|
210
|
+
dom.remove(part);
|
211
|
+
});
|
212
|
+
|
213
|
+
// Restore selection to start position if it still exists
|
214
|
+
buildGrid();
|
215
|
+
|
216
|
+
// Restore the selection to the closest table position
|
217
|
+
row = grid[Math.min(grid.length - 1, startPos.y)];
|
218
|
+
if (row) {
|
219
|
+
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
220
|
+
selection.collapse(true);
|
221
|
+
}
|
222
|
+
};
|
223
|
+
|
224
|
+
function fillLeftDown(x, y, rows, cols) {
|
225
|
+
var tr, x2, r, c, cell;
|
226
|
+
|
227
|
+
tr = grid[y][x].elm.parentNode;
|
228
|
+
for (r = 1; r <= rows; r++) {
|
229
|
+
tr = dom.getNext(tr, 'tr');
|
230
|
+
|
231
|
+
if (tr) {
|
232
|
+
// Loop left to find real cell
|
233
|
+
for (x2 = x; x2 >= 0; x2--) {
|
234
|
+
cell = grid[y + r][x2].elm;
|
235
|
+
|
236
|
+
if (cell.parentNode == tr) {
|
237
|
+
// Append clones after
|
238
|
+
for (c = 1; c <= cols; c++)
|
239
|
+
dom.insertAfter(cloneCell(cell), cell);
|
240
|
+
|
241
|
+
break;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
if (x2 == -1) {
|
246
|
+
// Insert nodes before first cell
|
247
|
+
for (c = 1; c <= cols; c++)
|
248
|
+
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
};
|
253
|
+
|
254
|
+
function split() {
|
255
|
+
each(grid, function(row, y) {
|
256
|
+
each(row, function(cell, x) {
|
257
|
+
var colSpan, rowSpan, newCell, i;
|
258
|
+
|
259
|
+
if (isCellSelected(cell)) {
|
260
|
+
cell = cell.elm;
|
261
|
+
colSpan = getSpanVal(cell, 'colspan');
|
262
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
263
|
+
|
264
|
+
if (colSpan > 1 || rowSpan > 1) {
|
265
|
+
setSpanVal(cell, 'rowSpan', 1);
|
266
|
+
setSpanVal(cell, 'colSpan', 1);
|
267
|
+
|
268
|
+
// Insert cells right
|
269
|
+
for (i = 0; i < colSpan - 1; i++)
|
270
|
+
dom.insertAfter(cloneCell(cell), cell);
|
271
|
+
|
272
|
+
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
});
|
276
|
+
});
|
277
|
+
};
|
278
|
+
|
279
|
+
function merge(cell, cols, rows) {
|
280
|
+
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
|
281
|
+
|
282
|
+
// Use specified cell and cols/rows
|
283
|
+
if (cell) {
|
284
|
+
pos = getPos(cell);
|
285
|
+
startX = pos.x;
|
286
|
+
startY = pos.y;
|
287
|
+
endX = startX + (cols - 1);
|
288
|
+
endY = startY + (rows - 1);
|
289
|
+
} else {
|
290
|
+
// Use selection
|
291
|
+
startX = startPos.x;
|
292
|
+
startY = startPos.y;
|
293
|
+
endX = endPos.x;
|
294
|
+
endY = endPos.y;
|
295
|
+
}
|
296
|
+
|
297
|
+
// Find start/end cells
|
298
|
+
startCell = getCell(startX, startY);
|
299
|
+
endCell = getCell(endX, endY);
|
300
|
+
|
301
|
+
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
302
|
+
if (startCell && endCell && startCell.part == endCell.part) {
|
303
|
+
// Split and rebuild grid
|
304
|
+
split();
|
305
|
+
buildGrid();
|
306
|
+
|
307
|
+
// Set row/col span to start cell
|
308
|
+
startCell = getCell(startX, startY).elm;
|
309
|
+
setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
|
310
|
+
setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
|
311
|
+
|
312
|
+
// Remove other cells and add it's contents to the start cell
|
313
|
+
for (y = startY; y <= endY; y++) {
|
314
|
+
for (x = startX; x <= endX; x++) {
|
315
|
+
if (!grid[y] || !grid[y][x])
|
316
|
+
continue;
|
317
|
+
|
318
|
+
cell = grid[y][x].elm;
|
319
|
+
|
320
|
+
if (cell != startCell) {
|
321
|
+
// Move children to startCell
|
322
|
+
children = tinymce.grep(cell.childNodes);
|
323
|
+
each(children, function(node) {
|
324
|
+
startCell.appendChild(node);
|
325
|
+
});
|
326
|
+
|
327
|
+
// Remove bogus nodes if there is children in the target cell
|
328
|
+
if (children.length) {
|
329
|
+
children = tinymce.grep(startCell.childNodes);
|
330
|
+
count = 0;
|
331
|
+
each(children, function(node) {
|
332
|
+
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
|
333
|
+
startCell.removeChild(node);
|
334
|
+
});
|
335
|
+
}
|
336
|
+
|
337
|
+
// Remove cell
|
338
|
+
dom.remove(cell);
|
339
|
+
}
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
// Remove empty rows etc and restore caret location
|
344
|
+
cleanup();
|
345
|
+
}
|
346
|
+
};
|
347
|
+
|
348
|
+
function insertRow(before) {
|
349
|
+
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
350
|
+
|
351
|
+
// Find first/last row
|
352
|
+
each(grid, function(row, y) {
|
353
|
+
each(row, function(cell, x) {
|
354
|
+
if (isCellSelected(cell)) {
|
355
|
+
cell = cell.elm;
|
356
|
+
rowElm = cell.parentNode;
|
357
|
+
newRow = cloneNode(rowElm, false);
|
358
|
+
posY = y;
|
359
|
+
|
360
|
+
if (before)
|
361
|
+
return false;
|
362
|
+
}
|
363
|
+
});
|
364
|
+
|
365
|
+
if (before)
|
366
|
+
return !posY;
|
367
|
+
});
|
368
|
+
|
369
|
+
for (x = 0; x < grid[0].length; x++) {
|
370
|
+
// Cell not found could be because of an invalid table structure
|
371
|
+
if (!grid[posY][x])
|
372
|
+
continue;
|
373
|
+
|
374
|
+
cell = grid[posY][x].elm;
|
375
|
+
|
376
|
+
if (cell != lastCell) {
|
377
|
+
if (!before) {
|
378
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
379
|
+
if (rowSpan > 1) {
|
380
|
+
setSpanVal(cell, 'rowSpan', rowSpan + 1);
|
381
|
+
continue;
|
382
|
+
}
|
383
|
+
} else {
|
384
|
+
// Check if cell above can be expanded
|
385
|
+
if (posY > 0 && grid[posY - 1][x]) {
|
386
|
+
otherCell = grid[posY - 1][x].elm;
|
387
|
+
rowSpan = getSpanVal(otherCell, 'rowSpan');
|
388
|
+
if (rowSpan > 1) {
|
389
|
+
setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
|
390
|
+
continue;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
// Insert new cell into new row
|
396
|
+
newCell = cloneCell(cell);
|
397
|
+
setSpanVal(newCell, 'colSpan', cell.colSpan);
|
398
|
+
|
399
|
+
newRow.appendChild(newCell);
|
400
|
+
|
401
|
+
lastCell = cell;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
if (newRow.hasChildNodes()) {
|
406
|
+
if (!before)
|
407
|
+
dom.insertAfter(newRow, rowElm);
|
408
|
+
else
|
409
|
+
rowElm.parentNode.insertBefore(newRow, rowElm);
|
410
|
+
}
|
411
|
+
};
|
412
|
+
|
413
|
+
function insertCol(before) {
|
414
|
+
var posX, lastCell;
|
415
|
+
|
416
|
+
// Find first/last column
|
417
|
+
each(grid, function(row, y) {
|
418
|
+
each(row, function(cell, x) {
|
419
|
+
if (isCellSelected(cell)) {
|
420
|
+
posX = x;
|
421
|
+
|
422
|
+
if (before)
|
423
|
+
return false;
|
424
|
+
}
|
425
|
+
});
|
426
|
+
|
427
|
+
if (before)
|
428
|
+
return !posX;
|
429
|
+
});
|
430
|
+
|
431
|
+
each(grid, function(row, y) {
|
432
|
+
var cell, rowSpan, colSpan;
|
433
|
+
|
434
|
+
if (!row[posX])
|
435
|
+
return;
|
436
|
+
|
437
|
+
cell = row[posX].elm;
|
438
|
+
if (cell != lastCell) {
|
439
|
+
colSpan = getSpanVal(cell, 'colspan');
|
440
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
441
|
+
|
442
|
+
if (colSpan == 1) {
|
443
|
+
if (!before) {
|
444
|
+
dom.insertAfter(cloneCell(cell), cell);
|
445
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
446
|
+
} else {
|
447
|
+
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
448
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
449
|
+
}
|
450
|
+
} else
|
451
|
+
setSpanVal(cell, 'colSpan', cell.colSpan + 1);
|
452
|
+
|
453
|
+
lastCell = cell;
|
454
|
+
}
|
455
|
+
});
|
456
|
+
};
|
457
|
+
|
458
|
+
function deleteCols() {
|
459
|
+
var cols = [];
|
460
|
+
|
461
|
+
// Get selected column indexes
|
462
|
+
each(grid, function(row, y) {
|
463
|
+
each(row, function(cell, x) {
|
464
|
+
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
465
|
+
each(grid, function(row) {
|
466
|
+
var cell = row[x].elm, colSpan;
|
467
|
+
|
468
|
+
colSpan = getSpanVal(cell, 'colSpan');
|
469
|
+
|
470
|
+
if (colSpan > 1)
|
471
|
+
setSpanVal(cell, 'colSpan', colSpan - 1);
|
472
|
+
else
|
473
|
+
dom.remove(cell);
|
474
|
+
});
|
475
|
+
|
476
|
+
cols.push(x);
|
477
|
+
}
|
478
|
+
});
|
479
|
+
});
|
480
|
+
|
481
|
+
cleanup();
|
482
|
+
};
|
483
|
+
|
484
|
+
function deleteRows() {
|
485
|
+
var rows;
|
486
|
+
|
487
|
+
function deleteRow(tr) {
|
488
|
+
var nextTr, pos, lastCell;
|
489
|
+
|
490
|
+
nextTr = dom.getNext(tr, 'tr');
|
491
|
+
|
492
|
+
// Move down row spanned cells
|
493
|
+
each(tr.cells, function(cell) {
|
494
|
+
var rowSpan = getSpanVal(cell, 'rowSpan');
|
495
|
+
|
496
|
+
if (rowSpan > 1) {
|
497
|
+
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
498
|
+
pos = getPos(cell);
|
499
|
+
fillLeftDown(pos.x, pos.y, 1, 1);
|
500
|
+
}
|
501
|
+
});
|
502
|
+
|
503
|
+
// Delete cells
|
504
|
+
pos = getPos(tr.cells[0]);
|
505
|
+
each(grid[pos.y], function(cell) {
|
506
|
+
var rowSpan;
|
507
|
+
|
508
|
+
cell = cell.elm;
|
509
|
+
|
510
|
+
if (cell != lastCell) {
|
511
|
+
rowSpan = getSpanVal(cell, 'rowSpan');
|
512
|
+
|
513
|
+
if (rowSpan <= 1)
|
514
|
+
dom.remove(cell);
|
515
|
+
else
|
516
|
+
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
517
|
+
|
518
|
+
lastCell = cell;
|
519
|
+
}
|
520
|
+
});
|
521
|
+
};
|
522
|
+
|
523
|
+
// Get selected rows and move selection out of scope
|
524
|
+
rows = getSelectedRows();
|
525
|
+
|
526
|
+
// Delete all selected rows
|
527
|
+
each(rows.reverse(), function(tr) {
|
528
|
+
deleteRow(tr);
|
529
|
+
});
|
530
|
+
|
531
|
+
cleanup();
|
532
|
+
};
|
533
|
+
|
534
|
+
function cutRows() {
|
535
|
+
var rows = getSelectedRows();
|
536
|
+
|
537
|
+
dom.remove(rows);
|
538
|
+
cleanup();
|
539
|
+
|
540
|
+
return rows;
|
541
|
+
};
|
542
|
+
|
543
|
+
function copyRows() {
|
544
|
+
var rows = getSelectedRows();
|
545
|
+
|
546
|
+
each(rows, function(row, i) {
|
547
|
+
rows[i] = cloneNode(row, true);
|
548
|
+
});
|
549
|
+
|
550
|
+
return rows;
|
551
|
+
};
|
552
|
+
|
553
|
+
function pasteRows(rows, before) {
|
554
|
+
var selectedRows = getSelectedRows(),
|
555
|
+
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
556
|
+
targetCellCount = targetRow.cells.length;
|
557
|
+
|
558
|
+
// Calc target cell count
|
559
|
+
each(grid, function(row) {
|
560
|
+
var match;
|
561
|
+
|
562
|
+
targetCellCount = 0;
|
563
|
+
each(row, function(cell, x) {
|
564
|
+
if (cell.real)
|
565
|
+
targetCellCount += cell.colspan;
|
566
|
+
|
567
|
+
if (cell.elm.parentNode == targetRow)
|
568
|
+
match = 1;
|
569
|
+
});
|
570
|
+
|
571
|
+
if (match)
|
572
|
+
return false;
|
573
|
+
});
|
574
|
+
|
575
|
+
if (!before)
|
576
|
+
rows.reverse();
|
577
|
+
|
578
|
+
each(rows, function(row) {
|
579
|
+
var cellCount = row.cells.length, cell;
|
580
|
+
|
581
|
+
// Remove col/rowspans
|
582
|
+
for (i = 0; i < cellCount; i++) {
|
583
|
+
cell = row.cells[i];
|
584
|
+
setSpanVal(cell, 'colSpan', 1);
|
585
|
+
setSpanVal(cell, 'rowSpan', 1);
|
586
|
+
}
|
587
|
+
|
588
|
+
// Needs more cells
|
589
|
+
for (i = cellCount; i < targetCellCount; i++)
|
590
|
+
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
591
|
+
|
592
|
+
// Needs less cells
|
593
|
+
for (i = targetCellCount; i < cellCount; i++)
|
594
|
+
dom.remove(row.cells[i]);
|
595
|
+
|
596
|
+
// Add before/after
|
597
|
+
if (before)
|
598
|
+
targetRow.parentNode.insertBefore(row, targetRow);
|
599
|
+
else
|
600
|
+
dom.insertAfter(row, targetRow);
|
601
|
+
});
|
602
|
+
};
|
603
|
+
|
604
|
+
function getPos(target) {
|
605
|
+
var pos;
|
606
|
+
|
607
|
+
each(grid, function(row, y) {
|
608
|
+
each(row, function(cell, x) {
|
609
|
+
if (cell.elm == target) {
|
610
|
+
pos = {x : x, y : y};
|
611
|
+
return false;
|
612
|
+
}
|
613
|
+
});
|
614
|
+
|
615
|
+
return !pos;
|
616
|
+
});
|
617
|
+
|
618
|
+
return pos;
|
619
|
+
};
|
620
|
+
|
621
|
+
function setStartCell(cell) {
|
622
|
+
startPos = getPos(cell);
|
623
|
+
};
|
624
|
+
|
625
|
+
function findEndPos() {
|
626
|
+
var pos, maxX, maxY;
|
627
|
+
|
628
|
+
maxX = maxY = 0;
|
629
|
+
|
630
|
+
each(grid, function(row, y) {
|
631
|
+
each(row, function(cell, x) {
|
632
|
+
var colSpan, rowSpan;
|
633
|
+
|
634
|
+
if (isCellSelected(cell)) {
|
635
|
+
cell = grid[y][x];
|
636
|
+
|
637
|
+
if (x > maxX)
|
638
|
+
maxX = x;
|
639
|
+
|
640
|
+
if (y > maxY)
|
641
|
+
maxY = y;
|
642
|
+
|
643
|
+
if (cell.real) {
|
644
|
+
colSpan = cell.colspan - 1;
|
645
|
+
rowSpan = cell.rowspan - 1;
|
646
|
+
|
647
|
+
if (colSpan) {
|
648
|
+
if (x + colSpan > maxX)
|
649
|
+
maxX = x + colSpan;
|
650
|
+
}
|
651
|
+
|
652
|
+
if (rowSpan) {
|
653
|
+
if (y + rowSpan > maxY)
|
654
|
+
maxY = y + rowSpan;
|
655
|
+
}
|
656
|
+
}
|
657
|
+
}
|
658
|
+
});
|
659
|
+
});
|
660
|
+
|
661
|
+
return {x : maxX, y : maxY};
|
662
|
+
};
|
663
|
+
|
664
|
+
function setEndCell(cell) {
|
665
|
+
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
666
|
+
|
667
|
+
endPos = getPos(cell);
|
668
|
+
|
669
|
+
if (startPos && endPos) {
|
670
|
+
// Get start/end positions
|
671
|
+
startX = Math.min(startPos.x, endPos.x);
|
672
|
+
startY = Math.min(startPos.y, endPos.y);
|
673
|
+
endX = Math.max(startPos.x, endPos.x);
|
674
|
+
endY = Math.max(startPos.y, endPos.y);
|
675
|
+
|
676
|
+
// Expand end positon to include spans
|
677
|
+
maxX = endX;
|
678
|
+
maxY = endY;
|
679
|
+
|
680
|
+
// Expand startX
|
681
|
+
for (y = startY; y <= maxY; y++) {
|
682
|
+
cell = grid[y][startX];
|
683
|
+
|
684
|
+
if (!cell.real) {
|
685
|
+
if (startX - (cell.colspan - 1) < startX)
|
686
|
+
startX -= cell.colspan - 1;
|
687
|
+
}
|
688
|
+
}
|
689
|
+
|
690
|
+
// Expand startY
|
691
|
+
for (x = startX; x <= maxX; x++) {
|
692
|
+
cell = grid[startY][x];
|
693
|
+
|
694
|
+
if (!cell.real) {
|
695
|
+
if (startY - (cell.rowspan - 1) < startY)
|
696
|
+
startY -= cell.rowspan - 1;
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
// Find max X, Y
|
701
|
+
for (y = startY; y <= endY; y++) {
|
702
|
+
for (x = startX; x <= endX; x++) {
|
703
|
+
cell = grid[y][x];
|
704
|
+
|
705
|
+
if (cell.real) {
|
706
|
+
colSpan = cell.colspan - 1;
|
707
|
+
rowSpan = cell.rowspan - 1;
|
708
|
+
|
709
|
+
if (colSpan) {
|
710
|
+
if (x + colSpan > maxX)
|
711
|
+
maxX = x + colSpan;
|
712
|
+
}
|
713
|
+
|
714
|
+
if (rowSpan) {
|
715
|
+
if (y + rowSpan > maxY)
|
716
|
+
maxY = y + rowSpan;
|
717
|
+
}
|
718
|
+
}
|
719
|
+
}
|
720
|
+
}
|
721
|
+
|
722
|
+
// Remove current selection
|
723
|
+
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
724
|
+
|
725
|
+
// Add new selection
|
726
|
+
for (y = startY; y <= maxY; y++) {
|
727
|
+
for (x = startX; x <= maxX; x++) {
|
728
|
+
if (grid[y][x])
|
729
|
+
dom.addClass(grid[y][x].elm, 'mceSelected');
|
730
|
+
}
|
731
|
+
}
|
732
|
+
}
|
733
|
+
};
|
734
|
+
|
735
|
+
// Expose to public
|
736
|
+
tinymce.extend(this, {
|
737
|
+
deleteTable : deleteTable,
|
738
|
+
split : split,
|
739
|
+
merge : merge,
|
740
|
+
insertRow : insertRow,
|
741
|
+
insertCol : insertCol,
|
742
|
+
deleteCols : deleteCols,
|
743
|
+
deleteRows : deleteRows,
|
744
|
+
cutRows : cutRows,
|
745
|
+
copyRows : copyRows,
|
746
|
+
pasteRows : pasteRows,
|
747
|
+
getPos : getPos,
|
748
|
+
setStartCell : setStartCell,
|
749
|
+
setEndCell : setEndCell
|
750
|
+
});
|
751
|
+
};
|
752
|
+
|
753
|
+
tinymce.create('tinymce.plugins.TablePlugin', {
|
754
|
+
init : function(ed, url) {
|
755
|
+
var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload
|
756
|
+
|
757
|
+
function createTableGrid(node) {
|
758
|
+
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
759
|
+
|
760
|
+
if (tblElm)
|
761
|
+
return new TableGrid(tblElm, ed.dom, selection);
|
762
|
+
};
|
763
|
+
|
764
|
+
function cleanup() {
|
765
|
+
// Restore selection possibilities
|
766
|
+
ed.getBody().style.webkitUserSelect = '';
|
767
|
+
|
768
|
+
if (hasCellSelection) {
|
769
|
+
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
770
|
+
hasCellSelection = false;
|
771
|
+
}
|
772
|
+
};
|
773
|
+
|
774
|
+
// Register buttons
|
775
|
+
each([
|
776
|
+
['table', 'table.desc', 'mceInsertTable', true],
|
777
|
+
['delete_table', 'table.del', 'mceTableDelete'],
|
778
|
+
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
779
|
+
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
780
|
+
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
781
|
+
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
782
|
+
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
783
|
+
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
784
|
+
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
785
|
+
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
786
|
+
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
787
|
+
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
788
|
+
], function(c) {
|
789
|
+
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
790
|
+
});
|
791
|
+
|
792
|
+
// Select whole table is a table border is clicked
|
793
|
+
if (!tinymce.isIE) {
|
794
|
+
ed.onClick.add(function(ed, e) {
|
795
|
+
e = e.target;
|
796
|
+
|
797
|
+
if (e.nodeName === 'TABLE') {
|
798
|
+
ed.selection.select(e);
|
799
|
+
ed.nodeChanged();
|
800
|
+
}
|
801
|
+
});
|
802
|
+
}
|
803
|
+
|
804
|
+
ed.onPreProcess.add(function(ed, args) {
|
805
|
+
var nodes, i, node, dom = ed.dom, value;
|
806
|
+
|
807
|
+
nodes = dom.select('table', args.node);
|
808
|
+
i = nodes.length;
|
809
|
+
while (i--) {
|
810
|
+
node = nodes[i];
|
811
|
+
dom.setAttrib(node, 'data-mce-style', '');
|
812
|
+
|
813
|
+
if ((value = dom.getAttrib(node, 'width'))) {
|
814
|
+
dom.setStyle(node, 'width', value);
|
815
|
+
dom.setAttrib(node, 'width', '');
|
816
|
+
}
|
817
|
+
|
818
|
+
if ((value = dom.getAttrib(node, 'height'))) {
|
819
|
+
dom.setStyle(node, 'height', value);
|
820
|
+
dom.setAttrib(node, 'height', '');
|
821
|
+
}
|
822
|
+
}
|
823
|
+
});
|
824
|
+
|
825
|
+
// Handle node change updates
|
826
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
827
|
+
var p;
|
828
|
+
|
829
|
+
n = ed.selection.getStart();
|
830
|
+
p = ed.dom.getParent(n, 'td,th,caption');
|
831
|
+
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
832
|
+
|
833
|
+
// Disable table tools if we are in caption
|
834
|
+
if (p && p.nodeName === 'CAPTION')
|
835
|
+
p = 0;
|
836
|
+
|
837
|
+
cm.setDisabled('delete_table', !p);
|
838
|
+
cm.setDisabled('delete_col', !p);
|
839
|
+
cm.setDisabled('delete_table', !p);
|
840
|
+
cm.setDisabled('delete_row', !p);
|
841
|
+
cm.setDisabled('col_after', !p);
|
842
|
+
cm.setDisabled('col_before', !p);
|
843
|
+
cm.setDisabled('row_after', !p);
|
844
|
+
cm.setDisabled('row_before', !p);
|
845
|
+
cm.setDisabled('row_props', !p);
|
846
|
+
cm.setDisabled('cell_props', !p);
|
847
|
+
cm.setDisabled('split_cells', !p);
|
848
|
+
cm.setDisabled('merge_cells', !p);
|
849
|
+
});
|
850
|
+
|
851
|
+
ed.onInit.add(function(ed) {
|
852
|
+
var startTable, startCell, dom = ed.dom, tableGrid;
|
853
|
+
|
854
|
+
winMan = ed.windowManager;
|
855
|
+
|
856
|
+
// Add cell selection logic
|
857
|
+
ed.onMouseDown.add(function(ed, e) {
|
858
|
+
if (e.button != 2) {
|
859
|
+
cleanup();
|
860
|
+
|
861
|
+
startCell = dom.getParent(e.target, 'td,th');
|
862
|
+
startTable = dom.getParent(startCell, 'table');
|
863
|
+
}
|
864
|
+
});
|
865
|
+
|
866
|
+
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
867
|
+
var sel, table, target = e.target;
|
868
|
+
|
869
|
+
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
870
|
+
table = dom.getParent(target, 'table');
|
871
|
+
if (table == startTable) {
|
872
|
+
if (!tableGrid) {
|
873
|
+
tableGrid = createTableGrid(table);
|
874
|
+
tableGrid.setStartCell(startCell);
|
875
|
+
|
876
|
+
ed.getBody().style.webkitUserSelect = 'none';
|
877
|
+
}
|
878
|
+
|
879
|
+
tableGrid.setEndCell(target);
|
880
|
+
hasCellSelection = true;
|
881
|
+
}
|
882
|
+
|
883
|
+
// Remove current selection
|
884
|
+
sel = ed.selection.getSel();
|
885
|
+
|
886
|
+
try {
|
887
|
+
if (sel.removeAllRanges)
|
888
|
+
sel.removeAllRanges();
|
889
|
+
else
|
890
|
+
sel.empty();
|
891
|
+
} catch (ex) {
|
892
|
+
// IE9 might throw errors here
|
893
|
+
}
|
894
|
+
|
895
|
+
e.preventDefault();
|
896
|
+
}
|
897
|
+
});
|
898
|
+
|
899
|
+
ed.onMouseUp.add(function(ed, e) {
|
900
|
+
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
901
|
+
|
902
|
+
// Move selection to startCell
|
903
|
+
if (startCell) {
|
904
|
+
if (tableGrid)
|
905
|
+
ed.getBody().style.webkitUserSelect = '';
|
906
|
+
|
907
|
+
function setPoint(node, start) {
|
908
|
+
var walker = new tinymce.dom.TreeWalker(node, node);
|
909
|
+
|
910
|
+
do {
|
911
|
+
// Text node
|
912
|
+
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
913
|
+
if (start)
|
914
|
+
rng.setStart(node, 0);
|
915
|
+
else
|
916
|
+
rng.setEnd(node, node.nodeValue.length);
|
917
|
+
|
918
|
+
return;
|
919
|
+
}
|
920
|
+
|
921
|
+
// BR element
|
922
|
+
if (node.nodeName == 'BR') {
|
923
|
+
if (start)
|
924
|
+
rng.setStartBefore(node);
|
925
|
+
else
|
926
|
+
rng.setEndBefore(node);
|
927
|
+
|
928
|
+
return;
|
929
|
+
}
|
930
|
+
} while (node = (start ? walker.next() : walker.prev()));
|
931
|
+
}
|
932
|
+
|
933
|
+
// Try to expand text selection as much as we can only Gecko supports cell selection
|
934
|
+
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
935
|
+
if (selectedCells.length > 0) {
|
936
|
+
rng = dom.createRng();
|
937
|
+
node = selectedCells[0];
|
938
|
+
endNode = selectedCells[selectedCells.length - 1];
|
939
|
+
rng.setStartBefore(node);
|
940
|
+
rng.setEndAfter(node);
|
941
|
+
|
942
|
+
setPoint(node, 1);
|
943
|
+
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
944
|
+
|
945
|
+
do {
|
946
|
+
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
947
|
+
if (!dom.hasClass(node, 'mceSelected'))
|
948
|
+
break;
|
949
|
+
|
950
|
+
lastNode = node;
|
951
|
+
}
|
952
|
+
} while (node = walker.next());
|
953
|
+
|
954
|
+
setPoint(lastNode);
|
955
|
+
|
956
|
+
sel.setRng(rng);
|
957
|
+
}
|
958
|
+
|
959
|
+
ed.nodeChanged();
|
960
|
+
startCell = tableGrid = startTable = null;
|
961
|
+
}
|
962
|
+
});
|
963
|
+
|
964
|
+
ed.onKeyUp.add(function(ed, e) {
|
965
|
+
cleanup();
|
966
|
+
});
|
967
|
+
|
968
|
+
ed.onKeyDown.add(function (ed, e) {
|
969
|
+
fixTableCellSelection(ed);
|
970
|
+
});
|
971
|
+
|
972
|
+
ed.onMouseDown.add(function (ed, e) {
|
973
|
+
if (e.button != 2) {
|
974
|
+
fixTableCellSelection(ed);
|
975
|
+
}
|
976
|
+
});
|
977
|
+
function tableCellSelected(ed, rng, n, currentCell) {
|
978
|
+
// The decision of when a table cell is selected is somewhat involved. The fact that this code is
|
979
|
+
// required is actually a pointer to the root cause of this bug. A cell is selected when the start
|
980
|
+
// and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
|
981
|
+
// or the parent of the table (in the case of the selection containing the last cell of a table).
|
982
|
+
var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'),
|
983
|
+
tableParent, allOfCellSelected, tableCellSelection;
|
984
|
+
if (table)
|
985
|
+
tableParent = table.parentNode;
|
986
|
+
allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE &&
|
987
|
+
rng.startOffset == 0 &&
|
988
|
+
rng.endOffset == 0 &&
|
989
|
+
currentCell &&
|
990
|
+
(n.nodeName=="TR" || n==tableParent);
|
991
|
+
tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;
|
992
|
+
return allOfCellSelected || tableCellSelection;
|
993
|
+
// return false;
|
994
|
+
}
|
995
|
+
|
996
|
+
// this nasty hack is here to work around some WebKit selection bugs.
|
997
|
+
function fixTableCellSelection(ed) {
|
998
|
+
if (!tinymce.isWebKit)
|
999
|
+
return;
|
1000
|
+
|
1001
|
+
var rng = ed.selection.getRng();
|
1002
|
+
var n = ed.selection.getNode();
|
1003
|
+
var currentCell = ed.dom.getParent(rng.startContainer, 'TD');
|
1004
|
+
|
1005
|
+
if (!tableCellSelected(ed, rng, n, currentCell))
|
1006
|
+
return;
|
1007
|
+
if (!currentCell) {
|
1008
|
+
currentCell=n;
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
// Get the very last node inside the table cell
|
1012
|
+
var end = currentCell.lastChild;
|
1013
|
+
while (end.lastChild)
|
1014
|
+
end = end.lastChild;
|
1015
|
+
|
1016
|
+
// Select the entire table cell. Nothing outside of the table cell should be selected.
|
1017
|
+
rng.setEnd(end, end.nodeValue.length);
|
1018
|
+
ed.selection.setRng(rng);
|
1019
|
+
}
|
1020
|
+
ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
|
1021
|
+
|
1022
|
+
// Add context menu
|
1023
|
+
if (ed && ed.plugins.contextmenu) {
|
1024
|
+
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
1025
|
+
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
1026
|
+
|
1027
|
+
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1028
|
+
m.removeAll();
|
1029
|
+
|
1030
|
+
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
1031
|
+
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
1032
|
+
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
1033
|
+
m.addSeparator();
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
1037
|
+
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
1038
|
+
m.addSeparator();
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
1042
|
+
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
1043
|
+
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
1044
|
+
m.addSeparator();
|
1045
|
+
|
1046
|
+
// Cell menu
|
1047
|
+
sm = m.addMenu({title : 'table.cell'});
|
1048
|
+
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
1049
|
+
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
1050
|
+
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
1051
|
+
|
1052
|
+
// Row menu
|
1053
|
+
sm = m.addMenu({title : 'table.row'});
|
1054
|
+
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
1055
|
+
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
1056
|
+
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
1057
|
+
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
1058
|
+
sm.addSeparator();
|
1059
|
+
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
1060
|
+
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
1061
|
+
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
1062
|
+
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
1063
|
+
|
1064
|
+
// Column menu
|
1065
|
+
sm = m.addMenu({title : 'table.col'});
|
1066
|
+
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
1067
|
+
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
1068
|
+
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
1069
|
+
} else
|
1070
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
1071
|
+
});
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
// Fix to allow navigating up and down in a table in WebKit browsers.
|
1075
|
+
if (tinymce.isWebKit) {
|
1076
|
+
function moveSelection(ed, e) {
|
1077
|
+
|
1078
|
+
function moveCursorToStartOfElement(n) {
|
1079
|
+
ed.selection.setCursorLocation(n, 0);
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
function getSibling(event, element) {
|
1083
|
+
return event.keyCode == UP_ARROW ? element.previousSibling : element.nextSibling;
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
function getNextRow(e, row) {
|
1087
|
+
var sibling = getSibling(e, row);
|
1088
|
+
return sibling !== null && sibling.tagName === 'TR' ? sibling : null;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
function getTable(ed, currentRow) {
|
1092
|
+
return ed.dom.getParent(currentRow, 'table');
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
function getTableSibling(currentRow) {
|
1096
|
+
var table = getTable(ed, currentRow);
|
1097
|
+
return getSibling(e, table);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
function isVerticalMovement(event) {
|
1101
|
+
return event.keyCode == UP_ARROW || event.keyCode == DOWN_ARROW;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
function isInTable(ed) {
|
1105
|
+
var node = ed.selection.getNode();
|
1106
|
+
var currentRow = ed.dom.getParent(node, 'tr');
|
1107
|
+
return currentRow !== null;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
function columnIndex(column) {
|
1111
|
+
var colIndex = 0;
|
1112
|
+
var c = column;
|
1113
|
+
while (c.previousSibling) {
|
1114
|
+
c = c.previousSibling;
|
1115
|
+
colIndex = colIndex + getSpanVal(c, "colspan");
|
1116
|
+
}
|
1117
|
+
return colIndex;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
function findColumn(rowElement, columnIndex) {
|
1121
|
+
var c = 0;
|
1122
|
+
var r = 0;
|
1123
|
+
each(rowElement.children, function(cell, i) {
|
1124
|
+
c = c + getSpanVal(cell, "colspan");
|
1125
|
+
r = i;
|
1126
|
+
if (c > columnIndex)
|
1127
|
+
return false;
|
1128
|
+
});
|
1129
|
+
return r;
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
function moveCursorToRow(ed, node, row) {
|
1133
|
+
var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th'));
|
1134
|
+
var tgtColumnIndex = findColumn(row, srcColumnIndex)
|
1135
|
+
var tgtNode = row.childNodes[tgtColumnIndex];
|
1136
|
+
moveCursorToStartOfElement(tgtNode);
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
function escapeTable(currentRow, e) {
|
1140
|
+
var tableSiblingElement = getTableSibling(currentRow);
|
1141
|
+
if (tableSiblingElement !== null) {
|
1142
|
+
moveCursorToStartOfElement(tableSiblingElement);
|
1143
|
+
return tinymce.dom.Event.cancel(e);
|
1144
|
+
} else {
|
1145
|
+
var element = e.keyCode == UP_ARROW ? currentRow.firstChild : currentRow.lastChild;
|
1146
|
+
// rely on default behaviour to escape table after we are in the last cell of the last row
|
1147
|
+
moveCursorToStartOfElement(element);
|
1148
|
+
return true;
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
var UP_ARROW = 38;
|
1153
|
+
var DOWN_ARROW = 40;
|
1154
|
+
|
1155
|
+
if (isVerticalMovement(e) && isInTable(ed)) {
|
1156
|
+
var node = ed.selection.getNode();
|
1157
|
+
var currentRow = ed.dom.getParent(node, 'tr');
|
1158
|
+
var nextRow = getNextRow(e, currentRow);
|
1159
|
+
|
1160
|
+
// If we're at the first or last row in the table, we should move the caret outside of the table
|
1161
|
+
if (nextRow == null) {
|
1162
|
+
return escapeTable(currentRow, e);
|
1163
|
+
} else {
|
1164
|
+
moveCursorToRow(ed, node, nextRow);
|
1165
|
+
tinymce.dom.Event.cancel(e);
|
1166
|
+
return true;
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
ed.onKeyDown.add(moveSelection);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
1175
|
+
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
1176
|
+
if (!tinymce.isIE) {
|
1177
|
+
function fixTableCaretPos() {
|
1178
|
+
var last;
|
1179
|
+
|
1180
|
+
// Skip empty text nodes form the end
|
1181
|
+
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
1182
|
+
|
1183
|
+
if (last && last.nodeName == 'TABLE')
|
1184
|
+
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
1185
|
+
};
|
1186
|
+
|
1187
|
+
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
1188
|
+
// this fix solves it by detecting when the caret is at the beginning of such a table
|
1189
|
+
// and then manually moves the caret infront of the table
|
1190
|
+
if (tinymce.isGecko) {
|
1191
|
+
ed.onKeyDown.add(function(ed, e) {
|
1192
|
+
var rng, table, dom = ed.dom;
|
1193
|
+
|
1194
|
+
// On gecko it's not possible to place the caret before a table
|
1195
|
+
if (e.keyCode == 37 || e.keyCode == 38) {
|
1196
|
+
rng = ed.selection.getRng();
|
1197
|
+
table = dom.getParent(rng.startContainer, 'table');
|
1198
|
+
|
1199
|
+
if (table && ed.getBody().firstChild == table) {
|
1200
|
+
if (isAtStart(rng, table)) {
|
1201
|
+
rng = dom.createRng();
|
1202
|
+
|
1203
|
+
rng.setStartBefore(table);
|
1204
|
+
rng.setEndBefore(table);
|
1205
|
+
|
1206
|
+
ed.selection.setRng(rng);
|
1207
|
+
|
1208
|
+
e.preventDefault();
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
});
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
ed.onKeyUp.add(fixTableCaretPos);
|
1216
|
+
ed.onSetContent.add(fixTableCaretPos);
|
1217
|
+
ed.onVisualAid.add(fixTableCaretPos);
|
1218
|
+
|
1219
|
+
ed.onPreProcess.add(function(ed, o) {
|
1220
|
+
var last = o.node.lastChild;
|
1221
|
+
|
1222
|
+
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
1223
|
+
ed.dom.remove(last);
|
1224
|
+
});
|
1225
|
+
|
1226
|
+
fixTableCaretPos();
|
1227
|
+
ed.startContent = ed.getContent({format : 'raw'});
|
1228
|
+
}
|
1229
|
+
});
|
1230
|
+
|
1231
|
+
// Register action commands
|
1232
|
+
each({
|
1233
|
+
mceTableSplitCells : function(grid) {
|
1234
|
+
grid.split();
|
1235
|
+
},
|
1236
|
+
|
1237
|
+
mceTableMergeCells : function(grid) {
|
1238
|
+
var rowSpan, colSpan, cell;
|
1239
|
+
|
1240
|
+
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
1241
|
+
if (cell) {
|
1242
|
+
rowSpan = cell.rowSpan;
|
1243
|
+
colSpan = cell.colSpan;
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1247
|
+
winMan.open({
|
1248
|
+
url : url + '/merge_cells.htm',
|
1249
|
+
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
1250
|
+
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
1251
|
+
inline : 1
|
1252
|
+
}, {
|
1253
|
+
rows : rowSpan,
|
1254
|
+
cols : colSpan,
|
1255
|
+
onaction : function(data) {
|
1256
|
+
grid.merge(cell, data.cols, data.rows);
|
1257
|
+
},
|
1258
|
+
plugin_url : url
|
1259
|
+
});
|
1260
|
+
} else
|
1261
|
+
grid.merge();
|
1262
|
+
},
|
1263
|
+
|
1264
|
+
mceTableInsertRowBefore : function(grid) {
|
1265
|
+
grid.insertRow(true);
|
1266
|
+
},
|
1267
|
+
|
1268
|
+
mceTableInsertRowAfter : function(grid) {
|
1269
|
+
grid.insertRow();
|
1270
|
+
},
|
1271
|
+
|
1272
|
+
mceTableInsertColBefore : function(grid) {
|
1273
|
+
grid.insertCol(true);
|
1274
|
+
},
|
1275
|
+
|
1276
|
+
mceTableInsertColAfter : function(grid) {
|
1277
|
+
grid.insertCol();
|
1278
|
+
},
|
1279
|
+
|
1280
|
+
mceTableDeleteCol : function(grid) {
|
1281
|
+
grid.deleteCols();
|
1282
|
+
},
|
1283
|
+
|
1284
|
+
mceTableDeleteRow : function(grid) {
|
1285
|
+
grid.deleteRows();
|
1286
|
+
},
|
1287
|
+
|
1288
|
+
mceTableCutRow : function(grid) {
|
1289
|
+
clipboardRows = grid.cutRows();
|
1290
|
+
},
|
1291
|
+
|
1292
|
+
mceTableCopyRow : function(grid) {
|
1293
|
+
clipboardRows = grid.copyRows();
|
1294
|
+
},
|
1295
|
+
|
1296
|
+
mceTablePasteRowBefore : function(grid) {
|
1297
|
+
grid.pasteRows(clipboardRows, true);
|
1298
|
+
},
|
1299
|
+
|
1300
|
+
mceTablePasteRowAfter : function(grid) {
|
1301
|
+
grid.pasteRows(clipboardRows);
|
1302
|
+
},
|
1303
|
+
|
1304
|
+
mceTableDelete : function(grid) {
|
1305
|
+
grid.deleteTable();
|
1306
|
+
}
|
1307
|
+
}, function(func, name) {
|
1308
|
+
ed.addCommand(name, function() {
|
1309
|
+
var grid = createTableGrid();
|
1310
|
+
|
1311
|
+
if (grid) {
|
1312
|
+
func(grid);
|
1313
|
+
ed.execCommand('mceRepaint');
|
1314
|
+
cleanup();
|
1315
|
+
}
|
1316
|
+
});
|
1317
|
+
});
|
1318
|
+
|
1319
|
+
// Register dialog commands
|
1320
|
+
each({
|
1321
|
+
mceInsertTable : function(val) {
|
1322
|
+
winMan.open({
|
1323
|
+
url : url + '/table.htm',
|
1324
|
+
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
1325
|
+
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
1326
|
+
inline : 1
|
1327
|
+
}, {
|
1328
|
+
plugin_url : url,
|
1329
|
+
action : val ? val.action : 0
|
1330
|
+
});
|
1331
|
+
},
|
1332
|
+
|
1333
|
+
mceTableRowProps : function() {
|
1334
|
+
winMan.open({
|
1335
|
+
url : url + '/row.htm',
|
1336
|
+
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
1337
|
+
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
1338
|
+
inline : 1
|
1339
|
+
}, {
|
1340
|
+
plugin_url : url
|
1341
|
+
});
|
1342
|
+
},
|
1343
|
+
|
1344
|
+
mceTableCellProps : function() {
|
1345
|
+
winMan.open({
|
1346
|
+
url : url + '/cell.htm',
|
1347
|
+
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
1348
|
+
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
1349
|
+
inline : 1
|
1350
|
+
}, {
|
1351
|
+
plugin_url : url
|
1352
|
+
});
|
1353
|
+
}
|
1354
|
+
}, function(func, name) {
|
1355
|
+
ed.addCommand(name, function(ui, val) {
|
1356
|
+
func(val);
|
1357
|
+
});
|
1358
|
+
});
|
1359
|
+
}
|
1360
|
+
});
|
1361
|
+
|
1362
|
+
// Register plugin
|
1363
|
+
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
1364
|
+
})(tinymce);
|