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.
Files changed (467) hide show
  1. data/CHANGELOG +131 -10
  2. data/README.md +1 -2
  3. data/Rakefile +3 -3
  4. data/app/controllers/skyline/application_controller.rb +40 -4
  5. data/app/controllers/skyline/articles_controller.rb +4 -4
  6. data/app/controllers/skyline/browser/tabs/media_library/media_files_controller.rb +1 -1
  7. data/app/controllers/skyline/content_controller.rb +4 -3
  8. data/app/controllers/skyline/{media_files_data_controller.rb → media/data_controller.rb} +61 -59
  9. data/app/controllers/skyline/media/dirs_controller.rb +83 -0
  10. data/app/controllers/skyline/media/files_controller.rb +80 -0
  11. data/app/controllers/skyline/sections_controller.rb +10 -3
  12. data/app/controllers/skyline/settings_controller.rb +4 -2
  13. data/app/controllers/skyline/user_preferences_controller.rb +18 -0
  14. data/app/controllers/skyline/users_controller.rb +1 -1
  15. data/app/controllers/skyline/variant_current_editor_controller.rb +2 -0
  16. data/app/helpers/skyline/application_helper.rb +39 -35
  17. data/app/helpers/skyline/dialog_helper.rb +11 -10
  18. data/app/helpers/skyline/editors/boolean.rb +2 -2
  19. data/app/helpers/skyline/editors/page_browser.rb +2 -0
  20. data/app/helpers/skyline/editors/wysiwyg.rb +1 -1
  21. data/app/helpers/skyline/js_layout_helper.rb +19 -0
  22. data/app/helpers/skyline/media/dirs_helper.rb +2 -0
  23. data/app/helpers/skyline/media/files_helper.rb +6 -0
  24. data/app/helpers/skyline/media_files_helper.rb +2 -2
  25. data/app/helpers/skyline/menu_helper.rb +33 -0
  26. data/app/helpers/skyline/message_generator.rb +5 -1
  27. data/app/helpers/skyline/notification_generator.rb +6 -0
  28. data/app/helpers/skyline/plugin_helper.rb +21 -0
  29. data/app/helpers/skyline/presenters/presenter.rb +4 -13
  30. data/app/helpers/skyline/presenters/table.rb +0 -27
  31. data/app/helpers/skyline/ref_object_helper.rb +2 -2
  32. data/app/helpers/skyline/tree_helper.rb +74 -5
  33. data/app/models/skyline/article.rb +18 -6
  34. data/app/models/skyline/article_version.rb +1 -1
  35. data/app/models/skyline/image_ref.rb +9 -5
  36. data/app/models/skyline/inline_ref.rb +3 -2
  37. data/app/models/skyline/link_section_link.rb +2 -2
  38. data/app/models/skyline/media_file.rb +33 -10
  39. data/app/models/skyline/page.rb +10 -9
  40. data/app/models/skyline/section.rb +1 -1
  41. data/app/models/skyline/sections/content_collection_section.rb +1 -1
  42. data/app/models/skyline/sections/content_item_section.rb +1 -1
  43. data/app/models/skyline/sections/heading_section.rb +1 -1
  44. data/app/models/skyline/sections/iframe_section.rb +2 -2
  45. data/app/models/skyline/sections/link_section.rb +1 -1
  46. data/app/models/skyline/sections/media_section.rb +32 -5
  47. data/app/models/skyline/sections/page_fragment_section.rb +1 -1
  48. data/app/models/skyline/sections/raw_section.rb +1 -1
  49. data/app/models/skyline/sections/redirect_section.rb +4 -4
  50. data/app/models/skyline/sections/rss_section.rb +7 -2
  51. data/app/models/skyline/sections/splitter_section.rb +1 -1
  52. data/app/models/skyline/sections/wysiwyg_section.rb +3 -3
  53. data/app/models/skyline/site.rb +1 -1
  54. data/app/models/skyline/user.rb +1 -1
  55. data/app/models/skyline/user_preference.rb +69 -0
  56. data/app/models/skyline/variant.rb +1 -1
  57. data/app/templates/skyline/sections/content_item_section/default/index.html.erb +1 -1
  58. data/app/templates/skyline/sections/media_section/default/index.html.erb +9 -9
  59. data/app/views/skyline/articles/_list.html.erb +34 -0
  60. data/app/views/skyline/articles/edit.html.erb +13 -6
  61. data/app/views/skyline/articles/index.html.erb +12 -43
  62. data/app/views/skyline/articles/page/_index.html.erb +13 -11
  63. data/app/views/skyline/authentications/new.html.erb +2 -2
  64. data/app/views/skyline/browser/links/_index.html.erb +4 -2
  65. data/app/views/skyline/browser/tabs/media_library/_index.html.erb +12 -13
  66. data/app/views/skyline/browser/tabs/media_library/media_files/_index.html.erb +122 -51
  67. data/app/views/skyline/browser/tabs/media_library/media_files/_show.html.erb +7 -7
  68. data/app/views/skyline/content/list.rhtml +1 -3
  69. data/app/views/skyline/content/presenters/_table.html.erb +45 -0
  70. data/app/views/skyline/layouts/content.html.erb +1 -1
  71. data/app/views/skyline/layouts/media.html.erb +2 -1
  72. data/app/views/skyline/layouts/pages.html.erb +10 -0
  73. data/app/views/skyline/link_section_links/_form.html.erb +0 -1
  74. data/app/views/skyline/locales/show.js.erb +2 -2
  75. data/app/views/skyline/media/dirs/_edit.html.erb +42 -0
  76. data/app/views/skyline/media/dirs/_index.html.erb +14 -0
  77. data/app/views/skyline/media/dirs/_show.html.erb +34 -0
  78. data/app/views/skyline/media/dirs/index.html.erb +36 -0
  79. data/app/views/skyline/media/files/_edit.html.erb +101 -0
  80. data/app/views/skyline/media/files/_index.html.erb +68 -0
  81. data/app/views/skyline/media/files/_new.html.erb +45 -0
  82. data/app/views/skyline/publications/_index.html.erb +2 -2
  83. data/app/views/skyline/sections/_media_section.html.erb +12 -2
  84. data/app/views/skyline/sections/_wysiwyg_section.html.erb +2 -3
  85. data/app/views/skyline/settings/index.html +14 -0
  86. data/app/views/skyline/shared/_head.html.erb +2 -0
  87. data/app/views/skyline/shared/_header_area.html.erb +7 -5
  88. data/app/views/skyline/users/index.html.erb +31 -16
  89. data/config/initializers/dependencies.rb +6 -1
  90. data/config/initializers/observers.rb +1 -2
  91. data/config/initializers/rails_defaults.rb +1 -1
  92. data/config/locales/en-US.yml +110 -68
  93. data/config/locales/nl-NL.yml +117 -77
  94. data/config/routes.rb +36 -32
  95. data/db/fixtures/roles_and_rights.rb +65 -40
  96. data/db/migrate/20090302102548_add_media_nodes.rb +2 -2
  97. data/db/migrate/20090309133933_add_description_to_media_nodes.rb +2 -2
  98. data/db/migrate/20090309134731_add_tags.rb +2 -2
  99. data/db/migrate/20090309135746_create_media_files_tags.rb +2 -2
  100. data/db/migrate/20090319091342_create_media_caches.rb +2 -2
  101. data/db/migrate/20090327083240_create_users.rb +2 -2
  102. data/db/migrate/20090327084656_create_roles.rb +2 -2
  103. data/db/migrate/20090327084719_create_rights.rb +2 -2
  104. data/db/migrate/20090327084739_create_grants.rb +2 -2
  105. data/db/migrate/20090327090918_create_rights_roles.rb +2 -2
  106. data/db/migrate/20090408115155_create_ref_objects.rb +2 -2
  107. data/db/migrate/20090504140044_create_test_sections.rb +2 -2
  108. data/db/migrate/20090506083107_add_refering_column_name_to_ref_objects.rb +2 -2
  109. data/db/migrate/20090706124019_add_skyline_media_node_title.rb +1 -1
  110. data/db/migrate/20090904121447_create_skyline_referable_uris.rb +6 -6
  111. data/db/migrate/20091221145204_add_skyline_media_section_link.rb +11 -0
  112. data/db/migrate/20100109145958_add_associated_tags_index.rb +9 -0
  113. data/db/migrate/20100115111440_create_skyline_user_preferences.rb +14 -0
  114. data/db/migrate/20100120113953_remove_unused_articles_index.rb +9 -0
  115. data/db/migrate/20100409073447_change_referable_uri_to_text.rb +9 -0
  116. data/doc/Bundler.md +33 -28
  117. data/doc/MIGRATION.md +48 -0
  118. data/lib/skyline/{content_item.rb → belongs_to_referable.rb} +57 -88
  119. data/lib/skyline/configuration.rb +14 -15
  120. data/lib/skyline/content/content.rb +14 -2
  121. data/lib/skyline/deprecated/version3_0_8.rb +106 -0
  122. data/lib/skyline/{form_builder_with_errors.rb → form_builder.rb} +5 -5
  123. data/lib/skyline/{referable.rb → has_many_referables_in.rb} +22 -12
  124. data/lib/skyline/javascript_generator_methods.rb +1 -1
  125. data/lib/skyline/plugins_manager.rb +135 -14
  126. data/lib/skyline/rendering/helpers/renderer_helper.rb +14 -9
  127. data/lib/skyline/{renderer.rb → rendering/renderer.rb} +3 -4
  128. data/lib/skyline/{renderable_scope_interface.rb → rendering/scopes/interface.rb} +1 -1
  129. data/lib/skyline/{wildcard_renderable_scope.rb → rendering/scopes/wildcard.rb} +3 -3
  130. data/lib/skyline/{section_item.rb → sections/interface.rb} +17 -10
  131. data/lib/skyline/settings.rb +29 -19
  132. data/lib/skyline/taggable.rb +3 -3
  133. data/lib/skyline/version.rb +2 -2
  134. data/{tasks → lib/tasks}/database.rake +14 -2
  135. data/{tasks → lib/tasks}/implementation.rake +0 -0
  136. data/lib/tasks/testing.rake +41 -0
  137. data/public/skyline/images/backgrounds/panel-dt.gif +0 -0
  138. data/public/skyline/javascripts/src/application.js +114 -120
  139. data/public/skyline/javascripts/src/browser.js +22 -4
  140. data/public/skyline/javascripts/src/library_uploader.js +13 -3
  141. data/public/skyline/javascripts/src/sections.js +57 -6
  142. data/public/skyline/javascripts/src/skyline/src/dialog.js +6 -0
  143. data/public/skyline/javascripts/src/skyline/src/drag.js +6 -0
  144. data/public/skyline/javascripts/src/skyline/src/events.js +50 -0
  145. data/public/skyline/javascripts/src/skyline/src/field_replicator.js +12 -11
  146. data/public/skyline/javascripts/src/skyline/src/layout.js +172 -30
  147. data/public/skyline/javascripts/src/skyline/src/menu.js +3 -0
  148. data/public/skyline/javascripts/src/skyline/src/menubutton.js +3 -0
  149. data/public/skyline/javascripts/src/skyline/src/skyline.js +3 -0
  150. data/public/skyline/javascripts/src/skyline/src/table.js +398 -0
  151. data/public/skyline/javascripts/src/skyline/src/tabs.js +2 -2
  152. data/public/skyline/javascripts/src/skyline/src/tag_selector.js +34 -26
  153. data/public/skyline/javascripts/src/skyline/src/tree.js +3 -0
  154. data/public/skyline/javascripts/src/skyline/src/uploader.js +2 -2
  155. data/public/skyline/javascripts/src/skyline/src/utils.js +3 -0
  156. data/public/skyline/javascripts/src/skyline/test/_dynamic_right.html +24 -0
  157. data/public/skyline/javascripts/src/skyline/test/_right_content.html +1 -0
  158. data/public/skyline/javascripts/src/skyline/test/basic_layout.html +190 -0
  159. data/public/skyline/javascripts/src/skyline/test/dialog.html +101 -0
  160. data/public/skyline/javascripts/src/skyline/test/draggablefiles.html +196 -0
  161. data/public/skyline/javascripts/src/skyline/test/dynamic_layout.html +89 -0
  162. data/public/skyline/javascripts/src/skyline/test/field_replicator.html +60 -0
  163. data/public/skyline/javascripts/src/skyline/test/last-closed.gif +0 -0
  164. data/public/skyline/javascripts/src/skyline/test/last-open.gif +0 -0
  165. data/public/skyline/javascripts/src/skyline/test/menubutton.html +81 -0
  166. data/public/skyline/javascripts/src/skyline/test/middle.gif +0 -0
  167. data/public/skyline/javascripts/src/skyline/test/sortable.html +121 -0
  168. data/public/skyline/javascripts/src/skyline/test/table.html +521 -0
  169. data/public/skyline/javascripts/src/skyline/test/tagselector.html +72 -0
  170. data/public/skyline/javascripts/src/skyline/test/toggle.html +95 -0
  171. data/public/skyline/javascripts/src/skyline/test/tree.html +310 -0
  172. data/public/skyline/javascripts/src/skyline/test/tree.png +0 -0
  173. data/public/skyline/javascripts/src/skyline/test/undohtml.css +27 -0
  174. data/public/skyline/javascripts/src/skyline/vendor/fancyupload/Swiff.Uploader.js +2 -2
  175. data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-core.js +1 -354
  176. data/public/skyline/javascripts/src/skyline/vendor/mootools/mootools-more.js +64 -52
  177. data/public/skyline/javascripts/src/skyline.editor/assets/content.css +1 -1
  178. data/public/skyline/javascripts/src/skyline.editor/src/script_loader.js +156 -75
  179. data/public/skyline/javascripts/src/skyline.editor/src/skyline.editor.js +14 -4
  180. data/public/skyline/javascripts/src/skyline.editor/src/theme.js +8 -0
  181. data/public/skyline/javascripts/src/skyline.editor/test/dialog.html +28 -0
  182. data/public/skyline/javascripts/src/skyline.editor/test/lorem.html +7 -0
  183. data/public/skyline/javascripts/src/skyline.editor/test/multiple_editors.html +87 -0
  184. data/public/skyline/javascripts/src/skyline.editor/test/undohtml.css +27 -0
  185. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/changelog.txt +205 -0
  186. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/css/content.css +54 -0
  187. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/custom_formats.html +111 -0
  188. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/full.html +19 -3
  189. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/menu.html +1 -0
  190. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/simple.html +6 -2
  191. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/skins.html +14 -10
  192. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/translate.html +7 -3
  193. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/word.html +8 -4
  194. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/langs/en.js +18 -2
  195. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js +6 -3
  196. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advhr/rule.htm +2 -7
  197. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js +6 -3
  198. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/image.htm +2 -7
  199. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js +1 -1
  200. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js +6 -3
  201. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js +1 -1
  202. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm +2 -7
  203. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
  204. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
  205. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
  206. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +52 -44
  207. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -1
  208. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js +388 -17
  209. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
  210. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +6 -3
  211. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -1
  212. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +58 -6
  213. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js +6 -3
  214. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -1
  215. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin_src.js +8 -5
  216. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example/dialog.htm +2 -7
  217. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin_src.js +6 -3
  218. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -1
  219. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +10 -3
  220. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm +2 -7
  221. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js +18 -8
  222. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -1
  223. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +12 -6
  224. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -1
  225. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin_src.js +6 -3
  226. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +6 -3
  227. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +6 -3
  228. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js +6 -3
  229. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
  230. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
  231. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js +1 -1
  232. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin_src.js +18 -9
  233. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/media/media.htm +2 -7
  234. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -1
  235. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +7 -4
  236. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +6 -3
  237. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +6 -3
  238. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js +1 -1
  239. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js +564 -124
  240. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/pastetext.htm +2 -8
  241. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/paste/pasteword.htm +2 -8
  242. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin_src.js +6 -3
  243. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin_src.js +6 -3
  244. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin_src.js +6 -3
  245. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -1
  246. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +7 -4
  247. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +4 -0
  248. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/searchreplace/searchreplace.htm +4 -9
  249. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
  250. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +106 -27
  251. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js +6 -3
  252. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/style/props.htm +4 -11
  253. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -1
  254. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +7 -4
  255. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/cell.htm +2 -7
  256. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js +1 -1
  257. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js +921 -918
  258. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js +41 -24
  259. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/merge_cells.js +18 -20
  260. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/row.js +48 -23
  261. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/js/table.js +24 -15
  262. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/merge_cells.htm +3 -8
  263. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/row.htm +2 -7
  264. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/table/table.htm +2 -7
  265. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js +1 -1
  266. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js +10 -7
  267. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/template/template.htm +2 -9
  268. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -1
  269. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +26 -16
  270. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  271. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
  272. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +3 -10
  273. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +3 -10
  274. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +2 -7
  275. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/cite.htm +3 -10
  276. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/del.htm +3 -11
  277. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -1
  278. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +11 -15
  279. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/ins.htm +3 -11
  280. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +8 -5
  281. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +7 -4
  282. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +7 -4
  283. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +7 -4
  284. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/del.js +7 -4
  285. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +8 -8
  286. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +7 -4
  287. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/about.htm +1 -3
  288. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/anchor.htm +2 -7
  289. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/charmap.htm +0 -1
  290. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm +2 -4
  291. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js +1 -1
  292. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js +252 -188
  293. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/image.htm +2 -7
  294. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  295. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/anchor.js +7 -7
  296. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/charmap.js +10 -0
  297. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/image.js +2 -2
  298. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js +4 -4
  299. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/link.htm +2 -7
  300. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css +7 -3
  301. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css +4 -3
  302. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/ui.css +5 -6
  303. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css +7 -3
  304. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +3 -2
  305. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +4 -4
  306. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/advanced/source_editor.htm +2 -8
  307. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js +5 -5
  308. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce.js +1 -1
  309. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js +1 -1
  310. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_src.js +5492 -4341
  311. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/editable_selects.js +5 -4
  312. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/form_utils.js +6 -5
  313. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/mctabs.js +5 -4
  314. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/utils/validate.js +5 -4
  315. data/public/skyline/javascripts/src/skyline.js +3 -1
  316. data/public/skyline/javascripts/src/user_preferences.js +49 -0
  317. data/public/skyline/stylesheets/general.css +149 -47
  318. data/rails/init.rb +3 -3
  319. data/test/factories.rb +28 -0
  320. data/test/integration/media_browser_super_access_test.rb +52 -0
  321. data/test/integration/media_browser_user_access_test.rb +50 -0
  322. data/test/integration/user_preferences_test.rb +73 -0
  323. data/test/mocks/test_content_object.rb +32 -0
  324. data/test/mocks/test_section.rb +22 -0
  325. data/test/test_helper.rb +60 -0
  326. data/test/unit/inline_ref_test.rb +195 -0
  327. data/test/unit/locales_test.rb +82 -0
  328. data/test/unit/page_test.rb +204 -0
  329. data/test/unit/test_content_object_test.rb +69 -0
  330. data/test/unit/test_section_test.rb +247 -0
  331. data/test/unit/user_preference_test.rb +123 -0
  332. data/test/unit/user_test.rb +74 -0
  333. data/test/user_access_helper.rb +36 -0
  334. data/vendor/digitpaint/personify/test/fixtures/multiple_tags.txt +8 -0
  335. data/vendor/digitpaint/personify/test/parse_runner.rb +25 -0
  336. data/vendor/digitpaint/personify/test/parser_test.rb +109 -0
  337. data/vendor/digitpaint/personify/test/test_helper.rb +16 -0
  338. data/vendor/digitpaint/personify/vendor/treetop/.gitignore +5 -0
  339. data/vendor/mootools-on-rails/lib/mootools_on_rails/mootools_helper.rb +13 -4
  340. data/vendor/mootools-on-rails/test/mootools_helper_test.rb +138 -0
  341. data/vendor/mootools-on-rails/test/test_helper.rb +5 -0
  342. data/vendor/weppos/url_validation.rb +76 -0
  343. metadata +384 -189
  344. data/app/controllers/skyline/media_dirs_controller.rb +0 -56
  345. data/app/controllers/skyline/media_files_controller.rb +0 -87
  346. data/app/helpers/skyline/presenters/article_list.rb +0 -139
  347. data/app/observers/skyline/media_file_observer.rb +0 -32
  348. data/app/views/skyline/media_dirs/_edit.html.erb +0 -25
  349. data/app/views/skyline/media_dirs/_index.html.erb +0 -14
  350. data/app/views/skyline/media_dirs/index.html.erb +0 -42
  351. data/app/views/skyline/media_files/_edit.html.erb +0 -75
  352. data/app/views/skyline/media_files/_header.html.erb +0 -3
  353. data/app/views/skyline/media_files/_index.html.erb +0 -51
  354. data/app/views/skyline/media_files/_new.html.erb +0 -50
  355. data/db/migrate/20090603104115_prefix_tables_for_skyline.rb +0 -30
  356. data/lib/skyline/indexer.rb +0 -36
  357. data/lib/skyline/renderable_scope.rb +0 -27
  358. data/lib/skyline/rendering/helpers/settings_helper.rb +0 -26
  359. data/lib/skyline/searchable_item.rb +0 -132
  360. data/lib/skyline/url_validation.rb +0 -66
  361. data/public/skyline/images/backgrounds/splitter.gif +0 -0
  362. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/build.bat +0 -2
  363. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/build.xml +0 -364
  364. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/examples/full_jquery.html +0 -94
  365. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/AddOnManager.js +0 -95
  366. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/CommandManager.js +0 -54
  367. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ControlManager.js +0 -489
  368. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Developer.js +0 -91
  369. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Editor.js +0 -2295
  370. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/EditorCommands.js +0 -934
  371. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/EditorManager.js +0 -453
  372. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ForceBlocks.js +0 -644
  373. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/Popup.js +0 -412
  374. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/UndoManager.js +0 -183
  375. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/WindowManager.js +0 -169
  376. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/jquery/adapter.js +0 -240
  377. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/jquery/jquery.tinymce.js +0 -179
  378. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/adapter/prototype/adapter.js +0 -38
  379. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/BlockQuote.js +0 -135
  380. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/CutCopyPaste.js +0 -24
  381. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/InsertHorizontalRule.js +0 -15
  382. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/RemoveFormat.js +0 -173
  383. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/commands/UndoRedo.js +0 -38
  384. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/DOMUtils.js +0 -1823
  385. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Element.js +0 -199
  386. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/EventUtils.js +0 -349
  387. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Range.js +0 -721
  388. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/ScriptLoader.js +0 -351
  389. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Selection.js +0 -747
  390. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Serializer.js +0 -979
  391. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/Sizzle.js +0 -975
  392. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/StringWriter.js +0 -200
  393. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/TridentSelection.js +0 -273
  394. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/dom/XMLWriter.js +0 -155
  395. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/firebug/firebug-lite.js +0 -2518
  396. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/tinymce.js +0 -549
  397. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Button.js +0 -68
  398. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/ColorSplitButton.js +0 -212
  399. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Container.js +0 -56
  400. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Control.js +0 -182
  401. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/DropMenu.js +0 -397
  402. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/ListBox.js +0 -320
  403. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Menu.js +0 -175
  404. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/MenuButton.js +0 -128
  405. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/MenuItem.js +0 -69
  406. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/NativeListBox.js +0 -198
  407. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Separator.js +0 -34
  408. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/SplitButton.js +0 -99
  409. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/ui/Toolbar.js +0 -86
  410. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/Cookie.js +0 -126
  411. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/Dispatcher.js +0 -101
  412. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSON.js +0 -81
  413. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSONP.js +0 -25
  414. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/JSONRequest.js +0 -87
  415. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/URI.js +0 -289
  416. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/util/XHR.js +0 -80
  417. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/classes/xml/Parser.js +0 -126
  418. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/jquery.tinymce.js +0 -1
  419. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/compat2x/editor_plugin.js +0 -1
  420. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/compat2x/editor_plugin_src.js +0 -616
  421. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/blank.htm +0 -1
  422. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/editor_plugin.js +0 -1
  423. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/plugins/safari/editor_plugin_src.js +0 -438
  424. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_dev.js +0 -128
  425. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_jquery.js +0 -1
  426. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_jquery_src.js +0 -12198
  427. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_prototype.js +0 -1
  428. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/jscripts/tiny_mce/tiny_mce_prototype_src.js +0 -13057
  429. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api.html +0 -18
  430. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api_jquery.html +0 -18
  431. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/api_prototype.html +0 -19
  432. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/basic.html +0 -548
  433. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/crossdomain.html +0 -87
  434. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/css/unit.css +0 -120
  435. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/index.html +0 -10
  436. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/jquery_plugin.html +0 -112
  437. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/js/api.js +0 -1438
  438. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/js/testrunner.js +0 -791
  439. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/main.html +0 -8
  440. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/media.html +0 -221
  441. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/menu.html +0 -22
  442. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/parts.html +0 -90
  443. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/paste.html +0 -132
  444. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/performance.html +0 -152
  445. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/range.html +0 -522
  446. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/removeformat.html +0 -88
  447. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/selection.html +0 -235
  448. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/config.ini +0 -27
  449. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/footer.html +0 -3
  450. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/header.html +0 -6
  451. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/index.php +0 -1
  452. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/instructions.txt +0 -4
  453. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/logo.png +0 -0
  454. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/selectors.list +0 -40
  455. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/style.css +0 -181
  456. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/index.php +0 -112
  457. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/slickspeed.js +0 -147
  458. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/system/template.php +0 -47
  459. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/slickspeed/template.html +0 -2865
  460. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tests/test.xml +0 -6
  461. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/ant-contrib.jar +0 -0
  462. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/js_build_tools.jar +0 -0
  463. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnClientAdapter.jar +0 -0
  464. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnant.jar +0 -0
  465. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnjavahl.jar +0 -0
  466. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/svnkit.jar +0 -0
  467. data/public/skyline/javascripts/src/skyline.editor/vendor/tinymce/tools/ant/yuicompressor.jar +0 -0
@@ -1,2295 +0,0 @@
1
- /**
2
- * $Id: Editor.js 1165 2009-06-26 15:26:55Z spocke $
3
- *
4
- * @author Moxiecode
5
- * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
6
- */
7
-
8
- (function(tinymce) {
9
- var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher;
10
- var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit;
11
- var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager;
12
- var inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;
13
-
14
- /**#@+
15
- * @class This class contains the core logic for a TinyMCE editor.
16
- * @member tinymce.Editor
17
- */
18
- tinymce.create('tinymce.Editor', {
19
- /**
20
- * Constructs a editor instance by id.
21
- *
22
- * @constructor
23
- * @member tinymce.Editor
24
- * @param {String} id Unique id for the editor.
25
- * @param {Object} s Optional settings string for the editor.
26
- */
27
- Editor : function(id, s) {
28
- var t = this;
29
-
30
- t.id = t.editorId = id;
31
- t.execCommands = {};
32
- t.queryStateCommands = {};
33
- t.queryValueCommands = {};
34
- t.plugins = {};
35
-
36
- // Add events to the editor
37
- each([
38
- 'onPreInit',
39
- 'onBeforeRenderUI',
40
- 'onPostRender',
41
- 'onInit',
42
- 'onRemove',
43
- 'onActivate',
44
- 'onDeactivate',
45
- 'onClick',
46
- 'onEvent',
47
- 'onMouseUp',
48
- 'onMouseDown',
49
- 'onDblClick',
50
- 'onKeyDown',
51
- 'onKeyUp',
52
- 'onKeyPress',
53
- 'onContextMenu',
54
- 'onSubmit',
55
- 'onReset',
56
- 'onPaste',
57
- 'onPreProcess',
58
- 'onPostProcess',
59
- 'onBeforeSetContent',
60
- 'onBeforeGetContent',
61
- 'onSetContent',
62
- 'onGetContent',
63
- 'onLoadContent',
64
- 'onSaveContent',
65
- 'onNodeChange',
66
- 'onChange',
67
- 'onBeforeExecCommand',
68
- 'onExecCommand',
69
- 'onUndo',
70
- 'onRedo',
71
- 'onVisualAid',
72
- 'onSetProgressState'
73
- ], function(e) {
74
- t[e] = new Dispatcher(t);
75
- });
76
-
77
- // Default editor config
78
- t.settings = s = extend({
79
- id : id,
80
- language : 'en',
81
- docs_language : 'en',
82
- theme : 'simple',
83
- skin : 'default',
84
- delta_width : 0,
85
- delta_height : 0,
86
- popup_css : '',
87
- plugins : '',
88
- document_base_url : tinymce.documentBaseURL,
89
- add_form_submit_trigger : 1,
90
- submit_patch : 1,
91
- add_unload_trigger : 1,
92
- convert_urls : 1,
93
- relative_urls : 1,
94
- remove_script_host : 1,
95
- table_inline_editing : 0,
96
- object_resizing : 1,
97
- cleanup : 1,
98
- accessibility_focus : 1,
99
- custom_shortcuts : 1,
100
- custom_undo_redo_keyboard_shortcuts : 1,
101
- custom_undo_redo_restore_selection : 1,
102
- custom_undo_redo : 1,
103
- doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
104
- visual_table_class : 'mceItemTable',
105
- visual : 1,
106
- inline_styles : true,
107
- convert_fonts_to_spans : true,
108
- font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
109
- apply_source_formatting : 1,
110
- directionality : 'ltr',
111
- forced_root_block : 'p',
112
- valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',
113
- hidden_input : 1,
114
- padd_empty_editor : 1,
115
- render_ui : 1,
116
- init_theme : 1,
117
- force_p_newlines : 1,
118
- indentation : '30px',
119
- keep_styles : 1,
120
- fix_table_elements : 1,
121
- removeformat_selector : 'span,b,strong,em,i,font,u,strike'
122
- }, s);
123
-
124
- // Setup URIs
125
- t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
126
- base_uri : tinyMCE.baseURI
127
- });
128
- t.baseURI = EditorManager.baseURI;
129
-
130
- // Call setup
131
- t.execCallback('setup', t);
132
- },
133
-
134
- /**#@+
135
- * @method
136
- */
137
-
138
- /**
139
- * Renderes the editor/adds it to the page.
140
- */
141
- render : function(nst) {
142
- var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;
143
-
144
- // Page is not loaded yet, wait for it
145
- if (!Event.domLoaded) {
146
- Event.add(document, 'init', function() {
147
- t.render();
148
- });
149
- return;
150
- }
151
-
152
- // Force strict loading mode if render us called by user and not internally
153
- if (!nst) {
154
- s.strict_loading_mode = 1;
155
- tinyMCE.settings = s;
156
- }
157
-
158
- // Element not found, then skip initialization
159
- if (!t.getElement())
160
- return;
161
-
162
- if (s.strict_loading_mode) {
163
- sl.settings.strict_mode = s.strict_loading_mode;
164
- tinymce.DOM.settings.strict = 1;
165
- }
166
-
167
- // Add hidden input for non input elements inside form elements
168
- if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
169
- DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
170
-
171
- if (tinymce.WindowManager)
172
- t.windowManager = new tinymce.WindowManager(t);
173
-
174
- if (s.encoding == 'xml') {
175
- t.onGetContent.add(function(ed, o) {
176
- if (o.save)
177
- o.content = DOM.encode(o.content);
178
- });
179
- }
180
-
181
- if (s.add_form_submit_trigger) {
182
- t.onSubmit.addToTop(function() {
183
- if (t.initialized) {
184
- t.save();
185
- t.isNotDirty = 1;
186
- }
187
- });
188
- }
189
-
190
- if (s.add_unload_trigger) {
191
- t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {
192
- if (t.initialized && !t.destroyed && !t.isHidden())
193
- t.save({format : 'raw', no_events : true});
194
- });
195
- }
196
-
197
- tinymce.addUnload(t.destroy, t);
198
-
199
- if (s.submit_patch) {
200
- t.onBeforeRenderUI.add(function() {
201
- var n = t.getElement().form;
202
-
203
- if (!n)
204
- return;
205
-
206
- // Already patched
207
- if (n._mceOldSubmit)
208
- return;
209
-
210
- // Check page uses id="submit" or name="submit" for it's submit button
211
- if (!n.submit.nodeType && !n.submit.length) {
212
- t.formElement = n;
213
- n._mceOldSubmit = n.submit;
214
- n.submit = function() {
215
- // Save all instances
216
- EditorManager.triggerSave();
217
- t.isNotDirty = 1;
218
-
219
- return t.formElement._mceOldSubmit(t.formElement);
220
- };
221
- }
222
-
223
- n = null;
224
- });
225
- }
226
-
227
- // Load scripts
228
- function loadScripts() {
229
- if (s.language)
230
- sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
231
-
232
- if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
233
- ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
234
-
235
- each(explode(s.plugins), function(p) {
236
- if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {
237
- // Skip safari plugin for other browsers
238
- if (!isWebKit && p == 'safari')
239
- return;
240
-
241
- PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
242
- }
243
- });
244
-
245
- // Init when que is loaded
246
- sl.loadQueue(function() {
247
- if (!t.removed)
248
- t.init();
249
- });
250
- };
251
-
252
- // Load compat2x first
253
- if (s.plugins.indexOf('compat2x') != -1) {
254
- PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
255
- sl.loadQueue(loadScripts);
256
- } else
257
- loadScripts();
258
- },
259
-
260
- /**
261
- * Initializes the editor this will be called automatically when
262
- * all plugins/themes and language packs are loaded by the rendered method.
263
- * This method will setup the iframe and create the theme and plugin instances.
264
- */
265
- init : function() {
266
- var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;
267
-
268
- EditorManager.add(t);
269
-
270
- // Create theme
271
- if (s.theme) {
272
- s.theme = s.theme.replace(/-/, '');
273
- o = ThemeManager.get(s.theme);
274
- t.theme = new o();
275
-
276
- if (t.theme.init && s.init_theme)
277
- t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));
278
- }
279
-
280
- // Create all plugins
281
- each(explode(s.plugins.replace(/\-/g, '')), function(p) {
282
- var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;
283
-
284
- if (c) {
285
- po = new c(t, u);
286
-
287
- t.plugins[p] = po;
288
-
289
- if (po.init)
290
- po.init(t, u);
291
- }
292
- });
293
-
294
- // Setup popup CSS path(s)
295
- if (s.popup_css !== false) {
296
- if (s.popup_css)
297
- s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);
298
- else
299
- s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
300
- }
301
-
302
- if (s.popup_css_add)
303
- s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
304
-
305
- // Setup control factory
306
- t.controlManager = new tinymce.ControlManager(t);
307
- t.undoManager = new tinymce.UndoManager(t);
308
-
309
- // Pass through
310
- t.undoManager.onAdd.add(function(um, l) {
311
- if (!l.initial)
312
- return t.onChange.dispatch(t, l, um);
313
- });
314
-
315
- t.undoManager.onUndo.add(function(um, l) {
316
- return t.onUndo.dispatch(t, l, um);
317
- });
318
-
319
- t.undoManager.onRedo.add(function(um, l) {
320
- return t.onRedo.dispatch(t, l, um);
321
- });
322
-
323
- if (s.custom_undo_redo) {
324
- t.onExecCommand.add(function(ed, cmd, ui, val, a) {
325
- if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))
326
- t.undoManager.add();
327
- });
328
- }
329
-
330
- t.onExecCommand.add(function(ed, c) {
331
- // Don't refresh the select lists until caret move
332
- if (!/^(FontName|FontSize)$/.test(c))
333
- t.nodeChanged();
334
- });
335
-
336
- // Remove ghost selections on images and tables in Gecko
337
- if (isGecko) {
338
- function repaint(a, o) {
339
- if (!o || !o.initial)
340
- t.execCommand('mceRepaint');
341
- };
342
-
343
- t.onUndo.add(repaint);
344
- t.onRedo.add(repaint);
345
- t.onSetContent.add(repaint);
346
- }
347
-
348
- // Enables users to override the control factory
349
- t.onBeforeRenderUI.dispatch(t, t.controlManager);
350
-
351
- // Measure box
352
- if (s.render_ui) {
353
- w = s.width || e.style.width || e.offsetWidth;
354
- h = s.height || e.style.height || e.offsetHeight;
355
- t.orgDisplay = e.style.display;
356
- re = /^[0-9\.]+(|px)$/i;
357
-
358
- if (re.test('' + w))
359
- w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);
360
-
361
- if (re.test('' + h))
362
- h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);
363
-
364
- // Render UI
365
- o = t.theme.renderUI({
366
- targetNode : e,
367
- width : w,
368
- height : h,
369
- deltaWidth : s.delta_width,
370
- deltaHeight : s.delta_height
371
- });
372
-
373
- t.editorContainer = o.editorContainer;
374
- }
375
-
376
- // #ifdef contentEditable
377
-
378
- // Content editable mode ends here
379
- if (s.content_editable) {
380
- e = n = o = null; // Fix IE leak
381
- return t.setupContentEditable();
382
- }
383
-
384
- // #endif
385
-
386
- // User specified a document.domain value
387
- if (document.domain && location.hostname != document.domain)
388
- tinymce.relaxedDomain = document.domain;
389
-
390
- // Resize editor
391
- DOM.setStyles(o.sizeContainer || o.editorContainer, {
392
- width : w,
393
- height : h
394
- });
395
-
396
- h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');
397
- if (h < 100)
398
- h = 100;
399
-
400
- t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';
401
-
402
- // We only need to override paths if we have to
403
- // IE has a bug where it remove site absolute urls to relative ones if this is specified
404
- if (s.document_base_url != tinymce.documentBaseURL)
405
- t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
406
-
407
- t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
408
-
409
- if (tinymce.relaxedDomain)
410
- t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';
411
-
412
- bi = s.body_id || 'tinymce';
413
- if (bi.indexOf('=') != -1) {
414
- bi = t.getParam('body_id', '', 'hash');
415
- bi = bi[t.id] || bi;
416
- }
417
-
418
- bc = s.body_class || '';
419
- if (bc.indexOf('=') != -1) {
420
- bc = t.getParam('body_class', '', 'hash');
421
- bc = bc[t.id] || '';
422
- }
423
-
424
- t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';
425
-
426
- // Domain relaxing enabled, then set document domain
427
- if (tinymce.relaxedDomain) {
428
- // We need to write the contents here in IE since multiple writes messes up refresh button and back button
429
- if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5))
430
- u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';
431
- else if (tinymce.isOpera)
432
- u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';
433
- }
434
-
435
- // Create iframe
436
- n = DOM.add(o.iframeContainer, 'iframe', {
437
- id : t.id + "_ifr",
438
- src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7
439
- frameBorder : '0',
440
- style : {
441
- width : '100%',
442
- height : h
443
- }
444
- });
445
-
446
- t.contentAreaContainer = o.iframeContainer;
447
- DOM.get(o.editorContainer).style.display = t.orgDisplay;
448
- DOM.get(t.id).style.display = 'none';
449
-
450
- if (!isIE || !tinymce.relaxedDomain)
451
- t.setupIframe();
452
-
453
- e = n = o = null; // Cleanup
454
- },
455
-
456
- /**
457
- * This method get called by the init method ones the iframe is loaded.
458
- * It will fill the iframe with contents, setups DOM and selection objects for the iframe.
459
- * This method should not be called directly.
460
- */
461
- setupIframe : function() {
462
- var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;
463
-
464
- // Setup iframe body
465
- if (!isIE || !tinymce.relaxedDomain) {
466
- d.open();
467
- d.write(t.iframeHTML);
468
- d.close();
469
- }
470
-
471
- // Design mode needs to be added here Ctrl+A will fail otherwise
472
- if (!isIE) {
473
- try {
474
- if (!s.readonly)
475
- d.designMode = 'On';
476
- } catch (ex) {
477
- // Will fail on Gecko if the editor is placed in an hidden container element
478
- // The design mode will be set ones the editor is focused
479
- }
480
- }
481
-
482
- // IE needs to use contentEditable or it will display non secure items for HTTPS
483
- if (isIE) {
484
- // It will not steal focus if we hide it while setting contentEditable
485
- b = t.getBody();
486
- DOM.hide(b);
487
-
488
- if (!s.readonly)
489
- b.contentEditable = true;
490
-
491
- DOM.show(b);
492
- }
493
-
494
- // Setup objects
495
- t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
496
- keep_values : true,
497
- url_converter : t.convertURL,
498
- url_converter_scope : t,
499
- hex_colors : s.force_hex_style_colors,
500
- class_filter : s.class_filter,
501
- update_styles : 1,
502
- fix_ie_paragraphs : 1
503
- });
504
-
505
- t.serializer = new tinymce.dom.Serializer({
506
- entity_encoding : s.entity_encoding,
507
- entities : s.entities,
508
- valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
509
- extended_valid_elements : s.extended_valid_elements,
510
- valid_child_elements : s.valid_child_elements,
511
- invalid_elements : s.invalid_elements,
512
- fix_table_elements : s.fix_table_elements,
513
- fix_list_elements : s.fix_list_elements,
514
- fix_content_duplication : s.fix_content_duplication,
515
- convert_fonts_to_spans : s.convert_fonts_to_spans,
516
- font_size_classes : s.font_size_classes,
517
- font_size_style_values : s.font_size_style_values,
518
- apply_source_formatting : s.apply_source_formatting,
519
- remove_linebreaks : s.remove_linebreaks,
520
- element_format : s.element_format,
521
- dom : t.dom
522
- });
523
-
524
- t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
525
- t.forceBlocks = new tinymce.ForceBlocks(t, {
526
- forced_root_block : s.forced_root_block
527
- });
528
- t.editorCommands = new tinymce.EditorCommands(t);
529
-
530
- // Pass through
531
- t.serializer.onPreProcess.add(function(se, o) {
532
- return t.onPreProcess.dispatch(t, o, se);
533
- });
534
-
535
- t.serializer.onPostProcess.add(function(se, o) {
536
- return t.onPostProcess.dispatch(t, o, se);
537
- });
538
-
539
- t.onPreInit.dispatch(t);
540
-
541
- if (!s.gecko_spellcheck)
542
- t.getBody().spellcheck = 0;
543
-
544
- if (!s.readonly)
545
- t._addEvents();
546
-
547
- t.controlManager.onPostRender.dispatch(t, t.controlManager);
548
- t.onPostRender.dispatch(t);
549
-
550
- if (s.directionality)
551
- t.getBody().dir = s.directionality;
552
-
553
- if (s.nowrap)
554
- t.getBody().style.whiteSpace = "nowrap";
555
-
556
- if (s.custom_elements) {
557
- function handleCustom(ed, o) {
558
- each(explode(s.custom_elements), function(v) {
559
- var n;
560
-
561
- if (v.indexOf('~') === 0) {
562
- v = v.substring(1);
563
- n = 'span';
564
- } else
565
- n = 'div';
566
-
567
- o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>');
568
- o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>');
569
- });
570
- };
571
-
572
- t.onBeforeSetContent.add(handleCustom);
573
- t.onPostProcess.add(function(ed, o) {
574
- if (o.set)
575
- handleCustom(ed, o);
576
- });
577
- }
578
-
579
- if (s.handle_node_change_callback) {
580
- t.onNodeChange.add(function(ed, cm, n) {
581
- t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());
582
- });
583
- }
584
-
585
- if (s.save_callback) {
586
- t.onSaveContent.add(function(ed, o) {
587
- var h = t.execCallback('save_callback', t.id, o.content, t.getBody());
588
-
589
- if (h)
590
- o.content = h;
591
- });
592
- }
593
-
594
- if (s.onchange_callback) {
595
- t.onChange.add(function(ed, l) {
596
- t.execCallback('onchange_callback', t, l);
597
- });
598
- }
599
-
600
- if (s.convert_newlines_to_brs) {
601
- t.onBeforeSetContent.add(function(ed, o) {
602
- if (o.initial)
603
- o.content = o.content.replace(/\r?\n/g, '<br />');
604
- });
605
- }
606
-
607
- if (s.fix_nesting && isIE) {
608
- t.onBeforeSetContent.add(function(ed, o) {
609
- o.content = t._fixNesting(o.content);
610
- });
611
- }
612
-
613
- if (s.preformatted) {
614
- t.onPostProcess.add(function(ed, o) {
615
- o.content = o.content.replace(/^\s*<pre.*?>/, '');
616
- o.content = o.content.replace(/<\/pre>\s*$/, '');
617
-
618
- if (o.set)
619
- o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';
620
- });
621
- }
622
-
623
- if (s.verify_css_classes) {
624
- t.serializer.attribValueFilter = function(n, v) {
625
- var s, cl;
626
-
627
- if (n == 'class') {
628
- // Build regexp for classes
629
- if (!t.classesRE) {
630
- cl = t.dom.getClasses();
631
-
632
- if (cl.length > 0) {
633
- s = '';
634
-
635
- each (cl, function(o) {
636
- s += (s ? '|' : '') + o['class'];
637
- });
638
-
639
- t.classesRE = new RegExp('(' + s + ')', 'gi');
640
- }
641
- }
642
-
643
- return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';
644
- }
645
-
646
- return v;
647
- };
648
- }
649
-
650
- if (s.convert_fonts_to_spans)
651
- t._convertFonts();
652
-
653
- if (s.inline_styles)
654
- t._convertInlineElements();
655
-
656
- if (s.cleanup_callback) {
657
- t.onBeforeSetContent.add(function(ed, o) {
658
- o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
659
- });
660
-
661
- t.onPreProcess.add(function(ed, o) {
662
- if (o.set)
663
- t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);
664
-
665
- if (o.get)
666
- t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);
667
- });
668
-
669
- t.onPostProcess.add(function(ed, o) {
670
- if (o.set)
671
- o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
672
-
673
- if (o.get)
674
- o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);
675
- });
676
- }
677
-
678
- if (s.save_callback) {
679
- t.onGetContent.add(function(ed, o) {
680
- if (o.save)
681
- o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());
682
- });
683
- }
684
-
685
- if (s.handle_event_callback) {
686
- t.onEvent.add(function(ed, e, o) {
687
- if (t.execCallback('handle_event_callback', e, ed, o) === false)
688
- Event.cancel(e);
689
- });
690
- }
691
-
692
- // Add visual aids when new contents is added
693
- t.onSetContent.add(function() {
694
- t.addVisual(t.getBody());
695
- });
696
-
697
- // Remove empty contents
698
- if (s.padd_empty_editor) {
699
- t.onPostProcess.add(function(ed, o) {
700
- o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
701
- });
702
- }
703
-
704
- if (isGecko) {
705
- // Fix gecko link bug, when a link is placed at the end of block elements there is
706
- // no way to move the caret behind the link. This fix adds a bogus br element after the link
707
- function fixLinks(ed, o) {
708
- each(ed.dom.select('a'), function(n) {
709
- var pn = n.parentNode;
710
-
711
- if (ed.dom.isBlock(pn) && pn.lastChild === n)
712
- ed.dom.add(pn, 'br', {'mce_bogus' : 1});
713
- });
714
- };
715
-
716
- t.onExecCommand.add(function(ed, cmd) {
717
- if (cmd === 'CreateLink')
718
- fixLinks(ed);
719
- });
720
-
721
- t.onSetContent.add(t.selection.onSetContent.add(fixLinks));
722
-
723
- if (!s.readonly) {
724
- try {
725
- // Design mode must be set here once again to fix a bug where
726
- // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again
727
- d.designMode = 'Off';
728
- d.designMode = 'On';
729
- } catch (ex) {
730
- // Will fail on Gecko if the editor is placed in an hidden container element
731
- // The design mode will be set ones the editor is focused
732
- }
733
- }
734
- }
735
-
736
- // A small timeout was needed since firefox will remove. Bug: #1838304
737
- setTimeout(function () {
738
- if (t.removed)
739
- return;
740
-
741
- t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
742
- t.startContent = t.getContent({format : 'raw'});
743
- t.undoManager.add({initial : true});
744
- t.initialized = true;
745
-
746
- t.onInit.dispatch(t);
747
- t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());
748
- t.execCallback('init_instance_callback', t);
749
- t.focus(true);
750
- t.nodeChanged({initial : 1});
751
-
752
- // Load specified content CSS last
753
- if (s.content_css) {
754
- tinymce.each(explode(s.content_css), function(u) {
755
- t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
756
- });
757
- }
758
-
759
- // Handle auto focus
760
- if (s.auto_focus) {
761
- setTimeout(function () {
762
- var ed = EditorManager.get(s.auto_focus);
763
-
764
- ed.selection.select(ed.getBody(), 1);
765
- ed.selection.collapse(1);
766
- ed.getWin().focus();
767
- }, 100);
768
- }
769
- }, 1);
770
-
771
- e = null;
772
- },
773
-
774
- // #ifdef contentEditable
775
-
776
- /**
777
- * Sets up the contentEditable mode.
778
- */
779
- setupContentEditable : function() {
780
- var t = this, s = t.settings, e = t.getElement();
781
-
782
- t.contentDocument = s.content_document || document;
783
- t.contentWindow = s.content_window || window;
784
- t.bodyElement = e;
785
-
786
- // Prevent leak in IE
787
- s.content_document = s.content_window = null;
788
-
789
- DOM.hide(e);
790
- e.contentEditable = t.getParam('content_editable_state', true);
791
- DOM.show(e);
792
-
793
- if (!s.gecko_spellcheck)
794
- t.getDoc().body.spellcheck = 0;
795
-
796
- // Setup objects
797
- t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
798
- keep_values : true,
799
- url_converter : t.convertURL,
800
- url_converter_scope : t,
801
- hex_colors : s.force_hex_style_colors,
802
- class_filter : s.class_filter,
803
- root_element : t.id,
804
- strict_root : 1,
805
- fix_ie_paragraphs : 1,
806
- update_styles : 1
807
- });
808
-
809
- t.serializer = new tinymce.dom.Serializer({
810
- entity_encoding : s.entity_encoding,
811
- entities : s.entities,
812
- valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
813
- extended_valid_elements : s.extended_valid_elements,
814
- valid_child_elements : s.valid_child_elements,
815
- invalid_elements : s.invalid_elements,
816
- fix_table_elements : s.fix_table_elements,
817
- fix_list_elements : s.fix_list_elements,
818
- fix_content_duplication : s.fix_content_duplication,
819
- convert_fonts_to_spans : s.convert_fonts_to_spans,
820
- font_size_classes : s.font_size_classes,
821
- font_size_style_values : s.font_size_style_values,
822
- apply_source_formatting : s.apply_source_formatting,
823
- dom : t.dom
824
- });
825
-
826
- t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
827
- t.forceBlocks = new tinymce.ForceBlocks(t, {
828
- forced_root_block : s.forced_root_block
829
- });
830
- t.editorCommands = new tinymce.EditorCommands(t);
831
-
832
- // Pass through
833
- t.serializer.onPreProcess.add(function(se, o) {
834
- return t.onPreProcess.dispatch(t, o, se);
835
- });
836
-
837
- t.serializer.onPostProcess.add(function(se, o) {
838
- return t.onPostProcess.dispatch(t, o, se);
839
- });
840
-
841
- t.onPreInit.dispatch(t);
842
- t._addEvents();
843
-
844
- t.controlManager.onPostRender.dispatch(t, t.controlManager);
845
- t.onPostRender.dispatch(t);
846
-
847
- if (s.convert_fonts_to_spans)
848
- t._convertFonts();
849
-
850
- if (s.inline_styles)
851
- t._convertInlineElements();
852
-
853
- t.onSetContent.add(function() {
854
- t.addVisual(t.getBody());
855
- });
856
-
857
- t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
858
- t.startContent = t.getContent({format : 'raw'});
859
- t.undoManager.add({initial : true});
860
- t.initialized = true;
861
-
862
- t.onInit.dispatch(t);
863
- t.focus(true);
864
- t.nodeChanged({initial : 1});
865
-
866
- // Load specified content CSS last
867
- if (s.content_css) {
868
- each(explode(s.content_css), function(u) {
869
- t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
870
- });
871
- }
872
-
873
- if (isIE) {
874
- // Store away selection
875
- t.dom.bind(t.getElement(), 'beforedeactivate', function() {
876
- t.lastSelectionBookmark = t.selection.getBookmark(1);
877
- });
878
-
879
- t.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
880
- if (!DOM.getParent(ed.selection.getStart(), function(n) {return n == ed.getBody();}))
881
- o.terminate = 1;
882
-
883
- if (!DOM.getParent(ed.selection.getEnd(), function(n) {return n == ed.getBody();}))
884
- o.terminate = 1;
885
- });
886
- }
887
-
888
- e = null; // Cleanup
889
- },
890
-
891
- // #endif
892
-
893
- /**
894
- * Focuses/activates the editor. This will set this editor as the activeEditor in the EditorManager
895
- * it will also place DOM focus inside the editor.
896
- *
897
- * @param {bool} sf Skip DOM focus. Just set is as the active editor.
898
- */
899
- focus : function(sf) {
900
- var oed, t = this, ce = t.settings.content_editable;
901
-
902
- if (!sf) {
903
- // Is not content editable or the selection is outside the area in IE
904
- // the IE statement is needed to avoid bluring if element selections inside layers since
905
- // the layer is like it's own document in IE
906
- if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc()))
907
- t.getWin().focus();
908
-
909
- // #ifdef contentEditable
910
-
911
- // Content editable mode ends here
912
- if (ce) {
913
- if (tinymce.isWebKit)
914
- t.getWin().focus();
915
- else {
916
- if (tinymce.isIE)
917
- t.getElement().setActive();
918
- else
919
- t.getElement().focus();
920
- }
921
- }
922
-
923
- // #endif
924
- }
925
-
926
- if (EditorManager.activeEditor != t) {
927
- if ((oed = EditorManager.activeEditor) != null)
928
- oed.onDeactivate.dispatch(oed, t);
929
-
930
- t.onActivate.dispatch(t, oed);
931
- }
932
-
933
- EditorManager._setActive(t);
934
- },
935
-
936
- /**
937
- * Executes a legacy callback. This method is useful to call old 2.x option callbacks.
938
- * There new event model is a better way to add callback so this method might be removed in the future.
939
- *
940
- * @param {String} n Name of the callback to execute.
941
- * @return {Object} Return value passed from callback function.
942
- */
943
- execCallback : function(n) {
944
- var t = this, f = t.settings[n], s;
945
-
946
- if (!f)
947
- return;
948
-
949
- // Look through lookup
950
- if (t.callbackLookup && (s = t.callbackLookup[n])) {
951
- f = s.func;
952
- s = s.scope;
953
- }
954
-
955
- if (is(f, 'string')) {
956
- s = f.replace(/\.\w+$/, '');
957
- s = s ? tinymce.resolve(s) : 0;
958
- f = tinymce.resolve(f);
959
- t.callbackLookup = t.callbackLookup || {};
960
- t.callbackLookup[n] = {func : f, scope : s};
961
- }
962
-
963
- return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
964
- },
965
-
966
- /**
967
- * Translates the specified string by replacing variables with language pack items it will also check if there is
968
- * a key mathcin the input.
969
- *
970
- * @param {String} s String to translate by the language pack data.
971
- * @return {String} Translated string.
972
- */
973
- translate : function(s) {
974
- var c = this.settings.language || 'en', i18n = EditorManager.i18n;
975
-
976
- if (!s)
977
- return '';
978
-
979
- return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
980
- return i18n[c + '.' + b] || '{#' + b + '}';
981
- });
982
- },
983
-
984
- /**
985
- * Returns a language pack item by name/key.
986
- *
987
- * @param {String} n Name/key to get from the language pack.
988
- * @param {String} dv Optional default value to retrive.
989
- */
990
- getLang : function(n, dv) {
991
- return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
992
- },
993
-
994
- /**
995
- * Returns a configuration parameter by name.
996
- *
997
- * @param {String} n Configruation parameter to retrive.
998
- * @param {String} dv Optional default value to return.
999
- * @param {String} ty Optional type parameter.
1000
- * @return {String} Configuration parameter value or default value.
1001
- */
1002
- getParam : function(n, dv, ty) {
1003
- var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;
1004
-
1005
- if (ty === 'hash') {
1006
- o = {};
1007
-
1008
- if (is(v, 'string')) {
1009
- each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {
1010
- v = v.split('=');
1011
-
1012
- if (v.length > 1)
1013
- o[tr(v[0])] = tr(v[1]);
1014
- else
1015
- o[tr(v[0])] = tr(v);
1016
- });
1017
- } else
1018
- o = v;
1019
-
1020
- return o;
1021
- }
1022
-
1023
- return v;
1024
- },
1025
-
1026
- /**
1027
- * Distpaches out a onNodeChange event to all observers. This method should be called when you
1028
- * need to update the UI states or element path etc.
1029
- *
1030
- * @param {Object} o Optional object to pass along for the node changed event.
1031
- */
1032
- nodeChanged : function(o) {
1033
- var t = this, s = t.selection, n = s.getNode() || t.getBody();
1034
-
1035
- // Fix for bug #1896577 it seems that this can not be fired while the editor is loading
1036
- if (t.initialized) {
1037
- t.onNodeChange.dispatch(
1038
- t,
1039
- o ? o.controlManager || t.controlManager : t.controlManager,
1040
- isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state
1041
- s.isCollapsed(),
1042
- o
1043
- );
1044
- }
1045
- },
1046
-
1047
- /**
1048
- * Adds a button that later gets created by the ControlManager. This is a shorter and easier method
1049
- * of adding buttons without the need to deal with the ControlManager directly. But it's also less
1050
- * powerfull if you need more control use the ControlManagers factory methods instead.
1051
- *
1052
- * @param {String} n Button name to add.
1053
- * @param {Object} s Settings object with title, cmd etc.
1054
- */
1055
- addButton : function(n, s) {
1056
- var t = this;
1057
-
1058
- t.buttons = t.buttons || {};
1059
- t.buttons[n] = s;
1060
- },
1061
-
1062
- /**
1063
- * Adds a custom command to the editor, you can also override existing commands with this method.
1064
- * The command that you add can be executed with execCommand.
1065
- *
1066
- * @param {String} n Command name to add/override.
1067
- * @param {function} f Function to execute when the command occurs.
1068
- * @param {Object} s Optional scope to execute the function in.
1069
- */
1070
- addCommand : function(n, f, s) {
1071
- this.execCommands[n] = {func : f, scope : s || this};
1072
- },
1073
-
1074
- /**
1075
- * Adds a custom query state command to the editor, you can also override existing commands with this method.
1076
- * The command that you add can be executed with queryCommandState function.
1077
- *
1078
- * @param {String} n Command name to add/override.
1079
- * @param {function} f Function to execute when the command state retrival occurs.
1080
- * @param {Object} s Optional scope to execute the function in.
1081
- */
1082
- addQueryStateHandler : function(n, f, s) {
1083
- this.queryStateCommands[n] = {func : f, scope : s || this};
1084
- },
1085
-
1086
- /**
1087
- * Adds a custom query value command to the editor, you can also override existing commands with this method.
1088
- * The command that you add can be executed with queryCommandValue function.
1089
- *
1090
- * @param {String} n Command name to add/override.
1091
- * @param {function} f Function to execute when the command value retrival occurs.
1092
- * @param {Object} s Optional scope to execute the function in.
1093
- */
1094
- addQueryValueHandler : function(n, f, s) {
1095
- this.queryValueCommands[n] = {func : f, scope : s || this};
1096
- },
1097
-
1098
- /**
1099
- * Adds a keyboard shortcut for some command or function.
1100
- *
1101
- * @param {String} pa Shortcut pattern. Like for example: ctrl+alt+o.
1102
- * @param {String} desc Text description for the command.
1103
- * @param {String/Function} cmd_func Command name string or function to execute when the key is pressed.
1104
- * @param {Object} sc Optional scope to execute the function in.
1105
- * @return {bool} true/false state if the shortcut was added or not.
1106
- */
1107
- addShortcut : function(pa, desc, cmd_func, sc) {
1108
- var t = this, c;
1109
-
1110
- if (!t.settings.custom_shortcuts)
1111
- return false;
1112
-
1113
- t.shortcuts = t.shortcuts || {};
1114
-
1115
- if (is(cmd_func, 'string')) {
1116
- c = cmd_func;
1117
-
1118
- cmd_func = function() {
1119
- t.execCommand(c, false, null);
1120
- };
1121
- }
1122
-
1123
- if (is(cmd_func, 'object')) {
1124
- c = cmd_func;
1125
-
1126
- cmd_func = function() {
1127
- t.execCommand(c[0], c[1], c[2]);
1128
- };
1129
- }
1130
-
1131
- each(explode(pa), function(pa) {
1132
- var o = {
1133
- func : cmd_func,
1134
- scope : sc || this,
1135
- desc : desc,
1136
- alt : false,
1137
- ctrl : false,
1138
- shift : false
1139
- };
1140
-
1141
- each(explode(pa, '+'), function(v) {
1142
- switch (v) {
1143
- case 'alt':
1144
- case 'ctrl':
1145
- case 'shift':
1146
- o[v] = true;
1147
- break;
1148
-
1149
- default:
1150
- o.charCode = v.charCodeAt(0);
1151
- o.keyCode = v.toUpperCase().charCodeAt(0);
1152
- }
1153
- });
1154
-
1155
- t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;
1156
- });
1157
-
1158
- return true;
1159
- },
1160
-
1161
- /**
1162
- * Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or
1163
- * they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org.
1164
- * This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these
1165
- * return true it will handle the command as a internal browser command.
1166
- *
1167
- * @param {String} cmd Command name to execute, for example mceLink or Bold.
1168
- * @param {bool} ui True/false state if a UI (dialog) should be presented or not.
1169
- * @param {mixed} val Optional command value, this can be anything.
1170
- * @param {Object} a Optional arguments object.
1171
- * @return {bool} True/false if the command was executed or not.
1172
- */
1173
- execCommand : function(cmd, ui, val, a) {
1174
- var t = this, s = 0, o, st;
1175
-
1176
- if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))
1177
- t.focus();
1178
-
1179
- o = {};
1180
- t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);
1181
- if (o.terminate)
1182
- return false;
1183
-
1184
- // Command callback
1185
- if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {
1186
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1187
- return true;
1188
- }
1189
-
1190
- // Registred commands
1191
- if (o = t.execCommands[cmd]) {
1192
- st = o.func.call(o.scope, ui, val);
1193
-
1194
- // Fall through on true
1195
- if (st !== true) {
1196
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1197
- return st;
1198
- }
1199
- }
1200
-
1201
- // Plugin commands
1202
- each(t.plugins, function(p) {
1203
- if (p.execCommand && p.execCommand(cmd, ui, val)) {
1204
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1205
- s = 1;
1206
- return false;
1207
- }
1208
- });
1209
-
1210
- if (s)
1211
- return true;
1212
-
1213
- // Theme commands
1214
- if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {
1215
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1216
- return true;
1217
- }
1218
-
1219
- // Execute global commands
1220
- if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) {
1221
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1222
- return true;
1223
- }
1224
-
1225
- // Editor commands
1226
- if (t.editorCommands.execCommand(cmd, ui, val)) {
1227
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1228
- return true;
1229
- }
1230
-
1231
- // Browser commands
1232
- t.getDoc().execCommand(cmd, ui, val);
1233
- t.onExecCommand.dispatch(t, cmd, ui, val, a);
1234
- },
1235
-
1236
- /**
1237
- * Returns a command specific state, for example if bold is enabled or not.
1238
- *
1239
- * @param {string} c Command to query state from.
1240
- * @return {bool} Command specific state, for example if bold is enabled or not.
1241
- */
1242
- queryCommandState : function(c) {
1243
- var t = this, o, s;
1244
-
1245
- // Is hidden then return undefined
1246
- if (t._isHidden())
1247
- return;
1248
-
1249
- // Registred commands
1250
- if (o = t.queryStateCommands[c]) {
1251
- s = o.func.call(o.scope);
1252
-
1253
- // Fall though on true
1254
- if (s !== true)
1255
- return s;
1256
- }
1257
-
1258
- // Registred commands
1259
- o = t.editorCommands.queryCommandState(c);
1260
- if (o !== -1)
1261
- return o;
1262
-
1263
- // Browser commands
1264
- try {
1265
- return this.getDoc().queryCommandState(c);
1266
- } catch (ex) {
1267
- // Fails sometimes see bug: 1896577
1268
- }
1269
- },
1270
-
1271
- /**
1272
- * Returns a command specific value, for example the current font size.
1273
- *
1274
- * @param {string} c Command to query value from.
1275
- * @return {Object} Command specific value, for example the current font size.
1276
- */
1277
- queryCommandValue : function(c) {
1278
- var t = this, o, s;
1279
-
1280
- // Is hidden then return undefined
1281
- if (t._isHidden())
1282
- return;
1283
-
1284
- // Registred commands
1285
- if (o = t.queryValueCommands[c]) {
1286
- s = o.func.call(o.scope);
1287
-
1288
- // Fall though on true
1289
- if (s !== true)
1290
- return s;
1291
- }
1292
-
1293
- // Registred commands
1294
- o = t.editorCommands.queryCommandValue(c);
1295
- if (is(o))
1296
- return o;
1297
-
1298
- // Browser commands
1299
- try {
1300
- return this.getDoc().queryCommandValue(c);
1301
- } catch (ex) {
1302
- // Fails sometimes see bug: 1896577
1303
- }
1304
- },
1305
-
1306
- /**
1307
- * Shows the editor and hides any textarea/div that the editor is supposed to replace.
1308
- */
1309
- show : function() {
1310
- var t = this;
1311
-
1312
- DOM.show(t.getContainer());
1313
- DOM.hide(t.id);
1314
- t.load();
1315
- },
1316
-
1317
- /**
1318
- * Hides the editor and shows any textarea/div that the editor is supposed to replace.
1319
- */
1320
- hide : function() {
1321
- var t = this, d = t.getDoc();
1322
-
1323
- // Fixed bug where IE has a blinking cursor left from the editor
1324
- if (isIE && d)
1325
- d.execCommand('SelectAll');
1326
-
1327
- // We must save before we hide so Safari doesn't crash
1328
- t.save();
1329
- DOM.hide(t.getContainer());
1330
- DOM.setStyle(t.id, 'display', t.orgDisplay);
1331
- },
1332
-
1333
- /**
1334
- * Returns true/false if the editor is hidden or not.
1335
- *
1336
- * @return {bool} True/false if the editor is hidden or not.
1337
- */
1338
- isHidden : function() {
1339
- return !DOM.isHidden(this.id);
1340
- },
1341
-
1342
- /**
1343
- * Sets the progress state, this will display a throbber/progess for the editor.
1344
- * This is ideal for asycronous operations like an AJAX save call.
1345
- *
1346
- * @param {bool} b Boolean state if the progress should be shown or hidden.
1347
- * @param {Number} ti Optional time to wait before the progress gets shown.
1348
- * @param {Object} o Optional object to pass to the progress observers.
1349
- * @return {bool} Same as the input state.
1350
- */
1351
- setProgressState : function(b, ti, o) {
1352
- this.onSetProgressState.dispatch(this, b, ti, o);
1353
-
1354
- return b;
1355
- },
1356
-
1357
- /**
1358
- * Loads contents from the textarea or div element that got converted into an editor instance.
1359
- * This method will move the contents from that textarea or div into the editor by using setContent
1360
- * so all events etc that method has will get dispatched as well.
1361
- *
1362
- * @param {Object} o Optional content object, this gets passed around through the whole load process.
1363
- * @return {String} HTML string that got set into the editor.
1364
- */
1365
- load : function(o) {
1366
- var t = this, e = t.getElement(), h;
1367
-
1368
- if (e) {
1369
- o = o || {};
1370
- o.load = true;
1371
-
1372
- // Double encode existing entities in the value
1373
- h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
1374
- o.element = e;
1375
-
1376
- if (!o.no_events)
1377
- t.onLoadContent.dispatch(t, o);
1378
-
1379
- o.element = e = null;
1380
-
1381
- return h;
1382
- }
1383
- },
1384
-
1385
- /**
1386
- * Saves the contents from a editor out to the textarea or div element that got converted into an editor instance.
1387
- * This method will move the HTML contents from the editor into that textarea or div by getContent
1388
- * so all events etc that method has will get dispatched as well.
1389
- *
1390
- * @param {Object} o Optional content object, this gets passed around through the whole save process.
1391
- * @return {String} HTML string that got set into the textarea/div.
1392
- */
1393
- save : function(o) {
1394
- var t = this, e = t.getElement(), h, f;
1395
-
1396
- if (!e || !t.initialized)
1397
- return;
1398
-
1399
- o = o || {};
1400
- o.save = true;
1401
-
1402
- // Add undo level will trigger onchange event
1403
- if (!o.no_events) {
1404
- t.undoManager.typing = 0;
1405
- t.undoManager.add();
1406
- }
1407
-
1408
- o.element = e;
1409
- h = o.content = t.getContent(o);
1410
-
1411
- if (!o.no_events)
1412
- t.onSaveContent.dispatch(t, o);
1413
-
1414
- h = o.content;
1415
-
1416
- if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {
1417
- e.innerHTML = h;
1418
-
1419
- // Update hidden form element
1420
- if (f = DOM.getParent(t.id, 'form')) {
1421
- each(f.elements, function(e) {
1422
- if (e.name == t.id) {
1423
- e.value = h;
1424
- return false;
1425
- }
1426
- });
1427
- }
1428
- } else
1429
- e.value = h;
1430
-
1431
- o.element = e = null;
1432
-
1433
- return h;
1434
- },
1435
-
1436
- /**
1437
- * Sets the specified content to the editor instance, this will cleanup the content before it gets set using
1438
- * the different cleanup rules options.
1439
- *
1440
- * @param {String} h Content to set to editor, normally HTML contents but can be other formats as well.
1441
- * @param {Object} o Optional content object, this gets passed around through the whole set process.
1442
- * @return {String} HTML string that got set into the editor.
1443
- */
1444
- setContent : function(h, o) {
1445
- var t = this;
1446
-
1447
- o = o || {};
1448
- o.format = o.format || 'html';
1449
- o.set = true;
1450
- o.content = h;
1451
-
1452
- if (!o.no_events)
1453
- t.onBeforeSetContent.dispatch(t, o);
1454
-
1455
- // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
1456
- // It will also be impossible to place the caret in the editor unless there is a BR element present
1457
- if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
1458
- o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />');
1459
- o.format = 'raw';
1460
- }
1461
-
1462
- o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content));
1463
-
1464
- if (o.format != 'raw' && t.settings.cleanup) {
1465
- o.getInner = true;
1466
- o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));
1467
- }
1468
-
1469
- if (!o.no_events)
1470
- t.onSetContent.dispatch(t, o);
1471
-
1472
- return o.content;
1473
- },
1474
-
1475
- /**
1476
- * Gets the content from the editor instance, this will cleanup the content before it gets returned using
1477
- * the different cleanup rules options.
1478
- *
1479
- * @param {Object} o Optional content object, this gets passed around through the whole get process.
1480
- * @return {String} Cleaned content string, normally HTML contents.
1481
- */
1482
- getContent : function(o) {
1483
- var t = this, h;
1484
-
1485
- o = o || {};
1486
- o.format = o.format || 'html';
1487
- o.get = true;
1488
-
1489
- if (!o.no_events)
1490
- t.onBeforeGetContent.dispatch(t, o);
1491
-
1492
- if (o.format != 'raw' && t.settings.cleanup) {
1493
- o.getInner = true;
1494
- h = t.serializer.serialize(t.getBody(), o);
1495
- } else
1496
- h = t.getBody().innerHTML;
1497
-
1498
- h = h.replace(/^\s*|\s*$/g, '');
1499
- o.content = h;
1500
-
1501
- if (!o.no_events)
1502
- t.onGetContent.dispatch(t, o);
1503
-
1504
- return o.content;
1505
- },
1506
-
1507
- /**
1508
- * Returns true/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
1509
- *
1510
- * @return {bool} True/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
1511
- */
1512
- isDirty : function() {
1513
- var t = this;
1514
-
1515
- return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;
1516
- },
1517
-
1518
- /**
1519
- * Returns the editors container element. The container element wrappes in
1520
- * all the elements added to the page for the editor. Such as UI, iframe etc.
1521
- *
1522
- * @return {Element} HTML DOM element for the editor container.
1523
- */
1524
- getContainer : function() {
1525
- var t = this;
1526
-
1527
- if (!t.container)
1528
- t.container = DOM.get(t.editorContainer || t.id + '_parent');
1529
-
1530
- return t.container;
1531
- },
1532
-
1533
- /**
1534
- * Returns the editors content area container element. The this element is the one who
1535
- * holds the iframe or the editable element.
1536
- *
1537
- * @return {Element} HTML DOM element for the editor area container.
1538
- */
1539
- getContentAreaContainer : function() {
1540
- return this.contentAreaContainer;
1541
- },
1542
-
1543
- /**
1544
- * Returns the target element/textarea that got replaced with a TinyMCE editor instance.
1545
- *
1546
- * @return {Element} HTML DOM element for the replaced element.
1547
- */
1548
- getElement : function() {
1549
- return DOM.get(this.settings.content_element || this.id);
1550
- },
1551
-
1552
- /**
1553
- * Returns the iframes window object.
1554
- *
1555
- * @return {Window} Iframe DOM window object.
1556
- */
1557
- getWin : function() {
1558
- var t = this, e;
1559
-
1560
- if (!t.contentWindow) {
1561
- e = DOM.get(t.id + "_ifr");
1562
-
1563
- if (e)
1564
- t.contentWindow = e.contentWindow;
1565
- }
1566
-
1567
- return t.contentWindow;
1568
- },
1569
-
1570
- /**
1571
- * Returns the iframes document object.
1572
- *
1573
- * @return {Document} Iframe DOM document object.
1574
- */
1575
- getDoc : function() {
1576
- var t = this, w;
1577
-
1578
- if (!t.contentDocument) {
1579
- w = t.getWin();
1580
-
1581
- if (w)
1582
- t.contentDocument = w.document;
1583
- }
1584
-
1585
- return t.contentDocument;
1586
- },
1587
-
1588
- /**
1589
- * Returns the iframes body element.
1590
- *
1591
- * @return {Element} Iframe body element.
1592
- */
1593
- getBody : function() {
1594
- return this.bodyElement || this.getDoc().body;
1595
- },
1596
-
1597
- /**
1598
- * URL converter function this gets executed each time a user adds an img, a or
1599
- * any other element that has a URL in it. This will be called both by the DOM and HTML
1600
- * manipulation functions.
1601
- *
1602
- * @param {string} u URL to convert.
1603
- * @param {string} n Attribute name src, href etc.
1604
- * @param {string/HTMLElement} Tag name or HTML DOM element depending on HTML or DOM insert.
1605
- * @return {string} Converted URL string.
1606
- */
1607
- convertURL : function(u, n, e) {
1608
- var t = this, s = t.settings;
1609
-
1610
- // Use callback instead
1611
- if (s.urlconverter_callback)
1612
- return t.execCallback('urlconverter_callback', u, e, true, n);
1613
-
1614
- // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs
1615
- if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0)
1616
- return u;
1617
-
1618
- // Convert to relative
1619
- if (s.relative_urls)
1620
- return t.documentBaseURI.toRelative(u);
1621
-
1622
- // Convert to absolute
1623
- u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);
1624
-
1625
- return u;
1626
- },
1627
-
1628
- /**
1629
- * Adds visual aid for tables, anchors etc so they can be more easily edited inside the editor.
1630
- *
1631
- * @param {Element} e Optional root element to loop though to find tables etc that needs the visual aid.
1632
- */
1633
- addVisual : function(e) {
1634
- var t = this, s = t.settings;
1635
-
1636
- e = e || t.getBody();
1637
-
1638
- if (!is(t.hasVisual))
1639
- t.hasVisual = s.visual;
1640
-
1641
- each(t.dom.select('table,a', e), function(e) {
1642
- var v;
1643
-
1644
- switch (e.nodeName) {
1645
- case 'TABLE':
1646
- v = t.dom.getAttrib(e, 'border');
1647
-
1648
- if (!v || v == '0') {
1649
- if (t.hasVisual)
1650
- t.dom.addClass(e, s.visual_table_class);
1651
- else
1652
- t.dom.removeClass(e, s.visual_table_class);
1653
- }
1654
-
1655
- return;
1656
-
1657
- case 'A':
1658
- v = t.dom.getAttrib(e, 'name');
1659
-
1660
- if (v) {
1661
- if (t.hasVisual)
1662
- t.dom.addClass(e, 'mceItemAnchor');
1663
- else
1664
- t.dom.removeClass(e, 'mceItemAnchor');
1665
- }
1666
-
1667
- return;
1668
- }
1669
- });
1670
-
1671
- t.onVisualAid.dispatch(t, e, t.hasVisual);
1672
- },
1673
-
1674
- /**
1675
- * Removes the editor from the dom and EditorManager collection.
1676
- */
1677
- remove : function() {
1678
- var t = this, e = t.getContainer();
1679
-
1680
- t.removed = 1; // Cancels post remove event execution
1681
- t.hide();
1682
-
1683
- t.execCallback('remove_instance_callback', t);
1684
- t.onRemove.dispatch(t);
1685
-
1686
- // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command
1687
- t.onExecCommand.listeners = [];
1688
-
1689
- EditorManager.remove(t);
1690
- DOM.remove(e);
1691
- },
1692
-
1693
- /**
1694
- * Destroys the editor instance by removing all events, element references or other resources
1695
- * that could leak memory. This method will be called automatically when the page is unloaded
1696
- * but you can also call it directly if you know what you are doing.
1697
- *
1698
- * @param {bool} s Optional state if the destroy is an automatic destroy or user called one.
1699
- */
1700
- destroy : function(s) {
1701
- var t = this;
1702
-
1703
- // One time is enough
1704
- if (t.destroyed)
1705
- return;
1706
-
1707
- if (!s) {
1708
- tinymce.removeUnload(t.destroy);
1709
- tinyMCE.onBeforeUnload.remove(t._beforeUnload);
1710
-
1711
- // Manual destroy
1712
- if (t.theme && t.theme.destroy)
1713
- t.theme.destroy();
1714
-
1715
- // Destroy controls, selection and dom
1716
- t.controlManager.destroy();
1717
- t.selection.destroy();
1718
- t.dom.destroy();
1719
-
1720
- // Remove all events
1721
-
1722
- // Don't clear the window or document if content editable
1723
- // is enabled since other instances might still be present
1724
- if (!t.settings.content_editable) {
1725
- Event.clear(t.getWin());
1726
- Event.clear(t.getDoc());
1727
- }
1728
-
1729
- Event.clear(t.getBody());
1730
- Event.clear(t.formElement);
1731
- }
1732
-
1733
- if (t.formElement) {
1734
- t.formElement.submit = t.formElement._mceOldSubmit;
1735
- t.formElement._mceOldSubmit = null;
1736
- }
1737
-
1738
- t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;
1739
-
1740
- if (t.selection)
1741
- t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
1742
-
1743
- t.destroyed = 1;
1744
- },
1745
-
1746
- // Internal functions
1747
-
1748
- _addEvents : function() {
1749
- // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
1750
- var t = this, i, s = t.settings, lo = {
1751
- mouseup : 'onMouseUp',
1752
- mousedown : 'onMouseDown',
1753
- click : 'onClick',
1754
- keyup : 'onKeyUp',
1755
- keydown : 'onKeyDown',
1756
- keypress : 'onKeyPress',
1757
- submit : 'onSubmit',
1758
- reset : 'onReset',
1759
- contextmenu : 'onContextMenu',
1760
- dblclick : 'onDblClick',
1761
- paste : 'onPaste' // Doesn't work in all browsers yet
1762
- };
1763
-
1764
- function eventHandler(e, o) {
1765
- var ty = e.type;
1766
-
1767
- // Don't fire events when it's removed
1768
- if (t.removed)
1769
- return;
1770
-
1771
- // Generic event handler
1772
- if (t.onEvent.dispatch(t, e, o) !== false) {
1773
- // Specific event handler
1774
- t[lo[e.fakeType || e.type]].dispatch(t, e, o);
1775
- }
1776
- };
1777
-
1778
- // Add DOM events
1779
- each(lo, function(v, k) {
1780
- switch (k) {
1781
- case 'contextmenu':
1782
- if (tinymce.isOpera) {
1783
- // Fake contextmenu on Opera
1784
- t.dom.bind(t.getBody(), 'mousedown', function(e) {
1785
- if (e.ctrlKey) {
1786
- e.fakeType = 'contextmenu';
1787
- eventHandler(e);
1788
- }
1789
- });
1790
- } else
1791
- t.dom.bind(t.getBody(), k, eventHandler);
1792
- break;
1793
-
1794
- case 'paste':
1795
- t.dom.bind(t.getBody(), k, function(e) {
1796
- eventHandler(e);
1797
- });
1798
- break;
1799
-
1800
- case 'submit':
1801
- case 'reset':
1802
- t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
1803
- break;
1804
-
1805
- default:
1806
- t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
1807
- }
1808
- });
1809
-
1810
- t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
1811
- t.focus(true);
1812
- });
1813
-
1814
- // #ifdef contentEditable
1815
-
1816
- if (s.content_editable && tinymce.isOpera) {
1817
- // Opera doesn't support focus event for contentEditable elements so we need to fake it
1818
- function doFocus(e) {
1819
- t.focus(true);
1820
- };
1821
-
1822
- t.dom.bind(t.getBody(), 'click', doFocus);
1823
- t.dom.bind(t.getBody(), 'keydown', doFocus);
1824
- }
1825
-
1826
- // #endif
1827
-
1828
- // Fixes bug where a specified document_base_uri could result in broken images
1829
- // This will also fix drag drop of images in Gecko
1830
- if (tinymce.isGecko) {
1831
- // Convert all images to absolute URLs
1832
- /* t.onSetContent.add(function(ed, o) {
1833
- each(ed.dom.select('img'), function(e) {
1834
- var v;
1835
-
1836
- if (v = e.getAttribute('mce_src'))
1837
- e.src = t.documentBaseURI.toAbsolute(v);
1838
- })
1839
- });*/
1840
-
1841
- t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {
1842
- var v;
1843
-
1844
- e = e.target;
1845
-
1846
- if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src')))
1847
- e.src = t.documentBaseURI.toAbsolute(v);
1848
- });
1849
- }
1850
-
1851
- // Set various midas options in Gecko
1852
- if (isGecko) {
1853
- function setOpts() {
1854
- var t = this, d = t.getDoc(), s = t.settings;
1855
-
1856
- if (isGecko && !s.readonly) {
1857
- if (t._isHidden()) {
1858
- try {
1859
- if (!s.content_editable)
1860
- d.designMode = 'On';
1861
- } catch (ex) {
1862
- // Fails if it's hidden
1863
- }
1864
- }
1865
-
1866
- try {
1867
- // Try new Gecko method
1868
- d.execCommand("styleWithCSS", 0, false);
1869
- } catch (ex) {
1870
- // Use old method
1871
- if (!t._isHidden())
1872
- try {d.execCommand("useCSS", 0, true);} catch (ex) {}
1873
- }
1874
-
1875
- if (!s.table_inline_editing)
1876
- try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
1877
-
1878
- if (!s.object_resizing)
1879
- try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
1880
- }
1881
- };
1882
-
1883
- t.onBeforeExecCommand.add(setOpts);
1884
- t.onMouseDown.add(setOpts);
1885
- }
1886
-
1887
- // Add node change handlers
1888
- t.onMouseUp.add(t.nodeChanged);
1889
- t.onClick.add(t.nodeChanged);
1890
- t.onKeyUp.add(function(ed, e) {
1891
- var c = e.keyCode;
1892
-
1893
- if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)
1894
- t.nodeChanged();
1895
- });
1896
-
1897
- // Add reset handler
1898
- t.onReset.add(function() {
1899
- t.setContent(t.startContent, {format : 'raw'});
1900
- });
1901
-
1902
- // Add shortcuts
1903
- if (s.custom_shortcuts) {
1904
- if (s.custom_undo_redo_keyboard_shortcuts) {
1905
- t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');
1906
- t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');
1907
- }
1908
-
1909
- // Add default shortcuts for gecko
1910
- if (isGecko) {
1911
- t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');
1912
- t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');
1913
- t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');
1914
- }
1915
-
1916
- // BlockFormat shortcuts keys
1917
- for (i=1; i<=6; i++)
1918
- t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']);
1919
-
1920
- t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
1921
- t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
1922
- t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);
1923
-
1924
- function find(e) {
1925
- var v = null;
1926
-
1927
- if (!e.altKey && !e.ctrlKey && !e.metaKey)
1928
- return v;
1929
-
1930
- each(t.shortcuts, function(o) {
1931
- if (tinymce.isMac && o.ctrl != e.metaKey)
1932
- return;
1933
- else if (!tinymce.isMac && o.ctrl != e.ctrlKey)
1934
- return;
1935
-
1936
- if (o.alt != e.altKey)
1937
- return;
1938
-
1939
- if (o.shift != e.shiftKey)
1940
- return;
1941
-
1942
- if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
1943
- v = o;
1944
- return false;
1945
- }
1946
- });
1947
-
1948
- return v;
1949
- };
1950
-
1951
- t.onKeyUp.add(function(ed, e) {
1952
- var o = find(e);
1953
-
1954
- if (o)
1955
- return Event.cancel(e);
1956
- });
1957
-
1958
- t.onKeyPress.add(function(ed, e) {
1959
- var o = find(e);
1960
-
1961
- if (o)
1962
- return Event.cancel(e);
1963
- });
1964
-
1965
- t.onKeyDown.add(function(ed, e) {
1966
- var o = find(e);
1967
-
1968
- if (o) {
1969
- o.func.call(o.scope);
1970
- return Event.cancel(e);
1971
- }
1972
- });
1973
- }
1974
-
1975
- if (tinymce.isIE) {
1976
- // Fix so resize will only update the width and height attributes not the styles of an image
1977
- // It will also block mceItemNoResize items
1978
- t.dom.bind(t.getDoc(), 'controlselect', function(e) {
1979
- var re = t.resizeInfo, cb;
1980
-
1981
- e = e.target;
1982
-
1983
- // Don't do this action for non image elements
1984
- if (e.nodeName !== 'IMG')
1985
- return;
1986
-
1987
- if (re)
1988
- t.dom.unbind(re.node, re.ev, re.cb);
1989
-
1990
- if (!t.dom.hasClass(e, 'mceItemNoResize')) {
1991
- ev = 'resizeend';
1992
- cb = t.dom.bind(e, ev, function(e) {
1993
- var v;
1994
-
1995
- e = e.target;
1996
-
1997
- if (v = t.dom.getStyle(e, 'width')) {
1998
- t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
1999
- t.dom.setStyle(e, 'width', '');
2000
- }
2001
-
2002
- if (v = t.dom.getStyle(e, 'height')) {
2003
- t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
2004
- t.dom.setStyle(e, 'height', '');
2005
- }
2006
- });
2007
- } else {
2008
- ev = 'resizestart';
2009
- cb = t.dom.bind(e, 'resizestart', Event.cancel, Event);
2010
- }
2011
-
2012
- re = t.resizeInfo = {
2013
- node : e,
2014
- ev : ev,
2015
- cb : cb
2016
- };
2017
- });
2018
-
2019
- t.onKeyDown.add(function(ed, e) {
2020
- switch (e.keyCode) {
2021
- case 8:
2022
- // Fix IE control + backspace browser bug
2023
- if (t.selection.getRng().item) {
2024
- t.selection.getRng().item(0).removeNode();
2025
- return Event.cancel(e);
2026
- }
2027
- }
2028
- });
2029
-
2030
- /*if (t.dom.boxModel) {
2031
- t.getBody().style.height = '100%';
2032
-
2033
- Event.add(t.getWin(), 'resize', function(e) {
2034
- var docElm = t.getDoc().documentElement;
2035
-
2036
- docElm.style.height = (docElm.offsetHeight - 10) + 'px';
2037
- });
2038
- }*/
2039
- }
2040
-
2041
- if (tinymce.isOpera) {
2042
- t.onClick.add(function(ed, e) {
2043
- Event.prevent(e);
2044
- });
2045
- }
2046
-
2047
- // Add custom undo/redo handlers
2048
- if (s.custom_undo_redo) {
2049
- function addUndo() {
2050
- t.undoManager.typing = 0;
2051
- t.undoManager.add();
2052
- };
2053
-
2054
- // Add undo level on editor blur
2055
- if (tinymce.isIE) {
2056
- t.dom.bind(t.getWin(), 'blur', function(e) {
2057
- var n;
2058
-
2059
- // Check added for fullscreen bug
2060
- if (t.selection) {
2061
- n = t.selection.getNode();
2062
-
2063
- // Add undo level is selection was lost to another document
2064
- if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc())
2065
- addUndo();
2066
- }
2067
- });
2068
- } else {
2069
- t.dom.bind(t.getDoc(), 'blur', function() {
2070
- if (t.selection && !t.removed)
2071
- addUndo();
2072
- });
2073
- }
2074
-
2075
- t.onMouseDown.add(addUndo);
2076
-
2077
- t.onKeyUp.add(function(ed, e) {
2078
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) {
2079
- t.undoManager.typing = 0;
2080
- t.undoManager.add();
2081
- }
2082
- });
2083
-
2084
- t.onKeyDown.add(function(ed, e) {
2085
- // Is caracter positon keys
2086
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
2087
- if (t.undoManager.typing) {
2088
- t.undoManager.add();
2089
- t.undoManager.typing = 0;
2090
- }
2091
-
2092
- return;
2093
- }
2094
-
2095
- if (!t.undoManager.typing) {
2096
- t.undoManager.add();
2097
- t.undoManager.typing = 1;
2098
- }
2099
- });
2100
- }
2101
- },
2102
-
2103
- _convertInlineElements : function() {
2104
- var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp;
2105
-
2106
- function convert(ed, o) {
2107
- if (!s.inline_styles)
2108
- return;
2109
-
2110
- if (o.get) {
2111
- each(t.dom.select('table,u,strike', o.node), function(n) {
2112
- switch (n.nodeName) {
2113
- case 'TABLE':
2114
- if (v = dom.getAttrib(n, 'height')) {
2115
- dom.setStyle(n, 'height', v);
2116
- dom.setAttrib(n, 'height', '');
2117
- }
2118
- break;
2119
-
2120
- case 'U':
2121
- case 'STRIKE':
2122
- //sp = dom.create('span', {style : dom.getAttrib(n, 'style')});
2123
- n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through';
2124
- dom.setAttrib(n, 'mce_style', '');
2125
- dom.setAttrib(n, 'mce_name', 'span');
2126
- break;
2127
- }
2128
- });
2129
- } else if (o.set) {
2130
- each(t.dom.select('table,span', o.node).reverse(), function(n) {
2131
- if (n.nodeName == 'TABLE') {
2132
- if (v = dom.getStyle(n, 'height'))
2133
- dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, ''));
2134
- } else {
2135
- // Convert spans to elements
2136
- if (n.style.textDecoration == 'underline')
2137
- na = 'u';
2138
- else if (n.style.textDecoration == 'line-through')
2139
- na = 'strike';
2140
- else
2141
- na = '';
2142
-
2143
- if (na) {
2144
- n.style.textDecoration = '';
2145
- dom.setAttrib(n, 'mce_style', '');
2146
-
2147
- e = dom.create(na, {
2148
- style : dom.getAttrib(n, 'style')
2149
- });
2150
-
2151
- dom.replace(e, n, 1);
2152
- }
2153
- }
2154
- });
2155
- }
2156
- };
2157
-
2158
- t.onPreProcess.add(convert);
2159
-
2160
- if (!s.cleanup_on_startup) {
2161
- t.onSetContent.add(function(ed, o) {
2162
- if (o.initial)
2163
- convert(t, {node : t.getBody(), set : 1});
2164
- });
2165
- }
2166
- },
2167
-
2168
- _convertFonts : function() {
2169
- var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl;
2170
-
2171
- // No need
2172
- if (!s.inline_styles)
2173
- return;
2174
-
2175
- // Font pt values and font size names
2176
- fz = [8, 10, 12, 14, 18, 24, 36];
2177
- fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
2178
-
2179
- if (sl = s.font_size_style_values)
2180
- sl = explode(sl);
2181
-
2182
- if (cl = s.font_size_classes)
2183
- cl = explode(cl);
2184
-
2185
- function process(no) {
2186
- var n, sp, nl, x;
2187
-
2188
- // Keep unit tests happy
2189
- if (!s.inline_styles)
2190
- return;
2191
-
2192
- nl = t.dom.select('font', no);
2193
- for (x = nl.length - 1; x >= 0; x--) {
2194
- n = nl[x];
2195
-
2196
- sp = dom.create('span', {
2197
- style : dom.getAttrib(n, 'style'),
2198
- 'class' : dom.getAttrib(n, 'class')
2199
- });
2200
-
2201
- dom.setStyles(sp, {
2202
- fontFamily : dom.getAttrib(n, 'face'),
2203
- color : dom.getAttrib(n, 'color'),
2204
- backgroundColor : n.style.backgroundColor
2205
- });
2206
-
2207
- if (n.size) {
2208
- if (sl)
2209
- dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
2210
- else
2211
- dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
2212
- }
2213
-
2214
- dom.setAttrib(sp, 'mce_style', '');
2215
- dom.replace(sp, n, 1);
2216
- }
2217
- };
2218
-
2219
- // Run on cleanup
2220
- t.onPreProcess.add(function(ed, o) {
2221
- if (o.get)
2222
- process(o.node);
2223
- });
2224
-
2225
- t.onSetContent.add(function(ed, o) {
2226
- if (o.initial)
2227
- process(o.node);
2228
- });
2229
- },
2230
-
2231
- _isHidden : function() {
2232
- var s;
2233
-
2234
- if (!isGecko)
2235
- return 0;
2236
-
2237
- // Weird, wheres that cursor selection?
2238
- s = this.selection.getSel();
2239
- return (!s || !s.rangeCount || s.rangeCount == 0);
2240
- },
2241
-
2242
- // Fix for bug #1867292
2243
- _fixNesting : function(s) {
2244
- var d = [], i;
2245
-
2246
- s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {
2247
- var e;
2248
-
2249
- // Handle end element
2250
- if (b === '/') {
2251
- if (!d.length)
2252
- return '';
2253
-
2254
- if (c !== d[d.length - 1].tag) {
2255
- for (i=d.length - 1; i>=0; i--) {
2256
- if (d[i].tag === c) {
2257
- d[i].close = 1;
2258
- break;
2259
- }
2260
- }
2261
-
2262
- return '';
2263
- } else {
2264
- d.pop();
2265
-
2266
- if (d.length && d[d.length - 1].close) {
2267
- a = a + '</' + d[d.length - 1].tag + '>';
2268
- d.pop();
2269
- }
2270
- }
2271
- } else {
2272
- // Ignore these
2273
- if (/^(br|hr|input|meta|img|link|param)$/i.test(c))
2274
- return a;
2275
-
2276
- // Ignore closed ones
2277
- if (/\/>$/.test(a))
2278
- return a;
2279
-
2280
- d.push({tag : c}); // Push start element
2281
- }
2282
-
2283
- return a;
2284
- });
2285
-
2286
- // End all open tags
2287
- for (i=d.length - 1; i>=0; i--)
2288
- s += '</' + d[i].tag + '>';
2289
-
2290
- return s;
2291
- }
2292
-
2293
- /**#@-*/
2294
- });
2295
- })(tinymce);