skylinecms 3.0.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +131 -10
- data/README.md +1 -2
- data/Rakefile +3 -3
- data/app/controllers/skyline/application_controller.rb +40 -4
- data/app/controllers/skyline/articles_controller.rb +4 -4
- data/app/controllers/skyline/browser/tabs/media_library/media_files_controller.rb +1 -1
- data/app/controllers/skyline/content_controller.rb +4 -3
- data/app/controllers/skyline/{media_files_data_controller.rb → media/data_controller.rb} +61 -59
- data/app/controllers/skyline/media/dirs_controller.rb +83 -0
- data/app/controllers/skyline/media/files_controller.rb +80 -0
- data/app/controllers/skyline/sections_controller.rb +10 -3
- data/app/controllers/skyline/settings_controller.rb +4 -2
- data/app/controllers/skyline/user_preferences_controller.rb +18 -0
- data/app/controllers/skyline/users_controller.rb +1 -1
- data/app/controllers/skyline/variant_current_editor_controller.rb +2 -0
- data/app/helpers/skyline/application_helper.rb +39 -35
- data/app/helpers/skyline/dialog_helper.rb +11 -10
- data/app/helpers/skyline/editors/boolean.rb +2 -2
- data/app/helpers/skyline/editors/page_browser.rb +2 -0
- data/app/helpers/skyline/editors/wysiwyg.rb +1 -1
- data/app/helpers/skyline/js_layout_helper.rb +19 -0
- data/app/helpers/skyline/media/dirs_helper.rb +2 -0
- data/app/helpers/skyline/media/files_helper.rb +6 -0
- data/app/helpers/skyline/media_files_helper.rb +2 -2
- data/app/helpers/skyline/menu_helper.rb +33 -0
- data/app/helpers/skyline/message_generator.rb +5 -1
- data/app/helpers/skyline/notification_generator.rb +6 -0
- data/app/helpers/skyline/plugin_helper.rb +21 -0
- data/app/helpers/skyline/presenters/presenter.rb +4 -13
- data/app/helpers/skyline/presenters/table.rb +0 -27
- data/app/helpers/skyline/ref_object_helper.rb +2 -2
- data/app/helpers/skyline/tree_helper.rb +74 -5
- data/app/models/skyline/article.rb +18 -6
- data/app/models/skyline/article_version.rb +1 -1
- data/app/models/skyline/image_ref.rb +9 -5
- data/app/models/skyline/inline_ref.rb +3 -2
- data/app/models/skyline/link_section_link.rb +2 -2
- data/app/models/skyline/media_file.rb +33 -10
- data/app/models/skyline/page.rb +10 -9
- data/app/models/skyline/section.rb +1 -1
- data/app/models/skyline/sections/content_collection_section.rb +1 -1
- data/app/models/skyline/sections/content_item_section.rb +1 -1
- data/app/models/skyline/sections/heading_section.rb +1 -1
- data/app/models/skyline/sections/iframe_section.rb +2 -2
- data/app/models/skyline/sections/link_section.rb +1 -1
- data/app/models/skyline/sections/media_section.rb +32 -5
- data/app/models/skyline/sections/page_fragment_section.rb +1 -1
- data/app/models/skyline/sections/raw_section.rb +1 -1
- data/app/models/skyline/sections/redirect_section.rb +4 -4
- data/app/models/skyline/sections/rss_section.rb +7 -2
- data/app/models/skyline/sections/splitter_section.rb +1 -1
- data/app/models/skyline/sections/wysiwyg_section.rb +3 -3
- data/app/models/skyline/site.rb +1 -1
- data/app/models/skyline/user.rb +1 -1
- data/app/models/skyline/user_preference.rb +69 -0
- data/app/models/skyline/variant.rb +1 -1
- data/app/templates/skyline/sections/content_item_section/default/index.html.erb +1 -1
- data/app/templates/skyline/sections/media_section/default/index.html.erb +9 -9
- data/app/views/skyline/articles/_list.html.erb +34 -0
- data/app/views/skyline/articles/edit.html.erb +13 -6
- data/app/views/skyline/articles/index.html.erb +12 -43
- data/app/views/skyline/articles/page/_index.html.erb +13 -11
- data/app/views/skyline/authentications/new.html.erb +2 -2
- data/app/views/skyline/browser/links/_index.html.erb +4 -2
- data/app/views/skyline/browser/tabs/media_library/_index.html.erb +12 -13
- data/app/views/skyline/browser/tabs/media_library/media_files/_index.html.erb +122 -51
- data/app/views/skyline/browser/tabs/media_library/media_files/_show.html.erb +7 -7
- data/app/views/skyline/content/list.rhtml +1 -3
- data/app/views/skyline/content/presenters/_table.html.erb +45 -0
- data/app/views/skyline/layouts/content.html.erb +1 -1
- data/app/views/skyline/layouts/media.html.erb +2 -1
- data/app/views/skyline/layouts/pages.html.erb +10 -0
- data/app/views/skyline/link_section_links/_form.html.erb +0 -1
- data/app/views/skyline/locales/show.js.erb +2 -2
- data/app/views/skyline/media/dirs/_edit.html.erb +42 -0
- data/app/views/skyline/media/dirs/_index.html.erb +14 -0
- data/app/views/skyline/media/dirs/_show.html.erb +34 -0
- data/app/views/skyline/media/dirs/index.html.erb +36 -0
- data/app/views/skyline/media/files/_edit.html.erb +101 -0
- data/app/views/skyline/media/files/_index.html.erb +68 -0
- data/app/views/skyline/media/files/_new.html.erb +45 -0
- data/app/views/skyline/publications/_index.html.erb +2 -2
- data/app/views/skyline/sections/_media_section.html.erb +12 -2
- data/app/views/skyline/sections/_wysiwyg_section.html.erb +2 -3
- data/app/views/skyline/settings/index.html +14 -0
- data/app/views/skyline/shared/_head.html.erb +2 -0
- data/app/views/skyline/shared/_header_area.html.erb +7 -5
- data/app/views/skyline/users/index.html.erb +31 -16
- data/config/initializers/dependencies.rb +6 -1
- data/config/initializers/observers.rb +1 -2
- data/config/initializers/rails_defaults.rb +1 -1
- data/config/locales/en-US.yml +110 -68
- data/config/locales/nl-NL.yml +117 -77
- data/config/routes.rb +36 -32
- data/db/fixtures/roles_and_rights.rb +65 -40
- data/db/migrate/20090302102548_add_media_nodes.rb +2 -2
- data/db/migrate/20090309133933_add_description_to_media_nodes.rb +2 -2
- data/db/migrate/20090309134731_add_tags.rb +2 -2
- data/db/migrate/20090309135746_create_media_files_tags.rb +2 -2
- data/db/migrate/20090319091342_create_media_caches.rb +2 -2
- data/db/migrate/20090327083240_create_users.rb +2 -2
- data/db/migrate/20090327084656_create_roles.rb +2 -2
- data/db/migrate/20090327084719_create_rights.rb +2 -2
- data/db/migrate/20090327084739_create_grants.rb +2 -2
- data/db/migrate/20090327090918_create_rights_roles.rb +2 -2
- data/db/migrate/20090408115155_create_ref_objects.rb +2 -2
- data/db/migrate/20090504140044_create_test_sections.rb +2 -2
- data/db/migrate/20090506083107_add_refering_column_name_to_ref_objects.rb +2 -2
- data/db/migrate/20090706124019_add_skyline_media_node_title.rb +1 -1
- data/db/migrate/20090904121447_create_skyline_referable_uris.rb +6 -6
- data/db/migrate/20091221145204_add_skyline_media_section_link.rb +11 -0
- data/db/migrate/20100109145958_add_associated_tags_index.rb +9 -0
- data/db/migrate/20100115111440_create_skyline_user_preferences.rb +14 -0
- data/db/migrate/20100120113953_remove_unused_articles_index.rb +9 -0
- data/db/migrate/20100409073447_change_referable_uri_to_text.rb +9 -0
- data/doc/Bundler.md +33 -28
- data/doc/MIGRATION.md +48 -0
- data/lib/skyline/{content_item.rb → belongs_to_referable.rb} +57 -88
- data/lib/skyline/configuration.rb +14 -15
- data/lib/skyline/content/content.rb +14 -2
- data/lib/skyline/deprecated/version3_0_8.rb +106 -0
- data/lib/skyline/{form_builder_with_errors.rb → form_builder.rb} +5 -5
- data/lib/skyline/{referable.rb → has_many_referables_in.rb} +22 -12
- data/lib/skyline/javascript_generator_methods.rb +1 -1
- data/lib/skyline/plugins_manager.rb +135 -14
- data/lib/skyline/rendering/helpers/renderer_helper.rb +14 -9
- data/lib/skyline/{renderer.rb → rendering/renderer.rb} +3 -4
- data/lib/skyline/{renderable_scope_interface.rb → rendering/scopes/interface.rb} +1 -1
- data/lib/skyline/{wildcard_renderable_scope.rb → rendering/scopes/wildcard.rb} +3 -3
- data/lib/skyline/{section_item.rb → sections/interface.rb} +17 -10
- data/lib/skyline/settings.rb +29 -19
- data/lib/skyline/taggable.rb +3 -3
- data/lib/skyline/version.rb +2 -2
- data/{tasks → lib/tasks}/database.rake +14 -2
- data/{tasks → lib/tasks}/implementation.rake +0 -0
- data/lib/tasks/testing.rake +41 -0
- data/public/skyline/images/backgrounds/panel-dt.gif +0 -0
- data/public/skyline/javascripts/src/application.js +114 -120
- data/public/skyline/javascripts/src/browser.js +22 -4
- data/public/skyline/javascripts/src/library_uploader.js +13 -3
- data/public/skyline/javascripts/src/sections.js +57 -6
- data/public/skyline/javascripts/src/skyline/src/dialog.js +6 -0
- data/public/skyline/javascripts/src/skyline/src/drag.js +6 -0
- data/public/skyline/javascripts/src/skyline/src/events.js +50 -0
- data/public/skyline/javascripts/src/skyline/src/field_replicator.js +12 -11
- data/public/skyline/javascripts/src/skyline/src/layout.js +172 -30
- data/public/skyline/javascripts/src/skyline/src/menu.js +3 -0
- data/public/skyline/javascripts/src/skyline/src/menubutton.js +3 -0
- data/public/skyline/javascripts/src/skyline/src/skyline.js +3 -0
- data/public/skyline/javascripts/src/skyline/src/table.js +398 -0
- data/public/skyline/javascripts/src/skyline/src/tabs.js +2 -2
- data/public/skyline/javascripts/src/skyline/src/tag_selector.js +34 -26
- data/public/skyline/javascripts/src/skyline/src/tree.js +3 -0
- data/public/skyline/javascripts/src/skyline/src/uploader.js +2 -2
- data/public/skyline/javascripts/src/skyline/src/utils.js +3 -0
- data/public/skyline/javascripts/src/skyline/test/_dynamic_right.html +24 -0
- data/public/skyline/javascripts/src/skyline/test/_right_content.html +1 -0
- data/public/skyline/javascripts/src/skyline/test/basic_layout.html +190 -0
- data/public/skyline/javascripts/src/skyline/test/dialog.html +101 -0
- data/public/skyline/javascripts/src/skyline/test/draggablefiles.html +196 -0
- data/public/skyline/javascripts/src/skyline/test/dynamic_layout.html +89 -0
- data/public/skyline/javascripts/src/skyline/test/field_replicator.html +60 -0
- data/public/skyline/javascripts/src/skyline/test/last-closed.gif +0 -0
- data/public/skyline/javascripts/src/skyline/test/last-open.gif +0 -0
- data/public/skyline/javascripts/src/skyline/test/menubutton.html +81 -0
- data/public/skyline/javascripts/src/skyline/test/middle.gif +0 -0
- data/public/skyline/javascripts/src/skyline/test/sortable.html +121 -0
- data/public/skyline/javascripts/src/skyline/test/table.html +521 -0
- data/public/skyline/javascripts/src/skyline/test/tagselector.html +72 -0
- data/public/skyline/javascripts/src/skyline/test/toggle.html +95 -0
- data/public/skyline/javascripts/src/skyline/test/tree.html +310 -0
- data/public/skyline/javascripts/src/skyline/test/tree.png +0 -0
- data/public/skyline/javascripts/src/skyline/test/undohtml.css +27 -0
- data/public/skyline/javascripts/src/skyline/vendor/fancyupload/Swiff.Uploader.js +2 -2
- data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-core.js +1 -354
- data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-more.js +64 -52
- data/public/skyline/javascripts/src/skyline.editor/assets/content.css +1 -1
- data/public/skyline/javascripts/src/skyline.editor/src/script_loader.js +156 -75
- data/public/skyline/javascripts/src/skyline.editor/src/skyline.editor.js +14 -4
- data/public/skyline/javascripts/src/skyline.editor/src/theme.js +8 -0
- data/public/skyline/javascripts/src/skyline.editor/test/dialog.html +28 -0
- data/public/skyline/javascripts/src/skyline.editor/test/lorem.html +7 -0
- data/public/skyline/javascripts/src/skyline.editor/test/multiple_editors.html +87 -0
- data/public/skyline/javascripts/src/skyline.editor/test/undohtml.css +27 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/changelog.txt +205 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/css/content.css +54 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/custom_formats.html +111 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/full.html +19 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/menu.html +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/simple.html +6 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/skins.html +14 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/translate.html +7 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/word.html +8 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/langs/en.js +18 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/rule.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/image.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -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 +52 -44
- 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 +388 -17
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +6 -3
- 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 +58 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin_src.js +8 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example/dialog.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin_src.js +6 -3
- 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 +10 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js +18 -8
- 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 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- 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 +18 -9
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/media.htm +2 -7
- 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 +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +6 -3
- 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 +564 -124
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/pastetext.htm +2 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/pasteword.htm +2 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin_src.js +6 -3
- 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 +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +4 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/searchreplace.htm +4 -9
- 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 +106 -27
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js +6 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/props.htm +4 -11
- 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 +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/cell.htm +2 -7
- 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 +921 -918
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js +41 -24
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/merge_cells.js +18 -20
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/row.js +48 -23
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/table.js +24 -15
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/merge_cells.htm +3 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/row.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/table.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js +10 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/template.htm +2 -9
- 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 +26 -16
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +3 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +3 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/cite.htm +3 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/del.htm +3 -11
- 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 +11 -15
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/ins.htm +3 -11
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +8 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/del.js +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +8 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +7 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/about.htm +1 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/anchor.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/charmap.htm +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm +2 -4
- 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 +252 -188
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/image.htm +2 -7
- 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/js/anchor.js +7 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/charmap.js +10 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/image.js +2 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js +4 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/link.htm +2 -7
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css +7 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css +4 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/ui.css +5 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css +7 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +3 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +4 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/source_editor.htm +2 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js +5 -5
- 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 +5492 -4341
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/editable_selects.js +5 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/form_utils.js +6 -5
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/mctabs.js +5 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/validate.js +5 -4
- data/public/skyline/javascripts/src/skyline.js +3 -1
- data/public/skyline/javascripts/src/user_preferences.js +49 -0
- data/public/skyline/stylesheets/general.css +149 -47
- data/rails/init.rb +3 -3
- data/test/factories.rb +28 -0
- data/test/integration/media_browser_super_access_test.rb +52 -0
- data/test/integration/media_browser_user_access_test.rb +50 -0
- data/test/integration/user_preferences_test.rb +73 -0
- data/test/mocks/test_content_object.rb +32 -0
- data/test/mocks/test_section.rb +22 -0
- data/test/test_helper.rb +60 -0
- data/test/unit/inline_ref_test.rb +195 -0
- data/test/unit/locales_test.rb +82 -0
- data/test/unit/page_test.rb +204 -0
- data/test/unit/test_content_object_test.rb +69 -0
- data/test/unit/test_section_test.rb +247 -0
- data/test/unit/user_preference_test.rb +123 -0
- data/test/unit/user_test.rb +74 -0
- data/test/user_access_helper.rb +36 -0
- data/vendor/digitpaint/personify/test/fixtures/multiple_tags.txt +8 -0
- data/vendor/digitpaint/personify/test/parse_runner.rb +25 -0
- data/vendor/digitpaint/personify/test/parser_test.rb +109 -0
- data/vendor/digitpaint/personify/test/test_helper.rb +16 -0
- data/vendor/digitpaint/personify/vendor/treetop/.gitignore +5 -0
- data/vendor/mootools-on-rails/lib/mootools_on_rails/mootools_helper.rb +13 -4
- data/vendor/mootools-on-rails/test/mootools_helper_test.rb +138 -0
- data/vendor/mootools-on-rails/test/test_helper.rb +5 -0
- data/vendor/weppos/url_validation.rb +76 -0
- metadata +384 -189
- data/app/controllers/skyline/media_dirs_controller.rb +0 -56
- data/app/controllers/skyline/media_files_controller.rb +0 -87
- data/app/helpers/skyline/presenters/article_list.rb +0 -139
- data/app/observers/skyline/media_file_observer.rb +0 -32
- data/app/views/skyline/media_dirs/_edit.html.erb +0 -25
- data/app/views/skyline/media_dirs/_index.html.erb +0 -14
- data/app/views/skyline/media_dirs/index.html.erb +0 -42
- data/app/views/skyline/media_files/_edit.html.erb +0 -75
- data/app/views/skyline/media_files/_header.html.erb +0 -3
- data/app/views/skyline/media_files/_index.html.erb +0 -51
- data/app/views/skyline/media_files/_new.html.erb +0 -50
- data/db/migrate/20090603104115_prefix_tables_for_skyline.rb +0 -30
- data/lib/skyline/indexer.rb +0 -36
- data/lib/skyline/renderable_scope.rb +0 -27
- data/lib/skyline/rendering/helpers/settings_helper.rb +0 -26
- data/lib/skyline/searchable_item.rb +0 -132
- data/lib/skyline/url_validation.rb +0 -66
- data/public/skyline/images/backgrounds/splitter.gif +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/build.bat +0 -2
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/build.xml +0 -364
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/full_jquery.html +0 -94
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/AddOnManager.js +0 -95
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/CommandManager.js +0 -54
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ControlManager.js +0 -489
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Developer.js +0 -91
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Editor.js +0 -2295
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/EditorCommands.js +0 -934
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/EditorManager.js +0 -453
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ForceBlocks.js +0 -644
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Popup.js +0 -412
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/UndoManager.js +0 -183
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/WindowManager.js +0 -169
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/jquery/adapter.js +0 -240
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/jquery/jquery.tinymce.js +0 -179
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/prototype/adapter.js +0 -38
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/BlockQuote.js +0 -135
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/CutCopyPaste.js +0 -24
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/InsertHorizontalRule.js +0 -15
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/RemoveFormat.js +0 -173
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/UndoRedo.js +0 -38
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/DOMUtils.js +0 -1823
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Element.js +0 -199
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/EventUtils.js +0 -349
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Range.js +0 -721
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/ScriptLoader.js +0 -351
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Selection.js +0 -747
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Serializer.js +0 -979
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Sizzle.js +0 -975
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/StringWriter.js +0 -200
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/TridentSelection.js +0 -273
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/XMLWriter.js +0 -155
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/firebug/firebug-lite.js +0 -2518
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/tinymce.js +0 -549
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Button.js +0 -68
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/ColorSplitButton.js +0 -212
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Container.js +0 -56
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Control.js +0 -182
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/DropMenu.js +0 -397
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/ListBox.js +0 -320
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Menu.js +0 -175
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/MenuButton.js +0 -128
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/MenuItem.js +0 -69
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/NativeListBox.js +0 -198
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Separator.js +0 -34
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/SplitButton.js +0 -99
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Toolbar.js +0 -86
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/Cookie.js +0 -126
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/Dispatcher.js +0 -101
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSON.js +0 -81
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSONP.js +0 -25
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSONRequest.js +0 -87
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/URI.js +0 -289
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/XHR.js +0 -80
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/xml/Parser.js +0 -126
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/jquery.tinymce.js +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/compat2x/editor_plugin.js +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/compat2x/editor_plugin_src.js +0 -616
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/blank.htm +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/editor_plugin.js +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/editor_plugin_src.js +0 -438
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_dev.js +0 -128
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_jquery.js +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_jquery_src.js +0 -12198
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_prototype.js +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_prototype_src.js +0 -13057
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api.html +0 -18
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api_jquery.html +0 -18
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api_prototype.html +0 -19
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/basic.html +0 -548
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/crossdomain.html +0 -87
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/css/unit.css +0 -120
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/index.html +0 -10
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/jquery_plugin.html +0 -112
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/js/api.js +0 -1438
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/js/testrunner.js +0 -791
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/main.html +0 -8
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/media.html +0 -221
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/menu.html +0 -22
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/parts.html +0 -90
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/paste.html +0 -132
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/performance.html +0 -152
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/range.html +0 -522
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/removeformat.html +0 -88
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/selection.html +0 -235
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/config.ini +0 -27
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/footer.html +0 -3
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/header.html +0 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/index.php +0 -1
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/instructions.txt +0 -4
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/logo.png +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/selectors.list +0 -40
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/style.css +0 -181
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/index.php +0 -112
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/slickspeed.js +0 -147
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/template.php +0 -47
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/template.html +0 -2865
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/test.xml +0 -6
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/ant-contrib.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/js_build_tools.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnClientAdapter.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnant.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnjavahl.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnkit.jar +0 -0
- data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/yuicompressor.jar +0 -0
|
@@ -1,1136 +1,1139 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* editor_plugin_src.js
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
|
-
(function() {
|
|
11
|
+
(function(tinymce) {
|
|
9
12
|
var each = tinymce.each;
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
rng2.setStartBefore(par);
|
|
19
|
+
rng2.setEnd(rng.endContainer, rng.endOffset);
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
['table', 'table.desc', 'mceInsertTable', true],
|
|
21
|
-
['delete_table', 'table.del', 'mceTableDelete'],
|
|
22
|
-
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
|
23
|
-
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
|
24
|
-
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
|
25
|
-
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
|
26
|
-
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
|
27
|
-
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
|
28
|
-
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
|
29
|
-
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
|
30
|
-
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
|
31
|
-
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
|
32
|
-
], function(c) {
|
|
33
|
-
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
|
34
|
-
});
|
|
21
|
+
elm = doc.createElement('body');
|
|
22
|
+
elm.appendChild(rng2.cloneContents());
|
|
35
23
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var dom = ed.dom;
|
|
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
|
+
};
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Table Grid class.
|
|
30
|
+
*/
|
|
31
|
+
function TableGrid(table, dom, selection) {
|
|
32
|
+
var grid, startPos, endPos, selectedCell;
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
buildGrid();
|
|
35
|
+
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
|
36
|
+
if (selectedCell) {
|
|
37
|
+
startPos = getPos(selectedCell);
|
|
38
|
+
endPos = findEndPos();
|
|
39
|
+
selectedCell = getCell(startPos.x, startPos.y);
|
|
40
|
+
}
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
42
|
+
function cloneNode(node, children) {
|
|
43
|
+
node = node.cloneNode(children);
|
|
44
|
+
node.removeAttribute('id');
|
|
56
45
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
|
60
|
-
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
|
46
|
+
return node;
|
|
47
|
+
}
|
|
61
48
|
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
function buildGrid() {
|
|
50
|
+
var startY = 0;
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
|
67
|
-
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
|
68
|
-
m.addSeparator();
|
|
69
|
-
}
|
|
52
|
+
grid = [];
|
|
70
53
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
m.addSeparator();
|
|
74
|
-
}
|
|
54
|
+
each(['thead', 'tbody', 'tfoot'], function(part) {
|
|
55
|
+
var rows = dom.select('> ' + part + ' tr', table);
|
|
75
56
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
|
|
79
|
-
m.addSeparator();
|
|
57
|
+
each(rows, function(tr, y) {
|
|
58
|
+
y += startY;
|
|
80
59
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
|
|
84
|
-
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
|
|
85
|
-
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
|
|
60
|
+
each(dom.select('> td, > th', tr), function(td, x) {
|
|
61
|
+
var x2, y2, rowspan, colspan;
|
|
86
62
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
|
93
|
-
sm.addSeparator();
|
|
94
|
-
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
|
95
|
-
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
|
96
|
-
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
|
|
97
|
-
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
|
|
63
|
+
// Skip over existing cells produced by rowspan
|
|
64
|
+
if (grid[y]) {
|
|
65
|
+
while (grid[y][x])
|
|
66
|
+
x++;
|
|
67
|
+
}
|
|
98
68
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
69
|
+
// Get col/rowspan from cell
|
|
70
|
+
rowspan = getSpanVal(td, 'rowspan');
|
|
71
|
+
colspan = getSpanVal(td, 'colspan');
|
|
72
|
+
|
|
73
|
+
// Fill out rowspan/colspan right and down
|
|
74
|
+
for (y2 = y; y2 < y + rowspan; y2++) {
|
|
75
|
+
if (!grid[y2])
|
|
76
|
+
grid[y2] = [];
|
|
77
|
+
|
|
78
|
+
for (x2 = x; x2 < x + colspan; x2++) {
|
|
79
|
+
grid[y2][x2] = {
|
|
80
|
+
part : part,
|
|
81
|
+
real : y2 == y && x2 == x,
|
|
82
|
+
elm : td,
|
|
83
|
+
rowspan : rowspan,
|
|
84
|
+
colspan : colspan
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
106
88
|
});
|
|
107
|
-
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
startY += rows.length;
|
|
108
92
|
});
|
|
93
|
+
};
|
|
109
94
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) {
|
|
113
|
-
if (!tinymce.isGecko && !tinymce.isOpera) {
|
|
114
|
-
tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true);
|
|
115
|
-
return tinymce.dom.Event.cancel(e);
|
|
116
|
-
}
|
|
95
|
+
function getCell(x, y) {
|
|
96
|
+
var row;
|
|
117
97
|
|
|
118
|
-
|
|
119
|
-
|
|
98
|
+
row = grid[y];
|
|
99
|
+
if (row)
|
|
100
|
+
return row[x];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function getSpanVal(td, name) {
|
|
104
|
+
return parseInt(td.getAttribute(name) || 1);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function isCellSelected(cell) {
|
|
108
|
+
return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
function getSelectedRows() {
|
|
112
|
+
var rows = [];
|
|
113
|
+
|
|
114
|
+
each(table.rows, function(row) {
|
|
115
|
+
each(row.cells, function(cell) {
|
|
116
|
+
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
|
117
|
+
rows.push(row);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
120
121
|
});
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (ed.getParam('table_selection', true)) {
|
|
125
|
-
ed.onClick.add(function(ed, e) {
|
|
126
|
-
e = e.target;
|
|
123
|
+
return rows;
|
|
124
|
+
};
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
126
|
+
function deleteTable() {
|
|
127
|
+
var rng = dom.createRng();
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
rng.setStartAfter(table);
|
|
130
|
+
rng.setEndAfter(table);
|
|
136
131
|
|
|
137
|
-
|
|
138
|
-
if (p && p.nodeName === 'CAPTION')
|
|
139
|
-
p = null;
|
|
132
|
+
selection.setRng(rng);
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
cm.setDisabled('delete_table', !p);
|
|
144
|
-
cm.setDisabled('delete_row', !p);
|
|
145
|
-
cm.setDisabled('col_after', !p);
|
|
146
|
-
cm.setDisabled('col_before', !p);
|
|
147
|
-
cm.setDisabled('row_after', !p);
|
|
148
|
-
cm.setDisabled('row_before', !p);
|
|
149
|
-
cm.setDisabled('row_props', !p);
|
|
150
|
-
cm.setDisabled('cell_props', !p);
|
|
151
|
-
cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
|
|
152
|
-
cm.setDisabled('merge_cells', !p);
|
|
153
|
-
});
|
|
134
|
+
dom.remove(table);
|
|
135
|
+
};
|
|
154
136
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
ed.onBeforeSetContent.add(function(ed, o) {
|
|
158
|
-
if (o.initial)
|
|
159
|
-
o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> </$1>' : '<$1$2><br mce_bogus="1" /></$1>');
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
execCommand : function(cmd, ui, val) {
|
|
165
|
-
var ed = this.editor, b;
|
|
166
|
-
|
|
167
|
-
// Is table command
|
|
168
|
-
switch (cmd) {
|
|
169
|
-
case "mceTableMoveToNextRow":
|
|
170
|
-
case "mceInsertTable":
|
|
171
|
-
case "mceTableRowProps":
|
|
172
|
-
case "mceTableCellProps":
|
|
173
|
-
case "mceTableSplitCells":
|
|
174
|
-
case "mceTableMergeCells":
|
|
175
|
-
case "mceTableInsertRowBefore":
|
|
176
|
-
case "mceTableInsertRowAfter":
|
|
177
|
-
case "mceTableDeleteRow":
|
|
178
|
-
case "mceTableInsertColBefore":
|
|
179
|
-
case "mceTableInsertColAfter":
|
|
180
|
-
case "mceTableDeleteCol":
|
|
181
|
-
case "mceTableCutRow":
|
|
182
|
-
case "mceTableCopyRow":
|
|
183
|
-
case "mceTablePasteRowBefore":
|
|
184
|
-
case "mceTablePasteRowAfter":
|
|
185
|
-
case "mceTableDelete":
|
|
186
|
-
ed.execCommand('mceBeginUndoLevel');
|
|
187
|
-
this._doExecCommand(cmd, ui, val);
|
|
188
|
-
ed.execCommand('mceEndUndoLevel');
|
|
189
|
-
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
137
|
+
function cloneCell(cell) {
|
|
138
|
+
var formatNode;
|
|
192
139
|
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
getInfo : function() {
|
|
198
|
-
return {
|
|
199
|
-
longname : 'Tables',
|
|
200
|
-
author : 'Moxiecode Systems AB',
|
|
201
|
-
authorurl : 'http://tinymce.moxiecode.com',
|
|
202
|
-
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
|
|
203
|
-
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
// Private plugin internal methods
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Executes the table commands.
|
|
211
|
-
*/
|
|
212
|
-
_doExecCommand : function(command, user_interface, value) {
|
|
213
|
-
var inst = this.editor, ed = inst, url = this.url;
|
|
214
|
-
var focusElm = inst.selection.getNode();
|
|
215
|
-
var trElm = inst.dom.getParent(focusElm, "tr");
|
|
216
|
-
var tdElm = inst.dom.getParent(focusElm, "td,th");
|
|
217
|
-
var tableElm = inst.dom.getParent(focusElm, "table");
|
|
218
|
-
var doc = inst.contentWindow.document;
|
|
219
|
-
var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
|
|
220
|
-
|
|
221
|
-
// Get first TD if no TD found
|
|
222
|
-
if (trElm && tdElm == null)
|
|
223
|
-
tdElm = trElm.cells[0];
|
|
224
|
-
|
|
225
|
-
function inArray(ar, v) {
|
|
226
|
-
for (var i=0; i<ar.length; i++) {
|
|
227
|
-
// Is array
|
|
228
|
-
if (ar[i].length > 0 && inArray(ar[i], v))
|
|
229
|
-
return true;
|
|
230
|
-
|
|
231
|
-
// Found value
|
|
232
|
-
if (ar[i] == v)
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
140
|
+
// Clone formats
|
|
141
|
+
tinymce.walk(cell, function(node) {
|
|
142
|
+
var curNode;
|
|
235
143
|
|
|
236
|
-
|
|
237
|
-
|
|
144
|
+
if (node.nodeType == 3) {
|
|
145
|
+
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
|
146
|
+
node = cloneNode(node, false);
|
|
238
147
|
|
|
239
|
-
|
|
240
|
-
|
|
148
|
+
if (!formatNode)
|
|
149
|
+
formatNode = curNode = node;
|
|
150
|
+
else if (curNode)
|
|
151
|
+
curNode.appendChild(node);
|
|
241
152
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
dy = dy || 0;
|
|
245
|
-
dx = Math.max(cpos.cellindex + dx, 0);
|
|
246
|
-
dy = Math.max(cpos.rowindex + dy, 0);
|
|
153
|
+
curNode = node;
|
|
154
|
+
});
|
|
247
155
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
156
|
+
// Add something to the inner node
|
|
157
|
+
if (curNode)
|
|
158
|
+
curNode.innerHTML = tinymce.isIE ? ' ' : '<br _mce_bogus="1" />';
|
|
251
159
|
|
|
252
|
-
|
|
253
|
-
inst.selection.select(td.firstChild || td);
|
|
254
|
-
inst.selection.collapse(1);
|
|
160
|
+
return false;
|
|
255
161
|
}
|
|
256
|
-
};
|
|
162
|
+
}, 'childNodes');
|
|
257
163
|
|
|
258
|
-
|
|
259
|
-
|
|
164
|
+
cell = cloneNode(cell, false);
|
|
165
|
+
cell.rowSpan = cell.colSpan = 1;
|
|
260
166
|
|
|
167
|
+
if (formatNode) {
|
|
168
|
+
cell.appendChild(formatNode);
|
|
169
|
+
} else {
|
|
261
170
|
if (!tinymce.isIE)
|
|
262
|
-
|
|
171
|
+
cell.innerHTML = '<br _mce_bogus="1" />';
|
|
263
172
|
}
|
|
264
173
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var rowspan = inst.dom.getAttrib(td, "rowspan");
|
|
174
|
+
return cell;
|
|
175
|
+
};
|
|
268
176
|
|
|
269
|
-
|
|
270
|
-
|
|
177
|
+
function cleanup() {
|
|
178
|
+
var rng = dom.createRng();
|
|
271
179
|
|
|
272
|
-
|
|
180
|
+
// Empty rows
|
|
181
|
+
each(dom.select('tr', table), function(tr) {
|
|
182
|
+
if (tr.cells.length == 0)
|
|
183
|
+
dom.remove(tr);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Empty table
|
|
187
|
+
if (dom.select('tr', table).length == 0) {
|
|
188
|
+
rng.setStartAfter(table);
|
|
189
|
+
rng.setEndAfter(table);
|
|
190
|
+
selection.setRng(rng);
|
|
191
|
+
dom.remove(table);
|
|
192
|
+
return;
|
|
273
193
|
}
|
|
274
194
|
|
|
275
|
-
|
|
276
|
-
|
|
195
|
+
// Empty header/body/footer
|
|
196
|
+
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
|
197
|
+
if (part.rows.length == 0)
|
|
198
|
+
dom.remove(part);
|
|
199
|
+
});
|
|
277
200
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (grid[y][x] == td)
|
|
281
|
-
return {cellindex : x, rowindex : y};
|
|
282
|
-
}
|
|
283
|
-
}
|
|
201
|
+
// Restore selection to start position if it still exists
|
|
202
|
+
buildGrid();
|
|
284
203
|
|
|
285
|
-
|
|
204
|
+
// Restore the selection to the closest table position
|
|
205
|
+
row = grid[Math.min(grid.length - 1, startPos.y)];
|
|
206
|
+
if (row) {
|
|
207
|
+
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
|
208
|
+
selection.collapse(true);
|
|
286
209
|
}
|
|
210
|
+
};
|
|
287
211
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return grid[row][col];
|
|
212
|
+
function fillLeftDown(x, y, rows, cols) {
|
|
213
|
+
var tr, x2, r, c, cell;
|
|
291
214
|
|
|
292
|
-
|
|
293
|
-
|
|
215
|
+
tr = grid[y][x].elm.parentNode;
|
|
216
|
+
for (r = 1; r <= rows; r++) {
|
|
217
|
+
tr = dom.getNext(tr, 'tr');
|
|
294
218
|
|
|
295
|
-
|
|
296
|
-
|
|
219
|
+
if (tr) {
|
|
220
|
+
// Loop left to find real cell
|
|
221
|
+
for (x2 = x; x2 >= 0; x2--) {
|
|
222
|
+
cell = grid[y + r][x2].elm;
|
|
297
223
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
224
|
+
if (cell.parentNode == tr) {
|
|
225
|
+
// Append clones after
|
|
226
|
+
for (c = 1; c <= cols; c++)
|
|
227
|
+
dom.insertAfter(cloneCell(cell), cell);
|
|
301
228
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (x2 == -1) {
|
|
234
|
+
// Insert nodes before first cell
|
|
235
|
+
for (c = 1; c <= cols; c++)
|
|
236
|
+
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
306
239
|
}
|
|
240
|
+
};
|
|
307
241
|
|
|
308
|
-
|
|
309
|
-
|
|
242
|
+
function split() {
|
|
243
|
+
each(grid, function(row, y) {
|
|
244
|
+
each(row, function(cell, x) {
|
|
245
|
+
var colSpan, rowSpan, newCell, i;
|
|
310
246
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
247
|
+
if (isCellSelected(cell)) {
|
|
248
|
+
cell = cell.elm;
|
|
249
|
+
colSpan = getSpanVal(cell, 'colspan');
|
|
250
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
|
315
251
|
|
|
316
|
-
|
|
317
|
-
|
|
252
|
+
if (colSpan > 1 || rowSpan > 1) {
|
|
253
|
+
cell.colSpan = cell.rowSpan = 1;
|
|
318
254
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
255
|
+
// Insert cells right
|
|
256
|
+
for (i = 0; i < colSpan - 1; i++)
|
|
257
|
+
dom.insertAfter(cloneCell(cell), cell);
|
|
258
|
+
|
|
259
|
+
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
function merge(cell, cols, rows) {
|
|
267
|
+
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
|
|
268
|
+
|
|
269
|
+
// Use specified cell and cols/rows
|
|
270
|
+
if (cell) {
|
|
271
|
+
pos = getPos(cell);
|
|
272
|
+
startX = pos.x;
|
|
273
|
+
startY = pos.y;
|
|
274
|
+
endX = startX + (cols - 1);
|
|
275
|
+
endY = startY + (rows - 1);
|
|
276
|
+
} else {
|
|
277
|
+
// Use selection
|
|
278
|
+
startX = startPos.x;
|
|
279
|
+
startY = startPos.y;
|
|
280
|
+
endX = endPos.x;
|
|
281
|
+
endY = endPos.y;
|
|
282
|
+
}
|
|
323
283
|
|
|
324
|
-
|
|
325
|
-
|
|
284
|
+
// Find start/end cells
|
|
285
|
+
startCell = getCell(startX, startY);
|
|
286
|
+
endCell = getCell(endX, endY);
|
|
287
|
+
|
|
288
|
+
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
|
289
|
+
if (startCell && endCell && startCell.part == endCell.part) {
|
|
290
|
+
// Split and rebuild grid
|
|
291
|
+
split();
|
|
292
|
+
buildGrid();
|
|
293
|
+
|
|
294
|
+
// Set row/col span to start cell
|
|
295
|
+
startCell = getCell(startX, startY).elm;
|
|
296
|
+
startCell.colSpan = (endX - startX) + 1;
|
|
297
|
+
startCell.rowSpan = (endY - startY) + 1;
|
|
298
|
+
|
|
299
|
+
// Remove other cells and add it's contents to the start cell
|
|
300
|
+
for (y = startY; y <= endY; y++) {
|
|
301
|
+
for (x = startX; x <= endX; x++) {
|
|
302
|
+
cell = grid[y][x].elm;
|
|
303
|
+
|
|
304
|
+
if (cell != startCell) {
|
|
305
|
+
// Move children to startCell
|
|
306
|
+
children = tinymce.grep(cell.childNodes);
|
|
307
|
+
each(children, function(node, i) {
|
|
308
|
+
// Jump over last BR element
|
|
309
|
+
if (node.nodeName != 'BR' || i != children.length - 1)
|
|
310
|
+
startCell.appendChild(node);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// Remove cell
|
|
314
|
+
dom.remove(cell);
|
|
326
315
|
}
|
|
327
316
|
}
|
|
328
317
|
}
|
|
329
318
|
|
|
330
|
-
|
|
319
|
+
// Remove empty rows etc and restore caret location
|
|
320
|
+
cleanup();
|
|
331
321
|
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
function insertRow(before) {
|
|
325
|
+
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
|
|
326
|
+
|
|
327
|
+
// Find first/last row
|
|
328
|
+
each(grid, function(row, y) {
|
|
329
|
+
each(row, function(cell, x) {
|
|
330
|
+
if (isCellSelected(cell)) {
|
|
331
|
+
cell = cell.elm;
|
|
332
|
+
rowElm = cell.parentNode;
|
|
333
|
+
newRow = cloneNode(rowElm, false);
|
|
334
|
+
posY = y;
|
|
335
|
+
|
|
336
|
+
if (before)
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
332
340
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
// Time to crop away some
|
|
338
|
-
if (new_tr.cells.length != tr.childNodes.length) {
|
|
339
|
-
cells = tr.childNodes;
|
|
340
|
-
lastElm = null;
|
|
341
|
-
|
|
342
|
-
for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
|
|
343
|
-
var remove = true;
|
|
344
|
-
var sd = getColRowSpan(td);
|
|
345
|
-
|
|
346
|
-
// Remove due to rowspan
|
|
347
|
-
if (inArray(cells, td)) {
|
|
348
|
-
new_tr.childNodes[x]._delete = true;
|
|
349
|
-
} else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
|
|
350
|
-
for (var i=x; i<x+td.colSpan; i++)
|
|
351
|
-
new_tr.childNodes[i]._delete = true;
|
|
352
|
-
}
|
|
341
|
+
if (before)
|
|
342
|
+
return !posY;
|
|
343
|
+
});
|
|
353
344
|
|
|
354
|
-
|
|
355
|
-
|
|
345
|
+
for (x = 0; x < grid[0].length; x++) {
|
|
346
|
+
cell = grid[posY][x].elm;
|
|
356
347
|
|
|
357
|
-
|
|
348
|
+
if (cell != lastCell) {
|
|
349
|
+
if (!before) {
|
|
350
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
|
351
|
+
if (rowSpan > 1) {
|
|
352
|
+
cell.rowSpan = rowSpan + 1;
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
} else {
|
|
356
|
+
// Check if cell above can be expanded
|
|
357
|
+
if (posY > 0 && grid[posY - 1][x]) {
|
|
358
|
+
otherCell = grid[posY - 1][x].elm;
|
|
359
|
+
rowSpan = getSpanVal(otherCell, 'rowspan');
|
|
360
|
+
if (rowSpan > 1) {
|
|
361
|
+
otherCell.rowSpan = rowSpan + 1;
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
358
365
|
}
|
|
359
366
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
367
|
+
// Insert new cell into new row
|
|
368
|
+
newCell = cloneCell(cell)
|
|
369
|
+
newCell.colSpan = cell.colSpan;
|
|
370
|
+
newRow.appendChild(newCell);
|
|
363
371
|
|
|
364
|
-
|
|
365
|
-
while ((node = node.previousSibling) != null) {
|
|
366
|
-
if (node.nodeName == name)
|
|
367
|
-
return node;
|
|
372
|
+
lastCell = cell;
|
|
368
373
|
}
|
|
374
|
+
}
|
|
369
375
|
|
|
370
|
-
|
|
376
|
+
if (newRow.hasChildNodes()) {
|
|
377
|
+
if (!before)
|
|
378
|
+
dom.insertAfter(newRow, rowElm);
|
|
379
|
+
else
|
|
380
|
+
rowElm.parentNode.insertBefore(newRow, rowElm);
|
|
371
381
|
}
|
|
382
|
+
};
|
|
372
383
|
|
|
373
|
-
|
|
374
|
-
|
|
384
|
+
function insertCol(before) {
|
|
385
|
+
var posX, lastCell;
|
|
375
386
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
387
|
+
// Find first/last column
|
|
388
|
+
each(grid, function(row, y) {
|
|
389
|
+
each(row, function(cell, x) {
|
|
390
|
+
if (isCellSelected(cell)) {
|
|
391
|
+
posX = x;
|
|
392
|
+
|
|
393
|
+
if (before)
|
|
394
|
+
return false;
|
|
380
395
|
}
|
|
381
|
-
}
|
|
396
|
+
});
|
|
382
397
|
|
|
383
|
-
|
|
384
|
-
|
|
398
|
+
if (before)
|
|
399
|
+
return !posX;
|
|
400
|
+
});
|
|
385
401
|
|
|
386
|
-
function
|
|
387
|
-
|
|
388
|
-
return;
|
|
402
|
+
each(grid, function(row, y) {
|
|
403
|
+
var cell = row[posX].elm, rowSpan, colSpan;
|
|
389
404
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
405
|
+
if (cell != lastCell) {
|
|
406
|
+
colSpan = getSpanVal(cell, 'colspan');
|
|
407
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
|
393
408
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
409
|
+
if (colSpan == 1) {
|
|
410
|
+
if (!before) {
|
|
411
|
+
dom.insertAfter(cloneCell(cell), cell);
|
|
412
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
|
413
|
+
} else {
|
|
414
|
+
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
|
415
|
+
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
|
416
|
+
}
|
|
417
|
+
} else
|
|
418
|
+
cell.colSpan++;
|
|
419
|
+
|
|
420
|
+
lastCell = cell;
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
function deleteCols() {
|
|
426
|
+
var cols = [];
|
|
399
427
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
428
|
+
// Get selected column indexes
|
|
429
|
+
each(grid, function(row, y) {
|
|
430
|
+
each(row, function(cell, x) {
|
|
431
|
+
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
|
432
|
+
each(grid, function(row) {
|
|
433
|
+
var cell = row[x].elm, colSpan;
|
|
434
|
+
|
|
435
|
+
colSpan = getSpanVal(cell, 'colspan');
|
|
436
|
+
|
|
437
|
+
if (colSpan > 1)
|
|
438
|
+
cell.colSpan = colSpan - 1;
|
|
439
|
+
else
|
|
440
|
+
dom.remove(cell);
|
|
441
|
+
});
|
|
405
442
|
|
|
406
|
-
|
|
407
|
-
td.parentNode.removeChild(td);
|
|
408
|
-
} while ((td = nexttd) != null);
|
|
443
|
+
cols.push(x);
|
|
409
444
|
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
445
|
+
});
|
|
446
|
+
});
|
|
412
447
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
td_elm.rowSpan = 1;
|
|
416
|
-
var trNext = nextElm(tr_elm, "TR");
|
|
417
|
-
for (var i=1; i<rowspan && trNext; i++) {
|
|
418
|
-
var newTD = doc.createElement("td");
|
|
448
|
+
cleanup();
|
|
449
|
+
};
|
|
419
450
|
|
|
420
|
-
|
|
421
|
-
|
|
451
|
+
function deleteRows() {
|
|
452
|
+
var rows;
|
|
422
453
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
else
|
|
426
|
-
trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
|
|
454
|
+
function deleteRow(tr) {
|
|
455
|
+
var nextTr, pos, lastCell;
|
|
427
456
|
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
}
|
|
457
|
+
nextTr = dom.getNext(tr, 'tr');
|
|
431
458
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
|
|
441
|
-
var newTD = null;
|
|
442
|
-
|
|
443
|
-
if (lastCell != tdElm) {
|
|
444
|
-
for (var i=0; i<tr.cells.length; i++) {
|
|
445
|
-
if (tdElm == tr.cells[i]) {
|
|
446
|
-
newTD = tdElm.cloneNode(true);
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
459
|
+
// Move down row spanned cells
|
|
460
|
+
each(tr.cells, function(cell) {
|
|
461
|
+
var rowSpan = getSpanVal(cell, 'rowspan');
|
|
462
|
+
|
|
463
|
+
if (rowSpan > 1) {
|
|
464
|
+
cell.rowSpan = rowSpan - 1;
|
|
465
|
+
pos = getPos(cell);
|
|
466
|
+
fillLeftDown(pos.x, pos.y, 1, 1);
|
|
450
467
|
}
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// Delete cells
|
|
471
|
+
pos = getPos(tr.cells[0]);
|
|
472
|
+
each(grid[pos.y], function(cell) {
|
|
473
|
+
var rowSpan;
|
|
474
|
+
|
|
475
|
+
cell = cell.elm;
|
|
451
476
|
|
|
452
|
-
if (
|
|
453
|
-
|
|
477
|
+
if (cell != lastCell) {
|
|
478
|
+
rowSpan = getSpanVal(cell, 'rowspan');
|
|
454
479
|
|
|
455
|
-
if (
|
|
456
|
-
|
|
480
|
+
if (rowSpan <= 1)
|
|
481
|
+
dom.remove(cell);
|
|
482
|
+
else
|
|
483
|
+
cell.rowSpan = rowSpan - 1;
|
|
484
|
+
|
|
485
|
+
lastCell = cell;
|
|
457
486
|
}
|
|
487
|
+
});
|
|
488
|
+
};
|
|
458
489
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
newTD.rowSpan = 1;
|
|
490
|
+
// Get selected rows and move selection out of scope
|
|
491
|
+
rows = getSelectedRows();
|
|
462
492
|
|
|
463
|
-
|
|
493
|
+
// Delete all selected rows
|
|
494
|
+
each(rows.reverse(), function(tr) {
|
|
495
|
+
deleteRow(tr);
|
|
496
|
+
});
|
|
464
497
|
|
|
465
|
-
|
|
466
|
-
|
|
498
|
+
cleanup();
|
|
499
|
+
};
|
|
467
500
|
|
|
468
|
-
|
|
469
|
-
|
|
501
|
+
function cutRows() {
|
|
502
|
+
var rows = getSelectedRows();
|
|
470
503
|
|
|
471
|
-
|
|
504
|
+
dom.remove(rows);
|
|
505
|
+
cleanup();
|
|
472
506
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
case "mceTableMoveToNextRow":
|
|
476
|
-
var nextCell = getNextCell(tableElm, tdElm);
|
|
507
|
+
return rows;
|
|
508
|
+
};
|
|
477
509
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
nextCell = getNextCell(tableElm, tdElm);
|
|
481
|
-
}
|
|
510
|
+
function copyRows() {
|
|
511
|
+
var rows = getSelectedRows();
|
|
482
512
|
|
|
483
|
-
|
|
484
|
-
|
|
513
|
+
each(rows, function(row, i) {
|
|
514
|
+
rows[i] = cloneNode(row, true);
|
|
515
|
+
});
|
|
485
516
|
|
|
486
|
-
|
|
517
|
+
return rows;
|
|
518
|
+
};
|
|
487
519
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
520
|
+
function pasteRows(rows, before) {
|
|
521
|
+
var selectedRows = getSelectedRows(),
|
|
522
|
+
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
|
523
|
+
targetCellCount = targetRow.cells.length;
|
|
491
524
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
|
|
496
|
-
height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
|
|
497
|
-
inline : 1
|
|
498
|
-
}, {
|
|
499
|
-
plugin_url : url
|
|
500
|
-
});
|
|
501
|
-
}
|
|
525
|
+
// Calc target cell count
|
|
526
|
+
each(grid, function(row) {
|
|
527
|
+
var match;
|
|
502
528
|
|
|
503
|
-
|
|
529
|
+
targetCellCount = 0;
|
|
530
|
+
each(row, function(cell, x) {
|
|
531
|
+
if (cell.real)
|
|
532
|
+
targetCellCount += cell.colspan;
|
|
504
533
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
534
|
+
if (cell.elm.parentNode == targetRow)
|
|
535
|
+
match = 1;
|
|
536
|
+
});
|
|
508
537
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
|
|
513
|
-
height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
|
|
514
|
-
inline : 1
|
|
515
|
-
}, {
|
|
516
|
-
plugin_url : url
|
|
517
|
-
});
|
|
518
|
-
}
|
|
538
|
+
if (match)
|
|
539
|
+
return false;
|
|
540
|
+
});
|
|
519
541
|
|
|
520
|
-
|
|
542
|
+
if (!before)
|
|
543
|
+
rows.reverse();
|
|
521
544
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
inst.windowManager.open({
|
|
525
|
-
url : url + '/table.htm',
|
|
526
|
-
width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
|
|
527
|
-
height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
|
|
528
|
-
inline : 1
|
|
529
|
-
}, {
|
|
530
|
-
plugin_url : url,
|
|
531
|
-
action : value ? value.action : 0
|
|
532
|
-
});
|
|
533
|
-
}
|
|
545
|
+
each(rows, function(row) {
|
|
546
|
+
var cellCount = row.cells.length, cell;
|
|
534
547
|
|
|
535
|
-
|
|
548
|
+
// Remove col/rowspans
|
|
549
|
+
for (i = 0; i < cellCount; i++) {
|
|
550
|
+
cell = row.cells[i];
|
|
551
|
+
cell.colSpan = cell.rowSpan = 1;
|
|
552
|
+
}
|
|
536
553
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
table.parentNode.removeChild(table);
|
|
541
|
-
inst.execCommand('mceRepaint');
|
|
542
|
-
}
|
|
543
|
-
return true;
|
|
544
|
-
|
|
545
|
-
case "mceTableSplitCells":
|
|
546
|
-
case "mceTableMergeCells":
|
|
547
|
-
case "mceTableInsertRowBefore":
|
|
548
|
-
case "mceTableInsertRowAfter":
|
|
549
|
-
case "mceTableDeleteRow":
|
|
550
|
-
case "mceTableInsertColBefore":
|
|
551
|
-
case "mceTableInsertColAfter":
|
|
552
|
-
case "mceTableDeleteCol":
|
|
553
|
-
case "mceTableCutRow":
|
|
554
|
-
case "mceTableCopyRow":
|
|
555
|
-
case "mceTablePasteRowBefore":
|
|
556
|
-
case "mceTablePasteRowAfter":
|
|
557
|
-
// No table just return (invalid command)
|
|
558
|
-
if (!tableElm)
|
|
559
|
-
return true;
|
|
560
|
-
|
|
561
|
-
// Table has a tbody use that reference
|
|
562
|
-
// Changed logic by ApTest 2005.07.12 (www.aptest.com)
|
|
563
|
-
// Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
|
|
564
|
-
if (trElm && tableElm != trElm.parentNode)
|
|
565
|
-
tableElm = trElm.parentNode;
|
|
566
|
-
|
|
567
|
-
if (tableElm && trElm) {
|
|
568
|
-
switch (command) {
|
|
569
|
-
case "mceTableCutRow":
|
|
570
|
-
if (!trElm || !tdElm)
|
|
571
|
-
return true;
|
|
572
|
-
|
|
573
|
-
inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
|
|
574
|
-
inst.execCommand("mceTableDeleteRow");
|
|
575
|
-
break;
|
|
576
|
-
|
|
577
|
-
case "mceTableCopyRow":
|
|
578
|
-
if (!trElm || !tdElm)
|
|
579
|
-
return true;
|
|
580
|
-
|
|
581
|
-
inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
|
|
582
|
-
break;
|
|
583
|
-
|
|
584
|
-
case "mceTablePasteRowBefore":
|
|
585
|
-
if (!trElm || !tdElm)
|
|
586
|
-
return true;
|
|
587
|
-
|
|
588
|
-
var newTR = inst.tableRowClipboard.cloneNode(true);
|
|
589
|
-
|
|
590
|
-
var prevTR = prevElm(trElm, "TR");
|
|
591
|
-
if (prevTR != null)
|
|
592
|
-
trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
|
|
593
|
-
|
|
594
|
-
trElm.parentNode.insertBefore(newTR, trElm);
|
|
595
|
-
break;
|
|
596
|
-
|
|
597
|
-
case "mceTablePasteRowAfter":
|
|
598
|
-
if (!trElm || !tdElm)
|
|
599
|
-
return true;
|
|
600
|
-
|
|
601
|
-
var nextTR = nextElm(trElm, "TR");
|
|
602
|
-
var newTR = inst.tableRowClipboard.cloneNode(true);
|
|
603
|
-
|
|
604
|
-
trimRow(tableElm, trElm, tdElm, newTR);
|
|
605
|
-
|
|
606
|
-
if (nextTR == null)
|
|
607
|
-
trElm.parentNode.appendChild(newTR);
|
|
608
|
-
else
|
|
609
|
-
nextTR.parentNode.insertBefore(newTR, nextTR);
|
|
610
|
-
|
|
611
|
-
break;
|
|
612
|
-
|
|
613
|
-
case "mceTableInsertRowBefore":
|
|
614
|
-
if (!trElm || !tdElm)
|
|
615
|
-
return true;
|
|
616
|
-
|
|
617
|
-
var grid = getTableGrid(tableElm);
|
|
618
|
-
var cpos = getCellPos(grid, tdElm);
|
|
619
|
-
var newTR = doc.createElement("tr");
|
|
620
|
-
var lastTDElm = null;
|
|
621
|
-
|
|
622
|
-
cpos.rowindex--;
|
|
623
|
-
if (cpos.rowindex < 0)
|
|
624
|
-
cpos.rowindex = 0;
|
|
625
|
-
|
|
626
|
-
// Create cells
|
|
627
|
-
for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
|
|
628
|
-
if (tdElm != lastTDElm) {
|
|
629
|
-
var sd = getColRowSpan(tdElm);
|
|
630
|
-
|
|
631
|
-
if (sd['rowspan'] == 1) {
|
|
632
|
-
var newTD = doc.createElement("td");
|
|
633
|
-
|
|
634
|
-
if (!tinymce.isIE)
|
|
635
|
-
newTD.innerHTML = '<br mce_bogus="1"/>';
|
|
636
|
-
|
|
637
|
-
newTD.colSpan = tdElm.colSpan;
|
|
638
|
-
|
|
639
|
-
newTR.appendChild(newTD);
|
|
640
|
-
} else
|
|
641
|
-
tdElm.rowSpan = sd['rowspan'] + 1;
|
|
642
|
-
|
|
643
|
-
lastTDElm = tdElm;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
554
|
+
// Needs more cells
|
|
555
|
+
for (i = cellCount; i < targetCellCount; i++)
|
|
556
|
+
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
|
646
557
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
558
|
+
// Needs less cells
|
|
559
|
+
for (i = targetCellCount; i < cellCount; i++)
|
|
560
|
+
dom.remove(row.cells[i]);
|
|
650
561
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
562
|
+
// Add before/after
|
|
563
|
+
if (before)
|
|
564
|
+
targetRow.parentNode.insertBefore(row, targetRow);
|
|
565
|
+
else
|
|
566
|
+
dom.insertAfter(row, targetRow);
|
|
567
|
+
});
|
|
568
|
+
};
|
|
654
569
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
var newTR = doc.createElement("tr");
|
|
658
|
-
var lastTDElm = null;
|
|
570
|
+
function getPos(target) {
|
|
571
|
+
var pos;
|
|
659
572
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
573
|
+
each(grid, function(row, y) {
|
|
574
|
+
each(row, function(cell, x) {
|
|
575
|
+
if (cell.elm == target) {
|
|
576
|
+
pos = {x : x, y : y};
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
664
580
|
|
|
665
|
-
|
|
666
|
-
|
|
581
|
+
return !pos;
|
|
582
|
+
});
|
|
667
583
|
|
|
668
|
-
|
|
669
|
-
|
|
584
|
+
return pos;
|
|
585
|
+
};
|
|
670
586
|
|
|
671
|
-
|
|
587
|
+
function setStartCell(cell) {
|
|
588
|
+
startPos = getPos(cell);
|
|
589
|
+
};
|
|
672
590
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
tdElm.rowSpan = sd['rowspan'] + 1;
|
|
591
|
+
function findEndPos() {
|
|
592
|
+
var pos, maxX, maxY;
|
|
676
593
|
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
}
|
|
594
|
+
maxX = maxY = 0;
|
|
680
595
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
nextTR.parentNode.insertBefore(newTR, nextTR);
|
|
685
|
-
else
|
|
686
|
-
tableElm.appendChild(newTR);
|
|
687
|
-
}
|
|
596
|
+
each(grid, function(row, y) {
|
|
597
|
+
each(row, function(cell, x) {
|
|
598
|
+
var colSpan, rowSpan;
|
|
688
599
|
|
|
689
|
-
|
|
690
|
-
|
|
600
|
+
if (isCellSelected(cell)) {
|
|
601
|
+
cell = grid[y][x];
|
|
691
602
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
return true;
|
|
603
|
+
if (x > maxX)
|
|
604
|
+
maxX = x;
|
|
695
605
|
|
|
696
|
-
|
|
697
|
-
|
|
606
|
+
if (y > maxY)
|
|
607
|
+
maxY = y;
|
|
698
608
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return true;
|
|
703
|
-
}
|
|
609
|
+
if (cell.real) {
|
|
610
|
+
colSpan = cell.colspan - 1;
|
|
611
|
+
rowSpan = cell.rowspan - 1;
|
|
704
612
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
if (cells[x].rowSpan > 1) {
|
|
710
|
-
var newTD = cells[x].cloneNode(true);
|
|
711
|
-
var sd = getColRowSpan(cells[x]);
|
|
613
|
+
if (colSpan) {
|
|
614
|
+
if (x + colSpan > maxX)
|
|
615
|
+
maxX = x + colSpan;
|
|
616
|
+
}
|
|
712
617
|
|
|
713
|
-
|
|
618
|
+
if (rowSpan) {
|
|
619
|
+
if (y + rowSpan > maxY)
|
|
620
|
+
maxY = y + rowSpan;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
});
|
|
714
626
|
|
|
715
|
-
|
|
627
|
+
return {x : maxX, y : maxY};
|
|
628
|
+
};
|
|
716
629
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
else
|
|
720
|
-
nextTR.insertBefore(newTD, nextTD);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
630
|
+
function setEndCell(cell) {
|
|
631
|
+
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
|
723
632
|
|
|
724
|
-
|
|
725
|
-
var lastTDElm = null;
|
|
726
|
-
for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
|
|
727
|
-
if (tdElm != lastTDElm) {
|
|
728
|
-
var sd = getColRowSpan(tdElm);
|
|
633
|
+
endPos = getPos(cell);
|
|
729
634
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
635
|
+
if (startPos && endPos) {
|
|
636
|
+
// Get start/end positions
|
|
637
|
+
startX = Math.min(startPos.x, endPos.x);
|
|
638
|
+
startY = Math.min(startPos.y, endPos.y);
|
|
639
|
+
endX = Math.max(startPos.x, endPos.x);
|
|
640
|
+
endY = Math.max(startPos.y, endPos.y);
|
|
734
641
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
642
|
+
// Expand end positon to include spans
|
|
643
|
+
maxX = endX;
|
|
644
|
+
maxY = endY;
|
|
738
645
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
646
|
+
// Expand startX
|
|
647
|
+
for (y = startY; y <= maxY; y++) {
|
|
648
|
+
cell = grid[y][startX];
|
|
742
649
|
|
|
743
|
-
|
|
650
|
+
if (!cell.real) {
|
|
651
|
+
if (startX - (cell.colspan - 1) < startX)
|
|
652
|
+
startX -= cell.colspan - 1;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
744
655
|
|
|
745
|
-
|
|
746
|
-
|
|
656
|
+
// Expand startY
|
|
657
|
+
for (x = startX; x <= maxX; x++) {
|
|
658
|
+
cell = grid[startY][x];
|
|
747
659
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
660
|
+
if (!cell.real) {
|
|
661
|
+
if (startY - (cell.rowspan - 1) < startY)
|
|
662
|
+
startY -= cell.rowspan - 1;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
751
665
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
666
|
+
// Find max X, Y
|
|
667
|
+
for (y = startY; y <= endY; y++) {
|
|
668
|
+
for (x = startX; x <= endX; x++) {
|
|
669
|
+
cell = grid[y][x];
|
|
755
670
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
671
|
+
if (cell.real) {
|
|
672
|
+
colSpan = cell.colspan - 1;
|
|
673
|
+
rowSpan = cell.rowspan - 1;
|
|
759
674
|
|
|
760
|
-
|
|
761
|
-
|
|
675
|
+
if (colSpan) {
|
|
676
|
+
if (x + colSpan > maxX)
|
|
677
|
+
maxX = x + colSpan;
|
|
678
|
+
}
|
|
762
679
|
|
|
763
|
-
|
|
764
|
-
|
|
680
|
+
if (rowSpan) {
|
|
681
|
+
if (y + rowSpan > maxY)
|
|
682
|
+
maxY = y + rowSpan;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
765
687
|
|
|
766
|
-
|
|
688
|
+
// Remove current selection
|
|
689
|
+
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
|
767
690
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
691
|
+
// Add new selection
|
|
692
|
+
for (y = startY; y <= maxY; y++) {
|
|
693
|
+
for (x = startX; x <= maxX; x++)
|
|
694
|
+
dom.addClass(grid[y][x].elm, 'mceSelected');
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// Expose to public
|
|
700
|
+
tinymce.extend(this, {
|
|
701
|
+
deleteTable : deleteTable,
|
|
702
|
+
split : split,
|
|
703
|
+
merge : merge,
|
|
704
|
+
insertRow : insertRow,
|
|
705
|
+
insertCol : insertCol,
|
|
706
|
+
deleteCols : deleteCols,
|
|
707
|
+
deleteRows : deleteRows,
|
|
708
|
+
cutRows : cutRows,
|
|
709
|
+
copyRows : copyRows,
|
|
710
|
+
pasteRows : pasteRows,
|
|
711
|
+
getPos : getPos,
|
|
712
|
+
setStartCell : setStartCell,
|
|
713
|
+
setEndCell : setEndCell
|
|
714
|
+
});
|
|
715
|
+
};
|
|
771
716
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
717
|
+
tinymce.create('tinymce.plugins.TablePlugin', {
|
|
718
|
+
init : function(ed, url) {
|
|
719
|
+
var winMan, clipboardRows;
|
|
775
720
|
|
|
776
|
-
|
|
777
|
-
|
|
721
|
+
function createTableGrid(node) {
|
|
722
|
+
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
|
778
723
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
724
|
+
if (tblElm)
|
|
725
|
+
return new TableGrid(tblElm, ed.dom, selection);
|
|
726
|
+
};
|
|
782
727
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
728
|
+
function cleanup() {
|
|
729
|
+
// Restore selection possibilities
|
|
730
|
+
ed.getBody().style.webkitUserSelect = '';
|
|
731
|
+
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
|
732
|
+
};
|
|
786
733
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
734
|
+
// Register buttons
|
|
735
|
+
each([
|
|
736
|
+
['table', 'table.desc', 'mceInsertTable', true],
|
|
737
|
+
['delete_table', 'table.del', 'mceTableDelete'],
|
|
738
|
+
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
|
739
|
+
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
|
740
|
+
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
|
741
|
+
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
|
742
|
+
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
|
743
|
+
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
|
744
|
+
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
|
745
|
+
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
|
746
|
+
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
|
747
|
+
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
|
748
|
+
], function(c) {
|
|
749
|
+
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
|
750
|
+
});
|
|
790
751
|
|
|
791
|
-
|
|
792
|
-
|
|
752
|
+
// Select whole table is a table border is clicked
|
|
753
|
+
if (!tinymce.isIE) {
|
|
754
|
+
ed.onClick.add(function(ed, e) {
|
|
755
|
+
e = e.target;
|
|
793
756
|
|
|
794
|
-
|
|
795
|
-
|
|
757
|
+
if (e.nodeName === 'TABLE')
|
|
758
|
+
ed.selection.select(e);
|
|
759
|
+
});
|
|
760
|
+
}
|
|
796
761
|
|
|
797
|
-
|
|
762
|
+
// Handle node change updates
|
|
763
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
|
764
|
+
var p;
|
|
798
765
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
else
|
|
803
|
-
nextTD.parentNode.insertBefore(newTD, nextTD);
|
|
804
|
-
} else
|
|
805
|
-
tdElm.colSpan++;
|
|
766
|
+
n = ed.selection.getStart();
|
|
767
|
+
p = ed.dom.getParent(n, 'td,th,caption');
|
|
768
|
+
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
|
806
769
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
770
|
+
// Disable table tools if we are in caption
|
|
771
|
+
if (p && p.nodeName === 'CAPTION')
|
|
772
|
+
p = 0;
|
|
810
773
|
|
|
811
|
-
|
|
812
|
-
|
|
774
|
+
cm.setDisabled('delete_table', !p);
|
|
775
|
+
cm.setDisabled('delete_col', !p);
|
|
776
|
+
cm.setDisabled('delete_table', !p);
|
|
777
|
+
cm.setDisabled('delete_row', !p);
|
|
778
|
+
cm.setDisabled('col_after', !p);
|
|
779
|
+
cm.setDisabled('col_before', !p);
|
|
780
|
+
cm.setDisabled('row_after', !p);
|
|
781
|
+
cm.setDisabled('row_before', !p);
|
|
782
|
+
cm.setDisabled('row_props', !p);
|
|
783
|
+
cm.setDisabled('cell_props', !p);
|
|
784
|
+
cm.setDisabled('split_cells', !p);
|
|
785
|
+
cm.setDisabled('merge_cells', !p);
|
|
786
|
+
});
|
|
813
787
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return true;
|
|
788
|
+
ed.onInit.add(function(ed) {
|
|
789
|
+
var startTable, startCell, dom = ed.dom, tableGrid;
|
|
817
790
|
|
|
818
|
-
|
|
819
|
-
var cpos = getCellPos(grid, tdElm);
|
|
820
|
-
var lastTDElm = null;
|
|
791
|
+
winMan = ed.windowManager;
|
|
821
792
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
}
|
|
793
|
+
// Add cell selection logic
|
|
794
|
+
ed.onMouseDown.add(function(ed, e) {
|
|
795
|
+
if (e.button != 2) {
|
|
796
|
+
cleanup();
|
|
827
797
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
798
|
+
startCell = dom.getParent(e.target, 'td,th');
|
|
799
|
+
startTable = dom.getParent(startCell, 'table');
|
|
800
|
+
}
|
|
801
|
+
});
|
|
832
802
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
else {
|
|
836
|
-
if (tdElm.parentNode)
|
|
837
|
-
tdElm.parentNode.removeChild(tdElm);
|
|
838
|
-
}
|
|
803
|
+
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
|
804
|
+
var sel, table, target = e.target;
|
|
839
805
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
806
|
+
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
|
807
|
+
table = dom.getParent(target, 'table');
|
|
808
|
+
if (table == startTable) {
|
|
809
|
+
if (!tableGrid) {
|
|
810
|
+
tableGrid = createTableGrid(table);
|
|
811
|
+
tableGrid.setStartCell(startCell);
|
|
843
812
|
|
|
844
|
-
|
|
845
|
-
|
|
813
|
+
ed.getBody().style.webkitUserSelect = 'none';
|
|
814
|
+
}
|
|
846
815
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
return true;
|
|
816
|
+
tableGrid.setEndCell(target);
|
|
817
|
+
}
|
|
850
818
|
|
|
851
|
-
|
|
819
|
+
// Remove current selection
|
|
820
|
+
sel = ed.selection.getSel();
|
|
852
821
|
|
|
853
|
-
|
|
854
|
-
|
|
822
|
+
if (sel.removeAllRanges)
|
|
823
|
+
sel.removeAllRanges();
|
|
824
|
+
else
|
|
825
|
+
sel.empty();
|
|
855
826
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
tdElm.colSpan = 1;
|
|
860
|
-
for (var i=1; i<colspan; i++) {
|
|
861
|
-
var newTD = doc.createElement("td");
|
|
827
|
+
e.preventDefault();
|
|
828
|
+
}
|
|
829
|
+
});
|
|
862
830
|
|
|
863
|
-
|
|
864
|
-
|
|
831
|
+
ed.onMouseUp.add(function(ed, e) {
|
|
832
|
+
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
|
865
833
|
|
|
866
|
-
|
|
834
|
+
// Move selection to startCell
|
|
835
|
+
if (startCell) {
|
|
836
|
+
if (tableGrid)
|
|
837
|
+
ed.getBody().style.webkitUserSelect = '';
|
|
867
838
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
}
|
|
839
|
+
function setPoint(node, start) {
|
|
840
|
+
var walker = new tinymce.dom.TreeWalker(node, node);
|
|
871
841
|
|
|
872
|
-
|
|
873
|
-
|
|
842
|
+
do {
|
|
843
|
+
// Text node
|
|
844
|
+
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
|
845
|
+
if (start)
|
|
846
|
+
rng.setStart(node, 0);
|
|
847
|
+
else
|
|
848
|
+
rng.setEnd(node, node.nodeValue.length);
|
|
874
849
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
break;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
878
852
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
if (user_interface) {
|
|
886
|
-
// Setup template
|
|
887
|
-
var sp = getColRowSpan(tdElm);
|
|
888
|
-
|
|
889
|
-
inst.windowManager.open({
|
|
890
|
-
url : url + '/merge_cells.htm',
|
|
891
|
-
width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
|
|
892
|
-
height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
|
|
893
|
-
inline : 1
|
|
894
|
-
}, {
|
|
895
|
-
action : "update",
|
|
896
|
-
numcols : sp.colspan,
|
|
897
|
-
numrows : sp.rowspan,
|
|
898
|
-
plugin_url : url
|
|
899
|
-
});
|
|
900
|
-
|
|
901
|
-
return true;
|
|
902
|
-
} else {
|
|
903
|
-
var numRows = parseInt(value['numrows']);
|
|
904
|
-
var numCols = parseInt(value['numcols']);
|
|
905
|
-
var cpos = getCellPos(grid, tdElm);
|
|
906
|
-
|
|
907
|
-
if (("" + numRows) == "NaN")
|
|
908
|
-
numRows = 1;
|
|
909
|
-
|
|
910
|
-
if (("" + numCols) == "NaN")
|
|
911
|
-
numCols = 1;
|
|
912
|
-
|
|
913
|
-
// Get rows and cells
|
|
914
|
-
var tRows = tableElm.rows;
|
|
915
|
-
for (var y=cpos.rowindex; y<grid.length; y++) {
|
|
916
|
-
var rowCells = [];
|
|
917
|
-
|
|
918
|
-
for (var x=cpos.cellindex; x<grid[y].length; x++) {
|
|
919
|
-
var td = getCell(grid, y, x);
|
|
920
|
-
|
|
921
|
-
if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
|
|
922
|
-
var cp = getCellPos(grid, td);
|
|
923
|
-
|
|
924
|
-
// Within range
|
|
925
|
-
if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
|
|
926
|
-
rowCells[rowCells.length] = td;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
if (rowCells.length > 0)
|
|
931
|
-
rows[rows.length] = rowCells;
|
|
932
|
-
|
|
933
|
-
var td = getCell(grid, cpos.rowindex, cpos.cellindex);
|
|
934
|
-
each(ed.dom.select('br', td), function(e, i) {
|
|
935
|
-
if (i > 0 && ed.dom.getAttrib('mce_bogus'))
|
|
936
|
-
ed.dom.remove(e);
|
|
937
|
-
});
|
|
938
|
-
}
|
|
853
|
+
// BR element
|
|
854
|
+
if (node.nodeName == 'BR') {
|
|
855
|
+
if (start)
|
|
856
|
+
rng.setStartBefore(node);
|
|
857
|
+
else
|
|
858
|
+
rng.setEndBefore(node);
|
|
939
859
|
|
|
940
|
-
|
|
860
|
+
return;
|
|
941
861
|
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
if (!tdElm)
|
|
862
|
+
} while (node = (start ? walker.next() : walker.prev()));
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
// Try to expand text selection as much as we can only Gecko supports cell selection
|
|
866
|
+
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
|
867
|
+
if (selectedCells.length > 0) {
|
|
868
|
+
rng = dom.createRng();
|
|
869
|
+
node = selectedCells[0];
|
|
870
|
+
endNode = selectedCells[selectedCells.length - 1];
|
|
871
|
+
|
|
872
|
+
setPoint(node, 1);
|
|
873
|
+
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
|
874
|
+
|
|
875
|
+
do {
|
|
876
|
+
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
|
877
|
+
if (!dom.hasClass(node, 'mceSelected'))
|
|
959
878
|
break;
|
|
960
879
|
|
|
961
|
-
|
|
962
|
-
cells[cells.length] = tdElm;
|
|
880
|
+
lastNode = node;
|
|
963
881
|
}
|
|
882
|
+
} while (node = walker.next());
|
|
964
883
|
|
|
965
|
-
|
|
966
|
-
var tRows = tableElm.rows;
|
|
967
|
-
for (var y=0; y<tRows.length; y++) {
|
|
968
|
-
var rowCells = [];
|
|
884
|
+
setPoint(lastNode);
|
|
969
885
|
|
|
970
|
-
|
|
971
|
-
|
|
886
|
+
sel.setRng(rng);
|
|
887
|
+
}
|
|
972
888
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
}
|
|
889
|
+
ed.nodeChanged();
|
|
890
|
+
startCell = tableGrid = startTable = null;
|
|
891
|
+
}
|
|
892
|
+
});
|
|
979
893
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
894
|
+
ed.onKeyUp.add(function(ed, e) {
|
|
895
|
+
cleanup();
|
|
896
|
+
});
|
|
983
897
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
for (var x=0; x<grid[y].length; x++) {
|
|
989
|
-
grid[y][x]._selected = false;
|
|
990
|
-
|
|
991
|
-
for (var i=0; i<cells.length; i++) {
|
|
992
|
-
if (grid[y][x] == cells[i]) {
|
|
993
|
-
// Get start pos
|
|
994
|
-
if (x1 == -1) {
|
|
995
|
-
x1 = x;
|
|
996
|
-
y1 = y;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
// Get end pos
|
|
1000
|
-
x2 = x;
|
|
1001
|
-
y2 = y;
|
|
1002
|
-
|
|
1003
|
-
grid[y][x]._selected = true;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
898
|
+
// Add context menu
|
|
899
|
+
if (ed && ed.plugins.contextmenu) {
|
|
900
|
+
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
|
901
|
+
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
|
1008
902
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
903
|
+
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
|
904
|
+
m.removeAll();
|
|
905
|
+
|
|
906
|
+
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
|
907
|
+
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
|
908
|
+
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
|
909
|
+
m.addSeparator();
|
|
1018
910
|
}
|
|
1019
911
|
|
|
1020
|
-
|
|
1021
|
-
|
|
912
|
+
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
|
913
|
+
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
|
914
|
+
m.addSeparator();
|
|
915
|
+
}
|
|
1022
916
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
917
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
|
918
|
+
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
|
919
|
+
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
|
920
|
+
m.addSeparator();
|
|
1027
921
|
|
|
1028
|
-
|
|
1029
|
-
|
|
922
|
+
// Cell menu
|
|
923
|
+
sm = m.addMenu({title : 'table.cell'});
|
|
924
|
+
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
|
925
|
+
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
|
926
|
+
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
|
1030
927
|
|
|
1031
|
-
|
|
928
|
+
// Row menu
|
|
929
|
+
sm = m.addMenu({title : 'table.row'});
|
|
930
|
+
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
|
931
|
+
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
|
932
|
+
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
|
933
|
+
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
|
934
|
+
sm.addSeparator();
|
|
935
|
+
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
|
936
|
+
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
|
937
|
+
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
|
938
|
+
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
|
1032
939
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
940
|
+
// Column menu
|
|
941
|
+
sm = m.addMenu({title : 'table.col'});
|
|
942
|
+
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
|
943
|
+
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
|
944
|
+
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
|
945
|
+
} else
|
|
946
|
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
|
947
|
+
});
|
|
948
|
+
}
|
|
1037
949
|
|
|
1038
|
-
|
|
1039
|
-
|
|
950
|
+
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
|
951
|
+
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
|
952
|
+
if (!tinymce.isIE) {
|
|
953
|
+
function fixTableCaretPos() {
|
|
954
|
+
var last;
|
|
1040
955
|
|
|
1041
|
-
|
|
1042
|
-
|
|
956
|
+
// Skip empty text nodes form the end
|
|
957
|
+
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
|
1043
958
|
|
|
1044
|
-
|
|
1045
|
-
|
|
959
|
+
if (last && last.nodeName == 'TABLE')
|
|
960
|
+
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
|
961
|
+
};
|
|
1046
962
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
963
|
+
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
|
964
|
+
// this fix solves it by detecting when the caret is at the beginning of such a table
|
|
965
|
+
// and then manually moves the caret infront of the table
|
|
966
|
+
if (tinymce.isGecko) {
|
|
967
|
+
ed.onKeyDown.add(function(ed, e) {
|
|
968
|
+
var rng, table, dom = ed.dom;
|
|
1051
969
|
|
|
1052
|
-
|
|
1053
|
-
|
|
970
|
+
// On gecko it's not possible to place the caret before a table
|
|
971
|
+
if (e.keyCode == 37 || e.keyCode == 38) {
|
|
972
|
+
rng = ed.selection.getRng();
|
|
973
|
+
table = dom.getParent(rng.startContainer, 'table');
|
|
1054
974
|
|
|
1055
|
-
|
|
975
|
+
if (table && ed.getBody().firstChild == table) {
|
|
976
|
+
if (isAtStart(rng, table)) {
|
|
977
|
+
rng = dom.createRng();
|
|
1056
978
|
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
return true;
|
|
1060
|
-
}
|
|
979
|
+
rng.setStartBefore(table);
|
|
980
|
+
rng.setEndBefore(table);
|
|
1061
981
|
|
|
1062
|
-
|
|
982
|
+
ed.selection.setRng(rng);
|
|
983
|
+
|
|
984
|
+
e.preventDefault();
|
|
985
|
+
}
|
|
1063
986
|
}
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
1064
990
|
|
|
1065
|
-
|
|
1066
|
-
|
|
991
|
+
ed.onKeyUp.add(fixTableCaretPos);
|
|
992
|
+
ed.onSetContent.add(fixTableCaretPos);
|
|
993
|
+
ed.onVisualAid.add(fixTableCaretPos);
|
|
1067
994
|
|
|
1068
|
-
|
|
1069
|
-
|
|
995
|
+
ed.onPreProcess.add(function(ed, o) {
|
|
996
|
+
var last = o.node.lastChild;
|
|
1070
997
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
tdElm.colSpan = colSpan;
|
|
998
|
+
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
|
999
|
+
ed.dom.remove(last);
|
|
1000
|
+
});
|
|
1075
1001
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
var html = rows[y][x].innerHTML;
|
|
1080
|
-
var chk = html.replace(/[ \t\r\n]/g, "");
|
|
1002
|
+
fixTableCaretPos();
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1081
1005
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1006
|
+
// Register action commands
|
|
1007
|
+
each({
|
|
1008
|
+
mceTableSplitCells : function(grid) {
|
|
1009
|
+
grid.split();
|
|
1010
|
+
},
|
|
1084
1011
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
var cpos = getCellPos(grid, rows[y][x]);
|
|
1088
|
-
var tr = rows[y][x].parentNode;
|
|
1012
|
+
mceTableMergeCells : function(grid) {
|
|
1013
|
+
var rowSpan, colSpan, cell;
|
|
1089
1014
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1015
|
+
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
|
1016
|
+
if (cell) {
|
|
1017
|
+
rowSpan = cell.rowSpan;
|
|
1018
|
+
colSpan = cell.colSpan;
|
|
1019
|
+
}
|
|
1092
1020
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1021
|
+
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
|
1022
|
+
winMan.open({
|
|
1023
|
+
url : url + '/merge_cells.htm',
|
|
1024
|
+
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
|
1025
|
+
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
|
1026
|
+
inline : 1
|
|
1027
|
+
}, {
|
|
1028
|
+
rows : rowSpan,
|
|
1029
|
+
cols : colSpan,
|
|
1030
|
+
onaction : function(data) {
|
|
1031
|
+
grid.merge(cell, data.cols, data.rows);
|
|
1032
|
+
},
|
|
1033
|
+
plugin_url : url
|
|
1034
|
+
});
|
|
1035
|
+
} else
|
|
1036
|
+
grid.merge();
|
|
1037
|
+
},
|
|
1096
1038
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
cellElm.rowSpan--;
|
|
1039
|
+
mceTableInsertRowBefore : function(grid) {
|
|
1040
|
+
grid.insertRow(true);
|
|
1041
|
+
},
|
|
1101
1042
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1043
|
+
mceTableInsertRowAfter : function(grid) {
|
|
1044
|
+
grid.insertRow();
|
|
1045
|
+
},
|
|
1104
1046
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1047
|
+
mceTableInsertColBefore : function(grid) {
|
|
1048
|
+
grid.insertCol(true);
|
|
1049
|
+
},
|
|
1111
1050
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
ed.dom.remove(e);
|
|
1116
|
-
});
|
|
1051
|
+
mceTableInsertColAfter : function(grid) {
|
|
1052
|
+
grid.insertCol();
|
|
1053
|
+
},
|
|
1117
1054
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1055
|
+
mceTableDeleteCol : function(grid) {
|
|
1056
|
+
grid.deleteCols();
|
|
1057
|
+
},
|
|
1120
1058
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1059
|
+
mceTableDeleteRow : function(grid) {
|
|
1060
|
+
grid.deleteRows();
|
|
1061
|
+
},
|
|
1125
1062
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1063
|
+
mceTableCutRow : function(grid) {
|
|
1064
|
+
clipboardRows = grid.cutRows();
|
|
1065
|
+
},
|
|
1066
|
+
|
|
1067
|
+
mceTableCopyRow : function(grid) {
|
|
1068
|
+
clipboardRows = grid.copyRows();
|
|
1069
|
+
},
|
|
1070
|
+
|
|
1071
|
+
mceTablePasteRowBefore : function(grid) {
|
|
1072
|
+
grid.pasteRows(clipboardRows, true);
|
|
1073
|
+
},
|
|
1074
|
+
|
|
1075
|
+
mceTablePasteRowAfter : function(grid) {
|
|
1076
|
+
grid.pasteRows(clipboardRows);
|
|
1077
|
+
},
|
|
1128
1078
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1079
|
+
mceTableDelete : function(grid) {
|
|
1080
|
+
grid.deleteTable();
|
|
1081
|
+
}
|
|
1082
|
+
}, function(func, name) {
|
|
1083
|
+
ed.addCommand(name, function() {
|
|
1084
|
+
var grid = createTableGrid();
|
|
1085
|
+
|
|
1086
|
+
if (grid) {
|
|
1087
|
+
func(grid);
|
|
1088
|
+
ed.execCommand('mceRepaint');
|
|
1089
|
+
cleanup();
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
// Register dialog commands
|
|
1095
|
+
each({
|
|
1096
|
+
mceInsertTable : function(val) {
|
|
1097
|
+
winMan.open({
|
|
1098
|
+
url : url + '/table.htm',
|
|
1099
|
+
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
|
1100
|
+
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
|
1101
|
+
inline : 1
|
|
1102
|
+
}, {
|
|
1103
|
+
plugin_url : url,
|
|
1104
|
+
action : val ? val.action : 0
|
|
1105
|
+
});
|
|
1106
|
+
},
|
|
1107
|
+
|
|
1108
|
+
mceTableRowProps : function() {
|
|
1109
|
+
winMan.open({
|
|
1110
|
+
url : url + '/row.htm',
|
|
1111
|
+
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
|
1112
|
+
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
|
1113
|
+
inline : 1
|
|
1114
|
+
}, {
|
|
1115
|
+
plugin_url : url
|
|
1116
|
+
});
|
|
1117
|
+
},
|
|
1118
|
+
|
|
1119
|
+
mceTableCellProps : function() {
|
|
1120
|
+
winMan.open({
|
|
1121
|
+
url : url + '/cell.htm',
|
|
1122
|
+
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
|
1123
|
+
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
|
1124
|
+
inline : 1
|
|
1125
|
+
}, {
|
|
1126
|
+
plugin_url : url
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
}, function(func, name) {
|
|
1130
|
+
ed.addCommand(name, function(ui, val) {
|
|
1131
|
+
func(val);
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1131
1134
|
}
|
|
1132
1135
|
});
|
|
1133
1136
|
|
|
1134
1137
|
// Register plugin
|
|
1135
1138
|
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
|
1136
|
-
})();
|
|
1139
|
+
})(tinymce);
|