ueditor_rails4 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.markdown +45 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/ueditor/themes/default/anchor.gif +0 -0
  6. data/app/assets/images/ueditor/themes/default/arrow.png +0 -0
  7. data/app/assets/images/ueditor/themes/default/button-bg.gif +0 -0
  8. data/app/assets/images/ueditor/themes/default/cancelbutton.gif +0 -0
  9. data/app/assets/images/ueditor/themes/default/cursor_h.gif +0 -0
  10. data/app/assets/images/ueditor/themes/default/cursor_h.png +0 -0
  11. data/app/assets/images/ueditor/themes/default/cursor_v.gif +0 -0
  12. data/app/assets/images/ueditor/themes/default/cursor_v.png +0 -0
  13. data/app/assets/images/ueditor/themes/default/dialog-title-bg.png +0 -0
  14. data/app/assets/images/ueditor/themes/default/filescan.png +0 -0
  15. data/app/assets/images/ueditor/themes/default/highlighted.gif +0 -0
  16. data/app/assets/images/ueditor/themes/default/icons-all.gif +0 -0
  17. data/app/assets/images/ueditor/themes/default/icons.gif +0 -0
  18. data/app/assets/images/ueditor/themes/default/icons.png +0 -0
  19. data/app/assets/images/ueditor/themes/default/lock.gif +0 -0
  20. data/app/assets/images/ueditor/themes/default/neweditor-tab-bg.png +0 -0
  21. data/app/assets/images/ueditor/themes/default/pagebreak.gif +0 -0
  22. data/app/assets/images/ueditor/themes/default/scale.png +0 -0
  23. data/app/assets/images/ueditor/themes/default/spacer.gif +0 -0
  24. data/app/assets/images/ueditor/themes/default/sparator_v.png +0 -0
  25. data/app/assets/images/ueditor/themes/default/toolbar_bg.png +0 -0
  26. data/app/assets/images/ueditor/themes/default/unhighlighted.gif +0 -0
  27. data/app/assets/images/ueditor/themes/default/upload.png +0 -0
  28. data/app/assets/images/ueditor/themes/default/videologo.gif +0 -0
  29. data/app/assets/images/ueditor/themes/default/word.gif +0 -0
  30. data/app/assets/images/ueditor/themes/default/wordpaste.png +0 -0
  31. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  32. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  33. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  34. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  35. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  36. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  37. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  38. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  39. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  40. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  41. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  42. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  43. data/app/assets/images/ueditor_rails/dialogs/image/center_focus.jpg +0 -0
  44. data/app/assets/images/ueditor_rails/dialogs/image/left_focus.jpg +0 -0
  45. data/app/assets/images/ueditor_rails/dialogs/image/none_focus.jpg +0 -0
  46. data/app/assets/images/ueditor_rails/dialogs/image/right_focus.jpg +0 -0
  47. data/app/assets/images/ueditor_rails/dialogs/scrawl/addimg.png +0 -0
  48. data/app/assets/images/ueditor_rails/dialogs/scrawl/brush.png +0 -0
  49. data/app/assets/images/ueditor_rails/dialogs/scrawl/delimg.png +0 -0
  50. data/app/assets/images/ueditor_rails/dialogs/scrawl/delimgH.png +0 -0
  51. data/app/assets/images/ueditor_rails/dialogs/scrawl/empty.png +0 -0
  52. data/app/assets/images/ueditor_rails/dialogs/scrawl/emptyH.png +0 -0
  53. data/app/assets/images/ueditor_rails/dialogs/scrawl/eraser.png +0 -0
  54. data/app/assets/images/ueditor_rails/dialogs/scrawl/redo.png +0 -0
  55. data/app/assets/images/ueditor_rails/dialogs/scrawl/redoH.png +0 -0
  56. data/app/assets/images/ueditor_rails/dialogs/scrawl/scale.png +0 -0
  57. data/app/assets/images/ueditor_rails/dialogs/scrawl/scaleH.png +0 -0
  58. data/app/assets/images/ueditor_rails/dialogs/scrawl/size.png +0 -0
  59. data/app/assets/images/ueditor_rails/dialogs/scrawl/undo.png +0 -0
  60. data/app/assets/images/ueditor_rails/dialogs/scrawl/undoH.png +0 -0
  61. data/app/assets/javascripts/ueditor_rails/_config.js.erb +211 -0
  62. data/app/assets/javascripts/ueditor_rails/dialogs/attachment.js +5 -0
  63. data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_callbacks.js +166 -0
  64. data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_file_type_maps.js.erb +14 -0
  65. data/app/assets/javascripts/ueditor_rails/dialogs/image.js.erb +724 -0
  66. data/app/assets/javascripts/ueditor_rails/dialogs/scrawl.js +655 -0
  67. data/app/assets/javascripts/ueditor_rails/dialogs/wordimage.js +154 -0
  68. data/app/assets/javascripts/ueditor_rails/init.js +12 -0
  69. data/app/assets/stylesheets/ueditor/themes/default/dialogbase.css.erb +100 -0
  70. data/app/assets/stylesheets/ueditor/themes/default/ueditor.css +1582 -0
  71. data/app/assets/stylesheets/ueditor/themes/iframe.css +1 -0
  72. data/app/assets/stylesheets/ueditor_rails/dialogs/attachment.css.erb +161 -0
  73. data/app/assets/stylesheets/ueditor_rails/dialogs/image.css.erb +69 -0
  74. data/app/assets/stylesheets/ueditor_rails/dialogs/scrawl.css.erb +72 -0
  75. data/app/controllers/ueditor_rails/application_controller.rb +5 -0
  76. data/app/controllers/ueditor_rails/dialogs_controller.rb +21 -0
  77. data/app/controllers/ueditor_rails/libs_controller.rb +33 -0
  78. data/app/helpers/ueditor_rails/application_helper.rb +27 -0
  79. data/app/views/ueditor_rails/dialogs/attachment.html.erb +124 -0
  80. data/app/views/ueditor_rails/dialogs/image.html.erb +203 -0
  81. data/app/views/ueditor_rails/dialogs/scrawl.html.erb +96 -0
  82. data/app/views/ueditor_rails/dialogs/wordimage.html.erb +155 -0
  83. data/config/routes.rb +11 -0
  84. data/lib/generators/ueditor_rails/USAGE +8 -0
  85. data/lib/generators/ueditor_rails/install_generator.rb +15 -0
  86. data/lib/generators/ueditor_rails/templates/ueditor_config.js.erb +216 -0
  87. data/lib/tasks/ueditor_rails_tasks.rake +4 -0
  88. data/lib/ueditor_rails/engine.rb +17 -0
  89. data/lib/ueditor_rails/helpers/form_builder.rb +11 -0
  90. data/lib/ueditor_rails/helpers/form_helper.rb +37 -0
  91. data/lib/ueditor_rails/helpers/view_helper.rb +21 -0
  92. data/lib/ueditor_rails/util.rb +42 -0
  93. data/lib/ueditor_rails/version.rb +3 -0
  94. data/lib/ueditor_rails4.rb +32 -0
  95. data/test/dummy/README.rdoc +261 -0
  96. data/test/dummy/Rakefile +7 -0
  97. data/test/dummy/app/assets/javascripts/application.js +16 -0
  98. data/test/dummy/app/assets/javascripts/posts.js +2 -0
  99. data/test/dummy/app/assets/javascripts/ueditor_config.js.erb +208 -0
  100. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  101. data/test/dummy/app/assets/stylesheets/posts.css +4 -0
  102. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  103. data/test/dummy/app/controllers/application_controller.rb +3 -0
  104. data/test/dummy/app/controllers/posts_controller.rb +83 -0
  105. data/test/dummy/app/helpers/application_helper.rb +2 -0
  106. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  107. data/test/dummy/app/models/post.rb +3 -0
  108. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  109. data/test/dummy/app/views/posts/_form.html.erb +25 -0
  110. data/test/dummy/app/views/posts/edit.html.erb +6 -0
  111. data/test/dummy/app/views/posts/index.html.erb +29 -0
  112. data/test/dummy/app/views/posts/new.html.erb +5 -0
  113. data/test/dummy/app/views/posts/show.html.erb +14 -0
  114. data/test/dummy/config.ru +4 -0
  115. data/test/dummy/config/application.rb +61 -0
  116. data/test/dummy/config/boot.rb +10 -0
  117. data/test/dummy/config/database.yml +25 -0
  118. data/test/dummy/config/environment.rb +5 -0
  119. data/test/dummy/config/environments/development.rb +37 -0
  120. data/test/dummy/config/environments/production.rb +67 -0
  121. data/test/dummy/config/environments/test.rb +37 -0
  122. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  123. data/test/dummy/config/initializers/inflections.rb +15 -0
  124. data/test/dummy/config/initializers/mime_types.rb +5 -0
  125. data/test/dummy/config/initializers/secret_token.rb +7 -0
  126. data/test/dummy/config/initializers/session_store.rb +8 -0
  127. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/test/dummy/config/locales/en.yml +5 -0
  129. data/test/dummy/config/routes.rb +8 -0
  130. data/test/dummy/db/migrate/20130327173045_create_posts.rb +10 -0
  131. data/test/dummy/db/schema.rb +23 -0
  132. data/test/dummy/public/404.html +26 -0
  133. data/test/dummy/public/422.html +26 -0
  134. data/test/dummy/public/500.html +25 -0
  135. data/test/dummy/public/favicon.ico +0 -0
  136. data/test/dummy/script/rails +6 -0
  137. data/test/dummy/test/fixtures/posts.yml +9 -0
  138. data/test/dummy/test/functional/posts_controller_test.rb +49 -0
  139. data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
  140. data/test/dummy/test/unit/post_test.rb +7 -0
  141. data/test/functional/ueditor_rails/dialogs_controller_test.rb +16 -0
  142. data/test/functional/ueditor_rails/libs_controller_test.rb +21 -0
  143. data/test/integration/navigation_test.rb +10 -0
  144. data/test/test_helper.rb +15 -0
  145. data/test/ueditor_rails_test.rb +7 -0
  146. data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html.erb +57 -0
  147. data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +24 -0
  148. data/vendor/assets/javascripts/ueditor/dialogs/background/background.html.erb +55 -0
  149. data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +348 -0
  150. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css.erb +43 -0
  151. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html.erb +54 -0
  152. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
  153. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  154. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  155. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  156. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  157. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  158. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  159. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  160. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  161. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  162. data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html.erb +89 -0
  163. data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
  164. data/vendor/assets/javascripts/ueditor/dialogs/help/help.html.erb +84 -0
  165. data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +54 -0
  166. data/vendor/assets/javascripts/ueditor/dialogs/highlightcode/highlightcode.html.erb +131 -0
  167. data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html.erb +98 -0
  168. data/vendor/assets/javascripts/ueditor/dialogs/internal.js +79 -0
  169. data/vendor/assets/javascripts/ueditor/dialogs/link/link.html.erb +141 -0
  170. data/vendor/assets/javascripts/ueditor/dialogs/map/map.html.erb +105 -0
  171. data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +30 -0
  172. data/vendor/assets/javascripts/ueditor/dialogs/music/music.html.erb +32 -0
  173. data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +192 -0
  174. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html.erb +74 -0
  175. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +160 -0
  176. data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html.erb +91 -0
  177. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html.erb +21 -0
  178. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +56 -0
  179. data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  180. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +75 -0
  181. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html.erb +57 -0
  182. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +182 -0
  183. data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html.erb +51 -0
  184. data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html.erb +33 -0
  185. data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1238 -0
  186. data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +42 -0
  187. data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  188. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  189. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  190. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  191. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  192. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  193. data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +18 -0
  194. data/vendor/assets/javascripts/ueditor/dialogs/template/template.html.erb +26 -0
  195. data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +53 -0
  196. data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  197. data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  198. data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  199. data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  200. data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +59 -0
  201. data/vendor/assets/javascripts/ueditor/dialogs/video/video.html.erb +78 -0
  202. data/vendor/assets/javascripts/ueditor/dialogs/video/video.js.erb +409 -0
  203. data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html.erb +64 -0
  204. data/vendor/assets/javascripts/ueditor/editor_all.js.erb +19133 -0
  205. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
  206. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
  207. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
  208. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
  209. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
  210. data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +492 -0
  211. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  212. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +316 -0
  213. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
  214. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
  215. data/vendor/assets/javascripts/ueditor/third-party/fClipboard_ueditor.swf +0 -0
  216. data/vendor/assets/javascripts/ueditor/third-party/imageUploader.swf +0 -0
  217. data/vendor/assets/javascripts/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  218. data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
  219. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
  220. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
  221. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
  222. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
  223. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
  224. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
  225. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
  226. data/vendor/assets/javascripts/ueditor/uparse.js +348 -0
  227. metadata +363 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Created with JetBrains PhpStorm.
3
+ * User: xuheng
4
+ * Date: 12-9-26
5
+ * Time: 下午1:06
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+ /**
9
+ * tab点击处理事件
10
+ * @param tabHeads
11
+ * @param tabBodys
12
+ * @param obj
13
+ */
14
+ function clickHandler( tabHeads,tabBodys,obj ) {
15
+ //head样式更改
16
+ for ( var k = 0, len = tabHeads.length; k < len; k++ ) {
17
+ tabHeads[k].className = "";
18
+ }
19
+ obj.className = "focus";
20
+ //body显隐
21
+ var tabSrc = obj.getAttribute( "tabSrc" );
22
+ for ( var j = 0, length = tabBodys.length; j < length; j++ ) {
23
+ var body = tabBodys[j],
24
+ id = body.getAttribute( "id" );
25
+ body.onclick = function(){
26
+ this.style.zoom = 1;
27
+ };
28
+ if ( id != tabSrc ) {
29
+ body.style.zIndex = 1;
30
+ } else {
31
+ body.style.zIndex = 200;
32
+ }
33
+ }
34
+
35
+ }
36
+
37
+ /**
38
+ * TAB切换
39
+ * @param tabParentId tab的父节点ID或者对象本身
40
+ */
41
+ function switchTab( tabParentId ) {
42
+ var tabElements = $G( tabParentId ).children,
43
+ tabHeads = tabElements[0].children,
44
+ tabBodys = tabElements[1].children;
45
+
46
+ for ( var i = 0, length = tabHeads.length; i < length; i++ ) {
47
+ var head = tabHeads[i];
48
+ if ( head.className === "focus" )clickHandler(tabHeads,tabBodys, head );
49
+ head.onclick = function () {
50
+ clickHandler(tabHeads,tabBodys,this);
51
+ }
52
+ }
53
+ }
54
+ switchTab("helptab");
@@ -0,0 +1,131 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <title></title>
7
+ <style type="text/css">
8
+ html, body {
9
+ _overflow: hidden;
10
+ }
11
+
12
+ * {
13
+ margin: 0;
14
+ padding: 0;
15
+ line-height: 20px;
16
+ }
17
+
18
+ .wrapper {
19
+ width: 520px;
20
+ height: 300px;
21
+ margin: 10px 15px;
22
+ font-size: 12px
23
+ }
24
+
25
+ textarea {
26
+ width: 510px;
27
+ height: 300px;
28
+ resize: none;
29
+ margin: 5px;
30
+ *margin-left: -12px;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="wrapper">
36
+ <p>
37
+ <label for="language"><var id="lang_input_selectLang"></var></label>
38
+ <select id="language">
39
+ <option value="as3">ActionScript3</option>
40
+ <option value="bash">Bash/Shell</option>
41
+ <option value="cpp">C/C++</option>
42
+ <option value="css">Css</option>
43
+ <option value="cf">CodeFunction</option>
44
+ <option value="c#">C#</option>
45
+ <option value="delphi">Delphi</option>
46
+ <option value="diff">Diff</option>
47
+ <option value="erlang">Erlang</option>
48
+ <option value="groovy">Groovy</option>
49
+ <option value="html">Html</option>
50
+ <option value="java">Java</option>
51
+ <option value="jfx">JavaFx</option>
52
+ <option value="js">Javascript</option>
53
+ <option value="pl">Perl</option>
54
+ <option value="php">Php</option>
55
+ <option value="plain">Plain Text</option>
56
+ <option value="ps">PowerShell</option>
57
+ <option value="python">Python</option>
58
+ <option value="ruby">Ruby</option>
59
+ <option value="scala">Scala</option>
60
+ <option value="sql">Sql</option>
61
+ <option value="vb">Vb</option>
62
+ <option value="xml">Xml</option>
63
+ </select>
64
+ </p>
65
+ <label for="code"></label><textarea id="code" cols="" rows=""></textarea>
66
+ </div>
67
+ <%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
68
+ <script type="text/javascript">
69
+ var sels = $G("language"),
70
+ code = $G('code');
71
+ var state = editor.queryCommandState("highlightcode");
72
+ if (state) {
73
+ var pN = domUtils.findParent(editor.selection.getRange().startContainer, function (node) {
74
+ return /syntaxhighlighter/ig.test(node.className);
75
+ });
76
+ if (pN) {
77
+ var divs = pN.getElementsByTagName("div"), di;
78
+ for (var i = divs.length - 1, container; container = divs[i--];) {
79
+ if (container.className == "container") {
80
+ di = container;
81
+ break;
82
+ }
83
+ }
84
+ for (var str = [], c = 0, ci; ci = di.childNodes[c++];) {
85
+ str.push(ci[parent.baidu.editor.browser.ie ? 'innerText' : 'textContent']);
86
+ }
87
+ $G("code").value = str.join("\n");
88
+ $G("language").value = pN.className.match(/highlighter[\s]+([a-z\d]*#?)/)[1];
89
+ }
90
+ }
91
+ code.onkeydown = function (evt) {
92
+ evt = evt || event;
93
+ if (evt.keyCode == 9) {
94
+ if (('selectionStart' in code) && code.selectionStart == code.selectionEnd) {
95
+ var offset = code.selectionStart;
96
+ code.value = code.value.substring(0, code.selectionStart) +
97
+ " " + code.value.substring(code.selectionStart);
98
+ code.selectionStart = code.selectionEnd = offset + 4;
99
+ $focus(code);
100
+ }
101
+ else {
102
+ var textRange = document.selection.createRange();
103
+ textRange.text = " " + textRange.text;
104
+ textRange.collapse(false);
105
+ textRange.select();
106
+ $focus(code);
107
+ }
108
+ evt.returnValue = false;
109
+ evt.preventDefault();
110
+ }
111
+ if ((evt.ctrlKey || evt.metaKey) && evt.keyCode == 13) {
112
+ dialog.onok();
113
+ }
114
+ };
115
+ dialog.onok = function () {
116
+ var language = sels.value;
117
+ if (code.value.replace(/^\s*|\s*$/ig, "")) {
118
+ editor.execCommand("highlightcode", code.value, language);
119
+ dialog.close();
120
+ } else {
121
+ alert(lang.importCode);
122
+ }
123
+ };
124
+ $focus(code);
125
+ sels.onchange = function () {
126
+ $focus(code);
127
+ }
128
+
129
+ </script>
130
+ </body>
131
+ </html>
@@ -0,0 +1,98 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
+ <title></title>
6
+ <style type="text/css">
7
+ .warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;}
8
+ #url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; }
9
+ .format span{display: inline-block; width: 58px;text-align: center; zoom:1;}
10
+ table td{padding:5px 0;}
11
+ #align{width: 65px;height: 23px;line-height: 22px;}
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <div class="warp">
16
+ <table width="300" cellpadding="0" cellspacing="0">
17
+ <tr>
18
+ <td colspan="2" class="format">
19
+ <span><var id="lang_input_address"></var></span>
20
+ <input style="width:200px" id="url" type="text" value=""/>
21
+ </td>
22
+ </tr>
23
+ <tr>
24
+ <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td>
25
+
26
+ </tr>
27
+ <tr>
28
+ <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td>
29
+ </tr>
30
+ <tr>
31
+ <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td>
32
+ <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td>
33
+ </tr>
34
+
35
+ <tr>
36
+ <td colspan="2"><span><var id="lang_input_alignMode"></var></span>
37
+ <select id="align">
38
+ <option value=""></option>
39
+ <option value="left"></option>
40
+ <option value="right"></option>
41
+ </select>
42
+ </td>
43
+ </tr>
44
+ </table>
45
+ </div>
46
+ <%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
47
+ <script type="text/javascript">
48
+ var iframe = editor._iframe;
49
+ if(iframe){
50
+ $G("url").value = iframe.getAttribute("src")||"";
51
+ $G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||"";
52
+ $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||"";
53
+ $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false;
54
+ $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false;
55
+ $G("align").value = iframe.align ? iframe.align : "";
56
+ }
57
+ function queding(){
58
+ var url = $G("url").value.replace(/^\s*|\s*$/ig,""),
59
+ width = $G("width").value,
60
+ height = $G("height").value,
61
+ scroll = $G("scroll"),
62
+ frameborder = $G("frameborder"),
63
+ float = $G("align").value,
64
+ newIframe = editor.document.createElement("iframe"),
65
+ div;
66
+ if(!url){
67
+ alert(lang.enterAddress);
68
+ return false;
69
+ }
70
+ newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url);
71
+ /^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : "";
72
+ /^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : "";
73
+ scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no");
74
+ frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0);
75
+ float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align","");
76
+ if(iframe){
77
+ iframe.parentNode.insertBefore(newIframe,iframe);
78
+ domUtils.remove(iframe);
79
+ }else{
80
+ div = editor.document.createElement("div");
81
+ div.appendChild(newIframe);
82
+ editor.execCommand("inserthtml",div.innerHTML);
83
+ }
84
+ editor._iframe = null;
85
+ dialog.close();
86
+ }
87
+ dialog.onok = queding;
88
+ $G("url").onkeydown = function(evt){
89
+ evt = evt || event;
90
+ if(evt.keyCode == 13){
91
+ queding();
92
+ }
93
+ };
94
+ $focus($G( "url" ));
95
+
96
+ </script>
97
+ </body>
98
+ </html>
@@ -0,0 +1,79 @@
1
+ (function () {
2
+ var parent = window.parent;
3
+ //dialog对象
4
+ dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
5
+ //当前打开dialog的编辑器实例
6
+ editor = dialog.editor;
7
+
8
+ UE = parent.UE;
9
+
10
+ domUtils = UE.dom.domUtils;
11
+
12
+ utils = UE.utils;
13
+
14
+ browser = UE.browser;
15
+
16
+ ajax = UE.ajax;
17
+
18
+ $G = function ( id ) {
19
+ return document.getElementById( id )
20
+ };
21
+ //focus元素
22
+ $focus = function ( node ) {
23
+ setTimeout( function () {
24
+ if ( browser.ie ) {
25
+ var r = node.createTextRange();
26
+ r.collapse( false );
27
+ r.select();
28
+ } else {
29
+ node.focus()
30
+ }
31
+ }, 0 )
32
+ };
33
+ utils.loadFile(document,{
34
+ href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(),
35
+ tag:"link",
36
+ type:"text/css",
37
+ rel:"stylesheet"
38
+ });
39
+ lang = editor.getLang(dialog.className.split( "-" )[2]);
40
+
41
+ domUtils.on(window,'load',function () {
42
+
43
+ var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
44
+ //针对静态资源
45
+ for ( var i in lang.static ) {
46
+ var dom = $G( i );
47
+ if(!dom) continue;
48
+ var tagName = dom.tagName,
49
+ content = lang.static[i];
50
+ if(content.src){
51
+ //clone
52
+ content = utils.extend({},content,false);
53
+ content.src = langImgPath + content.src;
54
+ }
55
+ if(content.style){
56
+ content = utils.extend({},content,false);
57
+ content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
58
+ }
59
+ switch ( tagName.toLowerCase() ) {
60
+ case "var":
61
+ dom.parentNode.replaceChild( document.createTextNode( content ), dom );
62
+ break;
63
+ case "select":
64
+ var ops = dom.options;
65
+ for ( var j = 0, oj; oj = ops[j]; ) {
66
+ oj.innerHTML = content.options[j++];
67
+ }
68
+ for ( var p in content ) {
69
+ p != "options" && dom.setAttribute( p, content[p] );
70
+ }
71
+ break;
72
+ default :
73
+ domUtils.setAttributes( dom, content);
74
+ }
75
+ }
76
+ } );
77
+
78
+ })();
79
+
@@ -0,0 +1,141 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title></title>
6
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
7
+ <style type="text/css">
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ color: #838383;
12
+ }
13
+
14
+ table {
15
+ font-size: 12px;
16
+ margin: 10px;
17
+ line-height: 30px
18
+ }
19
+
20
+ .txt {
21
+ width: 300px;
22
+ height: 21px;
23
+ line-height: 21px;
24
+ border: 1px solid #d7d7d7;
25
+ }
26
+ </style>
27
+ </head>
28
+ <body>
29
+ <table>
30
+ <tr>
31
+ <td><label for="text"> <var id="lang_input_text"></var></label></td>
32
+ <td><input class="txt" id="text" type="text" disabled="true"/></td>
33
+ </tr>
34
+ <tr>
35
+ <td><label for="href"> <var id="lang_input_url"></var></label></td>
36
+ <td><input class="txt" id="href" type="text"/></td>
37
+ </tr>
38
+ <tr>
39
+ <td><label for="title"> <var id="lang_input_title"></var></label></td>
40
+ <td><input class="txt" id="title" type="text"/></td>
41
+ </tr>
42
+ <tr>
43
+ <td colspan="2">
44
+ <label for="target"><var id="lang_input_target"></var></label>
45
+ <input id="target" type="checkbox"/>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td colspan="2" id="msg"></td>
50
+ </tr>
51
+ </table>
52
+ <%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
53
+ <script type="text/javascript">
54
+ var range = editor.selection.getRange(),
55
+ link = range.collapsed ? editor.queryCommandValue("link") : editor.selection.getStart(),
56
+ url,
57
+ text = $G('text'),
58
+ rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(), 'a', true),
59
+ orgText;
60
+ link = domUtils.findParentByTagName(link, "a", true);
61
+ if (link) {
62
+ url = utils.html(link.getAttribute('data_ue_src') || link.getAttribute('href', 2));
63
+
64
+ if (rangeLink === link && !link.getElementsByTagName('img').length) {
65
+ text.removeAttribute('disabled');
66
+ orgText = text.value = link[browser.ie ? 'innerText' : 'textContent'];
67
+ } else {
68
+ text.setAttribute('disabled', 'true');
69
+ text.value = lang.validLink;
70
+ }
71
+
72
+ } else {
73
+ if (range.collapsed) {
74
+ text.removeAttribute('disabled');
75
+ text.value = '';
76
+ } else {
77
+ text.setAttribute('disabled', 'true');
78
+ text.value = lang.validLink;
79
+ }
80
+
81
+ }
82
+ $G("title").value = url ? link.title : "";
83
+ $G("href").value = url ? url : '';
84
+ $G("target").checked = url && link.target == "_blank" ? true : false;
85
+ $focus($G("href"));
86
+
87
+ function handleDialogOk() {
88
+ var href = $G('href').value.replace(/^\s+|\s+$/g, '');
89
+ if (href) {
90
+ if (!hrefStartWith(href, ["http", "/", "ftp://"])) {
91
+ href = "http://" + href;
92
+ }
93
+ var obj = {
94
+ 'href': href,
95
+ 'target': $G("target").checked ? "_blank" : '_self',
96
+ 'title': $G("title").value.replace(/^\s+|\s+$/g, ''),
97
+ 'data_ue_src': href
98
+ };
99
+ //修改链接内容的情况太特殊了,所以先做到这里了
100
+ //todo:情况多的时候,做到command里
101
+ if (orgText && text.value != orgText) {
102
+ link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value;
103
+ range.selectNode(link).select()
104
+ }
105
+ if (range.collapsed) {
106
+ obj.textValue = text.value;
107
+ }
108
+ editor.execCommand('link', obj);
109
+ dialog.close();
110
+ }
111
+ }
112
+ dialog.onok = handleDialogOk;
113
+ $G('href').onkeydown = $G('title').onkeydown = function (evt) {
114
+ evt = evt || window.event;
115
+ if (evt.keyCode == 13) {
116
+ handleDialogOk();
117
+ return false;
118
+ }
119
+ };
120
+ $G('href').onblur = function () {
121
+ if (!hrefStartWith(this.value, ["http", "/", "ftp://"])) {
122
+ $G("msg").innerHTML = "<span style='color: red'>" + lang.httpPrompt + "</span>";
123
+ } else {
124
+ $G("msg").innerHTML = "";
125
+ }
126
+ };
127
+
128
+ function hrefStartWith(href, arr) {
129
+ href = href.replace(/^\s+|\s+$/g, '');
130
+ for (var i = 0, ai; ai = arr[i++];) {
131
+ if (href.indexOf(ai) == 0) {
132
+ return true;
133
+ }
134
+ }
135
+ return false;
136
+ }
137
+
138
+
139
+ </script>
140
+ </body>
141
+ </html>