loyal_rails_kindeditor 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. data/lib/loyal_rails_kindeditor.rb +1 -0
  2. metadata +27 -231
  3. data/.gitignore +0 -5
  4. data/Gemfile +0 -6
  5. data/loyal_rails_kindeditor.gemspec +0 -24
  6. data/rails_kindeditor.gemspec +0 -23
  7. data/screenshots/rails_kindeditor.png +0 -0
  8. data/screenshots/simple_mode.png +0 -0
  9. data/vendor/assets/javascripts/kindeditor/kindeditor.js +0 -5827
  10. data/vendor/assets/javascripts/kindeditor/lang/ar.js +0 -232
  11. data/vendor/assets/javascripts/kindeditor/lang/en.js +0 -231
  12. data/vendor/assets/javascripts/kindeditor/lang/ko.js +0 -237
  13. data/vendor/assets/javascripts/kindeditor/lang/zh_CN.js +0 -235
  14. data/vendor/assets/javascripts/kindeditor/lang/zh_TW.js +0 -234
  15. data/vendor/assets/javascripts/kindeditor/plugins/anchor/anchor.js +0 -46
  16. data/vendor/assets/javascripts/kindeditor/plugins/autoheight/autoheight.js +0 -27
  17. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/baidumap.js +0 -93
  18. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/index.html +0 -83
  19. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/map.html +0 -43
  20. data/vendor/assets/javascripts/kindeditor/plugins/clearhtml/clearhtml.js +0 -29
  21. data/vendor/assets/javascripts/kindeditor/plugins/code/code.js +0 -92
  22. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.css +0 -13
  23. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.js +0 -28
  24. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/emoticons.js +0 -129
  25. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/0.gif +0 -0
  26. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/1.gif +0 -0
  27. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/10.gif +0 -0
  28. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/100.gif +0 -0
  29. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/101.gif +0 -0
  30. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/102.gif +0 -0
  31. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/103.gif +0 -0
  32. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/104.gif +0 -0
  33. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/105.gif +0 -0
  34. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/106.gif +0 -0
  35. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/107.gif +0 -0
  36. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/108.gif +0 -0
  37. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/109.gif +0 -0
  38. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/11.gif +0 -0
  39. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/110.gif +0 -0
  40. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/111.gif +0 -0
  41. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/112.gif +0 -0
  42. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/113.gif +0 -0
  43. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/114.gif +0 -0
  44. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/115.gif +0 -0
  45. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/116.gif +0 -0
  46. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/117.gif +0 -0
  47. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/118.gif +0 -0
  48. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/119.gif +0 -0
  49. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/12.gif +0 -0
  50. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/120.gif +0 -0
  51. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/121.gif +0 -0
  52. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/122.gif +0 -0
  53. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/123.gif +0 -0
  54. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/124.gif +0 -0
  55. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/125.gif +0 -0
  56. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/126.gif +0 -0
  57. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/127.gif +0 -0
  58. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/128.gif +0 -0
  59. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/129.gif +0 -0
  60. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/13.gif +0 -0
  61. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/130.gif +0 -0
  62. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/131.gif +0 -0
  63. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/132.gif +0 -0
  64. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/133.gif +0 -0
  65. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/134.gif +0 -0
  66. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/14.gif +0 -0
  67. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/15.gif +0 -0
  68. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/16.gif +0 -0
  69. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/17.gif +0 -0
  70. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/18.gif +0 -0
  71. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/19.gif +0 -0
  72. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/2.gif +0 -0
  73. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/20.gif +0 -0
  74. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/21.gif +0 -0
  75. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/22.gif +0 -0
  76. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/23.gif +0 -0
  77. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/24.gif +0 -0
  78. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/25.gif +0 -0
  79. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/26.gif +0 -0
  80. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/27.gif +0 -0
  81. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/28.gif +0 -0
  82. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/29.gif +0 -0
  83. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/3.gif +0 -0
  84. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/30.gif +0 -0
  85. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/31.gif +0 -0
  86. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/32.gif +0 -0
  87. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/33.gif +0 -0
  88. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/34.gif +0 -0
  89. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/35.gif +0 -0
  90. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/36.gif +0 -0
  91. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/37.gif +0 -0
  92. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/38.gif +0 -0
  93. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/39.gif +0 -0
  94. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/4.gif +0 -0
  95. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/40.gif +0 -0
  96. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/41.gif +0 -0
  97. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/42.gif +0 -0
  98. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/43.gif +0 -0
  99. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/44.gif +0 -0
  100. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/45.gif +0 -0
  101. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/46.gif +0 -0
  102. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/47.gif +0 -0
  103. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/48.gif +0 -0
  104. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/49.gif +0 -0
  105. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/5.gif +0 -0
  106. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/50.gif +0 -0
  107. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/51.gif +0 -0
  108. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/52.gif +0 -0
  109. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/53.gif +0 -0
  110. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/54.gif +0 -0
  111. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/55.gif +0 -0
  112. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/56.gif +0 -0
  113. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/57.gif +0 -0
  114. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/58.gif +0 -0
  115. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/59.gif +0 -0
  116. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/6.gif +0 -0
  117. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/60.gif +0 -0
  118. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/61.gif +0 -0
  119. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/62.gif +0 -0
  120. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/63.gif +0 -0
  121. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/64.gif +0 -0
  122. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/65.gif +0 -0
  123. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/66.gif +0 -0
  124. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/67.gif +0 -0
  125. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/68.gif +0 -0
  126. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/69.gif +0 -0
  127. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/7.gif +0 -0
  128. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/70.gif +0 -0
  129. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/71.gif +0 -0
  130. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/72.gif +0 -0
  131. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/73.gif +0 -0
  132. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/74.gif +0 -0
  133. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/75.gif +0 -0
  134. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/76.gif +0 -0
  135. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/77.gif +0 -0
  136. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/78.gif +0 -0
  137. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/79.gif +0 -0
  138. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/8.gif +0 -0
  139. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/80.gif +0 -0
  140. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/81.gif +0 -0
  141. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/82.gif +0 -0
  142. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/83.gif +0 -0
  143. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/84.gif +0 -0
  144. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/85.gif +0 -0
  145. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/86.gif +0 -0
  146. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/87.gif +0 -0
  147. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/88.gif +0 -0
  148. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/89.gif +0 -0
  149. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/9.gif +0 -0
  150. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/90.gif +0 -0
  151. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/91.gif +0 -0
  152. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/92.gif +0 -0
  153. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/93.gif +0 -0
  154. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/94.gif +0 -0
  155. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/95.gif +0 -0
  156. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/96.gif +0 -0
  157. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/97.gif +0 -0
  158. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/98.gif +0 -0
  159. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/99.gif +0 -0
  160. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/static.gif +0 -0
  161. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/filemanager.js +0 -190
  162. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-16.gif +0 -0
  163. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-64.gif +0 -0
  164. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-16.gif +0 -0
  165. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-64.gif +0 -0
  166. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/go-up.gif +0 -0
  167. data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +0 -160
  168. data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +0 -316
  169. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_left.gif +0 -0
  170. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_right.gif +0 -0
  171. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_top.gif +0 -0
  172. data/vendor/assets/javascripts/kindeditor/plugins/image/images/refresh.png +0 -0
  173. data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +0 -139
  174. data/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js +0 -38
  175. data/vendor/assets/javascripts/kindeditor/plugins/link/link.js +0 -66
  176. data/vendor/assets/javascripts/kindeditor/plugins/map/map.html +0 -57
  177. data/vendor/assets/javascripts/kindeditor/plugins/map/map.js +0 -137
  178. data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +0 -169
  179. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png +0 -0
  180. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-en.png +0 -0
  181. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-zh_CN.png +0 -0
  182. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/swfupload.swf +0 -0
  183. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +0 -1385
  184. data/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js +0 -29
  185. data/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js +0 -41
  186. data/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js +0 -31
  187. data/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js +0 -81
  188. data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +0 -705
  189. data/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html +0 -14
  190. data/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html +0 -42
  191. data/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html +0 -36
  192. data/vendor/assets/javascripts/kindeditor/plugins/template/template.js +0 -58
  193. data/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js +0 -51
  194. data/vendor/assets/javascripts/kindeditor/themes/common/anchor.gif +0 -0
  195. data/vendor/assets/javascripts/kindeditor/themes/common/blank.gif +0 -0
  196. data/vendor/assets/javascripts/kindeditor/themes/common/blockquote.gif +0 -0
  197. data/vendor/assets/javascripts/kindeditor/themes/common/flash.gif +0 -0
  198. data/vendor/assets/javascripts/kindeditor/themes/common/iframe.css +0 -98
  199. data/vendor/assets/javascripts/kindeditor/themes/common/loading.gif +0 -0
  200. data/vendor/assets/javascripts/kindeditor/themes/common/media.gif +0 -0
  201. data/vendor/assets/javascripts/kindeditor/themes/common/rm.gif +0 -0
  202. data/vendor/assets/javascripts/kindeditor/themes/default/background.png +0 -0
  203. data/vendor/assets/javascripts/kindeditor/themes/default/default.css +0 -1148
  204. data/vendor/assets/javascripts/kindeditor/themes/default/default.png +0 -0
  205. data/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif +0 -0
  206. data/vendor/assets/javascripts/kindeditor/themes/qq/qq.css +0 -143
  207. data/vendor/assets/javascripts/kindeditor/themes/simple/simple.css +0 -100
@@ -1,29 +0,0 @@
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;
12
- var name = 'pagebreak';
13
- var pagebreakHtml = K.undef(self.pagebreakHtml, '<hr style="page-break-after: always;" class="ke-pagebreak" />');
14
-
15
- self.clickToolbar(name, function() {
16
- var cmd = self.cmd, range = cmd.range;
17
- self.focus();
18
- range.enlarge(true);
19
- cmd.split(true);
20
- var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : '<p id="__kindeditor_tail_tag__"></p>';
21
- self.insertHtml(pagebreakHtml + tail);
22
- if (tail !== '') {
23
- var p = K('#__kindeditor_tail_tag__', self.edit.doc);
24
- range.selectNodeContents(p[0]);
25
- p.removeAttr('id');
26
- cmd.select();
27
- }
28
- });
29
- });
@@ -1,41 +0,0 @@
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(/ {2}/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
- });
@@ -1,31 +0,0 @@
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
- });
@@ -1,81 +0,0 @@
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
- function getFirstChild(knode) {
14
- var child = knode.first();
15
- while (child && child.first()) {
16
- child = child.first();
17
- }
18
- return child;
19
- }
20
- self.clickToolbar(name, function() {
21
- self.focus();
22
- var doc = self.edit.doc,
23
- range = self.cmd.range,
24
- child = K(doc.body).first(), next,
25
- nodeList = [], subList = [],
26
- bookmark = range.createBookmark(true);
27
- while(child) {
28
- next = child.next();
29
- var firstChild = getFirstChild(child);
30
- if (!firstChild || firstChild.name != 'img') {
31
- if (blockMap[child.name]) {
32
- child.html(child.html().replace(/^(\s|&nbsp;| )+/ig, ''));
33
- child.css('text-indent', '2em');
34
- } else {
35
- subList.push(child);
36
- }
37
- if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) {
38
- if (subList.length > 0) {
39
- nodeList.push(subList);
40
- }
41
- subList = [];
42
- }
43
- }
44
- child = next;
45
- }
46
- K.each(nodeList, function(i, subList) {
47
- var wrapper = K('<p style="text-indent:2em;"></p>', doc);
48
- subList[0].before(wrapper);
49
- K.each(subList, function(i, knode) {
50
- wrapper.append(knode);
51
- });
52
- });
53
- range.moveToBookmark(bookmark);
54
- self.addBookmark();
55
- });
56
- });
57
-
58
- /**
59
- --------------------------
60
- abcd<br />
61
- 1234<br />
62
-
63
- to
64
-
65
- <p style="text-indent:2em;">
66
- abcd<br />
67
- 1234<br />
68
- </p>
69
-
70
- --------------------------
71
-
72
- &nbsp; abcd<img>1233
73
- <p>1234</p>
74
-
75
- to
76
-
77
- <p style="text-indent:2em;">abcd<img>1233</p>
78
- <p style="text-indent:2em;">1234</p>
79
-
80
- --------------------------
81
- */
@@ -1,705 +0,0 @@
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('table', function(K) {
11
- var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder';
12
- // 设置颜色
13
- function _setColor(box, color) {
14
- color = color.toUpperCase();
15
- box.css('background-color', color);
16
- box.css('color', color === '#000000' ? '#FFFFFF' : '#000000');
17
- box.html(color);
18
- }
19
- // 初始化取色器
20
- var pickerList = [];
21
- function _initColorPicker(dialogDiv, colorBox) {
22
- colorBox.bind('click,mousedown', function(e){
23
- e.stopPropagation();
24
- });
25
- function removePicker() {
26
- K.each(pickerList, function() {
27
- this.remove();
28
- });
29
- pickerList = [];
30
- K(document).unbind('click,mousedown', removePicker);
31
- dialogDiv.unbind('click,mousedown', removePicker);
32
- }
33
- colorBox.click(function(e) {
34
- removePicker();
35
- var box = K(this),
36
- pos = box.pos();
37
- var picker = K.colorpicker({
38
- x : pos.x,
39
- y : pos.y + box.height(),
40
- z : 811214,
41
- selectedColor : K(this).html(),
42
- colors : self.colorTable,
43
- noColor : self.lang('noColor'),
44
- shadowMode : self.shadowMode,
45
- click : function(color) {
46
- _setColor(box, color);
47
- removePicker();
48
- }
49
- });
50
- pickerList.push(picker);
51
- K(document).bind('click,mousedown', removePicker);
52
- dialogDiv.bind('click,mousedown', removePicker);
53
- });
54
- }
55
- // 取得下一行cell的index
56
- function _getCellIndex(table, row, cell) {
57
- var rowSpanCount = 0;
58
- for (var i = 0, len = row.cells.length; i < len; i++) {
59
- if (row.cells[i] == cell) {
60
- break;
61
- }
62
- rowSpanCount += row.cells[i].rowSpan - 1;
63
- }
64
- return cell.cellIndex - rowSpanCount;
65
- }
66
- self.plugin.table = {
67
- //insert or modify table
68
- prop : function(isInsert) {
69
- var html = [
70
- '<div style="padding:20px;">',
71
- //rows, cols
72
- '<div class="ke-dialog-row">',
73
- '<label for="keRows" style="width:90px;">' + lang.cells + '</label>',
74
- lang.rows + ' <input type="text" id="keRows" class="ke-input-text ke-input-number" name="rows" value="" maxlength="4" /> &nbsp; ',
75
- lang.cols + ' <input type="text" class="ke-input-text ke-input-number" name="cols" value="" maxlength="4" />',
76
- '</div>',
77
- //width, height
78
- '<div class="ke-dialog-row">',
79
- '<label for="keWidth" style="width:90px;">' + lang.size + '</label>',
80
- lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> &nbsp; ',
81
- '<select name="widthType">',
82
- '<option value="%">' + lang.percent + '</option>',
83
- '<option value="px">' + lang.px + '</option>',
84
- '</select> &nbsp; ',
85
- lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> &nbsp; ',
86
- '<select name="heightType">',
87
- '<option value="%">' + lang.percent + '</option>',
88
- '<option value="px">' + lang.px + '</option>',
89
- '</select>',
90
- '</div>',
91
- //space, padding
92
- '<div class="ke-dialog-row">',
93
- '<label for="kePadding" style="width:90px;">' + lang.space + '</label>',
94
- lang.padding + ' <input type="text" id="kePadding" class="ke-input-text ke-input-number" name="padding" value="" maxlength="4" /> &nbsp; ',
95
- lang.spacing + ' <input type="text" class="ke-input-text ke-input-number" name="spacing" value="" maxlength="4" />',
96
- '</div>',
97
- //align
98
- '<div class="ke-dialog-row">',
99
- '<label for="keAlign" style="width:90px;">' + lang.align + '</label>',
100
- '<select id="keAlign" name="align">',
101
- '<option value="">' + lang.alignDefault + '</option>',
102
- '<option value="left">' + lang.alignLeft + '</option>',
103
- '<option value="center">' + lang.alignCenter + '</option>',
104
- '<option value="right">' + lang.alignRight + '</option>',
105
- '</select>',
106
- '</div>',
107
- //border
108
- '<div class="ke-dialog-row">',
109
- '<label for="keBorder" style="width:90px;">' + lang.border + '</label>',
110
- lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> &nbsp; ',
111
- lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>',
112
- '</div>',
113
- //background color
114
- '<div class="ke-dialog-row">',
115
- '<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>',
116
- '<span class="ke-inline-block ke-input-color"></span>',
117
- '</div>',
118
- '</div>'
119
- ].join('');
120
- var dialog = self.createDialog({
121
- name : name,
122
- width : 500,
123
- title : self.lang(name),
124
- body : html,
125
- beforeRemove : function() {
126
- colorBox.unbind();
127
- },
128
- yesBtn : {
129
- name : self.lang('yes'),
130
- click : function(e) {
131
- var rows = rowsBox.val(),
132
- cols = colsBox.val(),
133
- width = widthBox.val(),
134
- height = heightBox.val(),
135
- widthType = widthTypeBox.val(),
136
- heightType = heightTypeBox.val(),
137
- padding = paddingBox.val(),
138
- spacing = spacingBox.val(),
139
- align = alignBox.val(),
140
- border = borderBox.val(),
141
- borderColor = K(colorBox[0]).html() || '',
142
- bgColor = K(colorBox[1]).html() || '';
143
- if (rows == 0 || !/^\d+$/.test(rows)) {
144
- alert(self.lang('invalidRows'));
145
- rowsBox[0].focus();
146
- return;
147
- }
148
- if (cols == 0 || !/^\d+$/.test(cols)) {
149
- alert(self.lang('invalidRows'));
150
- colsBox[0].focus();
151
- return;
152
- }
153
- if (!/^\d*$/.test(width)) {
154
- alert(self.lang('invalidWidth'));
155
- widthBox[0].focus();
156
- return;
157
- }
158
- if (!/^\d*$/.test(height)) {
159
- alert(self.lang('invalidHeight'));
160
- heightBox[0].focus();
161
- return;
162
- }
163
- if (!/^\d*$/.test(padding)) {
164
- alert(self.lang('invalidPadding'));
165
- paddingBox[0].focus();
166
- return;
167
- }
168
- if (!/^\d*$/.test(spacing)) {
169
- alert(self.lang('invalidSpacing'));
170
- spacingBox[0].focus();
171
- return;
172
- }
173
- if (!/^\d*$/.test(border)) {
174
- alert(self.lang('invalidBorder'));
175
- borderBox[0].focus();
176
- return;
177
- }
178
- //modify table
179
- if (table) {
180
- if (width !== '') {
181
- table.width(width + widthType);
182
- } else {
183
- table.css('width', '');
184
- }
185
- if (table[0].width !== undefined) {
186
- table.removeAttr('width');
187
- }
188
- if (height !== '') {
189
- table.height(height + heightType);
190
- } else {
191
- table.css('height', '');
192
- }
193
- if (table[0].height !== undefined) {
194
- table.removeAttr('height');
195
- }
196
- table.css('background-color', bgColor);
197
- if (table[0].bgColor !== undefined) {
198
- table.removeAttr('bgColor');
199
- }
200
- if (padding !== '') {
201
- table[0].cellPadding = padding;
202
- } else {
203
- table.removeAttr('cellPadding');
204
- }
205
- if (spacing !== '') {
206
- table[0].cellSpacing = spacing;
207
- } else {
208
- table.removeAttr('cellSpacing');
209
- }
210
- if (align !== '') {
211
- table[0].align = align;
212
- } else {
213
- table.removeAttr('align');
214
- }
215
- if (border !== '') {
216
- table.attr('border', border);
217
- } else {
218
- table.removeAttr('border');
219
- }
220
- if (border === '' || border === '0') {
221
- table.addClass(zeroborder);
222
- } else {
223
- table.removeClass(zeroborder);
224
- }
225
- if (borderColor !== '') {
226
- table.attr('borderColor', borderColor);
227
- } else {
228
- table.removeAttr('borderColor');
229
- }
230
- self.hideDialog().focus();
231
- return;
232
- }
233
- //insert new table
234
- var style = '';
235
- if (width !== '') {
236
- style += 'width:' + width + widthType + ';';
237
- }
238
- if (height !== '') {
239
- style += 'height:' + height + heightType + ';';
240
- }
241
- if (bgColor !== '') {
242
- style += 'background-color:' + bgColor + ';';
243
- }
244
- var html = '<table';
245
- if (style !== '') {
246
- html += ' style="' + style + '"';
247
- }
248
- if (padding !== '') {
249
- html += ' cellpadding="' + padding + '"';
250
- }
251
- if (spacing !== '') {
252
- html += ' cellspacing="' + spacing + '"';
253
- }
254
- if (align !== '') {
255
- html += ' align="' + align + '"';
256
- }
257
- if (border !== '') {
258
- html += ' border="' + border + '"';
259
- }
260
- if (border === '' || border === '0') {
261
- html += ' class="' + zeroborder + '"';
262
- }
263
- if (borderColor !== '') {
264
- html += ' bordercolor="' + borderColor + '"';
265
- }
266
- html += '>';
267
- for (var i = 0; i < rows; i++) {
268
- html += '<tr>';
269
- for (var j = 0; j < cols; j++) {
270
- html += '<td>' + (K.IE ? '&nbsp;' : '<br />') + '</td>';
271
- }
272
- html += '</tr>';
273
- }
274
- html += '</table>';
275
- if (!K.IE) {
276
- html += '<br />';
277
- }
278
- self.insertHtml(html);
279
- self.select().hideDialog().focus();
280
- self.addBookmark();
281
- }
282
- }
283
- }),
284
- div = dialog.div,
285
- rowsBox = K('[name="rows"]', div).val(3),
286
- colsBox = K('[name="cols"]', div).val(2),
287
- widthBox = K('[name="width"]', div).val(100),
288
- heightBox = K('[name="height"]', div),
289
- widthTypeBox = K('[name="widthType"]', div),
290
- heightTypeBox = K('[name="heightType"]', div),
291
- paddingBox = K('[name="padding"]', div).val(2),
292
- spacingBox = K('[name="spacing"]', div).val(0),
293
- alignBox = K('[name="align"]', div),
294
- borderBox = K('[name="border"]', div).val(1),
295
- colorBox = K('.ke-input-color', div);
296
- _initColorPicker(div, colorBox.eq(0));
297
- _initColorPicker(div, colorBox.eq(1));
298
- _setColor(colorBox.eq(0), '#000000');
299
- _setColor(colorBox.eq(1), '');
300
- // foucs and select
301
- rowsBox[0].focus();
302
- rowsBox[0].select();
303
- var table;
304
- if (isInsert) {
305
- return;
306
- }
307
- //get selected table node
308
- table = self.plugin.getSelectedTable();
309
- if (table) {
310
- rowsBox.val(table[0].rows.length);
311
- colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0);
312
- rowsBox.attr('disabled', true);
313
- colsBox.attr('disabled', true);
314
- var match,
315
- tableWidth = table[0].style.width || table[0].width,
316
- tableHeight = table[0].style.height || table[0].height;
317
- if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) {
318
- widthBox.val(match[1]);
319
- widthTypeBox.val(match[2]);
320
- } else {
321
- widthBox.val('');
322
- }
323
- if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) {
324
- heightBox.val(match[1]);
325
- heightTypeBox.val(match[2]);
326
- }
327
- paddingBox.val(table[0].cellPadding || '');
328
- spacingBox.val(table[0].cellSpacing || '');
329
- alignBox.val(table[0].align || '');
330
- borderBox.val(table[0].border === undefined ? '' : table[0].border);
331
- _setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || ''));
332
- _setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || ''));
333
- widthBox[0].focus();
334
- widthBox[0].select();
335
- }
336
- },
337
- //modify cell
338
- cellprop : function() {
339
- var html = [
340
- '<div style="padding:20px;">',
341
- //width, height
342
- '<div class="ke-dialog-row">',
343
- '<label for="keWidth" style="width:90px;">' + lang.size + '</label>',
344
- lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> &nbsp; ',
345
- '<select name="widthType">',
346
- '<option value="%">' + lang.percent + '</option>',
347
- '<option value="px">' + lang.px + '</option>',
348
- '</select> &nbsp; ',
349
- lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> &nbsp; ',
350
- '<select name="heightType">',
351
- '<option value="%">' + lang.percent + '</option>',
352
- '<option value="px">' + lang.px + '</option>',
353
- '</select>',
354
- '</div>',
355
- //align
356
- '<div class="ke-dialog-row">',
357
- '<label for="keAlign" style="width:90px;">' + lang.align + '</label>',
358
- lang.textAlign + ' <select id="keAlign" name="textAlign">',
359
- '<option value="">' + lang.alignDefault + '</option>',
360
- '<option value="left">' + lang.alignLeft + '</option>',
361
- '<option value="center">' + lang.alignCenter + '</option>',
362
- '<option value="right">' + lang.alignRight + '</option>',
363
- '</select> ',
364
- lang.verticalAlign + ' <select name="verticalAlign">',
365
- '<option value="">' + lang.alignDefault + '</option>',
366
- '<option value="top">' + lang.alignTop + '</option>',
367
- '<option value="middle">' + lang.alignMiddle + '</option>',
368
- '<option value="bottom">' + lang.alignBottom + '</option>',
369
- '<option value="baseline">' + lang.alignBaseline + '</option>',
370
- '</select>',
371
- '</div>',
372
- //border
373
- '<div class="ke-dialog-row">',
374
- '<label for="keBorder" style="width:90px;">' + lang.border + '</label>',
375
- lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> &nbsp; ',
376
- lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>',
377
- '</div>',
378
- //background color
379
- '<div class="ke-dialog-row">',
380
- '<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>',
381
- '<span class="ke-inline-block ke-input-color"></span>',
382
- '</div>',
383
- '</div>'
384
- ].join('');
385
- var dialog = self.createDialog({
386
- name : name,
387
- width : 500,
388
- title : self.lang('tablecell'),
389
- body : html,
390
- beforeRemove : function() {
391
- colorBox.unbind();
392
- },
393
- yesBtn : {
394
- name : self.lang('yes'),
395
- click : function(e) {
396
- var width = widthBox.val(),
397
- height = heightBox.val(),
398
- widthType = widthTypeBox.val(),
399
- heightType = heightTypeBox.val(),
400
- padding = paddingBox.val(),
401
- spacing = spacingBox.val(),
402
- textAlign = textAlignBox.val(),
403
- verticalAlign = verticalAlignBox.val(),
404
- border = borderBox.val(),
405
- borderColor = K(colorBox[0]).html() || '',
406
- bgColor = K(colorBox[1]).html() || '';
407
- if (!/^\d*$/.test(width)) {
408
- alert(self.lang('invalidWidth'));
409
- widthBox[0].focus();
410
- return;
411
- }
412
- if (!/^\d*$/.test(height)) {
413
- alert(self.lang('invalidHeight'));
414
- heightBox[0].focus();
415
- return;
416
- }
417
- if (!/^\d*$/.test(border)) {
418
- alert(self.lang('invalidBorder'));
419
- borderBox[0].focus();
420
- return;
421
- }
422
- cell.css({
423
- width : width !== '' ? (width + widthType) : '',
424
- height : height !== '' ? (height + heightType) : '',
425
- 'background-color' : bgColor,
426
- 'text-align' : textAlign,
427
- 'vertical-align' : verticalAlign,
428
- 'border-width' : border,
429
- 'border-style' : border !== '' ? 'solid' : '',
430
- 'border-color' : borderColor
431
- });
432
- self.hideDialog().focus();
433
- self.addBookmark();
434
- }
435
- }
436
- }),
437
- div = dialog.div,
438
- widthBox = K('[name="width"]', div).val(100),
439
- heightBox = K('[name="height"]', div),
440
- widthTypeBox = K('[name="widthType"]', div),
441
- heightTypeBox = K('[name="heightType"]', div),
442
- paddingBox = K('[name="padding"]', div).val(2),
443
- spacingBox = K('[name="spacing"]', div).val(0),
444
- textAlignBox = K('[name="textAlign"]', div),
445
- verticalAlignBox = K('[name="verticalAlign"]', div),
446
- borderBox = K('[name="border"]', div).val(1),
447
- colorBox = K('.ke-input-color', div);
448
- _initColorPicker(div, colorBox.eq(0));
449
- _initColorPicker(div, colorBox.eq(1));
450
- _setColor(colorBox.eq(0), '#000000');
451
- _setColor(colorBox.eq(1), '');
452
- // foucs and select
453
- widthBox[0].focus();
454
- widthBox[0].select();
455
- // get selected cell
456
- var cell = self.plugin.getSelectedCell();
457
- var match,
458
- cellWidth = cell[0].style.width || cell[0].width || '',
459
- cellHeight = cell[0].style.height || cell[0].height || '';
460
- if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) {
461
- widthBox.val(match[1]);
462
- widthTypeBox.val(match[2]);
463
- } else {
464
- widthBox.val('');
465
- }
466
- if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) {
467
- heightBox.val(match[1]);
468
- heightTypeBox.val(match[2]);
469
- }
470
- textAlignBox.val(cell[0].style.textAlign || '');
471
- verticalAlignBox.val(cell[0].style.verticalAlign || '');
472
- var border = cell[0].style.borderWidth || '';
473
- if (border) {
474
- border = parseInt(border);
475
- }
476
- borderBox.val(border);
477
- _setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || ''));
478
- _setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || ''));
479
- widthBox[0].focus();
480
- widthBox[0].select();
481
- },
482
- insert : function() {
483
- this.prop(true);
484
- },
485
- 'delete' : function() {
486
- var table = self.plugin.getSelectedTable();
487
- self.cmd.range.setStartBefore(table[0]).collapse(true);
488
- self.cmd.select();
489
- table.remove();
490
- self.addBookmark();
491
- },
492
- colinsert : function(offset) {
493
- var table = self.plugin.getSelectedTable()[0],
494
- row = self.plugin.getSelectedRow()[0],
495
- cell = self.plugin.getSelectedCell()[0],
496
- index = cell.cellIndex + offset;
497
- // 取得第一行的index
498
- index += table.rows[0].cells.length - row.cells.length;
499
-
500
- for (var i = 0, len = table.rows.length; i < len; i++) {
501
- var newRow = table.rows[i],
502
- newCell = newRow.insertCell(index);
503
- newCell.innerHTML = K.IE ? '' : '<br />';
504
- // 调整下一行的单元格index
505
- index = _getCellIndex(table, newRow, newCell);
506
- }
507
- self.cmd.range.selectNodeContents(cell).collapse(true);
508
- self.cmd.select();
509
- self.addBookmark();
510
- },
511
- colinsertleft : function() {
512
- this.colinsert(0);
513
- },
514
- colinsertright : function() {
515
- this.colinsert(1);
516
- },
517
- rowinsert : function(offset) {
518
- var table = self.plugin.getSelectedTable()[0],
519
- row = self.plugin.getSelectedRow()[0],
520
- cell = self.plugin.getSelectedCell()[0];
521
- var rowIndex = row.rowIndex;
522
- if (offset === 1) {
523
- rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset;
524
- }
525
- var newRow = table.insertRow(rowIndex);
526
-
527
- for (var i = 0, len = row.cells.length; i < len; i++) {
528
- // 调整cell个数
529
- if (row.cells[i].rowSpan > 1) {
530
- len -= row.cells[i].rowSpan - 1;
531
- }
532
- var newCell = newRow.insertCell(i);
533
- // copy colspan
534
- if (offset === 1 && row.cells[i].colSpan > 1) {
535
- newCell.colSpan = row.cells[i].colSpan;
536
- }
537
- newCell.innerHTML = K.IE ? '' : '<br />';
538
- }
539
- // 调整rowspan
540
- for (var j = rowIndex; j >= 0; j--) {
541
- var cells = table.rows[j].cells;
542
- if (cells.length > i) {
543
- for (var k = cell.cellIndex; k >= 0; k--) {
544
- if (cells[k].rowSpan > 1) {
545
- cells[k].rowSpan += 1;
546
- }
547
- }
548
- break;
549
- }
550
- }
551
- self.cmd.range.selectNodeContents(cell).collapse(true);
552
- self.cmd.select();
553
- self.addBookmark();
554
- },
555
- rowinsertabove : function() {
556
- this.rowinsert(0);
557
- },
558
- rowinsertbelow : function() {
559
- this.rowinsert(1);
560
- },
561
- rowmerge : function() {
562
- var table = self.plugin.getSelectedTable()[0],
563
- row = self.plugin.getSelectedRow()[0],
564
- cell = self.plugin.getSelectedCell()[0],
565
- rowIndex = row.rowIndex, // 当前行的index
566
- nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index
567
- nextRow = table.rows[nextRowIndex]; // 下一行
568
- // 最后一行不能合并
569
- if (table.rows.length <= nextRowIndex) {
570
- return;
571
- }
572
- var cellIndex = _getCellIndex(table, row, cell); // 下一行单元格的index
573
- if (nextRow.cells.length <= cellIndex) {
574
- return;
575
- }
576
- var nextCell = nextRow.cells[cellIndex]; // 下一行单元格
577
- // 上下行的colspan不一致时不能合并
578
- if (cell.colSpan !== nextCell.colSpan) {
579
- return;
580
- }
581
- cell.rowSpan += nextCell.rowSpan;
582
- nextRow.deleteCell(cellIndex);
583
- self.cmd.range.selectNodeContents(cell).collapse(true);
584
- self.cmd.select();
585
- self.addBookmark();
586
- },
587
- colmerge : function() {
588
- var table = self.plugin.getSelectedTable()[0],
589
- row = self.plugin.getSelectedRow()[0],
590
- cell = self.plugin.getSelectedCell()[0],
591
- rowIndex = row.rowIndex, // 当前行的index
592
- cellIndex = cell.cellIndex,
593
- nextCellIndex = cellIndex + 1;
594
- // 最后一列不能合并
595
- if (row.cells.length <= nextCellIndex) {
596
- return;
597
- }
598
- var nextCell = row.cells[nextCellIndex];
599
- // 左右列的rowspan不一致时不能合并
600
- if (cell.rowSpan !== nextCell.rowSpan) {
601
- return;
602
- }
603
- cell.colSpan += nextCell.colSpan;
604
- row.deleteCell(nextCellIndex);
605
- self.cmd.range.selectNodeContents(cell).collapse(true);
606
- self.cmd.select();
607
- self.addBookmark();
608
- },
609
- rowsplit : function() {
610
- var table = self.plugin.getSelectedTable()[0],
611
- row = self.plugin.getSelectedRow()[0],
612
- cell = self.plugin.getSelectedCell()[0],
613
- rowIndex = row.rowIndex;
614
- // 不是可分割单元格
615
- if (cell.rowSpan === 1) {
616
- return;
617
- }
618
- var cellIndex = _getCellIndex(table, row, cell);
619
- for (var i = 1, len = cell.rowSpan; i < len; i++) {
620
- var newRow = table.rows[rowIndex + i],
621
- newCell = newRow.insertCell(cellIndex);
622
- if (cell.colSpan > 1) {
623
- newCell.colSpan = cell.colSpan;
624
- }
625
- newCell.innerHTML = K.IE ? '' : '<br />';
626
- // 调整下一行的单元格index
627
- cellIndex = _getCellIndex(table, newRow, newCell);
628
- }
629
- K(cell).removeAttr('rowSpan');
630
- self.cmd.range.selectNodeContents(cell).collapse(true);
631
- self.cmd.select();
632
- self.addBookmark();
633
- },
634
- colsplit : function() {
635
- var table = self.plugin.getSelectedTable()[0],
636
- row = self.plugin.getSelectedRow()[0],
637
- cell = self.plugin.getSelectedCell()[0],
638
- cellIndex = cell.cellIndex;
639
- // 不是可分割单元格
640
- if (cell.colSpan === 1) {
641
- return;
642
- }
643
- for (var i = 1, len = cell.colSpan; i < len; i++) {
644
- var newCell = row.insertCell(cellIndex + i);
645
- if (cell.rowSpan > 1) {
646
- newCell.rowSpan = cell.rowSpan;
647
- }
648
- newCell.innerHTML = K.IE ? '' : '<br />';
649
- }
650
- K(cell).removeAttr('colSpan');
651
- self.cmd.range.selectNodeContents(cell).collapse(true);
652
- self.cmd.select();
653
- self.addBookmark();
654
- },
655
- coldelete : function() {
656
- var table = self.plugin.getSelectedTable()[0],
657
- row = self.plugin.getSelectedRow()[0],
658
- cell = self.plugin.getSelectedCell()[0],
659
- index = cell.cellIndex;
660
- for (var i = 0, len = table.rows.length; i < len; i++) {
661
- var newRow = table.rows[i],
662
- newCell = newRow.cells[index];
663
- if (newCell.colSpan > 1) {
664
- newCell.colSpan -= 1;
665
- if (newCell.colSpan === 1) {
666
- K(newCell).removeAttr('colSpan');
667
- }
668
- } else {
669
- newRow.deleteCell(index);
670
- }
671
- // 跳过不需要删除的行
672
- if (newCell.rowSpan > 1) {
673
- i += newCell.rowSpan - 1;
674
- }
675
- }
676
- if (row.cells.length === 0) {
677
- self.cmd.range.setStartBefore(table).collapse(true);
678
- self.cmd.select();
679
- K(table).remove();
680
- } else {
681
- self.cmd.selection(true);
682
- }
683
- self.addBookmark();
684
- },
685
- rowdelete : function() {
686
- var table = self.plugin.getSelectedTable()[0],
687
- row = self.plugin.getSelectedRow()[0],
688
- cell = self.plugin.getSelectedCell()[0],
689
- rowIndex = row.rowIndex;
690
- // 从下到上删除
691
- for (var i = cell.rowSpan - 1; i >= 0; i--) {
692
- table.deleteRow(rowIndex + i);
693
- }
694
- if (table.rows.length === 0) {
695
- self.cmd.range.setStartBefore(table).collapse(true);
696
- self.cmd.select();
697
- K(table).remove();
698
- } else {
699
- self.cmd.selection(true);
700
- }
701
- self.addBookmark();
702
- }
703
- };
704
- self.clickToolbar(name, self.plugin.table.prop);
705
- });