diff --git a/asset-manifest.json b/asset-manifest.json
deleted file mode 100644
index 5f05370e8..000000000
--- a/asset-manifest.json
+++ /dev/null
@@ -1,196 +0,0 @@
-{
- "./static/js/0.15abc98e.chunk.js": "/react/build/./static/js/0.15abc98e.chunk.js",
- "static/css/1.50ff7122.chunk.css": "/react/build/static/css/1.50ff7122.chunk.css",
- "./static/js/1.3c8bde58.chunk.js": "/react/build/./static/js/1.3c8bde58.chunk.js",
- "./static/js/2.bc87859a.chunk.js": "/react/build/./static/js/2.bc87859a.chunk.js",
- "static/css/3.8fcaeca1.chunk.css": "/react/build/static/css/3.8fcaeca1.chunk.css",
- "./static/js/3.ed73acdc.chunk.js": "/react/build/./static/js/3.ed73acdc.chunk.js",
- "static/css/4.8c0097ca.chunk.css": "/react/build/static/css/4.8c0097ca.chunk.css",
- "./static/js/4.78288daa.chunk.js": "/react/build/./static/js/4.78288daa.chunk.js",
- "static/css/5.5d2538f7.chunk.css": "/react/build/static/css/5.5d2538f7.chunk.css",
- "./static/js/5.a0c1abdb.chunk.js": "/react/build/./static/js/5.a0c1abdb.chunk.js",
- "static/css/6.f89d762e.chunk.css": "/react/build/static/css/6.f89d762e.chunk.css",
- "./static/js/6.d9db8079.chunk.js": "/react/build/./static/js/6.d9db8079.chunk.js",
- "./static/js/7.608d131e.chunk.js": "/react/build/./static/js/7.608d131e.chunk.js",
- "static/css/8.97377e5a.chunk.css": "/react/build/static/css/8.97377e5a.chunk.css",
- "./static/js/8.febda9cc.chunk.js": "/react/build/./static/js/8.febda9cc.chunk.js",
- "static/css/9.ce94a75e.chunk.css": "/react/build/static/css/9.ce94a75e.chunk.css",
- "./static/js/9.a9e4f855.chunk.js": "/react/build/./static/js/9.a9e4f855.chunk.js",
- "static/css/10.02258798.chunk.css": "/react/build/static/css/10.02258798.chunk.css",
- "./static/js/10.ba9b8069.chunk.js": "/react/build/./static/js/10.ba9b8069.chunk.js",
- "static/css/11.620a5b46.chunk.css": "/react/build/static/css/11.620a5b46.chunk.css",
- "./static/js/11.a38a90f3.chunk.js": "/react/build/./static/js/11.a38a90f3.chunk.js",
- "./static/js/12.90f473da.chunk.js": "/react/build/./static/js/12.90f473da.chunk.js",
- "static/css/13.10c72c84.chunk.css": "/react/build/static/css/13.10c72c84.chunk.css",
- "./static/js/13.5d60f875.chunk.js": "/react/build/./static/js/13.5d60f875.chunk.js",
- "static/css/14.71708f66.chunk.css": "/react/build/static/css/14.71708f66.chunk.css",
- "./static/js/14.12f3c6cc.chunk.js": "/react/build/./static/js/14.12f3c6cc.chunk.js",
- "static/css/15.e100b89b.chunk.css": "/react/build/static/css/15.e100b89b.chunk.css",
- "./static/js/15.2158c43b.chunk.js": "/react/build/./static/js/15.2158c43b.chunk.js",
- "static/css/16.2e5d8775.chunk.css": "/react/build/static/css/16.2e5d8775.chunk.css",
- "./static/js/16.ead6c073.chunk.js": "/react/build/./static/js/16.ead6c073.chunk.js",
- "static/css/17.5c0bd092.chunk.css": "/react/build/static/css/17.5c0bd092.chunk.css",
- "./static/js/17.1c256a16.chunk.js": "/react/build/./static/js/17.1c256a16.chunk.js",
- "static/css/18.9817d0c2.chunk.css": "/react/build/static/css/18.9817d0c2.chunk.css",
- "./static/js/18.bcc1e998.chunk.js": "/react/build/./static/js/18.bcc1e998.chunk.js",
- "static/css/19.5aa5391a.chunk.css": "/react/build/static/css/19.5aa5391a.chunk.css",
- "./static/js/19.7d4b1fca.chunk.js": "/react/build/./static/js/19.7d4b1fca.chunk.js",
- "static/css/20.d6d09ada.chunk.css": "/react/build/static/css/20.d6d09ada.chunk.css",
- "./static/js/20.31aeb849.chunk.js": "/react/build/./static/js/20.31aeb849.chunk.js",
- "static/css/21.f7d6412c.chunk.css": "/react/build/static/css/21.f7d6412c.chunk.css",
- "./static/js/21.21fcfd06.chunk.js": "/react/build/./static/js/21.21fcfd06.chunk.js",
- "static/css/22.f7d6412c.chunk.css": "/react/build/static/css/22.f7d6412c.chunk.css",
- "./static/js/22.cc1f6308.chunk.js": "/react/build/./static/js/22.cc1f6308.chunk.js",
- "static/css/23.f7d6412c.chunk.css": "/react/build/static/css/23.f7d6412c.chunk.css",
- "./static/js/23.d606bf2a.chunk.js": "/react/build/./static/js/23.d606bf2a.chunk.js",
- "static/css/24.524120d2.chunk.css": "/react/build/static/css/24.524120d2.chunk.css",
- "./static/js/24.dc0bec62.chunk.js": "/react/build/./static/js/24.dc0bec62.chunk.js",
- "static/css/25.92fbc085.chunk.css": "/react/build/static/css/25.92fbc085.chunk.css",
- "./static/js/25.1cf8b801.chunk.js": "/react/build/./static/js/25.1cf8b801.chunk.js",
- "static/css/26.b9de3e4e.chunk.css": "/react/build/static/css/26.b9de3e4e.chunk.css",
- "./static/js/26.cb988d4f.chunk.js": "/react/build/./static/js/26.cb988d4f.chunk.js",
- "static/css/27.b9de3e4e.chunk.css": "/react/build/static/css/27.b9de3e4e.chunk.css",
- "./static/js/27.6f8fe907.chunk.js": "/react/build/./static/js/27.6f8fe907.chunk.js",
- "static/css/28.daa6ef21.chunk.css": "/react/build/static/css/28.daa6ef21.chunk.css",
- "./static/js/28.cde8c217.chunk.js": "/react/build/./static/js/28.cde8c217.chunk.js",
- "static/css/29.24f89e07.chunk.css": "/react/build/static/css/29.24f89e07.chunk.css",
- "./static/js/29.364712b9.chunk.js": "/react/build/./static/js/29.364712b9.chunk.js",
- "static/css/30.76a31bc8.chunk.css": "/react/build/static/css/30.76a31bc8.chunk.css",
- "./static/js/30.828cd42f.chunk.js": "/react/build/./static/js/30.828cd42f.chunk.js",
- "static/css/31.b8dcc10e.chunk.css": "/react/build/static/css/31.b8dcc10e.chunk.css",
- "./static/js/31.30b0d046.chunk.js": "/react/build/./static/js/31.30b0d046.chunk.js",
- "static/css/32.ca47049f.chunk.css": "/react/build/static/css/32.ca47049f.chunk.css",
- "./static/js/32.2dd82958.chunk.js": "/react/build/./static/js/32.2dd82958.chunk.js",
- "static/css/33.1d1a9539.chunk.css": "/react/build/static/css/33.1d1a9539.chunk.css",
- "./static/js/33.2148c8eb.chunk.js": "/react/build/./static/js/33.2148c8eb.chunk.js",
- "static/css/34.acab7efd.chunk.css": "/react/build/static/css/34.acab7efd.chunk.css",
- "./static/js/34.878728fc.chunk.js": "/react/build/./static/js/34.878728fc.chunk.js",
- "static/css/35.04ea243c.chunk.css": "/react/build/static/css/35.04ea243c.chunk.css",
- "./static/js/35.f5f8e825.chunk.js": "/react/build/./static/js/35.f5f8e825.chunk.js",
- "static/css/36.1d1a9539.chunk.css": "/react/build/static/css/36.1d1a9539.chunk.css",
- "./static/js/36.023b5b68.chunk.js": "/react/build/./static/js/36.023b5b68.chunk.js",
- "static/css/37.bf188405.chunk.css": "/react/build/static/css/37.bf188405.chunk.css",
- "./static/js/37.0463c7f0.chunk.js": "/react/build/./static/js/37.0463c7f0.chunk.js",
- "static/css/38.c7312c17.chunk.css": "/react/build/static/css/38.c7312c17.chunk.css",
- "./static/js/38.d1a64b9d.chunk.js": "/react/build/./static/js/38.d1a64b9d.chunk.js",
- "static/css/39.c7312c17.chunk.css": "/react/build/static/css/39.c7312c17.chunk.css",
- "./static/js/39.a81112d1.chunk.js": "/react/build/./static/js/39.a81112d1.chunk.js",
- "static/css/40.b8e6ff52.chunk.css": "/react/build/static/css/40.b8e6ff52.chunk.css",
- "./static/js/40.16e29fd3.chunk.js": "/react/build/./static/js/40.16e29fd3.chunk.js",
- "static/css/41.869bb3b9.chunk.css": "/react/build/static/css/41.869bb3b9.chunk.css",
- "./static/js/41.6ad1095e.chunk.js": "/react/build/./static/js/41.6ad1095e.chunk.js",
- "static/css/42.640f37d5.chunk.css": "/react/build/static/css/42.640f37d5.chunk.css",
- "./static/js/42.685ba3b6.chunk.js": "/react/build/./static/js/42.685ba3b6.chunk.js",
- "static/css/43.5b9228b8.chunk.css": "/react/build/static/css/43.5b9228b8.chunk.css",
- "./static/js/43.db630713.chunk.js": "/react/build/./static/js/43.db630713.chunk.js",
- "static/css/44.5b9228b8.chunk.css": "/react/build/static/css/44.5b9228b8.chunk.css",
- "./static/js/44.c6d30961.chunk.js": "/react/build/./static/js/44.c6d30961.chunk.js",
- "static/css/45.23462c39.chunk.css": "/react/build/static/css/45.23462c39.chunk.css",
- "./static/js/45.d8277537.chunk.js": "/react/build/./static/js/45.d8277537.chunk.js",
- "static/css/46.640f37d5.chunk.css": "/react/build/static/css/46.640f37d5.chunk.css",
- "./static/js/46.698f826d.chunk.js": "/react/build/./static/js/46.698f826d.chunk.js",
- "static/css/47.fac0c3b4.chunk.css": "/react/build/static/css/47.fac0c3b4.chunk.css",
- "./static/js/47.79a0cc93.chunk.js": "/react/build/./static/js/47.79a0cc93.chunk.js",
- "static/css/48.971b56a9.chunk.css": "/react/build/static/css/48.971b56a9.chunk.css",
- "./static/js/48.db04275f.chunk.js": "/react/build/./static/js/48.db04275f.chunk.js",
- "static/css/49.d8fb7c36.chunk.css": "/react/build/static/css/49.d8fb7c36.chunk.css",
- "./static/js/49.1f000ced.chunk.js": "/react/build/./static/js/49.1f000ced.chunk.js",
- "static/css/50.d8fb7c36.chunk.css": "/react/build/static/css/50.d8fb7c36.chunk.css",
- "./static/js/50.4a14627b.chunk.js": "/react/build/./static/js/50.4a14627b.chunk.js",
- "static/css/51.64152c6c.chunk.css": "/react/build/static/css/51.64152c6c.chunk.css",
- "./static/js/51.f4fe4f71.chunk.js": "/react/build/./static/js/51.f4fe4f71.chunk.js",
- "static/css/52.5b9228b8.chunk.css": "/react/build/static/css/52.5b9228b8.chunk.css",
- "./static/js/52.d6b61755.chunk.js": "/react/build/./static/js/52.d6b61755.chunk.js",
- "./static/js/53.1285bda7.chunk.js": "/react/build/./static/js/53.1285bda7.chunk.js",
- "./static/js/54.9e5c2e43.chunk.js": "/react/build/./static/js/54.9e5c2e43.chunk.js",
- "static/css/55.2163ee97.chunk.css": "/react/build/static/css/55.2163ee97.chunk.css",
- "./static/js/55.2c551b30.chunk.js": "/react/build/./static/js/55.2c551b30.chunk.js",
- "static/css/56.8725ffda.chunk.css": "/react/build/static/css/56.8725ffda.chunk.css",
- "./static/js/56.0849250f.chunk.js": "/react/build/./static/js/56.0849250f.chunk.js",
- "static/css/57.8954a771.chunk.css": "/react/build/static/css/57.8954a771.chunk.css",
- "./static/js/57.e895f489.chunk.js": "/react/build/./static/js/57.e895f489.chunk.js",
- "./static/js/58.5493a340.chunk.js": "/react/build/./static/js/58.5493a340.chunk.js",
- "./static/js/59.afc61b25.chunk.js": "/react/build/./static/js/59.afc61b25.chunk.js",
- "./static/js/60.11d0009d.chunk.js": "/react/build/./static/js/60.11d0009d.chunk.js",
- "./static/js/61.e485fab4.chunk.js": "/react/build/./static/js/61.e485fab4.chunk.js",
- "./static/js/62.10582f58.chunk.js": "/react/build/./static/js/62.10582f58.chunk.js",
- "./static/js/63.2b2cfa71.chunk.js": "/react/build/./static/js/63.2b2cfa71.chunk.js",
- "./static/js/64.a82d4dc0.chunk.js": "/react/build/./static/js/64.a82d4dc0.chunk.js",
- "static/css/65.64152c6c.chunk.css": "/react/build/static/css/65.64152c6c.chunk.css",
- "./static/js/65.ed0675a6.chunk.js": "/react/build/./static/js/65.ed0675a6.chunk.js",
- "static/css/66.c092eb71.chunk.css": "/react/build/static/css/66.c092eb71.chunk.css",
- "./static/js/66.7c139002.chunk.js": "/react/build/./static/js/66.7c139002.chunk.js",
- "./static/js/67.44f243f2.chunk.js": "/react/build/./static/js/67.44f243f2.chunk.js",
- "./static/js/68.9e442481.chunk.js": "/react/build/./static/js/68.9e442481.chunk.js",
- "./static/js/69.32ab52f0.chunk.js": "/react/build/./static/js/69.32ab52f0.chunk.js",
- "./static/js/70.4e00caee.chunk.js": "/react/build/./static/js/70.4e00caee.chunk.js",
- "./static/js/71.eadd28a0.chunk.js": "/react/build/./static/js/71.eadd28a0.chunk.js",
- "./static/js/72.fb21ca86.chunk.js": "/react/build/./static/js/72.fb21ca86.chunk.js",
- "./static/js/73.c394711e.chunk.js": "/react/build/./static/js/73.c394711e.chunk.js",
- "./static/js/74.38b1b34f.chunk.js": "/react/build/./static/js/74.38b1b34f.chunk.js",
- "./static/js/75.54d54d76.chunk.js": "/react/build/./static/js/75.54d54d76.chunk.js",
- "./static/js/76.b386a122.chunk.js": "/react/build/./static/js/76.b386a122.chunk.js",
- "./static/js/77.4e88fd6c.chunk.js": "/react/build/./static/js/77.4e88fd6c.chunk.js",
- "./static/js/78.6713a1c9.chunk.js": "/react/build/./static/js/78.6713a1c9.chunk.js",
- "./static/js/79.0ce312a8.chunk.js": "/react/build/./static/js/79.0ce312a8.chunk.js",
- "./static/js/80.b176e49c.chunk.js": "/react/build/./static/js/80.b176e49c.chunk.js",
- "./static/js/81.bc72c6f2.chunk.js": "/react/build/./static/js/81.bc72c6f2.chunk.js",
- "./static/js/82.a89b9e37.chunk.js": "/react/build/./static/js/82.a89b9e37.chunk.js",
- "./static/js/83.68a33ebd.chunk.js": "/react/build/./static/js/83.68a33ebd.chunk.js",
- "./static/js/84.c899f74c.chunk.js": "/react/build/./static/js/84.c899f74c.chunk.js",
- "./static/js/85.fc2da9c6.chunk.js": "/react/build/./static/js/85.fc2da9c6.chunk.js",
- "./static/js/86.38ef67dc.chunk.js": "/react/build/./static/js/86.38ef67dc.chunk.js",
- "./static/js/87.e623d9fa.chunk.js": "/react/build/./static/js/87.e623d9fa.chunk.js",
- "./static/js/88.86d31a1a.chunk.js": "/react/build/./static/js/88.86d31a1a.chunk.js",
- "./static/js/89.ab63441c.chunk.js": "/react/build/./static/js/89.ab63441c.chunk.js",
- "./static/js/90.b52f5e75.chunk.js": "/react/build/./static/js/90.b52f5e75.chunk.js",
- "./static/js/91.122610d5.chunk.js": "/react/build/./static/js/91.122610d5.chunk.js",
- "./static/js/92.eafa84b4.chunk.js": "/react/build/./static/js/92.eafa84b4.chunk.js",
- "./static/js/93.5452cabe.chunk.js": "/react/build/./static/js/93.5452cabe.chunk.js",
- "./static/js/94.abf12c54.chunk.js": "/react/build/./static/js/94.abf12c54.chunk.js",
- "./static/js/95.ed3650a6.chunk.js": "/react/build/./static/js/95.ed3650a6.chunk.js",
- "./static/js/96.7029da86.chunk.js": "/react/build/./static/js/96.7029da86.chunk.js",
- "./static/js/97.14042baa.chunk.js": "/react/build/./static/js/97.14042baa.chunk.js",
- "./static/js/98.b8a10333.chunk.js": "/react/build/./static/js/98.b8a10333.chunk.js",
- "./static/js/99.931531ce.chunk.js": "/react/build/./static/js/99.931531ce.chunk.js",
- "./static/js/100.7ad66635.chunk.js": "/react/build/./static/js/100.7ad66635.chunk.js",
- "./static/js/101.5116f031.chunk.js": "/react/build/./static/js/101.5116f031.chunk.js",
- "./static/js/102.7e1f662e.chunk.js": "/react/build/./static/js/102.7e1f662e.chunk.js",
- "./static/js/103.c446ea6d.chunk.js": "/react/build/./static/js/103.c446ea6d.chunk.js",
- "./static/js/104.993a9335.chunk.js": "/react/build/./static/js/104.993a9335.chunk.js",
- "./static/js/105.51696fcf.chunk.js": "/react/build/./static/js/105.51696fcf.chunk.js",
- "./static/js/106.053e7538.chunk.js": "/react/build/./static/js/106.053e7538.chunk.js",
- "./static/js/107.79abf896.chunk.js": "/react/build/./static/js/107.79abf896.chunk.js",
- "./static/js/108.0bdc4d50.chunk.js": "/react/build/./static/js/108.0bdc4d50.chunk.js",
- "./static/js/109.a9d79ab1.chunk.js": "/react/build/./static/js/109.a9d79ab1.chunk.js",
- "./static/js/110.abe84fa4.chunk.js": "/react/build/./static/js/110.abe84fa4.chunk.js",
- "./static/js/111.151891b1.chunk.js": "/react/build/./static/js/111.151891b1.chunk.js",
- "./static/js/112.54ea5c5f.chunk.js": "/react/build/./static/js/112.54ea5c5f.chunk.js",
- "./static/js/113.2962abe2.chunk.js": "/react/build/./static/js/113.2962abe2.chunk.js",
- "./static/js/114.49bf6bfe.chunk.js": "/react/build/./static/js/114.49bf6bfe.chunk.js",
- "./static/js/115.2c55ac51.chunk.js": "/react/build/./static/js/115.2c55ac51.chunk.js",
- "./static/js/116.7b6a7794.chunk.js": "/react/build/./static/js/116.7b6a7794.chunk.js",
- "./static/js/117.9ba3a8f5.chunk.js": "/react/build/./static/js/117.9ba3a8f5.chunk.js",
- "./static/js/118.99b51c21.chunk.js": "/react/build/./static/js/118.99b51c21.chunk.js",
- "./static/js/119.94c5dc93.chunk.js": "/react/build/./static/js/119.94c5dc93.chunk.js",
- "./static/js/120.ad51b51e.chunk.js": "/react/build/./static/js/120.ad51b51e.chunk.js",
- "./static/js/121.36d6d72f.chunk.js": "/react/build/./static/js/121.36d6d72f.chunk.js",
- "./static/js/122.fdc2aaa0.chunk.js": "/react/build/./static/js/122.fdc2aaa0.chunk.js",
- "./static/js/123.2fbd9f6c.chunk.js": "/react/build/./static/js/123.2fbd9f6c.chunk.js",
- "main.css": "/react/build/static/css/main.62a41eaa.chunk.css",
- "main.js": "/react/build/./static/js/main.a5460cb5.chunk.js",
- "runtime~main.js": "/react/build/./static/js/runtime~main.7cb32796.js",
- "./static/js/118.99b51c21.chunk.js.LICENSE.txt": "/react/build/./static/js/118.99b51c21.chunk.js.LICENSE.txt",
- "./static/js/7.608d131e.chunk.js.LICENSE.txt": "/react/build/./static/js/7.608d131e.chunk.js.LICENSE.txt",
- "./static/js/9.a9e4f855.chunk.js.LICENSE.txt": "/react/build/./static/js/9.a9e4f855.chunk.js.LICENSE.txt",
- "./static/js/main.a5460cb5.chunk.js.LICENSE.txt": "/react/build/./static/js/main.a5460cb5.chunk.js.LICENSE.txt",
- "css.worker.js": "/react/build/css.worker.js",
- "editor.worker.js": "/react/build/editor.worker.js",
- "html.worker.js": "/react/build/html.worker.js",
- "index.html": "/react/build/index.html",
- "json.worker.js": "/react/build/json.worker.js",
- "static/media/katex.min.css": "/react/build/static/media/KaTeX_Typewriter-Regular.d3c8e68f.woff",
- "static/media/list.css": "/react/build/static/media/banner_list.690e0e74.png",
- "ts.worker.js": "/react/build/ts.worker.js",
- "ts.worker.js.LICENSE.txt": "/react/build/ts.worker.js.LICENSE.txt"
-}
\ No newline at end of file
diff --git a/assets/kindeditor/kindeditor.js b/assets/kindeditor/kindeditor.js
deleted file mode 100644
index 1df0f835a..000000000
--- a/assets/kindeditor/kindeditor.js
+++ /dev/null
@@ -1,6272 +0,0 @@
-//function dump_obj(myObject) {
-// var s = "";
-// for (var property in myObject) {
-// s = s + "\n "+property +": " + myObject[property] ;
-// }
-// alert(s)
-/*******************************************************************************
-* KindEditor - WYSIWYG HTML Editor for Internet
-* Copyright (C) 2006-2013 kindsoft.net
-*
-* @author Roddy
-* @website http://www.kindsoft.net/
-* @licence http://www.kindsoft.net/license.php
-* @version 4.1.10 (2013-11-23)
-*******************************************************************************/
-(function (window, undefined) {
- if (window.KindEditor) {
- return;
- }
-if (!window.console) {
- window.console = {};
-}
-if (!console.log) {
- console.log = function () {};
-}
-var _VERSION = '4.1.10 (2013-11-23)',
- _ua = navigator.userAgent.toLowerCase(),
- _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
- _NEWIE = _ua.indexOf('msie') == -1 && _ua.indexOf('trident') > -1,
- _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
- _WEBKIT = _ua.indexOf('applewebkit') > -1,
- _OPERA = _ua.indexOf('opera') > -1,
- _MOBILE = _ua.indexOf('mobile') > -1,
- _IOS = /ipad|iphone|ipod/.test(_ua),
- _QUIRKS = document.compatMode != 'CSS1Compat',
- _IERANGE = !window.getSelection,
- _matches = /(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua),
- _V = _matches ? _matches[1] : '0',
- _TIME = new Date().getTime();
-function _isArray(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Array]';
-}
-function _isFunction(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Function]';
-}
-function _inArray(val, arr) {
- for (var i = 0, len = arr.length; i < len; i++) {
- if (val === arr[i]) {
- return i;
- }
- }
- return -1;
-}
-function _each(obj, fn) {
- if (_isArray(obj)) {
- for (var i = 0, len = obj.length; i < len; i++) {
- if (fn.call(obj[i], i, obj[i]) === false) {
- break;
- }
- }
- } else {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- if (fn.call(obj[key], key, obj[key]) === false) {
- break;
- }
- }
- }
- }
-}
-function _trim(str) {
- return str.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '');
-}
-function _inString(val, str, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- return (delimiter + str + delimiter).indexOf(delimiter + val + delimiter) >= 0;
-}
-function _addUnit(val, unit) {
- unit = unit || 'px';
- //return val && /^\d+$/.test(val) ? val + unit : val;
- return val && /^-?\d+(?:\.\d+)?$/.test(val) ? val + unit : val;
-}
-function _removeUnit(val) {
- var match;
- return val && (match = /(\d+)/.exec(val)) ? parseInt(match[1], 10) : 0;
-}
-function _escape(val) {
- return val.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
-}
-function _unescape(val) {
- return val.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&');
-}
-function _toCamel(str) {
- var arr = str.split('-');
- str = '';
- _each(arr, function(key, val) {
- str += (key > 0) ? val.charAt(0).toUpperCase() + val.substr(1) : val;
- });
- return str;
-}
-function _toHex(val) {
- function hex(d) {
- var s = parseInt(d, 10).toString(16).toUpperCase();
- return s.length > 1 ? s : '0' + s;
- }
- return val.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,
- function($0, $1, $2, $3) {
- return '#' + hex($1) + hex($2) + hex($3);
- }
- );
-}
-function _toMap(val, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- var map = {}, arr = _isArray(val) ? val : val.split(delimiter), match;
- _each(arr, function(key, val) {
- if ((match = /^(\d+)\.\.(\d+)$/.exec(val))) {
- for (var i = parseInt(match[1], 10); i <= parseInt(match[2], 10); i++) {
- map[i.toString()] = true;
- }
- } else {
- map[val] = true;
- }
- });
- return map;
-}
-function _toArray(obj, offset) {
- return Array.prototype.slice.call(obj, offset || 0);
-}
-function _undef(val, defaultVal) {
- return val === undefined ? defaultVal : val;
-}
-function _invalidUrl(url) {
- return !url || /[<>"]/.test(url);
-}
-function _addParam(url, param) {
- return url.indexOf('?') >= 0 ? url + '&' + param : url + '?' + param;
-}
-function _extend(child, parent, proto) {
- if (!proto) {
- proto = parent;
- parent = null;
- }
- var childProto;
- if (parent) {
- var fn = function () {};
- fn.prototype = parent.prototype;
- childProto = new fn();
- _each(proto, function(key, val) {
- childProto[key] = val;
- });
- } else {
- childProto = proto;
- }
- childProto.constructor = child;
- child.prototype = childProto;
- child.parent = parent ? parent.prototype : null;
-}
-function _json(text) {
- var match;
- if ((match = /\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))) {
- text = match[0];
- }
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
- if (/^[\],:{}\s]*$/.
- test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
- replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
- replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- return eval('(' + text + ')');
- }
- throw 'JSON parse error';
-}
-var _round = Math.round;
-var K = {
- DEBUG : false,
- VERSION : _VERSION,
- IE : _IE,
- GECKO : _GECKO,
- WEBKIT : _WEBKIT,
- OPERA : _OPERA,
- V : _V,
- TIME : _TIME,
- each : _each,
- isArray : _isArray,
- isFunction : _isFunction,
- inArray : _inArray,
- inString : _inString,
- trim : _trim,
- addUnit : _addUnit,
- removeUnit : _removeUnit,
- escape : _escape,
- unescape : _unescape,
- toCamel : _toCamel,
- toHex : _toHex,
- toMap : _toMap,
- toArray : _toArray,
- undef : _undef,
- invalidUrl : _invalidUrl,
- addParam : _addParam,
- extend : _extend,
- json : _json
-};
-var _INLINE_TAG_MAP = _toMap('a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'),
- _BLOCK_TAG_MAP = _toMap('address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul'),
- _SINGLE_TAG_MAP = _toMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'),
- _STYLE_TAG_MAP = _toMap('b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u'),
- _CONTROL_TAG_MAP = _toMap('img,table,input,textarea,button'),
- _PRE_TAG_MAP = _toMap('pre,style,script'),
- _NOSPLIT_TAG_MAP = _toMap('html,head,body,td,tr,table,ol,ul,li'),
- _AUTOCLOSE_TAG_MAP = _toMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'),
- _FILL_ATTR_MAP = _toMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),
- _VALUE_TAG_MAP = _toMap('input,button,textarea,select');
-// Begining of modification by Macrow
-function _getBasePath() {
- var refPath = '/assets/kindeditor/';
- var els = document.getElementsByTagName('script'), src;
- for (var i = 0, len = els.length; i < len; i++) {
- src = els[i].src || '';
- if (/(kindeditor|application)[\w\-\.]*\.js/.test(src)) {
- return src.substring(0, src.indexOf('assets')) + refPath;
- }
- }
- return refPath;
-}
-// End of modification by Macrow
-K.basePath = _getBasePath();
-K.options = {
- placeholder : '',
- local_storage_mdu : '',
- local_storage_id : '',
- designMode : true,
- fullscreenMode : false,
- filterMode : true,
- wellFormatMode : true,
- shadowMode : true,
- loadStyleMode : true,
- basePath : K.basePath,
- emotionsBasePath: '', //TODO http://forge.trustie.net
- themesPath : K.basePath + 'themes/',
- langPath : K.basePath + 'lang/',
- pluginsPath : K.basePath + 'plugins/',
- themeType : 'default',
- langType : 'zh_CN',
- urlType : '',
- newlineTag : 'p',
- resizeType : 1,
- syncType : 'form',
- pasteType : 2,
- dialogAlignType : 'page',
- useContextmenu : true,
- fullscreenShortcut : false,
- bodyClass : 'ke-content',
- indentChar : '\t',
- cssPath : K.basePath +'plugins/code/previewcode.css',
- cssData : 'font{color:black;}',
- minWidth : 650,
- minHeight : 100,
- minChangeSize : 1,
- zIndex : 811213,
- items : ['code','emoticons','fontname',
- 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
- 'formatblock', 'fontsize', '|','indent', 'outdent',
- '|','imagedirectupload','table', 'media', 'preview',"more"
- ],
- noDisableItems : ['source', 'fullscreen'],
- colorTable : [
- ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'],
- ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'],
- ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'],
- ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000']
- ],
- fontSizeTable : ['选中的字体大小:','9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'],
- htmlTags : {
- font : ['id', 'class', 'color', 'size', 'face', '.background-color'],
- span : [
- 'id', 'class', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height', 'data-user-id'
- ],
- div : [
- 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
- '.background-color', '.font-size', '.font-family', '.font-weight', '.background',
- '.font-style', '.text-decoration', '.vertical-align', '.margin-left'
- ],
- table: [
- 'id', 'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor',
- '.padding', '.margin', '.border','.border-color', 'bgcolor', '.text-align', '.color', '.background-color',
- '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background',
- '.width', '.height', '.border-collapse','.table-layout'
- ],
- 'td,th': [
- 'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
- '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
- '.font-style', '.text-decoration', '.vertical-align', '.background', '.border','.border-color', '.text-overflow','.overflow','.white-space'
- ],
- a : ['id', 'class', 'href', 'target', 'name','data-method','data-remote','rel'],
- embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
- img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
- 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
- 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left', '.margin', '.border', '.padding'
- ],
- pre : ['id', 'class'],
- hr : ['id', 'class', '.page-break-after'],
- 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'],
- iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height']
- },
- layout : ''
-};
-var _useCapture = false;
-var _INPUT_KEY_MAP = _toMap('8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222');
-var _CURSORMOVE_KEY_MAP = _toMap('33..40');
-var _CHANGE_KEY_MAP = {};
-_each(_INPUT_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-_each(_CURSORMOVE_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-function _bindEvent(el, type, fn) {
- if (el.addEventListener){
- el.addEventListener(type, fn, _useCapture);
- } else if (el.attachEvent){
- el.attachEvent('on' + type, fn);
- }
-}
-function _unbindEvent(el, type, fn) {
- if (el.removeEventListener){
- el.removeEventListener(type, fn, _useCapture);
- } else if (el.detachEvent){
- el.detachEvent('on' + type, fn);
- }
-}
-var _EVENT_PROPS = ('altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,' +
- 'data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,' +
- 'pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which').split(',');
-function KEvent(el, event) {
- this.init(el, event);
-}
-_extend(KEvent, {
- init : function(el, event) {
- var self = this, doc = el.ownerDocument || el.document || el;
- self.event = event;
- _each(_EVENT_PROPS, function(key, val) {
- self[val] = event[val];
- });
- if (!self.target) {
- self.target = self.srcElement || doc;
- }
- if (self.target.nodeType === 3) {
- self.target = self.target.parentNode;
- }
- if (!self.relatedTarget && self.fromElement) {
- self.relatedTarget = self.fromElement === self.target ? self.toElement : self.fromElement;
- }
- if (self.pageX == null && self.clientX != null) {
- var d = doc.documentElement, body = doc.body;
- self.pageX = self.clientX + (d && d.scrollLeft || body && body.scrollLeft || 0) - (d && d.clientLeft || body && body.clientLeft || 0);
- self.pageY = self.clientY + (d && d.scrollTop || body && body.scrollTop || 0) - (d && d.clientTop || body && body.clientTop || 0);
- }
- if (!self.which && ((self.charCode || self.charCode === 0) ? self.charCode : self.keyCode)) {
- self.which = self.charCode || self.keyCode;
- }
- if (!self.metaKey && self.ctrlKey) {
- self.metaKey = self.ctrlKey;
- }
- if (!self.which && self.button !== undefined) {
- self.which = (self.button & 1 ? 1 : (self.button & 2 ? 3 : (self.button & 4 ? 2 : 0)));
- }
- switch (self.which) {
- case 186 :
- self.which = 59;
- break;
- case 187 :
- case 107 :
- case 43 :
- self.which = 61;
- break;
- case 189 :
- case 45 :
- self.which = 109;
- break;
- case 42 :
- self.which = 106;
- break;
- case 47 :
- self.which = 111;
- break;
- case 78 :
- self.which = 110;
- break;
- }
- if (self.which >= 96 && self.which <= 105) {
- self.which -= 48;
- }
- },
- preventDefault : function() {
- var ev = this.event;
- if (ev.preventDefault) {
- ev.preventDefault();
- } else {
- ev.returnValue = false;
- }
- },
- stopPropagation : function() {
- var ev = this.event;
- if (ev.stopPropagation) {
- ev.stopPropagation();
- } else {
- ev.cancelBubble = true;
- }
- },
- stop : function() {
- this.preventDefault();
- this.stopPropagation();
- }
-});
-var _eventExpendo = 'kindeditor_' + _TIME, _eventId = 0, _eventData = {};
-function _getId(el) {
- return el[_eventExpendo] || null;
-}
-function _setId(el) {
- el[_eventExpendo] = ++_eventId;
- return _eventId;
-}
-function _removeId(el) {
- try {
- delete el[_eventExpendo];
- } catch(e) {
- if (el.removeAttribute) {
- el.removeAttribute(_eventExpendo);
- }
- }
-}
-function _bind(el, type, fn) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _bind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- id = _setId(el);
- }
- if (_eventData[id] === undefined) {
- _eventData[id] = {};
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- _unbindEvent(el, type, events[0]);
- } else {
- _eventData[id][type] = [];
- _eventData[id].el = el;
- }
- events = _eventData[id][type];
- if (events.length === 0) {
- events[0] = function(e) {
- var kevent = e ? new KEvent(el, e) : undefined;
- _each(events, function(i, event) {
- if (i > 0 && event) {
- event.call(el, kevent);
- }
- });
- };
- }
- if (_inArray(fn, events) < 0) {
- events.push(fn);
- }
- _bindEvent(el, type, events[0]);
-}
-function _unbind(el, type, fn) {
- if (type && type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _unbind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- if (type === undefined) {
- if (id in _eventData) {
- _each(_eventData[id], function(key, events) {
- if (key != 'el' && events.length > 0) {
- _unbindEvent(el, key, events[0]);
- }
- });
- delete _eventData[id];
- _removeId(el);
- }
- return;
- }
- if (!_eventData[id]) {
- return;
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- if (fn === undefined) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- } else {
- _each(events, function(i, event) {
- if (i > 0 && event === fn) {
- events.splice(i, 1);
- }
- });
- if (events.length == 1) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- }
- }
- var count = 0;
- _each(_eventData[id], function() {
- count++;
- });
- if (count < 2) {
- delete _eventData[id];
- _removeId(el);
- }
- }
-}
-function _fire(el, type) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _fire(el, this);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- var events = _eventData[id][type];
- if (_eventData[id] && events && events.length > 0) {
- events[0]();
- }
-}
-function _ctrl(el, key, fn) {
- var self = this;
- key = /^\d{2,}$/.test(key) ? key : key.toUpperCase().charCodeAt(0);
- _bind(el, 'keydown', function(e) {
- if (e.ctrlKey && e.which == key && !e.shiftKey && !e.altKey) {
- fn.call(el);
- e.stop();
- }
- });
-}
-var _readyFinished = false;
-function _ready(fn) {
- if (_readyFinished) {
- fn(KindEditor);
- return;
- }
- var loaded = false;
- function readyFunc() {
- if (!loaded) {
- loaded = true;
- fn(KindEditor);
- _readyFinished = true;
- }
- }
- function ieReadyFunc() {
- if (!loaded) {
- try {
- document.documentElement.doScroll('left');
- } catch(e) {
- setTimeout(ieReadyFunc, 100);
- return;
- }
- readyFunc();
- }
- }
- function ieReadyStateFunc() {
- if (document.readyState === 'complete') {
- readyFunc();
- }
- }
- if (document.addEventListener) {
- _bind(document, 'DOMContentLoaded', readyFunc);
- } else if (document.attachEvent) {
- _bind(document, 'readystatechange', ieReadyStateFunc);
- var toplevel = false;
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
- if (document.documentElement.doScroll && toplevel) {
- ieReadyFunc();
- }
- }
- _bind(window, 'load', readyFunc);
-}
-if (window.attachEvent) {
- window.attachEvent('onunload', function() {
- _each(_eventData, function(key, events) {
- if (events.el) {
- _unbind(events.el);
- }
- });
- });
-}
-K.ctrl = _ctrl;
-K.ready = _ready;
-function _getCssList(css) {
- var list = {},
- reg = /\s*([\w\-]+)\s*:([^;]*)(;|$)/g,
- match;
- while ((match = reg.exec(css))) {
- var key = _trim(match[1].toLowerCase()),
- val = _trim(_toHex(match[2]));
- list[key] = val;
- }
- return list;
-}
-function _getAttrList(tag) {
- var list = {},
- reg = /\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,
- match;
- while ((match = reg.exec(tag))) {
- var key = (match[1] || match[2] || match[4] || match[6]).toLowerCase(),
- val = (match[2] ? match[3] : (match[4] ? match[5] : match[7])) || '';
- list[key] = val;
- }
- return list;
-}
-function _addClassToTag(tag, className) {
- if (/\s+class\s*=/.test(tag)) {
- tag = tag.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) {
- if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) {
- return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3;
- } else {
- return $0;
- }
- });
- } else {
- tag = tag.substr(0, tag.length - 1) + ' class="' + className + '">';
- }
- return tag;
-}
-function _formatCss(css) {
- var str = '';
- _each(_getCssList(css), function(key, val) {
- str += key + ':' + val + ';';
- });
- return str;
-}
-function _formatUrl(url, mode, host, pathname) {
- mode = _undef(mode, '').toLowerCase();
- if (url.substr(0, 5) != 'data:') {
- url = url.replace(/([^:])\/\//g, '$1/');
- }
- if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) {
- return url;
- }
- host = host || location.protocol + '//' + location.host;
- if (pathname === undefined) {
- var m = location.pathname.match(/^(\/.*)\//);
- pathname = m ? m[1] : '';
- }
- var match;
- if ((match = /^(\w+:\/\/[^\/]*)/.exec(url))) {
- if (match[1] !== host) {
- return url;
- }
- } else if (/^\w+:/.test(url)) {
- return url;
- }
- function getRealPath(path) {
- var parts = path.split('/'), paths = [];
- for (var i = 0, len = parts.length; i < len; i++) {
- var part = parts[i];
- if (part == '..') {
- if (paths.length > 0) {
- paths.pop();
- }
- } else if (part !== '' && part != '.') {
- paths.push(part);
- }
- }
- return '/' + paths.join('/');
- }
- if (/^\//.test(url)) {
- url = host + getRealPath(url.substr(1));
- } else if (!/^\w+:\/\//.test(url)) {
- url = host + getRealPath(pathname + '/' + url);
- }
- function getRelativePath(path, depth) {
- if (url.substr(0, path.length) === path) {
- var arr = [];
- for (var i = 0; i < depth; i++) {
- arr.push('..');
- }
- var prefix = '.';
- if (arr.length > 0) {
- prefix += '/' + arr.join('/');
- }
- if (pathname == '/') {
- prefix += '/';
- }
- return prefix + url.substr(path.length);
- } else {
- if ((match = /^(.*)\//.exec(path))) {
- return getRelativePath(match[1], ++depth);
- }
- }
- }
- if (mode === 'relative') {
- url = getRelativePath(host + pathname, 0).substr(2);
- } else if (mode === 'absolute') {
- if (url.substr(0, host.length) === host) {
- url = url.substr(host.length);
- }
- }
- return url;
-}
-function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) {
- if (html == null) {
- html = '';
- }
- urlType = urlType || '';
- wellFormatted = _undef(wellFormatted, false);
- indentChar = _undef(indentChar, '\t');
- var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(',');
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/<(?:br|br\s[^>]*)>/ig, '\n') + $3;
- });
- html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '
');
- html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1
$2');
- html = html.replace(/\u200B/g, '');
- html = html.replace(/\u00A9/g, '©');
- html = html.replace(/\u00AE/g, '®');
- html = html.replace(/\u2003/g, ' ');
- html = html.replace(/\u3000/g, ' ');
- html = html.replace(/<[^>]+/g, function($0) {
- return $0.replace(/\s+/g, ' ');
- });
- var htmlTagMap = {};
- if (htmlTags) {
- _each(htmlTags, function(key, val) {
- var arr = key.split(',');
- for (var i = 0, len = arr.length; i < len; i++) {
- htmlTagMap[arr[i]] = _toMap(val);
- }
- });
- if (!htmlTagMap.script) {
- html = html.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig, '');
- }
- if (!htmlTagMap.style) {
- html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, '');
- }
- }
- var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g;
- var tagStack = [];
- html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) {
- var full = $0,
- startNewline = $1 || '',
- startSlash = $2 || '',
- tagName = $3.toLowerCase(),
- attr = $4 || '',
- endSlash = $5 ? ' ' + $5 : '',
- endNewline = $6 || '';
- if (htmlTags && !htmlTagMap[tagName]) {
- return '';
- }
- if (endSlash === '' && _SINGLE_TAG_MAP[tagName]) {
- endSlash = ' /';
- }
- if (_INLINE_TAG_MAP[tagName]) {
- if (startNewline) {
- startNewline = ' ';
- }
- if (endNewline) {
- endNewline = ' ';
- }
- }
- if (_PRE_TAG_MAP[tagName]) {
- if (startSlash) {
- endNewline = '\n';
- } else {
- startNewline = '\n';
- }
- }
- if (wellFormatted && tagName == 'br') {
- endNewline = '\n';
- }
- if (_BLOCK_TAG_MAP[tagName] && !_PRE_TAG_MAP[tagName]) {
- if (wellFormatted) {
- if (startSlash && tagStack.length > 0 && tagStack[tagStack.length - 1] === tagName) {
- tagStack.pop();
- } else {
- tagStack.push(tagName);
- }
- startNewline = '\n';
- endNewline = '\n';
- for (var i = 0, len = startSlash ? tagStack.length : tagStack.length - 1; i < len; i++) {
- startNewline += indentChar;
- if (!startSlash) {
- endNewline += indentChar;
- }
- }
- if (endSlash) {
- tagStack.pop();
- } else if (!startSlash) {
- endNewline += indentChar;
- }
- } else {
- startNewline = endNewline = '';
- }
- }
- //blockquote 单独加上style 之后再改成接口 给别的加上默认的
- if (attr !== '' || (tagName === 'blockquote')) {
- var attrMap = _getAttrList(full);
- if (tagName === 'font') {
- var fontStyleMap = {}, fontStyle = '';
- _each(attrMap, function(key, val) {
- if (key === 'color') {
- fontStyleMap.color = val;
- delete attrMap[key];
- }
- if (key === 'size') {
- fontStyleMap['font-size'] = fontSizeList[parseInt(val, 10) - 1] || '';
- delete attrMap[key];
- }
- if (key === 'face') {
- fontStyleMap['font-family'] = val;
- delete attrMap[key];
- }
- if (key === 'style') {
- fontStyle = val;
- }
- });
- if (fontStyle && !/;$/.test(fontStyle)) {
- fontStyle += ';';
- }
- _each(fontStyleMap, function(key, val) {
- if (val === '') {
- return;
- }
- if (/\s/.test(val)) {
- val = "'" + val + "'";
- }
- fontStyle += key + ':' + val + ';';
- });
- attrMap.style = fontStyle;
- }
- _each(attrMap, function(key, val) {
- if (_FILL_ATTR_MAP[key]) {
- attrMap[key] = key;
- }
- if (_inArray(key, ['src', 'href']) >= 0) {
- attrMap[key] = _formatUrl(val, urlType);
- }
- if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] ||
- tagName === 'body' && key === 'contenteditable' ||
- /^kindeditor_\d+$/.test(key)) {
- delete attrMap[key];
- }
- if (key === 'style' && val !== '') {
- var styleMap = _getCssList(val);
- _each(styleMap, function(k, v) {
- if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) {
- delete styleMap[k];
- }
- });
- var style = '';
- _each(styleMap, function(k, v) {
- style += k + ':' + v + ';';
- });
- attrMap.style = style;
- }
- });
- attr = '';
- if (tagName === 'blockquote') {
- attrMap['style'] = "margin: 0 0 0 40px; border: none; padding: 0px;background: none;background-color: ;";
- }
- _each(attrMap, function(key, val) {
- if (key === 'style' && val === '') {
- return;
- }
- val = val.replace(/"/g, '"');
- attr += ' ' + key + '="' + val + '"';
- });
- }
- if (tagName === 'font') {
- tagName = 'span';
- }
- return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline;
- });
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/\n/g, '\n') + $3;
- });
- html = html.replace(/\n\s*\n/g, '\n');
- html = html.replace(/\n/g, '\n');
- return _trim(html);
-}
-function _clearMsWord(html, htmlTags) {
- html = html.replace(//ig, '')
- .replace(//ig, '')
- .replace(/'
- ];
- if (!_isArray(cssPath)) {
- cssPath = [cssPath];
- }
- _each(cssPath, function(i, path) {
- if (path) {
- arr.push('');
- }
- });
- if (cssData) {
- arr.push('');
- }
- arr.push('