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,86 @@
1
+ define(['util/dom2', 'util/arrays', 'util/strings'], function (Dom, Arrays, Strings) {
2
+ 'use strict';
3
+
4
+ function insert(range) {
5
+ var leftMarkerChar = (3 === range.startContainer.nodeType ? '[' : '{');
6
+ var rightMarkerChar = (3 === range.endContainer.nodeType ? ']' : '}');
7
+ Dom.splitTextContainers(range);
8
+ var leftMarker = document.createTextNode(leftMarkerChar);
9
+ var rightMarker = document.createTextNode(rightMarkerChar);
10
+ var start = Dom.cursorFromBoundaryPoint(range.startContainer, range.startOffset);
11
+ var end = Dom.cursorFromBoundaryPoint(range.endContainer, range.endOffset);
12
+ start.insert(leftMarker);
13
+ end.insert(rightMarker);
14
+ }
15
+
16
+ function extract(rootElem, range) {
17
+ var markers = ['[', '{', '}', ']'];
18
+ var markersFound = 0;
19
+ function setBoundaryPoint(marker, node) {
20
+ var setFn;
21
+ if (0 === markersFound) {
22
+ setFn = 'setStart';
23
+ if (marker !== '[' && marker !== '{') {
24
+ throw "end marker before start marker";
25
+ }
26
+ } else if (1 === markersFound) {
27
+ setFn = 'setEnd';
28
+ if (marker !== ']' && marker !== '}') {
29
+ throw "start marker before end marker";
30
+ }
31
+ } else {
32
+ throw "Too many markers";
33
+ }
34
+ markersFound += 1;
35
+ if (marker === '[' || marker === ']') {
36
+ var previousSibling = node.previousSibling;
37
+ if (!previousSibling || 3 !== previousSibling.nodeType) {
38
+ previousSibling = document.createTextNode('');
39
+ node.parentNode.insertBefore(previousSibling, node);
40
+ }
41
+ range[setFn].call(range, previousSibling, previousSibling.length);
42
+ // Because we have set a text offset.
43
+ return false;
44
+ } else { // marker === '{' || marker === '}'
45
+ range[setFn].call(range, node.parentNode, Dom.nodeIndex(node));
46
+ // Because we have set a non-text offset.
47
+ return true;
48
+ }
49
+ }
50
+ function extractMarkers(node) {
51
+ if (3 !== node.nodeType) {
52
+ return;
53
+ }
54
+ var text = node.nodeValue;
55
+ var parts = Strings.splitIncl(text, /[\[\{\}\]]/g);
56
+ // Because modifying every text node when there can be
57
+ // only two markers seems like too much overhead.
58
+ if (!Arrays.contains(markers, parts[0]) && parts.length < 2) {
59
+ return;
60
+ }
61
+ // Because non-text boundary positions must not be joined again.
62
+ var forceNextSplit = false;
63
+ Arrays.forEach(parts, function (part, i) {
64
+ // Because we don't want to join text nodes we haven't split.
65
+ forceNextSplit = forceNextSplit || (i === 0);
66
+ if (Arrays.contains(markers, part)) {
67
+ forceNextSplit = setBoundaryPoint(part, node);
68
+ } else if (!forceNextSplit && node.previousSibling && 3 === node.previousSibling.nodeType) {
69
+ node.previousSibling.insertData(node.previousSibling.length, part);
70
+ } else {
71
+ node.parentNode.insertBefore(document.createTextNode(part), node);
72
+ }
73
+ });
74
+ node.parentNode.removeChild(node);
75
+ }
76
+ Dom.walkRec(rootElem, extractMarkers);
77
+ if (2 !== markersFound) {
78
+ throw "Missing one or both markers";
79
+ }
80
+ }
81
+
82
+ return {
83
+ insert: insert,
84
+ extract: extract
85
+ };
86
+ });
@@ -0,0 +1,32 @@
1
+ /* ephemera.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(['jquery'], function ($) {
28
+ 'use strict';
29
+ return {
30
+ ie7: $.browser.msie && parseInt($.browser.version, 10) < 8
31
+ };
32
+ });
@@ -0,0 +1,78 @@
1
+ /* Simple JavaScript Inheritance
2
+ * By John Resig http://ejohn.org/
3
+ * MIT Licensed.
4
+ */
5
+ // Inspired by base2 and Prototype
6
+ /*
7
+ * MODIFICATIONS:
8
+ * * The name of the "constructor" method was changed from "init" to "_constructor"
9
+ * * Mixin Support using https://gist.github.com/1006243
10
+ * * Modified to be a require.js module
11
+ */
12
+ define([], function () {
13
+ var initializing = false,
14
+ fnTest = /xyz/.test(function () {
15
+ xyz;
16
+ }) ? /\b_super\b/ : /.*/;
17
+
18
+ // The base Class implementation (does nothing)
19
+ // with doing that Class is available in the global namespace.
20
+ this.Class = function () {};
21
+
22
+ // Create a new Class that inherits from this class
23
+ Class.extend = function () {
24
+ var _super = this.prototype;
25
+
26
+ // Instantiate a base class (but only create the instance,
27
+ // don't run the init constructor)
28
+ initializing = true;
29
+ var prototype = new this();
30
+ initializing = false;
31
+
32
+ // Copy the properties over onto the new prototype
33
+ for (var i = 0; i < arguments.length; i++) {
34
+ var prop = arguments[i];
35
+ for (var name in prop) {
36
+ // Check if we're overwriting an existing function
37
+ prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
38
+ return function () {
39
+
40
+ var tmp = this._super;
41
+
42
+ // Add a new ._super() method that is the same method
43
+ // but on the super-class
44
+ this._super = _super[name];
45
+
46
+ // The method only need to be bound temporarily, so we
47
+ // remove it when we're done executing
48
+ var ret = fn.apply(this, arguments);
49
+ this._super = tmp;
50
+
51
+ return ret;
52
+ };
53
+ })(name, prop[name]) : prop[name];
54
+ }
55
+ }
56
+
57
+ // The dummy class constructor
58
+ function Class() {
59
+ // All construction is actually done in the _constructor method
60
+ if (!initializing && this._constructor) this._constructor.apply(this, arguments);
61
+ }
62
+
63
+ // Populate our constructed prototype object
64
+ Class.prototype = prototype;
65
+
66
+ // Enforce the constructor to be what we expect
67
+ Class.constructor = Class;
68
+
69
+ // And make this class extendable
70
+ Class.extend = arguments.callee;
71
+
72
+ return Class;
73
+
74
+ };
75
+
76
+ return this.Class;
77
+
78
+ });
@@ -0,0 +1,1888 @@
1
+ /* dom.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
+ /*jslint eqeq: true */
28
+ // Ensure GENTICS Namespace
29
+ window.GENTICS = window.GENTICS || {};
30
+ window.GENTICS.Utils = window.GENTICS.Utils || {};
31
+
32
+ define(['jquery', 'util/class', 'aloha/ecma5shims'], function (jQuery, Class, $_) {
33
+ "use strict";
34
+
35
+ var GENTICS = window.GENTICS,
36
+ // Class = window.Class,
37
+ // http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1841493061
38
+ Node = {
39
+ 'ELEMENT_NODE': 1,
40
+ 'ATTRIBUTE_NODE': 2,
41
+ 'TEXT_NODE': 3,
42
+ 'CDATA_SECTION_NODE': 4,
43
+ 'ENTITY_REFERENCE_NODE': 5,
44
+ 'ENTITY_NODE': 6,
45
+ 'PROCESSING_INSTRUCTION_NODE': 7,
46
+ 'COMMENT_NODE': 8,
47
+ 'DOCUMENT_NODE': 9,
48
+ 'DOCUMENT_TYPE_NODE': 10,
49
+ 'DOCUMENT_FRAGMENT_NODE': 11,
50
+ 'NOTATION_NODE': 12,
51
+ //The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.
52
+ 'DOCUMENT_POSITION_DISCONNECTED': 0x01,
53
+ //The second node precedes the reference node.
54
+ 'DOCUMENT_POSITION_PRECEDING': 0x02,
55
+ //The node follows the reference node.
56
+ 'DOCUMENT_POSITION_FOLLOWING': 0x04,
57
+ //The node contains the reference node. A node which contains is always preceding, too.
58
+ 'DOCUMENT_POSITION_CONTAINS': 0x08,
59
+ //The node is contained by the reference node. A node which is contained is always following, too.
60
+ 'DOCUMENT_POSITION_CONTAINED_BY': 0x10,
61
+ //The determination of preceding versus following is implementation-specific.
62
+ 'DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC': 0x20
63
+ },
64
+ blockElementNames = {
65
+ 'P': true,
66
+ 'H1': true,
67
+ 'H2': true,
68
+ 'H3': true,
69
+ 'H4': true,
70
+ 'H5': true,
71
+ 'H6': true,
72
+ 'LI': true
73
+ };
74
+
75
+ /**
76
+ * Can't use elem.childNodes.length because
77
+ * http://www.quirksmode.org/dom/w3c_core.html
78
+ * "IE up to 8 does not count empty text nodes."
79
+ *
80
+ * Taken from Dom2.js
81
+ */
82
+ function numChildren(elem) {
83
+ var count = 0;
84
+ var child = elem.firstChild;
85
+ while (child) {
86
+ count += 1;
87
+ child = child.nextSibling;
88
+ }
89
+ return count;
90
+ }
91
+
92
+ /**
93
+ * Taken from Dom2.js
94
+ */
95
+ function nodeLength(node) {
96
+ if (1 === node.nodeType) {
97
+ return numChildren(node);
98
+ }
99
+ if (3 === node.nodeType) {
100
+ return node.length;
101
+ }
102
+ return 0;
103
+ }
104
+
105
+ /**
106
+ * Checks if the element given is an aloha-editing-p helper, added by split.
107
+ *
108
+ * @param {HTMLElement} node
109
+ * @return {Boolean} True if the given element is an
110
+ * aloha-editing-paragraph.
111
+ */
112
+ function isAlohaEditingP(node) {
113
+ return (
114
+ node.className === 'aloha-editing-p'
115
+ && nodeLength(node) === 1
116
+ && node.children[0].nodeName === 'BR'
117
+ && node.children[0].className === 'aloha-end-br'
118
+ );
119
+ }
120
+
121
+ /**
122
+ * Starting from the given node, will walk forward (right-ward) through the
123
+ * node until an element is found that matches the predicate `match` or we
124
+ * reach the last element in the tree inside the editing host.
125
+ *
126
+ * @param {HTMLElement} node An element that must be inside an editable.
127
+ * @param {function(HTMLElement):Boolean} match A prediate function to
128
+ * determine wether or not the
129
+ * node matches one we are
130
+ * looking for.
131
+ * @return {HTMLElement} The matched node that is forward in the DOM tree
132
+ * from `node`; null if nothing can be found that
133
+ * matches `match`.
134
+ */
135
+ function findNodeForward(node, match) {
136
+ if (!node) {
137
+ return null;
138
+ }
139
+ if (match(node)) {
140
+ return node;
141
+ }
142
+ var next = node.firstChild
143
+ || node.nextSibling
144
+ || (
145
+ node.parentNode
146
+ && !GENTICS.Utils.Dom.isEditingHost(node.parentNode)
147
+ && node.parentNode.nextSibling
148
+ );
149
+ return next ? findNodeForward(next, match) : null;
150
+ }
151
+
152
+ function isVisiblyEmpty(node) {
153
+ if (!node) {
154
+ return true;
155
+ }
156
+ // TODO: use isChildlessElement()
157
+ if ('BR' === node.nodeName) {
158
+ return false;
159
+ }
160
+ if (node.nodeType === Node.TEXT_NODE) {
161
+ // TODO: would prefer to use
162
+ // (Html.isWhitespaces(node) || Html.isZeroWidthCharacters(node))
163
+ // but cannot because of circular dependency
164
+ if (node.data.search(/\S/) === -1) {
165
+ return true;
166
+ }
167
+ // Fix for IE with zero-width characters
168
+ if (1 === node.data.length && node.data.charCodeAt(0) >= 0x2000) {
169
+ return true;
170
+ }
171
+ return false;
172
+ }
173
+ var numChildren = nodeLength(node);
174
+ if (0 === numChildren) {
175
+ return true;
176
+ }
177
+ var children = node.childNodes;
178
+ var i;
179
+ for (i = 0; i < numChildren; i++) {
180
+ if (!isVisiblyEmpty(children[i])) {
181
+ return false;
182
+ }
183
+ }
184
+ return true;
185
+ }
186
+
187
+ /**
188
+ * Checks for the opposite condition of isVisiblyEmpty().
189
+ *
190
+ * @param {HTMLElement} node
191
+ * @return {Boolean} True if the given node is visible not empty.
192
+ */
193
+ function isNotVisiblyEmpty(node) {
194
+ return !isVisiblyEmpty(node);
195
+ }
196
+
197
+ /**
198
+ * Checks whether the given element is a "phantom" element-- ie: an element
199
+ * that is either invisible or an aloha-editing-paragraph element.
200
+ *
201
+ * @param {HTMLElement} node
202
+ * @return {Boolean} True if the element is a "phantom" element.
203
+ */
204
+ function isPhantomNode(node) {
205
+ return isVisiblyEmpty(node) || isAlohaEditingP(node);
206
+ }
207
+
208
+ /**
209
+ * Inserts the DOM node `element` appropriately during a split operation.
210
+ *
211
+ * The element `head` is used to reference where the element should be
212
+ * inserted. Depending on the structure of this `head` node, the `element`
213
+ * will either replace/overwrite `head` or be appending immediately after
214
+ * `head`.
215
+ *
216
+ * @param {HTMLElement} head The "head" element of the "head and tail"
217
+ * nodes resulting from splitting a DOM element.
218
+ * @param {HTMLElement} element The element to be inserted between the head
219
+ * and tail split parts.
220
+ */
221
+ function insertAfterSplit(head, element) {
222
+ if (head.nodeType !== Node.TEXT_NODE && isPhantomNode(head)) {
223
+ jQuery(head).replaceWith(element);
224
+ } else {
225
+ jQuery(head).after(element);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * @namespace GENTICS.Utils
231
+ * @class Dom provides methods to get information about the DOM and to manipulate it
232
+ * @singleton
233
+ */
234
+ var Dom = Class.extend({
235
+ /**
236
+ * Regex to find word characters.
237
+ */
238
+ wordRegex: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCB\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
239
+
240
+ /**
241
+ * Regex to find non-word characters.
242
+ */
243
+ nonWordRegex: /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCB\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
244
+
245
+ /**
246
+ * Tags which can safely be merged
247
+ * @hide
248
+ */
249
+ mergeableTags: ['b', 'code', 'del', 'em', 'i', 'ins', 'strong', 'sub', 'sup', '#text'],
250
+
251
+ /**
252
+ * Tags which do not mark word boundaries
253
+ * @hide
254
+ */
255
+ nonWordBoundaryTags: ['a', 'b', 'code', 'del', 'em', 'i', 'ins', 'span', 'strong', 'sub', 'sup', '#text'],
256
+
257
+ /**
258
+ * Tags which are considered 'nonempty', even if they have no children (or not data)
259
+ * TODO: finish this list
260
+ * @hide
261
+ */
262
+ nonEmptyTags: ['br'],
263
+
264
+ /**
265
+ * Tags which make up Flow Content or Phrasing Content, according to the HTML 5 specification,
266
+ * @see http://dev.w3.org/html5/spec/Overview.html#flow-content
267
+ * @see http://dev.w3.org/html5/spec/Overview.html#phrasing-content
268
+ * @hide
269
+ */
270
+ tags: {
271
+ 'flow': ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'blockquote', 'br', 'button', 'canvas', 'cite', 'code', 'command', 'datalist', 'del', 'details', 'dfn', 'div', 'dl', 'em', 'embed', 'fieldset', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'math', 'menu', 'meter', 'nav', 'noscript', 'object', 'ol', 'output', 'p', 'pre', 'progress', 'q', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'span', 'strong', 'style', 'sub', 'sup', 'svg', 'table', 'textarea', 'time', 'u', 'ul', 'var', 'video', 'wbr', '#text'],
272
+ 'phrasing': ['a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite', 'code', 'command', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'math', 'meter', 'noscript', 'object', 'output', 'progress', 'q', 'ruby', 'samp', 'script', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'textarea', 'time', 'u', 'var', 'video', 'wbr', '#text']
273
+ },
274
+
275
+ /**
276
+ * Possible children of tags, according to the HTML 5
277
+ * specification.
278
+ * See http://dev.w3.org/html5/spec/Overview.html#elements-1
279
+ * Moved to http://www.whatwg.org/specs/web-apps/current-work/#elements-1
280
+ * @hide
281
+ */
282
+ children: {
283
+ 'a': 'phrasing', // transparent
284
+ 'abbr': 'phrasing',
285
+ 'address': 'flow',
286
+ 'area': 'empty',
287
+ 'article': 'flow',
288
+ 'aside': 'flow',
289
+ 'audio': 'source', // transparent
290
+ 'b': 'phrasing',
291
+ 'base': 'empty',
292
+ 'bdo': 'phrasing',
293
+ 'blockquote': 'phrasing',
294
+ 'body': 'flow',
295
+ 'br': 'empty',
296
+ 'button': 'phrasing',
297
+ 'canvas': 'phrasing', // transparent
298
+ 'caption': 'flow',
299
+ 'cite': 'phrasing',
300
+ 'code': 'phrasing',
301
+ 'col': 'empty',
302
+ 'colgroup': 'col',
303
+ 'command': 'empty',
304
+ 'datalist': ['phrasing', 'option'],
305
+ 'dd': 'flow',
306
+ 'del': 'phrasing',
307
+ 'div': 'flow',
308
+ 'details': ['summary', 'flow'],
309
+ 'dfn': 'flow',
310
+ 'dl': ['dt', 'dd'],
311
+ 'dt': 'phrasing', // varies
312
+ 'em': 'phrasing',
313
+ 'embed': 'empty',
314
+ 'fieldset': ['legend', 'flow'],
315
+ 'figcaption': 'flow',
316
+ 'figure': ['figcaption', 'flow'],
317
+ 'footer': 'flow',
318
+ 'form': 'flow',
319
+ 'h1': 'phrasing',
320
+ 'h2': 'phrasing',
321
+ 'h3': 'phrasing',
322
+ 'h4': 'phrasing',
323
+ 'h5': 'phrasing',
324
+ 'h6': 'phrasing',
325
+ //head
326
+ 'header': 'flow',
327
+ 'hgroup': ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
328
+ 'hr': 'empty',
329
+ //html :)
330
+ 'i': 'phrasing',
331
+ 'iframe': '#text',
332
+ 'img': 'empty',
333
+ 'input': 'empty',
334
+ 'ins': 'phrasing', // transparent
335
+ 'kbd': 'phrasing',
336
+ 'keygen': 'empty',
337
+ 'label': 'phrasing',
338
+ 'legend': 'phrasing',
339
+ 'li': 'flow',
340
+ 'link': 'empty',
341
+ 'map': 'area', // transparent
342
+ 'mark': 'phrasing',
343
+ 'menu': ['li', 'flow'],
344
+ 'meta': 'empty',
345
+ 'meter': 'phrasing',
346
+ 'nav': 'flow',
347
+ 'noscript': 'phrasing', // varies
348
+ 'object': 'param', // transparent
349
+ 'ol': 'li',
350
+ 'optgroup': 'option',
351
+ 'option': '#text',
352
+ 'output': 'phrasing',
353
+ 'p': 'phrasing',
354
+ 'param': 'empty',
355
+ 'pre': 'phrasing',
356
+ 'progress': 'phrasing',
357
+ 'q': 'phrasing',
358
+ 'rp': 'phrasing',
359
+ 'rt': 'phrasing',
360
+ 'ruby': ['phrasing', 'rt', 'rp'],
361
+ 's': 'phrasing',
362
+ 'samp': 'pharsing',
363
+ 'script': '#script', //script
364
+ 'section': 'flow',
365
+ 'select': ['option', 'optgroup'],
366
+ 'small': 'phrasing',
367
+ 'source': 'empty',
368
+ 'span': 'phrasing',
369
+ 'strong': 'phrasing',
370
+ 'style': 'phrasing', // varies
371
+ 'sub': 'phrasing',
372
+ 'summary': 'phrasing',
373
+ 'sup': 'phrasing',
374
+ 'table': ['caption', 'colgroup', 'thead', 'tbody', 'tfoot', 'tr'],
375
+ 'tbody': 'tr',
376
+ 'td': 'flow',
377
+ 'textarea': '#text',
378
+ 'tfoot': 'tr',
379
+ 'th': 'phrasing',
380
+ 'thead': 'tr',
381
+ 'time': 'phrasing',
382
+ 'title': '#text',
383
+ 'tr': ['th', 'td'],
384
+ 'track': 'empty',
385
+ 'u': 'phrasing',
386
+ 'ul': 'li',
387
+ 'var': 'phrasing',
388
+ 'video': 'source', // transparent
389
+ 'wbr': 'empty'
390
+ },
391
+
392
+ /**
393
+ * List of nodenames of blocklevel elements
394
+ * TODO: finish this list
395
+ * @hide
396
+ */
397
+ blockLevelElements: ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'div', 'pre'],
398
+
399
+ /**
400
+ * List of nodenames of list elements
401
+ * @hide
402
+ */
403
+ listElements: ['li', 'ol', 'ul'],
404
+
405
+ /**
406
+ * Splits a DOM element at the given position up until the limiting object(s), so that it is valid HTML again afterwards.
407
+ * @param {RangeObject} range Range object that indicates the position of the splitting.
408
+ * This range will be updated, so that it represents the same range as before the split.
409
+ * @param {jQuery} limit Limiting node(s) for the split.
410
+ * The limiting node will not be included in the split itself.
411
+ * If no limiting object is set, the document body will be the limiting object.
412
+ * @param {boolean} atEnd If set to true, the DOM will be splitted at the end of the range otherwise at the start.
413
+ * @return {object} jQuery object containing the two root DOM objects of the split, true if the DOM did not need to be split or false if the DOM could not be split
414
+ * @method
415
+ */
416
+ split: function (range, limit, atEnd) {
417
+ var splitElement = jQuery(range.startContainer),
418
+ splitPosition = range.startOffset,
419
+ updateRange,
420
+ path,
421
+ parents,
422
+ newDom,
423
+ insertElement,
424
+ secondPart,
425
+ i,
426
+ pathLength,
427
+ element,
428
+ jqelement,
429
+ children,
430
+ newElement,
431
+ next,
432
+ prev,
433
+ offset;
434
+
435
+ if (atEnd) {
436
+ splitElement = jQuery(range.endContainer);
437
+ splitPosition = range.endOffset;
438
+ }
439
+
440
+ if (limit.length < 1) {
441
+ limit = jQuery(document.body);
442
+ }
443
+
444
+ // we may have to update the range if it is not collapsed and we are splitting at the start
445
+ updateRange = (!range.isCollapsed() && !atEnd);
446
+
447
+ // find the path up to the highest object that will be splitted
448
+ parents = splitElement.parents().get();
449
+ parents.unshift(splitElement.get(0));
450
+
451
+ jQuery.each(parents, function (index, element) {
452
+ var isLimit = limit.filter(
453
+ function () {
454
+ return this == element;
455
+ }
456
+ ).length;
457
+ if (isLimit) {
458
+ if (index > 0) {
459
+ path = parents.slice(0, index);
460
+ }
461
+ return false;
462
+ }
463
+ });
464
+
465
+ // nothing found to split -> return here
466
+ if (!path) {
467
+ return true;
468
+ }
469
+
470
+ path = path.reverse();
471
+
472
+ // iterate over the path, create new dom nodes for every element and move
473
+ // the contents right of the split to the new element
474
+ for (i = 0, pathLength = path.length; i < pathLength; ++i) {
475
+ element = path[i];
476
+ if (i === pathLength - 1) {
477
+ // last element in the path -> we have to split it
478
+
479
+ // split the last part into two parts
480
+ if (element.nodeType === 3) {
481
+ // text node
482
+ secondPart = document.createTextNode(element.data.substring(splitPosition, element.data.length));
483
+ element.data = element.data.substring(0, splitPosition);
484
+ if (this.isEmpty(secondPart) && jQuery('br', newDom).length === 0) {
485
+ secondPart = jQuery('<br/>').addClass('aloha-end-br');
486
+ }
487
+ } else {
488
+ // other nodes
489
+ jqelement = jQuery(element);
490
+ children = jqelement.contents();
491
+ newElement = jqelement.clone(false).empty();
492
+ secondPart = newElement.append(children.slice(splitPosition, children.length)).get(0);
493
+ jQuery(secondPart).addClass('aloha-editing-p');
494
+ if (secondPart.childNodes.length === 1 && secondPart.childNodes.item(0).nodeName.toLowerCase() === 'br') {
495
+ jQuery(secondPart.childNodes.item(0)).addClass('aloha-end-br');
496
+ }
497
+ }
498
+
499
+ // update the range if necessary
500
+ if (updateRange && range.endContainer === element) {
501
+ range.endContainer = secondPart;
502
+ range.endOffset -= splitPosition;
503
+ range.clearCaches();
504
+ }
505
+
506
+ // add the second part
507
+ if (insertElement) {
508
+ insertElement.prepend(secondPart);
509
+ } else {
510
+ jQuery(element).after(secondPart);
511
+ }
512
+ } else {
513
+ // create the new element of the same type and prepend it to the previously created element
514
+ newElement = jQuery(element).clone(false).empty();
515
+
516
+ if (!newDom) {
517
+ newDom = newElement;
518
+ } else {
519
+ insertElement.prepend(newElement);
520
+ }
521
+ insertElement = newElement;
522
+
523
+ // move all contents right of the split to the new element
524
+ while (true) {
525
+ next = path[i + 1].nextSibling;
526
+ if (!next) {
527
+ break;
528
+ }
529
+ insertElement.append(next);
530
+ }
531
+
532
+ // update the range if necessary
533
+ if (updateRange && range.endContainer === element) {
534
+ range.endContainer = newElement.get(0);
535
+ prev = path[i + 1];
536
+ offset = 0;
537
+ while (true) {
538
+ prev = prev.previousSibling;
539
+ if (!prev) {
540
+ break;
541
+ }
542
+ offset++;
543
+ }
544
+ range.endOffset -= offset;
545
+ range.clearCaches();
546
+ }
547
+ }
548
+ }
549
+
550
+ // append the new dom
551
+ jQuery(path[0]).after(newDom);
552
+
553
+ return jQuery([path[0], newDom ? newDom.get(0) : secondPart]);
554
+ },
555
+
556
+ /**
557
+ * Check whether the HTML 5 specification allows direct nesting of the given DOM
558
+ * objects.
559
+ * @param {object} outerDOMObject
560
+ * outer (nesting) DOM Object
561
+ * @param {object} innerDOMObject
562
+ * inner (nested) DOM Object
563
+ * @return {boolean} true when the nesting is allowed, false if not
564
+ * @method
565
+ */
566
+ allowsNesting: function (outerDOMObject, innerDOMObject) {
567
+ if (!outerDOMObject || !outerDOMObject.nodeName || !innerDOMObject || !innerDOMObject.nodeName) {
568
+ return false;
569
+ }
570
+
571
+ var outerNodeName = outerDOMObject.nodeName.toLowerCase(),
572
+ innerNodeName = innerDOMObject.nodeName.toLowerCase();
573
+
574
+ if (!this.children[outerNodeName]) {
575
+ return false;
576
+ }
577
+
578
+ // check whether the nesting is configured by node names (like for table)
579
+ if (this.children[outerNodeName] == innerNodeName) {
580
+ return true;
581
+ }
582
+ if (jQuery.isArray(this.children[outerNodeName]) && jQuery.inArray(innerNodeName, this.children[outerNodeName]) >= 0) {
583
+ return true;
584
+ }
585
+
586
+ if (jQuery.isArray(this.tags[this.children[outerNodeName]])
587
+ && jQuery.inArray(innerNodeName, this.tags[this.children[outerNodeName]]) >= 0) {
588
+ return true;
589
+ }
590
+
591
+ return false;
592
+ },
593
+
594
+ /**
595
+ * Apply the given markup additively to the given range. The given rangeObject will be modified if necessary
596
+ * @param {GENTICS.Utils.RangeObject} rangeObject range to which the markup shall be added
597
+ * @param {jQuery} markup markup to be applied as jQuery object
598
+ * @param {boolean} allownesting true when nesting of the added markup is allowed, false if not (default: false)
599
+ * @method
600
+ */
601
+ addMarkup: function (rangeObject, markup, nesting) {
602
+ // split partially contained text nodes at the start and end of the range
603
+ if (rangeObject.startContainer.nodeType === 3
604
+ && rangeObject.startOffset > 0
605
+ && rangeObject.startOffset < rangeObject.startContainer.data.length) {
606
+ this.split(rangeObject, jQuery(rangeObject.startContainer).parent(), false);
607
+ }
608
+ if (rangeObject.endContainer.nodeType === 3 && rangeObject.endOffset > 0 && rangeObject.endOffset < rangeObject.endContainer.data.length) {
609
+ this.split(rangeObject, jQuery(rangeObject.endContainer).parent(), true);
610
+ }
611
+
612
+ // get the range tree
613
+ var rangeTree = rangeObject.getRangeTree();
614
+ this.recursiveAddMarkup(rangeTree, markup, rangeObject, nesting);
615
+
616
+ // cleanup DOM
617
+ this.doCleanup({
618
+ 'merge': true,
619
+ 'removeempty': true
620
+ }, rangeObject);
621
+ },
622
+
623
+ /**
624
+ * Recursive helper method to add the given markup to the range
625
+ * @param rangeTree rangetree at the current level
626
+ * @param markup markup to be applied
627
+ * @param rangeObject range object, which eventually is updated
628
+ * @param nesting true when nesting of the added markup is allowed, false if not
629
+ * @hide
630
+ */
631
+ recursiveAddMarkup: function (rangeTree, markup, rangeObject, nesting) {
632
+ var i, innerRange, rangeLength;
633
+
634
+ // iterate through all rangetree objects of that level
635
+ for (i = 0, rangeLength = rangeTree.length; i < rangeLength; ++i) {
636
+ // check whether the rangetree object is fully contained and the markup may be wrapped around the object
637
+ if (rangeTree[i].type == 'full' && this.allowsNesting(markup.get(0), rangeTree[i].domobj)) {
638
+ // we wrap the object, when
639
+ // 1. nesting of markup is allowed or the node is not of the markup to be added
640
+ // 2. the node an element node or a non-empty text node
641
+ if ((nesting || rangeTree[i].domobj.nodeName != markup.get(0).nodeName) && (rangeTree[i].domobj.nodeType !== 3 || jQuery.trim(rangeTree[i].domobj.data).length !== 0)) {
642
+ // wrap the object
643
+ jQuery(rangeTree[i].domobj).wrap(markup);
644
+
645
+ // TODO eventually update the range (if it changed)
646
+
647
+ // when nesting is not allowed, we remove the markup from the inner element
648
+ if (!nesting && rangeTree[i].domobj.nodeType !== 3) {
649
+ innerRange = new GENTICS.Utils.RangeObject();
650
+ innerRange.startContainer = innerRange.endContainer = rangeTree[i].domobj.parentNode;
651
+ innerRange.startOffset = 0;
652
+ innerRange.endOffset = innerRange.endContainer.childNodes.length;
653
+ this.removeMarkup(innerRange, markup, jQuery(rangeTree[i].domobj.parentNode));
654
+ }
655
+ }
656
+ } else {
657
+ // TODO check whether the object may be replaced by the given markup
658
+ //if (false) {
659
+ // TODO replace
660
+ //} else {
661
+ // recurse into the children (if any), but not if nesting is not
662
+ // allowed and the object is of the markup to be added
663
+ if ((nesting || (rangeTree[i].domobj && rangeTree[i].domobj.nodeName !== markup.get(0).nodeName)) && rangeTree[i].children && rangeTree[i].children.length > 0) {
664
+ this.recursiveAddMarkup(rangeTree[i].children, markup);
665
+ }
666
+ }
667
+ }
668
+ },
669
+
670
+ /**
671
+ * Find the highest occurrence of a node with given nodename within the parents
672
+ * of the start. When limit objects are given, the search stops there.
673
+ * The limiting object is of the found type, it won't be considered
674
+ * @param {DOMObject} start start object
675
+ * @param {String} nodeName name of the node to search for (case-insensitive)
676
+ * @param {jQuery} limit Limiting node(s) as jQuery object (if none given, the search will stop when there are no more parents)
677
+ * @return {DOMObject} the found DOM object or undefined
678
+ * @method
679
+ */
680
+ findHighestElement: function (start, nodeName, limit) {
681
+ nodeName = nodeName.toLowerCase();
682
+
683
+ // this will be the highest found markup object (up to a limit object)
684
+ var highestObject,
685
+ // blah
686
+ testObject = start,
687
+ // helper function to stop when we reach a limit object
688
+ isLimit = limit ? function () {
689
+ return limit.filter(
690
+ function () {
691
+ return testObject == this;
692
+ }
693
+ ).length;
694
+ } : function () {
695
+ return false;
696
+ };
697
+
698
+ // now get the highest parent that has the given markup (until we reached
699
+ // one of the limit objects or there are no more parent nodes)
700
+ while (!isLimit() && testObject) {
701
+ if (testObject.nodeName.toLowerCase() === nodeName) {
702
+ highestObject = testObject;
703
+ }
704
+ testObject = testObject.parentNode;
705
+ }
706
+
707
+ return highestObject;
708
+ },
709
+
710
+ /**
711
+ * Remove the given markup from the given range. The given rangeObject will be modified if necessary
712
+ * TODO: add parameter deep/shallow
713
+ * @param {GENTICS.Utils.RangeObject} rangeObject range from which the markup shall be removed
714
+ * @param {jQuery} markup markup to be removed as jQuery object
715
+ * @param {jQuery} limit Limiting node(s) as jQuery object
716
+ * @method
717
+ */
718
+ removeMarkup: function (rangeObject, markup, limit) {
719
+ var nodeName = markup.get(0).nodeName,
720
+ startSplitLimit = this.findHighestElement(rangeObject.startContainer, nodeName, limit),
721
+ endSplitLimit = this.findHighestElement(rangeObject.endContainer, nodeName, limit),
722
+ didSplit = false,
723
+ highestObject,
724
+ root,
725
+ rangeTree;
726
+
727
+ if (startSplitLimit && rangeObject.startOffset > 0) {
728
+ // when the start is in the start of its container, we don't split
729
+ this.split(rangeObject, jQuery(startSplitLimit).parent(), false);
730
+ didSplit = true;
731
+ }
732
+
733
+ if (endSplitLimit) {
734
+ // when the end is in the end of its container, we don't split
735
+ if (rangeObject.endContainer.nodeType === 3 && rangeObject.endOffset < rangeObject.endContainer.data.length) {
736
+ this.split(rangeObject, jQuery(endSplitLimit).parent(), true);
737
+ didSplit = true;
738
+ }
739
+ if (rangeObject.endContainer.nodeType === 1 && rangeObject.endOffset < rangeObject.endContainer.childNodes.length) {
740
+ this.split(rangeObject, jQuery(endSplitLimit).parent(), true);
741
+ didSplit = true;
742
+ }
743
+ }
744
+
745
+ // when we split the DOM, we maybe need to correct the range
746
+ if (didSplit) {
747
+ rangeObject.correctRange();
748
+ }
749
+
750
+ // find the highest occurrence of the markup
751
+ highestObject = this.findHighestElement(rangeObject.getCommonAncestorContainer(), nodeName, limit);
752
+ root = highestObject ? highestObject.parentNode : rangeObject.getCommonAncestorContainer();
753
+
754
+ if (root) {
755
+ // construct the range tree
756
+ rangeTree = rangeObject.getRangeTree(root);
757
+
758
+ // remove the markup from the range tree
759
+ this.recursiveRemoveMarkup(rangeTree, markup);
760
+
761
+ // cleanup DOM
762
+ this.doCleanup({
763
+ 'merge': true,
764
+ 'removeempty': true
765
+ }, rangeObject, root);
766
+ }
767
+ },
768
+
769
+ /**
770
+ * TODO: pass the range itself and eventually update it if necessary
771
+ * Recursive helper method to remove the given markup from the range
772
+ * @param rangeTree rangetree at the current level
773
+ * @param markup markup to be applied
774
+ * @hide
775
+ */
776
+ recursiveRemoveMarkup: function (rangeTree, markup) {
777
+ var i, rangeLength, content;
778
+ // iterate over the rangetree objects of this level
779
+ for (i = 0, rangeLength = rangeTree.length; i < rangeLength; ++i) {
780
+ // check whether the object is the markup to be removed and is fully into the range
781
+ if (rangeTree[i].type == 'full' && rangeTree[i].domobj.nodeName == markup.get(0).nodeName) {
782
+ // found the markup, so remove it
783
+ content = jQuery(rangeTree[i].domobj).contents();
784
+ if (content.length > 0) {
785
+ // when the object has children, we unwrap them
786
+ content.first().unwrap();
787
+ } else {
788
+ // obj has no children, so just remove it
789
+ jQuery(rangeTree[i].domobj).remove();
790
+ }
791
+ }
792
+
793
+ // if the object has children, we do the recursion now
794
+ if (rangeTree[i].children) {
795
+ this.recursiveRemoveMarkup(rangeTree[i].children, markup);
796
+ }
797
+ }
798
+ },
799
+
800
+ /**
801
+ * Cleanup the DOM, starting with the given startobject (or the common ancestor container of the given range)
802
+ * ATTENTION: If range is a selection you need to update the selection after doCleanup
803
+ * Cleanup modes (given as properties in 'cleanup'):
804
+ * <pre>
805
+ * - merge: merges multiple successive nodes of same type, if this is allowed, starting at the children of the given node (defaults to false)
806
+ * - removeempty: removes empty element nodes (defaults to false)
807
+ * - mergeable: Custom function to predicate whether or not a given
808
+ * element should be mergeable. Overrides `mergeableTags'.
809
+ * </pre>
810
+ * Example for calling this method:<br/>
811
+ * <code>GENTICS.Utils.Dom.doCleanup({merge:true,removeempty:false}, range)</code>
812
+ * @param {object} cleanup type of cleanup to be done
813
+ * @param {GENTICS.Utils.RangeObject} rangeObject range which is eventually updated
814
+ * @param {DOMObject} start start object, if not given, the commonancestorcontainer is used as startobject insted
815
+ * @return {boolean} true when the range (startContainer/startOffset/endContainer/endOffset) was modified, false if not
816
+ * @method
817
+ */
818
+ doCleanup: function (cleanup, rangeObject, start) {
819
+ var that = this,
820
+ prevNode,
821
+ modifiedRange,
822
+ startObject,
823
+ startOffset,
824
+ endOffset;
825
+
826
+ if (typeof cleanup === 'undefined') {
827
+ cleanup = {};
828
+ }
829
+ if (typeof cleanup.merge === 'undefined') {
830
+ cleanup.merge = false;
831
+ }
832
+ if (typeof cleanup.removeempty === 'undefined') {
833
+ cleanup.removeempty = false;
834
+ }
835
+
836
+ if (typeof start === 'undefined' && rangeObject) {
837
+ start = rangeObject.getCommonAncestorContainer();
838
+ }
839
+ // remember the previous node here (successive nodes of same type will be merged into this)
840
+ prevNode = false;
841
+ // check whether the range needed to be modified during merging
842
+ modifiedRange = false;
843
+ // get the start object
844
+ startObject = jQuery(start);
845
+ startOffset = rangeObject.startOffset;
846
+ endOffset = rangeObject.endOffset;
847
+
848
+ // iterate through all sub nodes
849
+ startObject.contents().each(function () {
850
+ var index;
851
+
852
+ // Try to read the nodeType property and return if we do not have permission
853
+ // ie.: frame document to an external URL
854
+ var nodeType;
855
+ try {
856
+ nodeType = this.nodeType;
857
+ index = that.getIndexInParent(this);
858
+ } catch (e) {
859
+ return;
860
+ }
861
+
862
+ // decide further actions by node type
863
+ switch (nodeType) {
864
+ // found a non-text node
865
+ case 1:
866
+ if (prevNode && prevNode.nodeName == this.nodeName) {
867
+ // found a successive node of same type
868
+
869
+ // now we check whether the selection starts or ends in the mother node after the current node
870
+ if (rangeObject.startContainer === startObject && startOffset > index) {
871
+ // there will be one less object, so reduce the startOffset by one
872
+ rangeObject.startOffset -= 1;
873
+ // set the flag for range modification
874
+ modifiedRange = true;
875
+ }
876
+ if (rangeObject.endContainer === startObject && endOffset > index) {
877
+ // there will be one less object, so reduce the endOffset by one
878
+ rangeObject.endOffset -= 1;
879
+ // set the flag for range modification
880
+ modifiedRange = true;
881
+ }
882
+
883
+ // merge the contents of this node into the previous one
884
+ jQuery(prevNode).append(jQuery(this).contents());
885
+
886
+ // after merging, we eventually need to cleanup the prevNode again
887
+ modifiedRange |= that.doCleanup(cleanup, rangeObject, prevNode);
888
+
889
+ // remove this node
890
+ jQuery(this).remove();
891
+
892
+ } else {
893
+
894
+ // do the recursion step here
895
+ modifiedRange |= that.doCleanup(cleanup, rangeObject, this);
896
+
897
+ // eventually remove empty elements
898
+ var removed = false;
899
+ if (cleanup.removeempty) {
900
+ if (GENTICS.Utils.Dom.isBlockLevelElement(this) && this.childNodes.length === 0) {
901
+ // jQuery(this).remove();
902
+ removed = true;
903
+ }
904
+ if (jQuery.inArray(this.nodeName.toLowerCase(), that.mergeableTags) >= 0 && jQuery(this).text().length === 0 && this.childNodes.length === 0) {
905
+ // jQuery(this).remove();
906
+ removed = true;
907
+ }
908
+ }
909
+
910
+ // when the current node was not removed, we eventually store it as previous (mergeable) tag
911
+ if (!removed) {
912
+ if (cleanup.mergeable
913
+ ? cleanup.mergeable(this)
914
+ : jQuery.inArray(this.nodeName.toLowerCase(), that.mergeableTags) >= 0) {
915
+ prevNode = this;
916
+ } else {
917
+ prevNode = false;
918
+ }
919
+ } else {
920
+ // now we check whether the selection starts or ends in the mother node of this
921
+ if (rangeObject.startContainer === this.parentNode && startOffset > index) {
922
+ // there will be one less object, so reduce the startOffset by one
923
+ rangeObject.startOffset = rangeObject.startOffset - 1;
924
+ // set the flag for range modification
925
+ modifiedRange = true;
926
+ }
927
+ if (rangeObject.endContainer === this.parentNode && endOffset > index) {
928
+ // there will be one less object, so reduce the endOffset by one
929
+ rangeObject.endOffset = rangeObject.endOffset - 1;
930
+ // set the flag for range modification
931
+ modifiedRange = true;
932
+ }
933
+
934
+ // remove this text node
935
+ jQuery(this).remove();
936
+
937
+ }
938
+ }
939
+
940
+ break;
941
+ // found a text node
942
+ case 3:
943
+ // found a text node
944
+ if (prevNode && prevNode.nodeType === 3 && cleanup.merge) {
945
+ // the current text node will be merged into the last one, so
946
+ // check whether the selection starts or ends in the current
947
+ // text node
948
+ if (rangeObject.startContainer === this) {
949
+ // selection starts in the current text node
950
+
951
+ // update the start container to the last node
952
+ rangeObject.startContainer = prevNode;
953
+
954
+ // update the start offset
955
+ rangeObject.startOffset += prevNode.nodeValue.length;
956
+
957
+ // set the flag for range modification
958
+ modifiedRange = true;
959
+
960
+ } else if (rangeObject.startContainer === prevNode.parentNode && rangeObject.startOffset === that.getIndexInParent(prevNode) + 1) {
961
+ // selection starts right between the previous and current text nodes (which will be merged)
962
+
963
+ // update the start container to the previous node
964
+ rangeObject.startContainer = prevNode;
965
+
966
+ // set the start offset
967
+ rangeObject.startOffset = prevNode.nodeValue.length;
968
+
969
+ // set the flag for range modification
970
+ modifiedRange = true;
971
+ }
972
+
973
+ if (rangeObject.endContainer === this) {
974
+ // selection ends in the current text node
975
+
976
+ // update the end container to be the last node
977
+ rangeObject.endContainer = prevNode;
978
+
979
+ // update the end offset
980
+ rangeObject.endOffset += prevNode.nodeValue.length;
981
+
982
+ // set the flag for range modification
983
+ modifiedRange = true;
984
+
985
+ } else if (rangeObject.endContainer === prevNode.parentNode && rangeObject.endOffset === that.getIndexInParent(prevNode) + 1) {
986
+ // selection ends right between the previous and current text nodes (which will be merged)
987
+
988
+ // update the end container to the previous node
989
+ rangeObject.endContainer = prevNode;
990
+
991
+ // set the end offset
992
+ rangeObject.endOffset = prevNode.nodeValue.length;
993
+
994
+ // set the flag for range modification
995
+ modifiedRange = true;
996
+ }
997
+
998
+ // now append the contents of the current text node into the previous
999
+ prevNode.data += this.data;
1000
+
1001
+ // remove empty text nodes
1002
+ } else if (!(this.nodeValue === '' && cleanup.removeempty)) {
1003
+ prevNode = this;
1004
+ // we are finish here don't delete this node
1005
+ break;
1006
+ }
1007
+
1008
+ // now we check whether the selection starts or ends in the mother node of this
1009
+ if (rangeObject.startContainer === this.parentNode && rangeObject.startOffset > index) {
1010
+ // there will be one less object, so reduce the startOffset by one
1011
+ rangeObject.startOffset = rangeObject.startOffset - 1;
1012
+ // set the flag for range modification
1013
+ modifiedRange = true;
1014
+ }
1015
+ if (rangeObject.endContainer === this.parentNode && rangeObject.endOffset > index) {
1016
+ // there will be one less object, so reduce the endOffset by one
1017
+ rangeObject.endOffset = rangeObject.endOffset - 1;
1018
+ // set the flag for range modification
1019
+ modifiedRange = true;
1020
+ }
1021
+
1022
+ // remove this text node
1023
+ jQuery(this).remove();
1024
+
1025
+ // if this is the last text node in a sequence, we remove any zero-width spaces in the text node,
1026
+ // unless it is the only character
1027
+ if (prevNode && (!prevNode.nextSibling || prevNode.nextSibling.nodeType !== 3)) {
1028
+ var pos;
1029
+ for (pos = prevNode.data.length - 1; pos >= 0 && prevNode.data.length > 1; pos--) {
1030
+ if (prevNode.data.charAt(pos) === '\u200b') {
1031
+ prevNode.deleteData(pos, 1);
1032
+ if (rangeObject.startContainer === prevNode && rangeObject.startOffset > pos) {
1033
+ rangeObject.startOffset--;
1034
+ modifiedRange = true;
1035
+ }
1036
+ if (rangeObject.endContainer === prevNode && rangeObject.endOffset > pos) {
1037
+ rangeObject.endOffset--;
1038
+ modifiedRange = true;
1039
+ }
1040
+ }
1041
+ }
1042
+ }
1043
+
1044
+ break;
1045
+ }
1046
+ });
1047
+
1048
+ // eventually remove the startnode itself
1049
+ // if (cleanup.removeempty
1050
+ // && GENTICS.Utils.Dom.isBlockLevelElement(start)
1051
+ // && (!start.childNodes || start.childNodes.length === 0)) {
1052
+ // if (rangeObject.startContainer == start) {
1053
+ // rangeObject.startContainer = start.parentNode;
1054
+ // rangeObject.startOffset = GENTICS.Utils.Dom.getIndexInParent(start);
1055
+ // }
1056
+ // if (rangeObject.endContainer == start) {
1057
+ // rangeObject.endContainer = start.parentNode;
1058
+ // rangeObject.endOffset = GENTICS.Utils.Dom.getIndexInParent(start);
1059
+ // }
1060
+ // startObject.remove();
1061
+ // modifiedRange = true;
1062
+ // }
1063
+
1064
+ if (modifiedRange) {
1065
+ rangeObject.clearCaches();
1066
+ }
1067
+
1068
+ return modifiedRange;
1069
+ },
1070
+
1071
+ /**
1072
+ * Get the index of the given node within its parent node
1073
+ * @param {DOMObject} node node to check
1074
+ * @return {Integer} index in the parent node or false if no node given or node has no parent
1075
+ * @method
1076
+ */
1077
+ getIndexInParent: function (node) {
1078
+ if (!node) {
1079
+ return false;
1080
+ }
1081
+
1082
+ var index = 0,
1083
+ check = node.previousSibling;
1084
+
1085
+ while (check) {
1086
+ index++;
1087
+ check = check.previousSibling;
1088
+ }
1089
+
1090
+ return index;
1091
+ },
1092
+
1093
+ /**
1094
+ * Check whether the given node is a blocklevel element
1095
+ * @param {DOMObject} node node to check
1096
+ * @return {boolean} true if yes, false if not (or null)
1097
+ * @method
1098
+ */
1099
+ isBlockLevelElement: function (node) {
1100
+ if (!node) {
1101
+ return false;
1102
+ }
1103
+ if (node.nodeType === 1 && jQuery.inArray(node.nodeName.toLowerCase(), this.blockLevelElements) >= 0) {
1104
+ return true;
1105
+ }
1106
+ return false;
1107
+ },
1108
+
1109
+ /**
1110
+ * Check whether the given node is a linebreak element
1111
+ * @param {DOMObject} node node to check
1112
+ * @return {boolean} true for linebreak elements, false for everything else
1113
+ * @method
1114
+ */
1115
+ isLineBreakElement: function (node) {
1116
+ if (!node) {
1117
+ return false;
1118
+ }
1119
+ return node.nodeType === 1 && node.nodeName.toLowerCase() == 'br';
1120
+ },
1121
+
1122
+ /**
1123
+ * Check whether the given node is a list element
1124
+ * @param {DOMObject} node node to check
1125
+ * @return {boolean} true for list elements (li, ul, ol), false for everything else
1126
+ * @method
1127
+ */
1128
+ isListElement: function (node) {
1129
+ if (!node) {
1130
+ return false;
1131
+ }
1132
+ return node.nodeType === 1 && jQuery.inArray(node.nodeName.toLowerCase(), this.listElements) >= 0;
1133
+ },
1134
+
1135
+ /**
1136
+ * This method checks, whether the passed dom object is a dom object, that would
1137
+ * be split in cases of pressing enter. This currently is true for paragraphs
1138
+ * and headings
1139
+ * @param {DOMObject} el
1140
+ * dom object to check
1141
+ * @return {boolean} true for split objects, false for other
1142
+ * @method
1143
+ */
1144
+ isSplitObject: function (el) {
1145
+ return el.nodeType === 1 && blockElementNames.hasOwnProperty(el.nodeName);
1146
+ },
1147
+
1148
+ /**
1149
+ * Starting with the given position (between nodes), search in the given direction to an adjacent notempty text node
1150
+ * @param {DOMObject} parent parent node containing the position
1151
+ * @param {Integer} index index of the position within the parent node
1152
+ * @param {boolean} searchleft true when search direction is 'left' (default), false for 'right'
1153
+ * @param {object} stopat define at which types of element we shall stop, may contain the following properties
1154
+ * <pre>
1155
+ * - blocklevel (default: true)
1156
+ * - list (default: true)
1157
+ * - linebreak (default: true)
1158
+ * </pre>
1159
+ * @return {DOMObject} the found text node or false if none found
1160
+ * @method
1161
+ */
1162
+ searchAdjacentTextNode: function (parent, index, searchleft, stopat) {
1163
+ if (!parent || parent.nodeType !== 1 || index < 0 || index > parent.childNodes.length) {
1164
+ return false;
1165
+ }
1166
+
1167
+ if (typeof stopat === 'undefined') {
1168
+ stopat = {
1169
+ 'blocklevel': true,
1170
+ 'list': true,
1171
+ 'linebreak': true
1172
+ };
1173
+ }
1174
+
1175
+ if (typeof stopat.blocklevel === 'undefined') {
1176
+ stopat.blocklevel = true;
1177
+ }
1178
+ if (typeof stopat.list === 'undefined') {
1179
+ stopat.list = true;
1180
+ }
1181
+ if (typeof stopat.linebreak === 'undefined') {
1182
+ stopat.linebreak = true;
1183
+ }
1184
+
1185
+ if (typeof searchleft === 'undefined') {
1186
+ searchleft = true;
1187
+ }
1188
+
1189
+ var nextNode,
1190
+ currentParent = parent;
1191
+
1192
+ // start at the node left/right of the given position
1193
+ if (searchleft && index > 0) {
1194
+ nextNode = parent.childNodes[index - 1];
1195
+ }
1196
+ if (!searchleft && index < parent.childNodes.length) {
1197
+ nextNode = parent.childNodes[index];
1198
+ }
1199
+
1200
+ //currentParent is not a number therefore it is sufficient to directly test for it with while(currentParent)
1201
+ //otherwise there would be an error if the object is null
1202
+ while (currentParent) {
1203
+ //while (typeof currentParent !== 'undefined') {
1204
+ if (!nextNode) {
1205
+ // no next node found, check whether the parent is a blocklevel element
1206
+ if (stopat.blocklevel && this.isBlockLevelElement(currentParent)) {
1207
+ // do not leave block level elements
1208
+ return false;
1209
+ }
1210
+ if (stopat.list && this.isListElement(currentParent)) {
1211
+ // do not leave list elements
1212
+ return false;
1213
+ }
1214
+ // continue with the parent
1215
+ nextNode = searchleft ? currentParent.previousSibling : currentParent.nextSibling;
1216
+ currentParent = currentParent.parentNode;
1217
+ continue;
1218
+ } else if (nextNode.nodeType === 3 && jQuery.trim(nextNode.data).length > 0) {
1219
+ // we are lucky and found a notempty text node
1220
+ return nextNode;
1221
+ }
1222
+ if (stopat.blocklevel && this.isBlockLevelElement(nextNode)) {
1223
+ // we found a blocklevel element, stop here
1224
+ return false;
1225
+ }
1226
+ if (stopat.linebreak && this.isLineBreakElement(nextNode)) {
1227
+ // we found a linebreak, stop here
1228
+ return false;
1229
+ }
1230
+ if (stopat.list && this.isListElement(nextNode)) {
1231
+ // we found a linebreak, stop here
1232
+ return false;
1233
+ }
1234
+ if (nextNode.nodeType === 3) {
1235
+ // we found an empty text node, so step to the next
1236
+ nextNode = searchleft ? nextNode.previousSibling : nextNode.nextSibling;
1237
+ } else {
1238
+ // we found a non-blocklevel element, step into
1239
+ currentParent = nextNode;
1240
+ nextNode = searchleft ? nextNode.lastChild : nextNode.firstChild;
1241
+ }
1242
+ }
1243
+ },
1244
+
1245
+ /**
1246
+ * Insert the given DOM Object into the start/end of the given range. The method
1247
+ * will find the appropriate place in the DOM tree for inserting the given
1248
+ * object, and will eventually split elements in between. The given range will
1249
+ * be updated if necessary. The updated range will NOT embrace the inserted
1250
+ * object, which means that the object is actually inserted before or after the
1251
+ * given range (depending on the atEnd parameter)
1252
+ *
1253
+ * @param {jQuery}
1254
+ * object object to insert into the DOM
1255
+ * @param {GENTICS.Utils.RangeObject}
1256
+ * range range where to insert the object (at start or end)
1257
+ * @param {jQuery}
1258
+ * limit limiting object(s) of the DOM modification
1259
+ * @param {boolean}
1260
+ * atEnd true when the object shall be inserted at the end, false for
1261
+ * insertion at the start (default)
1262
+ * @param {boolean}
1263
+ * true when the insertion shall be done, even if inserting the element
1264
+ * would not be allowed, false to deny inserting unallowed elements (default)
1265
+ * @return true if the object could be inserted, false if not.
1266
+ * @method
1267
+ */
1268
+ insertIntoDOM: function (object, range, limit, atEnd, force) {
1269
+ // first find the appropriate place to insert the given object
1270
+ var parentElements = range.getContainerParents(limit, atEnd),
1271
+ that = this,
1272
+ newParent,
1273
+ container,
1274
+ offset,
1275
+ splitParts,
1276
+ contents;
1277
+
1278
+ if (!limit) {
1279
+ limit = jQuery(document.body);
1280
+ }
1281
+
1282
+ // if no parent elements exist (up to the limit), the new parent will be the
1283
+ // limiter itself
1284
+ if (parentElements.length === 0) {
1285
+ newParent = limit.get(0);
1286
+ } else {
1287
+ jQuery.each(parentElements, function (index, parent) {
1288
+ if (that.allowsNesting(parent, object.get(0))) {
1289
+ newParent = parent;
1290
+ return false;
1291
+ }
1292
+ });
1293
+ }
1294
+
1295
+ if (typeof newParent === 'undefined' && limit.length > 0) {
1296
+ // found no possible new parent, so split up to the limit object
1297
+ newParent = limit.get(0);
1298
+ }
1299
+
1300
+ // check whether it is allowed to insert the element at all
1301
+ if (!this.allowsNesting(newParent, object.get(0)) && !force) {
1302
+ return false;
1303
+ }
1304
+
1305
+ if (typeof newParent !== 'undefined') {
1306
+ // we found a possible new parent, so we split the DOM up to the new parent
1307
+ splitParts = this.split(range, jQuery(newParent), atEnd);
1308
+ if (splitParts === true) {
1309
+ // DOM was not split (there was no need to split it), insert the new object anyway
1310
+ container = range.startContainer;
1311
+ offset = range.startOffset;
1312
+ if (atEnd) {
1313
+ container = range.endContainer;
1314
+ offset = range.endOffset;
1315
+ }
1316
+ if (offset === 0) {
1317
+ // insert right before the first element in the container
1318
+ contents = jQuery(container).contents();
1319
+ if (contents.length > 0) {
1320
+ contents.eq(0).before(object);
1321
+ } else {
1322
+ jQuery(container).append(object);
1323
+ }
1324
+ return true;
1325
+ }
1326
+ // insert right after the element at offset-1
1327
+ jQuery(container).contents().eq(offset - 1).after(object);
1328
+ return true;
1329
+ }
1330
+ if (splitParts) {
1331
+ // ASSERT(splitParts.length === 2)
1332
+ var head = splitParts[0];
1333
+ var tail = splitParts[1];
1334
+ insertAfterSplit(head, object);
1335
+ if (isPhantomNode(tail)) {
1336
+ var afterTail = tail.nextSibling
1337
+ || (tail.parentNode && tail.parentNode.nextSibling);
1338
+ if (findNodeForward(afterTail, isNotVisiblyEmpty)) {
1339
+ // Because the tail element that is generated from
1340
+ // the splitting is superfluous since there is
1341
+ // already a visible element in which to place the
1342
+ // selection.
1343
+ jQuery(tail).remove();
1344
+ }
1345
+ }
1346
+ return true;
1347
+ }
1348
+ // could not split, so could not insert
1349
+ return false;
1350
+ }
1351
+ // found no possible new parent, so we shall not insert
1352
+ return false;
1353
+ },
1354
+
1355
+ /**
1356
+ * Remove the given DOM object from the DOM and modify the given range to reflect the user expected range after the object was removed
1357
+ * TODO: finish this
1358
+ * @param {DOMObject} object DOM object to remove
1359
+ * @param {GENTICS.Utils.RangeObject} range range which eventually be modified
1360
+ * @param {boolean} preserveContent true if the contents of the removed DOM object shall be preserved, false if not (default: false)
1361
+ * @return true if the DOM object could be removed, false if not
1362
+ * @hide
1363
+ */
1364
+ removeFromDOM: function (object, range, preserveContent) {
1365
+ if (preserveContent) {
1366
+ // check whether the range will need modification
1367
+ var indexInParent = this.getIndexInParent(object),
1368
+ numChildren = jQuery(object).contents().length,
1369
+ parent = object.parentNode;
1370
+
1371
+ if (range.startContainer == parent && range.startOffset > indexInParent) {
1372
+ range.startOffset += numChildren - 1;
1373
+ } else if (range.startContainer == object) {
1374
+ range.startContainer = parent;
1375
+ range.startOffset = indexInParent + range.startOffset;
1376
+ }
1377
+
1378
+ if (range.endContainer == parent && range.endOffset > indexInParent) {
1379
+ range.endOffset += numChildren - 1;
1380
+ } else if (range.endContainer == object) {
1381
+ range.endContainer = parent;
1382
+ range.endOffset = indexInParent + range.endOffset;
1383
+ }
1384
+
1385
+ // we simply unwrap the children of the object
1386
+ jQuery(object).contents().unwrap();
1387
+
1388
+ // optionally do cleanup
1389
+ this.doCleanup({
1390
+ 'merge': true
1391
+ }, range, parent);
1392
+ }
1393
+ },
1394
+
1395
+ /**
1396
+ * Remove the content defined by the given range from the DOM. Update the given
1397
+ * range object to be a collapsed selection at the place of the previous
1398
+ * selection.
1399
+ * @param rangeObject range object
1400
+ * @return true if the range could be removed, false if not
1401
+ */
1402
+ removeRange: function (rangeObject) {
1403
+ if (!rangeObject) {
1404
+ // no range given
1405
+ return false;
1406
+ }
1407
+ if (rangeObject.isCollapsed()) {
1408
+ // the range is collapsed, nothing to delete
1409
+ return false;
1410
+ }
1411
+
1412
+ // split partially contained text nodes at the start and end of the range
1413
+ if (rangeObject.startContainer.nodeType == 3
1414
+ && rangeObject.startOffset > 0
1415
+ && rangeObject.startOffset < rangeObject.startContainer.data.length) {
1416
+ this.split(rangeObject, jQuery(rangeObject.startContainer).parent(), false);
1417
+ }
1418
+ if (rangeObject.endContainer.nodeType == 3 && rangeObject.endOffset > 0 && rangeObject.endOffset < rangeObject.endContainer.data.length) {
1419
+ this.split(rangeObject, jQuery(rangeObject.endContainer).parent(), true);
1420
+ }
1421
+
1422
+ // construct the range tree
1423
+ var rangeTree = rangeObject.getRangeTree();
1424
+
1425
+ // collapse the range
1426
+ rangeObject.endContainer = rangeObject.startContainer;
1427
+ rangeObject.endOffset = rangeObject.startOffset;
1428
+
1429
+ // remove the markup from the range tree
1430
+ this.recursiveRemoveRange(rangeTree, rangeObject);
1431
+
1432
+ // do some cleanup
1433
+ this.doCleanup({
1434
+ 'merge': true
1435
+ }, rangeObject);
1436
+ // this.doCleanup({'merge' : true, 'removeempty' : true}, rangeObject);
1437
+
1438
+ // clear the caches of the range object
1439
+ rangeObject.clearCaches();
1440
+ },
1441
+
1442
+ recursiveRemoveRange: function (rangeTree, rangeObject) {
1443
+ // iterate over the rangetree objects of this level
1444
+ var i;
1445
+ for (i = 0; i < rangeTree.length; ++i) {
1446
+ // check for nodes fully in the range
1447
+ if (rangeTree[i].type == 'full') {
1448
+ // if the domobj is the startcontainer, or the startcontainer is inside the domobj, we need to update the rangeObject
1449
+ if (jQuery(rangeObject.startContainer).parents().andSelf().filter(rangeTree[i].domobj).length > 0) {
1450
+ rangeObject.startContainer = rangeObject.endContainer = rangeTree[i].domobj.parentNode;
1451
+ rangeObject.startOffset = rangeObject.endOffset = this.getIndexInParent(rangeTree[i].domobj);
1452
+ }
1453
+
1454
+ // remove the object from the DOM
1455
+ jQuery(rangeTree[i].domobj).remove();
1456
+ } else if (rangeTree[i].type == 'partial' && rangeTree[i].children) {
1457
+ // node partially selected and has children, so do recursion
1458
+ this.recursiveRemoveRange(rangeTree[i].children, rangeObject);
1459
+ }
1460
+ }
1461
+ },
1462
+
1463
+ /**
1464
+ * Extend the given range to have start and end at the nearest word boundaries to the left (start) and right (end)
1465
+ * @param {GENTICS.Utils.RangeObject} range range to be extended
1466
+ * @param {boolean} fromBoundaries true if extending will also be done, if one or both ends of the range already are at a word boundary, false if not, default: false
1467
+ * @method
1468
+ */
1469
+ extendToWord: function (range, fromBoundaries) {
1470
+ // search the word boundaries to the left and right
1471
+ var leftBoundary = this.searchWordBoundary(range.startContainer, range.startOffset, true),
1472
+ rightBoundary = this.searchWordBoundary(range.endContainer, range.endOffset, false);
1473
+
1474
+ // check whether we must not extend the range from word boundaries
1475
+ if (!fromBoundaries) {
1476
+ // we only extend the range if both ends would be different
1477
+ if (range.startContainer == leftBoundary.container && range.startOffset == leftBoundary.offset) {
1478
+ return;
1479
+ }
1480
+ if (range.endContainer == rightBoundary.container && range.endOffset == rightBoundary.offset) {
1481
+ return;
1482
+ }
1483
+ }
1484
+
1485
+ // set the new boundaries
1486
+ range.startContainer = leftBoundary.container;
1487
+ range.startOffset = leftBoundary.offset;
1488
+ range.endContainer = rightBoundary.container;
1489
+ range.endOffset = rightBoundary.offset;
1490
+
1491
+ // correct the range
1492
+ range.correctRange();
1493
+
1494
+ // clear caches
1495
+ range.clearCaches();
1496
+ },
1497
+
1498
+ /**
1499
+ * Helper method to check whether the given DOM object is a word boundary.
1500
+ * @param {DOMObject} object DOM object in question
1501
+ * @return {boolean} true when the DOM object is a word boundary, false if not
1502
+ * @hide
1503
+ */
1504
+ isWordBoundaryElement: function (object) {
1505
+ if (!object || !object.nodeName) {
1506
+ return false;
1507
+ }
1508
+ return jQuery.inArray(object.nodeName.toLowerCase(), this.nonWordBoundaryTags) == -1;
1509
+ },
1510
+
1511
+ /**
1512
+ * Search for the next word boundary, starting at the given position
1513
+ * @param {DOMObject} container container of the start position
1514
+ * @param {Integer} offset offset of the start position
1515
+ * @param {boolean} searchleft true for searching to the left, false for searching to the right (default: true)
1516
+ * @return {object} object with properties 'container' and 'offset' marking the found word boundary
1517
+ * @method
1518
+ */
1519
+ searchWordBoundary: function (container, offset, searchleft) {
1520
+ if (typeof searchleft === 'undefined') {
1521
+ searchleft = true;
1522
+ }
1523
+ var boundaryFound = false,
1524
+ wordBoundaryPos,
1525
+ tempWordBoundaryPos,
1526
+ textNode;
1527
+ while (!boundaryFound) {
1528
+ // check the node type
1529
+ if (container.nodeType === 3) {
1530
+ // we are currently in a text node
1531
+
1532
+ // find the nearest word boundary character
1533
+ if (!searchleft) {
1534
+ // search right
1535
+ wordBoundaryPos = container.data.substring(offset).search(this.nonWordRegex);
1536
+ if (wordBoundaryPos != -1) {
1537
+ // found a word boundary
1538
+ offset = offset + wordBoundaryPos;
1539
+ boundaryFound = true;
1540
+ } else {
1541
+ // found no word boundary, so we set the position after the container
1542
+ offset = this.getIndexInParent(container) + 1;
1543
+ container = container.parentNode;
1544
+ }
1545
+ } else {
1546
+ // search left
1547
+ wordBoundaryPos = container.data.substring(0, offset).search(this.nonWordRegex);
1548
+ tempWordBoundaryPos = wordBoundaryPos;
1549
+ while (tempWordBoundaryPos != -1) {
1550
+ wordBoundaryPos = tempWordBoundaryPos;
1551
+ tempWordBoundaryPos = container.data.substring(wordBoundaryPos + 1, offset).search(this.nonWordRegex);
1552
+ if (tempWordBoundaryPos != -1) {
1553
+ tempWordBoundaryPos = tempWordBoundaryPos + wordBoundaryPos + 1;
1554
+ }
1555
+ }
1556
+
1557
+ if (wordBoundaryPos != -1) {
1558
+ // found a word boundary
1559
+ offset = wordBoundaryPos + 1;
1560
+ boundaryFound = true;
1561
+ } else {
1562
+ // found no word boundary, so we set the position before the container
1563
+ offset = this.getIndexInParent(container);
1564
+ container = container.parentNode;
1565
+ }
1566
+ }
1567
+ } else if (container.nodeType === 1) {
1568
+ // we are currently in an element node (between nodes)
1569
+
1570
+ if (!searchleft) {
1571
+ // check whether there is an element to the right
1572
+ if (offset < container.childNodes.length) {
1573
+ // there is an element to the right, check whether it is a word boundary element
1574
+ if (this.isWordBoundaryElement(container.childNodes[offset])) {
1575
+ // we are done
1576
+ boundaryFound = true;
1577
+ } else {
1578
+ // element to the right is no word boundary, so enter it
1579
+ container = container.childNodes[offset];
1580
+ offset = 0;
1581
+ }
1582
+ } else {
1583
+ // no element to the right, check whether the element itself is a boundary element
1584
+ if (this.isWordBoundaryElement(container)) {
1585
+ // we are done
1586
+ boundaryFound = true;
1587
+ } else {
1588
+ // element itself is no boundary element, so go to parent
1589
+ offset = this.getIndexInParent(container) + 1;
1590
+ container = container.parentNode;
1591
+ }
1592
+ }
1593
+ } else {
1594
+ // check whether there is an element to the left
1595
+ if (offset > 0) {
1596
+ // there is an element to the left, check whether it is a word boundary element
1597
+ if (this.isWordBoundaryElement(container.childNodes[offset - 1])) {
1598
+ // we are done
1599
+ boundaryFound = true;
1600
+ } else {
1601
+ // element to the left is no word boundary, so enter it
1602
+ container = container.childNodes[offset - 1];
1603
+ offset = container.nodeType === 3 ? container.data.length : container.childNodes.length;
1604
+ }
1605
+ } else {
1606
+ // no element to the left, check whether the element itself is a boundary element
1607
+ if (this.isWordBoundaryElement(container)) {
1608
+ // we are done
1609
+ boundaryFound = true;
1610
+ } else {
1611
+ // element itself is no boundary element, so go to parent
1612
+ offset = this.getIndexInParent(container);
1613
+ container = container.parentNode;
1614
+ }
1615
+ }
1616
+ }
1617
+ }
1618
+ }
1619
+
1620
+ if (container.nodeType !== 3) {
1621
+ textNode = this.searchAdjacentTextNode(container, offset, !searchleft);
1622
+ if (textNode) {
1623
+ container = textNode;
1624
+ offset = searchleft ? 0 : container.data.length;
1625
+ }
1626
+ }
1627
+
1628
+ return {
1629
+ 'container': container,
1630
+ 'offset': offset
1631
+ };
1632
+ },
1633
+
1634
+ /**
1635
+ * Check whether the given dom object is empty
1636
+ * @param {DOMObject} domObject object to check
1637
+ * @return {boolean} true when the object is empty, false if not
1638
+ * @method
1639
+ */
1640
+ isEmpty: function (domObject) {
1641
+ // a non dom object is considered empty
1642
+ if (!domObject) {
1643
+ return true;
1644
+ }
1645
+
1646
+ // some tags are considered to be non-empty
1647
+ if (jQuery.inArray(domObject.nodeName.toLowerCase(), this.nonEmptyTags) != -1) {
1648
+ return false;
1649
+ }
1650
+
1651
+ // text nodes are not empty, if they contain non-whitespace characters
1652
+ if (domObject.nodeType === 3) {
1653
+ if (domObject.data.search(/\S/) == -1) {
1654
+ return true;
1655
+ } else if (domObject.data.length === 1 // Fix FOR IE no width chars
1656
+ && domObject.data.charCodeAt(0) >= 0x2000) {
1657
+ return true;
1658
+ }
1659
+
1660
+ return false;
1661
+ }
1662
+
1663
+ // all other nodes are not empty if they contain at least one child which is not empty
1664
+ var i, childNodes;
1665
+ for (i = 0, childNodes = domObject.childNodes.length; i < childNodes; ++i) {
1666
+ if (!this.isEmpty(domObject.childNodes[i])) {
1667
+ return false;
1668
+ }
1669
+ }
1670
+
1671
+ // found no contents, so the element is empty
1672
+ return true;
1673
+ },
1674
+
1675
+ /**
1676
+ * Set the cursor (collapsed selection) right after the given DOM object
1677
+ * @param domObject DOM object
1678
+ * @method
1679
+ */
1680
+ setCursorAfter: function (domObject) {
1681
+ var newRange = new GENTICS.Utils.RangeObject(),
1682
+ index = this.getIndexInParent(domObject),
1683
+ targetNode,
1684
+ offset;
1685
+
1686
+ // selection cannot be set between to TEXT_NODEs
1687
+ // if domOject is a Text node set selection at last position in that node
1688
+ if (domObject.nodeType == 3) {
1689
+ targetNode = domObject;
1690
+ offset = targetNode.nodeValue.length;
1691
+
1692
+ // if domOject is a Text node set selection at last position in that node
1693
+ } else if (domObject.nextSibling && domObject.nextSibling.nodeType == 3) {
1694
+ targetNode = domObject.nextSibling;
1695
+ offset = 0;
1696
+ } else {
1697
+ targetNode = domObject.parentNode;
1698
+ offset = this.getIndexInParent(domObject) + 1;
1699
+ }
1700
+
1701
+ newRange.startContainer = newRange.endContainer = targetNode;
1702
+ newRange.startOffset = newRange.endOffset = offset;
1703
+
1704
+ // select the range
1705
+ newRange.select();
1706
+
1707
+ return newRange;
1708
+ },
1709
+
1710
+ /**
1711
+ * Select a DOM node
1712
+ * will create a new range which spans the provided dom node and selects it afterwards
1713
+ * @param domObject DOM object
1714
+ * @method
1715
+ */
1716
+ selectDomNode: function (domObject) {
1717
+ var newRange = new GENTICS.Utils.RangeObject();
1718
+ newRange.startContainer = newRange.endContainer = domObject.parentNode;
1719
+ newRange.startOffset = this.getIndexInParent(domObject);
1720
+ newRange.endOffset = newRange.startOffset + 1;
1721
+ newRange.select();
1722
+ },
1723
+
1724
+ /**
1725
+ * Set the cursor (collapsed selection) at the start into the given DOM object
1726
+ * @param domObject DOM object
1727
+ * @method
1728
+ */
1729
+ setCursorInto: function (domObject) {
1730
+ // set a new range into the given dom object
1731
+ var newRange = new GENTICS.Utils.RangeObject();
1732
+ newRange.startContainer = newRange.endContainer = domObject;
1733
+ newRange.startOffset = newRange.endOffset = 0;
1734
+
1735
+ // select the range
1736
+ newRange.select();
1737
+ },
1738
+
1739
+
1740
+ /**
1741
+ * "An editing host is a node that is either an Element with a contenteditable
1742
+ * attribute set to the true state, or the Element child of a Document whose
1743
+ * designMode is enabled."
1744
+ * @param domObject DOM object
1745
+ * @method
1746
+ */
1747
+ isEditingHost: function (node) {
1748
+ return node
1749
+ && node.nodeType == 1 //ELEMENT_NODE
1750
+ && (node.contentEditable == "true" || (node.parentNode && node.parentNode.nodeType == 9 //DOCUEMENT_NODE
1751
+ && node.parentNode.designMode == "on"));
1752
+ },
1753
+
1754
+ /**
1755
+ * "Something is editable if it is a node which is not an editing host, does
1756
+ * not have a contenteditable attribute set to the false state, and whose
1757
+ * parent is an editing host or editable."
1758
+ * @param domObject DOM object
1759
+ * @method
1760
+ */
1761
+ isEditable: function (node) {
1762
+ // This is slightly a lie, because we're excluding non-HTML elements with
1763
+ // contentEditable attributes.
1764
+ return node
1765
+ && !this.isEditingHost(node)
1766
+ && (node.nodeType != 1 || node.contentEditable != "false") // ELEMENT_NODE
1767
+ && (this.isEditingHost(node.parentNode) || this.isEditable(node.parentNode));
1768
+ },
1769
+
1770
+ /**
1771
+ * "The editing host of node is null if node is neither editable nor an editing
1772
+ * host; node itself, if node is an editing host; or the nearest ancestor of
1773
+ * node that is an editing host, if node is editable."
1774
+ * @param domObject DOM object
1775
+ * @method
1776
+ */
1777
+ getEditingHostOf: function (node) {
1778
+ if (this.isEditingHost(node)) {
1779
+ return node;
1780
+ }
1781
+ if (this.isEditable(node)) {
1782
+ var ancestor = node.parentNode;
1783
+ while (!this.isEditingHost(ancestor)) {
1784
+ ancestor = ancestor.parentNode;
1785
+ }
1786
+ return ancestor;
1787
+ }
1788
+ return null;
1789
+ },
1790
+
1791
+ /**
1792
+ *
1793
+ * "Two nodes are in the same editing host if the editing host of the first is
1794
+ * non-null and the same as the editing host of the second."
1795
+ * @param node1 DOM object
1796
+ * @param node2 DOM object
1797
+ * @method
1798
+ */
1799
+ inSameEditingHost: function (node1, node2) {
1800
+ return this.getEditingHostOf(node1) && this.getEditingHostOf(node1) == this.getEditingHostOf(node2);
1801
+ },
1802
+
1803
+ // "A block node is either an Element whose "display" property does not have
1804
+ // resolved value "inline" or "inline-block" or "inline-table" or "none", or a
1805
+ // Document, or a DocumentFragment."
1806
+ isBlockNode: function (node) {
1807
+ return node && ((node.nodeType == $_.Node.ELEMENT_NODE && $_(["inline", "inline-block", "inline-table", "none"]).indexOf($_.getComputedStyle(node).display) == -1) || node.nodeType == $_.Node.DOCUMENT_NODE || node.nodeType == $_.Node.DOCUMENT_FRAGMENT_NODE);
1808
+ },
1809
+
1810
+ /**
1811
+ * Get the first visible child of the given node.
1812
+ * @param node node
1813
+ * @param includeNode when set to true, the node itself may be returned, otherwise only children are allowed
1814
+ * @return first visible child or null if none found
1815
+ */
1816
+ getFirstVisibleChild: function (node, includeNode) {
1817
+ // no node -> no child
1818
+ if (!node) {
1819
+ return null;
1820
+ }
1821
+
1822
+ // check whether the node itself is visible
1823
+ if ((node.nodeType == $_.Node.TEXT_NODE && this.isEmpty(node)) || (node.nodeType == $_.Node.ELEMENT_NODE && node.offsetHeight == 0 && jQuery.inArray(node.nodeName.toLowerCase(), this.nonEmptyTags) === -1)) {
1824
+ return null;
1825
+ }
1826
+
1827
+ // if the node is a text node, or does not have children, or is not editable, it is the first visible child
1828
+ if (node.nodeType == $_.Node.TEXT_NODE || (node.nodeType == $_.Node.ELEMENT_NODE && node.childNodes.length == 0) || !jQuery(node).contentEditable()) {
1829
+ return includeNode ? node : null;
1830
+ }
1831
+
1832
+ // otherwise traverse through the children
1833
+ var i;
1834
+ for (i = 0; i < node.childNodes.length; ++i) {
1835
+ var visibleChild = this.getFirstVisibleChild(node.childNodes[i], true);
1836
+ if (visibleChild != null) {
1837
+ return visibleChild;
1838
+ }
1839
+ }
1840
+
1841
+ return null;
1842
+ },
1843
+
1844
+ /**
1845
+ * Get the last visible child of the given node.
1846
+ * @param node node
1847
+ * @param includeNode when set to true, the node itself may be returned, otherwise only children are allowed
1848
+ * @return last visible child or null if none found
1849
+ */
1850
+ getLastVisibleChild: function (node, includeNode) {
1851
+ // no node -> no child
1852
+ if (!node) {
1853
+ return null;
1854
+ }
1855
+
1856
+ // check whether the node itself is visible
1857
+ if ((node.nodeType == $_.Node.TEXT_NODE && this.isEmpty(node)) || (node.nodeType == $_.Node.ELEMENT_NODE && node.offsetHeight == 0 && jQuery.inArray(node.nodeName.toLowerCase(), this.nonEmptyTags) === -1)) {
1858
+ return null;
1859
+ }
1860
+
1861
+ // if the node is a text node, or does not have children, or is not editable, it is the first visible child
1862
+ if (node.nodeType == $_.Node.TEXT_NODE || (node.nodeType == $_.Node.ELEMENT_NODE && node.childNodes.length == 0) || !jQuery(node).contentEditable()) {
1863
+ return includeNode ? node : null;
1864
+ }
1865
+
1866
+ // otherwise traverse through the children
1867
+ var i;
1868
+ for (i = node.childNodes.length - 1; i >= 0; --i) {
1869
+ var visibleChild = this.getLastVisibleChild(node.childNodes[i], true);
1870
+ if (visibleChild != null) {
1871
+ return visibleChild;
1872
+ }
1873
+ }
1874
+
1875
+ return null;
1876
+ }
1877
+ });
1878
+
1879
+
1880
+ /**
1881
+ * Create the singleton object
1882
+ * @hide
1883
+ */
1884
+ GENTICS.Utils.Dom = new Dom();
1885
+
1886
+ return GENTICS.Utils.Dom;
1887
+
1888
+ });