ueditor-plus-assets 0.0.12 → 0.0.13

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.
@@ -1,9 +1,9 @@
1
- /*!
2
- * UEditorPlus
3
- * version: 2.0.0
4
- */
5
- (function(){
6
-
1
+ /*!
2
+ * UEditorPlus
3
+ * version: 2.0.0
4
+ */
5
+ (function(){
6
+
7
7
  // editor.js
8
8
  UEDITOR_CONFIG = window.UEDITOR_CONFIG || {};
9
9
 
@@ -40,7 +40,7 @@ window.UE = baidu.editor = {
40
40
  };
41
41
  var dom = (UE.dom = {});
42
42
 
43
-
43
+
44
44
  // core/browser.js
45
45
  /**
46
46
  * 浏览器判断模块
@@ -306,7 +306,7 @@ var ie = browser.ie,
306
306
  gecko = browser.gecko,
307
307
  opera = browser.opera;
308
308
 
309
-
309
+
310
310
  // core/utils.js
311
311
  /**
312
312
  * 工具函数包
@@ -1605,7 +1605,7 @@ utils.each(
1605
1605
  }
1606
1606
  );
1607
1607
 
1608
-
1608
+
1609
1609
  // core/EventBase.js
1610
1610
  /**
1611
1611
  * UE采用的事件基类
@@ -1780,7 +1780,7 @@ function getListener(obj, type, force) {
1780
1780
  );
1781
1781
  }
1782
1782
 
1783
-
1783
+
1784
1784
  // core/dtd.js
1785
1785
  ///import editor.js
1786
1786
  ///import core/dom/dom.js
@@ -2218,7 +2218,7 @@ var dtd = (dom.dtd = (function () {
2218
2218
  });
2219
2219
  })());
2220
2220
 
2221
-
2221
+
2222
2222
  // core/domUtils.js
2223
2223
  /**
2224
2224
  * Dom操作工具包
@@ -4797,7 +4797,7 @@ var domUtils = (dom.domUtils = {
4797
4797
  });
4798
4798
  var fillCharReg = new RegExp(domUtils.fillChar, "g");
4799
4799
 
4800
-
4800
+
4801
4801
  // core/Range.js
4802
4802
  /**
4803
4803
  * Range封装
@@ -6795,7 +6795,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, "g");
6795
6795
  };
6796
6796
  })();
6797
6797
 
6798
-
6798
+
6799
6799
  // core/Selection.js
6800
6800
  /**
6801
6801
  * 选集
@@ -7217,7 +7217,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, "g");
7217
7217
  };
7218
7218
  })();
7219
7219
 
7220
-
7220
+
7221
7221
  // core/Editor.js
7222
7222
  /**
7223
7223
  * 编辑器主类,包含编辑器提供的大部分公用接口
@@ -7484,7 +7484,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, "g");
7484
7484
  me.options.lang +
7485
7485
  "/" +
7486
7486
  me.options.lang +
7487
- ".js?{timestamp:dist/lang/zh-cn/zh-cn.js}",
7487
+ ".js?58c38108",
7488
7488
  tag: "script",
7489
7489
  type: "text/javascript",
7490
7490
  defer: "defer"
@@ -9019,7 +9019,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, "g");
9019
9019
  utils.inherits(Editor, EventBase);
9020
9020
  })();
9021
9021
 
9022
-
9022
+
9023
9023
  // core/Editor.defaultoptions.js
9024
9024
  //维护编辑器一下默认的不在插件中的配置项
9025
9025
  UE.Editor.defaultOptions = function (editor) {
@@ -9029,7 +9029,7 @@ UE.Editor.defaultOptions = function (editor) {
9029
9029
  initialContent: "",
9030
9030
  initialStyle: "",
9031
9031
  autoClearinitialContent: false,
9032
- iframeCssUrl: _url + "themes/iframe.css?{timestamp}",
9032
+ iframeCssUrl: _url + "themes/iframe.css?c20ec247",
9033
9033
  iframeCssUrlsAddition: [],
9034
9034
  textarea: '',
9035
9035
  focus: false,
@@ -9053,7 +9053,7 @@ UE.Editor.defaultOptions = function (editor) {
9053
9053
  };
9054
9054
  };
9055
9055
 
9056
-
9056
+
9057
9057
  // core/loadconfig.js
9058
9058
  (function () {
9059
9059
  UE.Editor.prototype.loadServerConfig = function () {
@@ -9140,7 +9140,7 @@ UE.Editor.defaultOptions = function (editor) {
9140
9140
  };
9141
9141
  })();
9142
9142
 
9143
-
9143
+
9144
9144
  // core/ajax.js
9145
9145
  /**
9146
9146
  * @file
@@ -9435,7 +9435,7 @@ UE.ajax = (function () {
9435
9435
  };
9436
9436
  })();
9437
9437
 
9438
-
9438
+
9439
9439
  // core/api.js
9440
9440
  UE.api = (function () {
9441
9441
  // axios import
@@ -10658,7 +10658,7 @@ UE.api = (function () {
10658
10658
  }
10659
10659
  })();
10660
10660
 
10661
-
10661
+
10662
10662
  // core/image.js
10663
10663
  UE.image = (function () {
10664
10664
  // import browser-image-compression
@@ -12659,7 +12659,7 @@ UE.image = (function () {
12659
12659
  };
12660
12660
  })();
12661
12661
 
12662
-
12662
+
12663
12663
  // core/dialog.js
12664
12664
  UE.dialog = (function () {
12665
12665
  return {
@@ -12693,7 +12693,7 @@ UE.dialog = (function () {
12693
12693
  }
12694
12694
  })();
12695
12695
 
12696
-
12696
+
12697
12697
  // core/filterword.js
12698
12698
  /**
12699
12699
  * UE过滤word的静态方法
@@ -12923,7 +12923,7 @@ var filterWord = (UE.filterWord = (function () {
12923
12923
  };
12924
12924
  })());
12925
12925
 
12926
-
12926
+
12927
12927
  // core/node.js
12928
12928
  /**
12929
12929
  * 编辑器模拟的节点类
@@ -13701,7 +13701,7 @@ var filterWord = (UE.filterWord = (function () {
13701
13701
  };
13702
13702
  })();
13703
13703
 
13704
-
13704
+
13705
13705
  // core/htmlparser.js
13706
13706
  /**
13707
13707
  * html字符串转换成uNode节点
@@ -13954,7 +13954,7 @@ var htmlparser = (UE.htmlparser = function (htmlstr, ignoreBlank) {
13954
13954
  return root;
13955
13955
  });
13956
13956
 
13957
-
13957
+
13958
13958
  // core/filternode.js
13959
13959
  /**
13960
13960
  * UE过滤节点的静态方法
@@ -14084,7 +14084,7 @@ var filterNode = (UE.filterNode = (function () {
14084
14084
  };
14085
14085
  })());
14086
14086
 
14087
-
14087
+
14088
14088
  // core/plugin.js
14089
14089
  /**
14090
14090
  * Created with JetBrains PhpStorm.
@@ -14166,7 +14166,7 @@ UE.plugin = (function () {
14166
14166
  };
14167
14167
  })();
14168
14168
 
14169
-
14169
+
14170
14170
  // core/keymap.js
14171
14171
  var keymap = (UE.keymap = {
14172
14172
  Backspace: 8,
@@ -14217,7 +14217,7 @@ var keymap = (UE.keymap = {
14217
14217
  n: 78
14218
14218
  });
14219
14219
 
14220
-
14220
+
14221
14221
  // core/localstorage.js
14222
14222
  var LocalStorage = (UE.LocalStorage = (function () {
14223
14223
 
@@ -14229,8 +14229,12 @@ var LocalStorage = (UE.LocalStorage = (function () {
14229
14229
  if (!storage) {
14230
14230
  return false;
14231
14231
  }
14232
- storage.setItem(key, data);
14233
- return true;
14232
+ try {
14233
+ storage.setItem(key, data);
14234
+ return true;
14235
+ } catch (error) {
14236
+ return false;
14237
+ }
14234
14238
  },
14235
14239
  getLocalData: function (key) {
14236
14240
  // console.log('getLocalData', key);
@@ -14265,7 +14269,13 @@ var LocalStorage = (UE.LocalStorage = (function () {
14265
14269
  } else {
14266
14270
  data = obj;
14267
14271
  }
14268
- data && LocalStorage.saveLocalData(ROOT_KEY, utils.json2str(data));
14272
+ if (data) {
14273
+ var serialized = utils.json2str(data);
14274
+ if (!LocalStorage.saveLocalData(ROOT_KEY, serialized) && utils.isString(key)) {
14275
+ delete data[key];
14276
+ LocalStorage.saveLocalData(ROOT_KEY, utils.json2str(data));
14277
+ }
14278
+ }
14269
14279
  };
14270
14280
 
14271
14281
  UE.Editor.prototype.getPreferences = function (key) {
@@ -14288,7 +14298,7 @@ var LocalStorage = (UE.LocalStorage = (function () {
14288
14298
  };
14289
14299
  })();
14290
14300
 
14291
-
14301
+
14292
14302
  // plugins/defaultfilter.js
14293
14303
  ///import core
14294
14304
  ///plugin 编辑器默认的过滤转换机制
@@ -14569,7 +14579,7 @@ UE.plugins["defaultfilter"] = function () {
14569
14579
  });
14570
14580
  };
14571
14581
 
14572
-
14582
+
14573
14583
  // plugins/inserthtml.js
14574
14584
  /**
14575
14585
  * 插入html字符串插件
@@ -14849,7 +14859,7 @@ UE.commands["inserthtml"] = {
14849
14859
  }
14850
14860
  };
14851
14861
 
14852
-
14862
+
14853
14863
  // plugins/autotypeset.js
14854
14864
  /**
14855
14865
  * 自动排版
@@ -15223,7 +15233,7 @@ UE.plugins["autotypeset"] = function () {
15223
15233
  };
15224
15234
  };
15225
15235
 
15226
-
15236
+
15227
15237
  // plugins/autosubmit.js
15228
15238
  /**
15229
15239
  * 快捷键提交
@@ -15265,7 +15275,7 @@ UE.plugin.register("autosubmit", function () {
15265
15275
  };
15266
15276
  });
15267
15277
 
15268
-
15278
+
15269
15279
  // plugins/background.js
15270
15280
  /**
15271
15281
  * 背景插件,为UEditor提供设置背景功能
@@ -15399,7 +15409,7 @@ UE.plugin.register("background", function () {
15399
15409
  };
15400
15410
  });
15401
15411
 
15402
-
15412
+
15403
15413
  // plugins/image.js
15404
15414
  /**
15405
15415
  * 图片插入、排版插件
@@ -15705,7 +15715,7 @@ UE.commands["insertimage"] = {
15705
15715
  }
15706
15716
  };
15707
15717
 
15708
-
15718
+
15709
15719
  // plugins/justify.js
15710
15720
  /**
15711
15721
  * 段落格式
@@ -15839,7 +15849,7 @@ UE.plugins["justify"] = function () {
15839
15849
  };
15840
15850
  };
15841
15851
 
15842
-
15852
+
15843
15853
  // plugins/font.js
15844
15854
  /**
15845
15855
  * 字体颜色,背景色,字号,字体,下划线,删除线
@@ -16421,7 +16431,7 @@ UE.plugins["font"] = function () {
16421
16431
  }
16422
16432
  };
16423
16433
 
16424
-
16434
+
16425
16435
  // plugins/link.js
16426
16436
  /**
16427
16437
  * 超链接
@@ -16620,7 +16630,7 @@ UE.plugins["link"] = function () {
16620
16630
  };
16621
16631
  };
16622
16632
 
16623
-
16633
+
16624
16634
  // plugins/iframe.js
16625
16635
  ///import core
16626
16636
  ///import plugins\inserthtml.js
@@ -16641,7 +16651,7 @@ UE.plugins["insertframe"] = function () {
16641
16651
  });
16642
16652
  };
16643
16653
 
16644
-
16654
+
16645
16655
  // plugins/scrawl.js
16646
16656
  ///import core
16647
16657
  ///commands 涂鸦
@@ -16654,7 +16664,7 @@ UE.commands["scrawl"] = {
16654
16664
  }
16655
16665
  };
16656
16666
 
16657
-
16667
+
16658
16668
  // plugins/removeformat.js
16659
16669
  /**
16660
16670
  * 清除格式
@@ -16868,7 +16878,7 @@ UE.plugins["removeformat"] = function () {
16868
16878
  };
16869
16879
  };
16870
16880
 
16871
-
16881
+
16872
16882
  // plugins/blockquote.js
16873
16883
  /**
16874
16884
  * 添加引用
@@ -17061,7 +17071,7 @@ UE.plugins["blockquote"] = function () {
17061
17071
  };
17062
17072
  };
17063
17073
 
17064
-
17074
+
17065
17075
  // plugins/convertcase.js
17066
17076
  /**
17067
17077
  * 大小写转换
@@ -17121,7 +17131,7 @@ UE.commands["touppercase"] = UE.commands["tolowercase"] = {
17121
17131
  }
17122
17132
  };
17123
17133
 
17124
-
17134
+
17125
17135
  // plugins/indent.js
17126
17136
  /**
17127
17137
  * 首行缩进
@@ -17167,7 +17177,7 @@ UE.commands["indent"] = {
17167
17177
  }
17168
17178
  };
17169
17179
 
17170
-
17180
+
17171
17181
  // plugins/print.js
17172
17182
  /**
17173
17183
  * 打印
@@ -17192,7 +17202,7 @@ UE.commands["print"] = {
17192
17202
  notNeedUndo: 1
17193
17203
  };
17194
17204
 
17195
-
17205
+
17196
17206
  // plugins/preview.js
17197
17207
  /**
17198
17208
  * 预览
@@ -17231,7 +17241,7 @@ UE.commands["preview"] = {
17231
17241
  notNeedUndo: 1
17232
17242
  };
17233
17243
 
17234
-
17244
+
17235
17245
  // plugins/selectall.js
17236
17246
  /**
17237
17247
  * 全选
@@ -17276,7 +17286,7 @@ UE.plugins["selectall"] = function () {
17276
17286
  });
17277
17287
  };
17278
17288
 
17279
-
17289
+
17280
17290
  // plugins/paragraph.js
17281
17291
  /**
17282
17292
  * 段落样式
@@ -17497,7 +17507,7 @@ UE.plugins["paragraph"] = function () {
17497
17507
  };
17498
17508
  };
17499
17509
 
17500
-
17510
+
17501
17511
  // plugins/directionality.js
17502
17512
  /**
17503
17513
  * 设置文字输入的方向的插件
@@ -17632,7 +17642,7 @@ UE.plugins["paragraph"] = function () {
17632
17642
  };
17633
17643
  })();
17634
17644
 
17635
-
17645
+
17636
17646
  // plugins/horizontal.js
17637
17647
  /**
17638
17648
  * 插入分割线插件
@@ -17737,7 +17747,7 @@ UE.plugins["horizontal"] = function () {
17737
17747
  });
17738
17748
  };
17739
17749
 
17740
-
17750
+
17741
17751
  // plugins/time.js
17742
17752
  /**
17743
17753
  * 插入时间和日期
@@ -17798,7 +17808,7 @@ UE.commands["time"] = UE.commands["date"] = {
17798
17808
  }
17799
17809
  };
17800
17810
 
17801
-
17811
+
17802
17812
  // plugins/rowspacing.js
17803
17813
  /**
17804
17814
  * 段前段后间距插件
@@ -17852,7 +17862,7 @@ UE.plugins["rowspacing"] = function () {
17852
17862
  };
17853
17863
  };
17854
17864
 
17855
-
17865
+
17856
17866
  // plugins/lineheight.js
17857
17867
  /**
17858
17868
  * 设置行内间距
@@ -17908,7 +17918,7 @@ UE.plugins["lineheight"] = function () {
17908
17918
  };
17909
17919
  };
17910
17920
 
17911
-
17921
+
17912
17922
  // plugins/insertcode.js
17913
17923
  /**
17914
17924
  * 插入代码插件
@@ -17918,32 +17928,253 @@ UE.plugins["lineheight"] = function () {
17918
17928
 
17919
17929
  UE.plugins["insertcode"] = function () {
17920
17930
  var me = this;
17931
+ function getStoredCodeBlockLanguage(node) {
17932
+ return normalizeInsertCodeLanguage(getNodeAttr(node, "data-code-lang"));
17933
+ }
17934
+ function normalizeInsertCodeLanguage(lang) {
17935
+ if (!lang) return "";
17936
+ lang = (lang + "").toLowerCase();
17937
+ var aliasMap = {
17938
+ javascript: "js",
17939
+ jscript: "js",
17940
+ shell: "bash",
17941
+ sh: "bash",
17942
+ powershell: "ps",
17943
+ csharp: "c#",
17944
+ plaintext: "plain",
17945
+ text: "plain",
17946
+ txt: "plain"
17947
+ };
17948
+ return aliasMap[lang] || lang;
17949
+ }
17950
+ function getCodeBlockLanguage(node) {
17951
+ if (!node) return "";
17952
+ var storedLang = getStoredCodeBlockLanguage(node);
17953
+ if (storedLang) {
17954
+ return storedLang;
17955
+ }
17956
+ var className = "";
17957
+ if (node.getAttr) {
17958
+ className = node.getAttr("class") || "";
17959
+ } else {
17960
+ className = node.className || "";
17961
+ }
17962
+ var match = className.match(/(?:^|\s)language-([^\s]+)/);
17963
+ if (match && match[1]) {
17964
+ return normalizeInsertCodeLanguage(match[1]);
17965
+ }
17966
+ match = className.match(/brush:([^;]+)/);
17967
+ return match && match[1] ? normalizeInsertCodeLanguage(match[1]) : "";
17968
+ }
17969
+ function getCodePlainText(node) {
17970
+ if (!node) return "";
17971
+ var text = "";
17972
+ if (typeof node.innerText == "function") {
17973
+ text = node.innerText() || "";
17974
+ } else if (typeof node.innerText == "string") {
17975
+ text = node.innerText;
17976
+ } else if (typeof node.textContent == "string") {
17977
+ text = node.textContent;
17978
+ } else if (node.nodeType == 3) {
17979
+ text = node.nodeValue || "";
17980
+ }
17981
+ return (text || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
17982
+ }
17983
+ function decodeSlateFragmentLanguage(node, expectedText) {
17984
+ if (!node) return "";
17985
+ var fragment = getNodeAttr(node, "data-slate-fragment");
17986
+ if (!fragment || typeof window === "undefined" || !window.atob) {
17987
+ return "";
17988
+ }
17989
+ try {
17990
+ var decoded = decodeURIComponent(window.atob(fragment));
17991
+ var json = JSON.parse(decoded);
17992
+ if (!utils.isArray(json)) {
17993
+ json = [json];
17994
+ }
17995
+ var found = [];
17996
+ var walk = function (items) {
17997
+ if (!items) return;
17998
+ utils.each(items, function (item) {
17999
+ if (!item) return;
18000
+ if (item.type == "code" && item.language) {
18001
+ var text = "";
18002
+ utils.each(item.children || [], function (child) {
18003
+ if (child && typeof child.text == "string") {
18004
+ text += child.text;
18005
+ }
18006
+ });
18007
+ found.push({
18008
+ language: item.language,
18009
+ text: text.replace(/\r\n/g, "\n").replace(/\r/g, "\n")
18010
+ });
18011
+ }
18012
+ if (item.children && item.children.length) {
18013
+ walk(item.children);
18014
+ }
18015
+ });
18016
+ };
18017
+ walk(json);
18018
+ if (!found.length) {
18019
+ return "";
18020
+ }
18021
+ var normalizedExpected = (expectedText || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
18022
+ if (normalizedExpected) {
18023
+ var matched = "";
18024
+ utils.each(found, function (item) {
18025
+ if (item.text == normalizedExpected) {
18026
+ matched = normalizeInsertCodeLanguage(item.language);
18027
+ return false;
18028
+ }
18029
+ });
18030
+ if (matched) {
18031
+ return matched;
18032
+ }
18033
+ }
18034
+ return found.length == 1
18035
+ ? normalizeInsertCodeLanguage(found[0].language)
18036
+ : "";
18037
+ } catch (error) {
18038
+ return "";
18039
+ }
18040
+ }
18041
+ function getCodeChild(node) {
18042
+ if (!node) return null;
18043
+ if (node.getElementsByTagName) {
18044
+ var codeNodes = node.getElementsByTagName("code");
18045
+ return codeNodes && codeNodes[0] ? codeNodes[0] : null;
18046
+ }
18047
+ var codeNode = null;
18048
+ utils.each(node.children || [], function (child) {
18049
+ if (child.type == "element" && child.tagName == "code") {
18050
+ codeNode = child;
18051
+ return false;
18052
+ }
18053
+ });
18054
+ return codeNode;
18055
+ }
18056
+ function setEditableCodeBlockLanguage(pre, lang) {
18057
+ lang = normalizeInsertCodeLanguage(lang);
18058
+ var className = lang ? "language-" + lang : "";
18059
+ var codeNode = getCodeChild(pre);
18060
+ if (codeNode) {
18061
+ codeNode.className = className;
18062
+ if (codeNode.setAttribute) {
18063
+ codeNode.setAttribute("data-code-lang", lang || "");
18064
+ } else if (codeNode.setAttr) {
18065
+ codeNode.setAttr("data-code-lang", lang || "");
18066
+ }
18067
+ if (pre.setAttribute) {
18068
+ pre.setAttribute("class", className);
18069
+ } else {
18070
+ pre.className = className;
18071
+ }
18072
+ pre.setAttribute && pre.setAttribute("data-code-lang", lang || "");
18073
+ pre.setAttr && pre.setAttr("data-code-lang", lang || "");
18074
+ } else {
18075
+ pre.className = className;
18076
+ pre.setAttribute && pre.setAttribute("data-code-lang", lang || "");
18077
+ pre.setAttr && pre.setAttr("data-code-lang", lang || "");
18078
+ }
18079
+ }
18080
+ function getNodeAttr(node, attrName) {
18081
+ if (!node) return "";
18082
+ if (node.getAttr) {
18083
+ return node.getAttr(attrName) || "";
18084
+ }
18085
+ return node.getAttribute ? node.getAttribute(attrName) || "" : "";
18086
+ }
18087
+ function ensureSlateCodeLineBreakText(node) {
18088
+ if (!node) return;
18089
+ utils.each(node.children || [], function (child) {
18090
+ if (!child || child.type != "element") return;
18091
+ ensureSlateCodeLineBreakText(child);
18092
+ if (getNodeAttr(child, "data-slate-string") === "") {
18093
+ return;
18094
+ }
18095
+ var hasChildContent = false;
18096
+ utils.each(child.children || [], function (grandChild) {
18097
+ if (!grandChild) return;
18098
+ if (grandChild.type == "element") {
18099
+ hasChildContent = true;
18100
+ return false;
18101
+ }
18102
+ if (grandChild.type == "text" && grandChild.data !== "") {
18103
+ hasChildContent = true;
18104
+ return false;
18105
+ }
18106
+ });
18107
+ if (!hasChildContent) {
18108
+ child.appendChild(UE.uNode.createText("\n"));
18109
+ }
18110
+ });
18111
+ }
18112
+ function removeRuntimeAttrs(node) {
18113
+ if (!node) return;
18114
+ var removeAttr = function (target, attrName) {
18115
+ if (!target) return;
18116
+ if (target.getAttr) {
18117
+ target.setAttr(attrName);
18118
+ } else if (target.removeAttribute) {
18119
+ target.removeAttribute(attrName);
18120
+ }
18121
+ };
18122
+ if (node.getAttr) {
18123
+ utils.each(node.attrs || {}, function (val, key) {
18124
+ if (
18125
+ /^data-w-e-/.test(key) ||
18126
+ key == "data-slate-fragment"
18127
+ ) {
18128
+ removeAttr(node, key);
18129
+ }
18130
+ });
18131
+ var currentId = node.getAttr("id");
18132
+ if (currentId && /^w-e-/.test(currentId)) {
18133
+ removeAttr(node, "id");
18134
+ }
18135
+ } else if (node.attributes) {
18136
+ var attrs = [];
18137
+ utils.each(node.attributes, function (attr) {
18138
+ if (attr && attr.name) {
18139
+ attrs.push(attr.name);
18140
+ }
18141
+ });
18142
+ utils.each(attrs, function (attrName) {
18143
+ if (
18144
+ /^data-w-e-/.test(attrName) ||
18145
+ attrName == "data-slate-fragment"
18146
+ ) {
18147
+ removeAttr(node, attrName);
18148
+ }
18149
+ });
18150
+ if (node.id && /^w-e-/.test(node.id)) {
18151
+ removeAttr(node, "id");
18152
+ }
18153
+ }
18154
+ utils.each(node.children || [], function (child) {
18155
+ if (child.type == "element" || child.nodeType == 1) {
18156
+ removeRuntimeAttrs(child);
18157
+ }
18158
+ });
18159
+ }
17921
18160
  me.setOpt("insertcode", {
17922
- as3: "ActionScript3",
17923
- bash: "Bash/Shell",
17924
- cpp: "C/C++",
17925
- css: "Css",
17926
- // cf: "CodeFunction",
17927
- "c#": "C#",
17928
- delphi: "Delphi",
17929
- // diff: "Diff",
17930
- erlang: "Erlang",
17931
- groovy: "Groovy",
17932
- html: "Html",
18161
+ css: "CSS",
18162
+ html: "HTML",
18163
+ xml: "XML",
18164
+ js: "JavaScript",
18165
+ typescript: "TypeScript",
18166
+ python: "Python",
17933
18167
  java: "Java",
17934
- // jfx: "JavaFx",
17935
- js: "Javascript",
17936
- pl: "Perl",
18168
+ go: "Go",
18169
+ rust: "Rust",
17937
18170
  php: "PHP",
17938
- plain: "Text",
17939
- ps: "PowerShell",
17940
- python: "Python",
17941
- ruby: "Ruby",
17942
- scala: "Scala",
18171
+ cpp: "C++",
18172
+ "c#": "C#",
18173
+ bash: "Shell",
18174
+ nginx: "Nginx",
17943
18175
  sql: "SQL",
17944
- vb: "VB",
17945
- xml: "XML",
17946
- mind: "Mind",
18176
+ json: "JSON",
18177
+ markdown: "Markdown"
17947
18178
  });
17948
18179
 
17949
18180
  /**
@@ -17976,7 +18207,7 @@ UE.plugins["insertcode"] = function () {
17976
18207
  rng = me.selection.getRange(),
17977
18208
  pre = domUtils.findParentByTagName(rng.startContainer, "pre", true);
17978
18209
  if (pre) {
17979
- pre.className = "brush:" + lang + ";toolbar:false;";
18210
+ setEditableCodeBlockLanguage(pre, lang);
17980
18211
  } else {
17981
18212
  var code = "";
17982
18213
  if (rng.collapsed) {
@@ -18062,9 +18293,9 @@ UE.plugins["insertcode"] = function () {
18062
18293
  }
18063
18294
  me.execCommand(
18064
18295
  "inserthtml",
18065
- '<pre id="coder"class="brush:' +
18296
+ '<pre id="coder" class="language-' +
18066
18297
  lang +
18067
- ';toolbar:false">' +
18298
+ '">' +
18068
18299
  code +
18069
18300
  "</pre>",
18070
18301
  true
@@ -18093,12 +18324,41 @@ UE.plugins["insertcode"] = function () {
18093
18324
  }
18094
18325
  },
18095
18326
  queryCommandValue: function () {
18327
+ var range = this.selection.getRange();
18328
+ var startContainer = range && range.startContainer;
18329
+ var codeElement = domUtils.findParentByTagName(startContainer, "code", true);
18330
+ var preElement = domUtils.findParentByTagName(startContainer, "pre", true);
18331
+ var directLang =
18332
+ getCodeBlockLanguage(codeElement) ||
18333
+ getCodeBlockLanguage(getCodeChild(preElement)) ||
18334
+ getCodeBlockLanguage(preElement) ||
18335
+ decodeSlateFragmentLanguage(
18336
+ preElement,
18337
+ getCodePlainText(codeElement || preElement)
18338
+ ) ||
18339
+ decodeSlateFragmentLanguage(codeElement, getCodePlainText(codeElement));
18340
+ if (directLang) {
18341
+ return directLang;
18342
+ }
18096
18343
  var path = this.selection.getStartElementPath();
18097
18344
  var lang = "";
18098
18345
  utils.each(path, function (node) {
18346
+ if (node.nodeName == "CODE") {
18347
+ lang = getCodeBlockLanguage(node);
18348
+ if (!lang) {
18349
+ lang = decodeSlateFragmentLanguage(node, getCodePlainText(node));
18350
+ }
18351
+ if (lang) {
18352
+ return false;
18353
+ }
18354
+ }
18099
18355
  if (node.nodeName == "PRE") {
18100
- var match = node.className.match(/brush:([^;]+)/);
18101
- lang = match && match[1] ? match[1] : "";
18356
+ var codeNode = getCodeChild(node);
18357
+ lang =
18358
+ getCodeBlockLanguage(codeNode) ||
18359
+ getCodeBlockLanguage(node) ||
18360
+ decodeSlateFragmentLanguage(node, getCodePlainText(codeNode || node)) ||
18361
+ decodeSlateFragmentLanguage(codeNode, getCodePlainText(codeNode));
18102
18362
  return false;
18103
18363
  }
18104
18364
  });
@@ -18108,6 +18368,28 @@ UE.plugins["insertcode"] = function () {
18108
18368
 
18109
18369
  me.addInputRule(function (root) {
18110
18370
  utils.each(root.getNodesByTagName("pre"), function (pre) {
18371
+ var codeNode = getCodeChild(pre);
18372
+ var codeText = getCodePlainText(codeNode || pre);
18373
+ var lang =
18374
+ getCodeBlockLanguage(codeNode) ||
18375
+ getCodeBlockLanguage(pre) ||
18376
+ decodeSlateFragmentLanguage(pre, codeText) ||
18377
+ decodeSlateFragmentLanguage(codeNode, codeText);
18378
+ if (codeNode) {
18379
+ ensureSlateCodeLineBreakText(codeNode);
18380
+ removeRuntimeAttrs(pre);
18381
+ if (lang && !getStoredCodeBlockLanguage(codeNode)) {
18382
+ codeNode.setAttr("class", "language-" + lang);
18383
+ }
18384
+ if (lang) {
18385
+ codeNode.setAttr("data-code-lang", lang);
18386
+ pre.setAttr("data-code-lang", lang);
18387
+ pre.setAttr("class", "language-" + lang);
18388
+ } else {
18389
+ pre.setAttr("class");
18390
+ }
18391
+ return;
18392
+ }
18111
18393
  var brs = pre.getNodesByTagName("br");
18112
18394
  if (brs.length) {
18113
18395
  browser.ie &&
@@ -18133,6 +18415,29 @@ UE.plugins["insertcode"] = function () {
18133
18415
  });
18134
18416
  me.addOutputRule(function (root) {
18135
18417
  utils.each(root.getNodesByTagName("pre"), function (pre) {
18418
+ var outputCodeNode = getCodeChild(pre);
18419
+ var outputCodeText = getCodePlainText(outputCodeNode || pre);
18420
+ var lang =
18421
+ getCodeBlockLanguage(outputCodeNode) ||
18422
+ getCodeBlockLanguage(pre) ||
18423
+ decodeSlateFragmentLanguage(pre, outputCodeText) ||
18424
+ decodeSlateFragmentLanguage(outputCodeNode, outputCodeText);
18425
+ var existingCodeNode = outputCodeNode;
18426
+ if (existingCodeNode) {
18427
+ ensureSlateCodeLineBreakText(existingCodeNode);
18428
+ removeRuntimeAttrs(pre);
18429
+ if (lang && !getStoredCodeBlockLanguage(existingCodeNode)) {
18430
+ existingCodeNode.setAttr("class", "language-" + lang);
18431
+ }
18432
+ if (lang) {
18433
+ existingCodeNode.setAttr("data-code-lang", lang);
18434
+ pre.setAttr("data-code-lang", lang);
18435
+ pre.setAttr("class", "language-" + lang);
18436
+ } else {
18437
+ pre.setAttr("class");
18438
+ }
18439
+ return;
18440
+ }
18136
18441
  var code = "";
18137
18442
  utils.each(pre.children, function (n) {
18138
18443
  if (n.type == "text") {
@@ -18148,7 +18453,16 @@ UE.plugins["insertcode"] = function () {
18148
18453
  }
18149
18454
  });
18150
18455
 
18151
- pre.innerText(code.replace(/(&nbsp;|\n)+$/, ""));
18456
+ var codeNode = UE.uNode.createElement("code");
18457
+ if (lang) {
18458
+ codeNode.setAttr("class", "language-" + lang);
18459
+ codeNode.setAttr("data-code-lang", lang);
18460
+ pre.setAttr("data-code-lang", lang);
18461
+ }
18462
+ codeNode.innerText(code.replace(/(&nbsp;|\n)+$/, ""));
18463
+ pre.innerHTML("");
18464
+ pre.setAttr("class");
18465
+ pre.appendChild(codeNode);
18152
18466
  });
18153
18467
  });
18154
18468
  //不需要判断highlight的command列表
@@ -18517,7 +18831,7 @@ UE.plugins["insertcode"] = function () {
18517
18831
  });
18518
18832
  };
18519
18833
 
18520
-
18834
+
18521
18835
  // plugins/cleardoc.js
18522
18836
  /**
18523
18837
  * 清空文档插件
@@ -18555,7 +18869,7 @@ UE.commands["cleardoc"] = {
18555
18869
  }
18556
18870
  };
18557
18871
 
18558
-
18872
+
18559
18873
  // plugins/anchor.js
18560
18874
  /**
18561
18875
  * 锚点插件,为UEditor提供插入锚点支持
@@ -18653,7 +18967,7 @@ UE.plugin.register("anchor", function () {
18653
18967
  };
18654
18968
  });
18655
18969
 
18656
-
18970
+
18657
18971
  // plugins/wordcount.js
18658
18972
  ///import core
18659
18973
  ///commands 字数统计
@@ -18697,7 +19011,7 @@ UE.plugins["wordcount"] = function () {
18697
19011
  });
18698
19012
  };
18699
19013
 
18700
-
19014
+
18701
19015
  // plugins/pagebreak.js
18702
19016
  /**
18703
19017
  * 分页功能插件
@@ -18880,7 +19194,7 @@ UE.plugins["pagebreak"] = function () {
18880
19194
  };
18881
19195
  };
18882
19196
 
18883
-
19197
+
18884
19198
  // plugins/wordimage.js
18885
19199
  ///import core
18886
19200
  ///commands 本地图片引导上传
@@ -18949,7 +19263,7 @@ UE.plugin.register("wordimage", function () {
18949
19263
  };
18950
19264
  });
18951
19265
 
18952
-
19266
+
18953
19267
  // plugins/autosave.js
18954
19268
  UE.plugin.register("autosave", function () {
18955
19269
  var me = this, saveKey = null;
@@ -19086,7 +19400,7 @@ UE.plugin.register("autosave", function () {
19086
19400
  };
19087
19401
  });
19088
19402
 
19089
-
19403
+
19090
19404
  // plugins/formula.js
19091
19405
  UE.plugin.register("formula", function () {
19092
19406
  var me = this, images = [];
@@ -19113,7 +19427,7 @@ UE.plugin.register("formula", function () {
19113
19427
  };
19114
19428
  });
19115
19429
 
19116
-
19430
+
19117
19431
  // plugins/dragdrop.js
19118
19432
  UE.plugins["dragdrop"] = function () {
19119
19433
  var me = this;
@@ -19181,7 +19495,7 @@ UE.plugins["dragdrop"] = function () {
19181
19495
  });
19182
19496
  };
19183
19497
 
19184
-
19498
+
19185
19499
  // plugins/undo.js
19186
19500
  /**
19187
19501
  * undo redo
@@ -19525,10 +19839,148 @@ UE.plugins["undo"] = function () {
19525
19839
  };
19526
19840
  };
19527
19841
 
19528
-
19842
+
19529
19843
  // plugins/copy.js
19530
19844
  UE.plugin.register("copy", function () {
19531
19845
  var me = this;
19846
+ function normalizeCopiedCodeBlocks(container) {
19847
+ if (!container || !container.getElementsByTagName) return;
19848
+ var codeBlocks = container.getElementsByTagName("code");
19849
+ function getCodeText(node) {
19850
+ if (!node) return "";
19851
+ if (node.nodeType == 3) {
19852
+ return node.nodeValue || "";
19853
+ }
19854
+ if (node.nodeType != 1) {
19855
+ return "";
19856
+ }
19857
+ if (node.tagName == "BR") {
19858
+ return "\n";
19859
+ }
19860
+ var text = "";
19861
+ utils.each(node.childNodes || [], function (childNode) {
19862
+ text += getCodeText(childNode);
19863
+ });
19864
+ return text;
19865
+ }
19866
+ utils.each(codeBlocks, function (codeNode) {
19867
+ if (!codeNode) return;
19868
+ var preNode = domUtils.findParentByTagName(codeNode, "pre", true);
19869
+ if (!preNode) return;
19870
+ var dataLang = codeNode.getAttribute("data-code-lang") || preNode.getAttribute("data-code-lang") || "";
19871
+ var className = codeNode.className || preNode.className || "";
19872
+ var match = className.match(/(?:^|\s)language-([^\s]+)/);
19873
+ var lang = dataLang || (match && match[1]) || "";
19874
+ var text = typeof codeNode.textContent == "string"
19875
+ ? codeNode.textContent
19876
+ : getCodeText(codeNode);
19877
+ text = text
19878
+ .replace(/\u00a0/g, " ")
19879
+ .replace(/\r\n/g, "\n")
19880
+ .replace(/\r/g, "\n");
19881
+
19882
+ codeNode.className = lang ? "language-" + lang : "";
19883
+ preNode.className = lang ? "language-" + lang : "";
19884
+
19885
+ if (lang) {
19886
+ codeNode.setAttribute("data-code-lang", lang);
19887
+ preNode.setAttribute("data-code-lang", lang);
19888
+ } else {
19889
+ codeNode.removeAttribute("data-code-lang");
19890
+ preNode.removeAttribute("data-code-lang");
19891
+ }
19892
+ codeNode.setAttribute("data-raw-code", encodeURIComponent(text));
19893
+ preNode.setAttribute("data-raw-code", encodeURIComponent(text));
19894
+ });
19895
+ }
19896
+ function appendStyleText(styleText, stylePart) {
19897
+ styleText = styleText || "";
19898
+ stylePart = stylePart || "";
19899
+ if (!stylePart) return styleText;
19900
+ if (styleText && !/;\s*$/.test(styleText)) {
19901
+ styleText += ";";
19902
+ }
19903
+ return styleText + stylePart;
19904
+ }
19905
+ function replaceCellTag(cell, tagName) {
19906
+ if (!cell || cell.tagName == tagName) return cell;
19907
+ var doc = cell.ownerDocument;
19908
+ var next = doc.createElement(tagName);
19909
+ var attrs = cell.attributes;
19910
+ for (var i = 0; i < attrs.length; i++) {
19911
+ var attr = attrs[i];
19912
+ if (attr && attr.specified !== false) {
19913
+ next.setAttribute(attr.nodeName, attr.nodeValue);
19914
+ }
19915
+ }
19916
+ next.innerHTML = cell.innerHTML;
19917
+ cell.parentNode.replaceChild(next, cell);
19918
+ return next;
19919
+ }
19920
+ function normalizeCopiedTables(container) {
19921
+ if (!container || !container.getElementsByTagName) return;
19922
+ var tables = container.getElementsByTagName("table");
19923
+ utils.each(tables, function (table) {
19924
+ if (!table || !table.rows) return;
19925
+ var tableStyle = table.getAttribute("style") || "";
19926
+ tableStyle = appendStyleText(tableStyle, "border-collapse:collapse;display:table;margin-bottom:10px;");
19927
+ tableStyle = tableStyle.replace(/(?:^|;)\s*height\s*:[^;]*/gi, "");
19928
+ tableStyle = tableStyle.replace(/(?:^|;)\s*background(?:-color)?\s*:[^;]*/gi, "");
19929
+ tableStyle = tableStyle.replace(/(?:^|;)\s*border(?:-(?:top|right|bottom|left))?-(?:width|style|color)\s*:[^;]*/gi, "");
19930
+ tableStyle = tableStyle.replace(/(?:^|;)\s*border\s*:[^;]*/gi, "");
19931
+ table.setAttribute("style", tableStyle);
19932
+
19933
+ var noBorder = domUtils.hasClass(table, "noBorderTable");
19934
+ utils.each(table.rows, function (row, rowIndex) {
19935
+ if (!row || !row.cells) return;
19936
+ var isHeaderRow = rowIndex === 0 || domUtils.hasClass(row, "firstRow");
19937
+ utils.each(row.cells, function (cell) {
19938
+ if (!cell) return;
19939
+ var normalizedCell = isHeaderRow ? replaceCellTag(cell, "th") : cell;
19940
+ var cellStyle = normalizedCell.getAttribute("style") || "";
19941
+ cellStyle = cellStyle.replace(/(?:^|;)\s*height\s*:[^;]*/gi, "");
19942
+ cellStyle = cellStyle.replace(/(?:^|;)\s*background(?:-color)?\s*:[^;]*/gi, "");
19943
+ cellStyle = cellStyle.replace(/(?:^|;)\s*border(?:-(?:top|right|bottom|left))?-(?:width|style|color)\s*:[^;]*/gi, "");
19944
+ cellStyle = cellStyle.replace(/(?:^|;)\s*border\s*:[^;]*/gi, "");
19945
+ cellStyle = appendStyleText(cellStyle, noBorder ? "border:1px dashed #ddd;" : "border:1px solid #DDD;");
19946
+ var align = normalizedCell.getAttribute("align");
19947
+ if (align && !/text-align\s*:/.test(cellStyle)) {
19948
+ cellStyle = appendStyleText(cellStyle, "text-align:" + align + ";");
19949
+ }
19950
+ normalizedCell.setAttribute("style", cellStyle);
19951
+ normalizedCell.removeAttribute("class");
19952
+ normalizedCell.removeAttribute("height");
19953
+ });
19954
+ row.removeAttribute("class");
19955
+ });
19956
+ table.removeAttribute("class");
19957
+ });
19958
+ }
19959
+ function getCopiedHtmlContainer() {
19960
+ var rng = me.selection.getRange(),
19961
+ div = document.createElement("div");
19962
+ div.appendChild(rng.cloneContents());
19963
+ normalizeCopiedTables(div);
19964
+ normalizeCopiedCodeBlocks(div);
19965
+ return div;
19966
+ }
19967
+ function handleNativeCopy(evt) {
19968
+ evt = evt || window.event;
19969
+ var clipboardData =
19970
+ evt.clipboardData ||
19971
+ (evt.originalEvent && evt.originalEvent.clipboardData) ||
19972
+ window.clipboardData;
19973
+ if (!clipboardData) return;
19974
+ var div = getCopiedHtmlContainer();
19975
+ try {
19976
+ if (clipboardData.setData) {
19977
+ clipboardData.setData("text/plain", div.innerText || div.textContent || "");
19978
+ clipboardData.setData("text/html", div.innerHTML);
19979
+ evt.preventDefault && evt.preventDefault();
19980
+ evt.returnValue = false;
19981
+ }
19982
+ } catch (error) {}
19983
+ }
19532
19984
 
19533
19985
  function initZeroClipboard() {
19534
19986
  ZeroClipboard.config({
@@ -19543,13 +19995,11 @@ UE.plugin.register("copy", function () {
19543
19995
  // 复制内容
19544
19996
  client.on("copy", function (e) {
19545
19997
  var client = e.client,
19546
- rng = me.selection.getRange(),
19547
- div = document.createElement("div");
19998
+ div = getCopiedHtmlContainer();
19548
19999
 
19549
- div.appendChild(rng.cloneContents());
19550
20000
  client.setText(div.innerText || div.textContent);
19551
20001
  client.setHtml(div.innerHTML);
19552
- rng.select();
20002
+ me.selection.getRange().select();
19553
20003
  });
19554
20004
  // hover事件传递到target
19555
20005
  client.on("mouseover mouseout", function (e) {
@@ -19574,6 +20024,7 @@ UE.plugin.register("copy", function () {
19574
20024
  return {
19575
20025
  bindEvents: {
19576
20026
  ready: function () {
20027
+ domUtils.on(me.body, "copy", handleNativeCopy);
19577
20028
  if (!browser.ie) {
19578
20029
  if (window.ZeroClipboard) {
19579
20030
  initZeroClipboard();
@@ -19608,7 +20059,7 @@ UE.plugin.register("copy", function () {
19608
20059
  };
19609
20060
  });
19610
20061
 
19611
-
20062
+
19612
20063
  // plugins/paste.js
19613
20064
  ///import core
19614
20065
  ///import plugins/inserthtml.js
@@ -19966,7 +20417,7 @@ UE.plugins["paste"] = function () {
19966
20417
  };
19967
20418
  };
19968
20419
 
19969
-
20420
+
19970
20421
  // plugins/puretxtpaste.js
19971
20422
  /**
19972
20423
  * 纯文本粘贴插件
@@ -20078,7 +20529,7 @@ UE.plugins["pasteplain"] = function () {
20078
20529
  };
20079
20530
  };
20080
20531
 
20081
-
20532
+
20082
20533
  // plugins/list.js
20083
20534
  /**
20084
20535
  * 有序列表,无序列表插件
@@ -21526,7 +21977,7 @@ UE.plugins["list"] = function () {
21526
21977
  };
21527
21978
  };
21528
21979
 
21529
-
21980
+
21530
21981
  // plugins/source.js
21531
21982
  /**
21532
21983
  * 源码编辑插件
@@ -21887,7 +22338,7 @@ UE.plugins["list"] = function () {
21887
22338
  };
21888
22339
  })();
21889
22340
 
21890
-
22341
+
21891
22342
  // plugins/enterkey.js
21892
22343
  ///import core
21893
22344
  ///import plugins/undo.js
@@ -22090,7 +22541,7 @@ UE.plugins["enterkey"] = function () {
22090
22541
  });
22091
22542
  };
22092
22543
 
22093
-
22544
+
22094
22545
  // plugins/keystrokes.js
22095
22546
  /* 处理特殊键的兼容性问题 */
22096
22547
  UE.plugins["keystrokes"] = function () {
@@ -22358,7 +22809,7 @@ UE.plugins["keystrokes"] = function () {
22358
22809
  });
22359
22810
  };
22360
22811
 
22361
-
22812
+
22362
22813
  // plugins/fiximgclick.js
22363
22814
  ///import core
22364
22815
  ///commands 修复chrome下图片不能点击的问题,出现八个角可改变大小
@@ -22751,7 +23202,7 @@ UE.plugins["fiximgclick"] = (function () {
22751
23202
  };
22752
23203
  })();
22753
23204
 
22754
-
23205
+
22755
23206
  // plugins/autolink.js
22756
23207
  ///import core
22757
23208
  ///commands 为非ie浏览器自动添加a标签
@@ -22974,7 +23425,7 @@ UE.plugin.register(
22974
23425
  }
22975
23426
  );
22976
23427
 
22977
-
23428
+
22978
23429
  // plugins/autoheight.js
22979
23430
  ///import core
22980
23431
  ///commands 当输入内容超过编辑器高度时,编辑器自动增高
@@ -23104,7 +23555,7 @@ UE.plugins["autoheight"] = function () {
23104
23555
  }
23105
23556
  };
23106
23557
 
23107
-
23558
+
23108
23559
  // plugins/autofloat.js
23109
23560
  ///import core
23110
23561
  ///commands 悬浮工具栏
@@ -23177,7 +23628,9 @@ UE.plugins["autofloat"] = function () {
23177
23628
  "px";
23178
23629
  }
23179
23630
  if (toolbarBox.style.position != "fixed") {
23180
- toolbarBox.style.position = "fixed";
23631
+ toolbarBox.style.position = "";
23632
+ toolbarBox.style.zIndex = "";
23633
+ toolbarBox.style.width = "";
23181
23634
  toolbarBox.style.top = topOffset + "px";
23182
23635
  (origalFloat == "absolute" || origalFloat == "relative") &&
23183
23636
  parseFloat(origalLeft) &&
@@ -23261,7 +23714,7 @@ UE.plugins["autofloat"] = function () {
23261
23714
  });
23262
23715
  };
23263
23716
 
23264
-
23717
+
23265
23718
  // plugins/video.js
23266
23719
  /**
23267
23720
  * video插件, 为UEditor提供视频插入支持
@@ -23287,7 +23740,7 @@ UE.plugins["video"] = function () {
23287
23740
  case 'iframe':
23288
23741
  str = '<iframe class="' + classname + '" ' +
23289
23742
  ' src="' + utils.html(url) + '" width="' + width + '" height="' + height + '"' +
23290
- ' frameborder=0 allowfullscreen>';
23743
+ ' frameborder="0" allowfullscreen></iframe>';
23291
23744
  break;
23292
23745
  case "image":
23293
23746
  str =
@@ -23300,7 +23753,6 @@ UE.plugins["video"] = function () {
23300
23753
  '" _url="' +
23301
23754
  url +
23302
23755
  '" class="' +
23303
- classname +
23304
23756
  '"' +
23305
23757
  ' src="' +
23306
23758
  me.options.UEDITOR_HOME_URL +
@@ -23485,13 +23937,12 @@ UE.plugins["video"] = function () {
23485
23937
  ) {
23486
23938
  var currentVideo = videoObjs[0];
23487
23939
  var currentVideoType = 'iframe';
23488
- var isUploadVideo = currentVideo.url.match(/.mp4$/);
23489
- if (isUploadVideo) {
23490
- currentVideoType = 'image';
23940
+ if (currentVideo.url.match(/.mp4$/)) {
23941
+ currentVideoType = 'video';
23491
23942
  }
23492
- var currentClassName = isUploadVideo
23493
- ? "edui-upload-video"
23494
- : "edui-video-iframe";
23943
+ var currentClassName = currentVideoType == "iframe"
23944
+ ? "edui-video-iframe"
23945
+ : "edui-video-video";
23495
23946
  var currentHtml = creatInsertStr(
23496
23947
  currentVideo.url,
23497
23948
  currentVideo.width || currentNode.width || 420,
@@ -23517,13 +23968,12 @@ UE.plugins["video"] = function () {
23517
23968
  for (var i = 0, vi, len = videoObjs.length; i < len; i++) {
23518
23969
  vi = videoObjs[i];
23519
23970
  var videoType = 'iframe';
23520
- var isUploadVideo = vi.url.match(/.mp4$/);
23521
- if (isUploadVideo) {
23522
- videoType = 'image';
23971
+ if (vi.url.match(/.mp4$/)) {
23972
+ videoType = 'video';
23523
23973
  }
23524
- cl = isUploadVideo
23525
- ? "edui-upload-video"
23526
- : "edui-video-iframe";
23974
+ cl = videoType == "iframe"
23975
+ ? "edui-video-iframe"
23976
+ : "edui-video-video";
23527
23977
  html.push(
23528
23978
  creatInsertStr(
23529
23979
  vi.url,
@@ -23560,7 +24010,7 @@ UE.plugins["video"] = function () {
23560
24010
  };
23561
24011
  };
23562
24012
 
23563
-
24013
+
23564
24014
  // plugins/audio.js
23565
24015
  UE.plugins["audio"] = function () {
23566
24016
  var me = this;
@@ -23658,7 +24108,7 @@ UE.plugins["audio"] = function () {
23658
24108
  };
23659
24109
  };
23660
24110
 
23661
-
24111
+
23662
24112
  // plugins/table.core.js
23663
24113
  /**
23664
24114
  * Created with JetBrains WebStorm.
@@ -25019,7 +25469,7 @@ UE.plugins["audio"] = function () {
25019
25469
  }
25020
25470
  })();
25021
25471
 
25022
-
25472
+
25023
25473
  // plugins/table.cmds.js
25024
25474
  /**
25025
25475
  * Created with JetBrains PhpStorm.
@@ -26070,7 +26520,7 @@ UE.plugins["audio"] = function () {
26070
26520
  }
26071
26521
  })();
26072
26522
 
26073
-
26523
+
26074
26524
  // plugins/table.action.js
26075
26525
  /**
26076
26526
  * Created with JetBrains PhpStorm.
@@ -26200,7 +26650,6 @@ UE.plugins["table"] = function () {
26200
26650
  "td,th{padding: 5px 10px;border: 1px solid #DDD;}" +
26201
26651
  "caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}" +
26202
26652
  "th{border-top:1px solid #BBB;background-color:#F7F7F7;}" +
26203
- "table tr.firstRow th{border-top-width:2px;}" +
26204
26653
  ".ue-table-interlace-color-single{ background-color: #fcfcfc; } .ue-table-interlace-color-double{ background-color: #f7faff; }" +
26205
26654
  "td p{margin:0;padding:0;}",
26206
26655
  me.document
@@ -28099,7 +28548,7 @@ UE.plugins["table"] = function () {
28099
28548
  }
28100
28549
  };
28101
28550
 
28102
-
28551
+
28103
28552
  // plugins/table.sort.js
28104
28553
  /**
28105
28554
  * Created with JetBrains PhpStorm.
@@ -28304,7 +28753,7 @@ UE.plugins["tablesort"] = function () {
28304
28753
  };
28305
28754
  };
28306
28755
 
28307
-
28756
+
28308
28757
  // plugins/contextmenu.js
28309
28758
  ///import core
28310
28759
  ///commands 右键菜单
@@ -28842,7 +29291,7 @@ UE.plugins["contextmenu"] = function () {
28842
29291
  });
28843
29292
  };
28844
29293
 
28845
-
29294
+
28846
29295
  // plugins/shortcutmenu.js
28847
29296
  ///import core
28848
29297
  ///commands 弹出菜单
@@ -28884,7 +29333,6 @@ UE.plugins["shortcutmenu"] = function () {
28884
29333
  me._activeVideoTarget = mediaTarget;
28885
29334
  me.selection.getRange().selectNode(mediaTarget).select(true);
28886
29335
  }
28887
- // console.log(e, me.selection.getRange());
28888
29336
  // var rng = me.selection.getRange();
28889
29337
  // if (rng.collapsed) {
28890
29338
  // return;
@@ -28933,7 +29381,7 @@ UE.plugins["shortcutmenu"] = function () {
28933
29381
  });
28934
29382
  };
28935
29383
 
28936
-
29384
+
28937
29385
  // plugins/basestyle.js
28938
29386
  /**
28939
29387
  * B、I、sub、super命令支持
@@ -29088,7 +29536,7 @@ UE.plugins["basestyle"] = function () {
29088
29536
  }
29089
29537
  };
29090
29538
 
29091
-
29539
+
29092
29540
  // plugins/elementpath.js
29093
29541
  /**
29094
29542
  * 选取路径命令
@@ -29133,7 +29581,7 @@ UE.plugins["elementpath"] = function () {
29133
29581
  };
29134
29582
  };
29135
29583
 
29136
-
29584
+
29137
29585
  // plugins/formatmatch.js
29138
29586
  /**
29139
29587
  * 格式刷,只格式inline的
@@ -29263,7 +29711,7 @@ UE.plugins["formatmatch"] = function () {
29263
29711
  };
29264
29712
  };
29265
29713
 
29266
-
29714
+
29267
29715
  // plugins/searchreplace.js
29268
29716
  ///import core
29269
29717
  ///commands 查找替换
@@ -29508,7 +29956,7 @@ UE.plugin.register("searchreplace", function () {
29508
29956
  };
29509
29957
  });
29510
29958
 
29511
-
29959
+
29512
29960
  // plugins/customstyle.js
29513
29961
  /**
29514
29962
  * 自定义样式
@@ -29692,7 +30140,7 @@ UE.plugins["customstyle"] = function () {
29692
30140
  });
29693
30141
  };
29694
30142
 
29695
-
30143
+
29696
30144
  // plugins/catchremoteimage.js
29697
30145
  ///import core
29698
30146
  ///commands 远程图片抓取
@@ -29901,7 +30349,7 @@ UE.plugins["catchremoteimage"] = function () {
29901
30349
  });
29902
30350
  };
29903
30351
 
29904
-
30352
+
29905
30353
  // plugins/insertparagraph.js
29906
30354
  /**
29907
30355
  * 插入段落
@@ -29947,7 +30395,7 @@ UE.commands["insertparagraph"] = {
29947
30395
  }
29948
30396
  };
29949
30397
 
29950
-
30398
+
29951
30399
  // plugins/template.js
29952
30400
  ///import core
29953
30401
  ///import plugins\inserthtml.js
@@ -29997,7 +30445,7 @@ UE.plugins["template"] = function () {
29997
30445
  });
29998
30446
  };
29999
30447
 
30000
-
30448
+
30001
30449
  // plugins/autoupload.js
30002
30450
  /**
30003
30451
  * @description
@@ -30283,7 +30731,7 @@ UE.plugin.register("autoupload", function () {
30283
30731
  };
30284
30732
  });
30285
30733
 
30286
-
30734
+
30287
30735
  // plugins/section.js
30288
30736
  /**
30289
30737
  * 目录大纲支持插件
@@ -30595,7 +31043,7 @@ UE.plugin.register("section", function () {
30595
31043
  };
30596
31044
  });
30597
31045
 
30598
-
31046
+
30599
31047
  // plugins/simpleupload.js
30600
31048
  /**
30601
31049
  * @description
@@ -30787,7 +31235,7 @@ UE.plugin.register("simpleupload", function () {
30787
31235
  };
30788
31236
  });
30789
31237
 
30790
-
31238
+
30791
31239
  // plugins/serverparam.js
30792
31240
  /**
30793
31241
  * 服务器提交的额外参数列表设置插件
@@ -30900,7 +31348,7 @@ UE.plugin.register("serverparam", function () {
30900
31348
  };
30901
31349
  });
30902
31350
 
30903
-
31351
+
30904
31352
  // plugins/insertfile.js
30905
31353
  /**
30906
31354
  * 插入附件
@@ -30989,7 +31437,7 @@ UE.plugin.register("insertfile", function () {
30989
31437
  };
30990
31438
  });
30991
31439
 
30992
-
31440
+
30993
31441
  // plugins/markdown-shortcut.js
30994
31442
  UE.plugins["markdown-shortcut"] = function () {
30995
31443
 
@@ -31073,7 +31521,7 @@ UE.plugins["markdown-shortcut"] = function () {
31073
31521
 
31074
31522
  };
31075
31523
 
31076
-
31524
+
31077
31525
  // plugins/quick-operate.js
31078
31526
  UE.plugins["quick-operate"] = function () {
31079
31527
 
@@ -31131,13 +31579,13 @@ UE.plugins["quick-operate"] = function () {
31131
31579
 
31132
31580
  };
31133
31581
 
31134
-
31582
+
31135
31583
  // ui/ui.js
31136
- var baidu = baidu || {};
31137
- baidu.editor = baidu.editor || {};
31138
- UE.ui = baidu.editor.ui = {};
31584
+ var baidu = baidu || {};
31585
+ baidu.editor = baidu.editor || {};
31586
+ UE.ui = baidu.editor.ui = {};
31587
+
31139
31588
 
31140
-
31141
31589
  // ui/uiutils.js
31142
31590
  (function () {
31143
31591
  var browser = baidu.editor.browser,
@@ -31421,7 +31869,7 @@ UE.ui = baidu.editor.ui = {};
31421
31869
  }
31422
31870
  })();
31423
31871
 
31424
-
31872
+
31425
31873
  // ui/uibase.js
31426
31874
  (function () {
31427
31875
  var utils = baidu.editor.utils,
@@ -31528,7 +31976,7 @@ UE.ui = baidu.editor.ui = {};
31528
31976
  utils.inherits(UIBase, EventBase);
31529
31977
  })();
31530
31978
 
31531
-
31979
+
31532
31980
  // ui/separator.js
31533
31981
  (function () {
31534
31982
  var utils = baidu.editor.utils,
@@ -31549,7 +31997,7 @@ UE.ui = baidu.editor.ui = {};
31549
31997
  utils.inherits(Separator, UIBase);
31550
31998
  })();
31551
31999
 
31552
-
32000
+
31553
32001
  // ui/mask.js
31554
32002
  ///import core
31555
32003
  ///import uicore
@@ -31605,7 +32053,7 @@ UE.ui = baidu.editor.ui = {};
31605
32053
  utils.inherits(Mask, UIBase);
31606
32054
  })();
31607
32055
 
31608
-
32056
+
31609
32057
  // ui/popup.js
31610
32058
  ///import core
31611
32059
  ///import uicore
@@ -31875,7 +32323,7 @@ UE.ui = baidu.editor.ui = {};
31875
32323
  });
31876
32324
  })();
31877
32325
 
31878
-
32326
+
31879
32327
  // ui/colorpicker.js
31880
32328
  ///import core
31881
32329
  ///import uicore
@@ -31980,7 +32428,7 @@ UE.ui = baidu.editor.ui = {};
31980
32428
  }
31981
32429
  })();
31982
32430
 
31983
-
32431
+
31984
32432
  // ui/tablepicker.js
31985
32433
  ///import core
31986
32434
  ///import uicore
@@ -32085,7 +32533,7 @@ UE.ui = baidu.editor.ui = {};
32085
32533
  utils.inherits(TablePicker, UIBase);
32086
32534
  })();
32087
32535
 
32088
-
32536
+
32089
32537
  // ui/stateful.js
32090
32538
  (function () {
32091
32539
  var browser = baidu.editor.browser,
@@ -32198,7 +32646,7 @@ UE.ui = baidu.editor.ui = {};
32198
32646
  };
32199
32647
  })();
32200
32648
 
32201
-
32649
+
32202
32650
  // ui/button.js
32203
32651
  ///import core
32204
32652
  ///import uicore
@@ -32281,7 +32729,7 @@ UE.ui = baidu.editor.ui = {};
32281
32729
  utils.extend(Button.prototype, Stateful);
32282
32730
  })();
32283
32731
 
32284
-
32732
+
32285
32733
  // ui/splitbutton.js
32286
32734
  ///import core
32287
32735
  ///import uicore
@@ -32383,7 +32831,7 @@ UE.ui = baidu.editor.ui = {};
32383
32831
  utils.extend(SplitButton.prototype, Stateful, true);
32384
32832
  })();
32385
32833
 
32386
-
32834
+
32387
32835
  // ui/colorbutton.js
32388
32836
  ///import core
32389
32837
  ///import uicore
@@ -32447,7 +32895,7 @@ UE.ui = baidu.editor.ui = {};
32447
32895
  utils.inherits(ColorButton, SplitButton);
32448
32896
  })();
32449
32897
 
32450
-
32898
+
32451
32899
  // ui/tablebutton.js
32452
32900
  ///import core
32453
32901
  ///import uicore
@@ -32486,7 +32934,7 @@ UE.ui = baidu.editor.ui = {};
32486
32934
  utils.inherits(TableButton, SplitButton);
32487
32935
  })();
32488
32936
 
32489
-
32937
+
32490
32938
  // ui/autotypesetpicker.js
32491
32939
  ///import core
32492
32940
  ///import uicore
@@ -32659,7 +33107,7 @@ UE.ui = baidu.editor.ui = {};
32659
33107
  utils.inherits(AutoTypeSetPicker, UIBase);
32660
33108
  })();
32661
33109
 
32662
-
33110
+
32663
33111
  // ui/autotypesetbutton.js
32664
33112
  ///import core
32665
33113
  ///import uicore
@@ -32813,7 +33261,7 @@ UE.ui = baidu.editor.ui = {};
32813
33261
  utils.inherits(AutoTypeSetButton, SplitButton);
32814
33262
  })();
32815
33263
 
32816
-
33264
+
32817
33265
  // ui/cellalignpicker.js
32818
33266
  ///import core
32819
33267
  ///import uicore
@@ -32915,7 +33363,7 @@ UE.ui = baidu.editor.ui = {};
32915
33363
  utils.extend(CellAlignPicker.prototype, Stateful, true);
32916
33364
  })();
32917
33365
 
32918
-
33366
+
32919
33367
  // ui/pastepicker.js
32920
33368
  ///import core
32921
33369
  ///import uicore
@@ -32989,7 +33437,7 @@ UE.ui = baidu.editor.ui = {};
32989
33437
  utils.extend(PastePicker.prototype, Stateful, true);
32990
33438
  })();
32991
33439
 
32992
-
33440
+
32993
33441
  // ui/toolbar.js
32994
33442
  (function () {
32995
33443
  var utils = baidu.editor.utils,
@@ -33041,7 +33489,7 @@ UE.ui = baidu.editor.ui = {};
33041
33489
  utils.inherits(Toolbar, UIBase);
33042
33490
  })();
33043
33491
 
33044
-
33492
+
33045
33493
  // ui/quick-operate.js
33046
33494
  ///import core
33047
33495
  ///import uicore
@@ -33337,7 +33785,7 @@ UE.ui = baidu.editor.ui = {};
33337
33785
  // utils.extend(MenuItem.prototype, Stateful, true);
33338
33786
  })();
33339
33787
 
33340
-
33788
+
33341
33789
  // ui/menu.js
33342
33790
  ///import core
33343
33791
  ///import uicore
@@ -33621,7 +34069,7 @@ UE.ui = baidu.editor.ui = {};
33621
34069
  utils.extend(MenuItem.prototype, Stateful, true);
33622
34070
  })();
33623
34071
 
33624
-
34072
+
33625
34073
  // ui/combox.js
33626
34074
  ///import core
33627
34075
  ///import uicore
@@ -33723,7 +34171,7 @@ UE.ui = baidu.editor.ui = {};
33723
34171
  utils.inherits(Combox, SplitButton);
33724
34172
  })();
33725
34173
 
33726
-
34174
+
33727
34175
  // ui/dialog.js
33728
34176
  ///import core
33729
34177
  ///import uicore
@@ -34216,7 +34664,7 @@ UE.ui = baidu.editor.ui = {};
34216
34664
  utils.inherits(Dialog, UIBase);
34217
34665
  })();
34218
34666
 
34219
-
34667
+
34220
34668
  // ui/menubutton.js
34221
34669
  ///import core
34222
34670
  ///import uicore
@@ -34258,7 +34706,7 @@ UE.ui = baidu.editor.ui = {};
34258
34706
  utils.inherits(MenuButton, SplitButton);
34259
34707
  })();
34260
34708
 
34261
-
34709
+
34262
34710
  // ui/multiMenu.js
34263
34711
  ///import core
34264
34712
  ///import uicore
@@ -34306,7 +34754,7 @@ UE.ui = baidu.editor.ui = {};
34306
34754
  utils.inherits(MultiMenuPop, SplitButton);
34307
34755
  })();
34308
34756
 
34309
-
34757
+
34310
34758
  // ui/shortcutmenu.js
34311
34759
  (function () {
34312
34760
  var UI = baidu.editor.ui,
@@ -34576,7 +35024,7 @@ UE.ui = baidu.editor.ui = {};
34576
35024
  });
34577
35025
  })();
34578
35026
 
34579
-
35027
+
34580
35028
  // ui/breakline.js
34581
35029
  (function () {
34582
35030
  var utils = baidu.editor.utils,
@@ -34597,7 +35045,7 @@ UE.ui = baidu.editor.ui = {};
34597
35045
  utils.inherits(Breakline, UIBase);
34598
35046
  })();
34599
35047
 
34600
-
35048
+
34601
35049
  // ui/message.js
34602
35050
  ///import core
34603
35051
  ///import uicore
@@ -34682,7 +35130,7 @@ UE.ui = baidu.editor.ui = {};
34682
35130
  utils.inherits(Message, UIBase);
34683
35131
  })();
34684
35132
 
34685
-
35133
+
34686
35134
  // adapter/editorui.js
34687
35135
  //ui跟编辑器的适配層
34688
35136
  //那个按钮弹出是dialog,是下拉筐等都是在这个js中配置
@@ -34954,28 +35402,28 @@ UE.ui = baidu.editor.ui = {};
34954
35402
  }
34955
35403
 
34956
35404
  var dialogIframeUrlMap = {
34957
- anchor: "~/dialogs/anchor/anchor.html?{timestamp}",
34958
- insertimage: "~/dialogs/image/image.html?{timestamp}",
34959
- link: "~/dialogs/link/link.html?{timestamp}",
34960
- spechars: "~/dialogs/spechars/spechars.html?{timestamp}",
34961
- searchreplace: "~/dialogs/searchreplace/searchreplace.html?{timestamp}",
34962
- insertvideo: "~/dialogs/video/video.html?{timestamp}",
34963
- insertaudio: "~/dialogs/audio/audio.html?{timestamp}",
34964
- help: "~/dialogs/help/help.html?{timestamp}",
34965
- preview: "~/dialogs/preview/preview.html?{timestamp}",
34966
- emotion: "~/dialogs/emotion/emotion.html?{timestamp}",
34967
- wordimage: "~/dialogs/wordimage/wordimage.html?{timestamp}",
34968
- formula: "~/dialogs/formula/formula.html?{timestamp}",
34969
- attachment: "~/dialogs/attachment/attachment.html?{timestamp}",
34970
- insertframe: "~/dialogs/insertframe/insertframe.html?{timestamp}",
34971
- edittip: "~/dialogs/table/edittip.html?{timestamp}",
34972
- edittable: "~/dialogs/table/edittable.html?{timestamp}",
34973
- edittd: "~/dialogs/table/edittd.html?{timestamp}",
34974
- scrawl: "~/dialogs/scrawl/scrawl.html?{timestamp}",
34975
- template: "~/dialogs/template/template.html?{timestamp}",
34976
- background: "~/dialogs/background/background.html?{timestamp}",
34977
- contentimport: "~/dialogs/contentimport/contentimport.html?{timestamp}",
34978
- ai: "~/dialogs/ai/ai.html?{timestamp}",
35405
+ anchor: "~/dialogs/anchor/anchor.html?eb9739cc",
35406
+ insertimage: "~/dialogs/image/image.html?afbedf05",
35407
+ link: "~/dialogs/link/link.html?fa72bcd7",
35408
+ spechars: "~/dialogs/spechars/spechars.html?3b88f009",
35409
+ searchreplace: "~/dialogs/searchreplace/searchreplace.html?3167e75a",
35410
+ insertvideo: "~/dialogs/video/video.html?c2c9fa02",
35411
+ insertaudio: "~/dialogs/audio/audio.html?47891a09",
35412
+ help: "~/dialogs/help/help.html?4bb38d19",
35413
+ preview: "~/dialogs/preview/preview.html?b533ff4e",
35414
+ emotion: "~/dialogs/emotion/emotion.html?c5e06473",
35415
+ wordimage: "~/dialogs/wordimage/wordimage.html?6c25c600",
35416
+ formula: "~/dialogs/formula/formula.html?a3bc14af",
35417
+ attachment: "~/dialogs/attachment/attachment.html?8cf1bb27",
35418
+ insertframe: "~/dialogs/insertframe/insertframe.html?9353d50c",
35419
+ edittip: "~/dialogs/table/edittip.html?7f922949",
35420
+ edittable: "~/dialogs/table/edittable.html?c2a698ec",
35421
+ edittd: "~/dialogs/table/edittd.html?e110da33",
35422
+ scrawl: "~/dialogs/scrawl/scrawl.html?185f463e",
35423
+ template: "~/dialogs/template/template.html?4ec66ee4",
35424
+ background: "~/dialogs/background/background.html?63701ca2",
35425
+ contentimport: "~/dialogs/contentimport/contentimport.html?96da835f",
35426
+ ai: "~/dialogs/ai/ai.html?86145ec2",
34979
35427
  };
34980
35428
  var dialogBtns = {
34981
35429
  noOk: ["searchreplace", "help", "spechars", "preview"],
@@ -35133,14 +35581,10 @@ UE.ui = baidu.editor.ui = {};
35133
35581
  return (
35134
35582
  activeNode.tagName === "VIDEO" ||
35135
35583
  activeNode.tagName === "IFRAME" ||
35136
- activeNode.className == "edui-faked-video" ||
35137
- activeNode.className.indexOf("edui-faked-video") != -1 ||
35138
- activeNode.className == "edui-upload-video" ||
35139
- activeNode.className.indexOf("edui-upload-video") != -1 ||
35140
- activeNode.className == "edui-video-iframe" ||
35141
- activeNode.className.indexOf("edui-video-iframe") != -1 ||
35142
- activeNode.className == "edui-video-video" ||
35143
- activeNode.className.indexOf("edui-video-video") != -1
35584
+ activeNode.className.indexOf("edui-video-iframe") !== -1 ||
35585
+ activeNode.className.indexOf("edui-video-video") !== -1 ||
35586
+ activeNode.className.indexOf("edui-faked-video") !== -1 ||
35587
+ activeNode.className.indexOf("edui-upload-video") !== -1
35144
35588
  );
35145
35589
  }
35146
35590
  return false;
@@ -35174,6 +35618,45 @@ UE.ui = baidu.editor.ui = {};
35174
35618
  editor.options.labelMap["insertcode"] ||
35175
35619
  editor.getLang("labelMap.insertcode") ||
35176
35620
  "";
35621
+ var normalizeInsertCodeUiLanguage = function (lang) {
35622
+ if (!lang) return "";
35623
+ lang = (lang + "").toLowerCase();
35624
+ var aliasMap = {
35625
+ javascript: "js",
35626
+ jscript: "js",
35627
+ shell: "bash",
35628
+ sh: "bash",
35629
+ powershell: "ps",
35630
+ csharp: "c#",
35631
+ plaintext: "plain",
35632
+ text: "plain",
35633
+ txt: "plain"
35634
+ };
35635
+ return aliasMap[lang] || lang;
35636
+ };
35637
+ var getInsertCodeUiLanguage = function () {
35638
+ var range = editor.selection && editor.selection.getRange
35639
+ ? editor.selection.getRange()
35640
+ : null;
35641
+ var startContainer = range && range.startContainer;
35642
+ var codeNode = domUtils.findParentByTagName(startContainer, "code", true);
35643
+ var preNode = domUtils.findParentByTagName(startContainer, "pre", true);
35644
+ var readLang = function (node) {
35645
+ if (!node) return "";
35646
+ var dataLang = node.getAttribute ? node.getAttribute("data-code-lang") : "";
35647
+ if (dataLang) {
35648
+ return normalizeInsertCodeUiLanguage(dataLang);
35649
+ }
35650
+ var className = node.className || "";
35651
+ var match = (className + "").match(/(?:^|\s)language-([^\s]+)/);
35652
+ if (match && match[1]) {
35653
+ return normalizeInsertCodeUiLanguage(match[1]);
35654
+ }
35655
+ match = (className + "").match(/brush:([^;]+)/);
35656
+ return match && match[1] ? normalizeInsertCodeUiLanguage(match[1]) : "";
35657
+ };
35658
+ return readLang(codeNode) || readLang(preNode);
35659
+ };
35177
35660
  // if (!list.length) return;
35178
35661
  var items = [];
35179
35662
  utils.each(list, function (key, val) {
@@ -35219,7 +35702,8 @@ UE.ui = baidu.editor.ui = {};
35219
35702
  ui.setDisabled(true);
35220
35703
  } else {
35221
35704
  ui.setDisabled(false);
35222
- var value = editor.queryCommandValue("insertcode");
35705
+ var value =
35706
+ getInsertCodeUiLanguage() || editor.queryCommandValue("insertcode");
35223
35707
  if (!value) {
35224
35708
  ui.setValue(title);
35225
35709
  return;
@@ -35793,7 +36277,7 @@ UE.ui = baidu.editor.ui = {};
35793
36277
 
35794
36278
  })();
35795
36279
 
35796
-
36280
+
35797
36281
  // adapter/editor.js
35798
36282
  ///import core
35799
36283
  ///commands 全屏
@@ -36674,7 +37158,7 @@ UE.ui = baidu.editor.ui = {};
36674
37158
  editor.options.editor = editor;
36675
37159
  utils.loadFile(document, {
36676
37160
  href:
36677
- editor.options.themePath + editor.options.theme + "/css/ueditor.css?{timestamp:dist/themes/default/css/ueditor.css}",
37161
+ editor.options.themePath + editor.options.theme + "/css/ueditor.css?dfa5e8ae",
36678
37162
  tag: "link",
36679
37163
  type: "text/css",
36680
37164
  rel: "stylesheet"
@@ -36824,7 +37308,7 @@ UE.ui = baidu.editor.ui = {};
36824
37308
  };
36825
37309
  })();
36826
37310
 
36827
-
37311
+
36828
37312
  // adapter/message.js
36829
37313
  UE.registerUI("message", function (editor) {
36830
37314
  var editorui = baidu.editor.ui;
@@ -36894,6 +37378,11 @@ UE.registerUI("message", function (editor) {
36894
37378
  }
36895
37379
  });
36896
37380
 
36897
-
36898
-
36899
- })();
37381
+
37382
+
37383
+ })();
37384
+
37385
+
37386
+
37387
+
37388
+