@@ -17,7 +17,19 @@ window.UE = baidu.editor = {
1717 instants: {},
1818 I18N: {},
1919 _customizeUI: {},
20- version: "4.2.0-beta",
20+ version: "4.2.0",
21+ plus: {
22+ fileExt: function (filename) {
23+ if (!filename) {
24+ return '';
25+ }
26+ var pcs = filename.split('.');
27+ if (pcs.length > 1) {
28+ return pcs.pop().toLowerCase();
29+ }
30+ return '';
31+ }
32+ },
2133 constants: {
2234 STATEFUL: {
2335 DISABLED: -1,
@@ -15931,8 +15943,8 @@ UE.plugins["font"] = function () {
1593115943 me.setOpt({
1593215944 fontfamily: [
1593315945 {name: "default", val: "default"},
15934- {name: "songti", val: "宋体, SimSun"},
15935- {name: "yahei", val: "微软雅黑, Microsoft YaHei"},
15946+ {name: "songti", val: "SimSun"},
15947+ {name: "yahei", val: "' Microsoft YaHei' "},
1593615948 {name: "kaiti", val: "楷体,楷体_GB2312,SimKai"},
1593715949 {name: "heiti", val: "黑体,SimHei"},
1593815950 {name: "lishu", val: "隶书,SimLi"},
@@ -16043,6 +16055,13 @@ UE.plugins["font"] = function () {
1604316055 }
1604416056 }
1604516057
16058+ var father = span.parentElement;
16059+ try {
16060+ if(father.style.textIndent && span.style.fontSize !== father.style.fontSize){
16061+ father.style.fontSize = span.style.fontSize
16062+ }
16063+ } catch (error) {
16064+ }
1604616065 mergeWithParent(span);
1604716066 if (browser.ie && browser.version > 8) {
1604816067 //拷贝父亲们的特别的属性,这里只做背景颜色的处理
@@ -17075,7 +17094,18 @@ UE.commands["indent"] = {
1707517094 value = me.queryCommandState("indent")
1707617095 ? "0em"
1707717096 : me.options.indentValue || "2em";
17078- me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
17097+ // 首行缩进不准确
17098+ // https://gitee.com/modstart-lib/ueditor-plus/issues/IAW75Z
17099+ var pN = domUtils.filterNodeList(
17100+ this.selection.getStartElementPath(),
17101+ "p h1 h2 h3 h4 h5 h6"
17102+ )
17103+ try {
17104+ me.execCommand("Paragraph", "p", {style: "text-indent:" + value + ';font-size:' + pN.firstChild.style.fontSize});
17105+ } catch (error) {
17106+ me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
17107+ }
17108+ // me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
1707917109 },
1708017110 queryCommandState: function () {
1708117111 var pN = domUtils.filterNodeList(
@@ -29084,12 +29114,15 @@ UE.plugins["formatmatch"] = function () {
2908429114 }
2908529115
2908629116 me.undoManger && me.undoManger.save();
29087- me.removeListener("mouseup", addList);
29088- flag = 0;
29117+
29118+ // 新增:格式化默认使用连续格式模式,支持快速格式化
29119+ // me.removeListener("mouseup", addList);
29120+ // flag = 0;
2908929121 }
2909029122
2909129123 me.commands["formatmatch"] = {
2909229124 execCommand: function (cmdName) {
29125+
2909329126 if (flag) {
2909429127 flag = 0;
2909529128 list = [];
@@ -29880,6 +29913,7 @@ UE.plugin.register("autoupload", function () {
2988029913 errorHandler,
2988129914 successHandler,
2988229915 filetype = /image\/\w+/i.test(file.type) ? "image" : "file",
29916+ fileExt = UE.plus.fileExt(file.name),
2988329917 loadingId = "loading_" + (+new Date()).toString(36);
2988429918
2988529919 fieldName = me.getOpt(filetype + "FieldName");
@@ -29994,7 +30028,7 @@ UE.plugin.register("autoupload", function () {
2999430028 var imageCompressEnable = me.getOpt('imageCompressEnable'),
2999530029 imageMaxSize = me.getOpt('imageMaxSize'),
2999630030 imageCompressBorder = me.getOpt('imageCompressBorder');
29997- if ('image' === filetype && imageCompressEnable) {
30031+ if ('image' === filetype && imageCompressEnable && ['jpg', 'jpeg', 'png'].includes(fileExt) ) {
2999830032 UE.image.compress(file, {
2999930033 maxSizeMB: imageMaxSize / 1024 / 1024,
3000030034 maxWidthOrHeight: imageCompressBorder
@@ -30568,11 +30602,12 @@ UE.plugin.register("simpleupload", function () {
3056830602 });
3056930603 };
3057030604 var file = input.files[0];
30605+ var fileExt = UE.plus.fileExt(file.name);
3057130606 // console.log('file',file);
3057230607 var imageCompressEnable = me.getOpt('imageCompressEnable'),
3057330608 imageMaxSize = me.getOpt('imageMaxSize'),
3057430609 imageCompressBorder = me.getOpt('imageCompressBorder');
30575- if (imageCompressEnable) {
30610+ if (imageCompressEnable && ['jpg', 'jpeg', 'png'].includes(fileExt) ) {
3057630611 UE.image.compress(file, {
3057730612 maxSizeMB: imageMaxSize / 1024 / 1024,
3057830613 maxWidthOrHeight: imageCompressBorder
@@ -34803,18 +34838,18 @@ UE.ui = baidu.editor.ui = {};
3480334838
3480434839 var dialogIframeUrlMap = {
3480534840 anchor: "~/dialogs/anchor/anchor.html?2f10d082",
34806- insertimage: "~/dialogs/image/image.html?4bce17a0 ",
34841+ insertimage: "~/dialogs/image/image.html?c97f781f ",
3480734842 link: "~/dialogs/link/link.html?ccbfcf18",
3480834843 spechars: "~/dialogs/spechars/spechars.html?3bbeb696",
3480934844 searchreplace: "~/dialogs/searchreplace/searchreplace.html?2cb782d2",
34810- insertvideo: "~/dialogs/video/video.html?7fde01cd ",
34811- insertaudio: "~/dialogs/audio/audio.html?d264cea1 ",
34845+ insertvideo: "~/dialogs/video/video.html?274637a8 ",
34846+ insertaudio: "~/dialogs/audio/audio.html?a8aea994 ",
3481234847 help: "~/dialogs/help/help.html?05c0c8bf",
3481334848 preview: "~/dialogs/preview/preview.html?5d9a0847",
3481434849 emotion: "~/dialogs/emotion/emotion.html?a7bc0989",
34815- wordimage: "~/dialogs/wordimage/wordimage.html?11da452e ",
34850+ wordimage: "~/dialogs/wordimage/wordimage.html?b4682ace ",
3481634851 formula: "~/dialogs/formula/formula.html?9a5a1511",
34817- attachment: "~/dialogs/attachment/attachment.html?d632fa7c ",
34852+ attachment: "~/dialogs/attachment/attachment.html?7462f395 ",
3481834853 insertframe: "~/dialogs/insertframe/insertframe.html?807119a5",
3481934854 edittip: "~/dialogs/table/edittip.html?fa0ea189",
3482034855 edittable: "~/dialogs/table/edittable.html?134e2f06",
@@ -36426,7 +36461,7 @@ UE.ui = baidu.editor.ui = {};
3642636461 editor.options.editor = editor;
3642736462 utils.loadFile(document, {
3642836463 href:
36429- editor.options.themePath + editor.options.theme + "/css/ueditor.css?69e258a4 ",
36464+ editor.options.themePath + editor.options.theme + "/css/ueditor.css?cac11a93 ",
3643036465 tag: "link",
3643136466 type: "text/css",
3643236467 rel: "stylesheet"
0 commit comments