rails_kindeditor 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/README.rdoc +115 -16
  2. data/app/controllers/kindeditor/assets_controller.rb +119 -42
  3. data/app/uploaders/kindeditor/asset_uploader.rb +68 -0
  4. data/app/uploaders/kindeditor/file_uploader.rb +3 -58
  5. data/app/uploaders/kindeditor/flash_uploader.rb +14 -0
  6. data/app/uploaders/kindeditor/image_uploader.rb +3 -58
  7. data/app/uploaders/kindeditor/media_uploader.rb +14 -0
  8. data/lib/generators/rails_kindeditor/install/install_generator.rb +1 -2
  9. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-init.js +9 -8
  10. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-min.js +158 -0
  11. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/en.js +208 -0
  12. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_CN.js +210 -0
  13. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_TW.js +210 -0
  14. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/clearhtml/clearhtml.js +28 -0
  15. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/code.js +57 -0
  16. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.css +13 -0
  17. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.js +28 -0
  18. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/emoticons.js +129 -0
  19. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{0.gif → images/0.gif} +0 -0
  20. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{1.gif → images/1.gif} +0 -0
  21. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{10.gif → images/10.gif} +0 -0
  22. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{100.gif → images/100.gif} +0 -0
  23. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{101.gif → images/101.gif} +0 -0
  24. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{102.gif → images/102.gif} +0 -0
  25. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{103.gif → images/103.gif} +0 -0
  26. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{104.gif → images/104.gif} +0 -0
  27. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{105.gif → images/105.gif} +0 -0
  28. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{106.gif → images/106.gif} +0 -0
  29. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{107.gif → images/107.gif} +0 -0
  30. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{108.gif → images/108.gif} +0 -0
  31. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{109.gif → images/109.gif} +0 -0
  32. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{11.gif → images/11.gif} +0 -0
  33. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{110.gif → images/110.gif} +0 -0
  34. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{111.gif → images/111.gif} +0 -0
  35. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{112.gif → images/112.gif} +0 -0
  36. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{113.gif → images/113.gif} +0 -0
  37. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{114.gif → images/114.gif} +0 -0
  38. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{115.gif → images/115.gif} +0 -0
  39. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{116.gif → images/116.gif} +0 -0
  40. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{117.gif → images/117.gif} +0 -0
  41. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{118.gif → images/118.gif} +0 -0
  42. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{119.gif → images/119.gif} +0 -0
  43. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{12.gif → images/12.gif} +0 -0
  44. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{120.gif → images/120.gif} +0 -0
  45. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{121.gif → images/121.gif} +0 -0
  46. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{122.gif → images/122.gif} +0 -0
  47. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{123.gif → images/123.gif} +0 -0
  48. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{124.gif → images/124.gif} +0 -0
  49. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{125.gif → images/125.gif} +0 -0
  50. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{126.gif → images/126.gif} +0 -0
  51. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{127.gif → images/127.gif} +0 -0
  52. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{128.gif → images/128.gif} +0 -0
  53. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{129.gif → images/129.gif} +0 -0
  54. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{13.gif → images/13.gif} +0 -0
  55. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{130.gif → images/130.gif} +0 -0
  56. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{131.gif → images/131.gif} +0 -0
  57. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{132.gif → images/132.gif} +0 -0
  58. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{133.gif → images/133.gif} +0 -0
  59. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{134.gif → images/134.gif} +0 -0
  60. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{14.gif → images/14.gif} +0 -0
  61. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{15.gif → images/15.gif} +0 -0
  62. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{16.gif → images/16.gif} +0 -0
  63. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{17.gif → images/17.gif} +0 -0
  64. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{18.gif → images/18.gif} +0 -0
  65. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{19.gif → images/19.gif} +0 -0
  66. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{2.gif → images/2.gif} +0 -0
  67. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{20.gif → images/20.gif} +0 -0
  68. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{21.gif → images/21.gif} +0 -0
  69. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{22.gif → images/22.gif} +0 -0
  70. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{23.gif → images/23.gif} +0 -0
  71. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{24.gif → images/24.gif} +0 -0
  72. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{25.gif → images/25.gif} +0 -0
  73. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{26.gif → images/26.gif} +0 -0
  74. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{27.gif → images/27.gif} +0 -0
  75. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{28.gif → images/28.gif} +0 -0
  76. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{29.gif → images/29.gif} +0 -0
  77. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{3.gif → images/3.gif} +0 -0
  78. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{30.gif → images/30.gif} +0 -0
  79. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{31.gif → images/31.gif} +0 -0
  80. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{32.gif → images/32.gif} +0 -0
  81. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{33.gif → images/33.gif} +0 -0
  82. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{34.gif → images/34.gif} +0 -0
  83. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{35.gif → images/35.gif} +0 -0
  84. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{36.gif → images/36.gif} +0 -0
  85. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{37.gif → images/37.gif} +0 -0
  86. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{38.gif → images/38.gif} +0 -0
  87. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{39.gif → images/39.gif} +0 -0
  88. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{4.gif → images/4.gif} +0 -0
  89. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{40.gif → images/40.gif} +0 -0
  90. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{41.gif → images/41.gif} +0 -0
  91. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{42.gif → images/42.gif} +0 -0
  92. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{43.gif → images/43.gif} +0 -0
  93. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{44.gif → images/44.gif} +0 -0
  94. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{45.gif → images/45.gif} +0 -0
  95. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{46.gif → images/46.gif} +0 -0
  96. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{47.gif → images/47.gif} +0 -0
  97. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{48.gif → images/48.gif} +0 -0
  98. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{49.gif → images/49.gif} +0 -0
  99. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{5.gif → images/5.gif} +0 -0
  100. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{50.gif → images/50.gif} +0 -0
  101. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{51.gif → images/51.gif} +0 -0
  102. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{52.gif → images/52.gif} +0 -0
  103. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{53.gif → images/53.gif} +0 -0
  104. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{54.gif → images/54.gif} +0 -0
  105. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{55.gif → images/55.gif} +0 -0
  106. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{56.gif → images/56.gif} +0 -0
  107. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{57.gif → images/57.gif} +0 -0
  108. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{58.gif → images/58.gif} +0 -0
  109. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{59.gif → images/59.gif} +0 -0
  110. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{6.gif → images/6.gif} +0 -0
  111. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{60.gif → images/60.gif} +0 -0
  112. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{61.gif → images/61.gif} +0 -0
  113. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{62.gif → images/62.gif} +0 -0
  114. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{63.gif → images/63.gif} +0 -0
  115. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{64.gif → images/64.gif} +0 -0
  116. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{65.gif → images/65.gif} +0 -0
  117. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{66.gif → images/66.gif} +0 -0
  118. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{67.gif → images/67.gif} +0 -0
  119. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{68.gif → images/68.gif} +0 -0
  120. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{69.gif → images/69.gif} +0 -0
  121. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{7.gif → images/7.gif} +0 -0
  122. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{70.gif → images/70.gif} +0 -0
  123. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{71.gif → images/71.gif} +0 -0
  124. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{72.gif → images/72.gif} +0 -0
  125. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{73.gif → images/73.gif} +0 -0
  126. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{74.gif → images/74.gif} +0 -0
  127. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{75.gif → images/75.gif} +0 -0
  128. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{76.gif → images/76.gif} +0 -0
  129. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{77.gif → images/77.gif} +0 -0
  130. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{78.gif → images/78.gif} +0 -0
  131. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{79.gif → images/79.gif} +0 -0
  132. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{8.gif → images/8.gif} +0 -0
  133. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{80.gif → images/80.gif} +0 -0
  134. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{81.gif → images/81.gif} +0 -0
  135. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{82.gif → images/82.gif} +0 -0
  136. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{83.gif → images/83.gif} +0 -0
  137. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{84.gif → images/84.gif} +0 -0
  138. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{85.gif → images/85.gif} +0 -0
  139. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{86.gif → images/86.gif} +0 -0
  140. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{87.gif → images/87.gif} +0 -0
  141. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{88.gif → images/88.gif} +0 -0
  142. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{89.gif → images/89.gif} +0 -0
  143. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{9.gif → images/9.gif} +0 -0
  144. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{90.gif → images/90.gif} +0 -0
  145. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{91.gif → images/91.gif} +0 -0
  146. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{92.gif → images/92.gif} +0 -0
  147. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{93.gif → images/93.gif} +0 -0
  148. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{94.gif → images/94.gif} +0 -0
  149. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{95.gif → images/95.gif} +0 -0
  150. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{96.gif → images/96.gif} +0 -0
  151. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{97.gif → images/97.gif} +0 -0
  152. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{98.gif → images/98.gif} +0 -0
  153. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{99.gif → images/99.gif} +0 -0
  154. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{qq.gif → images/static.gif} +0 -0
  155. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js +189 -0
  156. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-16.gif +0 -0
  157. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-64.gif +0 -0
  158. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-16.gif +0 -0
  159. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-64.gif +0 -0
  160. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/go-up.gif +0 -0
  161. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash/flash.js +128 -0
  162. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.js +226 -0
  163. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js +104 -0
  164. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/lineheight/lineheight.js +38 -0
  165. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.js +59 -0
  166. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.html +57 -0
  167. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.js +135 -0
  168. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media/media.js +136 -0
  169. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/pagebreak/pagebreak.js +26 -0
  170. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
  171. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/preview/preview.js +31 -0
  172. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/quickformat/quickformat.js +71 -0
  173. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/table/table.js +661 -0
  174. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/1.html +14 -0
  175. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/2.html +42 -0
  176. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/3.html +36 -0
  177. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/template.js +58 -0
  178. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste/wordpaste.js +57 -0
  179. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/blank.gif +0 -0
  180. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/flash.gif +0 -0
  181. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/loading.gif +0 -0
  182. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/media.gif +0 -0
  183. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/rm.gif +0 -0
  184. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/default/bg.gif +0 -0
  185. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes/default}/default.css +427 -396
  186. data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.gif +0 -0
  187. data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/simple/simple.css +148 -0
  188. data/lib/generators/rails_kindeditor/migration/migration_generator.rb +16 -3
  189. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/asset.rb +2 -5
  190. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/file.rb +1 -2
  191. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
  192. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/image.rb +1 -2
  193. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
  194. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +20 -0
  195. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
  196. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
  197. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
  198. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
  199. data/lib/rails_kindeditor/helper.rb +14 -2
  200. data/lib/rails_kindeditor/version.rb +1 -1
  201. data/rails_kindeditor.gemspec +3 -3
  202. metadata +199 -182
  203. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor.js +0 -4688
  204. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/about.html +0 -52
  205. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/accessory.html +0 -74
  206. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/advtable.html +0 -235
  207. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/cell.html +0 -201
  208. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.css +0 -64
  209. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.html +0 -31
  210. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.js +0 -221
  211. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash.html +0 -69
  212. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.html +0 -305
  213. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.html +0 -82
  214. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media.html +0 -73
  215. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste.html +0 -44
  216. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste.html +0 -50
  217. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/doc.gif +0 -0
  218. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/editor.css +0 -47
  219. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/mp3.gif +0 -0
  220. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/pdf.gif +0 -0
  221. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rar.gif +0 -0
  222. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/xls.gif +0 -0
  223. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/default.gif +0 -0
@@ -0,0 +1,38 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('lineheight', function(K) {
11
+ var self = this, name = 'lineheight', lang = self.lang(name + '.');
12
+ self.clickToolbar(name, function() {
13
+ var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'});
14
+ if (commonNode) {
15
+ curVal = commonNode.css('line-height');
16
+ }
17
+ var menu = self.createMenu({
18
+ name : name,
19
+ width : 150
20
+ });
21
+ K.each(lang.lineHeight, function(i, row) {
22
+ K.each(row, function(key, val) {
23
+ menu.addItem({
24
+ title : val,
25
+ checked : curVal === key,
26
+ click : function() {
27
+ self.cmd.toggle('<span style="line-height:' + key + ';"></span>', {
28
+ span : '.line-height=' + key
29
+ });
30
+ self.updateState();
31
+ self.addBookmark();
32
+ self.hideMenu();
33
+ }
34
+ });
35
+ });
36
+ });
37
+ });
38
+ });
@@ -0,0 +1,59 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('link', function(K) {
11
+ var self = this, name = 'link';
12
+ self.plugin.link = {
13
+ edit : function() {
14
+ var lang = self.lang(name + '.'),
15
+ html = '<div style="padding:10px 20px;">' +
16
+ //url
17
+ '<div class="ke-dialog-row">' +
18
+ '<label for="keUrl">' + lang.url + '</label>' +
19
+ '<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:90%;" /></div>' +
20
+ //type
21
+ '<div class="ke-dialog-row"">' +
22
+ '<label for="keType">' + lang.linkType + '</label>' +
23
+ '<select id="keType" name="type"></select>' +
24
+ '</div>' +
25
+ '</div>',
26
+ dialog = self.createDialog({
27
+ name : name,
28
+ width : 400,
29
+ title : self.lang(name),
30
+ body : html,
31
+ yesBtn : {
32
+ name : self.lang('yes'),
33
+ click : function(e) {
34
+ self.exec('createlink', urlBox.val(), typeBox.val()).hideDialog().focus();
35
+ }
36
+ }
37
+ }),
38
+ div = dialog.div,
39
+ urlBox = K('input[name="url"]', div),
40
+ typeBox = K('select[name="type"]', div);
41
+ urlBox.val('http://');
42
+ typeBox[0].options[0] = new Option(lang.newWindow, '_blank');
43
+ typeBox[0].options[1] = new Option(lang.selfWindow, '');
44
+ var a = self.plugin.getSelectedLink();
45
+ if (a) {
46
+ self.cmd.range.selectNode(a[0]);
47
+ self.cmd.select();
48
+ urlBox.val(a.attr('data-ke-src'));
49
+ typeBox.val(a.attr('target'));
50
+ }
51
+ urlBox[0].focus();
52
+ urlBox[0].select();
53
+ },
54
+ 'delete' : function() {
55
+ self.exec('unlink', null);
56
+ }
57
+ };
58
+ self.clickToolbar(name, self.plugin.link.edit);
59
+ });
@@ -0,0 +1,57 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
5
+ <style>
6
+ html { height: 100% }
7
+ body { height: 100%; margin: 0; padding: 0; background-color: #FFF }
8
+ #map_canvas { height: 100% }
9
+ </style>
10
+ <script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=zh_CN"></script>
11
+ <script>
12
+ var map, geocoder;
13
+ function initialize() {
14
+ var latlng = new google.maps.LatLng(31.230393, 121.473704);
15
+ var options = {
16
+ zoom: 11,
17
+ center: latlng,
18
+ disableDefaultUI: true,
19
+ panControl: true,
20
+ zoomControl: true,
21
+ mapTypeControl: true,
22
+ scaleControl: true,
23
+ streetViewControl: false,
24
+ overviewMapControl: true,
25
+ mapTypeId: google.maps.MapTypeId.ROADMAP
26
+ };
27
+ map = new google.maps.Map(document.getElementById("map_canvas"), options);
28
+ geocoder = new google.maps.Geocoder();
29
+ geocoder.geocode({latLng: latlng}, function(results, status) {
30
+ if (status == google.maps.GeocoderStatus.OK) {
31
+ if (results[3]) {
32
+ parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address;
33
+ }
34
+ }
35
+ });
36
+ }
37
+ function search(address) {
38
+ if (!map) return;
39
+ geocoder.geocode({address : address}, function(results, status) {
40
+ if (status == google.maps.GeocoderStatus.OK) {
41
+ map.setZoom(11);
42
+ map.setCenter(results[0].geometry.location);
43
+ var marker = new google.maps.Marker({
44
+ map: map,
45
+ position: results[0].geometry.location
46
+ });
47
+ } else {
48
+ alert("Invalid address: " + address);
49
+ }
50
+ });
51
+ }
52
+ </script>
53
+ </head>
54
+ <body onload="initialize();">
55
+ <div id="map_canvas" style="width:100%; height:100%"></div>
56
+ </body>
57
+ </html>
@@ -0,0 +1,135 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ // Google Maps: http://code.google.com/apis/maps/index.html
11
+
12
+ KindEditor.plugin('map', function(K) {
13
+ var self = this, name = 'map', lang = self.lang(name + '.');
14
+ self.clickToolbar(name, function() {
15
+ var html = ['<div style="padding:10px 20px;">',
16
+ '<div class="ke-dialog-row">',
17
+ lang.address + ' <input id="kindeditor_plugin_map_address" name="address" class="ke-input-text" value="" style="width:200px;" /> ',
18
+ '<span class="ke-button-common ke-button-outer">',
19
+ '<input type="button" name="searchBtn" class="ke-button-common ke-button" value="' + lang.search + '" />',
20
+ '</span>',
21
+ '</div>',
22
+ '<div class="ke-map" style="width:558px;height:360px;"></div>',
23
+ '</div>'].join('');
24
+ var dialog = self.createDialog({
25
+ name : name,
26
+ width : 600,
27
+ title : self.lang(name),
28
+ body : html,
29
+ yesBtn : {
30
+ name : self.lang('yes'),
31
+ click : function(e) {
32
+ var geocoder = win.geocoder,
33
+ map = win.map,
34
+ center = map.getCenter().lat() + ',' + map.getCenter().lng(),
35
+ zoom = map.getZoom(),
36
+ maptype = map.getMapTypeId(),
37
+ url = 'http://maps.googleapis.com/maps/api/staticmap';
38
+ url += '?center=' + encodeURIComponent(center);
39
+ url += '&zoom=' + encodeURIComponent(zoom);
40
+ url += '&size=558x360';
41
+ url += '&maptype=' + encodeURIComponent(maptype);
42
+ url += '&markers=' + encodeURIComponent(center);
43
+ url += '&language=' + self.langType;
44
+ url += '&sensor=false';
45
+ self.exec('insertimage', url).hideDialog().focus();
46
+ }
47
+ },
48
+ beforeRemove : function() {
49
+ searchBtn.remove();
50
+ doc.write('');
51
+ iframe.remove();
52
+ }
53
+ });
54
+ var div = dialog.div,
55
+ addressBox = K('[name="address"]', div),
56
+ searchBtn = K('[name="searchBtn"]', div),
57
+ win, doc;
58
+ var iframeHtml = ['<!doctype html><html><head>',
59
+ '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />',
60
+ '<style>',
61
+ ' html { height: 100% }',
62
+ ' body { height: 100%; margin: 0; padding: 0; background-color: #FFF }',
63
+ ' #map_canvas { height: 100% }',
64
+ '</style>',
65
+ '<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=' + self.langType + '"></script>',
66
+ '<script>',
67
+ 'var map, geocoder;',
68
+ 'function initialize() {',
69
+ ' var latlng = new google.maps.LatLng(31.230393, 121.473704);',
70
+ ' var options = {',
71
+ ' zoom: 11,',
72
+ ' center: latlng,',
73
+ ' disableDefaultUI: true,',
74
+ ' panControl: true,',
75
+ ' zoomControl: true,',
76
+ ' mapTypeControl: true,',
77
+ ' scaleControl: true,',
78
+ ' streetViewControl: false,',
79
+ ' overviewMapControl: true,',
80
+ ' mapTypeId: google.maps.MapTypeId.ROADMAP',
81
+ ' };',
82
+ ' map = new google.maps.Map(document.getElementById("map_canvas"), options);',
83
+ ' geocoder = new google.maps.Geocoder();',
84
+ ' geocoder.geocode({latLng: latlng}, function(results, status) {',
85
+ ' if (status == google.maps.GeocoderStatus.OK) {',
86
+ ' if (results[3]) {',
87
+ ' parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address;',
88
+ ' }',
89
+ ' }',
90
+ ' });',
91
+ '}',
92
+ 'function search(address) {',
93
+ ' if (!map) return;',
94
+ ' geocoder.geocode({address : address}, function(results, status) {',
95
+ ' if (status == google.maps.GeocoderStatus.OK) {',
96
+ ' map.setZoom(11);',
97
+ ' map.setCenter(results[0].geometry.location);',
98
+ ' var marker = new google.maps.Marker({',
99
+ ' map: map,',
100
+ ' position: results[0].geometry.location',
101
+ ' });',
102
+ ' } else {',
103
+ ' alert("Invalid address: " + address);',
104
+ ' }',
105
+ ' });',
106
+ '}',
107
+ '</script>',
108
+ '</head>',
109
+ '<body onload="initialize();">',
110
+ '<div id="map_canvas" style="width:100%; height:100%"></div>',
111
+ '</body></html>'].join('\n');
112
+ // TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式
113
+ var iframe = K('<iframe class="ke-textarea" frameborder="0" src="' + self.pluginsPath + 'map/map.html" style="width:558px;height:360px;"></iframe>');
114
+ function ready() {
115
+ win = iframe[0].contentWindow;
116
+ doc = K.iframeDoc(iframe);
117
+ //doc.open();
118
+ //doc.write(iframeHtml);
119
+ //doc.close();
120
+ }
121
+ iframe.bind('load', function() {
122
+ iframe.unbind('load');
123
+ if (K.IE) {
124
+ ready();
125
+ } else {
126
+ setTimeout(ready, 0);
127
+ }
128
+ });
129
+ K('.ke-map', div).replaceWith(iframe);
130
+ // search map
131
+ searchBtn.click(function() {
132
+ win.search(addressBox.val());
133
+ });
134
+ });
135
+ });
@@ -0,0 +1,136 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('media', function(K) {
11
+ var self = this, name = 'media', lang = self.lang(name + '.'),
12
+ allowMediaUpload = K.undef(self.allowMediaUpload, true),
13
+ allowFileManager = K.undef(self.allowFileManager, false),
14
+ uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
15
+ self.plugin.media = {
16
+ edit : function() {
17
+ var html = [
18
+ '<div style="padding:10px 20px;">',
19
+ //url
20
+ '<div class="ke-dialog-row">',
21
+ '<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
22
+ '<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> &nbsp;',
23
+ '<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> &nbsp;',
24
+ '<span class="ke-button-common ke-button-outer">',
25
+ '<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
26
+ '</span>',
27
+ '</div>',
28
+ //width
29
+ '<div class="ke-dialog-row">',
30
+ '<label for="keWidth" style="width:60px;">' + lang.width + '</label>',
31
+ '<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" />',
32
+ '</div>',
33
+ //height
34
+ '<div class="ke-dialog-row">',
35
+ '<label for="keHeight" style="width:60px;">' + lang.height + '</label>',
36
+ '<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" />',
37
+ '</div>',
38
+ //autostart
39
+ '<div class="ke-dialog-row">',
40
+ '<label for="keAutostart">' + lang.autostart + '</label>',
41
+ '<input type="checkbox" id="keAutostart" name="autostart" value="" /> ',
42
+ '</div>',
43
+ '</div>'
44
+ ].join('');
45
+ var dialog = self.createDialog({
46
+ name : name,
47
+ width : 450,
48
+ height : 230,
49
+ title : self.lang(name),
50
+ body : html,
51
+ yesBtn : {
52
+ name : self.lang('yes'),
53
+ click : function(e) {
54
+ var url = urlBox.val(),
55
+ html = K.mediaImg(self.themesPath + 'common/blank.gif', {
56
+ src : url,
57
+ type : K.mediaType(url),
58
+ width : widthBox.val(),
59
+ height : heightBox.val(),
60
+ autostart : autostartBox[0].checked ? 'true' : 'false',
61
+ loop : 'true'
62
+ });
63
+ self.insertHtml(html).hideDialog().focus();
64
+ }
65
+ }
66
+ }),
67
+ div = dialog.div,
68
+ urlBox = K('[name="url"]', div),
69
+ viewServerBtn = K('[name="viewServer"]', div),
70
+ widthBox = K('[name="width"]', div),
71
+ heightBox = K('[name="height"]', div),
72
+ autostartBox = K('[name="autostart"]', div);
73
+ urlBox.val('http://');
74
+
75
+ if (allowMediaUpload) {
76
+ var uploadbutton = K.uploadbutton({
77
+ button : K('.ke-upload-button', div)[0],
78
+ fieldName : 'imgFile',
79
+ url : uploadJson + '?dir=media',
80
+ afterUpload : function(data) {
81
+ if (data.error === 0) {
82
+ var url = K.formatUrl(data.url, 'absolute');
83
+ urlBox.val(url);
84
+ if (self.afterUpload) {
85
+ self.afterUpload.call(self, url);
86
+ }
87
+ alert(self.lang('uploadSuccess'));
88
+ } else {
89
+ alert(data.message);
90
+ }
91
+ }
92
+ });
93
+ uploadbutton.fileBox.change(function(e) {
94
+ uploadbutton.submit();
95
+ });
96
+ } else {
97
+ K('.ke-upload-button', div).hide();
98
+ urlBox.width(250);
99
+ }
100
+
101
+ if (allowFileManager) {
102
+ viewServerBtn.click(function(e) {
103
+ self.loadPlugin('filemanager', function() {
104
+ self.plugin.filemanagerDialog({
105
+ viewType : 'LIST',
106
+ dirName : 'media',
107
+ clickFn : function(url, title) {
108
+ if (self.dialogs.length > 1) {
109
+ K('[name="url"]', div).val(url);
110
+ self.hideDialog();
111
+ }
112
+ }
113
+ });
114
+ });
115
+ });
116
+ } else {
117
+ viewServerBtn.hide();
118
+ }
119
+
120
+ var img = self.plugin.getSelectedMedia();
121
+ if (img) {
122
+ var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
123
+ urlBox.val(attrs.src);
124
+ widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
125
+ heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
126
+ autostartBox[0].checked = (attrs.autostart === 'true');
127
+ }
128
+ urlBox[0].focus();
129
+ urlBox[0].select();
130
+ },
131
+ 'delete' : function() {
132
+ self.plugin.getSelectedMedia().remove();
133
+ }
134
+ };
135
+ self.clickToolbar(name, self.plugin.media.edit);
136
+ });
@@ -0,0 +1,26 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('pagebreak', function(K) {
11
+ var self = this, name = 'pagebreak';
12
+ self.clickToolbar(name, function() {
13
+ var cmd = self.cmd, range = cmd.range;
14
+ self.focus();
15
+ range.enlarge(true);
16
+ cmd.split(true);
17
+ var tail = self.newlineTag == 'br' ? '' : '<p id="__kindeditor_tail_tag__"></p>';
18
+ self.insertHtml('<hr class="ke-pagebreak" style="page-break-after: always;" />' + tail);
19
+ if (self.newlineTag != 'br') {
20
+ var p = K('#__kindeditor_tail_tag__', self.edit.doc);
21
+ range.selectNodeContents(p[0]);
22
+ p.removeAttr('id');
23
+ cmd.select();
24
+ }
25
+ });
26
+ });
@@ -0,0 +1,41 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('plainpaste', function(K) {
11
+ var self = this, name = 'plainpaste';
12
+ self.clickToolbar(name, function() {
13
+ var lang = self.lang(name + '.'),
14
+ html = '<div style="padding:10px 20px;">' +
15
+ '<div style="margin-bottom:10px;">' + lang.comment + '</div>' +
16
+ '<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>' +
17
+ '</div>',
18
+ dialog = self.createDialog({
19
+ name : name,
20
+ width : 450,
21
+ title : self.lang(name),
22
+ body : html,
23
+ yesBtn : {
24
+ name : self.lang('yes'),
25
+ click : function(e) {
26
+ var html = textarea.val();
27
+ html = K.escape(html);
28
+ html = html.replace(/ /g, '&nbsp;');
29
+ if (self.newlineTag == 'p') {
30
+ html = html.replace(/^/, '<p>').replace(/$/, '</p>').replace(/\n/g, '</p><p>');
31
+ } else {
32
+ html = html.replace(/\n/g, '<br />$&');
33
+ }
34
+ self.insertHtml(html).hideDialog().focus();
35
+ }
36
+ }
37
+ }),
38
+ textarea = K('textarea', dialog.div);
39
+ textarea[0].focus();
40
+ });
41
+ });
@@ -0,0 +1,31 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('preview', function(K) {
11
+ var self = this, name = 'preview', undefined;
12
+ self.clickToolbar(name, function() {
13
+ var lang = self.lang(name + '.'),
14
+ html = '<div style="padding:10px 20px;">' +
15
+ '<iframe class="ke-textarea" frameborder="0" style="width:708px;height:400px;"></iframe>' +
16
+ '</div>',
17
+ dialog = self.createDialog({
18
+ name : name,
19
+ width : 750,
20
+ title : self.lang(name),
21
+ body : html
22
+ }),
23
+ iframe = K('iframe', dialog.div),
24
+ doc = K.iframeDoc(iframe);
25
+ doc.open();
26
+ doc.write(self.fullHtml());
27
+ doc.close();
28
+ K(doc.body).css('background-color', '#FFF');
29
+ iframe[0].contentWindow.focus();
30
+ });
31
+ });
@@ -0,0 +1,71 @@
1
+ /*******************************************************************************
2
+ * KindEditor - WYSIWYG HTML Editor for Internet
3
+ * Copyright (C) 2006-2011 kindsoft.net
4
+ *
5
+ * @author Roddy <luolonghao@gmail.com>
6
+ * @site http://www.kindsoft.net/
7
+ * @licence http://www.kindsoft.net/license.php
8
+ *******************************************************************************/
9
+
10
+ KindEditor.plugin('quickformat', function(K) {
11
+ var self = this, name = 'quickformat',
12
+ blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p');
13
+ self.clickToolbar(name, function() {
14
+ self.focus();
15
+ var doc = self.edit.doc,
16
+ range = self.cmd.range,
17
+ child = K(doc.body).first(), next,
18
+ nodeList = [], subList = [],
19
+ bookmark = range.createBookmark(true);
20
+ while(child) {
21
+ next = child.next();
22
+ if (blockMap[child.name]) {
23
+ child.html(child.html().replace(/^(\s|&nbsp;| )+/ig, ''));
24
+ child.css('text-indent', '2em');
25
+ } else {
26
+ subList.push(child);
27
+ }
28
+ if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) {
29
+ if (subList.length > 0) {
30
+ nodeList.push(subList);
31
+ }
32
+ subList = [];
33
+ }
34
+ child = next;
35
+ }
36
+ K.each(nodeList, function(i, subList) {
37
+ var wrapper = K('<p style="text-indent:2em;"></p>', doc);
38
+ subList[0].before(wrapper);
39
+ K.each(subList, function(i, knode) {
40
+ wrapper.append(knode);
41
+ });
42
+ });
43
+ range.moveToBookmark(bookmark);
44
+ self.addBookmark();
45
+ });
46
+ });
47
+
48
+ /**
49
+ --------------------------
50
+ abcd<br />
51
+ 1234<br />
52
+
53
+ to
54
+
55
+ <p style="text-indent:2em;">
56
+ abcd<br />
57
+ 1234<br />
58
+ </p>
59
+
60
+ --------------------------
61
+
62
+ &nbsp; abcd<img>1233
63
+ <p>1234</p>
64
+
65
+ to
66
+
67
+ <p style="text-indent:2em;">abcd<img>1233</p>
68
+ <p style="text-indent:2em;">1234</p>
69
+
70
+ --------------------------
71
+ */