ckeditor-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. data/README.md +10 -4
  2. data/ckeditor-rails.gemspec +1 -1
  3. data/lib/ckeditor-rails/version.rb +1 -1
  4. data/vendor/assets/ckeditor/ckeditor/INSTALL.html +92 -92
  5. data/vendor/assets/ckeditor/ckeditor/_samples/adobeair/application.xml +32 -32
  6. data/vendor/assets/ckeditor/ckeditor/_samples/adobeair/run.bat +9 -9
  7. data/vendor/assets/ckeditor/ckeditor/_samples/adobeair/sample.html +45 -45
  8. data/vendor/assets/ckeditor/ckeditor/_samples/ajax.html +98 -98
  9. data/vendor/assets/ckeditor/ckeditor/_samples/api.html +192 -192
  10. data/vendor/assets/ckeditor/ckeditor/_samples/api_dialog.html +198 -198
  11. data/vendor/assets/ckeditor/ckeditor/_samples/api_dialog/my_dialog.js +28 -28
  12. data/vendor/assets/ckeditor/ckeditor/_samples/asp/advanced.asp +105 -105
  13. data/vendor/assets/ckeditor/ckeditor/_samples/asp/events.asp +136 -136
  14. data/vendor/assets/ckeditor/ckeditor/_samples/asp/index.html +103 -103
  15. data/vendor/assets/ckeditor/ckeditor/_samples/asp/replace.asp +72 -72
  16. data/vendor/assets/ckeditor/ckeditor/_samples/asp/replaceall.asp +77 -77
  17. data/vendor/assets/ckeditor/ckeditor/_samples/asp/sample_posteddata.asp +46 -46
  18. data/vendor/assets/ckeditor/ckeditor/_samples/asp/standalone.asp +72 -72
  19. data/vendor/assets/ckeditor/ckeditor/_samples/assets/_posteddata.php +59 -59
  20. data/vendor/assets/ckeditor/ckeditor/_samples/assets/output_xhtml.css +204 -204
  21. data/vendor/assets/ckeditor/ckeditor/_samples/assets/parsesample.css +70 -70
  22. data/vendor/assets/ckeditor/ckeditor/_samples/assets/swfobject.js +18 -18
  23. data/vendor/assets/ckeditor/ckeditor/_samples/autogrow.html +107 -107
  24. data/vendor/assets/ckeditor/ckeditor/_samples/bbcode.html +125 -125
  25. data/vendor/assets/ckeditor/ckeditor/_samples/devtools.html +94 -94
  26. data/vendor/assets/ckeditor/ckeditor/_samples/divreplace.html +154 -154
  27. data/vendor/assets/ckeditor/ckeditor/_samples/enterkey.html +115 -115
  28. data/vendor/assets/ckeditor/ckeditor/_samples/fullpage.html +82 -82
  29. data/vendor/assets/ckeditor/ckeditor/_samples/index.html +116 -116
  30. data/vendor/assets/ckeditor/ckeditor/_samples/jqueryadapter.html +99 -99
  31. data/vendor/assets/ckeditor/ckeditor/_samples/output_for_flash.html +275 -275
  32. data/vendor/assets/ckeditor/ckeditor/_samples/output_html.html +285 -285
  33. data/vendor/assets/ckeditor/ckeditor/_samples/output_xhtml.html +177 -177
  34. data/vendor/assets/ckeditor/ckeditor/_samples/php/advanced.php +120 -120
  35. data/vendor/assets/ckeditor/ckeditor/_samples/php/events.php +153 -153
  36. data/vendor/assets/ckeditor/ckeditor/_samples/php/index.html +47 -47
  37. data/vendor/assets/ckeditor/ckeditor/_samples/php/replace.php +87 -87
  38. data/vendor/assets/ckeditor/ckeditor/_samples/php/replaceall.php +88 -88
  39. data/vendor/assets/ckeditor/ckeditor/_samples/php/standalone.php +83 -83
  40. data/vendor/assets/ckeditor/ckeditor/_samples/placeholder.html +81 -81
  41. data/vendor/assets/ckeditor/ckeditor/_samples/readonly.html +91 -91
  42. data/vendor/assets/ckeditor/ckeditor/_samples/replacebyclass.html +64 -64
  43. data/vendor/assets/ckeditor/ckeditor/_samples/replacebycode.html +97 -97
  44. data/vendor/assets/ckeditor/ckeditor/_samples/sample.css +163 -163
  45. data/vendor/assets/ckeditor/ckeditor/_samples/sample.js +65 -65
  46. data/vendor/assets/ckeditor/ckeditor/_samples/sample_posteddata.php +21 -21
  47. data/vendor/assets/ckeditor/ckeditor/_samples/sharedspaces.html +153 -153
  48. data/vendor/assets/ckeditor/ckeditor/_samples/skins.html +110 -110
  49. data/vendor/assets/ckeditor/ckeditor/_samples/stylesheetparser.html +93 -93
  50. data/vendor/assets/ckeditor/ckeditor/_samples/tableresize.html +115 -115
  51. data/vendor/assets/ckeditor/ckeditor/_samples/ui_color.html +129 -129
  52. data/vendor/assets/ckeditor/ckeditor/_samples/ui_languages.html +134 -134
  53. data/vendor/assets/ckeditor/ckeditor/_source/adapters/jquery.js +306 -306
  54. data/vendor/assets/ckeditor/ckeditor/_source/core/_bootstrap.js +87 -87
  55. data/vendor/assets/ckeditor/ckeditor/_source/core/ckeditor.js +141 -141
  56. data/vendor/assets/ckeditor/ckeditor/_source/core/ckeditor_base.js +227 -227
  57. data/vendor/assets/ckeditor/ckeditor/_source/core/ckeditor_basic.js +238 -238
  58. data/vendor/assets/ckeditor/ckeditor/_source/core/command.js +209 -209
  59. data/vendor/assets/ckeditor/ckeditor/_source/core/commanddefinition.js +129 -129
  60. data/vendor/assets/ckeditor/ckeditor/_source/core/config.js +431 -431
  61. data/vendor/assets/ckeditor/ckeditor/_source/core/dataprocessor.js +65 -65
  62. data/vendor/assets/ckeditor/ckeditor/_source/core/dom.js +20 -20
  63. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/comment.js +32 -32
  64. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/document.js +251 -251
  65. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/documentfragment.js +49 -49
  66. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/domobject.js +258 -258
  67. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/element.js +1681 -1681
  68. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/elementpath.js +119 -119
  69. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/event.js +145 -145
  70. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/node.js +695 -695
  71. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/nodelist.js +26 -26
  72. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/range.js +2032 -2032
  73. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/rangelist.js +213 -213
  74. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/text.js +128 -128
  75. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/walker.js +462 -462
  76. data/vendor/assets/ckeditor/ckeditor/_source/core/dom/window.js +96 -96
  77. data/vendor/assets/ckeditor/ckeditor/_source/core/dtd.js +266 -266
  78. data/vendor/assets/ckeditor/ckeditor/_source/core/editor.js +1059 -1059
  79. data/vendor/assets/ckeditor/ckeditor/_source/core/editor_basic.js +186 -186
  80. data/vendor/assets/ckeditor/ckeditor/_source/core/env.js +291 -291
  81. data/vendor/assets/ckeditor/ckeditor/_source/core/event.js +342 -342
  82. data/vendor/assets/ckeditor/ckeditor/_source/core/eventInfo.js +120 -120
  83. data/vendor/assets/ckeditor/ckeditor/_source/core/focusmanager.js +152 -152
  84. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser.js +224 -224
  85. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/basicwriter.js +145 -145
  86. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/cdata.js +43 -43
  87. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/comment.js +60 -60
  88. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/element.js +308 -308
  89. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/filter.js +288 -288
  90. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/fragment.js +497 -497
  91. data/vendor/assets/ckeditor/ckeditor/_source/core/htmlparser/text.js +55 -55
  92. data/vendor/assets/ckeditor/ckeditor/_source/core/lang.js +157 -157
  93. data/vendor/assets/ckeditor/ckeditor/_source/core/loader.js +240 -240
  94. data/vendor/assets/ckeditor/ckeditor/_source/core/plugindefinition.js +83 -83
  95. data/vendor/assets/ckeditor/ckeditor/_source/core/plugins.js +103 -103
  96. data/vendor/assets/ckeditor/ckeditor/_source/core/resourcemanager.js +238 -238
  97. data/vendor/assets/ckeditor/ckeditor/_source/core/scriptloader.js +180 -180
  98. data/vendor/assets/ckeditor/ckeditor/_source/core/skins.js +184 -184
  99. data/vendor/assets/ckeditor/ckeditor/_source/core/themes.js +19 -19
  100. data/vendor/assets/ckeditor/ckeditor/_source/core/tools.js +763 -763
  101. data/vendor/assets/ckeditor/ckeditor/_source/core/ui.js +128 -128
  102. data/vendor/assets/ckeditor/ckeditor/_source/lang/_languages.js +84 -84
  103. data/vendor/assets/ckeditor/ckeditor/_source/lang/_translationstatus.txt +61 -61
  104. data/vendor/assets/ckeditor/ckeditor/_source/lang/af.js +812 -812
  105. data/vendor/assets/ckeditor/ckeditor/_source/lang/ar.js +812 -812
  106. data/vendor/assets/ckeditor/ckeditor/_source/lang/bg.js +812 -812
  107. data/vendor/assets/ckeditor/ckeditor/_source/lang/bn.js +812 -812
  108. data/vendor/assets/ckeditor/ckeditor/_source/lang/bs.js +812 -812
  109. data/vendor/assets/ckeditor/ckeditor/_source/lang/ca.js +812 -812
  110. data/vendor/assets/ckeditor/ckeditor/_source/lang/cs.js +812 -812
  111. data/vendor/assets/ckeditor/ckeditor/_source/lang/cy.js +812 -812
  112. data/vendor/assets/ckeditor/ckeditor/_source/lang/da.js +812 -812
  113. data/vendor/assets/ckeditor/ckeditor/_source/lang/de.js +812 -812
  114. data/vendor/assets/ckeditor/ckeditor/_source/lang/el.js +812 -812
  115. data/vendor/assets/ckeditor/ckeditor/_source/lang/en-au.js +812 -812
  116. data/vendor/assets/ckeditor/ckeditor/_source/lang/en-ca.js +812 -812
  117. data/vendor/assets/ckeditor/ckeditor/_source/lang/en-gb.js +812 -812
  118. data/vendor/assets/ckeditor/ckeditor/_source/lang/en.js +812 -812
  119. data/vendor/assets/ckeditor/ckeditor/_source/lang/eo.js +812 -812
  120. data/vendor/assets/ckeditor/ckeditor/_source/lang/es.js +812 -812
  121. data/vendor/assets/ckeditor/ckeditor/_source/lang/et.js +812 -812
  122. data/vendor/assets/ckeditor/ckeditor/_source/lang/eu.js +812 -812
  123. data/vendor/assets/ckeditor/ckeditor/_source/lang/fa.js +812 -812
  124. data/vendor/assets/ckeditor/ckeditor/_source/lang/fi.js +812 -812
  125. data/vendor/assets/ckeditor/ckeditor/_source/lang/fo.js +812 -812
  126. data/vendor/assets/ckeditor/ckeditor/_source/lang/fr-ca.js +812 -812
  127. data/vendor/assets/ckeditor/ckeditor/_source/lang/fr.js +812 -812
  128. data/vendor/assets/ckeditor/ckeditor/_source/lang/gl.js +812 -812
  129. data/vendor/assets/ckeditor/ckeditor/_source/lang/gu.js +812 -812
  130. data/vendor/assets/ckeditor/ckeditor/_source/lang/he.js +812 -812
  131. data/vendor/assets/ckeditor/ckeditor/_source/lang/hi.js +812 -812
  132. data/vendor/assets/ckeditor/ckeditor/_source/lang/hr.js +812 -812
  133. data/vendor/assets/ckeditor/ckeditor/_source/lang/hu.js +812 -812
  134. data/vendor/assets/ckeditor/ckeditor/_source/lang/is.js +812 -812
  135. data/vendor/assets/ckeditor/ckeditor/_source/lang/it.js +812 -812
  136. data/vendor/assets/ckeditor/ckeditor/_source/lang/ja.js +812 -812
  137. data/vendor/assets/ckeditor/ckeditor/_source/lang/ka.js +812 -812
  138. data/vendor/assets/ckeditor/ckeditor/_source/lang/km.js +812 -812
  139. data/vendor/assets/ckeditor/ckeditor/_source/lang/ko.js +812 -812
  140. data/vendor/assets/ckeditor/ckeditor/_source/lang/lt.js +812 -812
  141. data/vendor/assets/ckeditor/ckeditor/_source/lang/lv.js +812 -812
  142. data/vendor/assets/ckeditor/ckeditor/_source/lang/mn.js +812 -812
  143. data/vendor/assets/ckeditor/ckeditor/_source/lang/ms.js +812 -812
  144. data/vendor/assets/ckeditor/ckeditor/_source/lang/nb.js +812 -812
  145. data/vendor/assets/ckeditor/ckeditor/_source/lang/nl.js +812 -812
  146. data/vendor/assets/ckeditor/ckeditor/_source/lang/no.js +812 -812
  147. data/vendor/assets/ckeditor/ckeditor/_source/lang/pl.js +812 -812
  148. data/vendor/assets/ckeditor/ckeditor/_source/lang/pt-br.js +811 -811
  149. data/vendor/assets/ckeditor/ckeditor/_source/lang/pt.js +812 -812
  150. data/vendor/assets/ckeditor/ckeditor/_source/lang/ro.js +812 -812
  151. data/vendor/assets/ckeditor/ckeditor/_source/lang/ru.js +812 -812
  152. data/vendor/assets/ckeditor/ckeditor/_source/lang/sk.js +812 -812
  153. data/vendor/assets/ckeditor/ckeditor/_source/lang/sl.js +812 -812
  154. data/vendor/assets/ckeditor/ckeditor/_source/lang/sr-latn.js +812 -812
  155. data/vendor/assets/ckeditor/ckeditor/_source/lang/sr.js +812 -812
  156. data/vendor/assets/ckeditor/ckeditor/_source/lang/sv.js +811 -811
  157. data/vendor/assets/ckeditor/ckeditor/_source/lang/th.js +812 -812
  158. data/vendor/assets/ckeditor/ckeditor/_source/lang/tr.js +811 -811
  159. data/vendor/assets/ckeditor/ckeditor/_source/lang/uk.js +812 -812
  160. data/vendor/assets/ckeditor/ckeditor/_source/lang/vi.js +812 -812
  161. data/vendor/assets/ckeditor/ckeditor/_source/lang/zh-cn.js +812 -812
  162. data/vendor/assets/ckeditor/ckeditor/_source/lang/zh.js +812 -812
  163. data/vendor/assets/ckeditor/ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js +222 -222
  164. data/vendor/assets/ckeditor/ckeditor/_source/plugins/a11yhelp/lang/en.js +108 -108
  165. data/vendor/assets/ckeditor/ckeditor/_source/plugins/a11yhelp/lang/he.js +216 -216
  166. data/vendor/assets/ckeditor/ckeditor/_source/plugins/a11yhelp/plugin.js +47 -47
  167. data/vendor/assets/ckeditor/ckeditor/_source/plugins/about/dialogs/about.js +76 -76
  168. data/vendor/assets/ckeditor/ckeditor/_source/plugins/about/plugin.js +24 -24
  169. data/vendor/assets/ckeditor/ckeditor/_source/plugins/adobeair/plugin.js +228 -228
  170. data/vendor/assets/ckeditor/ckeditor/_source/plugins/ajax/plugin.js +152 -152
  171. data/vendor/assets/ckeditor/ckeditor/_source/plugins/autogrow/plugin.js +88 -88
  172. data/vendor/assets/ckeditor/ckeditor/_source/plugins/basicstyles/plugin.js +101 -101
  173. data/vendor/assets/ckeditor/ckeditor/_source/plugins/bbcode/plugin.js +931 -931
  174. data/vendor/assets/ckeditor/ckeditor/_source/plugins/bidi/plugin.js +334 -334
  175. data/vendor/assets/ckeditor/ckeditor/_source/plugins/blockquote/plugin.js +305 -305
  176. data/vendor/assets/ckeditor/ckeditor/_source/plugins/button/plugin.js +290 -290
  177. data/vendor/assets/ckeditor/ckeditor/_source/plugins/clipboard/dialogs/paste.js +223 -223
  178. data/vendor/assets/ckeditor/ckeditor/_source/plugins/clipboard/plugin.js +453 -453
  179. data/vendor/assets/ckeditor/ckeditor/_source/plugins/colorbutton/plugin.js +294 -294
  180. data/vendor/assets/ckeditor/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js +340 -340
  181. data/vendor/assets/ckeditor/ckeditor/_source/plugins/colordialog/plugin.js +15 -15
  182. data/vendor/assets/ckeditor/ckeditor/_source/plugins/contextmenu/plugin.js +177 -177
  183. data/vendor/assets/ckeditor/ckeditor/_source/plugins/devtools/lang/en.js +16 -16
  184. data/vendor/assets/ckeditor/ckeditor/_source/plugins/devtools/plugin.js +173 -173
  185. data/vendor/assets/ckeditor/ckeditor/_source/plugins/dialog/dialogDefinition.js +1166 -1166
  186. data/vendor/assets/ckeditor/ckeditor/_source/plugins/dialog/plugin.js +3289 -3289
  187. data/vendor/assets/ckeditor/ckeditor/_source/plugins/dialogadvtab/plugin.js +207 -207
  188. data/vendor/assets/ckeditor/ckeditor/_source/plugins/dialogui/plugin.js +1541 -1541
  189. data/vendor/assets/ckeditor/ckeditor/_source/plugins/div/dialogs/div.js +535 -535
  190. data/vendor/assets/ckeditor/ckeditor/_source/plugins/div/plugin.js +121 -121
  191. data/vendor/assets/ckeditor/ckeditor/_source/plugins/docprops/dialogs/docprops.js +686 -686
  192. data/vendor/assets/ckeditor/ckeditor/_source/plugins/docprops/plugin.js +22 -22
  193. data/vendor/assets/ckeditor/ckeditor/_source/plugins/domiterator/plugin.js +361 -361
  194. data/vendor/assets/ckeditor/ckeditor/_source/plugins/editingblock/plugin.js +275 -275
  195. data/vendor/assets/ckeditor/ckeditor/_source/plugins/elementspath/plugin.js +218 -218
  196. data/vendor/assets/ckeditor/ckeditor/_source/plugins/enterkey/plugin.js +413 -413
  197. data/vendor/assets/ckeditor/ckeditor/_source/plugins/entities/plugin.js +250 -250
  198. data/vendor/assets/ckeditor/ckeditor/_source/plugins/fakeobjects/plugin.js +175 -175
  199. data/vendor/assets/ckeditor/ckeditor/_source/plugins/filebrowser/plugin.js +524 -524
  200. data/vendor/assets/ckeditor/ckeditor/_source/plugins/find/dialogs/find.js +903 -903
  201. data/vendor/assets/ckeditor/ckeditor/_source/plugins/find/plugin.js +47 -47
  202. data/vendor/assets/ckeditor/ckeditor/_source/plugins/flash/dialogs/flash.js +673 -673
  203. data/vendor/assets/ckeditor/ckeditor/_source/plugins/flash/plugin.js +154 -154
  204. data/vendor/assets/ckeditor/ckeditor/_source/plugins/floatpanel/plugin.js +428 -428
  205. data/vendor/assets/ckeditor/ckeditor/_source/plugins/font/plugin.js +234 -234
  206. data/vendor/assets/ckeditor/ckeditor/_source/plugins/format/plugin.js +197 -197
  207. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/button.js +118 -118
  208. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/checkbox.js +153 -153
  209. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/form.js +177 -177
  210. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/hiddenfield.js +100 -100
  211. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/radio.js +135 -135
  212. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/select.js +558 -558
  213. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/textarea.js +114 -114
  214. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/dialogs/textfield.js +199 -199
  215. data/vendor/assets/ckeditor/ckeditor/_source/plugins/forms/plugin.js +288 -288
  216. data/vendor/assets/ckeditor/ckeditor/_source/plugins/horizontalrule/plugin.js +48 -48
  217. data/vendor/assets/ckeditor/ckeditor/_source/plugins/htmldataprocessor/plugin.js +595 -595
  218. data/vendor/assets/ckeditor/ckeditor/_source/plugins/htmlwriter/plugin.js +319 -319
  219. data/vendor/assets/ckeditor/ckeditor/_source/plugins/iframe/dialogs/iframe.js +229 -229
  220. data/vendor/assets/ckeditor/ckeditor/_source/plugins/iframe/plugin.js +87 -87
  221. data/vendor/assets/ckeditor/ckeditor/_source/plugins/iframedialog/plugin.js +188 -188
  222. data/vendor/assets/ckeditor/ckeditor/_source/plugins/image/dialogs/image.js +1406 -1406
  223. data/vendor/assets/ckeditor/ckeditor/_source/plugins/image/plugin.js +81 -81
  224. data/vendor/assets/ckeditor/ckeditor/_source/plugins/indent/plugin.js +461 -461
  225. data/vendor/assets/ckeditor/ckeditor/_source/plugins/justify/plugin.js +253 -253
  226. data/vendor/assets/ckeditor/ckeditor/_source/plugins/keystrokes/plugin.js +225 -225
  227. data/vendor/assets/ckeditor/ckeditor/_source/plugins/link/dialogs/anchor.js +144 -144
  228. data/vendor/assets/ckeditor/ckeditor/_source/plugins/link/dialogs/link.js +1424 -1424
  229. data/vendor/assets/ckeditor/ckeditor/_source/plugins/link/plugin.js +374 -374
  230. data/vendor/assets/ckeditor/ckeditor/_source/plugins/list/plugin.js +734 -734
  231. data/vendor/assets/ckeditor/ckeditor/_source/plugins/listblock/plugin.js +268 -268
  232. data/vendor/assets/ckeditor/ckeditor/_source/plugins/liststyle/dialogs/liststyle.js +225 -225
  233. data/vendor/assets/ckeditor/ckeditor/_source/plugins/liststyle/plugin.js +66 -66
  234. data/vendor/assets/ckeditor/ckeditor/_source/plugins/maximize/plugin.js +352 -352
  235. data/vendor/assets/ckeditor/ckeditor/_source/plugins/menu/plugin.js +541 -541
  236. data/vendor/assets/ckeditor/ckeditor/_source/plugins/menubutton/plugin.js +98 -98
  237. data/vendor/assets/ckeditor/ckeditor/_source/plugins/newpage/plugin.js +54 -54
  238. data/vendor/assets/ckeditor/ckeditor/_source/plugins/pagebreak/plugin.js +164 -164
  239. data/vendor/assets/ckeditor/ckeditor/_source/plugins/panel/plugin.js +403 -403
  240. data/vendor/assets/ckeditor/ckeditor/_source/plugins/panelbutton/plugin.js +144 -144
  241. data/vendor/assets/ckeditor/ckeditor/_source/plugins/pastefromword/filter/default.js +1367 -1367
  242. data/vendor/assets/ckeditor/ckeditor/_source/plugins/pastefromword/plugin.js +141 -141
  243. data/vendor/assets/ckeditor/ckeditor/_source/plugins/pastetext/dialogs/pastetext.js +67 -67
  244. data/vendor/assets/ckeditor/ckeditor/_source/plugins/pastetext/plugin.js +98 -98
  245. data/vendor/assets/ckeditor/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js +71 -71
  246. data/vendor/assets/ckeditor/ckeditor/_source/plugins/placeholder/lang/en.js +16 -16
  247. data/vendor/assets/ckeditor/ckeditor/_source/plugins/placeholder/lang/he.js +16 -16
  248. data/vendor/assets/ckeditor/ckeditor/_source/plugins/placeholder/plugin.js +171 -171
  249. data/vendor/assets/ckeditor/ckeditor/_source/plugins/popup/plugin.js +64 -64
  250. data/vendor/assets/ckeditor/ckeditor/_source/plugins/preview/plugin.js +109 -109
  251. data/vendor/assets/ckeditor/ckeditor/_source/plugins/print/plugin.js +42 -42
  252. data/vendor/assets/ckeditor/ckeditor/_source/plugins/removeformat/plugin.js +185 -185
  253. data/vendor/assets/ckeditor/ckeditor/_source/plugins/resize/plugin.js +168 -168
  254. data/vendor/assets/ckeditor/ckeditor/_source/plugins/richcombo/plugin.js +381 -381
  255. data/vendor/assets/ckeditor/ckeditor/_source/plugins/save/plugin.js +56 -56
  256. data/vendor/assets/ckeditor/ckeditor/_source/plugins/scayt/dialogs/options.js +537 -537
  257. data/vendor/assets/ckeditor/ckeditor/_source/plugins/scayt/dialogs/toolbar.css +71 -71
  258. data/vendor/assets/ckeditor/ckeditor/_source/plugins/scayt/plugin.js +964 -964
  259. data/vendor/assets/ckeditor/ckeditor/_source/plugins/selection/plugin.js +1601 -1601
  260. data/vendor/assets/ckeditor/ckeditor/_source/plugins/showblocks/plugin.js +160 -160
  261. data/vendor/assets/ckeditor/ckeditor/_source/plugins/showborders/plugin.js +207 -207
  262. data/vendor/assets/ckeditor/ckeditor/_source/plugins/smiley/dialogs/smiley.js +224 -224
  263. data/vendor/assets/ckeditor/ckeditor/_source/plugins/smiley/plugin.js +94 -94
  264. data/vendor/assets/ckeditor/ckeditor/_source/plugins/sourcearea/plugin.js +209 -209
  265. data/vendor/assets/ckeditor/ckeditor/_source/plugins/specialchar/dialogs/specialchar.js +350 -350
  266. data/vendor/assets/ckeditor/ckeditor/_source/plugins/specialchar/lang/en.js +89 -89
  267. data/vendor/assets/ckeditor/ckeditor/_source/plugins/specialchar/plugin.js +70 -70
  268. data/vendor/assets/ckeditor/ckeditor/_source/plugins/styles/plugin.js +1696 -1696
  269. data/vendor/assets/ckeditor/ckeditor/_source/plugins/styles/styles/default.js +88 -88
  270. data/vendor/assets/ckeditor/ckeditor/_source/plugins/stylescombo/plugin.js +218 -218
  271. data/vendor/assets/ckeditor/ckeditor/_source/plugins/stylesheetparser/plugin.js +148 -148
  272. data/vendor/assets/ckeditor/ckeditor/_source/plugins/tab/plugin.js +367 -367
  273. data/vendor/assets/ckeditor/ckeditor/_source/plugins/table/dialogs/table.js +602 -602
  274. data/vendor/assets/ckeditor/ckeditor/_source/plugins/table/plugin.js +78 -78
  275. data/vendor/assets/ckeditor/ckeditor/_source/plugins/tableresize/plugin.js +443 -443
  276. data/vendor/assets/ckeditor/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js +525 -525
  277. data/vendor/assets/ckeditor/ckeditor/_source/plugins/tabletools/plugin.js +1194 -1194
  278. data/vendor/assets/ckeditor/ckeditor/_source/plugins/templates/dialogs/templates.js +234 -234
  279. data/vendor/assets/ckeditor/ckeditor/_source/plugins/templates/plugin.js +99 -99
  280. data/vendor/assets/ckeditor/ckeditor/_source/plugins/templates/templates/default.js +94 -94
  281. data/vendor/assets/ckeditor/ckeditor/_source/plugins/toolbar/plugin.js +545 -545
  282. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/dialogs/uicolor.js +205 -205
  283. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/lang/en.js +15 -15
  284. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/lang/he.js +15 -15
  285. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/plugin.js +37 -37
  286. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/yui/assets/yui.css +15 -15
  287. data/vendor/assets/ckeditor/ckeditor/_source/plugins/uicolor/yui/yui.js +71 -71
  288. data/vendor/assets/ckeditor/ckeditor/_source/plugins/undo/plugin.js +580 -580
  289. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wsc/dialogs/ciframe.html +49 -49
  290. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wsc/dialogs/tmpFrameset.html +52 -52
  291. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wsc/dialogs/wsc.css +82 -82
  292. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wsc/dialogs/wsc.js +192 -192
  293. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wsc/plugin.js +33 -33
  294. data/vendor/assets/ckeditor/ckeditor/_source/plugins/wysiwygarea/plugin.js +1351 -1351
  295. data/vendor/assets/ckeditor/ckeditor/_source/plugins/xml/plugin.js +170 -170
  296. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/dialog.css +943 -943
  297. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/editor.css +25 -25
  298. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/elementspath.css +73 -73
  299. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/icons.css +366 -366
  300. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/mainui.css +203 -203
  301. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/menu.css +232 -232
  302. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/panel.css +217 -217
  303. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/presets.css +49 -49
  304. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/reset.css +84 -84
  305. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/richcombo.css +287 -287
  306. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/skin.js +236 -236
  307. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/templates.css +88 -88
  308. data/vendor/assets/ckeditor/ckeditor/_source/skins/kama/toolbar.css +407 -407
  309. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/dialog.css +844 -844
  310. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/editor.css +25 -25
  311. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/elementspath.css +74 -74
  312. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/icons.css +363 -363
  313. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/mainui.css +153 -153
  314. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/menu.css +229 -229
  315. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/panel.css +212 -212
  316. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/presets.css +49 -49
  317. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/reset.css +84 -84
  318. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/richcombo.css +309 -309
  319. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/skin.js +74 -74
  320. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/templates.css +87 -87
  321. data/vendor/assets/ckeditor/ckeditor/_source/skins/office2003/toolbar.css +522 -522
  322. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/dialog.css +861 -861
  323. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/editor.css +25 -25
  324. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/elementspath.css +74 -74
  325. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/icons.css +363 -363
  326. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/mainui.css +162 -162
  327. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/menu.css +232 -232
  328. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/panel.css +212 -212
  329. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/presets.css +50 -50
  330. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/reset.css +84 -84
  331. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/richcombo.css +302 -302
  332. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/skin.js +70 -70
  333. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/templates.css +87 -87
  334. data/vendor/assets/ckeditor/ckeditor/_source/skins/v2/toolbar.css +465 -465
  335. data/vendor/assets/ckeditor/ckeditor/_source/themes/default/theme.js +395 -395
  336. data/vendor/assets/ckeditor/ckeditor/adapters/jquery.js +6 -6
  337. data/vendor/assets/ckeditor/ckeditor/ckeditor.asp +955 -955
  338. data/vendor/assets/ckeditor/ckeditor/ckeditor.pack +211 -211
  339. data/vendor/assets/ckeditor/ckeditor/ckeditor.php +29 -29
  340. data/vendor/assets/ckeditor/ckeditor/ckeditor_basic.js +8 -8
  341. data/vendor/assets/ckeditor/ckeditor/ckeditor_basic_source.js +20 -20
  342. data/vendor/assets/ckeditor/ckeditor/ckeditor_php4.php +566 -566
  343. data/vendor/assets/ckeditor/ckeditor/ckeditor_php5.php +556 -556
  344. data/vendor/assets/ckeditor/ckeditor/config.js +11 -11
  345. data/vendor/assets/ckeditor/ckeditor/contents.css +25 -25
  346. data/vendor/assets/ckeditor/ckeditor/themes/default/theme.js +8 -8
  347. metadata +7 -9
@@ -1,207 +1,207 @@
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
- (function()
7
- {
8
-
9
- function setupAdvParams( element )
10
- {
11
- var attrName = this.att;
12
-
13
- var value = element && element.hasAttribute( attrName ) && element.getAttribute( attrName ) || '';
14
-
15
- if ( value !== undefined )
16
- this.setValue( value );
17
- }
18
-
19
- function commitAdvParams()
20
- {
21
- // Dialogs may use different parameters in the commit list, so, by
22
- // definition, we take the first CKEDITOR.dom.element available.
23
- var element;
24
-
25
- for ( var i = 0 ; i < arguments.length ; i++ )
26
- {
27
- if ( arguments[ i ] instanceof CKEDITOR.dom.element )
28
- {
29
- element = arguments[ i ];
30
- break;
31
- }
32
- }
33
-
34
- if ( element )
35
- {
36
- var attrName = this.att,
37
- value = this.getValue();
38
-
39
- if ( value )
40
- element.setAttribute( attrName, value );
41
- else
42
- element.removeAttribute( attrName, value );
43
- }
44
- }
45
-
46
- CKEDITOR.plugins.add( 'dialogadvtab',
47
- {
48
- /**
49
- *
50
- * @param tabConfig
51
- * id, dir, classes, styles
52
- */
53
- createAdvancedTab : function( editor, tabConfig )
54
- {
55
- if ( !tabConfig )
56
- tabConfig = { id:1, dir:1, classes:1, styles:1 };
57
-
58
- var lang = editor.lang.common;
59
-
60
- var result =
61
- {
62
- id : 'advanced',
63
- label : lang.advancedTab,
64
- title : lang.advancedTab,
65
- elements :
66
- [
67
- {
68
- type : 'vbox',
69
- padding : 1,
70
- children : []
71
- }
72
- ]
73
- };
74
-
75
- var contents = [];
76
-
77
- if ( tabConfig.id || tabConfig.dir )
78
- {
79
- if ( tabConfig.id )
80
- {
81
- contents.push(
82
- {
83
- id : 'advId',
84
- att : 'id',
85
- type : 'text',
86
- label : lang.id,
87
- setup : setupAdvParams,
88
- commit : commitAdvParams
89
- });
90
- }
91
-
92
- if ( tabConfig.dir )
93
- {
94
- contents.push(
95
- {
96
- id : 'advLangDir',
97
- att : 'dir',
98
- type : 'select',
99
- label : lang.langDir,
100
- 'default' : '',
101
- style : 'width:100%',
102
- items :
103
- [
104
- [ lang.notSet, '' ],
105
- [ lang.langDirLTR, 'ltr' ],
106
- [ lang.langDirRTL, 'rtl' ]
107
- ],
108
- setup : setupAdvParams,
109
- commit : commitAdvParams
110
- });
111
- }
112
-
113
- result.elements[ 0 ].children.push(
114
- {
115
- type : 'hbox',
116
- widths : [ '50%', '50%' ],
117
- children : [].concat( contents )
118
- });
119
- }
120
-
121
- if ( tabConfig.styles || tabConfig.classes )
122
- {
123
- contents = [];
124
-
125
- if ( tabConfig.styles )
126
- {
127
- contents.push(
128
- {
129
- id : 'advStyles',
130
- att : 'style',
131
- type : 'text',
132
- label : lang.styles,
133
- 'default' : '',
134
-
135
- onChange : function(){},
136
-
137
- getStyle : function( name, defaultValue )
138
- {
139
- var match = this.getValue().match( new RegExp( name + '\\s*:\\s*([^;]*)', 'i') );
140
- return match ? match[ 1 ] : defaultValue;
141
- },
142
-
143
- updateStyle : function( name, value )
144
- {
145
- var styles = this.getValue();
146
-
147
- // Remove the current value.
148
- if ( styles )
149
- {
150
- styles = styles
151
- .replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' )
152
- .replace( /^[;\s]+/, '' )
153
- .replace( /\s+$/, '' );
154
- }
155
-
156
- if ( value )
157
- {
158
- styles && !(/;\s*$/).test( styles ) && ( styles += '; ' );
159
- styles += name + ': ' + value;
160
- }
161
-
162
- this.setValue( styles, 1 );
163
-
164
- },
165
-
166
- setup : setupAdvParams,
167
-
168
- commit : commitAdvParams
169
-
170
- });
171
- }
172
-
173
- if ( tabConfig.classes )
174
- {
175
- contents.push(
176
- {
177
- type : 'hbox',
178
- widths : [ '45%', '55%' ],
179
- children :
180
- [
181
- {
182
- id : 'advCSSClasses',
183
- att : 'class',
184
- type : 'text',
185
- label : lang.cssClasses,
186
- 'default' : '',
187
- setup : setupAdvParams,
188
- commit : commitAdvParams
189
-
190
- }
191
- ]
192
- });
193
- }
194
-
195
- result.elements[ 0 ].children.push(
196
- {
197
- type : 'hbox',
198
- widths : [ '50%', '50%' ],
199
- children : [].concat( contents )
200
- });
201
- }
202
-
203
- return result;
204
- }
205
- });
206
-
207
- })();
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
+ (function()
7
+ {
8
+
9
+ function setupAdvParams( element )
10
+ {
11
+ var attrName = this.att;
12
+
13
+ var value = element && element.hasAttribute( attrName ) && element.getAttribute( attrName ) || '';
14
+
15
+ if ( value !== undefined )
16
+ this.setValue( value );
17
+ }
18
+
19
+ function commitAdvParams()
20
+ {
21
+ // Dialogs may use different parameters in the commit list, so, by
22
+ // definition, we take the first CKEDITOR.dom.element available.
23
+ var element;
24
+
25
+ for ( var i = 0 ; i < arguments.length ; i++ )
26
+ {
27
+ if ( arguments[ i ] instanceof CKEDITOR.dom.element )
28
+ {
29
+ element = arguments[ i ];
30
+ break;
31
+ }
32
+ }
33
+
34
+ if ( element )
35
+ {
36
+ var attrName = this.att,
37
+ value = this.getValue();
38
+
39
+ if ( value )
40
+ element.setAttribute( attrName, value );
41
+ else
42
+ element.removeAttribute( attrName, value );
43
+ }
44
+ }
45
+
46
+ CKEDITOR.plugins.add( 'dialogadvtab',
47
+ {
48
+ /**
49
+ *
50
+ * @param tabConfig
51
+ * id, dir, classes, styles
52
+ */
53
+ createAdvancedTab : function( editor, tabConfig )
54
+ {
55
+ if ( !tabConfig )
56
+ tabConfig = { id:1, dir:1, classes:1, styles:1 };
57
+
58
+ var lang = editor.lang.common;
59
+
60
+ var result =
61
+ {
62
+ id : 'advanced',
63
+ label : lang.advancedTab,
64
+ title : lang.advancedTab,
65
+ elements :
66
+ [
67
+ {
68
+ type : 'vbox',
69
+ padding : 1,
70
+ children : []
71
+ }
72
+ ]
73
+ };
74
+
75
+ var contents = [];
76
+
77
+ if ( tabConfig.id || tabConfig.dir )
78
+ {
79
+ if ( tabConfig.id )
80
+ {
81
+ contents.push(
82
+ {
83
+ id : 'advId',
84
+ att : 'id',
85
+ type : 'text',
86
+ label : lang.id,
87
+ setup : setupAdvParams,
88
+ commit : commitAdvParams
89
+ });
90
+ }
91
+
92
+ if ( tabConfig.dir )
93
+ {
94
+ contents.push(
95
+ {
96
+ id : 'advLangDir',
97
+ att : 'dir',
98
+ type : 'select',
99
+ label : lang.langDir,
100
+ 'default' : '',
101
+ style : 'width:100%',
102
+ items :
103
+ [
104
+ [ lang.notSet, '' ],
105
+ [ lang.langDirLTR, 'ltr' ],
106
+ [ lang.langDirRTL, 'rtl' ]
107
+ ],
108
+ setup : setupAdvParams,
109
+ commit : commitAdvParams
110
+ });
111
+ }
112
+
113
+ result.elements[ 0 ].children.push(
114
+ {
115
+ type : 'hbox',
116
+ widths : [ '50%', '50%' ],
117
+ children : [].concat( contents )
118
+ });
119
+ }
120
+
121
+ if ( tabConfig.styles || tabConfig.classes )
122
+ {
123
+ contents = [];
124
+
125
+ if ( tabConfig.styles )
126
+ {
127
+ contents.push(
128
+ {
129
+ id : 'advStyles',
130
+ att : 'style',
131
+ type : 'text',
132
+ label : lang.styles,
133
+ 'default' : '',
134
+
135
+ onChange : function(){},
136
+
137
+ getStyle : function( name, defaultValue )
138
+ {
139
+ var match = this.getValue().match( new RegExp( name + '\\s*:\\s*([^;]*)', 'i') );
140
+ return match ? match[ 1 ] : defaultValue;
141
+ },
142
+
143
+ updateStyle : function( name, value )
144
+ {
145
+ var styles = this.getValue();
146
+
147
+ // Remove the current value.
148
+ if ( styles )
149
+ {
150
+ styles = styles
151
+ .replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' )
152
+ .replace( /^[;\s]+/, '' )
153
+ .replace( /\s+$/, '' );
154
+ }
155
+
156
+ if ( value )
157
+ {
158
+ styles && !(/;\s*$/).test( styles ) && ( styles += '; ' );
159
+ styles += name + ': ' + value;
160
+ }
161
+
162
+ this.setValue( styles, 1 );
163
+
164
+ },
165
+
166
+ setup : setupAdvParams,
167
+
168
+ commit : commitAdvParams
169
+
170
+ });
171
+ }
172
+
173
+ if ( tabConfig.classes )
174
+ {
175
+ contents.push(
176
+ {
177
+ type : 'hbox',
178
+ widths : [ '45%', '55%' ],
179
+ children :
180
+ [
181
+ {
182
+ id : 'advCSSClasses',
183
+ att : 'class',
184
+ type : 'text',
185
+ label : lang.cssClasses,
186
+ 'default' : '',
187
+ setup : setupAdvParams,
188
+ commit : commitAdvParams
189
+
190
+ }
191
+ ]
192
+ });
193
+ }
194
+
195
+ result.elements[ 0 ].children.push(
196
+ {
197
+ type : 'hbox',
198
+ widths : [ '50%', '50%' ],
199
+ children : [].concat( contents )
200
+ });
201
+ }
202
+
203
+ return result;
204
+ }
205
+ });
206
+
207
+ })();
@@ -1,1541 +1,1541 @@
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
- /** @fileoverview The "dialogui" plugin. */
7
-
8
- CKEDITOR.plugins.add( 'dialogui' );
9
-
10
- (function()
11
- {
12
- var initPrivateObject = function( elementDefinition )
13
- {
14
- this._ || ( this._ = {} );
15
- this._['default'] = this._.initValue = elementDefinition['default'] || '';
16
- this._.required = elementDefinition[ 'required' ] || false;
17
- var args = [ this._ ];
18
- for ( var i = 1 ; i < arguments.length ; i++ )
19
- args.push( arguments[i] );
20
- args.push( true );
21
- CKEDITOR.tools.extend.apply( CKEDITOR.tools, args );
22
- return this._;
23
- },
24
- textBuilder =
25
- {
26
- build : function( dialog, elementDefinition, output )
27
- {
28
- return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output );
29
- }
30
- },
31
- commonBuilder =
32
- {
33
- build : function( dialog, elementDefinition, output )
34
- {
35
- return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output );
36
- }
37
- },
38
- containerBuilder =
39
- {
40
- build : function( dialog, elementDefinition, output )
41
- {
42
- var children = elementDefinition.children,
43
- child,
44
- childHtmlList = [],
45
- childObjList = [];
46
- for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
47
- {
48
- var childHtml = [];
49
- childHtmlList.push( childHtml );
50
- childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
51
- }
52
- return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition );
53
- }
54
- },
55
- commonPrototype =
56
- {
57
- isChanged : function()
58
- {
59
- return this.getValue() != this.getInitValue();
60
- },
61
-
62
- reset : function( noChangeEvent )
63
- {
64
- this.setValue( this.getInitValue(), noChangeEvent );
65
- },
66
-
67
- setInitValue : function()
68
- {
69
- this._.initValue = this.getValue();
70
- },
71
-
72
- resetInitValue : function()
73
- {
74
- this._.initValue = this._['default'];
75
- },
76
-
77
- getInitValue : function()
78
- {
79
- return this._.initValue;
80
- }
81
- },
82
- commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
83
- {
84
- onChange : function( dialog, func )
85
- {
86
- if ( !this._.domOnChangeRegistered )
87
- {
88
- dialog.on( 'load', function()
89
- {
90
- this.getInputElement().on( 'change', function()
91
- {
92
- // Make sure 'onchange' doesn't get fired after dialog closed. (#5719)
93
- if ( !dialog.parts.dialog.isVisible() )
94
- return;
95
-
96
- this.fire( 'change', { value : this.getValue() } );
97
- }, this );
98
- }, this );
99
- this._.domOnChangeRegistered = true;
100
- }
101
-
102
- this.on( 'change', func );
103
- }
104
- }, true ),
105
- eventRegex = /^on([A-Z]\w+)/,
106
- cleanInnerDefinition = function( def )
107
- {
108
- // An inner UI element should not have the parent's type, title or events.
109
- for ( var i in def )
110
- {
111
- if ( eventRegex.test( i ) || i == 'title' || i == 'type' )
112
- delete def[i];
113
- }
114
- return def;
115
- };
116
-
117
- CKEDITOR.tools.extend( CKEDITOR.ui.dialog,
118
- /** @lends CKEDITOR.ui.dialog */
119
- {
120
- /**
121
- * Base class for all dialog elements with a textual label on the left.
122
- * @constructor
123
- * @example
124
- * @extends CKEDITOR.ui.dialog.uiElement
125
- * @param {CKEDITOR.dialog} dialog
126
- * Parent dialog object.
127
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
128
- * The element definition. Accepted fields:
129
- * <ul>
130
- * <li><strong>label</strong> (Required) The label string.</li>
131
- * <li><strong>labelLayout</strong> (Optional) Put 'horizontal' here if the
132
- * label element is to be layed out horizontally. Otherwise a vertical
133
- * layout will be used.</li>
134
- * <li><strong>widths</strong> (Optional) This applies only for horizontal
135
- * layouts - an 2-element array of lengths to specify the widths of the
136
- * label and the content element.</li>
137
- * </ul>
138
- * @param {Array} htmlList
139
- * List of HTML code to output to.
140
- * @param {Function} contentHtml
141
- * A function returning the HTML code string to be added inside the content
142
- * cell.
143
- */
144
- labeledElement : function( dialog, elementDefinition, htmlList, contentHtml )
145
- {
146
- if ( arguments.length < 4 )
147
- return;
148
-
149
- var _ = initPrivateObject.call( this, elementDefinition );
150
- _.labelId = CKEDITOR.tools.getNextId() + '_label';
151
- var children = this._.children = [];
152
- /** @ignore */
153
- var innerHTML = function()
154
- {
155
- var html = [],
156
- requiredClass = elementDefinition.required ? ' cke_required' : '' ;
157
- if ( elementDefinition.labelLayout != 'horizontal' )
158
- html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ',
159
- ' id="'+ _.labelId + '"',
160
- ' for="' + _.inputId + '"',
161
- ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>',
162
- elementDefinition.label,
163
- '</label>',
164
- '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">',
165
- contentHtml.call( this, dialog, elementDefinition ),
166
- '</div>' );
167
- else
168
- {
169
- var hboxDefinition = {
170
- type : 'hbox',
171
- widths : elementDefinition.widths,
172
- padding : 0,
173
- children :
174
- [
175
- {
176
- type : 'html',
177
- html : '<label class="cke_dialog_ui_labeled_label' + requiredClass + '"' +
178
- ' id="' + _.labelId + '"' +
179
- ' for="' + _.inputId + '"' +
180
- ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>' +
181
- CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
182
- '</span>'
183
- },
184
- {
185
- type : 'html',
186
- html : '<span class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + '>' +
187
- contentHtml.call( this, dialog, elementDefinition ) +
188
- '</span>'
189
- }
190
- ]
191
- };
192
- CKEDITOR.dialog._.uiElementBuilders.hbox.build( dialog, hboxDefinition, html );
193
- }
194
- return html.join( '' );
195
- };
196
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
197
- },
198
-
199
- /**
200
- * A text input with a label. This UI element class represents both the
201
- * single-line text inputs and password inputs in dialog boxes.
202
- * @constructor
203
- * @example
204
- * @extends CKEDITOR.ui.dialog.labeledElement
205
- * @param {CKEDITOR.dialog} dialog
206
- * Parent dialog object.
207
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
208
- * The element definition. Accepted fields:
209
- * <ul>
210
- * <li><strong>default</strong> (Optional) The default value.</li>
211
- * <li><strong>validate</strong> (Optional) The validation function. </li>
212
- * <li><strong>maxLength</strong> (Optional) The maximum length of text box
213
- * contents.</li>
214
- * <li><strong>size</strong> (Optional) The size of the text box. This is
215
- * usually overridden by the size defined by the skin, however.</li>
216
- * </ul>
217
- * @param {Array} htmlList
218
- * List of HTML code to output to.
219
- */
220
- textInput : function( dialog, elementDefinition, htmlList )
221
- {
222
- if ( arguments.length < 3 )
223
- return;
224
-
225
- initPrivateObject.call( this, elementDefinition );
226
- var domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textInput',
227
- attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : 'text' },
228
- i;
229
-
230
- // Set the validator, if any.
231
- if ( elementDefinition.validate )
232
- this.validate = elementDefinition.validate;
233
-
234
- // Set the max length and size.
235
- if ( elementDefinition.maxLength )
236
- attributes.maxlength = elementDefinition.maxLength;
237
- if ( elementDefinition.size )
238
- attributes.size = elementDefinition.size;
239
-
240
- if ( elementDefinition.inputStyle )
241
- attributes.style = elementDefinition.inputStyle;
242
-
243
- // If user presses Enter in a text box, it implies clicking OK for the dialog.
244
- var me = this, keyPressedOnMe = false;
245
- dialog.on( 'load', function()
246
- {
247
- me.getInputElement().on( 'keydown', function( evt )
248
- {
249
- if ( evt.data.getKeystroke() == 13 )
250
- keyPressedOnMe = true;
251
- } );
252
-
253
- // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749)
254
- me.getInputElement().on( 'keyup', function( evt )
255
- {
256
- if ( evt.data.getKeystroke() == 13 && keyPressedOnMe )
257
- {
258
- dialog.getButton( 'ok' ) && setTimeout( function ()
259
- {
260
- dialog.getButton( 'ok' ).click();
261
- }, 0 );
262
- keyPressedOnMe = false;
263
- }
264
- }, null, null, 1000 );
265
- } );
266
-
267
- /** @ignore */
268
- var innerHTML = function()
269
- {
270
- // IE BUG: Text input fields in IE at 100% would exceed a <td> or inline
271
- // container's width, so need to wrap it inside a <div>.
272
- var html = [ '<div class="cke_dialog_ui_input_', elementDefinition.type, '" role="presentation"' ];
273
-
274
- if ( elementDefinition.width )
275
- html.push( 'style="width:'+ elementDefinition.width +'" ' );
276
-
277
- html.push( '><input ' );
278
-
279
- attributes[ 'aria-labelledby' ] = this._.labelId;
280
- this._.required && ( attributes[ 'aria-required' ] = this._.required );
281
- for ( var i in attributes )
282
- html.push( i + '="' + attributes[i] + '" ' );
283
- html.push( ' /></div>' );
284
- return html.join( '' );
285
- };
286
- CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
287
- },
288
-
289
- /**
290
- * A text area with a label on the top or left.
291
- * @constructor
292
- * @extends CKEDITOR.ui.dialog.labeledElement
293
- * @example
294
- * @param {CKEDITOR.dialog} dialog
295
- * Parent dialog object.
296
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
297
- * The element definition. Accepted fields:
298
- * <ul>
299
- * <li><strong>rows</strong> (Optional) The number of rows displayed.
300
- * Defaults to 5 if not defined.</li>
301
- * <li><strong>cols</strong> (Optional) The number of cols displayed.
302
- * Defaults to 20 if not defined. Usually overridden by skins.</li>
303
- * <li><strong>default</strong> (Optional) The default value.</li>
304
- * <li><strong>validate</strong> (Optional) The validation function. </li>
305
- * </ul>
306
- * @param {Array} htmlList
307
- * List of HTML code to output to.
308
- */
309
- textarea : function( dialog, elementDefinition, htmlList )
310
- {
311
- if ( arguments.length < 3 )
312
- return;
313
-
314
- initPrivateObject.call( this, elementDefinition );
315
- var me = this,
316
- domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textarea',
317
- attributes = {};
318
-
319
- if ( elementDefinition.validate )
320
- this.validate = elementDefinition.validate;
321
-
322
- // Generates the essential attributes for the textarea tag.
323
- attributes.rows = elementDefinition.rows || 5;
324
- attributes.cols = elementDefinition.cols || 20;
325
-
326
- if ( typeof elementDefinition.inputStyle != 'undefined' )
327
- attributes.style = elementDefinition.inputStyle;
328
-
329
-
330
- /** @ignore */
331
- var innerHTML = function()
332
- {
333
- attributes[ 'aria-labelledby' ] = this._.labelId;
334
- this._.required && ( attributes[ 'aria-required' ] = this._.required );
335
- var html = [ '<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="', domId, '" ' ];
336
- for ( var i in attributes )
337
- html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ' );
338
- html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '</textarea></div>' );
339
- return html.join( '' );
340
- };
341
- CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
342
- },
343
-
344
- /**
345
- * A single checkbox with a label on the right.
346
- * @constructor
347
- * @extends CKEDITOR.ui.dialog.uiElement
348
- * @example
349
- * @param {CKEDITOR.dialog} dialog
350
- * Parent dialog object.
351
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
352
- * The element definition. Accepted fields:
353
- * <ul>
354
- * <li><strong>checked</strong> (Optional) Whether the checkbox is checked
355
- * on instantiation. Defaults to false.</li>
356
- * <li><strong>validate</strong> (Optional) The validation function.</li>
357
- * <li><strong>label</strong> (Optional) The checkbox label.</li>
358
- * </ul>
359
- * @param {Array} htmlList
360
- * List of HTML code to output to.
361
- */
362
- checkbox : function( dialog, elementDefinition, htmlList )
363
- {
364
- if ( arguments.length < 3 )
365
- return;
366
-
367
- var _ = initPrivateObject.call( this, elementDefinition, { 'default' : !!elementDefinition[ 'default' ] } );
368
-
369
- if ( elementDefinition.validate )
370
- this.validate = elementDefinition.validate;
371
-
372
- /** @ignore */
373
- var innerHTML = function()
374
- {
375
- var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
376
- {
377
- id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox'
378
- }, true ),
379
- html = [];
380
-
381
- var labelId = CKEDITOR.tools.getNextId() + '_label';
382
- var attributes = { 'class' : 'cke_dialog_ui_checkbox_input', type : 'checkbox', 'aria-labelledby' : labelId };
383
- cleanInnerDefinition( myDefinition );
384
- if ( elementDefinition[ 'default' ] )
385
- attributes.checked = 'checked';
386
-
387
- if ( typeof myDefinition.inputStyle != 'undefined' )
388
- myDefinition.style = myDefinition.inputStyle;
389
-
390
- _.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes );
391
- html.push( ' <label id="', labelId, '" for="', attributes.id, '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>',
392
- CKEDITOR.tools.htmlEncode( elementDefinition.label ),
393
- '</label>' );
394
- return html.join( '' );
395
- };
396
-
397
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'span', null, null, innerHTML );
398
- },
399
-
400
- /**
401
- * A group of radio buttons.
402
- * @constructor
403
- * @example
404
- * @extends CKEDITOR.ui.dialog.labeledElement
405
- * @param {CKEDITOR.dialog} dialog
406
- * Parent dialog object.
407
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
408
- * The element definition. Accepted fields:
409
- * <ul>
410
- * <li><strong>default</strong> (Required) The default value.</li>
411
- * <li><strong>validate</strong> (Optional) The validation function.</li>
412
- * <li><strong>items</strong> (Required) An array of options. Each option
413
- * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value'
414
- * is missing, then the value would be assumed to be the same as the
415
- * description.</li>
416
- * </ul>
417
- * @param {Array} htmlList
418
- * List of HTML code to output to.
419
- */
420
- radio : function( dialog, elementDefinition, htmlList )
421
- {
422
- if ( arguments.length < 3)
423
- return;
424
-
425
- initPrivateObject.call( this, elementDefinition );
426
- if ( !this._['default'] )
427
- this._['default'] = this._.initValue = elementDefinition.items[0][1];
428
- if ( elementDefinition.validate )
429
- this.validate = elementDefinition.valdiate;
430
- var children = [], me = this;
431
-
432
- /** @ignore */
433
- var innerHTML = function()
434
- {
435
- var inputHtmlList = [], html = [],
436
- commonAttributes = { 'class' : 'cke_dialog_ui_radio_item', 'aria-labelledby' : this._.labelId },
437
- commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio';
438
- for ( var i = 0 ; i < elementDefinition.items.length ; i++ )
439
- {
440
- var item = elementDefinition.items[i],
441
- title = item[2] !== undefined ? item[2] : item[0],
442
- value = item[1] !== undefined ? item[1] : item[0],
443
- inputId = CKEDITOR.tools.getNextId() + '_radio_input',
444
- labelId = inputId + '_label',
445
- inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
446
- {
447
- id : inputId,
448
- title : null,
449
- type : null
450
- }, true ),
451
- labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition,
452
- {
453
- title : title
454
- }, true ),
455
- inputAttributes =
456
- {
457
- type : 'radio',
458
- 'class' : 'cke_dialog_ui_radio_input',
459
- name : commonName,
460
- value : value,
461
- 'aria-labelledby' : labelId
462
- },
463
- inputHtml = [];
464
- if ( me._['default'] == value )
465
- inputAttributes.checked = 'checked';
466
- cleanInnerDefinition( inputDefinition );
467
- cleanInnerDefinition( labelDefinition );
468
-
469
- if ( typeof inputDefinition.inputStyle != 'undefined' )
470
- inputDefinition.style = inputDefinition.inputStyle;
471
-
472
- children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
473
- inputHtml.push( ' ' );
474
- new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id : labelId, 'for' : inputAttributes.id },
475
- item[0] );
476
- inputHtmlList.push( inputHtml.join( '' ) );
477
- }
478
- new CKEDITOR.ui.dialog.hbox( dialog, [], inputHtmlList, html );
479
- return html.join( '' );
480
- };
481
-
482
- CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
483
- this._.children = children;
484
- },
485
-
486
- /**
487
- * A button with a label inside.
488
- * @constructor
489
- * @example
490
- * @extends CKEDITOR.ui.dialog.uiElement
491
- * @param {CKEDITOR.dialog} dialog
492
- * Parent dialog object.
493
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
494
- * The element definition. Accepted fields:
495
- * <ul>
496
- * <li><strong>label</strong> (Required) The button label.</li>
497
- * <li><strong>disabled</strong> (Optional) Set to true if you want the
498
- * button to appear in disabled state.</li>
499
- * </ul>
500
- * @param {Array} htmlList
501
- * List of HTML code to output to.
502
- */
503
- button : function( dialog, elementDefinition, htmlList )
504
- {
505
- if ( !arguments.length )
506
- return;
507
-
508
- if ( typeof elementDefinition == 'function' )
509
- elementDefinition = elementDefinition( dialog.getParentEditor() );
510
-
511
- initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } );
512
-
513
- // Add OnClick event to this input.
514
- CKEDITOR.event.implementOn( this );
515
-
516
- var me = this;
517
-
518
- // Register an event handler for processing button clicks.
519
- dialog.on( 'load', function( eventInfo )
520
- {
521
- var element = this.getElement();
522
-
523
- (function()
524
- {
525
- element.on( 'click', function( evt )
526
- {
527
- me.fire( 'click', { dialog : me.getDialog() } );
528
- evt.data.preventDefault();
529
- } );
530
-
531
- element.on( 'keydown', function( evt )
532
- {
533
- if ( evt.data.getKeystroke() in { 32:1 } )
534
- {
535
- me.click();
536
- evt.data.preventDefault();
537
- }
538
- } );
539
- })();
540
-
541
- element.unselectable();
542
- }, this );
543
-
544
- var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
545
- delete outerDefinition.style;
546
-
547
- var labelId = CKEDITOR.tools.getNextId() + '_label';
548
- CKEDITOR.ui.dialog.uiElement.call(
549
- this,
550
- dialog,
551
- outerDefinition,
552
- htmlList,
553
- 'a',
554
- null,
555
- {
556
- style : elementDefinition.style,
557
- href : 'javascript:void(0)',
558
- title : elementDefinition.label,
559
- hidefocus : 'true',
560
- 'class' : elementDefinition['class'],
561
- role : 'button',
562
- 'aria-labelledby' : labelId
563
- },
564
- '<span id="' + labelId + '" class="cke_dialog_ui_button">' +
565
- CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
566
- '</span>' );
567
- },
568
-
569
- /**
570
- * A select box.
571
- * @extends CKEDITOR.ui.dialog.uiElement
572
- * @example
573
- * @constructor
574
- * @param {CKEDITOR.dialog} dialog
575
- * Parent dialog object.
576
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
577
- * The element definition. Accepted fields:
578
- * <ul>
579
- * <li><strong>default</strong> (Required) The default value.</li>
580
- * <li><strong>validate</strong> (Optional) The validation function.</li>
581
- * <li><strong>items</strong> (Required) An array of options. Each option
582
- * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value'
583
- * is missing, then the value would be assumed to be the same as the
584
- * description.</li>
585
- * <li><strong>multiple</strong> (Optional) Set this to true if you'd like
586
- * to have a multiple-choice select box.</li>
587
- * <li><strong>size</strong> (Optional) The number of items to display in
588
- * the select box.</li>
589
- * </ul>
590
- * @param {Array} htmlList
591
- * List of HTML code to output to.
592
- */
593
- select : function( dialog, elementDefinition, htmlList )
594
- {
595
- if ( arguments.length < 3 )
596
- return;
597
-
598
- var _ = initPrivateObject.call( this, elementDefinition );
599
-
600
- if ( elementDefinition.validate )
601
- this.validate = elementDefinition.validate;
602
-
603
- _.inputId = CKEDITOR.tools.getNextId() + '_select';
604
- /** @ignore */
605
- var innerHTML = function()
606
- {
607
- var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
608
- {
609
- id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select'
610
- }, true ),
611
- html = [],
612
- innerHTML = [],
613
- attributes = { 'id' : _.inputId, 'class' : 'cke_dialog_ui_input_select', 'aria-labelledby' : this._.labelId };
614
-
615
- // Add multiple and size attributes from element definition.
616
- if ( elementDefinition.size != undefined )
617
- attributes.size = elementDefinition.size;
618
- if ( elementDefinition.multiple != undefined )
619
- attributes.multiple = elementDefinition.multiple;
620
-
621
- cleanInnerDefinition( myDefinition );
622
- for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ )
623
- {
624
- innerHTML.push( '<option value="',
625
- CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ).replace( /"/g, '&quot;' ), '" /> ',
626
- CKEDITOR.tools.htmlEncode( item[0] ) );
627
- }
628
-
629
- if ( typeof myDefinition.inputStyle != 'undefined' )
630
- myDefinition.style = myDefinition.inputStyle;
631
-
632
- _.select = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'select', null, attributes, innerHTML.join( '' ) );
633
- return html.join( '' );
634
- };
635
-
636
- CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
637
- },
638
-
639
- /**
640
- * A file upload input.
641
- * @extends CKEDITOR.ui.dialog.labeledElement
642
- * @example
643
- * @constructor
644
- * @param {CKEDITOR.dialog} dialog
645
- * Parent dialog object.
646
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
647
- * The element definition. Accepted fields:
648
- * <ul>
649
- * <li><strong>validate</strong> (Optional) The validation function.</li>
650
- * </ul>
651
- * @param {Array} htmlList
652
- * List of HTML code to output to.
653
- */
654
- file : function( dialog, elementDefinition, htmlList )
655
- {
656
- if ( arguments.length < 3 )
657
- return;
658
-
659
- if ( elementDefinition['default'] === undefined )
660
- elementDefinition['default'] = '';
661
-
662
- var _ = CKEDITOR.tools.extend( initPrivateObject.call( this, elementDefinition ), { definition : elementDefinition, buttons : [] } );
663
-
664
- if ( elementDefinition.validate )
665
- this.validate = elementDefinition.validate;
666
-
667
- /** @ignore */
668
- var innerHTML = function()
669
- {
670
- _.frameId = CKEDITOR.tools.getNextId() + '_fileInput';
671
-
672
- // Support for custom document.domain in IE.
673
- var isCustomDomain = CKEDITOR.env.isCustomDomain();
674
-
675
- var html = [
676
- '<iframe' +
677
- ' frameborder="0"' +
678
- ' allowtransparency="0"' +
679
- ' class="cke_dialog_ui_input_file"' +
680
- ' id="', _.frameId, '"' +
681
- ' title="', elementDefinition.label, '"' +
682
- ' src="javascript:void(' ];
683
-
684
- html.push(
685
- isCustomDomain ?
686
- '(function(){' +
687
- 'document.open();' +
688
- 'document.domain=\'' + document.domain + '\';' +
689
- 'document.close();' +
690
- '})()'
691
- :
692
- '0' );
693
-
694
- html.push(
695
- ')">' +
696
- '</iframe>' );
697
-
698
- return html.join( '' );
699
- };
700
-
701
- // IE BUG: Parent container does not resize to contain the iframe automatically.
702
- dialog.on( 'load', function()
703
- {
704
- var iframe = CKEDITOR.document.getById( _.frameId ),
705
- contentDiv = iframe.getParent();
706
- contentDiv.addClass( 'cke_dialog_ui_input_file' );
707
- } );
708
-
709
- CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
710
- },
711
-
712
- /**
713
- * A button for submitting the file in a file upload input.
714
- * @extends CKEDITOR.ui.dialog.button
715
- * @example
716
- * @constructor
717
- * @param {CKEDITOR.dialog} dialog
718
- * Parent dialog object.
719
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
720
- * The element definition. Accepted fields:
721
- * <ul>
722
- * <li><strong>for</strong> (Required) The file input's page and element Id
723
- * to associate to, in a 2-item array format: [ 'page_id', 'element_id' ].
724
- * </li>
725
- * <li><strong>validate</strong> (Optional) The validation function.</li>
726
- * </ul>
727
- * @param {Array} htmlList
728
- * List of HTML code to output to.
729
- */
730
- fileButton : function( dialog, elementDefinition, htmlList )
731
- {
732
- if ( arguments.length < 3 )
733
- return;
734
-
735
- var _ = initPrivateObject.call( this, elementDefinition ),
736
- me = this;
737
-
738
- if ( elementDefinition.validate )
739
- this.validate = elementDefinition.validate;
740
-
741
- var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
742
- var onClick = myDefinition.onClick;
743
- myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button';
744
- myDefinition.onClick = function( evt )
745
- {
746
- var target = elementDefinition[ 'for' ]; // [ pageId, elementId ]
747
- if ( !onClick || onClick.call( this, evt ) !== false )
748
- {
749
- dialog.getContentElement( target[0], target[1] ).submit();
750
- this.disable();
751
- }
752
- };
753
-
754
- dialog.on( 'load', function()
755
- {
756
- dialog.getContentElement( elementDefinition[ 'for' ][0], elementDefinition[ 'for' ][1] )._.buttons.push( me );
757
- } );
758
-
759
- CKEDITOR.ui.dialog.button.call( this, dialog, myDefinition, htmlList );
760
- },
761
-
762
- html : (function()
763
- {
764
- var myHtmlRe = /^\s*<[\w:]+\s+([^>]*)?>/,
765
- theirHtmlRe = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,
766
- emptyTagRe = /\/$/;
767
- /**
768
- * A dialog element made from raw HTML code.
769
- * @extends CKEDITOR.ui.dialog.uiElement
770
- * @name CKEDITOR.ui.dialog.html
771
- * @param {CKEDITOR.dialog} dialog Parent dialog object.
772
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element definition.
773
- * Accepted fields:
774
- * <ul>
775
- * <li><strong>html</strong> (Required) HTML code of this element.</li>
776
- * </ul>
777
- * @param {Array} htmlList List of HTML code to be added to the dialog's content area.
778
- * @example
779
- * @constructor
780
- */
781
- return function( dialog, elementDefinition, htmlList )
782
- {
783
- if ( arguments.length < 3 )
784
- return;
785
-
786
- var myHtmlList = [],
787
- myHtml,
788
- theirHtml = elementDefinition.html,
789
- myMatch, theirMatch;
790
-
791
- // If the HTML input doesn't contain any tags at the beginning, add a <span> tag around it.
792
- if ( theirHtml.charAt( 0 ) != '<' )
793
- theirHtml = '<span>' + theirHtml + '</span>';
794
-
795
- // Look for focus function in definition.
796
- var focus = elementDefinition.focus;
797
- if ( focus )
798
- {
799
- var oldFocus = this.focus;
800
- this.focus = function()
801
- {
802
- oldFocus.call( this );
803
- typeof focus == 'function' && focus.call( this );
804
- this.fire( 'focus' );
805
- };
806
- if ( elementDefinition.isFocusable )
807
- {
808
- var oldIsFocusable = this.isFocusable;
809
- this.isFocusable = oldIsFocusable;
810
- }
811
- this.keyboardFocusable = true;
812
- }
813
-
814
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, myHtmlList, 'span', null, null, '' );
815
-
816
- // Append the attributes created by the uiElement call to the real HTML.
817
- myHtml = myHtmlList.join( '' );
818
- myMatch = myHtml.match( myHtmlRe );
819
- theirMatch = theirHtml.match( theirHtmlRe ) || [ '', '', '' ];
820
-
821
- if ( emptyTagRe.test( theirMatch[1] ) )
822
- {
823
- theirMatch[1] = theirMatch[1].slice( 0, -1 );
824
- theirMatch[2] = '/' + theirMatch[2];
825
- }
826
-
827
- htmlList.push( [ theirMatch[1], ' ', myMatch[1] || '', theirMatch[2] ].join( '' ) );
828
- };
829
- })(),
830
-
831
- /**
832
- * Form fieldset for grouping dialog UI elements.
833
- * @constructor
834
- * @extends CKEDITOR.ui.dialog.uiElement
835
- * @param {CKEDITOR.dialog} dialog Parent dialog object.
836
- * @param {Array} childObjList
837
- * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
838
- * container.
839
- * @param {Array} childHtmlList
840
- * Array of HTML code that correspond to the HTML output of all the
841
- * objects in childObjList.
842
- * @param {Array} htmlList
843
- * Array of HTML code that this element will output to.
844
- * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
845
- * The element definition. Accepted fields:
846
- * <ul>
847
- * <li><strong>label</strong> (Optional) The legend of the this fieldset.</li>
848
- * <li><strong>children</strong> (Required) An array of dialog field definitions which will be grouped inside this fieldset. </li>
849
- * </ul>
850
- */
851
- fieldset : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
852
- {
853
- var legendLabel = elementDefinition.label;
854
- /** @ignore */
855
- var innerHTML = function()
856
- {
857
- var html = [];
858
- legendLabel && html.push( '<legend>' + legendLabel + '</legend>' );
859
- for ( var i = 0; i < childHtmlList.length; i++ )
860
- html.push( childHtmlList[ i ] );
861
- return html.join( '' );
862
- };
863
-
864
- this._ = { children : childObjList };
865
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'fieldset', null, null, innerHTML );
866
- }
867
-
868
- }, true );
869
-
870
- CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement;
871
-
872
- CKEDITOR.ui.dialog.labeledElement.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
873
- /** @lends CKEDITOR.ui.dialog.labeledElement.prototype */
874
- {
875
- /**
876
- * Sets the label text of the element.
877
- * @param {String} label The new label text.
878
- * @returns {CKEDITOR.ui.dialog.labeledElement} The current labeled element.
879
- * @example
880
- */
881
- setLabel : function( label )
882
- {
883
- var node = CKEDITOR.document.getById( this._.labelId );
884
- if ( node.getChildCount() < 1 )
885
- ( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node );
886
- else
887
- node.getChild( 0 ).$.nodeValue = label;
888
- return this;
889
- },
890
-
891
- /**
892
- * Retrieves the current label text of the elment.
893
- * @returns {String} The current label text.
894
- * @example
895
- */
896
- getLabel : function()
897
- {
898
- var node = CKEDITOR.document.getById( this._.labelId );
899
- if ( !node || node.getChildCount() < 1 )
900
- return '';
901
- else
902
- return node.getChild( 0 ).getText();
903
- },
904
-
905
- /**
906
- * Defines the onChange event for UI element definitions.
907
- * @field
908
- * @type Object
909
- * @example
910
- */
911
- eventProcessors : commonEventProcessors
912
- }, true );
913
-
914
- CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
915
- /** @lends CKEDITOR.ui.dialog.button.prototype */
916
- {
917
- /**
918
- * Simulates a click to the button.
919
- * @example
920
- * @returns {Object} Return value of the 'click' event.
921
- */
922
- click : function()
923
- {
924
- if ( !this._.disabled )
925
- return this.fire( 'click', { dialog : this._.dialog } );
926
- this.getElement().$.blur();
927
- return false;
928
- },
929
-
930
- /**
931
- * Enables the button.
932
- * @example
933
- */
934
- enable : function()
935
- {
936
- this._.disabled = false;
937
- var element = this.getElement();
938
- element && element.removeClass( 'cke_disabled' );
939
- },
940
-
941
- /**
942
- * Disables the button.
943
- * @example
944
- */
945
- disable : function()
946
- {
947
- this._.disabled = true;
948
- this.getElement().addClass( 'cke_disabled' );
949
- },
950
-
951
- isVisible : function()
952
- {
953
- return this.getElement().getFirst().isVisible();
954
- },
955
-
956
- isEnabled : function()
957
- {
958
- return !this._.disabled;
959
- },
960
-
961
- /**
962
- * Defines the onChange event and onClick for button element definitions.
963
- * @field
964
- * @type Object
965
- * @example
966
- */
967
- eventProcessors : CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
968
- {
969
- /** @ignore */
970
- onClick : function( dialog, func )
971
- {
972
- this.on( 'click', func );
973
- }
974
- }, true ),
975
-
976
- /**
977
- * Handler for the element's access key up event. Simulates a click to
978
- * the button.
979
- * @example
980
- */
981
- accessKeyUp : function()
982
- {
983
- this.click();
984
- },
985
-
986
- /**
987
- * Handler for the element's access key down event. Simulates a mouse
988
- * down to the button.
989
- * @example
990
- */
991
- accessKeyDown : function()
992
- {
993
- this.focus();
994
- },
995
-
996
- keyboardFocusable : true
997
- }, true );
998
-
999
- CKEDITOR.ui.dialog.textInput.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1000
- /** @lends CKEDITOR.ui.dialog.textInput.prototype */
1001
- {
1002
- /**
1003
- * Gets the text input DOM element under this UI object.
1004
- * @example
1005
- * @returns {CKEDITOR.dom.element} The DOM element of the text input.
1006
- */
1007
- getInputElement : function()
1008
- {
1009
- return CKEDITOR.document.getById( this._.inputId );
1010
- },
1011
-
1012
- /**
1013
- * Puts focus into the text input.
1014
- * @example
1015
- */
1016
- focus : function()
1017
- {
1018
- var me = this.selectParentTab();
1019
-
1020
- // GECKO BUG: setTimeout() is needed to workaround invisible selections.
1021
- setTimeout( function()
1022
- {
1023
- var element = me.getInputElement();
1024
- element && element.$.focus();
1025
- }, 0 );
1026
- },
1027
-
1028
- /**
1029
- * Selects all the text in the text input.
1030
- * @example
1031
- */
1032
- select : function()
1033
- {
1034
- var me = this.selectParentTab();
1035
-
1036
- // GECKO BUG: setTimeout() is needed to workaround invisible selections.
1037
- setTimeout( function()
1038
- {
1039
- var e = me.getInputElement();
1040
- if ( e )
1041
- {
1042
- e.$.focus();
1043
- e.$.select();
1044
- }
1045
- }, 0 );
1046
- },
1047
-
1048
- /**
1049
- * Handler for the text input's access key up event. Makes a select()
1050
- * call to the text input.
1051
- * @example
1052
- */
1053
- accessKeyUp : function()
1054
- {
1055
- this.select();
1056
- },
1057
-
1058
- /**
1059
- * Sets the value of this text input object.
1060
- * @param {Object} value The new value.
1061
- * @returns {CKEDITOR.ui.dialog.textInput} The current UI element.
1062
- * @example
1063
- * uiElement.setValue( 'Blamo' );
1064
- */
1065
- setValue : function( value )
1066
- {
1067
- !value && ( value = '' );
1068
- return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply( this, arguments );
1069
- },
1070
-
1071
- keyboardFocusable : true
1072
- }, commonPrototype, true );
1073
-
1074
- CKEDITOR.ui.dialog.textarea.prototype = new CKEDITOR.ui.dialog.textInput();
1075
-
1076
- CKEDITOR.ui.dialog.select.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1077
- /** @lends CKEDITOR.ui.dialog.select.prototype */
1078
- {
1079
- /**
1080
- * Gets the DOM element of the select box.
1081
- * @returns {CKEDITOR.dom.element} The &lt;select&gt; element of this UI
1082
- * element.
1083
- * @example
1084
- */
1085
- getInputElement : function()
1086
- {
1087
- return this._.select.getElement();
1088
- },
1089
-
1090
- /**
1091
- * Adds an option to the select box.
1092
- * @param {String} label Option label.
1093
- * @param {String} value (Optional) Option value, if not defined it'll be
1094
- * assumed to be the same as the label.
1095
- * @param {Number} index (Optional) Position of the option to be inserted
1096
- * to. If not defined the new option will be inserted to the end of list.
1097
- * @example
1098
- * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1099
- */
1100
- add : function( label, value, index )
1101
- {
1102
- var option = new CKEDITOR.dom.element( 'option', this.getDialog().getParentEditor().document ),
1103
- selectElement = this.getInputElement().$;
1104
- option.$.text = label;
1105
- option.$.value = ( value === undefined || value === null ) ? label : value;
1106
- if ( index === undefined || index === null )
1107
- {
1108
- if ( CKEDITOR.env.ie )
1109
- selectElement.add( option.$ );
1110
- else
1111
- selectElement.add( option.$, null );
1112
- }
1113
- else
1114
- selectElement.add( option.$, index );
1115
- return this;
1116
- },
1117
-
1118
- /**
1119
- * Removes an option from the selection list.
1120
- * @param {Number} index Index of the option to be removed.
1121
- * @example
1122
- * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1123
- */
1124
- remove : function( index )
1125
- {
1126
- var selectElement = this.getInputElement().$;
1127
- selectElement.remove( index );
1128
- return this;
1129
- },
1130
-
1131
- /**
1132
- * Clears all options out of the selection list.
1133
- * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1134
- */
1135
- clear : function()
1136
- {
1137
- var selectElement = this.getInputElement().$;
1138
- while ( selectElement.length > 0 )
1139
- selectElement.remove( 0 );
1140
- return this;
1141
- },
1142
-
1143
- keyboardFocusable : true
1144
- }, commonPrototype, true );
1145
-
1146
- CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
1147
- /** @lends CKEDITOR.ui.dialog.checkbox.prototype */
1148
- {
1149
- /**
1150
- * Gets the checkbox DOM element.
1151
- * @example
1152
- * @returns {CKEDITOR.dom.element} The DOM element of the checkbox.
1153
- */
1154
- getInputElement : function()
1155
- {
1156
- return this._.checkbox.getElement();
1157
- },
1158
-
1159
- /**
1160
- * Sets the state of the checkbox.
1161
- * @example
1162
- * @param {Boolean} true to tick the checkbox, false to untick it.
1163
- * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
1164
- */
1165
- setValue : function( checked, noChangeEvent )
1166
- {
1167
- this.getInputElement().$.checked = checked;
1168
- !noChangeEvent && this.fire( 'change', { value : checked } );
1169
- },
1170
-
1171
- /**
1172
- * Gets the state of the checkbox.
1173
- * @example
1174
- * @returns {Boolean} true means the checkbox is ticked, false means it's not ticked.
1175
- */
1176
- getValue : function()
1177
- {
1178
- return this.getInputElement().$.checked;
1179
- },
1180
-
1181
- /**
1182
- * Handler for the access key up event. Toggles the checkbox.
1183
- * @example
1184
- */
1185
- accessKeyUp : function()
1186
- {
1187
- this.setValue( !this.getValue() );
1188
- },
1189
-
1190
- /**
1191
- * Defines the onChange event for UI element definitions.
1192
- * @field
1193
- * @type Object
1194
- * @example
1195
- */
1196
- eventProcessors :
1197
- {
1198
- onChange : function( dialog, func )
1199
- {
1200
- if ( !CKEDITOR.env.ie )
1201
- return commonEventProcessors.onChange.apply( this, arguments );
1202
- else
1203
- {
1204
- dialog.on( 'load', function()
1205
- {
1206
- var element = this._.checkbox.getElement();
1207
- element.on( 'propertychange', function( evt )
1208
- {
1209
- evt = evt.data.$;
1210
- if ( evt.propertyName == 'checked' )
1211
- this.fire( 'change', { value : element.$.checked } );
1212
- }, this );
1213
- }, this );
1214
- this.on( 'change', func );
1215
- }
1216
- return null;
1217
- }
1218
- },
1219
-
1220
- keyboardFocusable : true
1221
- }, commonPrototype, true );
1222
-
1223
- CKEDITOR.ui.dialog.radio.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
1224
- /** @lends CKEDITOR.ui.dialog.radio.prototype */
1225
- {
1226
- /**
1227
- * Checks one of the radio buttons in this button group.
1228
- * @example
1229
- * @param {String} value The value of the button to be chcked.
1230
- * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
1231
- */
1232
- setValue : function( value, noChangeEvent )
1233
- {
1234
- var children = this._.children,
1235
- item;
1236
- for ( var i = 0 ; ( i < children.length ) && ( item = children[i] ) ; i++ )
1237
- item.getElement().$.checked = ( item.getValue() == value );
1238
- !noChangeEvent && this.fire( 'change', { value : value } );
1239
- },
1240
-
1241
- /**
1242
- * Gets the value of the currently checked radio button.
1243
- * @example
1244
- * @returns {String} The currently checked button's value.
1245
- */
1246
- getValue : function()
1247
- {
1248
- var children = this._.children;
1249
- for ( var i = 0 ; i < children.length ; i++ )
1250
- {
1251
- if ( children[i].getElement().$.checked )
1252
- return children[i].getValue();
1253
- }
1254
- return null;
1255
- },
1256
-
1257
- /**
1258
- * Handler for the access key up event. Focuses the currently
1259
- * selected radio button, or the first radio button if none is
1260
- * selected.
1261
- * @example
1262
- */
1263
- accessKeyUp : function()
1264
- {
1265
- var children = this._.children, i;
1266
- for ( i = 0 ; i < children.length ; i++ )
1267
- {
1268
- if ( children[i].getElement().$.checked )
1269
- {
1270
- children[i].getElement().focus();
1271
- return;
1272
- }
1273
- }
1274
- children[0].getElement().focus();
1275
- },
1276
-
1277
- /**
1278
- * Defines the onChange event for UI element definitions.
1279
- * @field
1280
- * @type Object
1281
- * @example
1282
- */
1283
- eventProcessors :
1284
- {
1285
- onChange : function( dialog, func )
1286
- {
1287
- if ( !CKEDITOR.env.ie )
1288
- return commonEventProcessors.onChange.apply( this, arguments );
1289
- else
1290
- {
1291
- dialog.on( 'load', function()
1292
- {
1293
- var children = this._.children, me = this;
1294
- for ( var i = 0 ; i < children.length ; i++ )
1295
- {
1296
- var element = children[i].getElement();
1297
- element.on( 'propertychange', function( evt )
1298
- {
1299
- evt = evt.data.$;
1300
- if ( evt.propertyName == 'checked' && this.$.checked )
1301
- me.fire( 'change', { value : this.getAttribute( 'value' ) } );
1302
- } );
1303
- }
1304
- }, this );
1305
- this.on( 'change', func );
1306
- }
1307
- return null;
1308
- }
1309
- },
1310
-
1311
- keyboardFocusable : true
1312
- }, commonPrototype, true );
1313
-
1314
- CKEDITOR.ui.dialog.file.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1315
- commonPrototype,
1316
- /** @lends CKEDITOR.ui.dialog.file.prototype */
1317
- {
1318
- /**
1319
- * Gets the &lt;input&gt; element of this file input.
1320
- * @returns {CKEDITOR.dom.element} The file input element.
1321
- * @example
1322
- */
1323
- getInputElement : function()
1324
- {
1325
- var frameDocument = CKEDITOR.document.getById( this._.frameId ).getFrameDocument();
1326
- return frameDocument.$.forms.length > 0 ?
1327
- new CKEDITOR.dom.element( frameDocument.$.forms[0].elements[0] ) :
1328
- this.getElement();
1329
- },
1330
-
1331
- /**
1332
- * Uploads the file in the file input.
1333
- * @returns {CKEDITOR.ui.dialog.file} This object.
1334
- * @example
1335
- */
1336
- submit : function()
1337
- {
1338
- this.getInputElement().getParent().$.submit();
1339
- return this;
1340
- },
1341
-
1342
- /**
1343
- * Get the action assigned to the form.
1344
- * @returns {String} The value of the action.
1345
- * @example
1346
- */
1347
- getAction : function()
1348
- {
1349
- return this.getInputElement().getParent().$.action;
1350
- },
1351
-
1352
- /**
1353
- * The events must be applied on the inner input element, and
1354
- * that must be done when the iframe & form has been loaded
1355
- */
1356
- registerEvents : function( definition )
1357
- {
1358
- var regex = /^on([A-Z]\w+)/,
1359
- match;
1360
-
1361
- var registerDomEvent = function( uiElement, dialog, eventName, func )
1362
- {
1363
- uiElement.on( 'formLoaded', function()
1364
- {
1365
- uiElement.getInputElement().on( eventName, func, uiElement );
1366
- });
1367
- };
1368
-
1369
- for ( var i in definition )
1370
- {
1371
- if ( !( match = i.match( regex ) ) )
1372
- continue;
1373
-
1374
- if ( this.eventProcessors[i] )
1375
- this.eventProcessors[i].call( this, this._.dialog, definition[i] );
1376
- else
1377
- registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
1378
- }
1379
-
1380
- return this;
1381
- },
1382
-
1383
- /**
1384
- * Redraws the file input and resets the file path in the file input.
1385
- * The redraw logic is necessary because non-IE browsers tend to clear
1386
- * the &lt;iframe&gt; containing the file input after closing the dialog.
1387
- * @example
1388
- */
1389
- reset : function()
1390
- {
1391
- var _ = this._,
1392
- frameElement = CKEDITOR.document.getById( _.frameId ),
1393
- frameDocument = frameElement.getFrameDocument(),
1394
- elementDefinition = _.definition,
1395
- buttons = _.buttons,
1396
- callNumber = this.formLoadedNumber,
1397
- unloadNumber = this.formUnloadNumber,
1398
- langDir = _.dialog._.editor.lang.dir,
1399
- langCode = _.dialog._.editor.langCode;
1400
-
1401
- // The callback function for the iframe, but we must call tools.addFunction only once
1402
- // so we store the function number in this.formLoadedNumber
1403
- if ( !callNumber )
1404
- {
1405
- callNumber = this.formLoadedNumber = CKEDITOR.tools.addFunction(
1406
- function()
1407
- {
1408
- // Now we can apply the events to the input type=file
1409
- this.fire( 'formLoaded' ) ;
1410
- }, this ) ;
1411
-
1412
- // Remove listeners attached to the content of the iframe (the file input)
1413
- unloadNumber = this.formUnloadNumber = CKEDITOR.tools.addFunction(
1414
- function()
1415
- {
1416
- this.getInputElement().clearCustomData();
1417
- }, this ) ;
1418
-
1419
- this.getDialog()._.editor.on( 'destroy', function()
1420
- {
1421
- CKEDITOR.tools.removeFunction( callNumber );
1422
- CKEDITOR.tools.removeFunction( unloadNumber );
1423
- } );
1424
- }
1425
-
1426
- function generateFormField()
1427
- {
1428
- frameDocument.$.open();
1429
-
1430
- // Support for custom document.domain in IE.
1431
- if ( CKEDITOR.env.isCustomDomain() )
1432
- frameDocument.$.domain = document.domain;
1433
-
1434
- var size = '';
1435
- if ( elementDefinition.size )
1436
- size = elementDefinition.size - ( CKEDITOR.env.ie ? 7 : 0 ); // "Browse" button is bigger in IE.
1437
-
1438
- frameDocument.$.write( [ '<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
1439
- '<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="',
1440
- CKEDITOR.tools.htmlEncode( elementDefinition.action ),
1441
- '">',
1442
- '<input type="file" name="',
1443
- CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ),
1444
- '" size="',
1445
- CKEDITOR.tools.htmlEncode( size > 0 ? size : "" ),
1446
- '" />',
1447
- '</form>',
1448
- '</body></html>',
1449
- '<script>window.parent.CKEDITOR.tools.callFunction(' + callNumber + ');',
1450
- 'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}</script>' ].join( '' ) );
1451
-
1452
- frameDocument.$.close();
1453
-
1454
- for ( var i = 0 ; i < buttons.length ; i++ )
1455
- buttons[i].enable();
1456
- }
1457
-
1458
- // #3465: Wait for the browser to finish rendering the dialog first.
1459
- if ( CKEDITOR.env.gecko )
1460
- setTimeout( generateFormField, 500 );
1461
- else
1462
- generateFormField();
1463
- },
1464
-
1465
- getValue : function()
1466
- {
1467
- return this.getInputElement().$.value || '';
1468
- },
1469
-
1470
- /***
1471
- * The default value of input type="file" is an empty string, but during initialization
1472
- * of this UI element, the iframe still isn't ready so it can't be read from that object
1473
- * Setting it manually prevents later issues about the current value ("") being different
1474
- * of the initial value (undefined as it asked for .value of a div)
1475
- */
1476
- setInitValue : function()
1477
- {
1478
- this._.initValue = '';
1479
- },
1480
-
1481
- /**
1482
- * Defines the onChange event for UI element definitions.
1483
- * @field
1484
- * @type Object
1485
- * @example
1486
- */
1487
- eventProcessors :
1488
- {
1489
- onChange : function( dialog, func )
1490
- {
1491
- // If this method is called several times (I'm not sure about how this can happen but the default
1492
- // onChange processor includes this protection)
1493
- // In order to reapply to the new element, the property is deleted at the beggining of the registerEvents method
1494
- if ( !this._.domOnChangeRegistered )
1495
- {
1496
- // By listening for the formLoaded event, this handler will get reapplied when a new
1497
- // form is created
1498
- this.on( 'formLoaded', function()
1499
- {
1500
- this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this );
1501
- }, this );
1502
- this._.domOnChangeRegistered = true;
1503
- }
1504
-
1505
- this.on( 'change', func );
1506
- }
1507
- },
1508
-
1509
- keyboardFocusable : true
1510
- }, true );
1511
-
1512
- CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button;
1513
-
1514
- CKEDITOR.ui.dialog.fieldset.prototype = CKEDITOR.tools.clone( CKEDITOR.ui.dialog.hbox.prototype );
1515
-
1516
- CKEDITOR.dialog.addUIElement( 'text', textBuilder );
1517
- CKEDITOR.dialog.addUIElement( 'password', textBuilder );
1518
- CKEDITOR.dialog.addUIElement( 'textarea', commonBuilder );
1519
- CKEDITOR.dialog.addUIElement( 'checkbox', commonBuilder );
1520
- CKEDITOR.dialog.addUIElement( 'radio', commonBuilder );
1521
- CKEDITOR.dialog.addUIElement( 'button', commonBuilder );
1522
- CKEDITOR.dialog.addUIElement( 'select', commonBuilder );
1523
- CKEDITOR.dialog.addUIElement( 'file', commonBuilder );
1524
- CKEDITOR.dialog.addUIElement( 'fileButton', commonBuilder );
1525
- CKEDITOR.dialog.addUIElement( 'html', commonBuilder );
1526
- CKEDITOR.dialog.addUIElement( 'fieldset', containerBuilder );
1527
- })();
1528
-
1529
- /**
1530
- * Fired when the value of the uiElement is changed
1531
- * @name CKEDITOR.ui.dialog.uiElement#change
1532
- * @event
1533
- */
1534
-
1535
- /**
1536
- * Fired when the inner frame created by the element is ready.
1537
- * Each time the button is used or the dialog is loaded a new
1538
- * form might be created.
1539
- * @name CKEDITOR.ui.dialog.fileButton#formLoaded
1540
- * @event
1541
- */
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
+ /** @fileoverview The "dialogui" plugin. */
7
+
8
+ CKEDITOR.plugins.add( 'dialogui' );
9
+
10
+ (function()
11
+ {
12
+ var initPrivateObject = function( elementDefinition )
13
+ {
14
+ this._ || ( this._ = {} );
15
+ this._['default'] = this._.initValue = elementDefinition['default'] || '';
16
+ this._.required = elementDefinition[ 'required' ] || false;
17
+ var args = [ this._ ];
18
+ for ( var i = 1 ; i < arguments.length ; i++ )
19
+ args.push( arguments[i] );
20
+ args.push( true );
21
+ CKEDITOR.tools.extend.apply( CKEDITOR.tools, args );
22
+ return this._;
23
+ },
24
+ textBuilder =
25
+ {
26
+ build : function( dialog, elementDefinition, output )
27
+ {
28
+ return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output );
29
+ }
30
+ },
31
+ commonBuilder =
32
+ {
33
+ build : function( dialog, elementDefinition, output )
34
+ {
35
+ return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output );
36
+ }
37
+ },
38
+ containerBuilder =
39
+ {
40
+ build : function( dialog, elementDefinition, output )
41
+ {
42
+ var children = elementDefinition.children,
43
+ child,
44
+ childHtmlList = [],
45
+ childObjList = [];
46
+ for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
47
+ {
48
+ var childHtml = [];
49
+ childHtmlList.push( childHtml );
50
+ childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
51
+ }
52
+ return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition );
53
+ }
54
+ },
55
+ commonPrototype =
56
+ {
57
+ isChanged : function()
58
+ {
59
+ return this.getValue() != this.getInitValue();
60
+ },
61
+
62
+ reset : function( noChangeEvent )
63
+ {
64
+ this.setValue( this.getInitValue(), noChangeEvent );
65
+ },
66
+
67
+ setInitValue : function()
68
+ {
69
+ this._.initValue = this.getValue();
70
+ },
71
+
72
+ resetInitValue : function()
73
+ {
74
+ this._.initValue = this._['default'];
75
+ },
76
+
77
+ getInitValue : function()
78
+ {
79
+ return this._.initValue;
80
+ }
81
+ },
82
+ commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
83
+ {
84
+ onChange : function( dialog, func )
85
+ {
86
+ if ( !this._.domOnChangeRegistered )
87
+ {
88
+ dialog.on( 'load', function()
89
+ {
90
+ this.getInputElement().on( 'change', function()
91
+ {
92
+ // Make sure 'onchange' doesn't get fired after dialog closed. (#5719)
93
+ if ( !dialog.parts.dialog.isVisible() )
94
+ return;
95
+
96
+ this.fire( 'change', { value : this.getValue() } );
97
+ }, this );
98
+ }, this );
99
+ this._.domOnChangeRegistered = true;
100
+ }
101
+
102
+ this.on( 'change', func );
103
+ }
104
+ }, true ),
105
+ eventRegex = /^on([A-Z]\w+)/,
106
+ cleanInnerDefinition = function( def )
107
+ {
108
+ // An inner UI element should not have the parent's type, title or events.
109
+ for ( var i in def )
110
+ {
111
+ if ( eventRegex.test( i ) || i == 'title' || i == 'type' )
112
+ delete def[i];
113
+ }
114
+ return def;
115
+ };
116
+
117
+ CKEDITOR.tools.extend( CKEDITOR.ui.dialog,
118
+ /** @lends CKEDITOR.ui.dialog */
119
+ {
120
+ /**
121
+ * Base class for all dialog elements with a textual label on the left.
122
+ * @constructor
123
+ * @example
124
+ * @extends CKEDITOR.ui.dialog.uiElement
125
+ * @param {CKEDITOR.dialog} dialog
126
+ * Parent dialog object.
127
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
128
+ * The element definition. Accepted fields:
129
+ * <ul>
130
+ * <li><strong>label</strong> (Required) The label string.</li>
131
+ * <li><strong>labelLayout</strong> (Optional) Put 'horizontal' here if the
132
+ * label element is to be layed out horizontally. Otherwise a vertical
133
+ * layout will be used.</li>
134
+ * <li><strong>widths</strong> (Optional) This applies only for horizontal
135
+ * layouts - an 2-element array of lengths to specify the widths of the
136
+ * label and the content element.</li>
137
+ * </ul>
138
+ * @param {Array} htmlList
139
+ * List of HTML code to output to.
140
+ * @param {Function} contentHtml
141
+ * A function returning the HTML code string to be added inside the content
142
+ * cell.
143
+ */
144
+ labeledElement : function( dialog, elementDefinition, htmlList, contentHtml )
145
+ {
146
+ if ( arguments.length < 4 )
147
+ return;
148
+
149
+ var _ = initPrivateObject.call( this, elementDefinition );
150
+ _.labelId = CKEDITOR.tools.getNextId() + '_label';
151
+ var children = this._.children = [];
152
+ /** @ignore */
153
+ var innerHTML = function()
154
+ {
155
+ var html = [],
156
+ requiredClass = elementDefinition.required ? ' cke_required' : '' ;
157
+ if ( elementDefinition.labelLayout != 'horizontal' )
158
+ html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ',
159
+ ' id="'+ _.labelId + '"',
160
+ ' for="' + _.inputId + '"',
161
+ ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>',
162
+ elementDefinition.label,
163
+ '</label>',
164
+ '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">',
165
+ contentHtml.call( this, dialog, elementDefinition ),
166
+ '</div>' );
167
+ else
168
+ {
169
+ var hboxDefinition = {
170
+ type : 'hbox',
171
+ widths : elementDefinition.widths,
172
+ padding : 0,
173
+ children :
174
+ [
175
+ {
176
+ type : 'html',
177
+ html : '<label class="cke_dialog_ui_labeled_label' + requiredClass + '"' +
178
+ ' id="' + _.labelId + '"' +
179
+ ' for="' + _.inputId + '"' +
180
+ ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>' +
181
+ CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
182
+ '</span>'
183
+ },
184
+ {
185
+ type : 'html',
186
+ html : '<span class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + '>' +
187
+ contentHtml.call( this, dialog, elementDefinition ) +
188
+ '</span>'
189
+ }
190
+ ]
191
+ };
192
+ CKEDITOR.dialog._.uiElementBuilders.hbox.build( dialog, hboxDefinition, html );
193
+ }
194
+ return html.join( '' );
195
+ };
196
+ CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
197
+ },
198
+
199
+ /**
200
+ * A text input with a label. This UI element class represents both the
201
+ * single-line text inputs and password inputs in dialog boxes.
202
+ * @constructor
203
+ * @example
204
+ * @extends CKEDITOR.ui.dialog.labeledElement
205
+ * @param {CKEDITOR.dialog} dialog
206
+ * Parent dialog object.
207
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
208
+ * The element definition. Accepted fields:
209
+ * <ul>
210
+ * <li><strong>default</strong> (Optional) The default value.</li>
211
+ * <li><strong>validate</strong> (Optional) The validation function. </li>
212
+ * <li><strong>maxLength</strong> (Optional) The maximum length of text box
213
+ * contents.</li>
214
+ * <li><strong>size</strong> (Optional) The size of the text box. This is
215
+ * usually overridden by the size defined by the skin, however.</li>
216
+ * </ul>
217
+ * @param {Array} htmlList
218
+ * List of HTML code to output to.
219
+ */
220
+ textInput : function( dialog, elementDefinition, htmlList )
221
+ {
222
+ if ( arguments.length < 3 )
223
+ return;
224
+
225
+ initPrivateObject.call( this, elementDefinition );
226
+ var domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textInput',
227
+ attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : 'text' },
228
+ i;
229
+
230
+ // Set the validator, if any.
231
+ if ( elementDefinition.validate )
232
+ this.validate = elementDefinition.validate;
233
+
234
+ // Set the max length and size.
235
+ if ( elementDefinition.maxLength )
236
+ attributes.maxlength = elementDefinition.maxLength;
237
+ if ( elementDefinition.size )
238
+ attributes.size = elementDefinition.size;
239
+
240
+ if ( elementDefinition.inputStyle )
241
+ attributes.style = elementDefinition.inputStyle;
242
+
243
+ // If user presses Enter in a text box, it implies clicking OK for the dialog.
244
+ var me = this, keyPressedOnMe = false;
245
+ dialog.on( 'load', function()
246
+ {
247
+ me.getInputElement().on( 'keydown', function( evt )
248
+ {
249
+ if ( evt.data.getKeystroke() == 13 )
250
+ keyPressedOnMe = true;
251
+ } );
252
+
253
+ // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749)
254
+ me.getInputElement().on( 'keyup', function( evt )
255
+ {
256
+ if ( evt.data.getKeystroke() == 13 && keyPressedOnMe )
257
+ {
258
+ dialog.getButton( 'ok' ) && setTimeout( function ()
259
+ {
260
+ dialog.getButton( 'ok' ).click();
261
+ }, 0 );
262
+ keyPressedOnMe = false;
263
+ }
264
+ }, null, null, 1000 );
265
+ } );
266
+
267
+ /** @ignore */
268
+ var innerHTML = function()
269
+ {
270
+ // IE BUG: Text input fields in IE at 100% would exceed a <td> or inline
271
+ // container's width, so need to wrap it inside a <div>.
272
+ var html = [ '<div class="cke_dialog_ui_input_', elementDefinition.type, '" role="presentation"' ];
273
+
274
+ if ( elementDefinition.width )
275
+ html.push( 'style="width:'+ elementDefinition.width +'" ' );
276
+
277
+ html.push( '><input ' );
278
+
279
+ attributes[ 'aria-labelledby' ] = this._.labelId;
280
+ this._.required && ( attributes[ 'aria-required' ] = this._.required );
281
+ for ( var i in attributes )
282
+ html.push( i + '="' + attributes[i] + '" ' );
283
+ html.push( ' /></div>' );
284
+ return html.join( '' );
285
+ };
286
+ CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
287
+ },
288
+
289
+ /**
290
+ * A text area with a label on the top or left.
291
+ * @constructor
292
+ * @extends CKEDITOR.ui.dialog.labeledElement
293
+ * @example
294
+ * @param {CKEDITOR.dialog} dialog
295
+ * Parent dialog object.
296
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
297
+ * The element definition. Accepted fields:
298
+ * <ul>
299
+ * <li><strong>rows</strong> (Optional) The number of rows displayed.
300
+ * Defaults to 5 if not defined.</li>
301
+ * <li><strong>cols</strong> (Optional) The number of cols displayed.
302
+ * Defaults to 20 if not defined. Usually overridden by skins.</li>
303
+ * <li><strong>default</strong> (Optional) The default value.</li>
304
+ * <li><strong>validate</strong> (Optional) The validation function. </li>
305
+ * </ul>
306
+ * @param {Array} htmlList
307
+ * List of HTML code to output to.
308
+ */
309
+ textarea : function( dialog, elementDefinition, htmlList )
310
+ {
311
+ if ( arguments.length < 3 )
312
+ return;
313
+
314
+ initPrivateObject.call( this, elementDefinition );
315
+ var me = this,
316
+ domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textarea',
317
+ attributes = {};
318
+
319
+ if ( elementDefinition.validate )
320
+ this.validate = elementDefinition.validate;
321
+
322
+ // Generates the essential attributes for the textarea tag.
323
+ attributes.rows = elementDefinition.rows || 5;
324
+ attributes.cols = elementDefinition.cols || 20;
325
+
326
+ if ( typeof elementDefinition.inputStyle != 'undefined' )
327
+ attributes.style = elementDefinition.inputStyle;
328
+
329
+
330
+ /** @ignore */
331
+ var innerHTML = function()
332
+ {
333
+ attributes[ 'aria-labelledby' ] = this._.labelId;
334
+ this._.required && ( attributes[ 'aria-required' ] = this._.required );
335
+ var html = [ '<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="', domId, '" ' ];
336
+ for ( var i in attributes )
337
+ html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ' );
338
+ html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '</textarea></div>' );
339
+ return html.join( '' );
340
+ };
341
+ CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
342
+ },
343
+
344
+ /**
345
+ * A single checkbox with a label on the right.
346
+ * @constructor
347
+ * @extends CKEDITOR.ui.dialog.uiElement
348
+ * @example
349
+ * @param {CKEDITOR.dialog} dialog
350
+ * Parent dialog object.
351
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
352
+ * The element definition. Accepted fields:
353
+ * <ul>
354
+ * <li><strong>checked</strong> (Optional) Whether the checkbox is checked
355
+ * on instantiation. Defaults to false.</li>
356
+ * <li><strong>validate</strong> (Optional) The validation function.</li>
357
+ * <li><strong>label</strong> (Optional) The checkbox label.</li>
358
+ * </ul>
359
+ * @param {Array} htmlList
360
+ * List of HTML code to output to.
361
+ */
362
+ checkbox : function( dialog, elementDefinition, htmlList )
363
+ {
364
+ if ( arguments.length < 3 )
365
+ return;
366
+
367
+ var _ = initPrivateObject.call( this, elementDefinition, { 'default' : !!elementDefinition[ 'default' ] } );
368
+
369
+ if ( elementDefinition.validate )
370
+ this.validate = elementDefinition.validate;
371
+
372
+ /** @ignore */
373
+ var innerHTML = function()
374
+ {
375
+ var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
376
+ {
377
+ id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox'
378
+ }, true ),
379
+ html = [];
380
+
381
+ var labelId = CKEDITOR.tools.getNextId() + '_label';
382
+ var attributes = { 'class' : 'cke_dialog_ui_checkbox_input', type : 'checkbox', 'aria-labelledby' : labelId };
383
+ cleanInnerDefinition( myDefinition );
384
+ if ( elementDefinition[ 'default' ] )
385
+ attributes.checked = 'checked';
386
+
387
+ if ( typeof myDefinition.inputStyle != 'undefined' )
388
+ myDefinition.style = myDefinition.inputStyle;
389
+
390
+ _.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes );
391
+ html.push( ' <label id="', labelId, '" for="', attributes.id, '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>',
392
+ CKEDITOR.tools.htmlEncode( elementDefinition.label ),
393
+ '</label>' );
394
+ return html.join( '' );
395
+ };
396
+
397
+ CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'span', null, null, innerHTML );
398
+ },
399
+
400
+ /**
401
+ * A group of radio buttons.
402
+ * @constructor
403
+ * @example
404
+ * @extends CKEDITOR.ui.dialog.labeledElement
405
+ * @param {CKEDITOR.dialog} dialog
406
+ * Parent dialog object.
407
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
408
+ * The element definition. Accepted fields:
409
+ * <ul>
410
+ * <li><strong>default</strong> (Required) The default value.</li>
411
+ * <li><strong>validate</strong> (Optional) The validation function.</li>
412
+ * <li><strong>items</strong> (Required) An array of options. Each option
413
+ * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value'
414
+ * is missing, then the value would be assumed to be the same as the
415
+ * description.</li>
416
+ * </ul>
417
+ * @param {Array} htmlList
418
+ * List of HTML code to output to.
419
+ */
420
+ radio : function( dialog, elementDefinition, htmlList )
421
+ {
422
+ if ( arguments.length < 3)
423
+ return;
424
+
425
+ initPrivateObject.call( this, elementDefinition );
426
+ if ( !this._['default'] )
427
+ this._['default'] = this._.initValue = elementDefinition.items[0][1];
428
+ if ( elementDefinition.validate )
429
+ this.validate = elementDefinition.valdiate;
430
+ var children = [], me = this;
431
+
432
+ /** @ignore */
433
+ var innerHTML = function()
434
+ {
435
+ var inputHtmlList = [], html = [],
436
+ commonAttributes = { 'class' : 'cke_dialog_ui_radio_item', 'aria-labelledby' : this._.labelId },
437
+ commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio';
438
+ for ( var i = 0 ; i < elementDefinition.items.length ; i++ )
439
+ {
440
+ var item = elementDefinition.items[i],
441
+ title = item[2] !== undefined ? item[2] : item[0],
442
+ value = item[1] !== undefined ? item[1] : item[0],
443
+ inputId = CKEDITOR.tools.getNextId() + '_radio_input',
444
+ labelId = inputId + '_label',
445
+ inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
446
+ {
447
+ id : inputId,
448
+ title : null,
449
+ type : null
450
+ }, true ),
451
+ labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition,
452
+ {
453
+ title : title
454
+ }, true ),
455
+ inputAttributes =
456
+ {
457
+ type : 'radio',
458
+ 'class' : 'cke_dialog_ui_radio_input',
459
+ name : commonName,
460
+ value : value,
461
+ 'aria-labelledby' : labelId
462
+ },
463
+ inputHtml = [];
464
+ if ( me._['default'] == value )
465
+ inputAttributes.checked = 'checked';
466
+ cleanInnerDefinition( inputDefinition );
467
+ cleanInnerDefinition( labelDefinition );
468
+
469
+ if ( typeof inputDefinition.inputStyle != 'undefined' )
470
+ inputDefinition.style = inputDefinition.inputStyle;
471
+
472
+ children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
473
+ inputHtml.push( ' ' );
474
+ new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id : labelId, 'for' : inputAttributes.id },
475
+ item[0] );
476
+ inputHtmlList.push( inputHtml.join( '' ) );
477
+ }
478
+ new CKEDITOR.ui.dialog.hbox( dialog, [], inputHtmlList, html );
479
+ return html.join( '' );
480
+ };
481
+
482
+ CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
483
+ this._.children = children;
484
+ },
485
+
486
+ /**
487
+ * A button with a label inside.
488
+ * @constructor
489
+ * @example
490
+ * @extends CKEDITOR.ui.dialog.uiElement
491
+ * @param {CKEDITOR.dialog} dialog
492
+ * Parent dialog object.
493
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
494
+ * The element definition. Accepted fields:
495
+ * <ul>
496
+ * <li><strong>label</strong> (Required) The button label.</li>
497
+ * <li><strong>disabled</strong> (Optional) Set to true if you want the
498
+ * button to appear in disabled state.</li>
499
+ * </ul>
500
+ * @param {Array} htmlList
501
+ * List of HTML code to output to.
502
+ */
503
+ button : function( dialog, elementDefinition, htmlList )
504
+ {
505
+ if ( !arguments.length )
506
+ return;
507
+
508
+ if ( typeof elementDefinition == 'function' )
509
+ elementDefinition = elementDefinition( dialog.getParentEditor() );
510
+
511
+ initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } );
512
+
513
+ // Add OnClick event to this input.
514
+ CKEDITOR.event.implementOn( this );
515
+
516
+ var me = this;
517
+
518
+ // Register an event handler for processing button clicks.
519
+ dialog.on( 'load', function( eventInfo )
520
+ {
521
+ var element = this.getElement();
522
+
523
+ (function()
524
+ {
525
+ element.on( 'click', function( evt )
526
+ {
527
+ me.fire( 'click', { dialog : me.getDialog() } );
528
+ evt.data.preventDefault();
529
+ } );
530
+
531
+ element.on( 'keydown', function( evt )
532
+ {
533
+ if ( evt.data.getKeystroke() in { 32:1 } )
534
+ {
535
+ me.click();
536
+ evt.data.preventDefault();
537
+ }
538
+ } );
539
+ })();
540
+
541
+ element.unselectable();
542
+ }, this );
543
+
544
+ var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
545
+ delete outerDefinition.style;
546
+
547
+ var labelId = CKEDITOR.tools.getNextId() + '_label';
548
+ CKEDITOR.ui.dialog.uiElement.call(
549
+ this,
550
+ dialog,
551
+ outerDefinition,
552
+ htmlList,
553
+ 'a',
554
+ null,
555
+ {
556
+ style : elementDefinition.style,
557
+ href : 'javascript:void(0)',
558
+ title : elementDefinition.label,
559
+ hidefocus : 'true',
560
+ 'class' : elementDefinition['class'],
561
+ role : 'button',
562
+ 'aria-labelledby' : labelId
563
+ },
564
+ '<span id="' + labelId + '" class="cke_dialog_ui_button">' +
565
+ CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
566
+ '</span>' );
567
+ },
568
+
569
+ /**
570
+ * A select box.
571
+ * @extends CKEDITOR.ui.dialog.uiElement
572
+ * @example
573
+ * @constructor
574
+ * @param {CKEDITOR.dialog} dialog
575
+ * Parent dialog object.
576
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
577
+ * The element definition. Accepted fields:
578
+ * <ul>
579
+ * <li><strong>default</strong> (Required) The default value.</li>
580
+ * <li><strong>validate</strong> (Optional) The validation function.</li>
581
+ * <li><strong>items</strong> (Required) An array of options. Each option
582
+ * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value'
583
+ * is missing, then the value would be assumed to be the same as the
584
+ * description.</li>
585
+ * <li><strong>multiple</strong> (Optional) Set this to true if you'd like
586
+ * to have a multiple-choice select box.</li>
587
+ * <li><strong>size</strong> (Optional) The number of items to display in
588
+ * the select box.</li>
589
+ * </ul>
590
+ * @param {Array} htmlList
591
+ * List of HTML code to output to.
592
+ */
593
+ select : function( dialog, elementDefinition, htmlList )
594
+ {
595
+ if ( arguments.length < 3 )
596
+ return;
597
+
598
+ var _ = initPrivateObject.call( this, elementDefinition );
599
+
600
+ if ( elementDefinition.validate )
601
+ this.validate = elementDefinition.validate;
602
+
603
+ _.inputId = CKEDITOR.tools.getNextId() + '_select';
604
+ /** @ignore */
605
+ var innerHTML = function()
606
+ {
607
+ var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
608
+ {
609
+ id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select'
610
+ }, true ),
611
+ html = [],
612
+ innerHTML = [],
613
+ attributes = { 'id' : _.inputId, 'class' : 'cke_dialog_ui_input_select', 'aria-labelledby' : this._.labelId };
614
+
615
+ // Add multiple and size attributes from element definition.
616
+ if ( elementDefinition.size != undefined )
617
+ attributes.size = elementDefinition.size;
618
+ if ( elementDefinition.multiple != undefined )
619
+ attributes.multiple = elementDefinition.multiple;
620
+
621
+ cleanInnerDefinition( myDefinition );
622
+ for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ )
623
+ {
624
+ innerHTML.push( '<option value="',
625
+ CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ).replace( /"/g, '&quot;' ), '" /> ',
626
+ CKEDITOR.tools.htmlEncode( item[0] ) );
627
+ }
628
+
629
+ if ( typeof myDefinition.inputStyle != 'undefined' )
630
+ myDefinition.style = myDefinition.inputStyle;
631
+
632
+ _.select = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'select', null, attributes, innerHTML.join( '' ) );
633
+ return html.join( '' );
634
+ };
635
+
636
+ CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
637
+ },
638
+
639
+ /**
640
+ * A file upload input.
641
+ * @extends CKEDITOR.ui.dialog.labeledElement
642
+ * @example
643
+ * @constructor
644
+ * @param {CKEDITOR.dialog} dialog
645
+ * Parent dialog object.
646
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
647
+ * The element definition. Accepted fields:
648
+ * <ul>
649
+ * <li><strong>validate</strong> (Optional) The validation function.</li>
650
+ * </ul>
651
+ * @param {Array} htmlList
652
+ * List of HTML code to output to.
653
+ */
654
+ file : function( dialog, elementDefinition, htmlList )
655
+ {
656
+ if ( arguments.length < 3 )
657
+ return;
658
+
659
+ if ( elementDefinition['default'] === undefined )
660
+ elementDefinition['default'] = '';
661
+
662
+ var _ = CKEDITOR.tools.extend( initPrivateObject.call( this, elementDefinition ), { definition : elementDefinition, buttons : [] } );
663
+
664
+ if ( elementDefinition.validate )
665
+ this.validate = elementDefinition.validate;
666
+
667
+ /** @ignore */
668
+ var innerHTML = function()
669
+ {
670
+ _.frameId = CKEDITOR.tools.getNextId() + '_fileInput';
671
+
672
+ // Support for custom document.domain in IE.
673
+ var isCustomDomain = CKEDITOR.env.isCustomDomain();
674
+
675
+ var html = [
676
+ '<iframe' +
677
+ ' frameborder="0"' +
678
+ ' allowtransparency="0"' +
679
+ ' class="cke_dialog_ui_input_file"' +
680
+ ' id="', _.frameId, '"' +
681
+ ' title="', elementDefinition.label, '"' +
682
+ ' src="javascript:void(' ];
683
+
684
+ html.push(
685
+ isCustomDomain ?
686
+ '(function(){' +
687
+ 'document.open();' +
688
+ 'document.domain=\'' + document.domain + '\';' +
689
+ 'document.close();' +
690
+ '})()'
691
+ :
692
+ '0' );
693
+
694
+ html.push(
695
+ ')">' +
696
+ '</iframe>' );
697
+
698
+ return html.join( '' );
699
+ };
700
+
701
+ // IE BUG: Parent container does not resize to contain the iframe automatically.
702
+ dialog.on( 'load', function()
703
+ {
704
+ var iframe = CKEDITOR.document.getById( _.frameId ),
705
+ contentDiv = iframe.getParent();
706
+ contentDiv.addClass( 'cke_dialog_ui_input_file' );
707
+ } );
708
+
709
+ CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
710
+ },
711
+
712
+ /**
713
+ * A button for submitting the file in a file upload input.
714
+ * @extends CKEDITOR.ui.dialog.button
715
+ * @example
716
+ * @constructor
717
+ * @param {CKEDITOR.dialog} dialog
718
+ * Parent dialog object.
719
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
720
+ * The element definition. Accepted fields:
721
+ * <ul>
722
+ * <li><strong>for</strong> (Required) The file input's page and element Id
723
+ * to associate to, in a 2-item array format: [ 'page_id', 'element_id' ].
724
+ * </li>
725
+ * <li><strong>validate</strong> (Optional) The validation function.</li>
726
+ * </ul>
727
+ * @param {Array} htmlList
728
+ * List of HTML code to output to.
729
+ */
730
+ fileButton : function( dialog, elementDefinition, htmlList )
731
+ {
732
+ if ( arguments.length < 3 )
733
+ return;
734
+
735
+ var _ = initPrivateObject.call( this, elementDefinition ),
736
+ me = this;
737
+
738
+ if ( elementDefinition.validate )
739
+ this.validate = elementDefinition.validate;
740
+
741
+ var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
742
+ var onClick = myDefinition.onClick;
743
+ myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button';
744
+ myDefinition.onClick = function( evt )
745
+ {
746
+ var target = elementDefinition[ 'for' ]; // [ pageId, elementId ]
747
+ if ( !onClick || onClick.call( this, evt ) !== false )
748
+ {
749
+ dialog.getContentElement( target[0], target[1] ).submit();
750
+ this.disable();
751
+ }
752
+ };
753
+
754
+ dialog.on( 'load', function()
755
+ {
756
+ dialog.getContentElement( elementDefinition[ 'for' ][0], elementDefinition[ 'for' ][1] )._.buttons.push( me );
757
+ } );
758
+
759
+ CKEDITOR.ui.dialog.button.call( this, dialog, myDefinition, htmlList );
760
+ },
761
+
762
+ html : (function()
763
+ {
764
+ var myHtmlRe = /^\s*<[\w:]+\s+([^>]*)?>/,
765
+ theirHtmlRe = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,
766
+ emptyTagRe = /\/$/;
767
+ /**
768
+ * A dialog element made from raw HTML code.
769
+ * @extends CKEDITOR.ui.dialog.uiElement
770
+ * @name CKEDITOR.ui.dialog.html
771
+ * @param {CKEDITOR.dialog} dialog Parent dialog object.
772
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element definition.
773
+ * Accepted fields:
774
+ * <ul>
775
+ * <li><strong>html</strong> (Required) HTML code of this element.</li>
776
+ * </ul>
777
+ * @param {Array} htmlList List of HTML code to be added to the dialog's content area.
778
+ * @example
779
+ * @constructor
780
+ */
781
+ return function( dialog, elementDefinition, htmlList )
782
+ {
783
+ if ( arguments.length < 3 )
784
+ return;
785
+
786
+ var myHtmlList = [],
787
+ myHtml,
788
+ theirHtml = elementDefinition.html,
789
+ myMatch, theirMatch;
790
+
791
+ // If the HTML input doesn't contain any tags at the beginning, add a <span> tag around it.
792
+ if ( theirHtml.charAt( 0 ) != '<' )
793
+ theirHtml = '<span>' + theirHtml + '</span>';
794
+
795
+ // Look for focus function in definition.
796
+ var focus = elementDefinition.focus;
797
+ if ( focus )
798
+ {
799
+ var oldFocus = this.focus;
800
+ this.focus = function()
801
+ {
802
+ oldFocus.call( this );
803
+ typeof focus == 'function' && focus.call( this );
804
+ this.fire( 'focus' );
805
+ };
806
+ if ( elementDefinition.isFocusable )
807
+ {
808
+ var oldIsFocusable = this.isFocusable;
809
+ this.isFocusable = oldIsFocusable;
810
+ }
811
+ this.keyboardFocusable = true;
812
+ }
813
+
814
+ CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, myHtmlList, 'span', null, null, '' );
815
+
816
+ // Append the attributes created by the uiElement call to the real HTML.
817
+ myHtml = myHtmlList.join( '' );
818
+ myMatch = myHtml.match( myHtmlRe );
819
+ theirMatch = theirHtml.match( theirHtmlRe ) || [ '', '', '' ];
820
+
821
+ if ( emptyTagRe.test( theirMatch[1] ) )
822
+ {
823
+ theirMatch[1] = theirMatch[1].slice( 0, -1 );
824
+ theirMatch[2] = '/' + theirMatch[2];
825
+ }
826
+
827
+ htmlList.push( [ theirMatch[1], ' ', myMatch[1] || '', theirMatch[2] ].join( '' ) );
828
+ };
829
+ })(),
830
+
831
+ /**
832
+ * Form fieldset for grouping dialog UI elements.
833
+ * @constructor
834
+ * @extends CKEDITOR.ui.dialog.uiElement
835
+ * @param {CKEDITOR.dialog} dialog Parent dialog object.
836
+ * @param {Array} childObjList
837
+ * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
838
+ * container.
839
+ * @param {Array} childHtmlList
840
+ * Array of HTML code that correspond to the HTML output of all the
841
+ * objects in childObjList.
842
+ * @param {Array} htmlList
843
+ * Array of HTML code that this element will output to.
844
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
845
+ * The element definition. Accepted fields:
846
+ * <ul>
847
+ * <li><strong>label</strong> (Optional) The legend of the this fieldset.</li>
848
+ * <li><strong>children</strong> (Required) An array of dialog field definitions which will be grouped inside this fieldset. </li>
849
+ * </ul>
850
+ */
851
+ fieldset : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
852
+ {
853
+ var legendLabel = elementDefinition.label;
854
+ /** @ignore */
855
+ var innerHTML = function()
856
+ {
857
+ var html = [];
858
+ legendLabel && html.push( '<legend>' + legendLabel + '</legend>' );
859
+ for ( var i = 0; i < childHtmlList.length; i++ )
860
+ html.push( childHtmlList[ i ] );
861
+ return html.join( '' );
862
+ };
863
+
864
+ this._ = { children : childObjList };
865
+ CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'fieldset', null, null, innerHTML );
866
+ }
867
+
868
+ }, true );
869
+
870
+ CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement;
871
+
872
+ CKEDITOR.ui.dialog.labeledElement.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
873
+ /** @lends CKEDITOR.ui.dialog.labeledElement.prototype */
874
+ {
875
+ /**
876
+ * Sets the label text of the element.
877
+ * @param {String} label The new label text.
878
+ * @returns {CKEDITOR.ui.dialog.labeledElement} The current labeled element.
879
+ * @example
880
+ */
881
+ setLabel : function( label )
882
+ {
883
+ var node = CKEDITOR.document.getById( this._.labelId );
884
+ if ( node.getChildCount() < 1 )
885
+ ( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node );
886
+ else
887
+ node.getChild( 0 ).$.nodeValue = label;
888
+ return this;
889
+ },
890
+
891
+ /**
892
+ * Retrieves the current label text of the elment.
893
+ * @returns {String} The current label text.
894
+ * @example
895
+ */
896
+ getLabel : function()
897
+ {
898
+ var node = CKEDITOR.document.getById( this._.labelId );
899
+ if ( !node || node.getChildCount() < 1 )
900
+ return '';
901
+ else
902
+ return node.getChild( 0 ).getText();
903
+ },
904
+
905
+ /**
906
+ * Defines the onChange event for UI element definitions.
907
+ * @field
908
+ * @type Object
909
+ * @example
910
+ */
911
+ eventProcessors : commonEventProcessors
912
+ }, true );
913
+
914
+ CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
915
+ /** @lends CKEDITOR.ui.dialog.button.prototype */
916
+ {
917
+ /**
918
+ * Simulates a click to the button.
919
+ * @example
920
+ * @returns {Object} Return value of the 'click' event.
921
+ */
922
+ click : function()
923
+ {
924
+ if ( !this._.disabled )
925
+ return this.fire( 'click', { dialog : this._.dialog } );
926
+ this.getElement().$.blur();
927
+ return false;
928
+ },
929
+
930
+ /**
931
+ * Enables the button.
932
+ * @example
933
+ */
934
+ enable : function()
935
+ {
936
+ this._.disabled = false;
937
+ var element = this.getElement();
938
+ element && element.removeClass( 'cke_disabled' );
939
+ },
940
+
941
+ /**
942
+ * Disables the button.
943
+ * @example
944
+ */
945
+ disable : function()
946
+ {
947
+ this._.disabled = true;
948
+ this.getElement().addClass( 'cke_disabled' );
949
+ },
950
+
951
+ isVisible : function()
952
+ {
953
+ return this.getElement().getFirst().isVisible();
954
+ },
955
+
956
+ isEnabled : function()
957
+ {
958
+ return !this._.disabled;
959
+ },
960
+
961
+ /**
962
+ * Defines the onChange event and onClick for button element definitions.
963
+ * @field
964
+ * @type Object
965
+ * @example
966
+ */
967
+ eventProcessors : CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
968
+ {
969
+ /** @ignore */
970
+ onClick : function( dialog, func )
971
+ {
972
+ this.on( 'click', func );
973
+ }
974
+ }, true ),
975
+
976
+ /**
977
+ * Handler for the element's access key up event. Simulates a click to
978
+ * the button.
979
+ * @example
980
+ */
981
+ accessKeyUp : function()
982
+ {
983
+ this.click();
984
+ },
985
+
986
+ /**
987
+ * Handler for the element's access key down event. Simulates a mouse
988
+ * down to the button.
989
+ * @example
990
+ */
991
+ accessKeyDown : function()
992
+ {
993
+ this.focus();
994
+ },
995
+
996
+ keyboardFocusable : true
997
+ }, true );
998
+
999
+ CKEDITOR.ui.dialog.textInput.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1000
+ /** @lends CKEDITOR.ui.dialog.textInput.prototype */
1001
+ {
1002
+ /**
1003
+ * Gets the text input DOM element under this UI object.
1004
+ * @example
1005
+ * @returns {CKEDITOR.dom.element} The DOM element of the text input.
1006
+ */
1007
+ getInputElement : function()
1008
+ {
1009
+ return CKEDITOR.document.getById( this._.inputId );
1010
+ },
1011
+
1012
+ /**
1013
+ * Puts focus into the text input.
1014
+ * @example
1015
+ */
1016
+ focus : function()
1017
+ {
1018
+ var me = this.selectParentTab();
1019
+
1020
+ // GECKO BUG: setTimeout() is needed to workaround invisible selections.
1021
+ setTimeout( function()
1022
+ {
1023
+ var element = me.getInputElement();
1024
+ element && element.$.focus();
1025
+ }, 0 );
1026
+ },
1027
+
1028
+ /**
1029
+ * Selects all the text in the text input.
1030
+ * @example
1031
+ */
1032
+ select : function()
1033
+ {
1034
+ var me = this.selectParentTab();
1035
+
1036
+ // GECKO BUG: setTimeout() is needed to workaround invisible selections.
1037
+ setTimeout( function()
1038
+ {
1039
+ var e = me.getInputElement();
1040
+ if ( e )
1041
+ {
1042
+ e.$.focus();
1043
+ e.$.select();
1044
+ }
1045
+ }, 0 );
1046
+ },
1047
+
1048
+ /**
1049
+ * Handler for the text input's access key up event. Makes a select()
1050
+ * call to the text input.
1051
+ * @example
1052
+ */
1053
+ accessKeyUp : function()
1054
+ {
1055
+ this.select();
1056
+ },
1057
+
1058
+ /**
1059
+ * Sets the value of this text input object.
1060
+ * @param {Object} value The new value.
1061
+ * @returns {CKEDITOR.ui.dialog.textInput} The current UI element.
1062
+ * @example
1063
+ * uiElement.setValue( 'Blamo' );
1064
+ */
1065
+ setValue : function( value )
1066
+ {
1067
+ !value && ( value = '' );
1068
+ return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply( this, arguments );
1069
+ },
1070
+
1071
+ keyboardFocusable : true
1072
+ }, commonPrototype, true );
1073
+
1074
+ CKEDITOR.ui.dialog.textarea.prototype = new CKEDITOR.ui.dialog.textInput();
1075
+
1076
+ CKEDITOR.ui.dialog.select.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1077
+ /** @lends CKEDITOR.ui.dialog.select.prototype */
1078
+ {
1079
+ /**
1080
+ * Gets the DOM element of the select box.
1081
+ * @returns {CKEDITOR.dom.element} The &lt;select&gt; element of this UI
1082
+ * element.
1083
+ * @example
1084
+ */
1085
+ getInputElement : function()
1086
+ {
1087
+ return this._.select.getElement();
1088
+ },
1089
+
1090
+ /**
1091
+ * Adds an option to the select box.
1092
+ * @param {String} label Option label.
1093
+ * @param {String} value (Optional) Option value, if not defined it'll be
1094
+ * assumed to be the same as the label.
1095
+ * @param {Number} index (Optional) Position of the option to be inserted
1096
+ * to. If not defined the new option will be inserted to the end of list.
1097
+ * @example
1098
+ * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1099
+ */
1100
+ add : function( label, value, index )
1101
+ {
1102
+ var option = new CKEDITOR.dom.element( 'option', this.getDialog().getParentEditor().document ),
1103
+ selectElement = this.getInputElement().$;
1104
+ option.$.text = label;
1105
+ option.$.value = ( value === undefined || value === null ) ? label : value;
1106
+ if ( index === undefined || index === null )
1107
+ {
1108
+ if ( CKEDITOR.env.ie )
1109
+ selectElement.add( option.$ );
1110
+ else
1111
+ selectElement.add( option.$, null );
1112
+ }
1113
+ else
1114
+ selectElement.add( option.$, index );
1115
+ return this;
1116
+ },
1117
+
1118
+ /**
1119
+ * Removes an option from the selection list.
1120
+ * @param {Number} index Index of the option to be removed.
1121
+ * @example
1122
+ * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1123
+ */
1124
+ remove : function( index )
1125
+ {
1126
+ var selectElement = this.getInputElement().$;
1127
+ selectElement.remove( index );
1128
+ return this;
1129
+ },
1130
+
1131
+ /**
1132
+ * Clears all options out of the selection list.
1133
+ * @returns {CKEDITOR.ui.dialog.select} The current select UI element.
1134
+ */
1135
+ clear : function()
1136
+ {
1137
+ var selectElement = this.getInputElement().$;
1138
+ while ( selectElement.length > 0 )
1139
+ selectElement.remove( 0 );
1140
+ return this;
1141
+ },
1142
+
1143
+ keyboardFocusable : true
1144
+ }, commonPrototype, true );
1145
+
1146
+ CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
1147
+ /** @lends CKEDITOR.ui.dialog.checkbox.prototype */
1148
+ {
1149
+ /**
1150
+ * Gets the checkbox DOM element.
1151
+ * @example
1152
+ * @returns {CKEDITOR.dom.element} The DOM element of the checkbox.
1153
+ */
1154
+ getInputElement : function()
1155
+ {
1156
+ return this._.checkbox.getElement();
1157
+ },
1158
+
1159
+ /**
1160
+ * Sets the state of the checkbox.
1161
+ * @example
1162
+ * @param {Boolean} true to tick the checkbox, false to untick it.
1163
+ * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
1164
+ */
1165
+ setValue : function( checked, noChangeEvent )
1166
+ {
1167
+ this.getInputElement().$.checked = checked;
1168
+ !noChangeEvent && this.fire( 'change', { value : checked } );
1169
+ },
1170
+
1171
+ /**
1172
+ * Gets the state of the checkbox.
1173
+ * @example
1174
+ * @returns {Boolean} true means the checkbox is ticked, false means it's not ticked.
1175
+ */
1176
+ getValue : function()
1177
+ {
1178
+ return this.getInputElement().$.checked;
1179
+ },
1180
+
1181
+ /**
1182
+ * Handler for the access key up event. Toggles the checkbox.
1183
+ * @example
1184
+ */
1185
+ accessKeyUp : function()
1186
+ {
1187
+ this.setValue( !this.getValue() );
1188
+ },
1189
+
1190
+ /**
1191
+ * Defines the onChange event for UI element definitions.
1192
+ * @field
1193
+ * @type Object
1194
+ * @example
1195
+ */
1196
+ eventProcessors :
1197
+ {
1198
+ onChange : function( dialog, func )
1199
+ {
1200
+ if ( !CKEDITOR.env.ie )
1201
+ return commonEventProcessors.onChange.apply( this, arguments );
1202
+ else
1203
+ {
1204
+ dialog.on( 'load', function()
1205
+ {
1206
+ var element = this._.checkbox.getElement();
1207
+ element.on( 'propertychange', function( evt )
1208
+ {
1209
+ evt = evt.data.$;
1210
+ if ( evt.propertyName == 'checked' )
1211
+ this.fire( 'change', { value : element.$.checked } );
1212
+ }, this );
1213
+ }, this );
1214
+ this.on( 'change', func );
1215
+ }
1216
+ return null;
1217
+ }
1218
+ },
1219
+
1220
+ keyboardFocusable : true
1221
+ }, commonPrototype, true );
1222
+
1223
+ CKEDITOR.ui.dialog.radio.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
1224
+ /** @lends CKEDITOR.ui.dialog.radio.prototype */
1225
+ {
1226
+ /**
1227
+ * Checks one of the radio buttons in this button group.
1228
+ * @example
1229
+ * @param {String} value The value of the button to be chcked.
1230
+ * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
1231
+ */
1232
+ setValue : function( value, noChangeEvent )
1233
+ {
1234
+ var children = this._.children,
1235
+ item;
1236
+ for ( var i = 0 ; ( i < children.length ) && ( item = children[i] ) ; i++ )
1237
+ item.getElement().$.checked = ( item.getValue() == value );
1238
+ !noChangeEvent && this.fire( 'change', { value : value } );
1239
+ },
1240
+
1241
+ /**
1242
+ * Gets the value of the currently checked radio button.
1243
+ * @example
1244
+ * @returns {String} The currently checked button's value.
1245
+ */
1246
+ getValue : function()
1247
+ {
1248
+ var children = this._.children;
1249
+ for ( var i = 0 ; i < children.length ; i++ )
1250
+ {
1251
+ if ( children[i].getElement().$.checked )
1252
+ return children[i].getValue();
1253
+ }
1254
+ return null;
1255
+ },
1256
+
1257
+ /**
1258
+ * Handler for the access key up event. Focuses the currently
1259
+ * selected radio button, or the first radio button if none is
1260
+ * selected.
1261
+ * @example
1262
+ */
1263
+ accessKeyUp : function()
1264
+ {
1265
+ var children = this._.children, i;
1266
+ for ( i = 0 ; i < children.length ; i++ )
1267
+ {
1268
+ if ( children[i].getElement().$.checked )
1269
+ {
1270
+ children[i].getElement().focus();
1271
+ return;
1272
+ }
1273
+ }
1274
+ children[0].getElement().focus();
1275
+ },
1276
+
1277
+ /**
1278
+ * Defines the onChange event for UI element definitions.
1279
+ * @field
1280
+ * @type Object
1281
+ * @example
1282
+ */
1283
+ eventProcessors :
1284
+ {
1285
+ onChange : function( dialog, func )
1286
+ {
1287
+ if ( !CKEDITOR.env.ie )
1288
+ return commonEventProcessors.onChange.apply( this, arguments );
1289
+ else
1290
+ {
1291
+ dialog.on( 'load', function()
1292
+ {
1293
+ var children = this._.children, me = this;
1294
+ for ( var i = 0 ; i < children.length ; i++ )
1295
+ {
1296
+ var element = children[i].getElement();
1297
+ element.on( 'propertychange', function( evt )
1298
+ {
1299
+ evt = evt.data.$;
1300
+ if ( evt.propertyName == 'checked' && this.$.checked )
1301
+ me.fire( 'change', { value : this.getAttribute( 'value' ) } );
1302
+ } );
1303
+ }
1304
+ }, this );
1305
+ this.on( 'change', func );
1306
+ }
1307
+ return null;
1308
+ }
1309
+ },
1310
+
1311
+ keyboardFocusable : true
1312
+ }, commonPrototype, true );
1313
+
1314
+ CKEDITOR.ui.dialog.file.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
1315
+ commonPrototype,
1316
+ /** @lends CKEDITOR.ui.dialog.file.prototype */
1317
+ {
1318
+ /**
1319
+ * Gets the &lt;input&gt; element of this file input.
1320
+ * @returns {CKEDITOR.dom.element} The file input element.
1321
+ * @example
1322
+ */
1323
+ getInputElement : function()
1324
+ {
1325
+ var frameDocument = CKEDITOR.document.getById( this._.frameId ).getFrameDocument();
1326
+ return frameDocument.$.forms.length > 0 ?
1327
+ new CKEDITOR.dom.element( frameDocument.$.forms[0].elements[0] ) :
1328
+ this.getElement();
1329
+ },
1330
+
1331
+ /**
1332
+ * Uploads the file in the file input.
1333
+ * @returns {CKEDITOR.ui.dialog.file} This object.
1334
+ * @example
1335
+ */
1336
+ submit : function()
1337
+ {
1338
+ this.getInputElement().getParent().$.submit();
1339
+ return this;
1340
+ },
1341
+
1342
+ /**
1343
+ * Get the action assigned to the form.
1344
+ * @returns {String} The value of the action.
1345
+ * @example
1346
+ */
1347
+ getAction : function()
1348
+ {
1349
+ return this.getInputElement().getParent().$.action;
1350
+ },
1351
+
1352
+ /**
1353
+ * The events must be applied on the inner input element, and
1354
+ * that must be done when the iframe & form has been loaded
1355
+ */
1356
+ registerEvents : function( definition )
1357
+ {
1358
+ var regex = /^on([A-Z]\w+)/,
1359
+ match;
1360
+
1361
+ var registerDomEvent = function( uiElement, dialog, eventName, func )
1362
+ {
1363
+ uiElement.on( 'formLoaded', function()
1364
+ {
1365
+ uiElement.getInputElement().on( eventName, func, uiElement );
1366
+ });
1367
+ };
1368
+
1369
+ for ( var i in definition )
1370
+ {
1371
+ if ( !( match = i.match( regex ) ) )
1372
+ continue;
1373
+
1374
+ if ( this.eventProcessors[i] )
1375
+ this.eventProcessors[i].call( this, this._.dialog, definition[i] );
1376
+ else
1377
+ registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
1378
+ }
1379
+
1380
+ return this;
1381
+ },
1382
+
1383
+ /**
1384
+ * Redraws the file input and resets the file path in the file input.
1385
+ * The redraw logic is necessary because non-IE browsers tend to clear
1386
+ * the &lt;iframe&gt; containing the file input after closing the dialog.
1387
+ * @example
1388
+ */
1389
+ reset : function()
1390
+ {
1391
+ var _ = this._,
1392
+ frameElement = CKEDITOR.document.getById( _.frameId ),
1393
+ frameDocument = frameElement.getFrameDocument(),
1394
+ elementDefinition = _.definition,
1395
+ buttons = _.buttons,
1396
+ callNumber = this.formLoadedNumber,
1397
+ unloadNumber = this.formUnloadNumber,
1398
+ langDir = _.dialog._.editor.lang.dir,
1399
+ langCode = _.dialog._.editor.langCode;
1400
+
1401
+ // The callback function for the iframe, but we must call tools.addFunction only once
1402
+ // so we store the function number in this.formLoadedNumber
1403
+ if ( !callNumber )
1404
+ {
1405
+ callNumber = this.formLoadedNumber = CKEDITOR.tools.addFunction(
1406
+ function()
1407
+ {
1408
+ // Now we can apply the events to the input type=file
1409
+ this.fire( 'formLoaded' ) ;
1410
+ }, this ) ;
1411
+
1412
+ // Remove listeners attached to the content of the iframe (the file input)
1413
+ unloadNumber = this.formUnloadNumber = CKEDITOR.tools.addFunction(
1414
+ function()
1415
+ {
1416
+ this.getInputElement().clearCustomData();
1417
+ }, this ) ;
1418
+
1419
+ this.getDialog()._.editor.on( 'destroy', function()
1420
+ {
1421
+ CKEDITOR.tools.removeFunction( callNumber );
1422
+ CKEDITOR.tools.removeFunction( unloadNumber );
1423
+ } );
1424
+ }
1425
+
1426
+ function generateFormField()
1427
+ {
1428
+ frameDocument.$.open();
1429
+
1430
+ // Support for custom document.domain in IE.
1431
+ if ( CKEDITOR.env.isCustomDomain() )
1432
+ frameDocument.$.domain = document.domain;
1433
+
1434
+ var size = '';
1435
+ if ( elementDefinition.size )
1436
+ size = elementDefinition.size - ( CKEDITOR.env.ie ? 7 : 0 ); // "Browse" button is bigger in IE.
1437
+
1438
+ frameDocument.$.write( [ '<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
1439
+ '<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="',
1440
+ CKEDITOR.tools.htmlEncode( elementDefinition.action ),
1441
+ '">',
1442
+ '<input type="file" name="',
1443
+ CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ),
1444
+ '" size="',
1445
+ CKEDITOR.tools.htmlEncode( size > 0 ? size : "" ),
1446
+ '" />',
1447
+ '</form>',
1448
+ '</body></html>',
1449
+ '<script>window.parent.CKEDITOR.tools.callFunction(' + callNumber + ');',
1450
+ 'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}</script>' ].join( '' ) );
1451
+
1452
+ frameDocument.$.close();
1453
+
1454
+ for ( var i = 0 ; i < buttons.length ; i++ )
1455
+ buttons[i].enable();
1456
+ }
1457
+
1458
+ // #3465: Wait for the browser to finish rendering the dialog first.
1459
+ if ( CKEDITOR.env.gecko )
1460
+ setTimeout( generateFormField, 500 );
1461
+ else
1462
+ generateFormField();
1463
+ },
1464
+
1465
+ getValue : function()
1466
+ {
1467
+ return this.getInputElement().$.value || '';
1468
+ },
1469
+
1470
+ /***
1471
+ * The default value of input type="file" is an empty string, but during initialization
1472
+ * of this UI element, the iframe still isn't ready so it can't be read from that object
1473
+ * Setting it manually prevents later issues about the current value ("") being different
1474
+ * of the initial value (undefined as it asked for .value of a div)
1475
+ */
1476
+ setInitValue : function()
1477
+ {
1478
+ this._.initValue = '';
1479
+ },
1480
+
1481
+ /**
1482
+ * Defines the onChange event for UI element definitions.
1483
+ * @field
1484
+ * @type Object
1485
+ * @example
1486
+ */
1487
+ eventProcessors :
1488
+ {
1489
+ onChange : function( dialog, func )
1490
+ {
1491
+ // If this method is called several times (I'm not sure about how this can happen but the default
1492
+ // onChange processor includes this protection)
1493
+ // In order to reapply to the new element, the property is deleted at the beggining of the registerEvents method
1494
+ if ( !this._.domOnChangeRegistered )
1495
+ {
1496
+ // By listening for the formLoaded event, this handler will get reapplied when a new
1497
+ // form is created
1498
+ this.on( 'formLoaded', function()
1499
+ {
1500
+ this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this );
1501
+ }, this );
1502
+ this._.domOnChangeRegistered = true;
1503
+ }
1504
+
1505
+ this.on( 'change', func );
1506
+ }
1507
+ },
1508
+
1509
+ keyboardFocusable : true
1510
+ }, true );
1511
+
1512
+ CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button;
1513
+
1514
+ CKEDITOR.ui.dialog.fieldset.prototype = CKEDITOR.tools.clone( CKEDITOR.ui.dialog.hbox.prototype );
1515
+
1516
+ CKEDITOR.dialog.addUIElement( 'text', textBuilder );
1517
+ CKEDITOR.dialog.addUIElement( 'password', textBuilder );
1518
+ CKEDITOR.dialog.addUIElement( 'textarea', commonBuilder );
1519
+ CKEDITOR.dialog.addUIElement( 'checkbox', commonBuilder );
1520
+ CKEDITOR.dialog.addUIElement( 'radio', commonBuilder );
1521
+ CKEDITOR.dialog.addUIElement( 'button', commonBuilder );
1522
+ CKEDITOR.dialog.addUIElement( 'select', commonBuilder );
1523
+ CKEDITOR.dialog.addUIElement( 'file', commonBuilder );
1524
+ CKEDITOR.dialog.addUIElement( 'fileButton', commonBuilder );
1525
+ CKEDITOR.dialog.addUIElement( 'html', commonBuilder );
1526
+ CKEDITOR.dialog.addUIElement( 'fieldset', containerBuilder );
1527
+ })();
1528
+
1529
+ /**
1530
+ * Fired when the value of the uiElement is changed
1531
+ * @name CKEDITOR.ui.dialog.uiElement#change
1532
+ * @event
1533
+ */
1534
+
1535
+ /**
1536
+ * Fired when the inner frame created by the element is ready.
1537
+ * Each time the button is used or the dialog is loaded a new
1538
+ * form might be created.
1539
+ * @name CKEDITOR.ui.dialog.fileButton#formLoaded
1540
+ * @event
1541
+ */