Skip to content

Commit

Permalink
修复:首行缩进不准确问题,设置字体后首行缩进不准确问题
Browse files Browse the repository at this point in the history
  • Loading branch information
git committed Dec 16, 2024
1 parent e4348e7 commit 7d91ce6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions _src/plugins/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ UE.plugins["font"] = function () {
}
}

var father = span.parentElement;
try {
if(father.style.textIndent && span.style.fontSize !== father.style.fontSize){
father.style.fontSize = span.style.fontSize
}
} catch (error) {
}
mergeWithParent(span);
if (browser.ie && browser.version > 8) {
//拷贝父亲们的特别的属性,这里只做背景颜色的处理
Expand Down
13 changes: 12 additions & 1 deletion _src/plugins/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ UE.commands["indent"] = {
value = me.queryCommandState("indent")
? "0em"
: me.options.indentValue || "2em";
me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
// 首行缩进不准确
// https://gitee.com/modstart-lib/ueditor-plus/issues/IAW75Z
var pN = domUtils.filterNodeList(
this.selection.getStartElementPath(),
"p h1 h2 h3 h4 h5 h6"
)
try {
me.execCommand("Paragraph", "p", {style: "text-indent:" + value + ';font-size:' + pN.firstChild.style.fontSize});
} catch (error) {
me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
}
// me.execCommand("Paragraph", "p", {style: "text-indent:" + value});
},
queryCommandState: function () {
var pN = domUtils.filterNodeList(
Expand Down

0 comments on commit 7d91ce6

Please sign in to comment.