main.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>KindEditor Main Test</title>
  6. <!-- <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> -->
  7. <!-- <script src="../lib/firebug-lite/build/firebug-lite.js#startOpened"></script> -->
  8. <link rel="stylesheet" href="../themes/default/default.css?t=20120318.css" />
  9. <link rel="stylesheet" href="../themes/simple/simple.css" />
  10. <style>
  11. .selected {
  12. padding: 10px;
  13. margin: 10px;
  14. }
  15. table, td, tr {
  16. padding: 10px;
  17. margin: 10px;
  18. }
  19. </style>
  20. <script src="../src/core.js"></script>
  21. <script src="../src/config.js"></script>
  22. <script src="../src/event.js"></script>
  23. <script src="../src/html.js"></script>
  24. <script src="../src/selector.js"></script>
  25. <script src="../src/node.js"></script>
  26. <script src="../src/range.js"></script>
  27. <script src="../src/cmd.js"></script>
  28. <script src="../src/widget.js"></script>
  29. <script src="../src/edit.js"></script>
  30. <script src="../src/toolbar.js"></script>
  31. <script src="../src/menu.js"></script>
  32. <script src="../src/colorpicker.js"></script>
  33. <script src="../src/uploadbutton.js"></script>
  34. <script src="../src/dialog.js"></script>
  35. <script src="../src/tabs.js"></script>
  36. <script src="../src/ajax.js"></script>
  37. <script src="../src/main.js"></script>
  38. <script src="../lang/zh-CN.js"></script>
  39. <script src="../lang/en.js"></script>
  40. <script src="../plugins/emoticons/emoticons.js"></script>
  41. <script src="../plugins/flash/flash.js"></script>
  42. <script src="../plugins/link/link.js"></script>
  43. <script src="../plugins/media/media.js"></script>
  44. <script src="../plugins/plainpaste/plainpaste.js"></script>
  45. <script src="../plugins/table/table.js"></script>
  46. <script src="../plugins/wordpaste/wordpaste.js"></script>
  47. <script src="../plugins/filemanager/filemanager.js"></script>
  48. <script src="../plugins/preview/preview.js"></script>
  49. <script src="../plugins/code/code.js"></script>
  50. <script src="../plugins/map/map.js"></script>
  51. <script src="../plugins/lineheight/lineheight.js"></script>
  52. <script src="../plugins/clearhtml/clearhtml.js"></script>
  53. <script src="../plugins/table/table.js"></script>
  54. <script src="../plugins/fixtoolbar/fixtoolbar.js"></script>
  55. <script src="../plugins/autoheight/autoheight.js"></script>
  56. </head>
  57. <body>
  58. <h1 id="type">KindEditor Main Test</h1>
  59. <table id="menu">
  60. <tr>
  61. <td align="center">
  62. <form method="post" action="../php/demo.php">
  63. <textarea name="content1" cols="100" rows="20" style="width:100%;height:200px;"><div>
  64. <img alt="" src="/kindeditor/plugins/emoticons/images/0.gif" />
  65. <div>
  66. 123
  67. </div>
  68. </div>
  69. </textarea>
  70. <br />
  71. <textarea name="content2" cols="100" rows="20" style="width:80%;height:200px;"><table style="width:100%;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
  72. <tbody>
  73. <tr>
  74. <td rowspan="3">
  75. <br />
  76. </td>
  77. <td>
  78. <br />
  79. </td>
  80. <td>
  81. <br />
  82. </td>
  83. <td>
  84. <br />
  85. </td>
  86. <td>
  87. <br />
  88. </td>
  89. </tr>
  90. <tr>
  91. <td>
  92. <br />
  93. </td>
  94. <td>
  95. <br />
  96. </td>
  97. <td>
  98. <br />
  99. </td>
  100. <td>
  101. <br />
  102. </td>
  103. </tr>
  104. <tr>
  105. <td>
  106. <br />
  107. </td>
  108. <td>
  109. <br />
  110. </td>
  111. <td>
  112. <br />
  113. </td>
  114. <td>
  115. <br />
  116. </td>
  117. </tr>
  118. <tr>
  119. <td>
  120. <br />
  121. </td>
  122. <td>
  123. <br />
  124. </td>
  125. <td>
  126. <br />
  127. </td>
  128. <td>
  129. <br />
  130. </td>
  131. <td>
  132. <br />
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>
  137. <br />
  138. </td>
  139. <td>
  140. <br />
  141. </td>
  142. <td>
  143. <br />
  144. </td>
  145. <td>
  146. <br />
  147. </td>
  148. <td>
  149. <br />
  150. </td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. <br />
  155. <br />
  156. <input checked="checked" type="radio" />
  157. <p>
  158. 在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。
  159. </p>
  160. <p>
  161. 在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。
  162. </p>
  163. <p>
  164. 在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。
  165. </p>
  166. <p>
  167. 在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。
  168. </p><input checked="checked" type="radio">
  169. <p>在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。</p>
  170. <p>在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。</p>
  171. <p>在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。</p>
  172. <p>在 Opera 浏览器下使用 KindEditor 有这么一个问题,当你编辑一篇长文章,而且编辑器中的内容已经滚动到最底部时,这时候我复制了一些文本到文章最底下。编辑器就会自动将内容滚动的最开始,然后我又要拉滚动条到最下方去添加更多内容。</p>
  173. </textarea>
  174. <br />
  175. <select id="uploadFile">
  176. <option value="">附件列表</option>
  177. </select>
  178. <br />
  179. HTML计数:<span id="J_count1"></span>
  180. <br />
  181. <!-- <iframe src="http://test.domain.com/github-kindsoft/kindeditor/test/leak.html"></iframe> -->
  182. <textarea id="insertHtml" style="width:90%;"><!-- comment test --><strong>abcd</strong></textarea>
  183. <br />
  184. <input type="button" id="create1" value="Create #1" />
  185. <input type="button" id="create2" value="Create #2" />
  186. <input type="button" id="remove1" value="Remove #1" />
  187. <input type="button" id="remove2" value="Remove #2" />
  188. <input type="button" id="getHtml1" value="Get HTML #1" />
  189. <input type="button" id="fullHtml1" value="Get Full HTML #1" />
  190. <input type="button" id="setHtml1" value="Set HTML #1" />
  191. <input type="button" id="empty1" value="Empty #1" />
  192. <input type="button" id="getText1" value="Get Text #1" />
  193. <input type="button" id="setText1" value="Set Text #1" />
  194. <input type="button" id="selectedHtml1" value="Get Selected HTML #1" />
  195. <input type="button" id="insertHtml1" value="Insert HTML #1" />
  196. <input type="button" id="appendHtml1" value="Append HTML #1" />
  197. <input type="button" id="sync1" value="Sync #1" />
  198. <input type="button" id="focus1" value="Focus #1" />
  199. <input type="button" id="blur1" value="Blur #1" />
  200. <input type="button" id="readonly1" value="Readonly #1" />
  201. <input type="button" id="cancelReadonly1" value="Cancel Readonly #1" />
  202. <input type="button" id="isEmpty1" value="Is Empty #1" />
  203. <input type="button" id="isDirty1" value="Is Dirty #1" />
  204. <input type="button" id="loadPlugin1" value="Load Plugin #1" />
  205. <input type="submit" name="button" value="Submit" />
  206. <input type="reset" name="button" value="Reset" />
  207. <input type="text" id="url" value="" /> <input type="button" id="image" value="选择图片" />
  208. </form>
  209. <script>
  210. KindEditor.DEBUG = true;
  211. KindEditor.options.filterMode = false;
  212. KindEditor.options.autoHeightMode = true;
  213. KindEditor.options.fixToolBar = true;
  214. //document.domain = 'domain.com';
  215. KindEditor.basePath = '../';
  216. KindEditor.ready(function(K) {
  217. var editor1 = K.create('textarea[name=content1]', {
  218. basePath : '../',
  219. pluginsPath : '../plugins/',
  220. urlType : 'absolute',
  221. themeType : 'simple',
  222. allowImageUpload : true,
  223. allowImageRemote : true,
  224. allowFileUpload : true,
  225. designMode : true,
  226. allowFileManager : true,
  227. fullscreenMode : false,
  228. formatUploadUrl : false,
  229. fullscreenShortcut : false,
  230. newlineTag : 'p',
  231. pasteType : 1,
  232. extraFileUploadParams : {
  233. 'testParam1' : 'a',
  234. 'testParam2' : 'b'
  235. },
  236. //afterTab : function() {
  237. //editor2.focus();
  238. //},
  239. afterChange : function() {
  240. K('#J_count1').html(this.count());
  241. //console.log('1');
  242. },
  243. afterUpload : function(url, data, name) {
  244. var select = K('#uploadFile')[0];
  245. select.options.add(new Option(url, url));
  246. console.log(data);
  247. console.log(name);
  248. },
  249. afterSelectFile : function(url) {
  250. var select = K('#uploadFile')[0];
  251. select.options.add(new Option(url, url));
  252. },
  253. afterCreate : function() {
  254. //this.loadPlugin('autoheight');
  255. }
  256. });
  257. K('#create1').click(function(e) {
  258. editor1.create();
  259. });
  260. K('#remove1').click(function(e) {
  261. editor1.remove();
  262. });
  263. K('#getHtml1').click(function(e) {
  264. alert(editor1.html());
  265. });
  266. K('#fullHtml1').click(function(e) {
  267. alert(editor1.fullHtml());
  268. });
  269. K('#setHtml1').click(function(e) {
  270. editor1.html(K('#insertHtml').val());
  271. });
  272. K('#empty1').click(function(e) {
  273. editor1.html('');
  274. });
  275. K('#getText1').click(function(e) {
  276. alert(editor1.text());
  277. });
  278. K('#setText1').click(function(e) {
  279. editor1.text(K('#insertHtml').val());
  280. });
  281. K('#selectedHtml1').click(function(e) {
  282. alert(editor1.selectedHtml());
  283. });
  284. K('#insertHtml1').click(function(e) {
  285. editor1.insertHtml(K('#insertHtml').val());
  286. });
  287. K('#appendHtml1').click(function(e) {
  288. editor1.appendHtml(K('#insertHtml').val());
  289. });
  290. K('#sync1').click(function(e) {
  291. editor1.sync();
  292. alert(K('textarea[name=content1]').val());
  293. });
  294. K('#focus1').click(function(e) {
  295. editor1.focus();
  296. });
  297. K('#blur1').click(function(e) {
  298. editor1.blur();
  299. });
  300. K('#readonly1').click(function(e) {
  301. editor1.readonly();
  302. });
  303. K('#cancelReadonly1').click(function(e) {
  304. editor1.readonly(false);
  305. });
  306. K('#isEmpty1').click(function(e) {
  307. alert(editor1.isEmpty());
  308. });
  309. K('#isDirty1').click(function(e) {
  310. alert(editor1.isDirty());
  311. });
  312. K('#loadPlugin1').click(function(e) {
  313. editor1.loadPlugin('template', function() {
  314. });
  315. editor1.loadPlugin('template', function() {
  316. });
  317. });
  318. var editor2 = K.create(K('textarea[name=content2]').get(), {
  319. basePath : '../',
  320. langType : 'en',
  321. formatUploadUrl : false,
  322. afterTab : function() {
  323. K('#uploadFile')[0].focus();
  324. },
  325. afterCreate : function() {
  326. //this.loadPlugin('autoheight');
  327. }
  328. });
  329. K('#create2').click(function(e) {
  330. editor2.create();
  331. });
  332. K('#remove2').click(function(e) {
  333. editor2.remove();
  334. });
  335. var editor3 = K.editor({
  336. basePath : '../',
  337. themesPath : '../themes/',
  338. pluginsPath : '../plugins/',
  339. langPath : '../lang/',
  340. allowFileManager : true
  341. });
  342. K('#image').click(function() {
  343. editor3.loadPlugin('image', function() {
  344. editor3.plugin.imageDialog({
  345. imageUrl : K('#url').val(),
  346. clickFn : function(url, title, width, height, border, align) {
  347. K('#url').val(url);
  348. editor3.hideDialog();
  349. }
  350. });
  351. });
  352. });
  353. K.create('textarea[name=content1]');
  354. //K(window).bind('resize', function(e) {
  355. // editor1.resize(null, document.documentElement.clientHeight);
  356. //});
  357. });
  358. </script>
  359. </td>
  360. </tr>
  361. </table>
  362. <div style="height:1000px;"></div>
  363. </body>
  364. </html>