gnuside-aloha-rails 0.23.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (826) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +18 -0
  3. data/README.md +48 -0
  4. data/Rakefile +69 -0
  5. data/app/assets/javascripts/aloha.js +3 -0
  6. data/app/assets/javascripts/aloha/preinit.js.erb +1 -0
  7. data/lib/aloha-rails.rb +1 -0
  8. data/lib/aloha/rails.rb +2 -0
  9. data/lib/aloha/rails/engine.rb +9 -0
  10. data/lib/aloha/rails/version.rb +7 -0
  11. data/lib/tasks/aloha-assets.rake +9 -0
  12. data/vendor/assets/javascripts/aloha/css/aloha.scss +31 -0
  13. data/vendor/assets/javascripts/aloha/img/arrow-down.png +0 -0
  14. data/vendor/assets/javascripts/aloha/img/arrow-left.png +0 -0
  15. data/vendor/assets/javascripts/aloha/img/arrow.png +0 -0
  16. data/vendor/assets/javascripts/aloha/img/base-multi.png +0 -0
  17. data/vendor/assets/javascripts/aloha/img/base.png +0 -0
  18. data/vendor/assets/javascripts/aloha/img/bg.png +0 -0
  19. data/vendor/assets/javascripts/aloha/img/breadcrumb-divider.png +0 -0
  20. data/vendor/assets/javascripts/aloha/img/gentics-logo.png +0 -0
  21. data/vendor/assets/javascripts/aloha/img/grabhandle.png +0 -0
  22. data/vendor/assets/javascripts/aloha/img/maximize.png +0 -0
  23. data/vendor/assets/javascripts/aloha/img/multisplit-base.jpg +0 -0
  24. data/vendor/assets/javascripts/aloha/img/multisplit-close.gif +0 -0
  25. data/vendor/assets/javascripts/aloha/img/multisplit-open.gif +0 -0
  26. data/vendor/assets/javascripts/aloha/img/pin.png +0 -0
  27. data/vendor/assets/javascripts/aloha/img/removeformat.png +0 -0
  28. data/vendor/assets/javascripts/aloha/img/text_indent.png +0 -0
  29. data/vendor/assets/javascripts/aloha/img/text_indent_remove.png +0 -0
  30. data/vendor/assets/javascripts/aloha/lib/aloha-jquery-noconflict.js +14 -0
  31. data/vendor/assets/javascripts/aloha/lib/aloha.js +595 -0
  32. data/vendor/assets/javascripts/aloha/lib/aloha/block-jump.js +153 -0
  33. data/vendor/assets/javascripts/aloha/lib/aloha/command.js +287 -0
  34. data/vendor/assets/javascripts/aloha/lib/aloha/console.js +347 -0
  35. data/vendor/assets/javascripts/aloha/lib/aloha/contenthandlermanager.js +104 -0
  36. data/vendor/assets/javascripts/aloha/lib/aloha/copypaste.js +108 -0
  37. data/vendor/assets/javascripts/aloha/lib/aloha/core.js +623 -0
  38. data/vendor/assets/javascripts/aloha/lib/aloha/ecma5shims.js +326 -0
  39. data/vendor/assets/javascripts/aloha/lib/aloha/editable.js +1042 -0
  40. data/vendor/assets/javascripts/aloha/lib/aloha/engine.js +8646 -0
  41. data/vendor/assets/javascripts/aloha/lib/aloha/ephemera.js +492 -0
  42. data/vendor/assets/javascripts/aloha/lib/aloha/ierange-m2.js +29 -0
  43. data/vendor/assets/javascripts/aloha/lib/aloha/jquery.aloha.js +542 -0
  44. data/vendor/assets/javascripts/aloha/lib/aloha/markup.js +1276 -0
  45. data/vendor/assets/javascripts/aloha/lib/aloha/nls/ca/i18n.js +11 -0
  46. data/vendor/assets/javascripts/aloha/lib/aloha/nls/de/i18n.js +11 -0
  47. data/vendor/assets/javascripts/aloha/lib/aloha/nls/i18n.js +20 -0
  48. data/vendor/assets/javascripts/aloha/lib/aloha/nls/mk/i18n.js +11 -0
  49. data/vendor/assets/javascripts/aloha/lib/aloha/nls/pt-br/i18n.js +11 -0
  50. data/vendor/assets/javascripts/aloha/lib/aloha/nls/ru/i18n.js +11 -0
  51. data/vendor/assets/javascripts/aloha/lib/aloha/nls/uk/i18n.js +11 -0
  52. data/vendor/assets/javascripts/aloha/lib/aloha/nls/zh-hans/i18n.js +11 -0
  53. data/vendor/assets/javascripts/aloha/lib/aloha/observable.js +113 -0
  54. data/vendor/assets/javascripts/aloha/lib/aloha/plugin.js +281 -0
  55. data/vendor/assets/javascripts/aloha/lib/aloha/pluginmanager.js +203 -0
  56. data/vendor/assets/javascripts/aloha/lib/aloha/rangy-core.js +30 -0
  57. data/vendor/assets/javascripts/aloha/lib/aloha/registry.js +137 -0
  58. data/vendor/assets/javascripts/aloha/lib/aloha/repository.js +255 -0
  59. data/vendor/assets/javascripts/aloha/lib/aloha/repositorymanager.js +742 -0
  60. data/vendor/assets/javascripts/aloha/lib/aloha/repositoryobjects.js +162 -0
  61. data/vendor/assets/javascripts/aloha/lib/aloha/selection.js +2402 -0
  62. data/vendor/assets/javascripts/aloha/lib/aloha/sidebar.js +1045 -0
  63. data/vendor/assets/javascripts/aloha/lib/aloha/state-override.js +147 -0
  64. data/vendor/assets/javascripts/aloha/lib/css.js +455 -0
  65. data/vendor/assets/javascripts/aloha/lib/i18n.js +192 -0
  66. data/vendor/assets/javascripts/aloha/lib/require.js +2053 -0
  67. data/vendor/assets/javascripts/aloha/lib/text.js +288 -0
  68. data/vendor/assets/javascripts/aloha/lib/util/arrays.js +287 -0
  69. data/vendor/assets/javascripts/aloha/lib/util/boundary-markers.js +86 -0
  70. data/vendor/assets/javascripts/aloha/lib/util/browser.js +32 -0
  71. data/vendor/assets/javascripts/aloha/lib/util/class.js +78 -0
  72. data/vendor/assets/javascripts/aloha/lib/util/dom.js +1888 -0
  73. data/vendor/assets/javascripts/aloha/lib/util/dom2.js +908 -0
  74. data/vendor/assets/javascripts/aloha/lib/util/functions.js +62 -0
  75. data/vendor/assets/javascripts/aloha/lib/util/html.js +311 -0
  76. data/vendor/assets/javascripts/aloha/lib/util/json2.js +464 -0
  77. data/vendor/assets/javascripts/aloha/lib/util/keys.js +65 -0
  78. data/vendor/assets/javascripts/aloha/lib/util/lang.js +89 -0
  79. data/vendor/assets/javascripts/aloha/lib/util/maps.js +130 -0
  80. data/vendor/assets/javascripts/aloha/lib/util/misc.js +51 -0
  81. data/vendor/assets/javascripts/aloha/lib/util/position.js +176 -0
  82. data/vendor/assets/javascripts/aloha/lib/util/range-context.js +776 -0
  83. data/vendor/assets/javascripts/aloha/lib/util/range.js +917 -0
  84. data/vendor/assets/javascripts/aloha/lib/util/strings.js +122 -0
  85. data/vendor/assets/javascripts/aloha/lib/util/trees.js +336 -0
  86. data/vendor/assets/javascripts/aloha/lib/vendor/3rdparty.txt +70 -0
  87. data/vendor/assets/javascripts/aloha/lib/vendor/amplify.store.js +298 -0
  88. data/vendor/assets/javascripts/aloha/lib/vendor/class.js +76 -0
  89. data/vendor/assets/javascripts/aloha/lib/vendor/grid.locale.de.js +138 -0
  90. data/vendor/assets/javascripts/aloha/lib/vendor/grid.locale.en.js +133 -0
  91. data/vendor/assets/javascripts/aloha/lib/vendor/ierange-m2.js +508 -0
  92. data/vendor/assets/javascripts/aloha/lib/vendor/jquery-1.7.2.js +9421 -0
  93. data/vendor/assets/javascripts/aloha/lib/vendor/jquery-ui-1.9.0.custom-aloha.js +14711 -0
  94. data/vendor/assets/javascripts/aloha/lib/vendor/jquery.jqgrid.js +474 -0
  95. data/vendor/assets/javascripts/aloha/lib/vendor/jquery.jstree.js +4549 -0
  96. data/vendor/assets/javascripts/aloha/lib/vendor/jquery.layout-1.3.0-rc30.7.js +5924 -0
  97. data/vendor/assets/javascripts/aloha/lib/vendor/pubsub/js/pubsub-unminified.js +187 -0
  98. data/vendor/assets/javascripts/aloha/lib/vendor/pubsub/js/pubsub.js +2 -0
  99. data/vendor/assets/javascripts/aloha/lib/vendor/rangy-core.js +3295 -0
  100. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/css/jstree.css +88 -0
  101. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/css/repository-browser.css +744 -0
  102. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow-000-medium.png +0 -0
  103. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow-180.png +0 -0
  104. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow-315-medium.png +0 -0
  105. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow-stop-180.png +0 -0
  106. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow-stop.png +0 -0
  107. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/arrow.png +0 -0
  108. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/control-stop-square-small.png +0 -0
  109. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/folder-horizontal-open.png +0 -0
  110. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/folder-open.png +0 -0
  111. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/magnifier-left.png +0 -0
  112. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/page.png +0 -0
  113. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/picture.png +0 -0
  114. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/sort-alphabet-descending.png +0 -0
  115. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/sort-alphabet.png +0 -0
  116. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/img/throbber.gif +0 -0
  117. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/js/repository-browser-unminified.js +1450 -0
  118. data/vendor/assets/javascripts/aloha/lib/vendor/repository-browser/js/repository-browser.js +32 -0
  119. data/vendor/assets/javascripts/aloha/lib/vendor/sanitize.js +278 -0
  120. data/vendor/assets/javascripts/aloha/plugins/common/abbr/css/abbr.css +1 -0
  121. data/vendor/assets/javascripts/aloha/plugins/common/abbr/img/remabbr.png +0 -0
  122. data/vendor/assets/javascripts/aloha/plugins/common/abbr/lib/abbr-plugin.js +304 -0
  123. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/ca/i18n.js +6 -0
  124. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/de/i18n.js +6 -0
  125. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/i18n.js +15 -0
  126. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/mk/i18n.js +6 -0
  127. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/pt-br/i18n.js +6 -0
  128. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/ru/i18n.js +6 -0
  129. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/uk/i18n.js +6 -0
  130. data/vendor/assets/javascripts/aloha/plugins/common/abbr/nls/zh-hans/i18n.js +6 -0
  131. data/vendor/assets/javascripts/aloha/plugins/common/abbr/package.json +1 -0
  132. data/vendor/assets/javascripts/aloha/plugins/common/align/LICENSE +166 -0
  133. data/vendor/assets/javascripts/aloha/plugins/common/align/README +12 -0
  134. data/vendor/assets/javascripts/aloha/plugins/common/align/css/align.css +31 -0
  135. data/vendor/assets/javascripts/aloha/plugins/common/align/img/align.png +0 -0
  136. data/vendor/assets/javascripts/aloha/plugins/common/align/lib/align-plugin.js +465 -0
  137. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/ca/i18n.js +6 -0
  138. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/de/i18n.js +9 -0
  139. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/i18n.js +18 -0
  140. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/mk/i18n.js +6 -0
  141. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/pt-br/i18n.js +6 -0
  142. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/ru/i18n.js +6 -0
  143. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/uk/i18n.js +6 -0
  144. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/zh-hans/i18n.js +6 -0
  145. data/vendor/assets/javascripts/aloha/plugins/common/align/package.json +2 -0
  146. data/vendor/assets/javascripts/aloha/plugins/common/block/README +0 -0
  147. data/vendor/assets/javascripts/aloha/plugins/common/block/css/block.css +110 -0
  148. data/vendor/assets/javascripts/aloha/plugins/common/block/img/toolbar-draghandle.gif +0 -0
  149. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block-plugin.js +347 -0
  150. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block.js +1277 -0
  151. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockcontenthandler.js +118 -0
  152. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockmanager.js +621 -0
  153. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editor.js +331 -0
  154. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editormanager.js +55 -0
  155. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/sidebarattributeeditor.js +126 -0
  156. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/ca/i18n.js +3 -0
  157. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/de/i18n.js +3 -0
  158. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/i18n.js +12 -0
  159. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/mk/i18n.js +3 -0
  160. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/pt-br/i18n.js +3 -0
  161. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/ru/i18n.js +3 -0
  162. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/uk/i18n.js +3 -0
  163. data/vendor/assets/javascripts/aloha/plugins/common/block/nls/zh-hans/i18n.js +3 -0
  164. data/vendor/assets/javascripts/aloha/plugins/common/block/package.json +11 -0
  165. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/css/characterpicker.css +44 -0
  166. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/img/icon.png +0 -0
  167. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/lib/characterpicker-plugin.js +466 -0
  168. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/ca/i18n.js +3 -0
  169. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/de/i18n.js +3 -0
  170. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/i18n.js +12 -0
  171. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/mk/i18n.js +3 -0
  172. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/pt-br/i18n.js +3 -0
  173. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/ru/i18n.js +3 -0
  174. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/uk/i18n.js +3 -0
  175. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/nls/zh-hans/i18n.js +3 -0
  176. data/vendor/assets/javascripts/aloha/plugins/common/commands/css/abbr.css +0 -0
  177. data/vendor/assets/javascripts/aloha/plugins/common/commands/lib/commands-plugin.js +33 -0
  178. data/vendor/assets/javascripts/aloha/plugins/common/commands/lib/inserthtml.js +126 -0
  179. data/vendor/assets/javascripts/aloha/plugins/common/commands/package.json +1 -0
  180. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/README.md +0 -0
  181. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/blockelementcontenthandler.js +144 -0
  182. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/contenthandler-plugin.js +65 -0
  183. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/contenthandler-utils.js +58 -0
  184. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/genericcontenthandler.js +359 -0
  185. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/oembedcontenthandler.js +461 -0
  186. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/sanitizecontenthandler.js +186 -0
  187. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/wordcontenthandler.js +461 -0
  188. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/package.json +1 -0
  189. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml-plugin.js +74 -0
  190. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml.js +415 -0
  191. data/vendor/assets/javascripts/aloha/plugins/common/format/img/em.png +0 -0
  192. data/vendor/assets/javascripts/aloha/plugins/common/format/img/strong.png +0 -0
  193. data/vendor/assets/javascripts/aloha/plugins/common/format/lib/format-plugin.js +594 -0
  194. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/ca/i18n.js +52 -0
  195. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/de/i18n.js +52 -0
  196. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/i18n.js +61 -0
  197. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/mk/i18n.js +52 -0
  198. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/pt-br/i18n.js +52 -0
  199. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/ru/i18n.js +52 -0
  200. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/uk/i18n.js +52 -0
  201. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/zh-hans/i18n.js +52 -0
  202. data/vendor/assets/javascripts/aloha/plugins/common/highlighteditables/css/highlighteditables.css +14 -0
  203. data/vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js +100 -0
  204. data/vendor/assets/javascripts/aloha/plugins/common/highlighteditables/package.json +1 -0
  205. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/css/horizontalruler.css +3 -0
  206. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/img/icon.png +0 -0
  207. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/lib/horizontalruler-plugin.js +95 -0
  208. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/ca/i18n.js +3 -0
  209. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/de/i18n.js +3 -0
  210. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/i18n.js +12 -0
  211. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/mk/i18n.js +3 -0
  212. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/pt-br/i18n.js +3 -0
  213. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/ru/i18n.js +3 -0
  214. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/uk/i18n.js +3 -0
  215. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/nls/zh-hans/i18n.js +3 -0
  216. data/vendor/assets/javascripts/aloha/plugins/common/image/README.md +66 -0
  217. data/vendor/assets/javascripts/aloha/plugins/common/image/css/image.css +133 -0
  218. data/vendor/assets/javascripts/aloha/plugins/common/image/img/blank.jpg +0 -0
  219. data/vendor/assets/javascripts/aloha/plugins/common/image/img/crop-buttons.gif +0 -0
  220. data/vendor/assets/javascripts/aloha/plugins/common/image/img/cropnresize.png +0 -0
  221. data/vendor/assets/javascripts/aloha/plugins/common/image/img/handle-sw.png +0 -0
  222. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image-align-left.png +0 -0
  223. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image-align-none.png +0 -0
  224. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image-align-right.png +0 -0
  225. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image-border.png +0 -0
  226. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image-title.png +0 -0
  227. data/vendor/assets/javascripts/aloha/plugins/common/image/img/image.gif +0 -0
  228. data/vendor/assets/javascripts/aloha/plugins/common/image/img/padding-decrease.gif +0 -0
  229. data/vendor/assets/javascripts/aloha/plugins/common/image/img/padding-increase.gif +0 -0
  230. data/vendor/assets/javascripts/aloha/plugins/common/image/img/page.png +0 -0
  231. data/vendor/assets/javascripts/aloha/plugins/common/image/img/size-decrease.gif +0 -0
  232. data/vendor/assets/javascripts/aloha/plugins/common/image/img/size-increase.gif +0 -0
  233. data/vendor/assets/javascripts/aloha/plugins/common/image/lib/image-floatingMenu.js +308 -0
  234. data/vendor/assets/javascripts/aloha/plugins/common/image/lib/image-plugin-actions.js +0 -0
  235. data/vendor/assets/javascripts/aloha/plugins/common/image/lib/image-plugin.js +1341 -0
  236. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/ca/i18n.js +32 -0
  237. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/de/i18n.js +32 -0
  238. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/i18n.js +41 -0
  239. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/mk/i18n.js +32 -0
  240. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/pt-br/i18n.js +32 -0
  241. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/ru/i18n.js +32 -0
  242. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/uk/i18n.js +32 -0
  243. data/vendor/assets/javascripts/aloha/plugins/common/image/nls/zh-hans/i18n.js +32 -0
  244. data/vendor/assets/javascripts/aloha/plugins/common/image/package.json +1 -0
  245. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/jcrop/jcrop.gif +0 -0
  246. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/jcrop/jquery.jcrop.css +46 -0
  247. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/jcrop/jquery.jcrop.min.js +165 -0
  248. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/mousewheel/mousewheel.js +85 -0
  249. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  250. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  251. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  252. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  253. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  254. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  255. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  256. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  257. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  258. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  259. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  260. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  261. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  262. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/ui/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  263. data/vendor/assets/javascripts/aloha/plugins/common/link/css/link.css +52 -0
  264. data/vendor/assets/javascripts/aloha/plugins/common/link/extra/delicious.js +264 -0
  265. data/vendor/assets/javascripts/aloha/plugins/common/link/extra/linklist.js +247 -0
  266. data/vendor/assets/javascripts/aloha/plugins/common/link/extra/slowlinklist.js +247 -0
  267. data/vendor/assets/javascripts/aloha/plugins/common/link/lib/link-plugin.js +958 -0
  268. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/ca/i18n.js +14 -0
  269. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/de/i18n.js +14 -0
  270. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/i18n.js +23 -0
  271. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/mk/i18n.js +14 -0
  272. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/pt-br/i18n.js +14 -0
  273. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/ru/i18n.js +14 -0
  274. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/uk/i18n.js +14 -0
  275. data/vendor/assets/javascripts/aloha/plugins/common/link/nls/zh-hans/i18n.js +14 -0
  276. data/vendor/assets/javascripts/aloha/plugins/common/list/lib/list-plugin.js +878 -0
  277. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/ca/i18n.js +7 -0
  278. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/de/i18n.js +7 -0
  279. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/i18n.js +16 -0
  280. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/mk/i18n.js +7 -0
  281. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/pt-br/i18n.js +7 -0
  282. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/ru/i18n.js +7 -0
  283. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/uk/i18n.js +7 -0
  284. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/zh-hans/i18n.js +7 -0
  285. data/vendor/assets/javascripts/aloha/plugins/common/list/package.json +1 -0
  286. data/vendor/assets/javascripts/aloha/plugins/common/paste/lib/paste-plugin.js +457 -0
  287. data/vendor/assets/javascripts/aloha/plugins/common/paste/package.json +8 -0
  288. data/vendor/assets/javascripts/aloha/plugins/common/table/css/table.css +125 -0
  289. data/vendor/assets/javascripts/aloha/plugins/common/table/img/down.cur +0 -0
  290. data/vendor/assets/javascripts/aloha/plugins/common/table/img/left.cur +0 -0
  291. data/vendor/assets/javascripts/aloha/plugins/common/table/img/table_layout.png +0 -0
  292. data/vendor/assets/javascripts/aloha/plugins/common/table/img/wai-green.png +0 -0
  293. data/vendor/assets/javascripts/aloha/plugins/common/table/img/wai-red.png +0 -0
  294. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-cell.js +542 -0
  295. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-create-layer.js +213 -0
  296. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-plugin-utils.js +494 -0
  297. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-plugin.js +1596 -0
  298. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-selection.js +468 -0
  299. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table.js +2110 -0
  300. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/ca/i18n.js +28 -0
  301. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/de/i18n.js +29 -0
  302. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/i18n.js +38 -0
  303. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/mk/i18n.js +28 -0
  304. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/pt-br/i18n.js +28 -0
  305. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/ru/i18n.js +28 -0
  306. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/uk/i18n.js +28 -0
  307. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/zh-hans/i18n.js +28 -0
  308. data/vendor/assets/javascripts/aloha/plugins/common/table/package.json +1 -0
  309. data/vendor/assets/javascripts/aloha/plugins/common/ui/css/jquery-ui-1.9m6.css +430 -0
  310. data/vendor/assets/javascripts/aloha/plugins/common/ui/css/ui.css +689 -0
  311. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/blockquote.png +0 -0
  312. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/character-picker.png +0 -0
  313. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/em.png +0 -0
  314. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/format-block.png +0 -0
  315. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/format-inline.png +0 -0
  316. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/indent.png +0 -0
  317. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/jqueryui/ui-icons_222222_256x240.png +0 -0
  318. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/justify.png +0 -0
  319. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/language-annotation.png +0 -0
  320. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview.png +0 -0
  321. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/anchor.png +0 -0
  322. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/blockquote.png +0 -0
  323. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/caption.png +0 -0
  324. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/cite.png +0 -0
  325. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/dd.png +0 -0
  326. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/div.png +0 -0
  327. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/dl.png +0 -0
  328. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/dt.png +0 -0
  329. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h1.png +0 -0
  330. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h2.png +0 -0
  331. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h3.png +0 -0
  332. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h4.png +0 -0
  333. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h5.png +0 -0
  334. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/h6.png +0 -0
  335. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/p.png +0 -0
  336. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/pre.png +0 -0
  337. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/q.png +0 -0
  338. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/table.png +0 -0
  339. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/td.png +0 -0
  340. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/metaview/th.png +0 -0
  341. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/multisplit-close.gif +0 -0
  342. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/multisplit-open.gif +0 -0
  343. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/outdent.png +0 -0
  344. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/quote.png +0 -0
  345. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/removeformat.png +0 -0
  346. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/strong.png +0 -0
  347. data/vendor/assets/javascripts/aloha/plugins/common/ui/img/tree.png +0 -0
  348. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/arena.js +11 -0
  349. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/autocomplete.js +70 -0
  350. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/button.js +114 -0
  351. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/component.js +121 -0
  352. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/container.js +210 -0
  353. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/context.js +53 -0
  354. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/dialog.js +215 -0
  355. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/floating.js +405 -0
  356. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/menuButton.js +169 -0
  357. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/multiSplit.js +237 -0
  358. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/port-helper-attribute-field.js +440 -0
  359. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/port-helper-multi-split.js +71 -0
  360. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/scopes.js +187 -0
  361. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/settings.js +202 -0
  362. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/subguarded.js +183 -0
  363. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/surface.js +106 -0
  364. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/tab.js +316 -0
  365. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/text.js +33 -0
  366. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/toggleButton.js +57 -0
  367. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/toolbar.js +251 -0
  368. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/ui-plugin.js +169 -0
  369. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/ui.js +181 -0
  370. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/utils.js +104 -0
  371. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/ca/i18n.js +46 -0
  372. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/de/i18n.js +48 -0
  373. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/i18n.js +75 -0
  374. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/mk/i18n.js +46 -0
  375. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/pt-br/i18n.js +46 -0
  376. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/ru/i18n.js +46 -0
  377. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/uk/i18n.js +46 -0
  378. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/zh-hans/i18n.js +46 -0
  379. data/vendor/assets/javascripts/aloha/plugins/common/ui/vendor/jquery-ui-autocomplete-html.js +42 -0
  380. data/vendor/assets/javascripts/aloha/plugins/common/undo/lib/undo-plugin.js +165 -0
  381. data/vendor/assets/javascripts/aloha/plugins/common/undo/package.json +7 -0
  382. data/vendor/assets/javascripts/aloha/plugins/common/undo/vendor/diff_match_patch_uncompressed.js +2155 -0
  383. data/vendor/assets/javascripts/aloha/plugins/common/undo/vendor/undo.js +121 -0
  384. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/README +0 -0
  385. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/css/attributes.css +12 -0
  386. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/lib/attributes-plugin.js +237 -0
  387. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/ca/i18n.js +5 -0
  388. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/de/i18n.js +5 -0
  389. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/i18n.js +14 -0
  390. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/mk/i18n.js +5 -0
  391. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/pt-br/i18n.js +5 -0
  392. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/ru/i18n.js +5 -0
  393. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/uk/i18n.js +5 -0
  394. data/vendor/assets/javascripts/aloha/plugins/extra/attributes/nls/zh-hans/i18n.js +5 -0
  395. data/vendor/assets/javascripts/aloha/plugins/extra/captioned-image/css/captioned-image.css +15 -0
  396. data/vendor/assets/javascripts/aloha/plugins/extra/captioned-image/lib/captioned-image-plugin.js +555 -0
  397. data/vendor/assets/javascripts/aloha/plugins/extra/cite/README +0 -0
  398. data/vendor/assets/javascripts/aloha/plugins/extra/cite/css/cite.css +39 -0
  399. data/vendor/assets/javascripts/aloha/plugins/extra/cite/img/blockquote.png +0 -0
  400. data/vendor/assets/javascripts/aloha/plugins/extra/cite/img/icon_cite.png +0 -0
  401. data/vendor/assets/javascripts/aloha/plugins/extra/cite/lib/cite-plugin.js +614 -0
  402. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/ca/i18n.js +4 -0
  403. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/de/i18n.js +4 -0
  404. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/i18n.js +13 -0
  405. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/mk/i18n.js +4 -0
  406. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/pt-br/i18n.js +4 -0
  407. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/ru/i18n.js +4 -0
  408. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/uk/i18n.js +4 -0
  409. data/vendor/assets/javascripts/aloha/plugins/extra/cite/nls/zh-hans/i18n.js +4 -0
  410. data/vendor/assets/javascripts/aloha/plugins/extra/cite/package.json +1 -0
  411. data/vendor/assets/javascripts/aloha/plugins/extra/comments/img/add-icon.png +0 -0
  412. data/vendor/assets/javascripts/aloha/plugins/extra/comments/img/add.png +0 -0
  413. data/vendor/assets/javascripts/aloha/plugins/extra/comments/img/comments.png +0 -0
  414. data/vendor/assets/javascripts/aloha/plugins/extra/comments/img/hr.png +0 -0
  415. data/vendor/assets/javascripts/aloha/plugins/extra/comments/img/textbox.png +0 -0
  416. data/vendor/assets/javascripts/aloha/plugins/extra/comments/lib/comments-plugin.js +692 -0
  417. data/vendor/assets/javascripts/aloha/plugins/extra/comments/lib/comments.css +442 -0
  418. data/vendor/assets/javascripts/aloha/plugins/extra/comments/package.json +1 -0
  419. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/README.md +5 -0
  420. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/TODO.md +2 -0
  421. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/img/cross.png +0 -0
  422. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/img/hourglass.png +0 -0
  423. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/img/loading.gif +0 -0
  424. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/img/page.png +0 -0
  425. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/img/tick.png +0 -0
  426. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/lib/draganddropfiles-plugin.js +4 -0
  427. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/lib/dragndropfiles.css +110 -0
  428. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/lib/dragndropfiles.js +363 -0
  429. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/lib/dropfilesrepository.js +365 -0
  430. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/ca/i18n.js +3 -0
  431. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/de/i18n.js +3 -0
  432. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/i18n.js +12 -0
  433. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/mk/i18n.js +3 -0
  434. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/pt-br/i18n.js +3 -0
  435. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/ru/i18n.js +3 -0
  436. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/uk/i18n.js +3 -0
  437. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/nls/zh-hans/i18n.js +3 -0
  438. data/vendor/assets/javascripts/aloha/plugins/extra/draganddropfiles/package.json +1 -0
  439. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/README.md +1 -0
  440. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/css/formatless.css +7 -0
  441. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/img/button.png +0 -0
  442. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/lib/formatlesshandler.js +97 -0
  443. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/lib/formatlesspaste-plugin.js +230 -0
  444. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/ca/i18n.js +3 -0
  445. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/de/i18n.js +3 -0
  446. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/i18n.js +12 -0
  447. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/mk/i18n.js +3 -0
  448. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/pt-br/i18n.js +3 -0
  449. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/ru/i18n.js +3 -0
  450. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/uk/i18n.js +3 -0
  451. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/nls/zh-hans/i18n.js +3 -0
  452. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/package.json +8 -0
  453. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/README +0 -0
  454. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/css/headerids.css +8 -0
  455. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/lib/headerids-plugin.js +254 -0
  456. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/ca/i18n.js +6 -0
  457. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/de/i18n.js +6 -0
  458. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/i18n.js +15 -0
  459. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/mk/i18n.js +6 -0
  460. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/pt-br/i18n.js +6 -0
  461. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/ru/i18n.js +6 -0
  462. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/uk/i18n.js +6 -0
  463. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/nls/zh-hans/i18n.js +6 -0
  464. data/vendor/assets/javascripts/aloha/plugins/extra/hints/README.md +12 -0
  465. data/vendor/assets/javascripts/aloha/plugins/extra/hints/css/hints.css +29 -0
  466. data/vendor/assets/javascripts/aloha/plugins/extra/hints/lib/hints-plugin.js +97 -0
  467. data/vendor/assets/javascripts/aloha/plugins/extra/hints/package.json +9 -0
  468. data/vendor/assets/javascripts/aloha/plugins/extra/hints/vendor/tipsy.js +242 -0
  469. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/README +0 -0
  470. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/lib/imagebrowser-plugin.js +160 -0
  471. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/ca/i18n.js +6 -0
  472. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/de/i18n.js +6 -0
  473. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/i18n.js +15 -0
  474. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/mk/i18n.js +6 -0
  475. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/pt-br/i18n.js +6 -0
  476. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/ru/i18n.js +6 -0
  477. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/uk/i18n.js +6 -0
  478. data/vendor/assets/javascripts/aloha/plugins/extra/imagebrowser/nls/zh-hans/i18n.js +6 -0
  479. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/README +0 -0
  480. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ad.png +0 -0
  481. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ae.png +0 -0
  482. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/af.png +0 -0
  483. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ag.png +0 -0
  484. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ai.png +0 -0
  485. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/al.png +0 -0
  486. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/am.png +0 -0
  487. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/an.png +0 -0
  488. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ao.png +0 -0
  489. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ar.png +0 -0
  490. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/as.png +0 -0
  491. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/at.png +0 -0
  492. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/au.png +0 -0
  493. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/aw.png +0 -0
  494. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ax.png +0 -0
  495. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/az.png +0 -0
  496. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ba.png +0 -0
  497. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bb.png +0 -0
  498. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bd.png +0 -0
  499. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/be.png +0 -0
  500. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bf.png +0 -0
  501. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bg.png +0 -0
  502. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bh.png +0 -0
  503. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bi.png +0 -0
  504. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bj.png +0 -0
  505. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bm.png +0 -0
  506. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bn.png +0 -0
  507. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bo.png +0 -0
  508. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/br.png +0 -0
  509. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bs.png +0 -0
  510. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bt.png +0 -0
  511. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bv.png +0 -0
  512. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bw.png +0 -0
  513. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/by.png +0 -0
  514. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/bz.png +0 -0
  515. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ca.png +0 -0
  516. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/catalonia.png +0 -0
  517. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cc.png +0 -0
  518. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cd.png +0 -0
  519. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cf.png +0 -0
  520. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cg.png +0 -0
  521. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ch.png +0 -0
  522. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ci.png +0 -0
  523. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ck.png +0 -0
  524. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cl.png +0 -0
  525. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cm.png +0 -0
  526. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cn.png +0 -0
  527. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/co.png +0 -0
  528. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cr.png +0 -0
  529. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cs.png +0 -0
  530. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cu.png +0 -0
  531. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cv.png +0 -0
  532. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cx.png +0 -0
  533. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cy.png +0 -0
  534. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/cz.png +0 -0
  535. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/de.png +0 -0
  536. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/dj.png +0 -0
  537. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/dk.png +0 -0
  538. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/dm.png +0 -0
  539. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/do.png +0 -0
  540. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/dz.png +0 -0
  541. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ec.png +0 -0
  542. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ee.png +0 -0
  543. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/eg.png +0 -0
  544. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/eh.png +0 -0
  545. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/en.png +0 -0
  546. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/er.png +0 -0
  547. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/es.png +0 -0
  548. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/et.png +0 -0
  549. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/europeanunion.png +0 -0
  550. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fam.png +0 -0
  551. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fi.png +0 -0
  552. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fj.png +0 -0
  553. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fk.png +0 -0
  554. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fm.png +0 -0
  555. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fo.png +0 -0
  556. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/fr.png +0 -0
  557. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ga.png +0 -0
  558. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gb.png +0 -0
  559. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gd.png +0 -0
  560. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ge.png +0 -0
  561. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gf.png +0 -0
  562. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gh.png +0 -0
  563. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gi.png +0 -0
  564. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gl.png +0 -0
  565. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gm.png +0 -0
  566. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gn.png +0 -0
  567. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gp.png +0 -0
  568. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gq.png +0 -0
  569. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gr.png +0 -0
  570. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gs.png +0 -0
  571. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gt.png +0 -0
  572. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gu.png +0 -0
  573. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gw.png +0 -0
  574. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/gy.png +0 -0
  575. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/hk.png +0 -0
  576. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/hm.png +0 -0
  577. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/hn.png +0 -0
  578. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/hr.png +0 -0
  579. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ht.png +0 -0
  580. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/hu.png +0 -0
  581. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/id.png +0 -0
  582. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ie.png +0 -0
  583. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/il.png +0 -0
  584. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/in.png +0 -0
  585. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/io.png +0 -0
  586. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/iq.png +0 -0
  587. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ir.png +0 -0
  588. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/is.png +0 -0
  589. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/it.png +0 -0
  590. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/jm.png +0 -0
  591. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/jo.png +0 -0
  592. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/jp.png +0 -0
  593. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ke.png +0 -0
  594. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kg.png +0 -0
  595. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kh.png +0 -0
  596. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ki.png +0 -0
  597. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/km.png +0 -0
  598. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kn.png +0 -0
  599. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kp.png +0 -0
  600. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kr.png +0 -0
  601. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kw.png +0 -0
  602. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ky.png +0 -0
  603. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/kz.png +0 -0
  604. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/la.png +0 -0
  605. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lb.png +0 -0
  606. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lc.png +0 -0
  607. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/li.png +0 -0
  608. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lk.png +0 -0
  609. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lr.png +0 -0
  610. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ls.png +0 -0
  611. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lt.png +0 -0
  612. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lu.png +0 -0
  613. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/lv.png +0 -0
  614. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ly.png +0 -0
  615. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ma.png +0 -0
  616. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mc.png +0 -0
  617. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/md.png +0 -0
  618. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/me.png +0 -0
  619. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mg.png +0 -0
  620. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mh.png +0 -0
  621. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mk.png +0 -0
  622. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ml.png +0 -0
  623. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mm.png +0 -0
  624. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mn.png +0 -0
  625. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mo.png +0 -0
  626. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mp.png +0 -0
  627. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mq.png +0 -0
  628. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mr.png +0 -0
  629. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ms.png +0 -0
  630. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mt.png +0 -0
  631. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mu.png +0 -0
  632. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mv.png +0 -0
  633. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mw.png +0 -0
  634. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mx.png +0 -0
  635. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/my.png +0 -0
  636. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/mz.png +0 -0
  637. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/na.png +0 -0
  638. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nc.png +0 -0
  639. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ne.png +0 -0
  640. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nf.png +0 -0
  641. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ng.png +0 -0
  642. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ni.png +0 -0
  643. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nl.png +0 -0
  644. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/no.png +0 -0
  645. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/np.png +0 -0
  646. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nr.png +0 -0
  647. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nu.png +0 -0
  648. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/nz.png +0 -0
  649. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/om.png +0 -0
  650. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pa.png +0 -0
  651. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pe.png +0 -0
  652. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pf.png +0 -0
  653. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pg.png +0 -0
  654. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ph.png +0 -0
  655. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pk.png +0 -0
  656. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pl.png +0 -0
  657. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pm.png +0 -0
  658. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pn.png +0 -0
  659. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pr.png +0 -0
  660. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ps.png +0 -0
  661. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pt.png +0 -0
  662. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/pw.png +0 -0
  663. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/py.png +0 -0
  664. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/qa.png +0 -0
  665. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/re.png +0 -0
  666. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ro.png +0 -0
  667. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/rs.png +0 -0
  668. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ru.png +0 -0
  669. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/rw.png +0 -0
  670. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sa.png +0 -0
  671. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sb.png +0 -0
  672. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sc.png +0 -0
  673. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/scotland.png +0 -0
  674. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sd.png +0 -0
  675. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/se.png +0 -0
  676. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sg.png +0 -0
  677. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sh.png +0 -0
  678. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/si.png +0 -0
  679. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sj.png +0 -0
  680. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sk.png +0 -0
  681. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sl.png +0 -0
  682. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sm.png +0 -0
  683. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sn.png +0 -0
  684. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/so.png +0 -0
  685. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sr.png +0 -0
  686. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/st.png +0 -0
  687. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sv.png +0 -0
  688. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sy.png +0 -0
  689. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/sz.png +0 -0
  690. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tc.png +0 -0
  691. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/td.png +0 -0
  692. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tf.png +0 -0
  693. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tg.png +0 -0
  694. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/th.png +0 -0
  695. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tj.png +0 -0
  696. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tk.png +0 -0
  697. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tl.png +0 -0
  698. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tm.png +0 -0
  699. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tn.png +0 -0
  700. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/to.png +0 -0
  701. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tr.png +0 -0
  702. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tt.png +0 -0
  703. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tv.png +0 -0
  704. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tw.png +0 -0
  705. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/tz.png +0 -0
  706. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ua.png +0 -0
  707. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ug.png +0 -0
  708. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/um.png +0 -0
  709. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/us.png +0 -0
  710. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/uy.png +0 -0
  711. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/uz.png +0 -0
  712. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/va.png +0 -0
  713. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/vc.png +0 -0
  714. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ve.png +0 -0
  715. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/vg.png +0 -0
  716. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/vi.png +0 -0
  717. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/vn.png +0 -0
  718. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/vu.png +0 -0
  719. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/wales.png +0 -0
  720. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/wf.png +0 -0
  721. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ws.png +0 -0
  722. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/ye.png +0 -0
  723. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/yt.png +0 -0
  724. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/za.png +0 -0
  725. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/zm.png +0 -0
  726. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/img/flags/zw.png +0 -0
  727. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/lib/linkbrowser-plugin.js +161 -0
  728. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/ca/i18n.js +6 -0
  729. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/de/i18n.js +6 -0
  730. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/i18n.js +15 -0
  731. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/mk/i18n.js +6 -0
  732. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/pt-br/i18n.js +6 -0
  733. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/ru/i18n.js +6 -0
  734. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/uk/i18n.js +6 -0
  735. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/nls/zh-hans/i18n.js +6 -0
  736. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/ca/i18n.js +28 -0
  737. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/de/i18n.js +28 -0
  738. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/i18n.js +37 -0
  739. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/mk/i18n.js +28 -0
  740. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/pt-br/i18n.js +28 -0
  741. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/ru/i18n.js +28 -0
  742. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/uk/i18n.js +28 -0
  743. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/nls/zh-hans/i18n.js +28 -0
  744. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/package.json +1 -0
  745. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/proxy.php.example +244 -0
  746. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/src/linkchecker.css +14 -0
  747. data/vendor/assets/javascripts/aloha/plugins/extra/linkchecker/src/linkchecker.js +269 -0
  748. data/vendor/assets/javascripts/aloha/plugins/extra/listenforcer/lib/listenforcer-plugin.js +190 -0
  749. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/README +0 -0
  750. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/css/metaview.css +78 -0
  751. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/anchor.png +0 -0
  752. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/blockquote.png +0 -0
  753. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/button.png +0 -0
  754. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/caption.png +0 -0
  755. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/cite.png +0 -0
  756. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/dd.png +0 -0
  757. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/div.png +0 -0
  758. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/dl.png +0 -0
  759. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/dt.png +0 -0
  760. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h1.png +0 -0
  761. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h2.png +0 -0
  762. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h3.png +0 -0
  763. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h4.png +0 -0
  764. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h5.png +0 -0
  765. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/h6.png +0 -0
  766. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/hr.png +0 -0
  767. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/icon_cite.png +0 -0
  768. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/p.png +0 -0
  769. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/pre.png +0 -0
  770. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/table.png +0 -0
  771. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/td.png +0 -0
  772. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/img/th.png +0 -0
  773. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/lib/metaview-plugin.js +185 -0
  774. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/ca/i18n.js +3 -0
  775. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/de/i18n.js +3 -0
  776. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/i18n.js +12 -0
  777. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/mk/i18n.js +3 -0
  778. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/pt-br/i18n.js +3 -0
  779. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/ru/i18n.js +3 -0
  780. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/uk/i18n.js +3 -0
  781. data/vendor/assets/javascripts/aloha/plugins/extra/metaview/nls/zh-hans/i18n.js +3 -0
  782. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/README +0 -0
  783. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/css/numerated-headers.css +7 -0
  784. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/img/headers.png +0 -0
  785. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/lib/numerated-headers-plugin.js +421 -0
  786. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/ca/i18n.js +5 -0
  787. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/de/i18n.js +6 -0
  788. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/i18n.js +15 -0
  789. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/mk/i18n.js +5 -0
  790. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/pt-br/i18n.js +5 -0
  791. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/ru/i18n.js +5 -0
  792. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/uk/i18n.js +5 -0
  793. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/zh-hans/i18n.js +5 -0
  794. data/vendor/assets/javascripts/aloha/plugins/extra/profiler/css/profiler.css +34 -0
  795. data/vendor/assets/javascripts/aloha/plugins/extra/profiler/lib/profiler-plugin.js +304 -0
  796. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/README.md +8 -0
  797. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/css/ribbon.css +54 -0
  798. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/img/fade-in.png +0 -0
  799. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/img/fade-out.png +0 -0
  800. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/lib/ribbon-plugin.js +144 -0
  801. data/vendor/assets/javascripts/aloha/plugins/extra/ribbon/package.json +1 -0
  802. data/vendor/assets/javascripts/aloha/plugins/extra/sourceview/css/sourceview.css +18 -0
  803. data/vendor/assets/javascripts/aloha/plugins/extra/sourceview/lib/sourceview-plugin.js +252 -0
  804. data/vendor/assets/javascripts/aloha/plugins/extra/sourceview/vendor/htmlbeautifier.js +468 -0
  805. data/vendor/assets/javascripts/aloha/plugins/extra/textcolor/css/textcolor.css +65 -0
  806. data/vendor/assets/javascripts/aloha/plugins/extra/textcolor/img/icon.png +0 -0
  807. data/vendor/assets/javascripts/aloha/plugins/extra/textcolor/lib/textcolor-plugin.js +420 -0
  808. data/vendor/assets/javascripts/aloha/plugins/extra/textcolor/nls/de/i18n.js +3 -0
  809. data/vendor/assets/javascripts/aloha/plugins/extra/textcolor/nls/i18n.js +6 -0
  810. data/vendor/assets/javascripts/aloha/plugins/extra/toc/lib/toc-plugin.js +399 -0
  811. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/ca/i18n.js +3 -0
  812. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/de/i18n.js +3 -0
  813. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/i18n.js +12 -0
  814. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/mk/i18n.js +3 -0
  815. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/pt-br/i18n.js +3 -0
  816. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/ru/i18n.js +3 -0
  817. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/uk/i18n.js +3 -0
  818. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/zh-hans/i18n.js +3 -0
  819. data/vendor/assets/javascripts/aloha/plugins/extra/toc/package.json +1 -0
  820. data/vendor/assets/javascripts/aloha/plugins/extra/validation/lib/validation-plugin.js +277 -0
  821. data/vendor/assets/stylesheets/aloha-common-extra.css +24 -0
  822. data/vendor/assets/stylesheets/aloha-core.css +19 -0
  823. data/vendor/assets/stylesheets/aloha-reset.css +24 -0
  824. data/vendor/assets/stylesheets/aloha-sidebar.css +296 -0
  825. data/vendor/assets/stylesheets/aloha.css +31 -0
  826. metadata +898 -0
@@ -0,0 +1,162 @@
1
+ /* repositoryobjects.js is part of Aloha Editor project http://aloha-editor.org
2
+ *
3
+ * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
4
+ * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
5
+ * Contributors http://aloha-editor.org/contribution.php
6
+ *
7
+ * Aloha Editor is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or any later version.
11
+ *
12
+ * Aloha Editor is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
+ *
21
+ * As an additional permission to the GNU GPL version 2, you may distribute
22
+ * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
23
+ * source code without the copy of the GNU GPL normally required,
24
+ * provided you include this license notice and a URL through which
25
+ * recipients can access the Corresponding Source.
26
+ */
27
+ define([
28
+ 'aloha/core',
29
+ 'util/class'
30
+ ], function (
31
+ Aloha,
32
+ Class
33
+ ) {
34
+ "use strict";
35
+
36
+ var GENTICS = window.GENTICS;
37
+
38
+ Aloha.RepositoryObject = function () {};
39
+
40
+ /**
41
+ * @namespace Aloha.Repository
42
+ * @class Document
43
+ * @constructor
44
+ *
45
+ * Abstract Document suitable for most Objects.<br /><br />
46
+ *
47
+ * Example:
48
+ *
49
+ <pre><code>
50
+ var item = new Aloha.Repository.Document({
51
+ id: 1,
52
+ repositoryId: 'myrepository',
53
+ name: 'Aloha Editor - The HTML5 Editor',
54
+ type: 'website',
55
+ url:'http://aloha-editor.com',
56
+ });
57
+ </code></pre>
58
+ *
59
+ * @param {Object} properties An object with the data.
60
+ * <div class="mdetail-params"><ul>
61
+ * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li>
62
+ * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li>
63
+ * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li>
64
+ * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li>
65
+ * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li>
66
+ * <li><code>mimetype</code> : String (optional) <div class="sub-desc">MIME type of the Content Stream</div></li>
67
+ * <li><code>filename</code> : String (optional) <div class="sub-desc">File name of the Content Stream</div></li>
68
+ * <li><code>length</code> : String (optional) <div class="sub-desc">Length of the content stream (in bytes)</div></li>
69
+ * <li><code>url</code> : String (optional) <div class="sub-desc">URL of the content stream</div></li>
70
+ * <li><code>renditions</code> : Array (optional) <div class="sub-desc">Array of different renditions of this object</div></li>
71
+ * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li>
72
+ * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li>
73
+ * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li>
74
+ * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li>
75
+ * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li>
76
+ * </ul></div>
77
+ *
78
+ */
79
+ Aloha.RepositoryDocument = Class.extend({
80
+ _constructor: function (properties) {
81
+
82
+ var p = properties;
83
+
84
+ this.type = 'document';
85
+
86
+ // Basic error checking for MUST attributes
87
+ if (!p.id || !p.name || !p.repositoryId) {
88
+ // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property");
89
+ return;
90
+ }
91
+
92
+ GENTICS.Utils.applyProperties(this, properties);
93
+
94
+ this.baseType = 'document';
95
+ }
96
+ // /**
97
+ // * Not implemented method to generate this JS API doc correctly.
98
+ // */
99
+ // ,empty = function() }
100
+
101
+ });
102
+
103
+
104
+
105
+ /**
106
+ * @namespace Aloha.Repository
107
+ * @class Folder
108
+ * @constructor
109
+ * Abstract Folder suitable for most strucural Objects.<br /><br />
110
+ *
111
+ * Example:
112
+ *
113
+ <pre><code>
114
+ var item = new Aloha.Repository.Folder({
115
+ id: 2,
116
+ repositoryId: 'myrepository',
117
+ name: 'images',
118
+ type: 'directory',
119
+ parentId:'/www'
120
+ });
121
+ </code></pre>
122
+ * @param {Object} properties An object with the data.
123
+ * <div class="mdetail-params"><ul>
124
+ * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li>
125
+ * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li>
126
+ * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li>
127
+ * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li>
128
+ * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li>
129
+ * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li>
130
+ * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li>
131
+ * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li>
132
+ * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li>
133
+ * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li>
134
+ * </ul></div>
135
+ *
136
+ */
137
+ Aloha.RepositoryFolder = Class.extend({
138
+
139
+ _constructor: function (properties) {
140
+
141
+ var p = properties;
142
+
143
+ this.type = 'folder';
144
+
145
+ // Basic error checking for MUST attributes
146
+ if (!p.id || !p.name || !p.repositoryId) {
147
+ // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property");
148
+ return;
149
+ }
150
+
151
+ GENTICS.Utils.applyProperties(this, properties);
152
+
153
+ this.baseType = 'folder';
154
+
155
+ }
156
+ // /**
157
+ // * Not implemented method to generate this JS API doc correctly.
158
+ // */
159
+ // ,empty = function() {};
160
+
161
+ });
162
+ });
@@ -0,0 +1,2402 @@
1
+ /* selection.js is part of Aloha Editor project http://aloha-editor.org
2
+ *
3
+ * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
4
+ * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
5
+ * Contributors http://aloha-editor.org/contribution.php
6
+ *
7
+ * Aloha Editor is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or any later version.
11
+ *
12
+ * Aloha Editor is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
+ *
21
+ * As an additional permission to the GNU GPL version 2, you may distribute
22
+ * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
23
+ * source code without the copy of the GNU GPL normally required,
24
+ * provided you include this license notice and a URL through which
25
+ * recipients can access the Corresponding Source.
26
+ */
27
+ define([
28
+ 'aloha/core',
29
+ 'jquery',
30
+ 'util/class',
31
+ 'util/range',
32
+ 'util/arrays',
33
+ 'util/strings',
34
+ 'aloha/console',
35
+ 'PubSub',
36
+ 'aloha/engine',
37
+ 'aloha/ecma5shims',
38
+ 'aloha/rangy-core'
39
+ ], function (
40
+ Aloha,
41
+ jQuery,
42
+ Class,
43
+ Range,
44
+ Arrays,
45
+ Strings,
46
+ console,
47
+ PubSub,
48
+ Engine,
49
+ e5s
50
+ ) {
51
+ "use strict";
52
+
53
+ var GENTICS = window.GENTICS;
54
+
55
+ function isCollapsedAndEmptyOrEndBr(rangeObject) {
56
+ var firstChild;
57
+ if (rangeObject.startContainer !== rangeObject.endContainer) {
58
+ return false;
59
+ }
60
+ // check whether the container starts in an element node
61
+ if (rangeObject.startContainer.nodeType != 1) {
62
+ return false;
63
+ }
64
+ firstChild = rangeObject.startContainer.firstChild;
65
+ return (!firstChild || (!firstChild.nextSibling && firstChild.nodeName == 'BR'));
66
+ }
67
+
68
+ function isCollapsedAndEndBr(rangeObject) {
69
+ if (rangeObject.startContainer !== rangeObject.endContainer) {
70
+ return false;
71
+ }
72
+ if (rangeObject.startContainer.nodeType != 1) {
73
+ return false;
74
+ }
75
+ return Engine.isEndBreak(rangeObject.startContainer);
76
+ }
77
+
78
+ var prevStartContext = null;
79
+ var prevEndContext = null;
80
+
81
+ function makeContextHtml(node, parents) {
82
+ var result = [],
83
+ parent,
84
+ len,
85
+ i;
86
+ if (1 === node.nodeType && node.nodeName !== 'BODY' && node.nodeName !== 'HTML') {
87
+ result.push(node.cloneNode(false).outerHTML);
88
+ } else {
89
+ result.push('#' + node.nodeType);
90
+ }
91
+ for (i = 0, len = parents.length; i < len; i++) {
92
+ parent = parents[i];
93
+ if (parent.nodeName === 'BODY' || parent.nodeName === 'HTML') {
94
+ // Although we limit the ancestors in most cases to the
95
+ // active editable, in some cases (copy&paste) the
96
+ // parent may be outside.
97
+ // On IE7 this means the following code may clone the
98
+ // HTML node too, which causes the browser to crash.
99
+ // On other browsers, this is just an optimization
100
+ // because the body and html elements should probably
101
+ // not be considered part of the context of an edit
102
+ // operation.
103
+ break;
104
+ }
105
+ result.push(parent.cloneNode(false).outerHTML);
106
+ }
107
+ return result.join('');
108
+ }
109
+
110
+ function getChangedContext(node, context) {
111
+ var until = Aloha.activeEditable ? Aloha.activeEditable.obj.parent()[0] : null;
112
+ var parents = jQuery(node).parentsUntil(until).get();
113
+ var html = makeContextHtml(node, parents);
114
+ var equal = (context && node === context.node && Arrays.equal(context.parents, parents) && html === context.html);
115
+ return equal ? null : {
116
+ node: node,
117
+ parents: parents,
118
+ html: html
119
+ };
120
+ }
121
+
122
+ function triggerSelectionContextChanged(rangeObject, event) {
123
+ var startContainer = rangeObject.startContainer;
124
+ var endContainer = rangeObject.endContainer;
125
+ if (!startContainer || !endContainer) {
126
+ console.warn("aloha/selection", "encountered range object without start or end container");
127
+ return;
128
+ }
129
+ var startContext = getChangedContext(startContainer, prevStartContext);
130
+ var endContext = getChangedContext(endContainer, prevEndContext);
131
+ if (!startContext && !endContext) {
132
+ return;
133
+ }
134
+ prevStartContext = startContext;
135
+ prevEndContext = endContext;
136
+
137
+ /**
138
+ * @api documented in the guides
139
+ */
140
+ PubSub.pub('aloha.selection.context-change', {
141
+ range: rangeObject,
142
+ event: event
143
+ });
144
+ }
145
+
146
+ /**
147
+ * @namespace Aloha
148
+ * @class Selection
149
+ * This singleton class always represents the current user selection
150
+ * @singleton
151
+ */
152
+ var Selection = Class.extend({
153
+ _constructor: function () {
154
+ // Pseudo Range Clone being cleaned up for better HTML wrapping support
155
+ this.rangeObject = {};
156
+
157
+ this.preventSelectionChangedFlag = false; // will remember if someone urged us to skip the next aloha-selection-changed event
158
+
159
+ // define basics first
160
+ this.tagHierarchy = {
161
+ 'textNode': {},
162
+ 'abbr': {
163
+ 'textNode': true
164
+ },
165
+ 'b': {
166
+ 'textNode': true,
167
+ 'b': true,
168
+ 'i': true,
169
+ 'em': true,
170
+ 'sup': true,
171
+ 'sub': true,
172
+ 'br': true,
173
+ 'span': true,
174
+ 'img': true,
175
+ 'a': true,
176
+ 'del': true,
177
+ 'ins': true,
178
+ 'u': true,
179
+ 'cite': true,
180
+ 'q': true,
181
+ 'code': true,
182
+ 'abbr': true,
183
+ 'strong': true
184
+ },
185
+ 'pre': {
186
+ 'textNode': true,
187
+ 'b': true,
188
+ 'i': true,
189
+ 'em': true,
190
+ 'sup': true,
191
+ 'sub': true,
192
+ 'br': true,
193
+ 'span': true,
194
+ 'img': true,
195
+ 'a': true,
196
+ 'del': true,
197
+ 'ins': true,
198
+ 'u': true,
199
+ 'cite': true,
200
+ 'q': true,
201
+ 'code': true,
202
+ 'abbr': true
203
+ },
204
+ 'blockquote': {
205
+ 'textNode': true,
206
+ 'b': true,
207
+ 'i': true,
208
+ 'em': true,
209
+ 'sup': true,
210
+ 'sub': true,
211
+ 'br': true,
212
+ 'span': true,
213
+ 'img': true,
214
+ 'a': true,
215
+ 'del': true,
216
+ 'ins': true,
217
+ 'u': true,
218
+ 'cite': true,
219
+ 'q': true,
220
+ 'code': true,
221
+ 'abbr': true,
222
+ 'p': true,
223
+ 'h1': true,
224
+ 'h2': true,
225
+ 'h3': true,
226
+ 'h4': true,
227
+ 'h5': true,
228
+ 'h6': true
229
+ },
230
+ 'ins': {
231
+ 'textNode': true,
232
+ 'b': true,
233
+ 'i': true,
234
+ 'em': true,
235
+ 'sup': true,
236
+ 'sub': true,
237
+ 'br': true,
238
+ 'span': true,
239
+ 'img': true,
240
+ 'a': true,
241
+ 'u': true,
242
+ 'p': true,
243
+ 'h1': true,
244
+ 'h2': true,
245
+ 'h3': true,
246
+ 'h4': true,
247
+ 'h5': true,
248
+ 'h6': true
249
+ },
250
+ 'ul': {
251
+ 'li': true
252
+ },
253
+ 'ol': {
254
+ 'li': true
255
+ },
256
+ 'li': {
257
+ 'textNode': true,
258
+ 'b': true,
259
+ 'i': true,
260
+ 'em': true,
261
+ 'sup': true,
262
+ 'sub': true,
263
+ 'br': true,
264
+ 'span': true,
265
+ 'img': true,
266
+ 'ul': true,
267
+ 'ol': true,
268
+ 'h1': true,
269
+ 'h2': true,
270
+ 'h3': true,
271
+ 'h4': true,
272
+ 'h5': true,
273
+ 'h6': true,
274
+ 'del': true,
275
+ 'ins': true,
276
+ 'u': true,
277
+ 'a': true
278
+ },
279
+ 'tr': {
280
+ 'td': true,
281
+ 'th': true
282
+ },
283
+ 'table': {
284
+ 'tr': true
285
+ },
286
+ 'div': {
287
+ 'textNode': true,
288
+ 'b': true,
289
+ 'i': true,
290
+ 'em': true,
291
+ 'sup': true,
292
+ 'sub': true,
293
+ 'br': true,
294
+ 'span': true,
295
+ 'img': true,
296
+ 'ul': true,
297
+ 'ol': true,
298
+ 'table': true,
299
+ 'h1': true,
300
+ 'h2': true,
301
+ 'h3': true,
302
+ 'h4': true,
303
+ 'h5': true,
304
+ 'h6': true,
305
+ 'del': true,
306
+ 'ins': true,
307
+ 'u': true,
308
+ 'p': true,
309
+ 'div': true,
310
+ 'pre': true,
311
+ 'blockquote': true,
312
+ 'a': true
313
+ },
314
+ 'h1': {
315
+ 'textNode': true,
316
+ 'b': true,
317
+ 'i': true,
318
+ 'em': true,
319
+ 'sup': true,
320
+ 'sub': true,
321
+ 'br': true,
322
+ 'span': true,
323
+ 'img': true,
324
+ 'a': true,
325
+ 'del': true,
326
+ 'ins': true,
327
+ 'u': true
328
+ }
329
+ };
330
+
331
+ // now reference the basics for all other equal tags (important: don't forget to include
332
+ // the basics itself as reference: 'b' : this.tagHierarchy.b
333
+ this.tagHierarchy = {
334
+ 'textNode': this.tagHierarchy.textNode,
335
+ 'abbr': this.tagHierarchy.abbr,
336
+ 'br': this.tagHierarchy.textNode,
337
+ 'img': this.tagHierarchy.textNode,
338
+ 'b': this.tagHierarchy.b,
339
+ 'strong': this.tagHierarchy.b,
340
+ 'code': this.tagHierarchy.b,
341
+ 'q': this.tagHierarchy.b,
342
+ 'blockquote': this.tagHierarchy.blockquote,
343
+ 'cite': this.tagHierarchy.b,
344
+ 'i': this.tagHierarchy.b,
345
+ 'em': this.tagHierarchy.b,
346
+ 'sup': this.tagHierarchy.b,
347
+ 'sub': this.tagHierarchy.b,
348
+ 'span': this.tagHierarchy.b,
349
+ 'del': this.tagHierarchy.del,
350
+ 'ins': this.tagHierarchy.ins,
351
+ 'u': this.tagHierarchy.b,
352
+ 'p': this.tagHierarchy.b,
353
+ 'pre': this.tagHierarchy.pre,
354
+ 'a': this.tagHierarchy.b,
355
+ 'ul': this.tagHierarchy.ul,
356
+ 'ol': this.tagHierarchy.ol,
357
+ 'li': this.tagHierarchy.li,
358
+ 'td': this.tagHierarchy.li,
359
+ 'div': this.tagHierarchy.div,
360
+ 'h1': this.tagHierarchy.h1,
361
+ 'h2': this.tagHierarchy.h1,
362
+ 'h3': this.tagHierarchy.h1,
363
+ 'h4': this.tagHierarchy.h1,
364
+ 'h5': this.tagHierarchy.h1,
365
+ 'h6': this.tagHierarchy.h1,
366
+ 'table': this.tagHierarchy.table
367
+ };
368
+
369
+ // When applying this elements to selection they will replace the assigned elements
370
+ this.replacingElements = {
371
+ 'h1': {
372
+ 'p': true,
373
+ 'h1': true,
374
+ 'h2': true,
375
+ 'h3': true,
376
+ 'h4': true,
377
+ 'h5': true,
378
+ 'h6': true,
379
+ 'pre': true,
380
+ 'blockquote': true
381
+ }
382
+ };
383
+ this.replacingElements = {
384
+ 'h1': this.replacingElements.h1,
385
+ 'h2': this.replacingElements.h1,
386
+ 'h3': this.replacingElements.h1,
387
+ 'h4': this.replacingElements.h1,
388
+ 'h5': this.replacingElements.h1,
389
+ 'h6': this.replacingElements.h1,
390
+ 'pre': this.replacingElements.h1,
391
+ 'p': this.replacingElements.h1,
392
+ 'blockquote': this.replacingElements.h1
393
+ };
394
+ this.allowedToStealElements = {
395
+ 'h1': {
396
+ 'textNode': true
397
+ }
398
+ };
399
+ this.allowedToStealElements = {
400
+ 'h1': this.allowedToStealElements.h1,
401
+ 'h2': this.allowedToStealElements.h1,
402
+ 'h3': this.allowedToStealElements.h1,
403
+ 'h4': this.allowedToStealElements.h1,
404
+ 'h5': this.allowedToStealElements.h1,
405
+ 'h6': this.allowedToStealElements.h1,
406
+ 'p': this.tagHierarchy.b
407
+ };
408
+ },
409
+
410
+ /**
411
+ * Class definition of a SelectionTree (relevant for all formatting / markup changes)
412
+ * TODO: remove this (was moved to range.js)
413
+ * Structure:
414
+ * +
415
+ * |-domobj: <reference to the DOM Object> (NOT jQuery)
416
+ * |-selection: defines if this node is marked by user [none|partial|full]
417
+ * |-children: recursive structure like this
418
+ * @hide
419
+ */
420
+ SelectionTree: function () {
421
+ this.domobj = {};
422
+ this.selection = undefined;
423
+ this.children = [];
424
+ },
425
+
426
+ /**
427
+ * INFO: Method is used for integration with Gentics Aloha, has no use otherwise
428
+ * Updates the rangeObject according to the current user selection
429
+ * Method is always called on selection change
430
+ * @param objectClicked Object that triggered the selectionChange event
431
+ * @return true when rangeObject was modified, false otherwise
432
+ * @hide
433
+ */
434
+ onChange: function (objectClicked, event, timeout) {
435
+ if (this.updateSelectionTimeout) {
436
+ window.clearTimeout(this.updateSelectionTimeout);
437
+ }
438
+
439
+ // We have to update the selection in a timeout due to an IE
440
+ // bug that is is caused by selecting some text and then
441
+ // clicking once inside the selection (which collapses the
442
+ // selection inside the previous selection).
443
+ var selection = this;
444
+ this.updateSelectionTimeout = window.setTimeout(function () {
445
+ var range = new Aloha.Selection.SelectionRange(true);
446
+ // We have to work around an IE bug that causes the user
447
+ // selection to be incorrectly set on the body element
448
+ // when the updateSelectionTimeout triggers. The
449
+ // selection corrects itself after waiting a while.
450
+ if (!range.startContainer || 'HTML' === range.startContainer.nodeName || 'BODY' === range.startContainer.nodeName) {
451
+ if (!this.updateSelectionTimeout) {
452
+ // First wait 5 millis, then 20 millis, 50 millis, 110 millis etc.
453
+ selection.onChange(objectClicked, event, 10 + (timeout || 5) * 2);
454
+ }
455
+ return;
456
+ }
457
+ Aloha.Selection._updateSelection(event, range);
458
+ }, timeout || 5);
459
+ },
460
+
461
+ /**
462
+ * prevents the next aloha-selection-changed event from being triggered
463
+ */
464
+ preventSelectionChanged: function () {
465
+ this.preventSelectionChangedFlag = true;
466
+ },
467
+
468
+ /**
469
+ * will return wheter selection change event was prevented or not, and reset the preventSelectionChangedFlag
470
+ * @return {Boolean} true if aloha-selection-change event was prevented
471
+ */
472
+ isSelectionChangedPrevented: function () {
473
+ var prevented = this.preventSelectionChangedFlag;
474
+ this.preventSelectionChangedFlag = false;
475
+ return prevented;
476
+ },
477
+
478
+ /**
479
+ * Checks if the current rangeObject common ancector container is edtiable
480
+ * @return {Boolean} true if current common ancestor is editable
481
+ */
482
+ isSelectionEditable: function () {
483
+ return (this.rangeObject.commonAncestorContainer && jQuery(this.rangeObject.commonAncestorContainer).contentEditable());
484
+ },
485
+
486
+ /**
487
+ * This method checks, if the current rangeObject common ancestor container has a 'data-aloha-floatingmenu-visible' Attribute.
488
+ * Needed in Floating Menu for exceptional display of floatingmenu.
489
+ */
490
+ isFloatingMenuVisible: function () {
491
+ var visible = jQuery(Aloha.Selection.rangeObject.commonAncestorContainer).attr('data-aloha-floatingmenu-visible');
492
+ if (visible !== 'undefined') {
493
+ if (visible === 'true') {
494
+ return true;
495
+ }
496
+ return false;
497
+ }
498
+ return false;
499
+ },
500
+
501
+ /**
502
+ * INFO: Method is used for integration with Gentics Aloha, has no use otherwise
503
+ * Updates the rangeObject according to the current user selection
504
+ * Method is always called on selection change
505
+ * @param event jQuery browser event object
506
+ * @return true when rangeObject was modified, false otherwise
507
+ * @hide
508
+ */
509
+ updateSelection: function (event) {
510
+ return this._updateSelection(event, null);
511
+ },
512
+
513
+ /**
514
+ * Internal version of updateSelection that adds the range parameter to be
515
+ * able to work around an IE bug that caused the current user selection
516
+ * sometimes to be on the body element.
517
+ * @param {Object} event
518
+ * @param {Object} range a substitute for the current user selection. if not provided,
519
+ * the current user selection will be used.
520
+ * @hide
521
+ */
522
+ _updateSelection: function (event, range) {
523
+ if (event && event.originalEvent &&
524
+ true === event.originalEvent.stopSelectionUpdate) {
525
+ return false;
526
+ }
527
+
528
+ if (typeof range === 'undefined') {
529
+ return false;
530
+ }
531
+
532
+ this.rangeObject = range =
533
+ range || new Aloha.Selection.SelectionRange(true);
534
+
535
+ // Determine the common ancestor container and update the selection
536
+ // tree.
537
+ range.update();
538
+
539
+ // Workaround for nasty IE bug that allows the user to select
540
+ // text nodes inside areas with contenteditable "false"
541
+ if (range && range.startContainer && range.endContainer) {
542
+ var inEditable =
543
+ jQuery(range.commonAncestorContainer)
544
+ .closest('.aloha-editable').length > 0;
545
+
546
+ if (inEditable) {
547
+ var validStartPosition = !(3 === range.startContainer.nodeType &&
548
+ !jQuery(range.startContainer.parentNode).contentEditable());
549
+
550
+ var validEndPosition = !(3 === range.endContainer.nodeType &&
551
+ !jQuery(range.endContainer.parentNode).contentEditable());
552
+
553
+ if (!validStartPosition || !validEndPosition) {
554
+ Aloha.getSelection().removeAllRanges();
555
+ return true;
556
+ }
557
+ }
558
+ }
559
+
560
+ // check if aloha-selection-changed event has been prevented
561
+ if (this.isSelectionChangedPrevented()) {
562
+ return true;
563
+ }
564
+
565
+ Aloha.trigger('aloha-selection-changed-before', [this.rangeObject, event]);
566
+
567
+ // throw the event that the selection has changed. Plugins now have the
568
+ // chance to react on the currentElements[childCount].children.lengthged selection
569
+ Aloha.trigger('aloha-selection-changed', [this.rangeObject, event]);
570
+
571
+ triggerSelectionContextChanged(this.rangeObject, event);
572
+
573
+ Aloha.trigger('aloha-selection-changed-after', [this.rangeObject, event]);
574
+
575
+ return true;
576
+ },
577
+
578
+ /**
579
+ * creates an object with x items containing all relevant dom objects.
580
+ * Structure:
581
+ * +
582
+ * |-domobj: <reference to the DOM Object> (NOT jQuery)
583
+ * |-selection: defines if this node is marked by user [none|partial|full]
584
+ * |-children: recursive structure like this ("x.." because it's then shown last in DOM Browsers...)
585
+ * TODO: remove this (was moved to range.js)
586
+ *
587
+ * @param rangeObject "Aloha clean" range object including a commonAncestorContainer
588
+ * @return obj selection
589
+ * @hide
590
+ */
591
+ getSelectionTree: function (rangeObject) {
592
+ if (!rangeObject) { // if called without any parameters, the method acts as getter for this.selectionTree
593
+ return this.rangeObject.getSelectionTree();
594
+ }
595
+ if (!rangeObject.commonAncestorContainer) {
596
+ Aloha.Log.error(this, 'the rangeObject is missing the commonAncestorContainer');
597
+ return false;
598
+ }
599
+
600
+ this.inselection = false;
601
+
602
+ // before getting the selection tree, we do a cleanup
603
+ if (GENTICS.Utils.Dom.doCleanup({ 'merge': true }, rangeObject)) {
604
+ rangeObject.update();
605
+ rangeObject.select();
606
+ }
607
+
608
+ return this.recursiveGetSelectionTree(rangeObject, rangeObject.commonAncestorContainer);
609
+ },
610
+
611
+ /**
612
+ * Recursive inner function for generating the selection tree.
613
+ * TODO: remove this (was moved to range.js)
614
+ * @param rangeObject range object
615
+ * @param currentObject current DOM object for which the selection tree shall be generated
616
+ * @return array of SelectionTree objects for the children of the current DOM object
617
+ * @hide
618
+ */
619
+ recursiveGetSelectionTree: function (rangeObject, currentObject) {
620
+ // get all direct children of the given object
621
+ var jQueryCurrentObject = jQuery(currentObject),
622
+ childCount = 0,
623
+ that = this,
624
+ currentElements = [];
625
+
626
+ jQueryCurrentObject.contents().each(function (index) {
627
+ var selectionType = 'none',
628
+ startOffset = false,
629
+ endOffset = false,
630
+ collapsedFound = false,
631
+ i,
632
+ elementsLength,
633
+ noneFound = false,
634
+ partialFound = false,
635
+ fullFound = false;
636
+
637
+ // check for collapsed selections between nodes
638
+ if (rangeObject.isCollapsed() && currentObject === rangeObject.startContainer && rangeObject.startOffset == index) {
639
+ // insert an extra selectiontree object for the collapsed selection here
640
+ currentElements[childCount] = new Aloha.Selection.SelectionTree();
641
+ currentElements[childCount].selection = 'collapsed';
642
+ currentElements[childCount].domobj = undefined;
643
+ that.inselection = false;
644
+ collapsedFound = true;
645
+ childCount++;
646
+ }
647
+
648
+ if (!that.inselection && !collapsedFound) {
649
+ // the start of the selection was not yet found, so look for it now
650
+ // check whether the start of the selection is found here
651
+
652
+ // Try to read the nodeType property and return if we do not have permission
653
+ // ie.: frame document to an external URL
654
+ var nodeType;
655
+ try {
656
+ nodeType = this.nodeType;
657
+ } catch (e) {
658
+ return;
659
+ }
660
+
661
+ // check is dependent on the node type
662
+ switch (nodeType) {
663
+ case 3:
664
+ // text node
665
+ if (this === rangeObject.startContainer) {
666
+ // the selection starts here
667
+ that.inselection = true;
668
+
669
+ // when the startoffset is > 0, the selection type is only partial
670
+ selectionType = rangeObject.startOffset > 0 ? 'partial' : 'full';
671
+ startOffset = rangeObject.startOffset;
672
+ endOffset = this.length;
673
+ }
674
+ break;
675
+ case 1:
676
+ // element node
677
+ if (this === rangeObject.startContainer && rangeObject.startOffset === 0) {
678
+ // the selection starts here
679
+ that.inselection = true;
680
+ selectionType = 'full';
681
+ }
682
+ if (currentObject === rangeObject.startContainer && rangeObject.startOffset === index) {
683
+ // the selection starts here
684
+ that.inselection = true;
685
+ selectionType = 'full';
686
+ }
687
+ break;
688
+ }
689
+ }
690
+
691
+ if (that.inselection && !collapsedFound) {
692
+ if (selectionType == 'none') {
693
+ selectionType = 'full';
694
+ }
695
+ // we already found the start of the selection, so look for the end of the selection now
696
+ // check whether the end of the selection is found here
697
+
698
+ switch (this.nodeType) {
699
+ case 3:
700
+ // text node
701
+ if (this === rangeObject.endContainer) {
702
+ // the selection ends here
703
+ that.inselection = false;
704
+
705
+ // check for partial selection here
706
+ if (rangeObject.endOffset < this.length) {
707
+ selectionType = 'partial';
708
+ }
709
+ if (startOffset === false) {
710
+ startOffset = 0;
711
+ }
712
+ endOffset = rangeObject.endOffset;
713
+ }
714
+ break;
715
+ case 1:
716
+ // element node
717
+ if (this === rangeObject.endContainer && rangeObject.endOffset === 0) {
718
+ that.inselection = false;
719
+ }
720
+ break;
721
+ }
722
+ if (currentObject === rangeObject.endContainer && rangeObject.endOffset <= index) {
723
+ that.inselection = false;
724
+ selectionType = 'none';
725
+ }
726
+ }
727
+
728
+ // create the current selection tree entry
729
+ currentElements[childCount] = new Aloha.Selection.SelectionTree();
730
+ currentElements[childCount].domobj = this;
731
+ currentElements[childCount].selection = selectionType;
732
+ if (selectionType == 'partial') {
733
+ currentElements[childCount].startOffset = startOffset;
734
+ currentElements[childCount].endOffset = endOffset;
735
+ }
736
+
737
+ // now do the recursion step into the current object
738
+ currentElements[childCount].children = that.recursiveGetSelectionTree(rangeObject, this);
739
+ elementsLength = currentElements[childCount].children.length;
740
+
741
+ // check whether a selection was found within the children
742
+ if (elementsLength > 0) {
743
+ for (i = 0; i < elementsLength; ++i) {
744
+ switch (currentElements[childCount].children[i].selection) {
745
+ case 'none':
746
+ noneFound = true;
747
+ break;
748
+ case 'full':
749
+ fullFound = true;
750
+ break;
751
+ case 'partial':
752
+ partialFound = true;
753
+ break;
754
+ }
755
+ }
756
+
757
+ if (partialFound || (fullFound && noneFound)) {
758
+ // found at least one 'partial' selection in the children, or both 'full' and 'none', so this element is also 'partial' selected
759
+ currentElements[childCount].selection = 'partial';
760
+ } else if (fullFound && !partialFound && !noneFound) {
761
+ // only found 'full' selected children, so this element is also 'full' selected
762
+ currentElements[childCount].selection = 'full';
763
+ }
764
+ }
765
+
766
+ childCount++;
767
+ });
768
+
769
+ // extra check for collapsed selections at the end of the current element
770
+ if (rangeObject.isCollapsed() && currentObject === rangeObject.startContainer && rangeObject.startOffset == currentObject.childNodes.length) {
771
+ currentElements[childCount] = new Aloha.Selection.SelectionTree();
772
+ currentElements[childCount].selection = 'collapsed';
773
+ currentElements[childCount].domobj = undefined;
774
+ }
775
+
776
+ return currentElements;
777
+ },
778
+
779
+ /**
780
+ * Get the currently selected range
781
+ * @return {Aloha.Selection.SelectionRange} currently selected range
782
+ * @method
783
+ */
784
+ getRangeObject: function () {
785
+ return this.rangeObject;
786
+ },
787
+
788
+ /**
789
+ * method finds out, if a node is within a certain markup or not
790
+ * @param rangeObj Aloha rangeObject
791
+ * @param startOrEnd boolean; defines, if start or endContainer should be used: false for start, true for end
792
+ * @param markupObject jQuery object of the markup to look for
793
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
794
+ * @param limitObject dom object which limits the search are within the dom. normally this will be the active Editable
795
+ * @return true, if the markup is effective on the range objects start or end node
796
+ * @hide
797
+ */
798
+ isRangeObjectWithinMarkup: function (rangeObject, startOrEnd, markupObject, tagComparator, limitObject) {
799
+ var domObj = !startOrEnd ? rangeObject.startContainer : rangeObject.endContainer,
800
+ that = this,
801
+ parents = jQuery(domObj).parents(),
802
+ returnVal = false,
803
+ i = -1;
804
+
805
+ // check if a comparison method was passed as parameter ...
806
+ if (typeof tagComparator !== 'undefined' && typeof tagComparator !== 'function') {
807
+ Aloha.Log.error(this, 'parameter tagComparator is not a function');
808
+ }
809
+ // ... if not use this as standard tag comparison method
810
+ if (typeof tagComparator === 'undefined') {
811
+ tagComparator = function (domobj, markupObject) {
812
+ return that.standardTextLevelSemanticsComparator(domobj, markupObject); // TODO should actually be this.getStandardTagComparator(markupObject)
813
+ };
814
+ }
815
+
816
+ if (parents.length > 0) {
817
+ parents.each(function () {
818
+ // the limit object was reached (normally the Editable Element)
819
+ if (this === limitObject) {
820
+ Aloha.Log.debug(that, 'reached limit dom obj');
821
+ return false; // break() of jQuery .each(); THIS IS NOT THE FUNCTION RETURN VALUE
822
+ }
823
+ if (tagComparator(this, markupObject)) {
824
+ if (returnVal === false) {
825
+ returnVal = [];
826
+ }
827
+ Aloha.Log.debug(that, 'reached object equal to markup');
828
+ i++;
829
+ returnVal[i] = this;
830
+ return true; // continue() of jQuery .each(); THIS IS NOT THE FUNCTION RETURN VALUE
831
+ }
832
+ });
833
+ }
834
+ return returnVal;
835
+ },
836
+
837
+ /**
838
+ * standard method, to compare a domobj and a jquery object for sections and grouping content (e.g. p, h1, h2, ul, ....).
839
+ * is always used when no other tag comparator is passed as parameter
840
+ * @param domobj domobject to compare with markup
841
+ * @param markupObject jQuery object of the markup to compare with domobj
842
+ * @return true if objects are equal and false if not
843
+ * @hide
844
+ */
845
+ standardSectionsAndGroupingContentComparator: function (domobj, markupObject) {
846
+ if (domobj.nodeType !== 1) {
847
+ Aloha.Log.debug(this, 'only element nodes (nodeType == 1) can be compared');
848
+ return false;
849
+ }
850
+ if (!markupObject[0].nodeName) {
851
+ return false;
852
+ }
853
+ var elemMap = Aloha.Selection.replacingElements[domobj.nodeName.toLowerCase()];
854
+ return elemMap && elemMap[markupObject[0].nodeName.toLowerCase()];
855
+ },
856
+
857
+ /**
858
+ * standard method, to compare a domobj and a jquery object for their tagName (aka span elements, e.g. b, i, sup, span, ...).
859
+ * is always used when no other tag comparator is passed as parameter
860
+ * @param domobj domobject to compare with markup
861
+ * @param markupObject jQuery object of the markup to compare with domobj
862
+ * @return true if objects are equal and false if not
863
+ * @hide
864
+ */
865
+ standardTagNameComparator: function (domobj, markupObject) {
866
+ if (domobj.nodeType === 1) {
867
+ if (domobj.nodeName != markupObject[0].nodeName) {
868
+ return false;
869
+ }
870
+ return true;
871
+ }
872
+ Aloha.Log.debug(this, 'only element nodes (nodeType == 1) can be compared');
873
+ return false;
874
+ },
875
+
876
+ /**
877
+ * standard method, to compare a domobj and a jquery object for text level semantics (aka span elements, e.g. b, i, sup, span, ...).
878
+ * is always used when no other tag comparator is passed as parameter
879
+ * @param domobj domobject to compare with markup
880
+ * @param markupObject jQuery object of the markup to compare with domobj
881
+ * @return true if objects are equal and false if not
882
+ * @hide
883
+ */
884
+ standardTextLevelSemanticsComparator: function (domobj, markupObject) {
885
+ // only element nodes can be compared
886
+ if (domobj.nodeType === 1) {
887
+ if (domobj.nodeName != markupObject[0].nodeName) {
888
+ return false;
889
+ }
890
+ if (!this.standardAttributesComparator(domobj, markupObject)) {
891
+ return false;
892
+ }
893
+ return true;
894
+ }
895
+ Aloha.Log.debug(this, 'only element nodes (nodeType == 1) can be compared');
896
+ return false;
897
+ },
898
+
899
+
900
+ /**
901
+ * standard method, to compare attributes of one dom obj and one markup obj (jQuery)
902
+ * @param domobj domobject to compare with markup
903
+ * @param markupObject jQuery object of the markup to compare with domobj
904
+ * @return true if objects are equal and false if not
905
+ * @hide
906
+ */
907
+ standardAttributesComparator: function (domobj, markupObject) {
908
+ var classesA = Strings.words((domobj && domobj.className) || '');
909
+ var classesB = Strings.words((markupObject.length && markupObject[0].className) || '');
910
+ Arrays.sortUnique(classesA);
911
+ Arrays.sortUnique(classesB);
912
+ return Arrays.equal(classesA, classesB);
913
+ },
914
+
915
+ /**
916
+ * method finds out, if a node is within a certain markup or not
917
+ * @param rangeObj Aloha rangeObject
918
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
919
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
920
+ * @return void; TODO: should return true if the markup applied successfully and false if not
921
+ * @hide
922
+ */
923
+ changeMarkup: function (rangeObject, markupObject, tagComparator) {
924
+ var tagName = markupObject[0].tagName.toLowerCase(),
925
+ newCAC,
926
+ limitObject,
927
+ backupRangeObject,
928
+ relevantMarkupObjectsAtSelectionStart = this.isRangeObjectWithinMarkup(rangeObject, false, markupObject, tagComparator, limitObject),
929
+ relevantMarkupObjectsAtSelectionEnd = this.isRangeObjectWithinMarkup(rangeObject, true, markupObject, tagComparator, limitObject),
930
+ nextSibling,
931
+ relevantMarkupObjectAfterSelection,
932
+ prevSibling,
933
+ relevantMarkupObjectBeforeSelection,
934
+ extendedRangeObject;
935
+ var parentElement;
936
+
937
+ // if the element is a replacing element (like p/h1/h2/h3/h4/h5/h6...), which must not wrap each other
938
+ // use a clone of rangeObject
939
+ if (this.replacingElements[tagName]) {
940
+ // backup rangeObject for later selection;
941
+ backupRangeObject = rangeObject;
942
+
943
+ // create a new range object to not modify the orginal
944
+ rangeObject = new this.SelectionRange(rangeObject);
945
+
946
+ // either select the active Editable as new commonAncestorContainer (CAC) or use the body
947
+ if (Aloha.activeEditable) {
948
+ newCAC = Aloha.activeEditable.obj.get(0);
949
+ } else {
950
+ newCAC = jQuery('body');
951
+ }
952
+ // update rangeObject by setting the newCAC and automatically recalculating the selectionTree
953
+ rangeObject.update(newCAC);
954
+
955
+ // store the information, that the markupObject can be replaced (not must be!!) inside the jQuery markup object
956
+ markupObject.isReplacingElement = true;
957
+ } else {
958
+ // if the element is NOT a replacing element, then something needs to be selected, otherwise it can not be wrapped
959
+ // therefor the method can return false, if nothing is selected ( = rangeObject is collapsed)
960
+ if (rangeObject.isCollapsed()) {
961
+ Aloha.Log.debug(this, 'early returning from applying markup because nothing is currently selected');
962
+ return false;
963
+ }
964
+ }
965
+
966
+ // is Start/End DOM Obj inside the markup to change
967
+ if (Aloha.activeEditable) {
968
+ limitObject = Aloha.activeEditable.obj[0];
969
+ } else {
970
+ limitObject = jQuery('body');
971
+ }
972
+
973
+ if (!markupObject.isReplacingElement && rangeObject.startOffset === 0) { // don't care about replacers, because they never extend
974
+ if (null != (prevSibling = this.getTextNodeSibling(false, rangeObject.commonAncestorContainer.parentNode, rangeObject.startContainer))) {
975
+ relevantMarkupObjectBeforeSelection = this.isRangeObjectWithinMarkup({
976
+ startContainer: prevSibling,
977
+ startOffset: 0
978
+ }, false, markupObject, tagComparator, limitObject);
979
+ }
980
+ }
981
+ if (!markupObject.isReplacingElement && (rangeObject.endOffset === rangeObject.endContainer.length)) { // don't care about replacers, because they never extend
982
+ if (null != (nextSibling = this.getTextNodeSibling(true, rangeObject.commonAncestorContainer.parentNode, rangeObject.endContainer))) {
983
+ relevantMarkupObjectAfterSelection = this.isRangeObjectWithinMarkup({
984
+ startContainer: nextSibling,
985
+ startOffset: 0
986
+ }, false, markupObject, tagComparator, limitObject);
987
+ }
988
+ }
989
+
990
+ // decide what to do (expand or reduce markup)
991
+ // Alternative A: from markup to no-markup: markup will be removed in selection;
992
+ // reapplied from original markup start to selection start
993
+ if (!markupObject.isReplacingElement && (relevantMarkupObjectsAtSelectionStart && !relevantMarkupObjectsAtSelectionEnd)) {
994
+ Aloha.Log.info(this, 'markup 2 non-markup');
995
+ this.prepareForRemoval(rangeObject.getSelectionTree(), markupObject, tagComparator);
996
+ jQuery(relevantMarkupObjectsAtSelectionStart).addClass('preparedForRemoval');
997
+ this.insertCroppedMarkups(relevantMarkupObjectsAtSelectionStart, rangeObject, false, tagComparator);
998
+ } else if (!markupObject.isReplacingElement && relevantMarkupObjectsAtSelectionStart && relevantMarkupObjectsAtSelectionEnd) {
999
+ // Alternative B: from markup to markup:
1000
+ // remove selected markup (=split existing markup if single, shrink if two different)
1001
+ Aloha.Log.info(this, 'markup 2 markup');
1002
+ this.prepareForRemoval(rangeObject.getSelectionTree(), markupObject, tagComparator);
1003
+ this.splitRelevantMarkupObject(relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd, rangeObject, tagComparator);
1004
+ } else if (!markupObject.isReplacingElement && ((!relevantMarkupObjectsAtSelectionStart && relevantMarkupObjectsAtSelectionEnd) || relevantMarkupObjectAfterSelection || relevantMarkupObjectBeforeSelection)) { //
1005
+ // Alternative C: from no-markup to markup OR with next2markup:
1006
+ // new markup is wrapped from selection start to end of originalmarkup, original is remove afterwards
1007
+ Aloha.Log.info(this, 'non-markup 2 markup OR with next2markup');
1008
+ // move end of rangeObject to end of relevant markups
1009
+ if (relevantMarkupObjectBeforeSelection && relevantMarkupObjectAfterSelection) {
1010
+ extendedRangeObject = new Aloha.Selection.SelectionRange(rangeObject);
1011
+ extendedRangeObject.startContainer = jQuery(relevantMarkupObjectBeforeSelection[relevantMarkupObjectBeforeSelection.length - 1]).textNodes()[0];
1012
+ extendedRangeObject.startOffset = 0;
1013
+ extendedRangeObject.endContainer = jQuery(relevantMarkupObjectAfterSelection[relevantMarkupObjectAfterSelection.length - 1]).textNodes().last()[0];
1014
+ extendedRangeObject.endOffset = extendedRangeObject.endContainer.length;
1015
+ extendedRangeObject.update();
1016
+ this.applyMarkup(extendedRangeObject.getSelectionTree(), rangeObject, markupObject, tagComparator);
1017
+ Aloha.Log.info(this, 'double extending previous markup(previous and after selection), actually wrapping it ...');
1018
+
1019
+ } else if (relevantMarkupObjectBeforeSelection && !relevantMarkupObjectAfterSelection && !relevantMarkupObjectsAtSelectionEnd) {
1020
+ this.extendExistingMarkupWithSelection(relevantMarkupObjectBeforeSelection, rangeObject, false, tagComparator);
1021
+ Aloha.Log.info(this, 'extending previous markup');
1022
+
1023
+ } else if (relevantMarkupObjectBeforeSelection && !relevantMarkupObjectAfterSelection && relevantMarkupObjectsAtSelectionEnd) {
1024
+ extendedRangeObject = new Aloha.Selection.SelectionRange(rangeObject);
1025
+ extendedRangeObject.startContainer = jQuery(relevantMarkupObjectBeforeSelection[relevantMarkupObjectBeforeSelection.length - 1]).textNodes()[0];
1026
+ extendedRangeObject.startOffset = 0;
1027
+ extendedRangeObject.endContainer = jQuery(relevantMarkupObjectsAtSelectionEnd[relevantMarkupObjectsAtSelectionEnd.length - 1]).textNodes().last()[0];
1028
+ extendedRangeObject.endOffset = extendedRangeObject.endContainer.length;
1029
+ extendedRangeObject.update();
1030
+ this.applyMarkup(extendedRangeObject.getSelectionTree(), rangeObject, markupObject, tagComparator);
1031
+ Aloha.Log.info(this, 'double extending previous markup(previous and relevant at the end), actually wrapping it ...');
1032
+
1033
+ } else if (!relevantMarkupObjectBeforeSelection && relevantMarkupObjectAfterSelection) {
1034
+ this.extendExistingMarkupWithSelection(relevantMarkupObjectAfterSelection, rangeObject, true, tagComparator);
1035
+ Aloha.Log.info(this, 'extending following markup backwards');
1036
+
1037
+ } else {
1038
+ this.extendExistingMarkupWithSelection(relevantMarkupObjectsAtSelectionEnd, rangeObject, true, tagComparator);
1039
+ }
1040
+ } else if (markupObject.isReplacingElement || (!relevantMarkupObjectsAtSelectionStart && !relevantMarkupObjectsAtSelectionEnd && !relevantMarkupObjectBeforeSelection && !relevantMarkupObjectAfterSelection)) {
1041
+ // Alternative D: no-markup to no-markup: easy
1042
+ Aloha.Log.info(this, 'non-markup 2 non-markup');
1043
+
1044
+ // workaround to keep the caret at the right position if it's an empty element
1045
+ // applyMarkup was not working correctly and has a lot of overhead we don't need in that case
1046
+ if (isCollapsedAndEmptyOrEndBr(rangeObject)) {
1047
+ var newMarkup = markupObject.clone();
1048
+
1049
+ if (isCollapsedAndEndBr(rangeObject)) {
1050
+ newMarkup[0].appendChild(Engine.createEndBreak());
1051
+ }
1052
+
1053
+ // setting the focus is needed for mozilla and IE 7 to have a working rangeObject.select()
1054
+ if (Aloha.activeEditable && jQuery.browser.mozilla) {
1055
+ Aloha.activeEditable.obj.focus();
1056
+ }
1057
+
1058
+ if (Engine.isEditable(rangeObject.startContainer)) {
1059
+ Engine.copyAttributes(rangeObject.startContainer, newMarkup[0]);
1060
+ jQuery(rangeObject.startContainer).after(newMarkup[0]).remove();
1061
+ } else if (Engine.isEditingHost(rangeObject.startContainer)) {
1062
+ jQuery(rangeObject.startContainer).append(newMarkup[0]);
1063
+ Engine.ensureContainerEditable(newMarkup[0]);
1064
+ }
1065
+
1066
+ backupRangeObject.startContainer = newMarkup[0];
1067
+ backupRangeObject.endContainer = newMarkup[0];
1068
+ backupRangeObject.startOffset = 0;
1069
+ backupRangeObject.endOffset = 0;
1070
+ return;
1071
+ }
1072
+ this.applyMarkup(rangeObject.getSelectionTree(), rangeObject, markupObject, tagComparator, {
1073
+ setRangeObject2NewMarkup: true
1074
+ });
1075
+ backupRangeObject.startContainer = rangeObject.startContainer;
1076
+ backupRangeObject.endContainer = rangeObject.endContainer;
1077
+ backupRangeObject.startOffset = rangeObject.startOffset;
1078
+ backupRangeObject.endOffset = rangeObject.endOffset;
1079
+ }
1080
+
1081
+ if (markupObject.isReplacingElement) {
1082
+ //Check if the startContainer is one of the zapped elements
1083
+ if (backupRangeObject && backupRangeObject.startContainer.className && backupRangeObject.startContainer.className.indexOf('preparedForRemoval') > -1) {
1084
+ //var parentElement = jQuery(backupRangeObject.startContainer).closest(markupObject[0].tagName).get(0);
1085
+ parentElement = jQuery(backupRangeObject.startContainer).parents(markupObject[0].tagName).get(0);
1086
+ backupRangeObject.startContainer = parentElement;
1087
+ rangeObject.startContainer = parentElement;
1088
+ }
1089
+ //check if the endContainer is one of the zapped elements
1090
+ if (backupRangeObject && backupRangeObject.endContainer.className && backupRangeObject.endContainer.className.indexOf('preparedForRemoval') > -1) {
1091
+ //var parentElement = jQuery(backupRangeObject.endContainer).closest(markupObject[0].tagName).get(0);
1092
+ parentElement = jQuery(backupRangeObject.endContainer).parents(markupObject[0].tagName).get(0);
1093
+ backupRangeObject.endContainer = parentElement;
1094
+ rangeObject.endContainer = parentElement;
1095
+ }
1096
+ }
1097
+ // remove all marked items
1098
+ jQuery('.preparedForRemoval').zap();
1099
+
1100
+ // recalculate cac and selectionTree
1101
+
1102
+ // update selection
1103
+ if (markupObject.isReplacingElement) {
1104
+ //After the zapping we have to check for wrong offsets
1105
+ if (e5s.Node.ELEMENT_NODE === backupRangeObject.startContainer.nodeType && backupRangeObject.startContainer.childNodes && backupRangeObject.startContainer.childNodes.length < backupRangeObject.startOffset) {
1106
+ backupRangeObject.startOffset = backupRangeObject.startContainer.childNodes.length;
1107
+ rangeObject.startOffset = backupRangeObject.startContainer.childNodes.length;
1108
+ }
1109
+ if (e5s.Node.ELEMENT_NODE === backupRangeObject.endContainer.nodeType && backupRangeObject.endContainer.childNodes && backupRangeObject.endContainer.childNodes.length < backupRangeObject.endOffset) {
1110
+ backupRangeObject.endOffset = backupRangeObject.endContainer.childNodes.length;
1111
+ rangeObject.endOffset = backupRangeObject.endContainer.childNodes.length;
1112
+ }
1113
+ rangeObject.endContainer = backupRangeObject.endContainer;
1114
+ rangeObject.endOffset = backupRangeObject.endOffset;
1115
+ rangeObject.startContainer = backupRangeObject.startContainer;
1116
+ rangeObject.startOffset = backupRangeObject.startOffset;
1117
+ backupRangeObject.update();
1118
+ backupRangeObject.select();
1119
+ } else {
1120
+ rangeObject.update();
1121
+ rangeObject.select();
1122
+ }
1123
+ },
1124
+
1125
+ /**
1126
+ * method compares a JS array of domobjects with a range object and decides, if the rangeObject spans the whole markup objects. method is used to decide if a markup2markup selection can be completely remove or if it must be splitted into 2 separate markups
1127
+ * @param relevantMarkupObjectsAtSelectionStart JS Array of dom objects, which are parents to the rangeObject.startContainer
1128
+ * @param relevantMarkupObjectsAtSelectionEnd JS Array of dom objects, which are parents to the rangeObject.endContainer
1129
+ * @param rangeObj Aloha rangeObject
1130
+ * @return true, if rangeObjects and markup objects are identical, false otherwise
1131
+ * @hide
1132
+ */
1133
+ areMarkupObjectsAsLongAsRangeObject: function (relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd, rangeObject) {
1134
+ var i, el, textNode, relMarkupEnd, relMarkupStart;
1135
+
1136
+ if (rangeObject.startOffset !== 0) {
1137
+ return false;
1138
+ }
1139
+
1140
+ for (i = 0, relMarkupStart = relevantMarkupObjectsAtSelectionStart.length; i < relMarkupStart; i++) {
1141
+ el = jQuery(relevantMarkupObjectsAtSelectionStart[i]);
1142
+ if (el.textNodes().first()[0] !== rangeObject.startContainer) {
1143
+ return false;
1144
+ }
1145
+ }
1146
+
1147
+ for (i = 0, relMarkupEnd = relevantMarkupObjectsAtSelectionEnd.length; i < relMarkupEnd; i++) {
1148
+ el = jQuery(relevantMarkupObjectsAtSelectionEnd[i]);
1149
+ textNode = el.textNodes().last()[0];
1150
+ if (textNode !== rangeObject.endContainer || textNode.length != rangeObject.endOffset) {
1151
+ return false;
1152
+ }
1153
+ }
1154
+
1155
+ return true;
1156
+ },
1157
+
1158
+ /**
1159
+ * method used to remove/split markup from a "markup2markup" selection
1160
+ * @param relevantMarkupObjectsAtSelectionStart JS Array of dom objects, which are parents to the rangeObject.startContainer
1161
+ * @param relevantMarkupObjectsAtSelectionEnd JS Array of dom objects, which are parents to the rangeObject.endContainer
1162
+ * @param rangeObj Aloha rangeObject
1163
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1164
+ * @return true (always, since no "false" case is currently known...but might be added)
1165
+ * @hide
1166
+ */
1167
+ splitRelevantMarkupObject: function (relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd, rangeObject, tagComparator) {
1168
+ // mark them to be deleted
1169
+ jQuery(relevantMarkupObjectsAtSelectionStart).addClass('preparedForRemoval');
1170
+ jQuery(relevantMarkupObjectsAtSelectionEnd).addClass('preparedForRemoval');
1171
+
1172
+ // check if the rangeObject is identical with the relevantMarkupObjects (in this case the markup can simply be removed)
1173
+ if (this.areMarkupObjectsAsLongAsRangeObject(relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd, rangeObject)) {
1174
+ return true;
1175
+ }
1176
+
1177
+ // find intersection (this can always only be one dom element (namely the highest) because all others will be removed
1178
+ var relevantMarkupObjectAtSelectionStartAndEnd = this.intersectRelevantMarkupObjects(relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd);
1179
+
1180
+ if (relevantMarkupObjectAtSelectionStartAndEnd) {
1181
+ this.insertCroppedMarkups([relevantMarkupObjectAtSelectionStartAndEnd], rangeObject, false, tagComparator);
1182
+ this.insertCroppedMarkups([relevantMarkupObjectAtSelectionStartAndEnd], rangeObject, true, tagComparator);
1183
+ } else {
1184
+ this.insertCroppedMarkups(relevantMarkupObjectsAtSelectionStart, rangeObject, false, tagComparator);
1185
+ this.insertCroppedMarkups(relevantMarkupObjectsAtSelectionEnd, rangeObject, true, tagComparator);
1186
+ }
1187
+ return true;
1188
+ },
1189
+
1190
+ /**
1191
+ * method takes two arrays of bottom up dom objects, compares them and returns either the object closest to the root or false
1192
+ * @param relevantMarkupObjectsAtSelectionStart JS Array of dom objects
1193
+ * @param relevantMarkupObjectsAtSelectionEnd JS Array of dom objects
1194
+ * @return dom object closest to the root or false
1195
+ * @hide
1196
+ */
1197
+ intersectRelevantMarkupObjects: function (relevantMarkupObjectsAtSelectionStart, relevantMarkupObjectsAtSelectionEnd) {
1198
+ var intersection = false, i, elStart, j, elEnd, relMarkupStart, relMarkupEnd;
1199
+ if (!relevantMarkupObjectsAtSelectionStart || !relevantMarkupObjectsAtSelectionEnd) {
1200
+ return intersection; // we can only intersect, if we have to arrays!
1201
+ }
1202
+ relMarkupStart = relevantMarkupObjectsAtSelectionStart.length;
1203
+ relMarkupEnd = relevantMarkupObjectsAtSelectionEnd.length;
1204
+ for (i = 0; i < relMarkupStart; i++) {
1205
+ elStart = relevantMarkupObjectsAtSelectionStart[i];
1206
+ for (j = 0; j < relMarkupEnd; j++) {
1207
+ elEnd = relevantMarkupObjectsAtSelectionEnd[j];
1208
+ if (elStart === elEnd) {
1209
+ intersection = elStart;
1210
+ }
1211
+ }
1212
+ }
1213
+ return intersection;
1214
+ },
1215
+
1216
+ /**
1217
+ * method used to add markup to a nonmarkup2markup selection
1218
+ * @param relevantMarkupObjects JS Array of dom objects effecting either the start or endContainer of a selection (which should be extended)
1219
+ * @param rangeObject Aloha rangeObject the markups should be extended to
1220
+ * @param startOrEnd boolean; defines, if the existing markups should be extended forwards or backwards (is propably redundant and could be found out by comparing start or end container with the markup array dom objects)
1221
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1222
+ * @return true
1223
+ * @hide
1224
+ */
1225
+ extendExistingMarkupWithSelection: function (relevantMarkupObjects, rangeObject, startOrEnd, tagComparator) {
1226
+ var extendMarkupsAtStart, extendMarkupsAtEnd, objects, i, relMarkupLength, el, textnodes, nodeNr;
1227
+ if (!startOrEnd) { // = Start
1228
+ // start part of rangeObject should be used, therefor existing markups are cropped at the end
1229
+ extendMarkupsAtStart = true;
1230
+ }
1231
+ if (startOrEnd) { // = End
1232
+ // end part of rangeObject should be used, therefor existing markups are cropped at start (beginning)
1233
+ extendMarkupsAtEnd = true;
1234
+ }
1235
+ objects = [];
1236
+ for (i = 0, relMarkupLength = relevantMarkupObjects.length; i < relMarkupLength; i++) {
1237
+ objects[i] = new this.SelectionRange();
1238
+ el = relevantMarkupObjects[i];
1239
+ if (extendMarkupsAtEnd && !extendMarkupsAtStart) {
1240
+ objects[i].startContainer = rangeObject.startContainer; // jQuery(el).contents()[0];
1241
+ objects[i].startOffset = rangeObject.startOffset;
1242
+ textnodes = jQuery(el).textNodes(true);
1243
+
1244
+ nodeNr = textnodes.length - 1;
1245
+ objects[i].endContainer = textnodes[nodeNr];
1246
+ objects[i].endOffset = textnodes[nodeNr].length;
1247
+ objects[i].update();
1248
+ this.applyMarkup(objects[i].getSelectionTree(), rangeObject, this.getClonedMarkup4Wrapping(el), tagComparator, {
1249
+ setRangeObject2NewMarkup: true
1250
+ });
1251
+ }
1252
+ if (!extendMarkupsAtEnd && extendMarkupsAtStart) {
1253
+ textnodes = jQuery(el).textNodes(true);
1254
+ objects[i].startContainer = textnodes[0]; // jQuery(el).contents()[0];
1255
+ objects[i].startOffset = 0;
1256
+ objects[i].endContainer = rangeObject.endContainer;
1257
+ objects[i].endOffset = rangeObject.endOffset;
1258
+ objects[i].update();
1259
+ this.applyMarkup(objects[i].getSelectionTree(), rangeObject, this.getClonedMarkup4Wrapping(el), tagComparator, {
1260
+ setRangeObject2NewMarkup: true
1261
+ });
1262
+ }
1263
+ }
1264
+ return true;
1265
+ },
1266
+
1267
+ /**
1268
+ * method creates an empty markup jQuery object from a dom object passed as paramter
1269
+ * @param domobj domobject to be cloned, cleaned and emptied
1270
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1271
+ * @return jQuery wrapper object to be passed to e.g. this.applyMarkup(...)
1272
+ * @hide
1273
+ */
1274
+ getClonedMarkup4Wrapping: function (domobj) {
1275
+ var wrapper = jQuery(domobj.outerHTML).removeClass('preparedForRemoval').empty();
1276
+ if (wrapper.attr('class').length === 0) {
1277
+ wrapper.removeAttr('class');
1278
+ }
1279
+ return wrapper;
1280
+ },
1281
+
1282
+ /**
1283
+ * method used to subtract the range object from existing markup. in other words: certain markup is removed from the selections defined by the rangeObject
1284
+ * @param relevantMarkupObjects JS Array of dom objects effecting either the start or endContainer of a selection (which should be extended)
1285
+ * @param rangeObject Aloha rangeObject the markups should be removed from
1286
+ * @param startOrEnd boolean; defines, if the existing markups should be reduced at the beginning of the tag or at the end (is propably redundant and could be found out by comparing start or end container with the markup array dom objects)
1287
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1288
+ * @return true
1289
+ * @hide
1290
+ */
1291
+ insertCroppedMarkups: function (relevantMarkupObjects, rangeObject, startOrEnd, tagComparator) {
1292
+ var cropMarkupsAtEnd, cropMarkupsAtStart, textnodes, objects, i, el, textNodes;
1293
+ if (!startOrEnd) { // = Start
1294
+ // start part of rangeObject should be used, therefor existing markups are cropped at the end
1295
+ cropMarkupsAtEnd = true;
1296
+ } else { // = End
1297
+ // end part of rangeObject should be used, therefor existing markups are cropped at start (beginning)
1298
+ cropMarkupsAtStart = true;
1299
+ }
1300
+ objects = [];
1301
+ for (i = 0; i < relevantMarkupObjects.length; i++) {
1302
+ objects[i] = new this.SelectionRange();
1303
+ el = relevantMarkupObjects[i];
1304
+ if (cropMarkupsAtEnd && !cropMarkupsAtStart) {
1305
+ textNodes = jQuery(el).textNodes(true);
1306
+ objects[i].startContainer = textNodes[0];
1307
+ objects[i].startOffset = 0;
1308
+ // if the existing markup startContainer & startOffset are equal to the rangeObject startContainer and startOffset,
1309
+ // then markupobject does not have to be added again, because it would have no content (zero-length)
1310
+ if (objects[i].startContainer === rangeObject.startContainer && objects[i].startOffset === rangeObject.startOffset) {
1311
+ continue;
1312
+ }
1313
+ if (rangeObject.startOffset === 0) {
1314
+ objects[i].endContainer = this.getTextNodeSibling(false, el, rangeObject.startContainer);
1315
+ objects[i].endOffset = objects[i].endContainer.length;
1316
+ } else {
1317
+ objects[i].endContainer = rangeObject.startContainer;
1318
+ objects[i].endOffset = rangeObject.startOffset;
1319
+ }
1320
+
1321
+ objects[i].update();
1322
+
1323
+ this.applyMarkup(objects[i].getSelectionTree(), rangeObject, this.getClonedMarkup4Wrapping(el), tagComparator, {
1324
+ setRangeObject2NextSibling: true
1325
+ });
1326
+ }
1327
+
1328
+ if (!cropMarkupsAtEnd && cropMarkupsAtStart) {
1329
+ objects[i].startContainer = rangeObject.endContainer; // jQuery(el).contents()[0];
1330
+ objects[i].startOffset = rangeObject.endOffset;
1331
+ textnodes = jQuery(el).textNodes(true);
1332
+ objects[i].endContainer = textnodes[textnodes.length - 1];
1333
+ objects[i].endOffset = textnodes[textnodes.length - 1].length;
1334
+ objects[i].update();
1335
+ this.applyMarkup(objects[i].getSelectionTree(), rangeObject, this.getClonedMarkup4Wrapping(el), tagComparator, {
1336
+ setRangeObject2PreviousSibling: true
1337
+ });
1338
+ }
1339
+ }
1340
+ return true;
1341
+ },
1342
+
1343
+ /**
1344
+ * apply a certain markup to the current selection
1345
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1346
+ * @return void
1347
+ * @hide
1348
+ */
1349
+ changeMarkupOnSelection: function (markupObject) {
1350
+ var rangeObject = this.getRangeObject();
1351
+
1352
+ // change the markup
1353
+ this.changeMarkup(rangeObject, markupObject, this.getStandardTagComparator(markupObject));
1354
+
1355
+ // merge text nodes
1356
+ GENTICS.Utils.Dom.doCleanup({
1357
+ 'merge': true
1358
+ }, rangeObject);
1359
+
1360
+ // update the range and select it
1361
+ rangeObject.update();
1362
+ rangeObject.select();
1363
+ this.rangeObject = rangeObject;
1364
+ },
1365
+
1366
+ /**
1367
+ * apply a certain markup to the selection Tree
1368
+ * @param selectionTree SelectionTree Object markup should be applied to
1369
+ * @param rangeObject Aloha rangeObject which will be modified to reflect the dom changes, after the markup was applied (only if activated via options)
1370
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1371
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1372
+ * @param options JS object, with the following boolean properties: setRangeObject2NewMarkup, setRangeObject2NextSibling, setRangeObject2PreviousSibling
1373
+ * @return void
1374
+ * @hide
1375
+ */
1376
+ applyMarkup: function (selectionTree, rangeObject, markupObject, tagComparator, options) {
1377
+ var optimizedSelectionTree, i, el, breakpoint;
1378
+ options = options || {};
1379
+ // first same tags from within fully selected nodes for removal
1380
+ this.prepareForRemoval(selectionTree, markupObject, tagComparator);
1381
+
1382
+ // first let's optimize the selection Tree in useful groups which can be wrapped together
1383
+ optimizedSelectionTree = this.optimizeSelectionTree4Markup(selectionTree, markupObject, tagComparator);
1384
+ breakpoint = true;
1385
+
1386
+ // now iterate over grouped elements and either recursively dive into object or wrap it as a whole
1387
+ for (i = 0; i < optimizedSelectionTree.length; i++) {
1388
+ el = optimizedSelectionTree[i];
1389
+ if (el.wrappable) {
1390
+ this.wrapMarkupAroundSelectionTree(el.elements, rangeObject, markupObject, tagComparator, options);
1391
+ } else {
1392
+ Aloha.Log.debug(this, 'dive further into non-wrappable object');
1393
+ this.applyMarkup(el.element.children, rangeObject, markupObject, tagComparator, options);
1394
+ }
1395
+ }
1396
+ },
1397
+
1398
+ /**
1399
+ * returns the type of the given markup (trying to match HTML5)
1400
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1401
+ * @return string name of the markup type
1402
+ * @hide
1403
+ */
1404
+ getMarkupType: function (markupObject) {
1405
+ var nn = jQuery(markupObject)[0].nodeName.toLowerCase();
1406
+ if (markupObject.outerHtml) {
1407
+ Aloha.Log.debug(this, 'Node name detected: ' + nn + ' for: ' + markupObject.outerHtml());
1408
+ }
1409
+ if (nn == '#text') {
1410
+ return 'textNode';
1411
+ }
1412
+ if (this.replacingElements[nn]) {
1413
+ return 'sectionOrGroupingContent';
1414
+ }
1415
+ if (this.tagHierarchy[nn]) {
1416
+ return 'textLevelSemantics';
1417
+ }
1418
+ Aloha.Log.warn(this, 'unknown markup passed to this.getMarkupType(...): ' + markupObject.outerHtml());
1419
+ },
1420
+
1421
+ /**
1422
+ * returns the standard tag comparator for the given markup object
1423
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1424
+ * @return function tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1425
+ * @hide
1426
+ */
1427
+ getStandardTagComparator: function (markupObject) {
1428
+ var that = this,
1429
+ result;
1430
+ switch (this.getMarkupType(markupObject)) {
1431
+ case 'textNode':
1432
+ result = function (p1, p2) {
1433
+ return false;
1434
+ };
1435
+ break;
1436
+
1437
+ case 'sectionOrGroupingContent':
1438
+ result = function (domobj, markupObject) {
1439
+ return that.standardSectionsAndGroupingContentComparator(domobj, markupObject);
1440
+ };
1441
+ break;
1442
+
1443
+ //case 'textLevelSemantics' covered by default
1444
+ default:
1445
+ result = function (domobj, markupObject) {
1446
+ return that.standardTextLevelSemanticsComparator(domobj, markupObject);
1447
+ };
1448
+ break;
1449
+ }
1450
+ return result;
1451
+ },
1452
+
1453
+ /**
1454
+ * searches for fully selected equal markup tags
1455
+ * @param selectionTree SelectionTree Object markup should be applied to
1456
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1457
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1458
+ * @return void
1459
+ * @hide
1460
+ */
1461
+ prepareForRemoval: function (selectionTree, markupObject, tagComparator) {
1462
+ var that = this, i, el;
1463
+
1464
+ // check if a comparison method was passed as parameter ...
1465
+ if (typeof tagComparator !== 'undefined' && typeof tagComparator !== 'function') {
1466
+ Aloha.Log.error(this, 'parameter tagComparator is not a function');
1467
+ }
1468
+ // ... if not use this as standard tag comparison method
1469
+ if (typeof tagComparator === 'undefined') {
1470
+ tagComparator = this.getStandardTagComparator(markupObject);
1471
+ }
1472
+ for (i = 0; i < selectionTree.length; i++) {
1473
+ el = selectionTree[i];
1474
+ if (el.domobj && (el.selection == 'full' || (el.selection == 'partial' && markupObject.isReplacingElement))) {
1475
+ // mark for removal
1476
+ if (el.domobj.nodeType === 1 && tagComparator(el.domobj, markupObject)) {
1477
+ Aloha.Log.debug(this, 'Marking for removal: ' + el.domobj.nodeName);
1478
+ jQuery(el.domobj).addClass('preparedForRemoval');
1479
+ }
1480
+ }
1481
+ if (el.selection != 'none' && el.children.length > 0) {
1482
+ this.prepareForRemoval(el.children, markupObject, tagComparator);
1483
+ }
1484
+
1485
+ }
1486
+ },
1487
+
1488
+ /**
1489
+ * searches for fully selected equal markup tags
1490
+ * @param selectionTree SelectionTree Object markup should be applied to
1491
+ * @param rangeObject Aloha rangeObject the markup will be applied to
1492
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1493
+ * @param tagComparator method, which is used to compare the dom object and the jQuery markup object. the method must accept 2 parameters, the first is the domobj, the second is the jquery object. if no method is specified, the method this.standardTextLevelSemanticsComparator is used
1494
+ * @param options JS object, with the following boolean properties: setRangeObject2NewMarkup, setRangeObject2NextSibling, setRangeObject2PreviousSibling
1495
+ * @return void
1496
+ * @hide
1497
+ */
1498
+ wrapMarkupAroundSelectionTree: function (selectionTree, rangeObject, markupObject, tagComparator, options) {
1499
+ // first let's find out if theoretically the whole selection can be wrapped with one tag and save it for later use
1500
+ var objects2wrap = [], // // this will be used later to collect objects
1501
+ j = -1, // internal counter,
1502
+ breakpoint = true,
1503
+ preText = '',
1504
+ postText = '',
1505
+ prevOrNext,
1506
+ textNode2Start,
1507
+ textnodes,
1508
+ newMarkup,
1509
+ i,
1510
+ el,
1511
+ middleText;
1512
+
1513
+ Aloha.Log.debug(this, 'The formatting <' + markupObject[0].tagName + '> will be wrapped around the selection');
1514
+
1515
+ // now lets iterate over the elements
1516
+ for (i = 0; i < selectionTree.length; i++) {
1517
+ el = selectionTree[i];
1518
+
1519
+ // check if markup is allowed inside the elements parent
1520
+ if (el.domobj && !this.canTag1WrapTag2(el.domobj.parentNode.tagName.toLowerCase(), markupObject[0].tagName.toLowerCase())) {
1521
+ Aloha.Log.info(this, 'Skipping the wrapping of <' + markupObject[0].tagName.toLowerCase() + '> because this tag is not allowed inside <' + el.domobj.parentNode.tagName.toLowerCase() + '>');
1522
+ continue;
1523
+ }
1524
+
1525
+ // skip empty text nodes
1526
+ if (el.domobj && el.domobj.nodeType === 3 && jQuery.trim(el.domobj.nodeValue).length === 0) {
1527
+ continue;
1528
+ }
1529
+
1530
+ // partial element, can either be a textnode and therefore be wrapped (at least partially)
1531
+ // or can be a nodeType == 1 (tag) which must be dived into
1532
+ if (el.domobj && el.selection == 'partial' && !markupObject.isReplacingElement) {
1533
+ if (el.startOffset !== undefined && el.endOffset === undefined) {
1534
+ j++;
1535
+ preText += el.domobj.data.substr(0, el.startOffset);
1536
+ el.domobj.data = el.domobj.data.substr(el.startOffset, el.domobj.data.length - el.startOffset);
1537
+ objects2wrap[j] = el.domobj;
1538
+ } else if (el.endOffset !== undefined && el.startOffset === undefined) {
1539
+ j++;
1540
+ postText += el.domobj.data.substr(el.endOffset, el.domobj.data.length - el.endOffset);
1541
+ el.domobj.data = el.domobj.data.substr(0, el.endOffset);
1542
+ objects2wrap[j] = el.domobj;
1543
+ } else if (el.endOffset !== undefined && el.startOffset !== undefined) {
1544
+ if (el.startOffset == el.endOffset) { // do not wrap empty selections
1545
+ Aloha.Log.debug(this, 'skipping empty selection');
1546
+ continue;
1547
+ }
1548
+ j++;
1549
+ preText += el.domobj.data.substr(0, el.startOffset);
1550
+ middleText = el.domobj.data.substr(el.startOffset, el.endOffset - el.startOffset);
1551
+ postText += el.domobj.data.substr(el.endOffset, el.domobj.data.length - el.endOffset);
1552
+ el.domobj.data = middleText;
1553
+ objects2wrap[j] = el.domobj;
1554
+ } else {
1555
+ // a partially selected item without selectionStart/EndOffset is a nodeType 1 Element on the way to the textnode
1556
+ Aloha.Log.debug(this, 'diving into object');
1557
+ this.applyMarkup(el.children, rangeObject, markupObject, tagComparator, options);
1558
+ }
1559
+ }
1560
+ // fully selected dom elements can be wrapped as whole element
1561
+ if (el.domobj && (el.selection == 'full' || (el.selection == 'partial' && markupObject.isReplacingElement))) {
1562
+ j++;
1563
+ objects2wrap[j] = el.domobj;
1564
+ }
1565
+ }
1566
+
1567
+ if (objects2wrap.length > 0) {
1568
+ // wrap collected DOM object with markupObject
1569
+ objects2wrap = jQuery(objects2wrap);
1570
+
1571
+ // make a fix for text nodes in <li>'s in ie
1572
+ jQuery.each(objects2wrap, function (index, element) {
1573
+ if (jQuery.browser.msie && element.nodeType == 3 && !element.nextSibling && !element.previousSibling && element.parentNode && element.parentNode.nodeName.toLowerCase() == 'li') {
1574
+ element.data = jQuery.trim(element.data);
1575
+ }
1576
+ });
1577
+
1578
+ newMarkup = objects2wrap.wrapAll(markupObject).parent();
1579
+ newMarkup.before(preText).after(postText);
1580
+
1581
+ if (options.setRangeObject2NewMarkup) { // this is used, when markup is added to normal/normal Text
1582
+ textnodes = objects2wrap.textNodes();
1583
+
1584
+ if (textnodes.index(rangeObject.startContainer) != -1) {
1585
+ rangeObject.startOffset = 0;
1586
+ }
1587
+ if (textnodes.index(rangeObject.endContainer) != -1) {
1588
+ rangeObject.endOffset = rangeObject.endContainer.length;
1589
+ }
1590
+ breakpoint = true;
1591
+ }
1592
+ if (options.setRangeObject2NextSibling) {
1593
+ prevOrNext = true;
1594
+ textNode2Start = newMarkup.textNodes(true).last()[0];
1595
+ if (objects2wrap.index(rangeObject.startContainer) != -1) {
1596
+ rangeObject.startContainer = this.getTextNodeSibling(prevOrNext, newMarkup.parent(), textNode2Start);
1597
+ rangeObject.startOffset = 0;
1598
+ }
1599
+ if (objects2wrap.index(rangeObject.endContainer) != -1) {
1600
+ rangeObject.endContainer = this.getTextNodeSibling(prevOrNext, newMarkup.parent(), textNode2Start);
1601
+ rangeObject.endOffset = rangeObject.endOffset - textNode2Start.length;
1602
+ }
1603
+ }
1604
+ if (options.setRangeObject2PreviousSibling) {
1605
+ prevOrNext = false;
1606
+ textNode2Start = newMarkup.textNodes(true).first()[0];
1607
+ if (objects2wrap.index(rangeObject.startContainer) != -1) {
1608
+ rangeObject.startContainer = this.getTextNodeSibling(prevOrNext, newMarkup.parent(), textNode2Start);
1609
+ rangeObject.startOffset = 0;
1610
+ }
1611
+ if (objects2wrap.index(rangeObject.endContainer) != -1) {
1612
+ rangeObject.endContainer = this.getTextNodeSibling(prevOrNext, newMarkup.parent(), textNode2Start);
1613
+ rangeObject.endOffset = rangeObject.endContainer.length;
1614
+ }
1615
+ }
1616
+ }
1617
+ },
1618
+
1619
+ /**
1620
+ * takes a text node and return either the next recursive text node sibling or the previous
1621
+ * @param previousOrNext boolean, false for previous, true for next sibling
1622
+ * @param commonAncestorContainer dom object to be used as root for the sibling search
1623
+ * @param currentTextNode dom object of the originating text node
1624
+ * @return dom object of the sibling text node
1625
+ * @hide
1626
+ */
1627
+ getTextNodeSibling: function (previousOrNext, commonAncestorContainer, currentTextNode) {
1628
+ var textNodes = jQuery(commonAncestorContainer).textNodes(true), newIndex, index;
1629
+
1630
+ index = textNodes.index(currentTextNode);
1631
+ if (index == -1) { // currentTextNode was not found
1632
+ return false;
1633
+ }
1634
+ newIndex = index + (!previousOrNext ? -1 : 1);
1635
+ return textNodes[newIndex] || false;
1636
+ },
1637
+
1638
+ /**
1639
+ * takes a selection tree and groups it into markup wrappable selection trees
1640
+ * @param selectionTree rangeObject selection tree
1641
+ * @param markupObject jQuery object of the markup to be applied (e.g. created with obj = jQuery('<b></b>'); )
1642
+ * @return JS array of wrappable selection trees
1643
+ * @hide
1644
+ */
1645
+ optimizeSelectionTree4Markup: function (selectionTree, markupObject, tagComparator) {
1646
+ var groupMap = [],
1647
+ outerGroupIndex = 0,
1648
+ innerGroupIndex = 0,
1649
+ that = this,
1650
+ i,
1651
+ j,
1652
+ endPosition,
1653
+ startPosition;
1654
+
1655
+ if (typeof tagComparator === 'undefined') {
1656
+ tagComparator = function (domobj, markupObject) {
1657
+ return that.standardTextLevelSemanticsComparator(markupObject);
1658
+ };
1659
+ }
1660
+ for (i = 0; i < selectionTree.length; i++) {
1661
+ // we are just interested in selected item, but not in non-selected items
1662
+ if (selectionTree[i].domobj && selectionTree[i].selection != 'none') {
1663
+ if (markupObject.isReplacingElement && tagComparator(markupObject[0], jQuery(selectionTree[i].domobj))) {
1664
+ if (groupMap[outerGroupIndex] !== undefined) {
1665
+ outerGroupIndex++;
1666
+ }
1667
+ groupMap[outerGroupIndex] = {};
1668
+ groupMap[outerGroupIndex].wrappable = true;
1669
+ groupMap[outerGroupIndex].elements = [];
1670
+ groupMap[outerGroupIndex].elements[innerGroupIndex] = selectionTree[i];
1671
+ outerGroupIndex++;
1672
+
1673
+ } else if (this.canMarkupBeApplied2ElementAsWhole([selectionTree[i]], markupObject)) {
1674
+ // now check, if the children of our item could be wrapped all together by the markup object
1675
+ // if yes, add it to the current group
1676
+ if (groupMap[outerGroupIndex] === undefined) {
1677
+ groupMap[outerGroupIndex] = {};
1678
+ groupMap[outerGroupIndex].wrappable = true;
1679
+ groupMap[outerGroupIndex].elements = [];
1680
+ }
1681
+ if (markupObject.isReplacingElement) { // && selectionTree[i].domobj.nodeType === 3
1682
+ /* we found the node to wrap for a replacing element. however there might
1683
+ * be siblings which should be included as well
1684
+ * although they are actually not selected. example:
1685
+ * li
1686
+ * |-textNode ( .selection = 'none')
1687
+ * |-textNode (cursor inside, therefor .selection = 'partial')
1688
+ * |-textNode ( .selection = 'none')
1689
+ *
1690
+ * in this case it would be useful to select the previous and following textNodes as well (they might result from a previous DOM manipulation)
1691
+ * Think about other cases, where the parent is the Editable. In this case we propably only want to select from and until the next <br /> ??
1692
+ * .... many possibilities, here I realize the two described cases
1693
+ */
1694
+
1695
+ // first find start element starting from the current element going backwards until sibling 0
1696
+ startPosition = i;
1697
+ for (j = i - 1; j >= 0; j--) {
1698
+ if (this.canMarkupBeApplied2ElementAsWhole([selectionTree[j]], markupObject) && this.isMarkupAllowedToStealSelectionTreeElement(selectionTree[j], markupObject)) {
1699
+ startPosition = j;
1700
+ } else {
1701
+ break;
1702
+ }
1703
+ }
1704
+
1705
+ // now find the end element starting from the current element going forward until the last sibling
1706
+ endPosition = i;
1707
+ for (j = i + 1; j < selectionTree.length; j++) {
1708
+ if (this.canMarkupBeApplied2ElementAsWhole([selectionTree[j]], markupObject) && this.isMarkupAllowedToStealSelectionTreeElement(selectionTree[j], markupObject)) {
1709
+ endPosition = j;
1710
+ } else {
1711
+ break;
1712
+ }
1713
+ }
1714
+
1715
+ // now add the elements to the groupMap
1716
+ innerGroupIndex = 0;
1717
+ for (j = startPosition; j <= endPosition; j++) {
1718
+ groupMap[outerGroupIndex].elements[innerGroupIndex] = selectionTree[j];
1719
+ groupMap[outerGroupIndex].elements[innerGroupIndex].selection = 'full';
1720
+ innerGroupIndex++;
1721
+ }
1722
+ innerGroupIndex = 0;
1723
+ } else {
1724
+ // normal text level semantics object, no siblings need to be selected
1725
+ groupMap[outerGroupIndex].elements[innerGroupIndex] = selectionTree[i];
1726
+ innerGroupIndex++;
1727
+ }
1728
+ } else {
1729
+ // if no, isolate it in its own group
1730
+ if (groupMap[outerGroupIndex] !== undefined) {
1731
+ outerGroupIndex++;
1732
+ }
1733
+ groupMap[outerGroupIndex] = {};
1734
+ groupMap[outerGroupIndex].wrappable = false;
1735
+ groupMap[outerGroupIndex].element = selectionTree[i];
1736
+ innerGroupIndex = 0;
1737
+ outerGroupIndex++;
1738
+ }
1739
+ }
1740
+ }
1741
+ return groupMap;
1742
+ },
1743
+
1744
+ /**
1745
+ * very tricky method, which decides, if a certain markup (normally a replacing markup element like p, h1, blockquote)
1746
+ * is allowed to extend the user selection to other dom objects (represented as selectionTreeElement)
1747
+ * to understand the purpose: if the user selection is collapsed inside e.g. some text, which is currently not
1748
+ * wrapped by the markup to be applied, and therefor the markup does not have an equal markup to replace, then the DOM
1749
+ * manipulator has to decide which objects to wrap. real example:
1750
+ * <div>
1751
+ * <h1>headline</h1>
1752
+ * some text blabla bla<br>
1753
+ * more text HERE THE | CURSOR BLINKING and <b>even more bold text</b>
1754
+ * </div>
1755
+ * when the user now wants to apply e.g. a <p> tag, what will be wrapped? it could be useful if the manipulator would actually
1756
+ * wrap everything inside the div except the <h1>. but for this purpose someone has to decide, if the markup is
1757
+ * allowed to wrap certain dom elements in this case the question would be, if the <p> is allowed to wrap
1758
+ * textNodes, <br> and <b> and <h1>. therefore this tricky method should answer the question for those 3 elements
1759
+ * with true, but for for the <h1> it should return false. and since the method does not know this, there is a configuration
1760
+ * for this
1761
+ *
1762
+ * @param selectionTree rangeObject selection tree element (only one, not an array of)
1763
+ * @param markupObject lowercase string of the tag to be verified (e.g. "b")
1764
+ * @return true if the markup is allowed to wrap the selection tree element, false otherwise
1765
+ * @hide
1766
+ */
1767
+ isMarkupAllowedToStealSelectionTreeElement: function (selectionTreeElement, markupObject) {
1768
+ if (!selectionTreeElement.domobj) {
1769
+ return false;
1770
+ }
1771
+ var maybeTextNodeName = selectionTreeElement.domobj.nodeName.toLowerCase(),
1772
+ nodeName = (maybeTextNodeName == '#text') ? 'textNode' : maybeTextNodeName,
1773
+ markupName = markupObject[0].nodeName.toLowerCase(),
1774
+ elemMap = this.allowedToStealElements[markupName];
1775
+ return elemMap && elemMap[nodeName];
1776
+ },
1777
+
1778
+ /**
1779
+ * checks if a selection can be completey wrapped by a certain html tags (helper method for this.optimizeSelectionTree4Markup
1780
+ * @param selectionTree rangeObject selection tree
1781
+ * @param markupObject lowercase string of the tag to be verified (e.g. "b")
1782
+ * @return true if selection can be applied as whole, false otherwise
1783
+ * @hide
1784
+ */
1785
+ canMarkupBeApplied2ElementAsWhole: function (selectionTree, markupObject) {
1786
+ var htmlTag, i, el, returnVal;
1787
+
1788
+ if (markupObject.jquery) {
1789
+ htmlTag = markupObject[0].tagName;
1790
+ }
1791
+ if (markupObject.tagName) {
1792
+ htmlTag = markupObject.tagName;
1793
+ }
1794
+
1795
+ returnVal = true;
1796
+ for (i = 0; i < selectionTree.length; i++) {
1797
+ el = selectionTree[i];
1798
+ if (el.domobj && (el.selection != "none" || markupObject.isReplacingElement)) {
1799
+ // Aloha.Log.debug(this, 'Checking, if <' + htmlTag + '> can be applied to ' + el.domobj.nodeName);
1800
+ if (!this.canTag1WrapTag2(htmlTag, el.domobj.nodeName)) {
1801
+ return false;
1802
+ }
1803
+ if (el.children.length > 0 && !this.canMarkupBeApplied2ElementAsWhole(el.children, markupObject)) {
1804
+ return false;
1805
+ }
1806
+ }
1807
+ }
1808
+ return returnVal;
1809
+ },
1810
+
1811
+ /**
1812
+ * checks if a tag 1 (first parameter) can wrap tag 2 (second parameter).
1813
+ * IMPORTANT: the method does not verify, if there have to be other tags in between
1814
+ * Example: this.canTag1WrapTag2("table", "td") will return true, because the method does not take into account, that there has to be a "tr" in between
1815
+ * @param t1 string: tagname of outer tag to verify, e.g. "b"
1816
+ * @param t2 string: tagname of inner tag to verify, e.g. "b"
1817
+ * @return true if tag 1 can wrap tag 2, false otherwise
1818
+ * @hide
1819
+ */
1820
+ canTag1WrapTag2: function (t1, t2) {
1821
+ t1 = (t1 == '#text') ? 'textNode' : t1.toLowerCase();
1822
+ t2 = (t2 == '#text') ? 'textNode' : t2.toLowerCase();
1823
+ var t1Map = this.tagHierarchy[t1];
1824
+ if (!t1Map) {
1825
+ return true;
1826
+ }
1827
+ if (!this.tagHierarchy[t2]) {
1828
+ return true;
1829
+ }
1830
+ return t1Map[t2];
1831
+ },
1832
+
1833
+ /**
1834
+ * Check whether it is allowed to insert the given tag at the start of the
1835
+ * current selection. This method will check whether the markup effective for
1836
+ * the start and outside of the editable part (starting with the editable tag
1837
+ * itself) may wrap the given tag.
1838
+ * @param tagName {String} name of the tag which shall be inserted
1839
+ * @return true when it is allowed to insert that tag, false if not
1840
+ * @hide
1841
+ */
1842
+ mayInsertTag: function (tagName) {
1843
+ var i;
1844
+ if (typeof this.rangeObject.unmodifiableMarkupAtStart == 'object') {
1845
+ // iterate over all DOM elements outside of the editable part
1846
+ for (i = 0; i < this.rangeObject.unmodifiableMarkupAtStart.length; ++i) {
1847
+ // check whether an element may not wrap the given
1848
+ if (!this.canTag1WrapTag2(this.rangeObject.unmodifiableMarkupAtStart[i].nodeName, tagName)) {
1849
+ // found a DOM element which forbids to insert the given tag, we are done
1850
+ return false;
1851
+ }
1852
+ }
1853
+
1854
+ // all of the found DOM elements allow inserting the given tag
1855
+ return true;
1856
+ }
1857
+ Aloha.Log.warn(this, 'Unable to determine whether tag ' + tagName + ' may be inserted');
1858
+ return true;
1859
+ },
1860
+
1861
+ /**
1862
+ * String representation
1863
+ * @return "Aloha.Selection"
1864
+ * @hide
1865
+ */
1866
+ toString: function () {
1867
+ return 'Aloha.Selection';
1868
+ },
1869
+
1870
+ /**
1871
+ * @namespace Aloha.Selection
1872
+ * @class SelectionRange
1873
+ * @extends GENTICS.Utils.RangeObject
1874
+ * Constructor for a range object.
1875
+ * Optionally you can pass in a range object that's properties will be assigned to the new range object.
1876
+ * @param rangeObject A range object thats properties will be assigned to the new range object.
1877
+ * @constructor
1878
+ */
1879
+ SelectionRange: GENTICS.Utils.RangeObject.extend({
1880
+ _constructor: function (rangeObject) {
1881
+ this._super(rangeObject);
1882
+ // If a range object was passed in we apply the values to the new range object
1883
+ if (rangeObject) {
1884
+ if (rangeObject.commonAncestorContainer) {
1885
+ this.commonAncestorContainer = rangeObject.commonAncestorContainer;
1886
+ }
1887
+ if (rangeObject.selectionTree) {
1888
+ this.selectionTree = rangeObject.selectionTree;
1889
+ }
1890
+ if (rangeObject.limitObject) {
1891
+ this.limitObject = rangeObject.limitObject;
1892
+ }
1893
+ if (rangeObject.markupEffectiveAtStart) {
1894
+ this.markupEffectiveAtStart = rangeObject.markupEffectiveAtStart;
1895
+ }
1896
+ if (rangeObject.unmodifiableMarkupAtStart) {
1897
+ this.unmodifiableMarkupAtStart = rangeObject.unmodifiableMarkupAtStart;
1898
+ }
1899
+ if (rangeObject.splitObject) {
1900
+ this.splitObject = rangeObject.splitObject;
1901
+ }
1902
+ }
1903
+ },
1904
+
1905
+ /**
1906
+ * DOM object of the common ancestor from startContainer and endContainer
1907
+ * @hide
1908
+ */
1909
+ commonAncestorContainer: undefined,
1910
+
1911
+ /**
1912
+ * The selection tree
1913
+ * @hide
1914
+ */
1915
+ selectionTree: undefined,
1916
+
1917
+ /**
1918
+ * Array of DOM objects effective for the start container and inside the
1919
+ * editable part (inside the limit object). relevant for the button status
1920
+ * @hide
1921
+ */
1922
+ markupEffectiveAtStart: [],
1923
+
1924
+ /**
1925
+ * Array of DOM objects effective for the start container, which lies
1926
+ * outside of the editable portion (starting with the limit object)
1927
+ * @hide
1928
+ */
1929
+ unmodifiableMarkupAtStart: [],
1930
+
1931
+ /**
1932
+ * DOM object being the limit for all markup relevant activities
1933
+ * @hide
1934
+ */
1935
+ limitObject: undefined,
1936
+
1937
+ /**
1938
+ * DOM object being split when enter key gets hit
1939
+ * @hide
1940
+ */
1941
+ splitObject: undefined,
1942
+
1943
+ /**
1944
+ * Sets the visible selection in the Browser based on the range object.
1945
+ * If the selection is collapsed, this will result in a blinking cursor,
1946
+ * otherwise in a text selection.
1947
+ * @method
1948
+ */
1949
+ select: function () {
1950
+ // Call Utils' select()
1951
+ this._super();
1952
+
1953
+ // update the selection
1954
+ Aloha.Selection.updateSelection();
1955
+ },
1956
+
1957
+ /**
1958
+ * Method to update a range object internally
1959
+ * @param commonAncestorContainer (DOM Object); optional Parameter; if set, the parameter
1960
+ * will be used instead of the automatically calculated CAC
1961
+ * @return void
1962
+ * @hide
1963
+ */
1964
+ update: function (commonAncestorContainer) {
1965
+ this.updatelimitObject();
1966
+ this.updateMarkupEffectiveAtStart();
1967
+ this.updateCommonAncestorContainer(commonAncestorContainer);
1968
+
1969
+ // reset the selectiontree (must be recalculated)
1970
+ this.selectionTree = undefined;
1971
+ },
1972
+
1973
+ /**
1974
+ * Get the selection tree for this range
1975
+ * TODO: remove this (was moved to range.js)
1976
+ * @return selection tree
1977
+ * @hide
1978
+ */
1979
+ getSelectionTree: function () {
1980
+ // if not yet calculated, do this now
1981
+ if (!this.selectionTree) {
1982
+ this.selectionTree = Aloha.Selection.getSelectionTree(this);
1983
+ }
1984
+
1985
+ return this.selectionTree;
1986
+ },
1987
+
1988
+ /**
1989
+ * TODO: move this to range.js
1990
+ * Get an array of domobj (in dom tree order) of siblings of the given domobj, which are contained in the selection
1991
+ * @param domobj dom object to start with
1992
+ * @return array of siblings of the given domobj, which are also selected
1993
+ * @hide
1994
+ */
1995
+ getSelectedSiblings: function (domobj) {
1996
+ var selectionTree = this.getSelectionTree();
1997
+
1998
+ return this.recursionGetSelectedSiblings(domobj, selectionTree);
1999
+ },
2000
+
2001
+ /**
2002
+ * TODO: move this to range.js
2003
+ * Recursive method to find the selected siblings of the given domobj (which should be selected as well)
2004
+ * @param domobj dom object for which the selected siblings shall be found
2005
+ * @param selectionTree current level of the selection tree
2006
+ * @return array of selected siblings of dom objects or false if none found
2007
+ * @hide
2008
+ */
2009
+ recursionGetSelectedSiblings: function (domobj, selectionTree) {
2010
+ var selectedSiblings = false,
2011
+ foundObj = false,
2012
+ i;
2013
+
2014
+ for (i = 0; i < selectionTree.length; ++i) {
2015
+ if (selectionTree[i].domobj === domobj) {
2016
+ foundObj = true;
2017
+ selectedSiblings = [];
2018
+ } else if (!foundObj && selectionTree[i].children) {
2019
+ // do the recursion
2020
+ selectedSiblings = this.recursionGetSelectedSiblings(domobj, selectionTree[i].children);
2021
+ if (selectedSiblings !== false) {
2022
+ break;
2023
+ }
2024
+ } else if (foundObj && selectionTree[i].domobj && selectionTree[i].selection != 'collapsed' && selectionTree[i].selection != 'none') {
2025
+ selectedSiblings.push(selectionTree[i].domobj);
2026
+ } else if (foundObj && selectionTree[i].selection == 'none') {
2027
+ break;
2028
+ }
2029
+ }
2030
+
2031
+ return selectedSiblings;
2032
+ },
2033
+
2034
+ /**
2035
+ * TODO: move this to range.js
2036
+ * Method updates member var markupEffectiveAtStart and splitObject, which is relevant primarily for button status and enter key behaviour
2037
+ * @return void
2038
+ * @hide
2039
+ */
2040
+ updateMarkupEffectiveAtStart: function () {
2041
+ // reset the current markup
2042
+ this.markupEffectiveAtStart = [];
2043
+ this.unmodifiableMarkupAtStart = [];
2044
+
2045
+ var parents = this.getStartContainerParents(),
2046
+ limitFound = false,
2047
+ splitObjectWasSet,
2048
+ i,
2049
+ el;
2050
+
2051
+ for (i = 0; i < parents.length; i++) {
2052
+ el = parents[i];
2053
+ if (!limitFound && (el !== this.limitObject)) {
2054
+ this.markupEffectiveAtStart[i] = el;
2055
+ if (!splitObjectWasSet && GENTICS.Utils.Dom.isSplitObject(el)) {
2056
+ splitObjectWasSet = true;
2057
+ this.splitObject = el;
2058
+ }
2059
+ } else {
2060
+ limitFound = true;
2061
+ this.unmodifiableMarkupAtStart.push(el);
2062
+ }
2063
+ }
2064
+ if (!splitObjectWasSet) {
2065
+ this.splitObject = false;
2066
+ }
2067
+ return;
2068
+ },
2069
+
2070
+ /**
2071
+ * TODO: remove this
2072
+ * Method updates member var markupEffectiveAtStart, which is relevant primarily for button status
2073
+ * @return void
2074
+ * @hide
2075
+ */
2076
+ updatelimitObject: function () {
2077
+ if (Aloha.editables && Aloha.editables.length > 0) {
2078
+ var parents = this.getStartContainerParents(),
2079
+ editables = Aloha.editables,
2080
+ i,
2081
+ el,
2082
+ j,
2083
+ editable;
2084
+ for (i = 0; i < parents.length; i++) {
2085
+ el = parents[i];
2086
+ for (j = 0; j < editables.length; j++) {
2087
+ editable = editables[j].obj[0];
2088
+ if (el === editable) {
2089
+ this.limitObject = el;
2090
+ return true;
2091
+ }
2092
+ }
2093
+ }
2094
+ }
2095
+ this.limitObject = jQuery('body');
2096
+ return true;
2097
+ },
2098
+
2099
+ /**
2100
+ * string representation of the range object
2101
+ * @param verbose set to true for verbose output
2102
+ * @return string representation of the range object
2103
+ * @hide
2104
+ */
2105
+ toString: function (verbose) {
2106
+ if (!verbose) {
2107
+ return 'Aloha.Selection.SelectionRange';
2108
+ }
2109
+ return 'Aloha.Selection.SelectionRange {start [' + this.startContainer.nodeValue + '] offset ' + this.startOffset + ', end [' + this.endContainer.nodeValue + '] offset ' + this.endOffset + '}';
2110
+ }
2111
+
2112
+ }) // SelectionRange
2113
+
2114
+ }); // Selection
2115
+
2116
+
2117
+ /**
2118
+ * This method implements an ugly workaround for a selection problem in ie:
2119
+ * when the cursor shall be placed at the end of a text node in a li element, that is followed by a nested list,
2120
+ * the selection would always snap into the first li of the nested list
2121
+ * therefore, we make sure that the text node ends with a space and place the cursor right before it
2122
+ */
2123
+ function nestedListInIEWorkaround(range) {
2124
+ var nextSibling;
2125
+ if (jQuery.browser.msie && range.startContainer === range.endContainer && range.startOffset === range.endOffset && range.startContainer.nodeType == 3 && range.startOffset == range.startContainer.data.length && range.startContainer.nextSibling) {
2126
+ nextSibling = range.startContainer.nextSibling;
2127
+ if ('OL' === nextSibling.nodeName || 'UL' === nextSibling.nodeName) {
2128
+ if (range.startContainer.data[range.startContainer.data.length - 1] == ' ') {
2129
+ range.startOffset = range.endOffset = range.startOffset - 1;
2130
+ } else {
2131
+ range.startContainer.data = range.startContainer.data + ' ';
2132
+ }
2133
+ }
2134
+ }
2135
+ }
2136
+
2137
+ function correctRange(range) {
2138
+ nestedListInIEWorkaround(range);
2139
+ return range;
2140
+ }
2141
+
2142
+ /**
2143
+ * Implements Selection http://html5.org/specs/dom-range.html#selection
2144
+ * @namespace Aloha
2145
+ * @class Selection This singleton class always represents the
2146
+ * current user selection
2147
+ * @singleton
2148
+ */
2149
+ var AlohaSelection = Class.extend({
2150
+
2151
+ _constructor: function (nativeSelection) {
2152
+
2153
+ this._nativeSelection = nativeSelection;
2154
+ this.ranges = [];
2155
+
2156
+ // will remember if urged to not change the selection
2157
+ this.preventChange = false;
2158
+
2159
+ },
2160
+
2161
+ /**
2162
+ * Returns the element that contains the start of the selection. Returns null if there's no selection.
2163
+ * @readonly
2164
+ * @type Node
2165
+ */
2166
+ anchorNode: null,
2167
+
2168
+ /**
2169
+ * Returns the offset of the start of the selection relative to the element that contains the start
2170
+ * of the selection. Returns 0 if there's no selection.
2171
+ * @readonly
2172
+ * @type int
2173
+ */
2174
+ anchorOffset: 0,
2175
+
2176
+ /**
2177
+ * Returns the element that contains the end of the selection.
2178
+ * Returns null if there's no selection.
2179
+ * @readonly
2180
+ * @type Node
2181
+ */
2182
+ focusNode: null,
2183
+
2184
+ /**
2185
+ * Returns the offset of the end of the selection relative to the element that contains the end
2186
+ * of the selection. Returns 0 if there's no selection.
2187
+ * @readonly
2188
+ * @type int
2189
+ */
2190
+ focusOffset: 0,
2191
+
2192
+ /**
2193
+ * Returns true if there's no selection or if the selection is empty. Otherwise, returns false.
2194
+ * @readonly
2195
+ * @type boolean
2196
+ */
2197
+ isCollapsed: false,
2198
+
2199
+ /**
2200
+ * Returns the number of ranges in the selection.
2201
+ * @readonly
2202
+ * @type int
2203
+ */
2204
+ rangeCount: 0,
2205
+
2206
+ /**
2207
+ * Replaces the selection with an empty one at the given position.
2208
+ * @throws a WRONG_DOCUMENT_ERR exception if the given node is in a different document.
2209
+ * @param parentNode Node of new selection
2210
+ * @param offest offest of new Selection in parentNode
2211
+ * @void
2212
+ */
2213
+ collapse: function (parentNode, offset) {
2214
+ this._nativeSelection.collapse(parentNode, offset);
2215
+ },
2216
+
2217
+ /**
2218
+ * Replaces the selection with an empty one at the position of the start of the current selection.
2219
+ * @throws an INVALID_STATE_ERR exception if there is no selection.
2220
+ * @void
2221
+ */
2222
+ collapseToStart: function () {
2223
+ throw "NOT_IMPLEMENTED";
2224
+ },
2225
+
2226
+ /**
2227
+ * @void
2228
+ */
2229
+ extend: function (parentNode, offset) {
2230
+
2231
+ },
2232
+
2233
+ /**
2234
+ * @param alter DOMString
2235
+ * @param direction DOMString
2236
+ * @param granularity DOMString
2237
+ * @void
2238
+ */
2239
+ modify: function (alter, direction, granularity) {
2240
+
2241
+ },
2242
+
2243
+ /**
2244
+ * Replaces the selection with an empty one at the position of the end of the current selection.
2245
+ * @throws an INVALID_STATE_ERR exception if there is no selection.
2246
+ * @void
2247
+ */
2248
+ collapseToEnd: function () {
2249
+ this._nativeSelection.collapseToEnd();
2250
+ },
2251
+
2252
+ /**
2253
+ * Replaces the selection with one that contains all the contents of the given element.
2254
+ * @throws a WRONG_DOCUMENT_ERR exception if the given node is in a different document.
2255
+ * @param parentNode Node the Node fully select
2256
+ * @void
2257
+ */
2258
+ selectAllChildren: function (parentNode) {
2259
+ throw "NOT_IMPLEMENTED";
2260
+ },
2261
+
2262
+ /**
2263
+ * Deletes the contents of the selection
2264
+ */
2265
+ deleteFromDocument: function () {
2266
+ throw "NOT_IMPLEMENTED";
2267
+ },
2268
+
2269
+ /**
2270
+ * NB!
2271
+ * We have serious problem in IE.
2272
+ * The range that we get in IE is not the same as the range we had set,
2273
+ * so even if we normalize it during getRangeAt, in IE, we will be
2274
+ * correcting the range to the "correct" place, but still not the place
2275
+ * where it was originally set.
2276
+ *
2277
+ * Returns the given range.
2278
+ * The getRangeAt(index) method returns the indexth range in the list.
2279
+ * NOTE: Aloha Editor only support 1 range! index can only be 0
2280
+ * @throws INDEX_SIZE_ERR DOM exception if index is less than zero or
2281
+ * greater or equal to the value returned by the rangeCount.
2282
+ * @param index int
2283
+ * @return Range return the selected range from index
2284
+ */
2285
+ getRangeAt: function (index) {
2286
+ return correctRange(this._nativeSelection.getRangeAt(index));
2287
+ //if ( index < 0 || this.rangeCount ) {
2288
+ // throw "INDEX_SIZE_ERR DOM";
2289
+ //}
2290
+ //return this._ranges[index];
2291
+ },
2292
+
2293
+ /**
2294
+ * Adds the given range to the selection.
2295
+ * The addRange(range) method adds the given range Range object to the list of
2296
+ * selections, at the end (so the newly added range is the new last range).
2297
+ * NOTE: Aloha Editor only support 1 range! The added range will replace the
2298
+ * range at index 0
2299
+ * see http://html5.org/specs/dom-range.html#selection note about addRange
2300
+ * @throws an INVALID_NODE_TYPE_ERR exception if the given Range has a boundary point
2301
+ * node that's not a Text or Element node, and an INVALID_MODIFICATION_ERR exception
2302
+ * if it has a boundary point node that doesn't descend from a Document.
2303
+ * @param range Range adds the range to the selection
2304
+ * @void
2305
+ */
2306
+ addRange: function (range) {
2307
+ // set readonly attributes
2308
+ this._nativeSelection.addRange(range);
2309
+ // We will correct the range after rangy has processed the native
2310
+ // selection range, so that our correction will be the final fix on
2311
+ // the range according to the guarentee's that Aloha wants to make
2312
+ this._nativeSelection._ranges[0] = correctRange(range);
2313
+
2314
+ // make sure, the old Aloha selection will be updated (until all implementations use the new AlohaSelection)
2315
+ Aloha.Selection.updateSelection();
2316
+ },
2317
+
2318
+ /**
2319
+ * Removes the given range from the selection, if the range was one of the ones in the selection.
2320
+ * NOTE: Aloha Editor only support 1 range! The added range will replace the
2321
+ * range at with index 0
2322
+ * @param range Range removes the range from the selection
2323
+ * @void
2324
+ */
2325
+ removeRange: function (range) {
2326
+ this._nativeSelection.removeRange();
2327
+ },
2328
+
2329
+ /**
2330
+ * Removes all the ranges in the selection.
2331
+ * @viod
2332
+ */
2333
+ removeAllRanges: function () {
2334
+ this._nativeSelection.removeAllRanges();
2335
+ },
2336
+
2337
+ /**
2338
+ * INFO: Method is used for integration with Gentics
2339
+ * Aloha, has no use otherwise Updates the rangeObject
2340
+ * according to the current user selection Method is
2341
+ * always called on selection change
2342
+ *
2343
+ * @param event
2344
+ * jQuery browser event object
2345
+ * @return true when rangeObject was modified, false
2346
+ * otherwise
2347
+ * @hide
2348
+ */
2349
+ refresh: function (event) {
2350
+
2351
+ },
2352
+
2353
+ /**
2354
+ * String representation
2355
+ *
2356
+ * @return "Aloha.Selection"
2357
+ * @hide
2358
+ */
2359
+ toString: function () {
2360
+ return 'Aloha.Selection';
2361
+ },
2362
+
2363
+ getRangeCount: function () {
2364
+ return this._nativeSelection.rangeCount;
2365
+ }
2366
+
2367
+ });
2368
+
2369
+ /**
2370
+ * A wrapper for the function of the same name in the rangy core-depdency.
2371
+ * This function should be preferred as it hides the global rangy object.
2372
+ * For more information look at the following sites:
2373
+ * http://html5.org/specs/dom-range.html
2374
+ * @param window optional - specifices the window to get the selection of
2375
+ */
2376
+ Aloha.getSelection = function (target) {
2377
+ target = (target !== document || target !== window) ? window : target;
2378
+ // Aloha.Selection.refresh()
2379
+ // implement Aloha Selection
2380
+ // TODO cache
2381
+ return new AlohaSelection(window.rangy.getSelection(target));
2382
+ };
2383
+
2384
+ /**
2385
+ * A wrapper for the function of the same name in the rangy core-depdency.
2386
+ * This function should be preferred as it hides the global rangy object.
2387
+ * Please note: when the range object is not needed anymore,
2388
+ * invoke the detach method on it. It is currently unknown to me why
2389
+ * this is required, but that's what it says in the rangy specification.
2390
+ * For more information look at the following sites:
2391
+ * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
2392
+ * @param document optional - specifies which document to create the range for
2393
+ */
2394
+ Aloha.createRange = function (givenWindow) {
2395
+ return window.rangy.createRange(givenWindow);
2396
+ };
2397
+
2398
+ var selection = new Selection();
2399
+ Aloha.Selection = selection;
2400
+
2401
+ return selection;
2402
+ });