Skip to content

Commit 7d91ce6

Browse files
author
git
committed
修复:首行缩进不准确问题,设置字体后首行缩进不准确问题
1 parent e4348e7 commit 7d91ce6

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

_src/plugins/font.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ UE.plugins["font"] = function () {
263263
}
264264
}
265265

266+
var father = span.parentElement;
267+
try {
268+
if(father.style.textIndent && span.style.fontSize !== father.style.fontSize){
269+
father.style.fontSize = span.style.fontSize
270+
}
271+
} catch (error) {
272+
}
266273
mergeWithParent(span);
267274
if (browser.ie && browser.version > 8) {
268275
//拷贝父亲们的特别的属性,这里只做背景颜色的处理

_src/plugins/indent.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ UE.commands["indent"] = {
2020
value = me.queryCommandState("indent")
2121
? "0em"
2222
: me.options.indentValue || "2em";
23-
me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
23+
// 首行缩进不准确
24+
// https://gitee.com/modstart-lib/ueditor-plus/issues/IAW75Z
25+
var pN = domUtils.filterNodeList(
26+
this.selection.getStartElementPath(),
27+
"p h1 h2 h3 h4 h5 h6"
28+
)
29+
try {
30+
me.execCommand("Paragraph", "p", {style: "text-indent:" + value + ';font-size:' + pN.firstChild.style.fontSize});
31+
} catch (error) {
32+
me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
33+
}
34+
// me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
2435
},
2536
queryCommandState: function () {
2637
var pN = domUtils.filterNodeList(

0 commit comments

Comments
 (0)