Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

多行文字,修改字号,加粗,再修改字号,只有第一行文字会改变 #3222

Open
wants to merge 2 commits into
base: dev-1.5.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions _src/plugins/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,28 +185,35 @@ UE.plugins["font"] = function() {
if (needSetChild[cmdName]) {
rng.adjustmentBoundary();
if (!rng.collapsed && rng.startContainer.nodeType == 1) {
var start = rng.startContainer.childNodes[rng.startOffset];
if (start && domUtils.isTagNode(start, "span")) {
var bk = rng.createBookmark();
utils.each(domUtils.getElementsByTagName(start, "span"), function(
span
) {
if (!span.parentNode || domUtils.isBookmarkNode(span)) return;
if (
cmdName == "backcolor" &&
domUtils
.getComputedStyle(span, "background-color")
.toLowerCase() === value
rng.traversal(function(node){
var start;
if(domUtils.isTagNode(node,'span')){
start = node;
}else{
start = domUtils.getElementsByTagName(node,'span')[0];
}
if (start && domUtils.isTagNode(start, "span")) {
var bk = rng.createBookmark();
utils.each(domUtils.getElementsByTagName(start, "span"), function(
span
) {
return;
}
domUtils.removeStyle(span, needSetChild[cmdName]);
if (span.style.cssText.replace(/^\s+$/, "").length == 0) {
domUtils.remove(span, true);
}
});
rng.moveToBookmark(bk);
if (!span.parentNode || domUtils.isBookmarkNode(span)) return;
if (
cmdName == "backcolor" &&
domUtils
.getComputedStyle(span, "background-color")
.toLowerCase() === value
) {
return;
}
domUtils.removeStyle(span, needSetChild[cmdName]);
if (span.style.cssText.replace(/^\s+$/, "").length == 0) {
domUtils.remove(span, true);
}
});
rng.moveToBookmark(bk);
}
});
}
}
}
Expand Down