esp-ckeditor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +32 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/javascripts/esp-ckeditor/_source/core/_bootstrap.js +87 -0
  5. data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor.js +141 -0
  6. data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor_base.js +227 -0
  7. data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor_basic.js +238 -0
  8. data/app/assets/javascripts/esp-ckeditor/_source/core/command.js +209 -0
  9. data/app/assets/javascripts/esp-ckeditor/_source/core/commanddefinition.js +129 -0
  10. data/app/assets/javascripts/esp-ckeditor/_source/core/config.js +423 -0
  11. data/app/assets/javascripts/esp-ckeditor/_source/core/dataprocessor.js +65 -0
  12. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/comment.js +32 -0
  13. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/document.js +251 -0
  14. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/documentfragment.js +49 -0
  15. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/domobject.js +258 -0
  16. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/element.js +1691 -0
  17. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/elementpath.js +119 -0
  18. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/event.js +145 -0
  19. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/node.js +696 -0
  20. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/nodelist.js +26 -0
  21. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/range.js +2054 -0
  22. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/rangelist.js +213 -0
  23. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/text.js +128 -0
  24. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/walker.js +462 -0
  25. data/app/assets/javascripts/esp-ckeditor/_source/core/dom/window.js +96 -0
  26. data/app/assets/javascripts/esp-ckeditor/_source/core/dom.js +20 -0
  27. data/app/assets/javascripts/esp-ckeditor/_source/core/dtd.js +266 -0
  28. data/app/assets/javascripts/esp-ckeditor/_source/core/editor.js +1060 -0
  29. data/app/assets/javascripts/esp-ckeditor/_source/core/editor_basic.js +186 -0
  30. data/app/assets/javascripts/esp-ckeditor/_source/core/env.js +305 -0
  31. data/app/assets/javascripts/esp-ckeditor/_source/core/event.js +342 -0
  32. data/app/assets/javascripts/esp-ckeditor/_source/core/eventInfo.js +120 -0
  33. data/app/assets/javascripts/esp-ckeditor/_source/core/focusmanager.js +152 -0
  34. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/basicwriter.js +145 -0
  35. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/cdata.js +43 -0
  36. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/comment.js +60 -0
  37. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/element.js +308 -0
  38. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/filter.js +288 -0
  39. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/fragment.js +518 -0
  40. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/text.js +53 -0
  41. data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser.js +224 -0
  42. data/app/assets/javascripts/esp-ckeditor/_source/core/lang.js +157 -0
  43. data/app/assets/javascripts/esp-ckeditor/_source/core/loader.js +240 -0
  44. data/app/assets/javascripts/esp-ckeditor/_source/core/plugindefinition.js +83 -0
  45. data/app/assets/javascripts/esp-ckeditor/_source/core/plugins.js +103 -0
  46. data/app/assets/javascripts/esp-ckeditor/_source/core/resourcemanager.js +238 -0
  47. data/app/assets/javascripts/esp-ckeditor/_source/core/scriptloader.js +180 -0
  48. data/app/assets/javascripts/esp-ckeditor/_source/core/skins.js +184 -0
  49. data/app/assets/javascripts/esp-ckeditor/_source/core/themes.js +19 -0
  50. data/app/assets/javascripts/esp-ckeditor/_source/core/tools.js +763 -0
  51. data/app/assets/javascripts/esp-ckeditor/_source/core/ui.js +128 -0
  52. data/app/assets/javascripts/esp-ckeditor/_source/lang/_languages.js +27 -0
  53. data/app/assets/javascripts/esp-ckeditor/_source/lang/en.js +815 -0
  54. data/app/assets/javascripts/esp-ckeditor/_source/lang/ru.js +815 -0
  55. data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js +222 -0
  56. data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/lang/en.js +108 -0
  57. data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/lang/he.js +216 -0
  58. data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/plugin.js +47 -0
  59. data/app/assets/javascripts/esp-ckeditor/_source/plugins/basicstyles/plugin.js +129 -0
  60. data/app/assets/javascripts/esp-ckeditor/_source/plugins/button/plugin.js +290 -0
  61. data/app/assets/javascripts/esp-ckeditor/_source/plugins/clipboard/dialogs/paste.js +223 -0
  62. data/app/assets/javascripts/esp-ckeditor/_source/plugins/clipboard/plugin.js +453 -0
  63. data/app/assets/javascripts/esp-ckeditor/_source/plugins/contextmenu/plugin.js +179 -0
  64. data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialog/dialogDefinition.js +1166 -0
  65. data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialog/plugin.js +3308 -0
  66. data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialogadvtab/plugin.js +208 -0
  67. data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialogui/plugin.js +1541 -0
  68. data/app/assets/javascripts/esp-ckeditor/_source/plugins/domiterator/plugin.js +361 -0
  69. data/app/assets/javascripts/esp-ckeditor/_source/plugins/editingblock/plugin.js +278 -0
  70. data/app/assets/javascripts/esp-ckeditor/_source/plugins/elementspath/plugin.js +218 -0
  71. data/app/assets/javascripts/esp-ckeditor/_source/plugins/enterkey/plugin.js +433 -0
  72. data/app/assets/javascripts/esp-ckeditor/_source/plugins/entities/plugin.js +250 -0
  73. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/dialogs/esp_attachment.js +234 -0
  74. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/images/esp_attachment.png +0 -0
  75. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/en.js +22 -0
  76. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/ru.js +22 -0
  77. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/uk.js +22 -0
  78. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/plugin.js +23 -0
  79. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/dialogs/esp_audio.js +207 -0
  80. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/images/esp_audio.png +0 -0
  81. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/images/placeholder.png +0 -0
  82. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/en.js +18 -0
  83. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/ru.js +18 -0
  84. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/uk.js +18 -0
  85. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/plugin.js +182 -0
  86. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_blockquote/dialogs/esp_blockquote.js +132 -0
  87. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_blockquote/plugin.js +235 -0
  88. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/dialogs/esp_image.js +1414 -0
  89. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/images/esp_image.png +0 -0
  90. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/en.js +9 -0
  91. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/ru.js +9 -0
  92. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/uk.js +9 -0
  93. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/plugin.js +80 -0
  94. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/dialogs/esp_anchor.js +145 -0
  95. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/dialogs/esp_link.js +1396 -0
  96. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/anchor.png +0 -0
  97. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_anchor.png +0 -0
  98. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_link.png +0 -0
  99. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_unlink.png +0 -0
  100. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/en.js +8 -0
  101. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/ru.js +8 -0
  102. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/uk.js +8 -0
  103. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/plugin.js +379 -0
  104. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_address.png +0 -0
  105. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_blockquote.png +0 -0
  106. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_div.png +0 -0
  107. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h1.png +0 -0
  108. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h2.png +0 -0
  109. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h3.png +0 -0
  110. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h4.png +0 -0
  111. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h5.png +0 -0
  112. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h6.png +0 -0
  113. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_p.png +0 -0
  114. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_pre.png +0 -0
  115. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/esp_showblocks.png +0 -0
  116. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/plugin.js +163 -0
  117. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/dialogs/esp_video.js +277 -0
  118. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/images/esp_video.png +0 -0
  119. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/images/placeholder.png +0 -0
  120. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/en.js +19 -0
  121. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/ru.js +19 -0
  122. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/uk.js +19 -0
  123. data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/plugin.js +182 -0
  124. data/app/assets/javascripts/esp-ckeditor/_source/plugins/fakeobjects/plugin.js +175 -0
  125. data/app/assets/javascripts/esp-ckeditor/_source/plugins/filebrowser/plugin.js +534 -0
  126. data/app/assets/javascripts/esp-ckeditor/_source/plugins/find/dialogs/find.js +915 -0
  127. data/app/assets/javascripts/esp-ckeditor/_source/plugins/find/plugin.js +47 -0
  128. data/app/assets/javascripts/esp-ckeditor/_source/plugins/floatpanel/plugin.js +428 -0
  129. data/app/assets/javascripts/esp-ckeditor/_source/plugins/format/plugin.js +197 -0
  130. data/app/assets/javascripts/esp-ckeditor/_source/plugins/htmldataprocessor/plugin.js +596 -0
  131. data/app/assets/javascripts/esp-ckeditor/_source/plugins/htmlwriter/plugin.js +319 -0
  132. data/app/assets/javascripts/esp-ckeditor/_source/plugins/image/dialogs/image.js +1407 -0
  133. data/app/assets/javascripts/esp-ckeditor/_source/plugins/image/plugin.js +81 -0
  134. data/app/assets/javascripts/esp-ckeditor/_source/plugins/indent/plugin.js +461 -0
  135. data/app/assets/javascripts/esp-ckeditor/_source/plugins/justify/plugin.js +253 -0
  136. data/app/assets/javascripts/esp-ckeditor/_source/plugins/keystrokes/plugin.js +225 -0
  137. data/app/assets/javascripts/esp-ckeditor/_source/plugins/list/plugin.js +774 -0
  138. data/app/assets/javascripts/esp-ckeditor/_source/plugins/listblock/plugin.js +266 -0
  139. data/app/assets/javascripts/esp-ckeditor/_source/plugins/liststyle/dialogs/liststyle.js +225 -0
  140. data/app/assets/javascripts/esp-ckeditor/_source/plugins/liststyle/plugin.js +66 -0
  141. data/app/assets/javascripts/esp-ckeditor/_source/plugins/maximize/plugin.js +353 -0
  142. data/app/assets/javascripts/esp-ckeditor/_source/plugins/menu/plugin.js +541 -0
  143. data/app/assets/javascripts/esp-ckeditor/_source/plugins/panel/plugin.js +400 -0
  144. data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastefromword/filter/default.js +1367 -0
  145. data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastefromword/plugin.js +141 -0
  146. data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastetext/dialogs/pastetext.js +67 -0
  147. data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastetext/plugin.js +98 -0
  148. data/app/assets/javascripts/esp-ckeditor/_source/plugins/popup/plugin.js +64 -0
  149. data/app/assets/javascripts/esp-ckeditor/_source/plugins/removeformat/plugin.js +185 -0
  150. data/app/assets/javascripts/esp-ckeditor/_source/plugins/resize/plugin.js +168 -0
  151. data/app/assets/javascripts/esp-ckeditor/_source/plugins/richcombo/plugin.js +381 -0
  152. data/app/assets/javascripts/esp-ckeditor/_source/plugins/selection/plugin.js +1729 -0
  153. data/app/assets/javascripts/esp-ckeditor/_source/plugins/showborders/plugin.js +207 -0
  154. data/app/assets/javascripts/esp-ckeditor/_source/plugins/sourcearea/plugin.js +209 -0
  155. data/app/assets/javascripts/esp-ckeditor/_source/plugins/styles/plugin.js +1700 -0
  156. data/app/assets/javascripts/esp-ckeditor/_source/plugins/styles/styles/default.js +88 -0
  157. data/app/assets/javascripts/esp-ckeditor/_source/plugins/stylescombo/plugin.js +218 -0
  158. data/app/assets/javascripts/esp-ckeditor/_source/plugins/tab/plugin.js +367 -0
  159. data/app/assets/javascripts/esp-ckeditor/_source/plugins/table/dialogs/table.js +623 -0
  160. data/app/assets/javascripts/esp-ckeditor/_source/plugins/table/plugin.js +78 -0
  161. data/app/assets/javascripts/esp-ckeditor/_source/plugins/tabletools/dialogs/tableCell.js +525 -0
  162. data/app/assets/javascripts/esp-ckeditor/_source/plugins/tabletools/plugin.js +1194 -0
  163. data/app/assets/javascripts/esp-ckeditor/_source/plugins/toolbar/plugin.js +545 -0
  164. data/app/assets/javascripts/esp-ckeditor/_source/plugins/undo/plugin.js +578 -0
  165. data/app/assets/javascripts/esp-ckeditor/_source/plugins/wysiwygarea/plugin.js +1347 -0
  166. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/dialog.css +988 -0
  167. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/editor.css +25 -0
  168. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/elementspath.css +73 -0
  169. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons.css +367 -0
  170. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons.png +0 -0
  171. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons_rtl.png +0 -0
  172. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides.gif +0 -0
  173. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides.png +0 -0
  174. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides_rtl.png +0 -0
  175. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/mini.gif +0 -0
  176. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/noimage.png +0 -0
  177. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/sprites.png +0 -0
  178. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/sprites_ie6.png +0 -0
  179. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/toolbar_start.gif +0 -0
  180. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/mainui.css +209 -0
  181. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/menu.css +232 -0
  182. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/panel.css +227 -0
  183. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/presets.css +49 -0
  184. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/reset.css +85 -0
  185. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/richcombo.css +287 -0
  186. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/skin.js +236 -0
  187. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/templates.css +88 -0
  188. data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/toolbar.css +412 -0
  189. data/app/assets/javascripts/esp-ckeditor/_source/themes/default/theme.js +407 -0
  190. data/app/assets/javascripts/esp-ckeditor/application.js +8 -0
  191. data/app/assets/javascripts/esp-ckeditor/ckeditor.js +137 -0
  192. data/app/assets/javascripts/esp-ckeditor/ckeditor.pack +194 -0
  193. data/app/assets/javascripts/esp-ckeditor/ckeditor_source.js +35 -0
  194. data/app/assets/javascripts/esp-ckeditor/ckpackager.jar +0 -0
  195. data/app/assets/javascripts/esp-ckeditor/ckpackager.txt +2 -0
  196. data/app/assets/javascripts/esp-ckeditor/config.js +147 -0
  197. data/app/assets/javascripts/esp-ckeditor/contents.css +38 -0
  198. data/app/assets/javascripts/esp-ckeditor/images/spacer.gif +0 -0
  199. data/app/assets/javascripts/esp-ckeditor/init_ckeditor.js +1 -0
  200. data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +1 -0
  201. data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/lang/en.js +1 -0
  202. data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/lang/he.js +1 -0
  203. data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/plugin.js +1 -0
  204. data/app/assets/javascripts/esp-ckeditor/plugins/basicstyles/plugin.js +1 -0
  205. data/app/assets/javascripts/esp-ckeditor/plugins/button/plugin.js +1 -0
  206. data/app/assets/javascripts/esp-ckeditor/plugins/clipboard/dialogs/paste.js +1 -0
  207. data/app/assets/javascripts/esp-ckeditor/plugins/clipboard/plugin.js +1 -0
  208. data/app/assets/javascripts/esp-ckeditor/plugins/contextmenu/plugin.js +1 -0
  209. data/app/assets/javascripts/esp-ckeditor/plugins/dialog/dialogDefinition.js +0 -0
  210. data/app/assets/javascripts/esp-ckeditor/plugins/dialog/plugin.js +1 -0
  211. data/app/assets/javascripts/esp-ckeditor/plugins/dialogadvtab/plugin.js +1 -0
  212. data/app/assets/javascripts/esp-ckeditor/plugins/dialogui/plugin.js +1 -0
  213. data/app/assets/javascripts/esp-ckeditor/plugins/domiterator/plugin.js +1 -0
  214. data/app/assets/javascripts/esp-ckeditor/plugins/editingblock/plugin.js +1 -0
  215. data/app/assets/javascripts/esp-ckeditor/plugins/elementspath/plugin.js +1 -0
  216. data/app/assets/javascripts/esp-ckeditor/plugins/enterkey/plugin.js +1 -0
  217. data/app/assets/javascripts/esp-ckeditor/plugins/entities/plugin.js +1 -0
  218. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/dialogs/esp_attachment.js +1 -0
  219. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/images/esp_attachment.png +0 -0
  220. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/en.js +1 -0
  221. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/ru.js +1 -0
  222. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/uk.js +1 -0
  223. data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/plugin.js +1 -0
  224. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/dialogs/esp_audio.js +1 -0
  225. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/images/esp_audio.png +0 -0
  226. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/images/placeholder.png +0 -0
  227. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/en.js +1 -0
  228. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/ru.js +1 -0
  229. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/uk.js +1 -0
  230. data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/plugin.js +1 -0
  231. data/app/assets/javascripts/esp-ckeditor/plugins/esp_blockquote/dialogs/esp_blockquote.js +1 -0
  232. data/app/assets/javascripts/esp-ckeditor/plugins/esp_blockquote/plugin.js +1 -0
  233. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/dialogs/esp_image.js +1 -0
  234. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/images/esp_image.png +0 -0
  235. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/en.js +1 -0
  236. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/ru.js +1 -0
  237. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/uk.js +1 -0
  238. data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/plugin.js +1 -0
  239. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/dialogs/esp_anchor.js +1 -0
  240. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/dialogs/esp_link.js +1 -0
  241. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/anchor.png +0 -0
  242. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_anchor.png +0 -0
  243. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_link.png +0 -0
  244. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_unlink.png +0 -0
  245. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/en.js +1 -0
  246. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/ru.js +1 -0
  247. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/uk.js +1 -0
  248. data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/plugin.js +1 -0
  249. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_address.png +0 -0
  250. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_blockquote.png +0 -0
  251. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_div.png +0 -0
  252. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h1.png +0 -0
  253. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h2.png +0 -0
  254. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h3.png +0 -0
  255. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h4.png +0 -0
  256. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h5.png +0 -0
  257. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h6.png +0 -0
  258. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_p.png +0 -0
  259. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_pre.png +0 -0
  260. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/esp_showblocks.png +0 -0
  261. data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/plugin.js +1 -0
  262. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/dialogs/esp_video.js +1 -0
  263. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/images/esp_video.png +0 -0
  264. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/images/placeholder.png +0 -0
  265. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/en.js +1 -0
  266. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/ru.js +1 -0
  267. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/uk.js +1 -0
  268. data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/plugin.js +1 -0
  269. data/app/assets/javascripts/esp-ckeditor/plugins/fakeobjects/plugin.js +1 -0
  270. data/app/assets/javascripts/esp-ckeditor/plugins/filebrowser/plugin.js +1 -0
  271. data/app/assets/javascripts/esp-ckeditor/plugins/find/dialogs/find.js +1 -0
  272. data/app/assets/javascripts/esp-ckeditor/plugins/find/plugin.js +1 -0
  273. data/app/assets/javascripts/esp-ckeditor/plugins/floatpanel/plugin.js +1 -0
  274. data/app/assets/javascripts/esp-ckeditor/plugins/format/plugin.js +1 -0
  275. data/app/assets/javascripts/esp-ckeditor/plugins/htmldataprocessor/plugin.js +1 -0
  276. data/app/assets/javascripts/esp-ckeditor/plugins/htmlwriter/plugin.js +1 -0
  277. data/app/assets/javascripts/esp-ckeditor/plugins/image/dialogs/image.js +1 -0
  278. data/app/assets/javascripts/esp-ckeditor/plugins/image/plugin.js +1 -0
  279. data/app/assets/javascripts/esp-ckeditor/plugins/indent/plugin.js +1 -0
  280. data/app/assets/javascripts/esp-ckeditor/plugins/justify/plugin.js +1 -0
  281. data/app/assets/javascripts/esp-ckeditor/plugins/keystrokes/plugin.js +1 -0
  282. data/app/assets/javascripts/esp-ckeditor/plugins/list/plugin.js +1 -0
  283. data/app/assets/javascripts/esp-ckeditor/plugins/listblock/plugin.js +1 -0
  284. data/app/assets/javascripts/esp-ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -0
  285. data/app/assets/javascripts/esp-ckeditor/plugins/liststyle/plugin.js +1 -0
  286. data/app/assets/javascripts/esp-ckeditor/plugins/maximize/plugin.js +1 -0
  287. data/app/assets/javascripts/esp-ckeditor/plugins/menu/plugin.js +1 -0
  288. data/app/assets/javascripts/esp-ckeditor/plugins/panel/plugin.js +1 -0
  289. data/app/assets/javascripts/esp-ckeditor/plugins/pastefromword/filter/default.js +1 -0
  290. data/app/assets/javascripts/esp-ckeditor/plugins/pastefromword/plugin.js +1 -0
  291. data/app/assets/javascripts/esp-ckeditor/plugins/pastetext/dialogs/pastetext.js +1 -0
  292. data/app/assets/javascripts/esp-ckeditor/plugins/pastetext/plugin.js +1 -0
  293. data/app/assets/javascripts/esp-ckeditor/plugins/popup/plugin.js +1 -0
  294. data/app/assets/javascripts/esp-ckeditor/plugins/removeformat/plugin.js +1 -0
  295. data/app/assets/javascripts/esp-ckeditor/plugins/resize/plugin.js +1 -0
  296. data/app/assets/javascripts/esp-ckeditor/plugins/richcombo/plugin.js +1 -0
  297. data/app/assets/javascripts/esp-ckeditor/plugins/selection/plugin.js +1 -0
  298. data/app/assets/javascripts/esp-ckeditor/plugins/showborders/plugin.js +1 -0
  299. data/app/assets/javascripts/esp-ckeditor/plugins/sourcearea/plugin.js +1 -0
  300. data/app/assets/javascripts/esp-ckeditor/plugins/styles/plugin.js +1 -0
  301. data/app/assets/javascripts/esp-ckeditor/plugins/styles/styles/default.js +1 -0
  302. data/app/assets/javascripts/esp-ckeditor/plugins/stylescombo/plugin.js +1 -0
  303. data/app/assets/javascripts/esp-ckeditor/plugins/tab/plugin.js +1 -0
  304. data/app/assets/javascripts/esp-ckeditor/plugins/table/dialogs/table.js +1 -0
  305. data/app/assets/javascripts/esp-ckeditor/plugins/table/plugin.js +1 -0
  306. data/app/assets/javascripts/esp-ckeditor/plugins/tabletools/dialogs/tableCell.js +1 -0
  307. data/app/assets/javascripts/esp-ckeditor/plugins/tabletools/plugin.js +1 -0
  308. data/app/assets/javascripts/esp-ckeditor/plugins/toolbar/plugin.js +1 -0
  309. data/app/assets/javascripts/esp-ckeditor/plugins/undo/plugin.js +1 -0
  310. data/app/assets/javascripts/esp-ckeditor/plugins/wysiwygarea/plugin.js +1 -0
  311. data/app/assets/javascripts/esp-ckeditor/skins/kama/dialog.css +988 -0
  312. data/app/assets/javascripts/esp-ckeditor/skins/kama/editor.css +25 -0
  313. data/app/assets/javascripts/esp-ckeditor/skins/kama/elementspath.css +73 -0
  314. data/app/assets/javascripts/esp-ckeditor/skins/kama/icons.css +367 -0
  315. data/app/assets/javascripts/esp-ckeditor/skins/kama/icons.png +0 -0
  316. data/app/assets/javascripts/esp-ckeditor/skins/kama/icons_rtl.png +0 -0
  317. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides.gif +0 -0
  318. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides.png +0 -0
  319. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
  320. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/mini.gif +0 -0
  321. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/noimage.png +0 -0
  322. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/sprites.png +0 -0
  323. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/sprites_ie6.png +0 -0
  324. data/app/assets/javascripts/esp-ckeditor/skins/kama/images/toolbar_start.gif +0 -0
  325. data/app/assets/javascripts/esp-ckeditor/skins/kama/mainui.css +209 -0
  326. data/app/assets/javascripts/esp-ckeditor/skins/kama/menu.css +232 -0
  327. data/app/assets/javascripts/esp-ckeditor/skins/kama/panel.css +227 -0
  328. data/app/assets/javascripts/esp-ckeditor/skins/kama/presets.css +49 -0
  329. data/app/assets/javascripts/esp-ckeditor/skins/kama/reset.css +85 -0
  330. data/app/assets/javascripts/esp-ckeditor/skins/kama/richcombo.css +287 -0
  331. data/app/assets/javascripts/esp-ckeditor/skins/kama/skin.js +236 -0
  332. data/app/assets/javascripts/esp-ckeditor/skins/kama/templates.css +88 -0
  333. data/app/assets/javascripts/esp-ckeditor/skins/kama/toolbar.css +412 -0
  334. data/app/inputs/ckeditor_input.rb +42 -0
  335. data/config/routes.rb +2 -0
  336. data/lib/esp-ckeditor/engine.rb +9 -0
  337. data/lib/esp-ckeditor/version.rb +3 -0
  338. data/lib/esp-ckeditor.rb +17 -0
  339. data/lib/tasks/esp-ckeditor_tasks.rake +4 -0
  340. metadata +434 -0
@@ -0,0 +1,774 @@
1
+ /*
2
+ Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @file Insert and remove numbered and bulleted lists.
8
+ */
9
+
10
+ (function()
11
+ {
12
+ var listNodeNames = { ol : 1, ul : 1 },
13
+ emptyTextRegex = /^[\n\r\t ]*$/;
14
+
15
+ var whitespaces = CKEDITOR.dom.walker.whitespaces(),
16
+ bookmarks = CKEDITOR.dom.walker.bookmark(),
17
+ nonEmpty = function( node ){ return !( whitespaces( node ) || bookmarks( node ) ); };
18
+
19
+ function cleanUpDirection( element )
20
+ {
21
+ var dir, parent, parentDir;
22
+ if ( ( dir = element.getDirection() ) )
23
+ {
24
+ parent = element.getParent();
25
+ while ( parent && !( parentDir = parent.getDirection() ) )
26
+ parent = parent.getParent();
27
+
28
+ if ( dir == parentDir )
29
+ element.removeAttribute( 'dir' );
30
+ }
31
+ }
32
+
33
+ CKEDITOR.plugins.list = {
34
+ /*
35
+ * Convert a DOM list tree into a data structure that is easier to
36
+ * manipulate. This operation should be non-intrusive in the sense that it
37
+ * does not change the DOM tree, with the exception that it may add some
38
+ * markers to the list item nodes when database is specified.
39
+ */
40
+ listToArray : function( listNode, database, baseArray, baseIndentLevel, grandparentNode )
41
+ {
42
+ if ( !listNodeNames[ listNode.getName() ] )
43
+ return [];
44
+
45
+ if ( !baseIndentLevel )
46
+ baseIndentLevel = 0;
47
+ if ( !baseArray )
48
+ baseArray = [];
49
+
50
+ // Iterate over all list items to and look for inner lists.
51
+ for ( var i = 0, count = listNode.getChildCount() ; i < count ; i++ )
52
+ {
53
+ var listItem = listNode.getChild( i );
54
+
55
+ // Fixing malformed nested lists by moving it into a previous list item. (#6236)
56
+ if( listItem.type == CKEDITOR.NODE_ELEMENT && listItem.getName() in CKEDITOR.dtd.$list )
57
+ CKEDITOR.plugins.list.listToArray( listItem, database, baseArray, baseIndentLevel + 1 );
58
+
59
+ // It may be a text node or some funny stuff.
60
+ if ( listItem.$.nodeName.toLowerCase() != 'li' )
61
+ continue;
62
+
63
+ var itemObj = { 'parent' : listNode, indent : baseIndentLevel, element : listItem, contents : [] };
64
+ if ( !grandparentNode )
65
+ {
66
+ itemObj.grandparent = listNode.getParent();
67
+ if ( itemObj.grandparent && itemObj.grandparent.$.nodeName.toLowerCase() == 'li' )
68
+ itemObj.grandparent = itemObj.grandparent.getParent();
69
+ }
70
+ else
71
+ itemObj.grandparent = grandparentNode;
72
+
73
+ if ( database )
74
+ CKEDITOR.dom.element.setMarker( database, listItem, 'listarray_index', baseArray.length );
75
+ baseArray.push( itemObj );
76
+
77
+ for ( var j = 0, itemChildCount = listItem.getChildCount(), child; j < itemChildCount ; j++ )
78
+ {
79
+ child = listItem.getChild( j );
80
+ if ( child.type == CKEDITOR.NODE_ELEMENT && listNodeNames[ child.getName() ] )
81
+ // Note the recursion here, it pushes inner list items with
82
+ // +1 indentation in the correct order.
83
+ CKEDITOR.plugins.list.listToArray( child, database, baseArray, baseIndentLevel + 1, itemObj.grandparent );
84
+ else
85
+ itemObj.contents.push( child );
86
+ }
87
+ }
88
+ return baseArray;
89
+ },
90
+
91
+ // Convert our internal representation of a list back to a DOM forest.
92
+ arrayToList : function( listArray, database, baseIndex, paragraphMode, dir )
93
+ {
94
+ if ( !baseIndex )
95
+ baseIndex = 0;
96
+ if ( !listArray || listArray.length < baseIndex + 1 )
97
+ return null;
98
+ var doc = listArray[ baseIndex ].parent.getDocument(),
99
+ retval = new CKEDITOR.dom.documentFragment( doc ),
100
+ rootNode = null,
101
+ currentIndex = baseIndex,
102
+ indentLevel = Math.max( listArray[ baseIndex ].indent, 0 ),
103
+ currentListItem = null,
104
+ orgDir,
105
+ paragraphName = ( paragraphMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
106
+ while ( 1 )
107
+ {
108
+ var item = listArray[ currentIndex ];
109
+
110
+ orgDir = item.element.getDirection( 1 );
111
+
112
+ if ( item.indent == indentLevel )
113
+ {
114
+ if ( !rootNode || listArray[ currentIndex ].parent.getName() != rootNode.getName() )
115
+ {
116
+ rootNode = listArray[ currentIndex ].parent.clone( false, 1 );
117
+ dir && rootNode.setAttribute( 'dir', dir );
118
+ retval.append( rootNode );
119
+ }
120
+ currentListItem = rootNode.append( item.element.clone( 0, 1 ) );
121
+
122
+ if ( orgDir != rootNode.getDirection( 1 ) )
123
+ currentListItem.setAttribute( 'dir', orgDir );
124
+
125
+ for ( var i = 0 ; i < item.contents.length ; i++ )
126
+ currentListItem.append( item.contents[i].clone( 1, 1 ) );
127
+ currentIndex++;
128
+ }
129
+ else if ( item.indent == Math.max( indentLevel, 0 ) + 1 )
130
+ {
131
+ // Maintain original direction (#6861).
132
+ var currDir = listArray[ currentIndex - 1 ].element.getDirection( 1 ),
133
+ listData = CKEDITOR.plugins.list.arrayToList( listArray, null, currentIndex, paragraphMode,
134
+ currDir != orgDir ? orgDir: null );
135
+
136
+ // If the next block is an <li> with another list tree as the first
137
+ // child, we'll need to append a filler (<br>/NBSP) or the list item
138
+ // wouldn't be editable. (#6724)
139
+ if ( !currentListItem.getChildCount() && CKEDITOR.env.ie && !( doc.$.documentMode > 7 ))
140
+ currentListItem.append( doc.createText( '\xa0' ) );
141
+ currentListItem.append( listData.listNode );
142
+ currentIndex = listData.nextIndex;
143
+ }
144
+ else if ( item.indent == -1 && !baseIndex && item.grandparent )
145
+ {
146
+ if ( listNodeNames[ item.grandparent.getName() ] )
147
+ currentListItem = item.element.clone( false, true );
148
+ else
149
+ {
150
+ // Create completely new blocks here.
151
+ if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR )
152
+ {
153
+ currentListItem = doc.createElement( paragraphName );
154
+ item.element.copyAttributes( currentListItem, { type:1, value:1 } );
155
+
156
+ // There might be a case where there are no attributes in the element after all
157
+ // (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR,
158
+ // the current item should be a fragment.
159
+ if ( !dir && paragraphMode == CKEDITOR.ENTER_BR && !currentListItem.hasAttributes() )
160
+ currentListItem = new CKEDITOR.dom.documentFragment( doc );
161
+ }
162
+ else
163
+ currentListItem = new CKEDITOR.dom.documentFragment( doc );
164
+ }
165
+
166
+ if ( currentListItem.type == CKEDITOR.NODE_ELEMENT )
167
+ {
168
+ if ( item.grandparent.getDirection( 1 ) != orgDir )
169
+ currentListItem.setAttribute( 'dir', orgDir );
170
+ }
171
+
172
+ for ( i = 0 ; i < item.contents.length ; i++ )
173
+ currentListItem.append( item.contents[i].clone( 1, 1 ) );
174
+
175
+ if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT
176
+ && currentIndex != listArray.length - 1 )
177
+ {
178
+ var last = currentListItem.getLast();
179
+ if ( last && last.type == CKEDITOR.NODE_ELEMENT
180
+ && last.getAttribute( 'type' ) == '_moz' )
181
+ {
182
+ last.remove();
183
+ }
184
+
185
+ if ( !( last = currentListItem.getLast( nonEmpty )
186
+ && last.type == CKEDITOR.NODE_ELEMENT
187
+ && last.getName() in CKEDITOR.dtd.$block ) )
188
+ {
189
+ currentListItem.append( doc.createElement( 'br' ) );
190
+ }
191
+ }
192
+
193
+ if ( currentListItem.type == CKEDITOR.NODE_ELEMENT &&
194
+ currentListItem.getName() == paragraphName &&
195
+ currentListItem.$.firstChild )
196
+ {
197
+ currentListItem.trim();
198
+ var firstChild = currentListItem.getFirst();
199
+ if ( firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.isBlockBoundary() )
200
+ {
201
+ var tmp = new CKEDITOR.dom.documentFragment( doc );
202
+ currentListItem.moveChildren( tmp );
203
+ currentListItem = tmp;
204
+ }
205
+ }
206
+
207
+ var currentListItemName = currentListItem.$.nodeName.toLowerCase();
208
+ if ( !CKEDITOR.env.ie && ( currentListItemName == 'div' || currentListItemName == 'p' ) )
209
+ currentListItem.appendBogus();
210
+ retval.append( currentListItem );
211
+ rootNode = null;
212
+ currentIndex++;
213
+ }
214
+ else
215
+ return null;
216
+
217
+ if ( listArray.length <= currentIndex || Math.max( listArray[ currentIndex ].indent, 0 ) < indentLevel )
218
+ break;
219
+ }
220
+
221
+ if ( database )
222
+ {
223
+ var currentNode = retval.getFirst(),
224
+ listRoot = listArray[ 0 ].parent;
225
+
226
+ while ( currentNode )
227
+ {
228
+ if ( currentNode.type == CKEDITOR.NODE_ELEMENT )
229
+ {
230
+ // Clear marker attributes for the new list tree made of cloned nodes, if any.
231
+ CKEDITOR.dom.element.clearMarkers( database, currentNode );
232
+
233
+ // Clear redundant direction attribute specified on list items.
234
+ if ( currentNode.getName() in CKEDITOR.dtd.$listItem )
235
+ cleanUpDirection( currentNode );
236
+ }
237
+
238
+ currentNode = currentNode.getNextSourceNode();
239
+ }
240
+ }
241
+
242
+ return { listNode : retval, nextIndex : currentIndex };
243
+ }
244
+ };
245
+
246
+ function onSelectionChange( evt )
247
+ {
248
+ if ( evt.editor.readOnly )
249
+ return null;
250
+
251
+ var path = evt.data.path,
252
+ blockLimit = path.blockLimit,
253
+ elements = path.elements,
254
+ element,
255
+ i;
256
+
257
+ // Grouping should only happen under blockLimit.(#3940).
258
+ for ( i = 0 ; i < elements.length && ( element = elements[ i ] )
259
+ && !element.equals( blockLimit ); i++ )
260
+ {
261
+ if ( listNodeNames[ elements[ i ].getName() ] )
262
+ return this.setState( this.type == elements[ i ].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
263
+ }
264
+
265
+ return this.setState( CKEDITOR.TRISTATE_OFF );
266
+ }
267
+
268
+ function changeListType( editor, groupObj, database, listsCreated )
269
+ {
270
+ // This case is easy...
271
+ // 1. Convert the whole list into a one-dimensional array.
272
+ // 2. Change the list type by modifying the array.
273
+ // 3. Recreate the whole list by converting the array to a list.
274
+ // 4. Replace the original list with the recreated list.
275
+ var listArray = CKEDITOR.plugins.list.listToArray( groupObj.root, database ),
276
+ selectedListItems = [];
277
+
278
+ for ( var i = 0 ; i < groupObj.contents.length ; i++ )
279
+ {
280
+ var itemNode = groupObj.contents[i];
281
+ itemNode = itemNode.getAscendant( 'li', true );
282
+ if ( !itemNode || itemNode.getCustomData( 'list_item_processed' ) )
283
+ continue;
284
+ selectedListItems.push( itemNode );
285
+ CKEDITOR.dom.element.setMarker( database, itemNode, 'list_item_processed', true );
286
+ }
287
+
288
+ var root = groupObj.root,
289
+ fakeParent = root.getDocument().createElement( this.type );
290
+ // Copy all attributes, except from 'start' and 'type'.
291
+ root.copyAttributes( fakeParent, { start : 1, type : 1 } );
292
+ // The list-style-type property should be ignored.
293
+ fakeParent.removeStyle( 'list-style-type' );
294
+
295
+ for ( i = 0 ; i < selectedListItems.length ; i++ )
296
+ {
297
+ var listIndex = selectedListItems[i].getCustomData( 'listarray_index' );
298
+ listArray[listIndex].parent = fakeParent;
299
+ }
300
+ var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode );
301
+ var child, length = newList.listNode.getChildCount();
302
+ for ( i = 0 ; i < length && ( child = newList.listNode.getChild( i ) ) ; i++ )
303
+ {
304
+ if ( child.getName() == this.type )
305
+ listsCreated.push( child );
306
+ }
307
+ newList.listNode.replace( groupObj.root );
308
+ }
309
+
310
+ var headerTagRegex = /^h[1-6]$/;
311
+
312
+ function createList( editor, groupObj, listsCreated )
313
+ {
314
+ var contents = groupObj.contents,
315
+ doc = groupObj.root.getDocument(),
316
+ listContents = [];
317
+
318
+ // It is possible to have the contents returned by DomRangeIterator to be the same as the root.
319
+ // e.g. when we're running into table cells.
320
+ // In such a case, enclose the childNodes of contents[0] into a <div>.
321
+ if ( contents.length == 1 && contents[0].equals( groupObj.root ) )
322
+ {
323
+ var divBlock = doc.createElement( 'div' );
324
+ contents[0].moveChildren && contents[0].moveChildren( divBlock );
325
+ contents[0].append( divBlock );
326
+ contents[0] = divBlock;
327
+ }
328
+
329
+ // Calculate the common parent node of all content blocks.
330
+ var commonParent = groupObj.contents[0].getParent();
331
+ for ( var i = 0 ; i < contents.length ; i++ )
332
+ commonParent = commonParent.getCommonAncestor( contents[i].getParent() );
333
+
334
+ var useComputedState = editor.config.useComputedState,
335
+ listDir, explicitDirection;
336
+
337
+ useComputedState = useComputedState === undefined || useComputedState;
338
+
339
+ // We want to insert things that are in the same tree level only, so calculate the contents again
340
+ // by expanding the selected blocks to the same tree level.
341
+ for ( i = 0 ; i < contents.length ; i++ )
342
+ {
343
+ var contentNode = contents[i],
344
+ parentNode;
345
+ while ( ( parentNode = contentNode.getParent() ) )
346
+ {
347
+ if ( parentNode.equals( commonParent ) )
348
+ {
349
+ listContents.push( contentNode );
350
+
351
+ // Determine the lists's direction.
352
+ if ( !explicitDirection && contentNode.getDirection() )
353
+ explicitDirection = 1;
354
+
355
+ var itemDir = contentNode.getDirection( useComputedState );
356
+
357
+ if ( listDir !== null )
358
+ {
359
+ // If at least one LI have a different direction than current listDir, we can't have listDir.
360
+ if ( listDir && listDir != itemDir )
361
+ listDir = null;
362
+ else
363
+ listDir = itemDir;
364
+ }
365
+
366
+ break;
367
+ }
368
+ contentNode = parentNode;
369
+ }
370
+ }
371
+
372
+ if ( listContents.length < 1 )
373
+ return;
374
+
375
+ // Insert the list to the DOM tree.
376
+ var insertAnchor = listContents[ listContents.length - 1 ].getNext(),
377
+ listNode = doc.createElement( this.type );
378
+
379
+ listsCreated.push( listNode );
380
+
381
+ var contentBlock, listItem;
382
+
383
+ while ( listContents.length )
384
+ {
385
+ contentBlock = listContents.shift();
386
+ listItem = doc.createElement( 'li' );
387
+
388
+ // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271)
389
+ if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) )
390
+ contentBlock.appendTo( listItem );
391
+ else
392
+ {
393
+ contentBlock.copyAttributes( listItem );
394
+ // Remove direction attribute after it was merged into list root. (#7657)
395
+ if ( listDir && contentBlock.getDirection() )
396
+ {
397
+ listItem.removeStyle( 'direction' );
398
+ listItem.removeAttribute( 'dir' );
399
+ }
400
+ contentBlock.moveChildren( listItem );
401
+ contentBlock.remove();
402
+ }
403
+
404
+ listItem.appendTo( listNode );
405
+ }
406
+
407
+ // Apply list root dir only if it has been explicitly declared.
408
+ if ( listDir && explicitDirection )
409
+ listNode.setAttribute( 'dir', listDir );
410
+
411
+ if ( insertAnchor )
412
+ listNode.insertBefore( insertAnchor );
413
+ else
414
+ listNode.appendTo( commonParent );
415
+ }
416
+
417
+ function removeList( editor, groupObj, database )
418
+ {
419
+ // This is very much like the change list type operation.
420
+ // Except that we're changing the selected items' indent to -1 in the list array.
421
+ var listArray = CKEDITOR.plugins.list.listToArray( groupObj.root, database ),
422
+ selectedListItems = [];
423
+
424
+ for ( var i = 0 ; i < groupObj.contents.length ; i++ )
425
+ {
426
+ var itemNode = groupObj.contents[i];
427
+ itemNode = itemNode.getAscendant( 'li', true );
428
+ if ( !itemNode || itemNode.getCustomData( 'list_item_processed' ) )
429
+ continue;
430
+ selectedListItems.push( itemNode );
431
+ CKEDITOR.dom.element.setMarker( database, itemNode, 'list_item_processed', true );
432
+ }
433
+
434
+ var lastListIndex = null;
435
+ for ( i = 0 ; i < selectedListItems.length ; i++ )
436
+ {
437
+ var listIndex = selectedListItems[i].getCustomData( 'listarray_index' );
438
+ listArray[listIndex].indent = -1;
439
+ lastListIndex = listIndex;
440
+ }
441
+
442
+ // After cutting parts of the list out with indent=-1, we still have to maintain the array list
443
+ // model's nextItem.indent <= currentItem.indent + 1 invariant. Otherwise the array model of the
444
+ // list cannot be converted back to a real DOM list.
445
+ for ( i = lastListIndex + 1 ; i < listArray.length ; i++ )
446
+ {
447
+ if ( listArray[i].indent > listArray[i-1].indent + 1 )
448
+ {
449
+ var indentOffset = listArray[i-1].indent + 1 - listArray[i].indent;
450
+ var oldIndent = listArray[i].indent;
451
+ while ( listArray[i] && listArray[i].indent >= oldIndent )
452
+ {
453
+ listArray[i].indent += indentOffset;
454
+ i++;
455
+ }
456
+ i--;
457
+ }
458
+ }
459
+
460
+ var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode,
461
+ groupObj.root.getAttribute( 'dir' ) );
462
+
463
+ // Compensate <br> before/after the list node if the surrounds are non-blocks.(#3836)
464
+ var docFragment = newList.listNode, boundaryNode, siblingNode;
465
+ function compensateBrs( isStart )
466
+ {
467
+ if ( ( boundaryNode = docFragment[ isStart ? 'getFirst' : 'getLast' ]() )
468
+ && !( boundaryNode.is && boundaryNode.isBlockBoundary() )
469
+ && ( siblingNode = groupObj.root[ isStart ? 'getPrevious' : 'getNext' ]
470
+ ( CKEDITOR.dom.walker.whitespaces( true ) ) )
471
+ && !( siblingNode.is && siblingNode.isBlockBoundary( { br : 1 } ) ) )
472
+ editor.document.createElement( 'br' )[ isStart ? 'insertBefore' : 'insertAfter' ]( boundaryNode );
473
+ }
474
+ compensateBrs( true );
475
+ compensateBrs();
476
+
477
+ docFragment.replace( groupObj.root );
478
+ }
479
+
480
+ function listCommand( name, type )
481
+ {
482
+ this.name = name;
483
+ this.type = type;
484
+ }
485
+
486
+ // Move direction attribute from root to list items.
487
+ function dirToListItems( list )
488
+ {
489
+ var dir = list.getDirection();
490
+ if ( dir )
491
+ {
492
+ for ( var i = 0, children = list.getChildren(), child; child = children.getItem( i ), i < children.count(); i++ )
493
+ {
494
+ if ( child.type == CKEDITOR.NODE_ELEMENT && child.is( 'li' ) && !child.getDirection() )
495
+ child.setAttribute( 'dir', dir );
496
+ }
497
+
498
+ list.removeAttribute( 'dir' );
499
+ }
500
+ }
501
+
502
+ listCommand.prototype = {
503
+ exec : function( editor )
504
+ {
505
+ var doc = editor.document,
506
+ config = editor.config,
507
+ selection = editor.getSelection(),
508
+ ranges = selection && selection.getRanges( true );
509
+
510
+ // There should be at least one selected range.
511
+ if ( !ranges || ranges.length < 1 )
512
+ return;
513
+
514
+ // Midas lists rule #1 says we can create a list even in an empty document.
515
+ // But DOM iterator wouldn't run if the document is really empty.
516
+ // So create a paragraph if the document is empty and we're going to create a list.
517
+ if ( this.state == CKEDITOR.TRISTATE_OFF )
518
+ {
519
+ var body = doc.getBody();
520
+ if ( !body.getFirst( nonEmpty ) )
521
+ {
522
+ config.enterMode == CKEDITOR.ENTER_BR ?
523
+ body.appendBogus() :
524
+ ranges[ 0 ].fixBlock( 1, config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
525
+
526
+ selection.selectRanges( ranges );
527
+ }
528
+ // Maybe a single range there enclosing the whole list,
529
+ // turn on the list state manually(#4129).
530
+ else
531
+ {
532
+ var range = ranges.length == 1 && ranges[ 0 ],
533
+ enclosedNode = range && range.getEnclosedNode();
534
+ if ( enclosedNode && enclosedNode.is
535
+ && this.type == enclosedNode.getName() )
536
+ this.setState( CKEDITOR.TRISTATE_ON );
537
+ }
538
+ }
539
+
540
+ var bookmarks = selection.createBookmarks( true );
541
+
542
+ // Group the blocks up because there are many cases where multiple lists have to be created,
543
+ // or multiple lists have to be cancelled.
544
+ var listGroups = [],
545
+ database = {},
546
+ rangeIterator = ranges.createIterator(),
547
+ index = 0;
548
+
549
+ while ( ( range = rangeIterator.getNextRange() ) && ++index )
550
+ {
551
+ var boundaryNodes = range.getBoundaryNodes(),
552
+ startNode = boundaryNodes.startNode,
553
+ endNode = boundaryNodes.endNode;
554
+
555
+ if ( startNode.type == CKEDITOR.NODE_ELEMENT && startNode.getName() == 'td' )
556
+ range.setStartAt( boundaryNodes.startNode, CKEDITOR.POSITION_AFTER_START );
557
+
558
+ if ( endNode.type == CKEDITOR.NODE_ELEMENT && endNode.getName() == 'td' )
559
+ range.setEndAt( boundaryNodes.endNode, CKEDITOR.POSITION_BEFORE_END );
560
+
561
+ var iterator = range.createIterator(),
562
+ block;
563
+
564
+ iterator.forceBrBreak = ( this.state == CKEDITOR.TRISTATE_OFF );
565
+
566
+ while ( ( block = iterator.getNextParagraph() ) )
567
+ {
568
+ // Avoid duplicate blocks get processed across ranges.
569
+ if( block.getCustomData( 'list_block' ) )
570
+ continue;
571
+ else
572
+ CKEDITOR.dom.element.setMarker( database, block, 'list_block', 1 );
573
+
574
+ var path = new CKEDITOR.dom.elementPath( block ),
575
+ pathElements = path.elements,
576
+ pathElementsCount = pathElements.length,
577
+ listNode = null,
578
+ processedFlag = 0,
579
+ blockLimit = path.blockLimit,
580
+ element;
581
+
582
+ // First, try to group by a list ancestor.
583
+ for ( var i = pathElementsCount - 1; i >= 0 && ( element = pathElements[ i ] ); i-- )
584
+ {
585
+ if ( listNodeNames[ element.getName() ]
586
+ && blockLimit.contains( element ) ) // Don't leak outside block limit (#3940).
587
+ {
588
+ // If we've encountered a list inside a block limit
589
+ // The last group object of the block limit element should
590
+ // no longer be valid. Since paragraphs after the list
591
+ // should belong to a different group of paragraphs before
592
+ // the list. (Bug #1309)
593
+ blockLimit.removeCustomData( 'list_group_object_' + index );
594
+
595
+ var groupObj = element.getCustomData( 'list_group_object' );
596
+ if ( groupObj )
597
+ groupObj.contents.push( block );
598
+ else
599
+ {
600
+ groupObj = { root : element, contents : [ block ] };
601
+ listGroups.push( groupObj );
602
+ CKEDITOR.dom.element.setMarker( database, element, 'list_group_object', groupObj );
603
+ }
604
+ processedFlag = 1;
605
+ break;
606
+ }
607
+ }
608
+
609
+ if ( processedFlag )
610
+ continue;
611
+
612
+ // No list ancestor? Group by block limit, but don't mix contents from different ranges.
613
+ var root = blockLimit;
614
+ if ( root.getCustomData( 'list_group_object_' + index ) )
615
+ root.getCustomData( 'list_group_object_' + index ).contents.push( block );
616
+ else
617
+ {
618
+ groupObj = { root : root, contents : [ block ] };
619
+ CKEDITOR.dom.element.setMarker( database, root, 'list_group_object_' + index, groupObj );
620
+ listGroups.push( groupObj );
621
+ }
622
+ }
623
+ }
624
+
625
+ // Now we have two kinds of list groups, groups rooted at a list, and groups rooted at a block limit element.
626
+ // We either have to build lists or remove lists, for removing a list does not makes sense when we are looking
627
+ // at the group that's not rooted at lists. So we have three cases to handle.
628
+ var listsCreated = [];
629
+ while ( listGroups.length > 0 )
630
+ {
631
+ groupObj = listGroups.shift();
632
+ if ( this.state == CKEDITOR.TRISTATE_OFF )
633
+ {
634
+ if ( listNodeNames[ groupObj.root.getName() ] )
635
+ changeListType.call( this, editor, groupObj, database, listsCreated );
636
+ else
637
+ createList.call( this, editor, groupObj, listsCreated );
638
+ }
639
+ else if ( this.state == CKEDITOR.TRISTATE_ON && listNodeNames[ groupObj.root.getName() ] )
640
+ removeList.call( this, editor, groupObj, database );
641
+ }
642
+
643
+ // For all new lists created, merge adjacent, same type lists.
644
+ for ( i = 0 ; i < listsCreated.length ; i++ )
645
+ {
646
+ listNode = listsCreated[i];
647
+ var mergeSibling, listCommand = this;
648
+ ( mergeSibling = function( rtl ){
649
+
650
+ var sibling = listNode[ rtl ?
651
+ 'getPrevious' : 'getNext' ]( CKEDITOR.dom.walker.whitespaces( true ) );
652
+ if ( sibling && sibling.getName &&
653
+ sibling.getName() == listCommand.type )
654
+ {
655
+
656
+ // In case to be merged lists have difference directions. (#7448)
657
+ if ( sibling.getDirection( 1 ) != listNode.getDirection( 1 ) )
658
+ dirToListItems( listNode.getDirection() ? listNode : sibling );
659
+
660
+ sibling.remove();
661
+ // Move children order by merge direction.(#3820)
662
+ sibling.moveChildren( listNode, rtl );
663
+ }
664
+ } )();
665
+ mergeSibling( 1 );
666
+ }
667
+
668
+ // Clean up, restore selection and update toolbar button states.
669
+ CKEDITOR.dom.element.clearAllMarkers( database );
670
+ selection.selectBookmarks( bookmarks );
671
+ editor.focus();
672
+ }
673
+ };
674
+
675
+ var dtd = CKEDITOR.dtd;
676
+ var tailNbspRegex = /[\t\r\n ]*(?:&nbsp;|\xa0)$/;
677
+
678
+ function indexOfFirstChildElement( element, tagNameList )
679
+ {
680
+ var child,
681
+ children = element.children,
682
+ length = children.length;
683
+
684
+ for ( var i = 0 ; i < length ; i++ )
685
+ {
686
+ child = children[ i ];
687
+ if ( child.name && ( child.name in tagNameList ) )
688
+ return i;
689
+ }
690
+
691
+ return length;
692
+ }
693
+
694
+ function getExtendNestedListFilter( isHtmlFilter )
695
+ {
696
+ // An element filter function that corrects nested list start in an empty
697
+ // list item for better displaying/outputting. (#3165)
698
+ return function( listItem )
699
+ {
700
+ var children = listItem.children,
701
+ firstNestedListIndex = indexOfFirstChildElement( listItem, dtd.$list ),
702
+ firstNestedList = children[ firstNestedListIndex ],
703
+ nodeBefore = firstNestedList && firstNestedList.previous,
704
+ tailNbspmatch;
705
+
706
+ if ( nodeBefore
707
+ && ( nodeBefore.name && nodeBefore.name == 'br'
708
+ || nodeBefore.value && ( tailNbspmatch = nodeBefore.value.match( tailNbspRegex ) ) ) )
709
+ {
710
+ var fillerNode = nodeBefore;
711
+
712
+ // Always use 'nbsp' as filler node if we found a nested list appear
713
+ // in front of a list item.
714
+ if ( !( tailNbspmatch && tailNbspmatch.index ) && fillerNode == children[ 0 ] )
715
+ children[ 0 ] = ( isHtmlFilter || CKEDITOR.env.ie ) ?
716
+ new CKEDITOR.htmlParser.text( '\xa0' ) :
717
+ new CKEDITOR.htmlParser.element( 'br', {} );
718
+
719
+ // Otherwise the filler is not needed anymore.
720
+ else if ( fillerNode.name == 'br' )
721
+ children.splice( firstNestedListIndex - 1, 1 );
722
+ else
723
+ fillerNode.value = fillerNode.value.replace( tailNbspRegex, '' );
724
+ }
725
+
726
+ };
727
+ }
728
+
729
+ var defaultListDataFilterRules = { elements : {} };
730
+ for ( var i in dtd.$listItem )
731
+ defaultListDataFilterRules.elements[ i ] = getExtendNestedListFilter();
732
+
733
+ var defaultListHtmlFilterRules = { elements : {} };
734
+ for ( i in dtd.$listItem )
735
+ defaultListHtmlFilterRules.elements[ i ] = getExtendNestedListFilter( true );
736
+
737
+ CKEDITOR.plugins.add( 'list',
738
+ {
739
+ init : function( editor )
740
+ {
741
+ // Register commands.
742
+ var numberedListCommand = editor.addCommand( 'numberedlist', new listCommand( 'numberedlist', 'ol' ) ),
743
+ bulletedListCommand = editor.addCommand( 'bulletedlist', new listCommand( 'bulletedlist', 'ul' ) );
744
+
745
+ // Register the toolbar button.
746
+ editor.ui.addButton( 'NumberedList',
747
+ {
748
+ label : editor.lang.numberedlist,
749
+ command : 'numberedlist'
750
+ } );
751
+ editor.ui.addButton( 'BulletedList',
752
+ {
753
+ label : editor.lang.bulletedlist,
754
+ command : 'bulletedlist'
755
+ } );
756
+
757
+ // Register the state changing handlers.
758
+ editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, numberedListCommand ) );
759
+ editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, bulletedListCommand ) );
760
+ },
761
+
762
+ afterInit : function ( editor )
763
+ {
764
+ var dataProcessor = editor.dataProcessor;
765
+ if ( dataProcessor )
766
+ {
767
+ dataProcessor.dataFilter.addRules( defaultListDataFilterRules );
768
+ dataProcessor.htmlFilter.addRules( defaultListHtmlFilterRules );
769
+ }
770
+ },
771
+
772
+ requires : [ 'domiterator' ]
773
+ } );
774
+ })();