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,1347 @@
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
+ * @fileOverview The "wysiwygarea" plugin. It registers the "wysiwyg" editing
8
+ * mode, which handles the main editing area space.
9
+ */
10
+
11
+ (function()
12
+ {
13
+ // Matching an empty paragraph at the end of document.
14
+ var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
15
+
16
+ var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
17
+
18
+ // Elements that could blink the cursor anchoring beside it, like hr, page-break. (#6554)
19
+ function nonEditable( element )
20
+ {
21
+ return element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ];
22
+ }
23
+
24
+
25
+ function onInsert( insertFunc )
26
+ {
27
+ return function( evt )
28
+ {
29
+ if ( this.mode == 'wysiwyg' )
30
+ {
31
+ this.focus();
32
+
33
+ this.fire( 'saveSnapshot' );
34
+
35
+ insertFunc.call( this, evt.data );
36
+
37
+ // Save snaps after the whole execution completed.
38
+ // This's a workaround for make DOM modification's happened after
39
+ // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents'
40
+ // call.
41
+ CKEDITOR.tools.setTimeout( function()
42
+ {
43
+ this.fire( 'saveSnapshot' );
44
+ }, 0, this );
45
+ }
46
+ };
47
+ }
48
+
49
+ function doInsertHtml( data )
50
+ {
51
+ if ( this.dataProcessor )
52
+ data = this.dataProcessor.toHtml( data );
53
+
54
+ if ( !data )
55
+ return;
56
+
57
+ // HTML insertion only considers the first range.
58
+ var selection = this.getSelection(),
59
+ range = selection.getRanges()[ 0 ];
60
+
61
+ if ( range.checkReadOnly() )
62
+ return;
63
+
64
+ // Opera: force block splitting when pasted content contains block. (#7801)
65
+ if ( CKEDITOR.env.opera )
66
+ {
67
+ var path = new CKEDITOR.dom.elementPath( range.startContainer );
68
+ if ( path.block )
69
+ {
70
+ var nodes = CKEDITOR.htmlParser.fragment.fromHtml( data, false ).children;
71
+ for ( var i = 0, count = nodes.length; i < count; i++ )
72
+ {
73
+ if ( nodes[ i ]._.isBlockLike )
74
+ {
75
+ range.splitBlock( this.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
76
+ range.insertNode( range.document.createText( '' ) );
77
+ range.select();
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ if ( CKEDITOR.env.ie )
85
+ {
86
+ var selIsLocked = selection.isLocked;
87
+
88
+ if ( selIsLocked )
89
+ selection.unlock();
90
+
91
+ var $sel = selection.getNative();
92
+
93
+ // Delete control selections to avoid IE bugs on pasteHTML.
94
+ if ( $sel.type == 'Control' )
95
+ $sel.clear();
96
+ else if ( selection.getType() == CKEDITOR.SELECTION_TEXT )
97
+ {
98
+ // Due to IE bugs on handling contenteditable=false blocks
99
+ // (#6005), we need to make some checks and eventually
100
+ // delete the selection first.
101
+
102
+ range = selection.getRanges()[ 0 ];
103
+ var endContainer = range && range.endContainer;
104
+
105
+ if ( endContainer &&
106
+ endContainer.type == CKEDITOR.NODE_ELEMENT &&
107
+ endContainer.getAttribute( 'contenteditable' ) == 'false' &&
108
+ range.checkBoundaryOfElement( endContainer, CKEDITOR.END ) )
109
+ {
110
+ range.setEndAfter( range.endContainer );
111
+ range.deleteContents();
112
+ }
113
+ }
114
+
115
+ $sel.createRange().pasteHTML( data );
116
+
117
+ if ( selIsLocked )
118
+ this.getSelection().lock();
119
+ }
120
+ else
121
+ this.document.$.execCommand( 'inserthtml', false, data );
122
+
123
+ // Webkit does not scroll to the cursor position after pasting (#5558)
124
+ if ( CKEDITOR.env.webkit )
125
+ {
126
+ selection = this.getSelection();
127
+ selection.scrollIntoView();
128
+ }
129
+ }
130
+
131
+ function doInsertText( text )
132
+ {
133
+ var selection = this.getSelection(),
134
+ mode = selection.getStartElement().hasAscendant( 'pre', true ) ?
135
+ CKEDITOR.ENTER_BR : this.config.enterMode,
136
+ isEnterBrMode = mode == CKEDITOR.ENTER_BR;
137
+
138
+ var html = CKEDITOR.tools.htmlEncode( text.replace( /\r\n|\r/g, '\n' ) );
139
+
140
+ // Convert leading and trailing whitespaces into &nbsp;
141
+ html = html.replace( /^[ \t]+|[ \t]+$/g, function( match, offset, s )
142
+ {
143
+ if ( match.length == 1 ) // one space, preserve it
144
+ return '&nbsp;';
145
+ else if ( !offset ) // beginning of block
146
+ return CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 ) + ' ';
147
+ else // end of block
148
+ return ' ' + CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 );
149
+ } );
150
+
151
+ // Convert subsequent whitespaces into &nbsp;
152
+ html = html.replace( /[ \t]{2,}/g, function ( match )
153
+ {
154
+ return CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 ) + ' ';
155
+ } );
156
+
157
+ var paragraphTag = mode == CKEDITOR.ENTER_P ? 'p' : 'div';
158
+
159
+ // Two line-breaks create one paragraph.
160
+ if ( !isEnterBrMode )
161
+ {
162
+ html = html.replace( /(\n{2})([\s\S]*?)(?:$|\1)/g,
163
+ function( match, group1, text )
164
+ {
165
+ return '<'+paragraphTag + '>' + text + '</' + paragraphTag + '>';
166
+ });
167
+ }
168
+
169
+ // One <br> per line-break.
170
+ html = html.replace( /\n/g, '<br>' );
171
+
172
+ // Compensate padding <br> for non-IE.
173
+ if ( !( isEnterBrMode || CKEDITOR.env.ie ) )
174
+ {
175
+ html = html.replace( new RegExp( '<br>(?=</' + paragraphTag + '>)' ), function( match )
176
+ {
177
+ return CKEDITOR.tools.repeat( match, 2 );
178
+ } );
179
+ }
180
+
181
+ // Inline styles have to be inherited in Firefox.
182
+ if ( CKEDITOR.env.gecko || CKEDITOR.env.webkit )
183
+ {
184
+ var path = new CKEDITOR.dom.elementPath( selection.getStartElement() ),
185
+ context = [];
186
+
187
+ for ( var i = 0; i < path.elements.length; i++ )
188
+ {
189
+ var tag = path.elements[ i ].getName();
190
+ if ( tag in CKEDITOR.dtd.$inline )
191
+ context.unshift( path.elements[ i ].getOuterHtml().match( /^<.*?>/) );
192
+ else if ( tag in CKEDITOR.dtd.$block )
193
+ break;
194
+ }
195
+
196
+ // Reproduce the context by preceding the pasted HTML with opening inline tags.
197
+ html = context.join( '' ) + html;
198
+ }
199
+
200
+ doInsertHtml.call( this, html );
201
+ }
202
+
203
+ function doInsertElement( element )
204
+ {
205
+ var selection = this.getSelection(),
206
+ ranges = selection.getRanges(),
207
+ elementName = element.getName(),
208
+ isBlock = CKEDITOR.dtd.$block[ elementName ];
209
+
210
+ var selIsLocked = selection.isLocked;
211
+
212
+ if ( selIsLocked )
213
+ selection.unlock();
214
+
215
+ var range, clone, lastElement, bookmark;
216
+
217
+ for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
218
+ {
219
+ range = ranges[ i ];
220
+
221
+ if ( !range.checkReadOnly() )
222
+ {
223
+ // Remove the original contents, merge splitted nodes.
224
+ range.deleteContents( 1 );
225
+
226
+ clone = !i && element || element.clone( 1 );
227
+
228
+ // If we're inserting a block at dtd-violated position, split
229
+ // the parent blocks until we reach blockLimit.
230
+ var current, dtd;
231
+ if ( isBlock )
232
+ {
233
+ while ( ( current = range.getCommonAncestor( 0, 1 ) )
234
+ && ( dtd = CKEDITOR.dtd[ current.getName() ] )
235
+ && !( dtd && dtd [ elementName ] ) )
236
+ {
237
+ // Split up inline elements.
238
+ if ( current.getName() in CKEDITOR.dtd.span )
239
+ range.splitElement( current );
240
+ // If we're in an empty block which indicate a new paragraph,
241
+ // simply replace it with the inserting block.(#3664)
242
+ else if ( range.checkStartOfBlock()
243
+ && range.checkEndOfBlock() )
244
+ {
245
+ range.setStartBefore( current );
246
+ range.collapse( true );
247
+ current.remove();
248
+ }
249
+ else
250
+ range.splitBlock();
251
+ }
252
+ }
253
+
254
+ // Insert the new node.
255
+ range.insertNode( clone );
256
+
257
+ // Save the last element reference so we can make the
258
+ // selection later.
259
+ if ( !lastElement )
260
+ lastElement = clone;
261
+ }
262
+ }
263
+
264
+ if ( lastElement )
265
+ {
266
+ range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
267
+
268
+ // If we're inserting a block element immediatelly followed by
269
+ // another block element, the selection must move there. (#3100,#5436)
270
+ if ( isBlock )
271
+ {
272
+ var next = lastElement.getNext( notWhitespaceEval ),
273
+ nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName();
274
+
275
+ // Check if it's a block element that accepts text.
276
+ if ( nextName && CKEDITOR.dtd.$block[ nextName ] && CKEDITOR.dtd[ nextName ]['#'] )
277
+ range.moveToElementEditStart( next );
278
+ }
279
+ }
280
+
281
+ selection.selectRanges( [ range ] );
282
+
283
+ if ( selIsLocked )
284
+ this.getSelection().lock();
285
+ }
286
+
287
+ // DOM modification here should not bother dirty flag.(#4385)
288
+ function restoreDirty( editor )
289
+ {
290
+ if ( !editor.checkDirty() )
291
+ setTimeout( function(){ editor.resetDirty(); }, 0 );
292
+ }
293
+
294
+ var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),
295
+ isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true );
296
+
297
+ function isNotEmpty( node )
298
+ {
299
+ return isNotWhitespace( node ) && isNotBookmark( node );
300
+ }
301
+
302
+ function isNbsp( node )
303
+ {
304
+ return node.type == CKEDITOR.NODE_TEXT
305
+ && CKEDITOR.tools.trim( node.getText() ).match( /^(?:&nbsp;|\xa0)$/ );
306
+ }
307
+
308
+ function restoreSelection( selection )
309
+ {
310
+ if ( selection.isLocked )
311
+ {
312
+ selection.unlock();
313
+ setTimeout( function() { selection.lock(); }, 0 );
314
+ }
315
+ }
316
+
317
+ function isBlankParagraph( block )
318
+ {
319
+ return block.getOuterHtml().match( emptyParagraphRegexp );
320
+ }
321
+
322
+ isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );
323
+
324
+ // Gecko need a key event to 'wake up' the editing
325
+ // ability when document is empty.(#3864, #5781)
326
+ function activateEditing( editor )
327
+ {
328
+ var win = editor.window,
329
+ doc = editor.document,
330
+ body = editor.document.getBody(),
331
+ bodyFirstChild = body.getFirst(),
332
+ bodyChildsNum = body.getChildren().count();
333
+
334
+ if ( !bodyChildsNum
335
+ || bodyChildsNum == 1
336
+ && bodyFirstChild.type == CKEDITOR.NODE_ELEMENT
337
+ && bodyFirstChild.hasAttribute( '_moz_editor_bogus_node' ) )
338
+ {
339
+ restoreDirty( editor );
340
+
341
+ // Memorize scroll position to restore it later (#4472).
342
+ var hostDocument = editor.element.getDocument();
343
+ var hostDocumentElement = hostDocument.getDocumentElement();
344
+ var scrollTop = hostDocumentElement.$.scrollTop;
345
+ var scrollLeft = hostDocumentElement.$.scrollLeft;
346
+
347
+ // Simulating keyboard character input by dispatching a keydown of white-space text.
348
+ var keyEventSimulate = doc.$.createEvent( "KeyEvents" );
349
+ keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,
350
+ false, false, false, 0, 32 );
351
+ doc.$.dispatchEvent( keyEventSimulate );
352
+
353
+ if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft )
354
+ hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop );
355
+
356
+ // Restore the original document status by placing the cursor before a bogus br created (#5021).
357
+ bodyChildsNum && body.getFirst().remove();
358
+ doc.getBody().appendBogus();
359
+ var nativeRange = new CKEDITOR.dom.range( doc );
360
+ nativeRange.setStartAt( body , CKEDITOR.POSITION_AFTER_START );
361
+ nativeRange.select();
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Auto-fixing block-less content by wrapping paragraph (#3190), prevent
367
+ * non-exitable-block by padding extra br.(#3189)
368
+ */
369
+ function onSelectionChangeFixBody( evt )
370
+ {
371
+ var editor = evt.editor,
372
+ path = evt.data.path,
373
+ blockLimit = path.blockLimit,
374
+ selection = evt.data.selection,
375
+ range = selection.getRanges()[0],
376
+ body = editor.document.getBody(),
377
+ enterMode = editor.config.enterMode;
378
+
379
+ if ( CKEDITOR.env.gecko )
380
+ {
381
+ activateEditing( editor );
382
+
383
+ // Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041)
384
+ var pathBlock = path.block || path.blockLimit,
385
+ lastNode = pathBlock && pathBlock.getLast( isNotEmpty );
386
+
387
+ // Check some specialities of the current path block:
388
+ // 1. It is really displayed as block; (#7221)
389
+ // 2. It doesn't end with one inner block; (#7467)
390
+ // 3. It doesn't have bogus br yet.
391
+ if ( pathBlock
392
+ && pathBlock.isBlockBoundary()
393
+ && !( lastNode && lastNode.type == CKEDITOR.NODE_ELEMENT && lastNode.isBlockBoundary() )
394
+ && !pathBlock.is( 'pre' )
395
+ && !pathBlock.getBogus() )
396
+ {
397
+ pathBlock.appendBogus();
398
+ }
399
+ }
400
+
401
+ // When we're in block enter mode, a new paragraph will be established
402
+ // to encapsulate inline contents right under body. (#3657)
403
+ if ( editor.config.autoParagraph !== false
404
+ && enterMode != CKEDITOR.ENTER_BR
405
+ && range.collapsed
406
+ && blockLimit.getName() == 'body'
407
+ && !path.block )
408
+ {
409
+ var fixedBlock = range.fixBlock( true,
410
+ editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
411
+
412
+ // For IE, we should remove any filler node which was introduced before.
413
+ if ( CKEDITOR.env.ie )
414
+ {
415
+ var first = fixedBlock.getFirst( isNotEmpty );
416
+ first && isNbsp( first ) && first.remove();
417
+ }
418
+
419
+ // If the fixed block is actually blank and is already followed by an exitable blank
420
+ // block, we should revert the fix and move into the existed one. (#3684)
421
+ if ( isBlankParagraph( fixedBlock ) )
422
+ {
423
+ var element = fixedBlock.getNext( isNotWhitespace );
424
+ if ( element &&
425
+ element.type == CKEDITOR.NODE_ELEMENT &&
426
+ !nonEditable( element ) )
427
+ {
428
+ range.moveToElementEditStart( element );
429
+ fixedBlock.remove();
430
+ }
431
+ else
432
+ {
433
+ element = fixedBlock.getPrevious( isNotWhitespace );
434
+ if ( element &&
435
+ element.type == CKEDITOR.NODE_ELEMENT &&
436
+ !nonEditable( element ) )
437
+ {
438
+ range.moveToElementEditEnd( element );
439
+ fixedBlock.remove();
440
+ }
441
+ }
442
+ }
443
+
444
+ range.select();
445
+ // Cancel this selection change in favor of the next (correct). (#6811)
446
+ evt.cancel();
447
+ }
448
+
449
+ // Browsers are incapable of moving cursor out of certain block elements (e.g. table, div, pre)
450
+ // at the end of document, makes it unable to continue adding content, we have to make this
451
+ // easier by opening an new empty paragraph.
452
+ var testRange = new CKEDITOR.dom.range( editor.document );
453
+ testRange.moveToElementEditEnd( editor.document.getBody() );
454
+ var testPath = new CKEDITOR.dom.elementPath( testRange.startContainer );
455
+ if ( !testPath.blockLimit.is( 'body') )
456
+ {
457
+ var paddingBlock;
458
+ if ( enterMode != CKEDITOR.ENTER_BR )
459
+ paddingBlock = body.append( editor.document.createElement( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) );
460
+ else
461
+ paddingBlock = body;
462
+
463
+ if ( !CKEDITOR.env.ie )
464
+ paddingBlock.appendBogus();
465
+ }
466
+ }
467
+
468
+ CKEDITOR.plugins.add( 'wysiwygarea',
469
+ {
470
+ requires : [ 'editingblock' ],
471
+
472
+ init : function( editor )
473
+ {
474
+ var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR && editor.config.autoParagraph !== false )
475
+ ? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false;
476
+
477
+ var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name );
478
+
479
+ var contentDomReadyHandler;
480
+ editor.on( 'editingBlockReady', function()
481
+ {
482
+ var mainElement,
483
+ iframe,
484
+ isLoadingData,
485
+ isPendingFocus,
486
+ frameLoaded,
487
+ fireMode;
488
+
489
+
490
+ // Support for custom document.domain in IE.
491
+ var isCustomDomain = CKEDITOR.env.isCustomDomain();
492
+
493
+ // Creates the iframe that holds the editable document.
494
+ var createIFrame = function( data )
495
+ {
496
+ if ( iframe )
497
+ iframe.remove();
498
+
499
+ var src =
500
+ 'document.open();' +
501
+
502
+ // The document domain must be set any time we
503
+ // call document.open().
504
+ ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
505
+
506
+ 'document.close();';
507
+
508
+ // With IE, the custom domain has to be taken care at first,
509
+ // for other browers, the 'src' attribute should be left empty to
510
+ // trigger iframe's 'load' event.
511
+ src =
512
+ CKEDITOR.env.air ?
513
+ 'javascript:void(0)' :
514
+ CKEDITOR.env.ie ?
515
+ 'javascript:void(function(){' + encodeURIComponent( src ) + '}())'
516
+ :
517
+ '';
518
+
519
+ iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +
520
+ ' style="width:100%;height:100%"' +
521
+ ' frameBorder="0"' +
522
+ ' title="' + frameLabel + '"' +
523
+ ' src="' + src + '"' +
524
+ ' tabIndex="' + ( CKEDITOR.env.webkit? -1 : editor.tabIndex ) + '"' +
525
+ ' allowTransparency="true"' +
526
+ '></iframe>' );
527
+
528
+ // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)
529
+ if ( document.location.protocol == 'chrome:' )
530
+ CKEDITOR.event.useCapture = true;
531
+
532
+ // With FF, it's better to load the data on iframe.load. (#3894,#4058)
533
+ iframe.on( 'load', function( ev )
534
+ {
535
+ frameLoaded = 1;
536
+ ev.removeListener();
537
+
538
+ var doc = iframe.getFrameDocument();
539
+ doc.write( data );
540
+
541
+ CKEDITOR.env.air && contentDomReady( doc.getWindow().$ );
542
+ });
543
+
544
+ // Reset adjustment back to default (#5689)
545
+ if ( document.location.protocol == 'chrome:' )
546
+ CKEDITOR.event.useCapture = false;
547
+
548
+ mainElement.append( iframe );
549
+ };
550
+
551
+ // The script that launches the bootstrap logic on 'domReady', so the document
552
+ // is fully editable even before the editing iframe is fully loaded (#4455).
553
+ contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady );
554
+ var activationScript =
555
+ '<script id="cke_actscrpt" type="text/javascript" data-cke-temp="1">' +
556
+ ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
557
+ 'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' +
558
+ '</script>';
559
+
560
+ // Editing area bootstrap code.
561
+ function contentDomReady( domWindow )
562
+ {
563
+ if ( !frameLoaded )
564
+ return;
565
+ frameLoaded = 0;
566
+
567
+ editor.fire( 'ariaWidget', iframe );
568
+
569
+ var domDocument = domWindow.document,
570
+ body = domDocument.body;
571
+
572
+ // Remove this script from the DOM.
573
+ var script = domDocument.getElementById( "cke_actscrpt" );
574
+ script && script.parentNode.removeChild( script );
575
+
576
+ body.spellcheck = !editor.config.disableNativeSpellChecker;
577
+
578
+ var editable = !editor.readOnly;
579
+
580
+ if ( CKEDITOR.env.ie )
581
+ {
582
+ // Don't display the focus border.
583
+ body.hideFocus = true;
584
+
585
+ // Disable and re-enable the body to avoid IE from
586
+ // taking the editing focus at startup. (#141 / #523)
587
+ body.disabled = true;
588
+ body.contentEditable = editable;
589
+ body.removeAttribute( 'disabled' );
590
+ }
591
+ else
592
+ {
593
+ // Avoid opening design mode in a frame window thread,
594
+ // which will cause host page scrolling.(#4397)
595
+ setTimeout( function()
596
+ {
597
+ // Prefer 'contentEditable' instead of 'designMode'. (#3593)
598
+ if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900
599
+ || CKEDITOR.env.opera )
600
+ domDocument.$.body.contentEditable = editable;
601
+ else if ( CKEDITOR.env.webkit )
602
+ domDocument.$.body.parentNode.contentEditable = editable;
603
+ else
604
+ domDocument.$.designMode = editable? 'off' : 'on';
605
+ }, 0 );
606
+ }
607
+
608
+ editable && CKEDITOR.env.gecko && CKEDITOR.tools.setTimeout( activateEditing, 0, null, editor );
609
+
610
+ domWindow = editor.window = new CKEDITOR.dom.window( domWindow );
611
+ domDocument = editor.document = new CKEDITOR.dom.document( domDocument );
612
+
613
+ editable && domDocument.on( 'dblclick', function( evt )
614
+ {
615
+ var element = evt.data.getTarget(),
616
+ data = { element : element, dialog : '' };
617
+ editor.fire( 'doubleclick', data );
618
+ data.dialog && editor.openDialog( data.dialog );
619
+ });
620
+
621
+ // Prevent automatic submission in IE #6336
622
+ CKEDITOR.env.ie && domDocument.on( 'click', function( evt )
623
+ {
624
+ var element = evt.data.getTarget();
625
+ if ( element.is( 'input' ) )
626
+ {
627
+ var type = element.getAttribute( 'type' );
628
+ if ( type == 'submit' || type == 'reset' )
629
+ evt.data.preventDefault();
630
+ }
631
+ });
632
+
633
+ // Gecko/Webkit need some help when selecting control type elements. (#3448)
634
+ if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) )
635
+ {
636
+ domDocument.on( 'mousedown', function( ev )
637
+ {
638
+ var control = ev.data.getTarget();
639
+ if ( control.is( 'img', 'hr', 'input', 'textarea', 'select' ) )
640
+ editor.getSelection().selectElement( control );
641
+ } );
642
+ }
643
+
644
+ if ( CKEDITOR.env.gecko )
645
+ {
646
+ domDocument.on( 'mouseup', function( ev )
647
+ {
648
+ if ( ev.data.$.button == 2 )
649
+ {
650
+ var target = ev.data.getTarget();
651
+
652
+ // Prevent right click from selecting an empty block even
653
+ // when selection is anchored inside it. (#5845)
654
+ if ( !target.getOuterHtml().replace( emptyParagraphRegexp, '' ) )
655
+ {
656
+ var range = new CKEDITOR.dom.range( domDocument );
657
+ range.moveToElementEditStart( target );
658
+ range.select( true );
659
+ }
660
+ }
661
+ } );
662
+ }
663
+
664
+ // Prevent the browser opening links in read-only blocks. (#6032)
665
+ domDocument.on( 'click', function( ev )
666
+ {
667
+ ev = ev.data;
668
+ if ( ev.getTarget().is( 'a' ) && ev.$.button != 2 )
669
+ ev.preventDefault();
670
+ });
671
+
672
+ // Webkit: avoid from editing form control elements content.
673
+ if ( CKEDITOR.env.webkit )
674
+ {
675
+ // Mark that cursor will right blinking (#7113).
676
+ domDocument.on( 'mousedown', function() { wasFocused = 1; } );
677
+ // Prevent from tick checkbox/radiobox/select
678
+ domDocument.on( 'click', function( ev )
679
+ {
680
+ if ( ev.data.getTarget().is( 'input', 'select' ) )
681
+ ev.data.preventDefault();
682
+ } );
683
+
684
+ // Prevent from editig textfield/textarea value.
685
+ domDocument.on( 'mouseup', function( ev )
686
+ {
687
+ if ( ev.data.getTarget().is( 'input', 'textarea' ) )
688
+ ev.data.preventDefault();
689
+ } );
690
+ }
691
+
692
+ // IE standard compliant in editing frame doesn't focus the editor when
693
+ // clicking outside actual content, manually apply the focus. (#1659)
694
+ if ( editable &&
695
+ CKEDITOR.env.ie && domDocument.$.compatMode == 'CSS1Compat'
696
+ || CKEDITOR.env.gecko
697
+ || CKEDITOR.env.opera )
698
+ {
699
+ var htmlElement = domDocument.getDocumentElement();
700
+ htmlElement.on( 'mousedown', function( evt )
701
+ {
702
+ // Setting focus directly on editor doesn't work, we
703
+ // have to use here a temporary element to 'redirect'
704
+ // the focus.
705
+ if ( evt.data.getTarget().equals( htmlElement ) )
706
+ {
707
+ if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )
708
+ blinkCursor();
709
+ focusGrabber.focus();
710
+ }
711
+ } );
712
+ }
713
+
714
+ var focusTarget = CKEDITOR.env.ie ? iframe : domWindow;
715
+ focusTarget.on( 'blur', function()
716
+ {
717
+ editor.focusManager.blur();
718
+ });
719
+
720
+ var wasFocused;
721
+
722
+ focusTarget.on( 'focus', function()
723
+ {
724
+ var doc = editor.document;
725
+
726
+ if ( editable && CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )
727
+ blinkCursor();
728
+ else if ( CKEDITOR.env.opera )
729
+ doc.getBody().focus();
730
+ // Webkit needs focus for the first time on the HTML element. (#6153)
731
+ else if ( CKEDITOR.env.webkit )
732
+ {
733
+ if ( !wasFocused )
734
+ {
735
+ editor.document.getDocumentElement().focus();
736
+ wasFocused = 1;
737
+ }
738
+ }
739
+
740
+ editor.focusManager.focus();
741
+ });
742
+
743
+ var keystrokeHandler = editor.keystrokeHandler;
744
+ // Prevent backspace from navigating off the page.
745
+ keystrokeHandler.blockedKeystrokes[ 8 ] = !editable;
746
+ keystrokeHandler.attach( domDocument );
747
+
748
+ domDocument.getDocumentElement().addClass( domDocument.$.compatMode );
749
+ // Override keystroke behaviors.
750
+ editable && domDocument.on( 'keydown', function( evt )
751
+ {
752
+ var keyCode = evt.data.getKeystroke();
753
+
754
+ // Backspace OR Delete.
755
+ if ( keyCode in { 8 : 1, 46 : 1 } )
756
+ {
757
+ var sel = editor.getSelection(),
758
+ selected = sel.getSelectedElement(),
759
+ range = sel.getRanges()[ 0 ];
760
+
761
+ // Override keystrokes which should have deletion behavior
762
+ // on fully selected element . (#4047) (#7645)
763
+ if ( selected )
764
+ {
765
+ // Make undo snapshot.
766
+ editor.fire( 'saveSnapshot' );
767
+
768
+ // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will
769
+ // break up the selection, safely manage it here. (#4795)
770
+ range.moveToPosition( selected, CKEDITOR.POSITION_BEFORE_START );
771
+ // Remove the control manually.
772
+ selected.remove();
773
+ range.select();
774
+
775
+ editor.fire( 'saveSnapshot' );
776
+
777
+ evt.data.preventDefault();
778
+ return;
779
+ }
780
+ }
781
+ } );
782
+
783
+ // PageUp/PageDown scrolling is broken in document
784
+ // with standard doctype, manually fix it. (#4736)
785
+ if ( CKEDITOR.env.ie && domDocument.$.compatMode == 'CSS1Compat' )
786
+ {
787
+ var pageUpDownKeys = { 33 : 1, 34 : 1 };
788
+ domDocument.on( 'keydown', function( evt )
789
+ {
790
+ if ( evt.data.getKeystroke() in pageUpDownKeys )
791
+ {
792
+ setTimeout( function ()
793
+ {
794
+ editor.getSelection().scrollIntoView();
795
+ }, 0 );
796
+ }
797
+ } );
798
+ }
799
+
800
+ // Prevent IE from leaving new paragraph after deleting all contents in body. (#6966)
801
+ if ( CKEDITOR.env.ie && editor.config.enterMode != CKEDITOR.ENTER_P )
802
+ {
803
+ domDocument.on( 'selectionchange', function()
804
+ {
805
+ var body = domDocument.getBody(),
806
+ range = editor.getSelection().getRanges()[ 0 ];
807
+
808
+ if ( body.getHtml().match( /^<p>&nbsp;<\/p>$/i )
809
+ && range.startContainer.equals( body ) )
810
+ {
811
+ // Avoid the ambiguity from a real user cursor position.
812
+ setTimeout( function ()
813
+ {
814
+ range = editor.getSelection().getRanges()[ 0 ];
815
+ if ( !range.startContainer.equals ( 'body' ) )
816
+ {
817
+ body.getFirst().remove( 1 );
818
+ range.moveToElementEditEnd( body );
819
+ range.select( 1 );
820
+ }
821
+ }, 0 );
822
+ }
823
+ });
824
+ }
825
+
826
+ // Adds the document body as a context menu target.
827
+ if ( editor.contextMenu )
828
+ editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );
829
+
830
+ setTimeout( function()
831
+ {
832
+ editor.fire( 'contentDom' );
833
+
834
+ if ( fireMode )
835
+ {
836
+ editor.mode = 'wysiwyg';
837
+ editor.fire( 'mode', { previousMode : editor._.previousMode } );
838
+ fireMode = false;
839
+ }
840
+
841
+ isLoadingData = false;
842
+
843
+ if ( isPendingFocus )
844
+ {
845
+ editor.focus();
846
+ isPendingFocus = false;
847
+ }
848
+ setTimeout( function()
849
+ {
850
+ editor.fire( 'dataReady' );
851
+ }, 0 );
852
+
853
+ // IE, Opera and Safari may not support it and throw errors.
854
+ try { editor.document.$.execCommand( 'enableInlineTableEditing', false, !editor.config.disableNativeTableHandles ); } catch(e) {}
855
+ if ( editor.config.disableObjectResizing )
856
+ {
857
+ try
858
+ {
859
+ editor.document.$.execCommand( 'enableObjectResizing', false, false );
860
+ }
861
+ catch(e)
862
+ {
863
+ // For browsers in which the above method failed, we can cancel the resizing on the fly (#4208)
864
+ editor.document.getBody().on( CKEDITOR.env.ie ? 'resizestart' : 'resize', function( evt )
865
+ {
866
+ evt.data.preventDefault();
867
+ });
868
+ }
869
+ }
870
+
871
+ /*
872
+ * IE BUG: IE might have rendered the iframe with invisible contents.
873
+ * (#3623). Push some inconsequential CSS style changes to force IE to
874
+ * refresh it.
875
+ *
876
+ * Also, for some unknown reasons, short timeouts (e.g. 100ms) do not
877
+ * fix the problem. :(
878
+ */
879
+ if ( CKEDITOR.env.ie )
880
+ {
881
+ setTimeout( function()
882
+ {
883
+ if ( editor.document )
884
+ {
885
+ var $body = editor.document.$.body;
886
+ $body.runtimeStyle.marginBottom = '0px';
887
+ $body.runtimeStyle.marginBottom = '';
888
+ }
889
+ }, 1000 );
890
+ }
891
+ },
892
+ 0 );
893
+ }
894
+
895
+ editor.addMode( 'wysiwyg',
896
+ {
897
+ load : function( holderElement, data, isSnapshot )
898
+ {
899
+ mainElement = holderElement;
900
+
901
+ if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )
902
+ holderElement.setStyle( 'position', 'relative' );
903
+
904
+ // The editor data "may be dirty" after this
905
+ // point.
906
+ editor.mayBeDirty = true;
907
+
908
+ fireMode = true;
909
+
910
+ if ( isSnapshot )
911
+ this.loadSnapshotData( data );
912
+ else
913
+ this.loadData( data );
914
+ },
915
+
916
+ loadData : function( data )
917
+ {
918
+ isLoadingData = true;
919
+ editor._.dataStore = { id : 1 };
920
+
921
+ var config = editor.config,
922
+ fullPage = config.fullPage,
923
+ docType = config.docType;
924
+
925
+ // Build the additional stuff to be included into <head>.
926
+ var headExtra =
927
+ '<style type="text/css" data-cke-temp="1">' +
928
+ editor._.styles.join( '\n' ) +
929
+ '</style>';
930
+
931
+ !fullPage && ( headExtra =
932
+ CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
933
+ headExtra );
934
+
935
+ var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : '';
936
+
937
+ if ( fullPage )
938
+ {
939
+ // Search and sweep out the doctype declaration.
940
+ data = data.replace( /<!DOCTYPE[^>]*>/i, function( match )
941
+ {
942
+ editor.docType = docType = match;
943
+ return '';
944
+ }).replace( /<\?xml\s[^\?]*\?>/i, function( match )
945
+ {
946
+ editor.xmlDeclaration = match;
947
+ return '';
948
+ });
949
+ }
950
+
951
+ // Get the HTML version of the data.
952
+ if ( editor.dataProcessor )
953
+ data = editor.dataProcessor.toHtml( data, fixForBody );
954
+
955
+ if ( fullPage )
956
+ {
957
+ // Check if the <body> tag is available.
958
+ if ( !(/<body[\s|>]/).test( data ) )
959
+ data = '<body>' + data;
960
+
961
+ // Check if the <html> tag is available.
962
+ if ( !(/<html[\s|>]/).test( data ) )
963
+ data = '<html>' + data + '</html>';
964
+
965
+ // Check if the <head> tag is available.
966
+ if ( !(/<head[\s|>]/).test( data ) )
967
+ data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ;
968
+ else if ( !(/<title[\s|>]/).test( data ) )
969
+ data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ;
970
+
971
+ // The base must be the first tag in the HEAD, e.g. to get relative
972
+ // links on styles.
973
+ baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) );
974
+
975
+ // Inject the extra stuff into <head>.
976
+ // Attention: do not change it before testing it well. (V2)
977
+ // This is tricky... if the head ends with <meta ... content type>,
978
+ // Firefox will break. But, it works if we place our extra stuff as
979
+ // the last elements in the HEAD.
980
+ data = data.replace( /<\/head\s*>/, headExtra + '$&' );
981
+
982
+ // Add the DOCTYPE back to it.
983
+ data = docType + data;
984
+ }
985
+ else
986
+ {
987
+ data =
988
+ config.docType +
989
+ '<html dir="' + config.contentsLangDirection + '"' +
990
+ ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +
991
+ '<head>' +
992
+ '<title>' + frameLabel + '</title>' +
993
+ baseTag +
994
+ headExtra +
995
+ '</head>' +
996
+ '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) +
997
+ ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +
998
+ '>' +
999
+ data +
1000
+ '</html>';
1001
+ }
1002
+
1003
+ // Distinguish bogus to normal BR at the end of document for Mozilla. (#5293).
1004
+ if ( CKEDITOR.env.gecko )
1005
+ data = data.replace( /<br \/>(?=\s*<\/(:?html|body)>)/, '$&<br type="_moz" />' );
1006
+
1007
+ data += activationScript;
1008
+
1009
+
1010
+ // The iframe is recreated on each call of setData, so we need to clear DOM objects
1011
+ this.onDispose();
1012
+ createIFrame( data );
1013
+ },
1014
+
1015
+ getData : function()
1016
+ {
1017
+ var config = editor.config,
1018
+ fullPage = config.fullPage,
1019
+ docType = fullPage && editor.docType,
1020
+ xmlDeclaration = fullPage && editor.xmlDeclaration,
1021
+ doc = iframe.getFrameDocument();
1022
+
1023
+ var data = fullPage
1024
+ ? doc.getDocumentElement().getOuterHtml()
1025
+ : doc.getBody().getHtml();
1026
+
1027
+ // BR at the end of document is bogus node for Mozilla. (#5293).
1028
+ if ( CKEDITOR.env.gecko )
1029
+ data = data.replace( /<br>(?=\s*(:?$|<\/body>))/, '' );
1030
+
1031
+ if ( editor.dataProcessor )
1032
+ data = editor.dataProcessor.toDataFormat( data, fixForBody );
1033
+
1034
+ // Reset empty if the document contains only one empty paragraph.
1035
+ if ( config.ignoreEmptyParagraph )
1036
+ data = data.replace( emptyParagraphRegexp, function( match, lookback ) { return lookback; } );
1037
+
1038
+ if ( xmlDeclaration )
1039
+ data = xmlDeclaration + '\n' + data;
1040
+ if ( docType )
1041
+ data = docType + '\n' + data;
1042
+
1043
+ return data;
1044
+ },
1045
+
1046
+ getSnapshotData : function()
1047
+ {
1048
+ return iframe.getFrameDocument().getBody().getHtml();
1049
+ },
1050
+
1051
+ loadSnapshotData : function( data )
1052
+ {
1053
+ iframe.getFrameDocument().getBody().setHtml( data );
1054
+ },
1055
+
1056
+ onDispose : function()
1057
+ {
1058
+ if ( !editor.document )
1059
+ return;
1060
+
1061
+ editor.document.getDocumentElement().clearCustomData();
1062
+ editor.document.getBody().clearCustomData();
1063
+
1064
+ editor.window.clearCustomData();
1065
+ editor.document.clearCustomData();
1066
+
1067
+ iframe.clearCustomData();
1068
+
1069
+ /*
1070
+ * IE BUG: When destroying editor DOM with the selection remains inside
1071
+ * editing area would break IE7/8's selection system, we have to put the editing
1072
+ * iframe offline first. (#3812 and #5441)
1073
+ */
1074
+ iframe.remove();
1075
+ },
1076
+
1077
+ unload : function( holderElement )
1078
+ {
1079
+ this.onDispose();
1080
+
1081
+ editor.window = editor.document = iframe = mainElement = isPendingFocus = null;
1082
+
1083
+ editor.fire( 'contentDomUnload' );
1084
+ },
1085
+
1086
+ focus : function()
1087
+ {
1088
+ var win = editor.window;
1089
+
1090
+ if ( isLoadingData )
1091
+ isPendingFocus = true;
1092
+ else if ( win )
1093
+ {
1094
+ // AIR needs a while to focus when moving from a link.
1095
+ CKEDITOR.env.air ? setTimeout( function () { win.focus(); }, 0 ) : win.focus();
1096
+ editor.selectionChange();
1097
+ }
1098
+ }
1099
+ });
1100
+
1101
+ editor.on( 'insertHtml', onInsert( doInsertHtml ) , null, null, 20 );
1102
+ editor.on( 'insertElement', onInsert( doInsertElement ), null, null, 20 );
1103
+ editor.on( 'insertText', onInsert( doInsertText ), null, null, 20 );
1104
+ // Auto fixing on some document structure weakness to enhance usabilities. (#3190 and #3189)
1105
+ editor.on( 'selectionChange', function( evt )
1106
+ {
1107
+ if ( editor.readOnly )
1108
+ return;
1109
+
1110
+ var sel = editor.getSelection();
1111
+ // Do it only when selection is not locked. (#8222)
1112
+ if ( sel && !sel.isLocked )
1113
+ {
1114
+ var isDirty = editor.checkDirty();
1115
+ editor.fire( 'saveSnapshot', { contentOnly : 1 } );
1116
+ onSelectionChangeFixBody.call( this, evt );
1117
+ editor.fire( 'updateSnapshot' );
1118
+ !isDirty && editor.resetDirty();
1119
+ }
1120
+
1121
+ }, null, null, 1 );
1122
+ });
1123
+
1124
+ var titleBackup;
1125
+ // Setting voice label as window title, backup the original one
1126
+ // and restore it before running into use.
1127
+ editor.on( 'contentDom', function()
1128
+ {
1129
+ var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );
1130
+ title.data( 'cke-title', editor.document.$.title );
1131
+ editor.document.$.title = frameLabel;
1132
+ });
1133
+
1134
+ editor.on( 'readOnly', function()
1135
+ {
1136
+ if ( editor.mode == 'wysiwyg' )
1137
+ {
1138
+ // Symply reload the wysiwyg area. It'll take care of read-only.
1139
+ var wysiwyg = editor.getMode();
1140
+ wysiwyg.loadData( wysiwyg.getData() );
1141
+ }
1142
+ });
1143
+
1144
+ // IE>=8 stricts mode doesn't have 'contentEditable' in effect
1145
+ // on element unless it has layout. (#5562)
1146
+ if ( CKEDITOR.document.$.documentMode >= 8 )
1147
+ {
1148
+ editor.addCss( 'html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}' );
1149
+
1150
+ var selectors = [];
1151
+ for ( var tag in CKEDITOR.dtd.$removeEmpty )
1152
+ selectors.push( 'html.CSS1Compat ' + tag + '[contenteditable=false]' );
1153
+ editor.addCss( selectors.join( ',' ) + '{ display:inline-block;}' );
1154
+ }
1155
+ // Set the HTML style to 100% to have the text cursor in affect (#6341)
1156
+ else if ( CKEDITOR.env.gecko )
1157
+ {
1158
+ editor.addCss( 'html { height: 100% !important; }' );
1159
+ editor.addCss( 'img:-moz-broken { -moz-force-broken-image-icon : 1; width : 24px; height : 24px; }' );
1160
+ }
1161
+
1162
+ /* #3658: [IE6] Editor document has horizontal scrollbar on long lines
1163
+ To prevent this misbehavior, we show the scrollbar always */
1164
+ /* #6341: The text cursor must be set on the editor area. */
1165
+ /* #6632: Avoid having "text" shape of cursor in IE7 scrollbars.*/
1166
+ editor.addCss( 'html { _overflow-y: scroll; cursor: text; *cursor:auto;}' );
1167
+ // Use correct cursor for these elements
1168
+ editor.addCss( 'img, input, textarea { cursor: default;}' );
1169
+
1170
+ // Switch on design mode for a short while and close it after then.
1171
+ function blinkCursor( retry )
1172
+ {
1173
+ if ( editor.readOnly )
1174
+ return;
1175
+
1176
+ CKEDITOR.tools.tryThese(
1177
+ function()
1178
+ {
1179
+ editor.document.$.designMode = 'on';
1180
+ setTimeout( function()
1181
+ {
1182
+ editor.document.$.designMode = 'off';
1183
+ if ( CKEDITOR.currentInstance == editor )
1184
+ editor.document.getBody().focus();
1185
+ }, 50 );
1186
+ },
1187
+ function()
1188
+ {
1189
+ // The above call is known to fail when parent DOM
1190
+ // tree layout changes may break design mode. (#5782)
1191
+ // Refresh the 'contentEditable' is a cue to this.
1192
+ editor.document.$.designMode = 'off';
1193
+ var body = editor.document.getBody();
1194
+ body.setAttribute( 'contentEditable', false );
1195
+ body.setAttribute( 'contentEditable', true );
1196
+ // Try it again once..
1197
+ !retry && blinkCursor( 1 );
1198
+ });
1199
+ }
1200
+
1201
+ // Create an invisible element to grab focus.
1202
+ if ( CKEDITOR.env.gecko || CKEDITOR.env.ie || CKEDITOR.env.opera )
1203
+ {
1204
+ var focusGrabber;
1205
+ editor.on( 'uiReady', function()
1206
+ {
1207
+ focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml(
1208
+ // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049)
1209
+ '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ) );
1210
+
1211
+ focusGrabber.on( 'focus', function()
1212
+ {
1213
+ editor.focus();
1214
+ } );
1215
+
1216
+ editor.focusGrabber = focusGrabber;
1217
+ } );
1218
+ editor.on( 'destroy', function()
1219
+ {
1220
+ CKEDITOR.tools.removeFunction( contentDomReadyHandler );
1221
+ focusGrabber.clearCustomData();
1222
+ delete editor.focusGrabber;
1223
+ } );
1224
+ }
1225
+
1226
+ // Disable form elements editing mode provided by some browers. (#5746)
1227
+ editor.on( 'insertElement', function ( evt )
1228
+ {
1229
+ var element = evt.data;
1230
+ if ( element.type == CKEDITOR.NODE_ELEMENT
1231
+ && ( element.is( 'input' ) || element.is( 'textarea' ) ) )
1232
+ {
1233
+ // We should flag that the element was locked by our code so
1234
+ // it'll be editable by the editor functions (#6046).
1235
+ var readonly = element.getAttribute( 'contenteditable' ) == 'false';
1236
+ if ( !readonly )
1237
+ {
1238
+ element.data( 'cke-editable', element.hasAttribute( 'contenteditable' ) ? 'true' : '1' );
1239
+ element.setAttribute( 'contenteditable', false );
1240
+ }
1241
+ }
1242
+ });
1243
+
1244
+ }
1245
+ });
1246
+
1247
+ // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)
1248
+ if ( CKEDITOR.env.gecko )
1249
+ {
1250
+ (function()
1251
+ {
1252
+ var body = document.body;
1253
+
1254
+ if ( !body )
1255
+ window.addEventListener( 'load', arguments.callee, false );
1256
+ else
1257
+ {
1258
+ var currentHandler = body.getAttribute( 'onpageshow' );
1259
+ body.setAttribute( 'onpageshow', ( currentHandler ? currentHandler + ';' : '') +
1260
+ 'event.persisted && (function(){' +
1261
+ 'var allInstances = CKEDITOR.instances, editor, doc;' +
1262
+ 'for ( var i in allInstances )' +
1263
+ '{' +
1264
+ ' editor = allInstances[ i ];' +
1265
+ ' doc = editor.document;' +
1266
+ ' if ( doc )' +
1267
+ ' {' +
1268
+ ' doc.$.designMode = "off";' +
1269
+ ' doc.$.designMode = "on";' +
1270
+ ' }' +
1271
+ '}' +
1272
+ '})();' );
1273
+ }
1274
+ } )();
1275
+
1276
+ }
1277
+ })();
1278
+
1279
+ /**
1280
+ * Disables the ability of resize objects (image and tables) in the editing
1281
+ * area.
1282
+ * @type Boolean
1283
+ * @default false
1284
+ * @example
1285
+ * config.disableObjectResizing = true;
1286
+ */
1287
+ CKEDITOR.config.disableObjectResizing = false;
1288
+
1289
+ /**
1290
+ * Disables the "table tools" offered natively by the browser (currently
1291
+ * Firefox only) to make quick table editing operations, like adding or
1292
+ * deleting rows and columns.
1293
+ * @type Boolean
1294
+ * @default true
1295
+ * @example
1296
+ * config.disableNativeTableHandles = false;
1297
+ */
1298
+ CKEDITOR.config.disableNativeTableHandles = true;
1299
+
1300
+ /**
1301
+ * Disables the built-in words spell checker if browser provides one.<br /><br />
1302
+ *
1303
+ * <strong>Note:</strong> Although word suggestions provided by browsers (natively) will not appear in CKEditor's default context menu,
1304
+ * users can always reach the native context menu by holding the <em>Ctrl</em> key when right-clicking if {@link CKEDITOR.config.browserContextMenuOnCtrl}
1305
+ * is enabled or you're simply not using the context menu plugin.
1306
+ *
1307
+ * @type Boolean
1308
+ * @default true
1309
+ * @example
1310
+ * config.disableNativeSpellChecker = false;
1311
+ */
1312
+ CKEDITOR.config.disableNativeSpellChecker = true;
1313
+
1314
+ /**
1315
+ * Whether the editor must output an empty value ("") if it's contents is made
1316
+ * by an empty paragraph only.
1317
+ * @type Boolean
1318
+ * @default true
1319
+ * @example
1320
+ * config.ignoreEmptyParagraph = false;
1321
+ */
1322
+ CKEDITOR.config.ignoreEmptyParagraph = true;
1323
+
1324
+ /**
1325
+ * Fired when data is loaded and ready for retrieval in an editor instance.
1326
+ * @name CKEDITOR.editor#dataReady
1327
+ * @event
1328
+ */
1329
+
1330
+ /**
1331
+ * Whether automatically create wrapping blocks around inline contents inside document body,
1332
+ * this helps to ensure the integrality of the block enter mode.
1333
+ * <strong>Note:</strong> Changing the default value might introduce unpredictable usability issues.
1334
+ * @name CKEDITOR.config.autoParagraph
1335
+ * @since 3.6
1336
+ * @type Boolean
1337
+ * @default true
1338
+ * @example
1339
+ * config.autoParagraph = false;
1340
+ */
1341
+
1342
+ /**
1343
+ * Fired when some elements are added to the document
1344
+ * @name CKEDITOR.editor#ariaWidget
1345
+ * @event
1346
+ * @param {Object} element The element being added
1347
+ */