@lingxiteam/lcdp-ueditor-react 1.0.2 → 1.0.3-alpha.2

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 (76) hide show
  1. package/es/LcdpUeditor.d.ts.map +1 -1
  2. package/es/LcdpUeditor.js +2 -1
  3. package/es/tools/UeditorResourceLoader.d.ts +1 -1
  4. package/es/tools/UeditorResourceLoader.d.ts.map +1 -1
  5. package/es/tools/UeditorResourceLoader.js +18 -7
  6. package/es/tools/filterHtmlNode.d.ts.map +1 -1
  7. package/es/tools/filterHtmlNode.js +7 -2
  8. package/lib/LcdpUeditor.js +1 -3
  9. package/lib/tools/UeditorResourceLoader.d.ts +1 -1
  10. package/lib/tools/UeditorResourceLoader.js +15 -7
  11. package/lib/tools/filterHtmlNode.js +8 -4
  12. package/package.json +1 -1
  13. package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
  14. package/ueditor-resource/dialogs/attachment/attachment.css +2 -715
  15. package/ueditor-resource/dialogs/attachment/attachment.html +6 -6
  16. package/ueditor-resource/dialogs/attachment/attachment.js +2 -803
  17. package/ueditor-resource/dialogs/audio/audio.css +2 -878
  18. package/ueditor-resource/dialogs/audio/audio.js +2 -815
  19. package/ueditor-resource/dialogs/background/background.css +2 -192
  20. package/ueditor-resource/dialogs/background/background.html +3 -3
  21. package/ueditor-resource/dialogs/background/background.js +2 -370
  22. package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
  23. package/ueditor-resource/dialogs/contentimport/contentimport.js +2 -91
  24. package/ueditor-resource/dialogs/emotion/emotion.css +2 -128
  25. package/ueditor-resource/dialogs/emotion/emotion.html +3 -3
  26. package/ueditor-resource/dialogs/emotion/emotion.js +2 -186
  27. package/ueditor-resource/dialogs/formula/formula.html +4 -4
  28. package/ueditor-resource/dialogs/formula/formula.js +2 -147
  29. package/ueditor-resource/dialogs/help/help.css +2 -36
  30. package/ueditor-resource/dialogs/help/help.html +3 -3
  31. package/ueditor-resource/dialogs/help/help.js +2 -57
  32. package/ueditor-resource/dialogs/image/image.css +2 -767
  33. package/ueditor-resource/dialogs/image/image.js +2 -1060
  34. package/ueditor-resource/dialogs/insertframe/insertframe.html +2 -2
  35. package/ueditor-resource/dialogs/internal.js +2 -81
  36. package/ueditor-resource/dialogs/preview/preview.html +2 -2
  37. package/ueditor-resource/dialogs/scrawl/scrawl.css +2 -323
  38. package/ueditor-resource/dialogs/scrawl/scrawl.html +3 -3
  39. package/ueditor-resource/dialogs/scrawl/scrawl.js +2 -682
  40. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
  41. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +2 -174
  42. package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
  43. package/ueditor-resource/dialogs/spechars/spechars.js +2 -86
  44. package/ueditor-resource/dialogs/table/edittable.css +2 -84
  45. package/ueditor-resource/dialogs/table/edittable.html +3 -3
  46. package/ueditor-resource/dialogs/table/edittable.js +2 -241
  47. package/ueditor-resource/dialogs/table/edittd.html +1 -1
  48. package/ueditor-resource/dialogs/table/edittip.html +1 -1
  49. package/ueditor-resource/dialogs/template/config.js +2 -42
  50. package/ueditor-resource/dialogs/template/template.css +2 -98
  51. package/ueditor-resource/dialogs/template/template.html +4 -4
  52. package/ueditor-resource/dialogs/template/template.js +2 -53
  53. package/ueditor-resource/dialogs/video/video.css +2 -908
  54. package/ueditor-resource/dialogs/video/video.js +2 -867
  55. package/ueditor-resource/dialogs/wordimage/wordimage.html +5 -5
  56. package/ueditor-resource/dialogs/wordimage/wordimage.js +2 -93
  57. package/ueditor-resource/lang/en/en.js +2 -686
  58. package/ueditor-resource/lang/zh-cn/zh-cn.js +2 -748
  59. package/ueditor-resource/lang/zh-tw/zh-tw.js +2 -748
  60. package/ueditor-resource/plugins/demo/demo.js +1 -3
  61. package/ueditor-resource/themes/default/css/ueditor.css +2 -2148
  62. package/ueditor-resource/themes/default/dialog.css +2 -16
  63. package/ueditor-resource/themes/default/dialogbase.css +2 -131
  64. package/ueditor-resource/themes/iframe.css +2 -62
  65. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +4 -3655
  66. package/ueditor-resource/third-party/SyntaxHighlighter/shCoreDefault.css +3 -1
  67. package/ueditor-resource/third-party/clipboard/clipboard.js +2 -753
  68. package/ueditor-resource/third-party/codemirror/codemirror.css +2 -105
  69. package/ueditor-resource/third-party/codemirror/codemirror.js +3 -3581
  70. package/ueditor-resource/third-party/jquery-3.5.1.js +4 -2
  71. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4 -4314
  72. package/ueditor-resource/third-party/webuploader/webuploader.css +2 -87
  73. package/ueditor-resource/third-party/webuploader/webuploader.js +5 -4
  74. package/ueditor-resource/ueditor.all.js +20 -32644
  75. package/ueditor-resource/ueditor.config.js +2 -655
  76. package/ueditor-resource/ueditor.parse.js +2 -639
@@ -1,639 +1,2 @@
1
- /*!
2
- * UEditorPlus parse
3
- * version: 2.0.0
4
- */
5
- (function(){
6
-
7
- "use strict";
8
-
9
- (function () {
10
- UE = window.UE || {};
11
- var isIE = !!window.ActiveXObject;
12
- //定义utils工具
13
- var utils = {
14
- removeLastbs: function removeLastbs(url) {
15
- return url.replace(/\/$/, "");
16
- },
17
- extend: function extend(t, s) {
18
- var a = arguments,
19
- notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false,
20
- len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length;
21
- for (var i = 1; i < len; i++) {
22
- var x = a[i];
23
- for (var k in x) {
24
- if (!notCover || !t.hasOwnProperty(k)) {
25
- t[k] = x[k];
26
- }
27
- }
28
- }
29
- return t;
30
- },
31
- isIE: isIE,
32
- cssRule: isIE ? function (key, style, doc) {
33
- var indexList, index;
34
- doc = doc || document;
35
- if (doc.indexList) {
36
- indexList = doc.indexList;
37
- } else {
38
- indexList = doc.indexList = {};
39
- }
40
- var sheetStyle;
41
- if (!indexList[key]) {
42
- if (style === undefined) {
43
- return "";
44
- }
45
- sheetStyle = doc.createStyleSheet("", index = doc.styleSheets.length);
46
- indexList[key] = index;
47
- } else {
48
- sheetStyle = doc.styleSheets[indexList[key]];
49
- }
50
- if (style === undefined) {
51
- return sheetStyle.cssText;
52
- }
53
- sheetStyle.cssText = sheetStyle.cssText + "\n" + (style || "");
54
- } : function (key, style, doc) {
55
- doc = doc || document;
56
- var head = doc.getElementsByTagName("head")[0],
57
- node;
58
- if (!(node = doc.getElementById(key))) {
59
- if (style === undefined) {
60
- return "";
61
- }
62
- node = doc.createElement("style");
63
- node.id = key;
64
- head.appendChild(node);
65
- }
66
- if (style === undefined) {
67
- return node.innerHTML;
68
- }
69
- if (style !== "") {
70
- node.innerHTML = node.innerHTML + "\n" + style;
71
- } else {
72
- head.removeChild(node);
73
- }
74
- },
75
- domReady: function domReady(onready) {
76
- var doc = window.document;
77
- if (doc.readyState === "complete") {
78
- onready();
79
- } else {
80
- if (isIE) {
81
- (function () {
82
- if (doc.isReady) return;
83
- try {
84
- doc.documentElement.doScroll("left");
85
- } catch (error) {
86
- setTimeout(arguments.callee, 0);
87
- return;
88
- }
89
- onready();
90
- })();
91
- window.attachEvent("onload", function () {
92
- onready();
93
- });
94
- } else {
95
- doc.addEventListener("DOMContentLoaded", function () {
96
- doc.removeEventListener("DOMContentLoaded", arguments.callee, false);
97
- onready();
98
- }, false);
99
- window.addEventListener("load", function () {
100
- onready();
101
- }, false);
102
- }
103
- }
104
- },
105
- each: function each(obj, iterator, context) {
106
- if (obj == null) return;
107
- if (obj.length === +obj.length) {
108
- for (var i = 0, l = obj.length; i < l; i++) {
109
- if (iterator.call(context, obj[i], i, obj) === false) return false;
110
- }
111
- } else {
112
- for (var key in obj) {
113
- if (obj.hasOwnProperty(key)) {
114
- if (iterator.call(context, obj[key], key, obj) === false) return false;
115
- }
116
- }
117
- }
118
- },
119
- inArray: function inArray(arr, item) {
120
- var index = -1;
121
- this.each(arr, function (v, i) {
122
- if (v === item) {
123
- index = i;
124
- return false;
125
- }
126
- });
127
- return index;
128
- },
129
- pushItem: function pushItem(arr, item) {
130
- if (this.inArray(arr, item) == -1) {
131
- arr.push(item);
132
- }
133
- },
134
- trim: function trim(str) {
135
- return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, "");
136
- },
137
- indexOf: function indexOf(array, item, start) {
138
- var index = -1;
139
- start = this.isNumber(start) ? start : 0;
140
- this.each(array, function (v, i) {
141
- if (i >= start && v === item) {
142
- index = i;
143
- return false;
144
- }
145
- });
146
- return index;
147
- },
148
- hasClass: function hasClass(element, className) {
149
- className = className.replace(/(^[ ]+)|([ ]+$)/g, "").replace(/[ ]{2,}/g, " ").split(" ");
150
- for (var i = 0, ci, cls = element.className; ci = className[i++];) {
151
- if (!new RegExp("\\b" + ci + "\\b", "i").test(cls)) {
152
- return false;
153
- }
154
- }
155
- return i - 1 == className.length;
156
- },
157
- addClass: function addClass(elm, classNames) {
158
- if (!elm) return;
159
- classNames = this.trim(classNames).replace(/[ ]{2,}/g, " ").split(" ");
160
- for (var i = 0, ci, cls = elm.className; ci = classNames[i++];) {
161
- if (!new RegExp("\\b" + ci + "\\b").test(cls)) {
162
- cls += " " + ci;
163
- }
164
- }
165
- elm.className = utils.trim(cls);
166
- },
167
- removeClass: function removeClass(elm, classNames) {
168
- classNames = this.isArray(classNames) ? classNames : this.trim(classNames).replace(/[ ]{2,}/g, " ").split(" ");
169
- for (var i = 0, ci, cls = elm.className; ci = classNames[i++];) {
170
- cls = cls.replace(new RegExp("\\b" + ci + "\\b"), "");
171
- }
172
- cls = this.trim(cls).replace(/[ ]{2,}/g, " ");
173
- elm.className = cls;
174
- !cls && elm.removeAttribute("className");
175
- },
176
- on: function on(element, type, handler) {
177
- var types = this.isArray(type) ? type : type.split(/\s+/),
178
- k = types.length;
179
- if (k) while (k--) {
180
- type = types[k];
181
- if (element.addEventListener) {
182
- element.addEventListener(type, handler, false);
183
- } else {
184
- if (!handler._d) {
185
- handler._d = {
186
- els: []
187
- };
188
- }
189
- var key = type + handler.toString(),
190
- index = utils.indexOf(handler._d.els, element);
191
- if (!handler._d[key] || index == -1) {
192
- if (index == -1) {
193
- handler._d.els.push(element);
194
- }
195
- if (!handler._d[key]) {
196
- handler._d[key] = function (evt) {
197
- return handler.call(evt.srcElement, evt || window.event);
198
- };
199
- }
200
- element.attachEvent("on" + type, handler._d[key]);
201
- }
202
- }
203
- }
204
- element = null;
205
- },
206
- off: function off(element, type, handler) {
207
- var types = this.isArray(type) ? type : type.split(/\s+/),
208
- k = types.length;
209
- if (k) while (k--) {
210
- type = types[k];
211
- if (element.removeEventListener) {
212
- element.removeEventListener(type, handler, false);
213
- } else {
214
- var key = type + handler.toString();
215
- try {
216
- element.detachEvent("on" + type, handler._d ? handler._d[key] : handler);
217
- } catch (e) {}
218
- if (handler._d && handler._d[key]) {
219
- var index = utils.indexOf(handler._d.els, element);
220
- if (index != -1) {
221
- handler._d.els.splice(index, 1);
222
- }
223
- handler._d.els.length == 0 && delete handler._d[key];
224
- }
225
- }
226
- }
227
- },
228
- loadFile: function () {
229
- var tmpList = [];
230
- function getItem(doc, obj) {
231
- try {
232
- for (var i = 0, ci; ci = tmpList[i++];) {
233
- if (ci.doc === doc && ci.url == (obj.src || obj.href)) {
234
- return ci;
235
- }
236
- }
237
- } catch (e) {
238
- return null;
239
- }
240
- }
241
- return function (doc, obj, fn) {
242
- var item = getItem(doc, obj);
243
- if (item) {
244
- if (item.ready) {
245
- fn && fn();
246
- } else {
247
- item.funs.push(fn);
248
- }
249
- return;
250
- }
251
- tmpList.push({
252
- doc: doc,
253
- url: obj.src || obj.href,
254
- funs: [fn]
255
- });
256
- if (!doc.body) {
257
- var html = [];
258
- for (var p in obj) {
259
- if (p == "tag") continue;
260
- html.push(p + '="' + obj[p] + '"');
261
- }
262
- doc.write("<" + obj.tag + " " + html.join(" ") + " ></" + obj.tag + ">");
263
- return;
264
- }
265
- if (obj.id && doc.getElementById(obj.id)) {
266
- return;
267
- }
268
- var element = doc.createElement(obj.tag);
269
- delete obj.tag;
270
- for (var p in obj) {
271
- element.setAttribute(p, obj[p]);
272
- }
273
- element.onload = element.onreadystatechange = function () {
274
- if (!this.readyState || /loaded|complete/.test(this.readyState)) {
275
- item = getItem(doc, obj);
276
- if (item.funs.length > 0) {
277
- item.ready = 1;
278
- for (var fi; fi = item.funs.pop();) {
279
- fi();
280
- }
281
- }
282
- element.onload = element.onreadystatechange = null;
283
- }
284
- };
285
- element.onerror = function () {
286
- throw Error("The load " + (obj.href || obj.src) + " fails,check the url");
287
- };
288
- doc.getElementsByTagName("head")[0].appendChild(element);
289
- };
290
- }()
291
- };
292
- utils.each(["String", "Function", "Array", "Number", "RegExp", "Object", "Boolean"], function (v) {
293
- utils["is" + v] = function (obj) {
294
- return Object.prototype.toString.apply(obj) == "[object " + v + "]";
295
- };
296
- });
297
- var parselist = {};
298
- UE.parse = {
299
- register: function register(parseName, fn) {
300
- parselist[parseName] = fn;
301
- },
302
- load: function load(opt) {
303
- utils.each(parselist, function (v) {
304
- v.call(opt, utils);
305
- });
306
- }
307
- };
308
- uParse = function uParse(selector, opt) {
309
- utils.domReady(function () {
310
- var contents;
311
- if (document.querySelectorAll) {
312
- contents = document.querySelectorAll(selector);
313
- } else {
314
- if (/^#/.test(selector)) {
315
- contents = [document.getElementById(selector.replace(/^#/, ""))];
316
- } else if (/^\./.test(selector)) {
317
- var contents = [];
318
- utils.each(document.getElementsByTagName("*"), function (node) {
319
- if (node.className && new RegExp("\\b" + selector.replace(/^\./, "") + "\\b", "i").test(node.className)) {
320
- contents.push(node);
321
- }
322
- });
323
- } else {
324
- contents = document.getElementsByTagName(selector);
325
- }
326
- }
327
- utils.each(contents, function (v) {
328
- UE.parse.load(utils.extend({
329
- root: v,
330
- selector: selector
331
- }, opt));
332
- });
333
- });
334
- };
335
- })();
336
-
337
- "use strict";
338
-
339
- UE.parse.register("insertcode", function (utils) {
340
- var pres = this.root.getElementsByTagName("pre");
341
- if (pres.length) {
342
- if (typeof XRegExp == "undefined") {
343
- var jsurl, cssurl;
344
- if (this.rootPath !== undefined) {
345
- jsurl = utils.removeLastbs(this.rootPath) + "/third-party/SyntaxHighlighter/shCore.js";
346
- cssurl = utils.removeLastbs(this.rootPath) + "/third-party/SyntaxHighlighter/shCoreDefault.css";
347
- } else {
348
- jsurl = this.highlightJsUrl;
349
- cssurl = this.highlightCssUrl;
350
- }
351
- utils.loadFile(document, {
352
- id: "syntaxhighlighter_css",
353
- tag: "link",
354
- rel: "stylesheet",
355
- type: "text/css",
356
- href: cssurl
357
- });
358
- utils.loadFile(document, {
359
- id: "syntaxhighlighter_js",
360
- src: jsurl,
361
- tag: "script",
362
- type: "text/javascript",
363
- defer: "defer"
364
- }, function () {
365
- utils.each(pres, function (pi) {
366
- if (pi && /brush/i.test(pi.className)) {
367
- SyntaxHighlighter.highlight(pi);
368
- }
369
- });
370
- });
371
- } else {
372
- utils.each(pres, function (pi) {
373
- if (pi && /brush/i.test(pi.className)) {
374
- SyntaxHighlighter.highlight(pi);
375
- }
376
- });
377
- }
378
- }
379
- });
380
-
381
- "use strict";
382
-
383
- UE.parse.register("table", function (utils) {
384
- var me = this,
385
- root = this.root,
386
- tables = root.getElementsByTagName("table");
387
- if (tables.length) {
388
- var selector = this.selector;
389
- //追加默认的表格样式
390
- utils.cssRule("table", selector + " table.noBorderTable td," + selector + " table.noBorderTable th," + selector + " table.noBorderTable caption{border:1px dashed #ddd !important}" + selector + " table.sortEnabled tr.firstRow th," + selector + " table.sortEnabled tr.firstRow td{padding-right:20px; background-repeat: no-repeat;" + "background-position: center right; background-image:url(" + this.rootPath + "themes/default/images/sortable.png);}" + selector + " table.sortEnabled tr.firstRow th:hover," + selector + " table.sortEnabled tr.firstRow td:hover{background-color: #EEE;}" + selector + " table{margin-bottom:10px;border-collapse:collapse;display:table;}" + selector + " td," + selector + " th{padding: 5px 10px;border: 1px solid #DDD;}" + selector + " caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}" + selector + " th{border-top:1px solid #BBB;background:#F7F7F7;}" + selector + " table tr.firstRow th{border-top:2px solid #BBB;background:#F7F7F7;}" + selector + " tr.ue-table-interlace-color-single td{ background: #fcfcfc; }" + selector + " tr.ue-table-interlace-color-double td{ background: #f7faff; }" + selector + " td p{margin:0;padding:0;width:auto;height:auto;}", document);
391
- //填充空的单元格
392
-
393
- utils.each("td th caption".split(" "), function (tag) {
394
- var cells = root.getElementsByTagName(tag);
395
- cells.length && utils.each(cells, function (node) {
396
- if (!node.firstChild) {
397
- node.innerHTML = "&nbsp;";
398
- }
399
- });
400
- });
401
-
402
- //表格可排序
403
- var tables = root.getElementsByTagName("table");
404
- utils.each(tables, function (table) {
405
- if (/\bsortEnabled\b/.test(table.className)) {
406
- utils.on(table, "click", function (e) {
407
- var target = e.target || e.srcElement,
408
- cell = findParentByTagName(target, ["td", "th"]);
409
- var table = findParentByTagName(target, "table"),
410
- colIndex = utils.indexOf(table.rows[0].cells, cell),
411
- sortType = table.getAttribute("data-sort-type");
412
- if (colIndex != -1) {
413
- sortTable(table, colIndex, me.tableSortCompareFn || sortType);
414
- updateTable(table);
415
- }
416
- });
417
- }
418
- });
419
-
420
- //按照标签名查找父节点
421
- function findParentByTagName(target, tagNames) {
422
- var i,
423
- current = target;
424
- tagNames = utils.isArray(tagNames) ? tagNames : [tagNames];
425
- while (current) {
426
- for (i = 0; i < tagNames.length; i++) {
427
- if (current.tagName == tagNames[i].toUpperCase()) return current;
428
- }
429
- current = current.parentNode;
430
- }
431
- return null;
432
- }
433
-
434
- //表格排序
435
- function sortTable(table, sortByCellIndex, compareFn) {
436
- var rows = table.rows,
437
- trArray = [],
438
- flag = rows[0].cells[0].tagName === "TH",
439
- lastRowIndex = 0;
440
- for (var i = 0, len = rows.length; i < len; i++) {
441
- trArray[i] = rows[i];
442
- }
443
- var Fn = {
444
- reversecurrent: function reversecurrent(td1, td2) {
445
- return 1;
446
- },
447
- orderbyasc: function orderbyasc(td1, td2) {
448
- var value1 = td1.innerText || td1.textContent,
449
- value2 = td2.innerText || td2.textContent;
450
- return value1.localeCompare(value2);
451
- },
452
- reversebyasc: function reversebyasc(td1, td2) {
453
- var value1 = td1.innerHTML,
454
- value2 = td2.innerHTML;
455
- return value2.localeCompare(value1);
456
- },
457
- orderbynum: function orderbynum(td1, td2) {
458
- var value1 = td1[utils.isIE ? "innerText" : "textContent"].match(/\d+/),
459
- value2 = td2[utils.isIE ? "innerText" : "textContent"].match(/\d+/);
460
- if (value1) value1 = +value1[0];
461
- if (value2) value2 = +value2[0];
462
- return (value1 || 0) - (value2 || 0);
463
- },
464
- reversebynum: function reversebynum(td1, td2) {
465
- var value1 = td1[utils.isIE ? "innerText" : "textContent"].match(/\d+/),
466
- value2 = td2[utils.isIE ? "innerText" : "textContent"].match(/\d+/);
467
- if (value1) value1 = +value1[0];
468
- if (value2) value2 = +value2[0];
469
- return (value2 || 0) - (value1 || 0);
470
- }
471
- };
472
-
473
- //对表格设置排序的标记data-sort-type
474
- table.setAttribute("data-sort-type", compareFn && typeof compareFn === "string" && Fn[compareFn] ? compareFn : "");
475
-
476
- //th不参与排序
477
- flag && trArray.splice(0, 1);
478
- trArray = sort(trArray, function (tr1, tr2) {
479
- var result;
480
- if (compareFn && typeof compareFn === "function") {
481
- result = compareFn.call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]);
482
- } else if (compareFn && typeof compareFn === "number") {
483
- result = 1;
484
- } else if (compareFn && typeof compareFn === "string" && Fn[compareFn]) {
485
- result = Fn[compareFn].call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]);
486
- } else {
487
- result = Fn["orderbyasc"].call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]);
488
- }
489
- return result;
490
- });
491
- var fragment = table.ownerDocument.createDocumentFragment();
492
- for (var j = 0, len = trArray.length; j < len; j++) {
493
- fragment.appendChild(trArray[j]);
494
- }
495
- var tbody = table.getElementsByTagName("tbody")[0];
496
- if (!lastRowIndex) {
497
- tbody.appendChild(fragment);
498
- } else {
499
- tbody.insertBefore(fragment, rows[lastRowIndex - range.endRowIndex + range.beginRowIndex - 1]);
500
- }
501
- }
502
-
503
- //冒泡排序
504
- function sort(array, compareFn) {
505
- compareFn = compareFn || function (item1, item2) {
506
- return item1.localeCompare(item2);
507
- };
508
- for (var i = 0, len = array.length; i < len; i++) {
509
- for (var j = i, length = array.length; j < length; j++) {
510
- if (compareFn(array[i], array[j]) > 0) {
511
- var t = array[i];
512
- array[i] = array[j];
513
- array[j] = t;
514
- }
515
- }
516
- }
517
- return array;
518
- }
519
-
520
- //更新表格
521
- function updateTable(table) {
522
- //给第一行设置firstRow的样式名称,在排序图标的样式上使用到
523
- if (!utils.hasClass(table.rows[0], "firstRow")) {
524
- for (var i = 1; i < table.rows.length; i++) {
525
- utils.removeClass(table.rows[i], "firstRow");
526
- }
527
- utils.addClass(table.rows[0], "firstRow");
528
- }
529
- }
530
- }
531
- });
532
-
533
- "use strict";
534
-
535
- UE.parse.register("background", function (utils) {
536
- var me = this,
537
- root = me.root,
538
- p = root.getElementsByTagName("p"),
539
- styles;
540
- for (var i = 0, ci; ci = p[i++];) {
541
- styles = ci.getAttribute("data-background");
542
- if (styles) {
543
- ci.parentNode.removeChild(ci);
544
- }
545
- }
546
-
547
- //追加默认的表格样式
548
- styles && utils.cssRule("ueditor_background", me.selector + "{" + styles + "}", document);
549
- });
550
-
551
- "use strict";
552
-
553
- UE.parse.register("list", function (utils) {
554
- var customCss = [],
555
- customStyle = {
556
- cn: "cn-1-",
557
- cn1: "cn-2-",
558
- cn2: "cn-3-",
559
- num: "num-1-",
560
- num1: "num-2-",
561
- num2: "num-3-",
562
- dash: "dash",
563
- dot: "dot"
564
- };
565
- utils.extend(this, {
566
- liiconpath: "http://bs.baidu.com/listicon/",
567
- listDefaultPaddingLeft: "20"
568
- });
569
- var root = this.root,
570
- ols = root.getElementsByTagName("ol"),
571
- uls = root.getElementsByTagName("ul"),
572
- selector = this.selector;
573
- if (ols.length) {
574
- applyStyle.call(this, ols);
575
- }
576
- if (uls.length) {
577
- applyStyle.call(this, uls);
578
- }
579
- if (ols.length || uls.length) {
580
- customCss.push(selector + " .list-paddingleft-1{padding-left:0}");
581
- customCss.push(selector + " .list-paddingleft-2{padding-left:" + this.listDefaultPaddingLeft + "px}");
582
- customCss.push(selector + " .list-paddingleft-3{padding-left:" + this.listDefaultPaddingLeft * 2 + "px}");
583
- utils.cssRule("list", selector + " ol," + selector + " ul{margin:0;padding:0;}\n" + selector + " li{clear:both;}\n" + customCss.join("\n"), document);
584
- }
585
- function applyStyle(nodes) {
586
- var T = this;
587
- utils.each(nodes, function (list) {
588
- if (list.className && /custom_/i.test(list.className)) {
589
- var listStyle = list.className.match(/custom_(\w+)/)[1];
590
- if (listStyle == "dash" || listStyle == "dot") {
591
- utils.pushItem(customCss, selector + " li.list-" + customStyle[listStyle] + "{background-image:url(" + T.liiconpath + customStyle[listStyle] + ".gif)}");
592
- utils.pushItem(customCss, selector + " ul.custom_" + listStyle + "{list-style:none;} " + selector + " ul.custom_" + listStyle + " li{background-position:0 3px;background-repeat:no-repeat}");
593
- } else {
594
- var index = 1;
595
- utils.each(list.childNodes, function (li) {
596
- if (li.tagName == "LI") {
597
- utils.pushItem(customCss, selector + " li.list-" + customStyle[listStyle] + index + "{background-image:url(" + T.liiconpath + "list-" + customStyle[listStyle] + index + ".gif)}");
598
- index++;
599
- }
600
- });
601
- utils.pushItem(customCss, selector + " ol.custom_" + listStyle + "{list-style:none;}" + selector + " ol.custom_" + listStyle + " li{background-position:0 3px;background-repeat:no-repeat}");
602
- }
603
- switch (listStyle) {
604
- case "cn":
605
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-1{padding-left:25px}");
606
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-2{padding-left:40px}");
607
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-3{padding-left:55px}");
608
- break;
609
- case "cn1":
610
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-1{padding-left:30px}");
611
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-2{padding-left:40px}");
612
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-3{padding-left:55px}");
613
- break;
614
- case "cn2":
615
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-1{padding-left:40px}");
616
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-2{padding-left:55px}");
617
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-3{padding-left:68px}");
618
- break;
619
- case "num":
620
- case "num1":
621
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-1{padding-left:25px}");
622
- break;
623
- case "num2":
624
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-1{padding-left:35px}");
625
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft-2{padding-left:40px}");
626
- break;
627
- case "dash":
628
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft{padding-left:35px}");
629
- break;
630
- case "dot":
631
- utils.pushItem(customCss, selector + " li.list-" + listStyle + "-paddingleft{padding-left:20px}");
632
- }
633
- }
634
- });
635
- }
636
- });
637
-
638
-
639
- })();
1
+ /*! UEditorPlus v2.0.0*/
2
+ !function(){"use strict";!function(){UE=window.UE||{};var a=!!window.ActiveXObject,b={removeLastbs:function(a){return a.replace(/\/$/,"")},extend:function(a,b){for(var c=arguments,d=!!this.isBoolean(c[c.length-1])&&c[c.length-1],e=this.isBoolean(c[c.length-1])?c.length-1:c.length,f=1;f<e;f++){var g=c[f];for(var h in g)d&&a.hasOwnProperty(h)||(a[h]=g[h])}return a},isIE:a,cssRule:a?function(a,b,c){var d,e;c=c||document,d=c.indexList?c.indexList:c.indexList={};var f;if(d[a])f=c.styleSheets[d[a]];else{if(void 0===b)return"";f=c.createStyleSheet("",e=c.styleSheets.length),d[a]=e}return void 0===b?f.cssText:void(f.cssText=f.cssText+"\n"+(b||""))}:function(a,b,c){c=c||document;var d,e=c.getElementsByTagName("head")[0];if(!(d=c.getElementById(a))){if(void 0===b)return"";d=c.createElement("style"),d.id=a,e.appendChild(d)}return void 0===b?d.innerHTML:void(""!==b?d.innerHTML=d.innerHTML+"\n"+b:e.removeChild(d))},domReady:function(b){var c=window.document;"complete"===c.readyState?b():a?(!function(){if(!c.isReady){try{c.documentElement.doScroll("left")}catch(a){return void setTimeout(arguments.callee,0)}b()}}(),window.attachEvent("onload",function(){b()})):(c.addEventListener("DOMContentLoaded",function(){c.removeEventListener("DOMContentLoaded",arguments.callee,!1),b()},!1),window.addEventListener("load",function(){b()},!1))},each:function(a,b,c){if(null!=a)if(a.length===+a.length){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},inArray:function(a,b){var c=-1;return this.each(a,function(a,d){if(a===b)return c=d,!1}),c},pushItem:function(a,b){this.inArray(a,b)==-1&&a.push(b)},trim:function(a){return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},indexOf:function(a,b,c){var d=-1;return c=this.isNumber(c)?c:0,this.each(a,function(a,e){if(e>=c&&a===b)return d=e,!1}),d},hasClass:function(a,b){b=b.replace(/(^[ ]+)|([ ]+$)/g,"").replace(/[ ]{2,}/g," ").split(" ");for(var c,d=0,e=a.className;c=b[d++];)if(!new RegExp("\\b"+c+"\\b","i").test(e))return!1;return d-1==b.length},addClass:function(a,c){if(a){c=this.trim(c).replace(/[ ]{2,}/g," ").split(" ");for(var d,e=0,f=a.className;d=c[e++];)new RegExp("\\b"+d+"\\b").test(f)||(f+=" "+d);a.className=b.trim(f)}},removeClass:function(a,b){b=this.isArray(b)?b:this.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var c,d=0,e=a.className;c=b[d++];)e=e.replace(new RegExp("\\b"+c+"\\b"),"");e=this.trim(e).replace(/[ ]{2,}/g," "),a.className=e,!e&&a.removeAttribute("className")},on:function(a,c,d){var e=this.isArray(c)?c:c.split(/\s+/),f=e.length;if(f)for(;f--;)if(c=e[f],a.addEventListener)a.addEventListener(c,d,!1);else{d._d||(d._d={els:[]});var g=c+d.toString(),h=b.indexOf(d._d.els,a);d._d[g]&&h!=-1||(h==-1&&d._d.els.push(a),d._d[g]||(d._d[g]=function(a){return d.call(a.srcElement,a||window.event)}),a.attachEvent("on"+c,d._d[g]))}a=null},off:function(a,c,d){var e=this.isArray(c)?c:c.split(/\s+/),f=e.length;if(f)for(;f--;)if(c=e[f],a.removeEventListener)a.removeEventListener(c,d,!1);else{var g=c+d.toString();try{a.detachEvent("on"+c,d._d?d._d[g]:d)}catch(h){}if(d._d&&d._d[g]){var i=b.indexOf(d._d.els,a);i!=-1&&d._d.els.splice(i,1),0==d._d.els.length&&delete d._d[g]}}},loadFile:function(){function a(a,c){try{for(var d,e=0;d=b[e++];)if(d.doc===a&&d.url==(c.src||c.href))return d}catch(f){return null}}var b=[];return function(c,d,e){var f=a(c,d);if(f)return void(f.ready?e&&e():f.funs.push(e));if(b.push({doc:c,url:d.src||d.href,funs:[e]}),!c.body){var g=[];for(var h in d)"tag"!=h&&g.push(h+'="'+d[h]+'"');return void c.write("<"+d.tag+" "+g.join(" ")+" ></"+d.tag+">")}if(!d.id||!c.getElementById(d.id)){var i=c.createElement(d.tag);delete d.tag;for(var h in d)i.setAttribute(h,d[h]);i.onload=i.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(f=a(c,d),f.funs.length>0){f.ready=1;for(var b;b=f.funs.pop();)b()}i.onload=i.onreadystatechange=null}},i.onerror=function(){throw Error("The load "+(d.href||d.src)+" fails,check the url")},c.getElementsByTagName("head")[0].appendChild(i)}}}()};b.each(["String","Function","Array","Number","RegExp","Object","Boolean"],function(a){b["is"+a]=function(b){return Object.prototype.toString.apply(b)=="[object "+a+"]"}});var c={};UE.parse={register:function(a,b){c[a]=b},load:function(a){b.each(c,function(c){c.call(a,b)})}},uParse=function(a,c){b.domReady(function(){var d;if(document.querySelectorAll)d=document.querySelectorAll(a);else if(/^#/.test(a))d=[document.getElementById(a.replace(/^#/,""))];else if(/^\./.test(a)){var d=[];b.each(document.getElementsByTagName("*"),function(b){b.className&&new RegExp("\\b"+a.replace(/^\./,"")+"\\b","i").test(b.className)&&d.push(b)})}else d=document.getElementsByTagName(a);b.each(d,function(d){UE.parse.load(b.extend({root:d,selector:a},c))})})}}(),UE.parse.register("insertcode",function(a){var b=this.root.getElementsByTagName("pre");if(b.length)if("undefined"==typeof XRegExp){var c,d;void 0!==this.rootPath?(c=a.removeLastbs(this.rootPath)+"/third-party/SyntaxHighlighter/shCore.js",d=a.removeLastbs(this.rootPath)+"/third-party/SyntaxHighlighter/shCoreDefault.css"):(c=this.highlightJsUrl,d=this.highlightCssUrl),a.loadFile(document,{id:"syntaxhighlighter_css",tag:"link",rel:"stylesheet",type:"text/css",href:d}),a.loadFile(document,{id:"syntaxhighlighter_js",src:c,tag:"script",type:"text/javascript",defer:"defer"},function(){a.each(b,function(a){a&&/brush/i.test(a.className)&&SyntaxHighlighter.highlight(a)})})}else a.each(b,function(a){a&&/brush/i.test(a.className)&&SyntaxHighlighter.highlight(a)})}),UE.parse.register("table",function(a){function b(b,c){var d,e=b;for(c=a.isArray(c)?c:[c];e;){for(d=0;d<c.length;d++)if(e.tagName==c[d].toUpperCase())return e;e=e.parentNode}return null}function c(b,c,e){for(var f=b.rows,g=[],h="TH"===f[0].cells[0].tagName,i=0,j=0,k=f.length;j<k;j++)g[j]=f[j];var l={reversecurrent:function(a,b){return 1},orderbyasc:function(a,b){var c=a.innerText||a.textContent,d=b.innerText||b.textContent;return c.localeCompare(d)},reversebyasc:function(a,b){var c=a.innerHTML,d=b.innerHTML;return d.localeCompare(c)},orderbynum:function(b,c){var d=b[a.isIE?"innerText":"textContent"].match(/\d+/),e=c[a.isIE?"innerText":"textContent"].match(/\d+/);return d&&(d=+d[0]),e&&(e=+e[0]),(d||0)-(e||0)},reversebynum:function(b,c){var d=b[a.isIE?"innerText":"textContent"].match(/\d+/),e=c[a.isIE?"innerText":"textContent"].match(/\d+/);return d&&(d=+d[0]),e&&(e=+e[0]),(e||0)-(d||0)}};b.setAttribute("data-sort-type",e&&"string"==typeof e&&l[e]?e:""),h&&g.splice(0,1),g=d(g,function(a,b){var d;return d=e&&"function"==typeof e?e.call(this,a.cells[c],b.cells[c]):e&&"number"==typeof e?1:e&&"string"==typeof e&&l[e]?l[e].call(this,a.cells[c],b.cells[c]):l.orderbyasc.call(this,a.cells[c],b.cells[c])});for(var m=b.ownerDocument.createDocumentFragment(),n=0,k=g.length;n<k;n++)m.appendChild(g[n]);var o=b.getElementsByTagName("tbody")[0];i?o.insertBefore(m,f[i-range.endRowIndex+range.beginRowIndex-1]):o.appendChild(m)}function d(a,b){b=b||function(a,b){return a.localeCompare(b)};for(var c=0,d=a.length;c<d;c++)for(var e=c,f=a.length;e<f;e++)if(b(a[c],a[e])>0){var g=a[c];a[c]=a[e],a[e]=g}return a}function e(b){if(!a.hasClass(b.rows[0],"firstRow")){for(var c=1;c<b.rows.length;c++)a.removeClass(b.rows[c],"firstRow");a.addClass(b.rows[0],"firstRow")}}var f=this,g=this.root,h=g.getElementsByTagName("table");if(h.length){var i=this.selector;a.cssRule("table",i+" table.noBorderTable td,"+i+" table.noBorderTable th,"+i+" table.noBorderTable caption{border:1px dashed #ddd !important}"+i+" table.sortEnabled tr.firstRow th,"+i+" table.sortEnabled tr.firstRow td{padding-right:20px; background-repeat: no-repeat;background-position: center right; background-image:url("+this.rootPath+"themes/default/images/sortable.png);}"+i+" table.sortEnabled tr.firstRow th:hover,"+i+" table.sortEnabled tr.firstRow td:hover{background-color: #EEE;}"+i+" table{margin-bottom:10px;border-collapse:collapse;display:table;}"+i+" td,"+i+" th{padding: 5px 10px;border: 1px solid #DDD;}"+i+" caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}"+i+" th{border-top:1px solid #BBB;background:#F7F7F7;}"+i+" table tr.firstRow th{border-top:2px solid #BBB;background:#F7F7F7;}"+i+" tr.ue-table-interlace-color-single td{ background: #fcfcfc; }"+i+" tr.ue-table-interlace-color-double td{ background: #f7faff; }"+i+" td p{margin:0;padding:0;width:auto;height:auto;}",document),a.each("td th caption".split(" "),function(b){var c=g.getElementsByTagName(b);c.length&&a.each(c,function(a){a.firstChild||(a.innerHTML="&nbsp;")})});var h=g.getElementsByTagName("table");a.each(h,function(d){/\bsortEnabled\b/.test(d.className)&&a.on(d,"click",function(d){var g=d.target||d.srcElement,h=b(g,["td","th"]),i=b(g,"table"),j=a.indexOf(i.rows[0].cells,h),k=i.getAttribute("data-sort-type");j!=-1&&(c(i,j,f.tableSortCompareFn||k),e(i))})})}}),UE.parse.register("background",function(a){for(var b,c,d=this,e=d.root,f=e.getElementsByTagName("p"),g=0;c=f[g++];)b=c.getAttribute("data-background"),b&&c.parentNode.removeChild(c);b&&a.cssRule("ueditor_background",d.selector+"{"+b+"}",document)}),UE.parse.register("list",function(a){function b(b){var e=this;a.each(b,function(b){if(b.className&&/custom_/i.test(b.className)){var f=b.className.match(/custom_(\w+)/)[1];if("dash"==f||"dot"==f)a.pushItem(c,h+" li.list-"+d[f]+"{background-image:url("+e.liiconpath+d[f]+".gif)}"),a.pushItem(c,h+" ul.custom_"+f+"{list-style:none;} "+h+" ul.custom_"+f+" li{background-position:0 3px;background-repeat:no-repeat}");else{var g=1;a.each(b.childNodes,function(b){"LI"==b.tagName&&(a.pushItem(c,h+" li.list-"+d[f]+g+"{background-image:url("+e.liiconpath+"list-"+d[f]+g+".gif)}"),g++)}),a.pushItem(c,h+" ol.custom_"+f+"{list-style:none;}"+h+" ol.custom_"+f+" li{background-position:0 3px;background-repeat:no-repeat}")}switch(f){case"cn":a.pushItem(c,h+" li.list-"+f+"-paddingleft-1{padding-left:25px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-2{padding-left:40px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-3{padding-left:55px}");break;case"cn1":a.pushItem(c,h+" li.list-"+f+"-paddingleft-1{padding-left:30px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-2{padding-left:40px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-3{padding-left:55px}");break;case"cn2":a.pushItem(c,h+" li.list-"+f+"-paddingleft-1{padding-left:40px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-2{padding-left:55px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-3{padding-left:68px}");break;case"num":case"num1":a.pushItem(c,h+" li.list-"+f+"-paddingleft-1{padding-left:25px}");break;case"num2":a.pushItem(c,h+" li.list-"+f+"-paddingleft-1{padding-left:35px}"),a.pushItem(c,h+" li.list-"+f+"-paddingleft-2{padding-left:40px}");break;case"dash":a.pushItem(c,h+" li.list-"+f+"-paddingleft{padding-left:35px}");break;case"dot":a.pushItem(c,h+" li.list-"+f+"-paddingleft{padding-left:20px}")}}})}var c=[],d={cn:"cn-1-",cn1:"cn-2-",cn2:"cn-3-",num:"num-1-",num1:"num-2-",num2:"num-3-",dash:"dash",dot:"dot"};a.extend(this,{liiconpath:"http://bs.baidu.com/listicon/",listDefaultPaddingLeft:"20"});var e=this.root,f=e.getElementsByTagName("ol"),g=e.getElementsByTagName("ul"),h=this.selector;f.length&&b.call(this,f),g.length&&b.call(this,g),(f.length||g.length)&&(c.push(h+" .list-paddingleft-1{padding-left:0}"),c.push(h+" .list-paddingleft-2{padding-left:"+this.listDefaultPaddingLeft+"px}"),c.push(h+" .list-paddingleft-3{padding-left:"+2*this.listDefaultPaddingLeft+"px}"),a.cssRule("list",h+" ol,"+h+" ul{margin:0;padding:0;}\n"+h+" li{clear:both;}\n"+c.join("\n"),document))})}();