fix: 协同下懒加载报错问题
This commit is contained in:
parent
bf181d4772
commit
8bbb9d0dc4
|
@ -539,11 +539,7 @@ class Producer extends EventEmitter2 {
|
|||
},
|
||||
);
|
||||
// 没有这个卡片节点,或者卡片内部已经渲染了才需要过滤
|
||||
if (
|
||||
result &&
|
||||
!result.rendered &&
|
||||
cardElement.attributes(CARD_LOADING_KEY) !== 'remote'
|
||||
) {
|
||||
if (result && !result.rendered) {
|
||||
isTransient = false;
|
||||
record['nl'] = true;
|
||||
} else {
|
||||
|
|
|
@ -71,17 +71,27 @@ class RangeColoring implements RangeColoringInterface {
|
|||
range: RangeInterface,
|
||||
style: DrawStyle,
|
||||
) {
|
||||
let startOffset = range.startOffset;
|
||||
while (startOffset < range.endOffset) {
|
||||
range.setStart(range.commonAncestorContainer, startOffset);
|
||||
range.setEnd(range.commonAncestorContainer, startOffset + 1);
|
||||
const rect = this.getRectWithRange(node, range);
|
||||
canvas.clearRect(rect);
|
||||
canvas.drawRect({ ...rect.toJSON(), ...style });
|
||||
startOffset++;
|
||||
const { startOffset, startNode, endNode } = range;
|
||||
let start = range.startOffset;
|
||||
const endOffset = range.endOffset;
|
||||
let startTop = range.getClientRect().top;
|
||||
let drawOffset = startOffset;
|
||||
while (start < endOffset) {
|
||||
range.setStart(range.commonAncestorContainer, start);
|
||||
range.setEnd(range.commonAncestorContainer, start + 1);
|
||||
const curRect = range.getClientRect();
|
||||
if (curRect.top > startTop || start === endOffset - 1) {
|
||||
range.setStart(range.commonAncestorContainer, drawOffset);
|
||||
drawOffset = start;
|
||||
startTop = curRect.top;
|
||||
const rect = this.getRectWithRange(node, range);
|
||||
canvas.clearRect(rect);
|
||||
canvas.drawRect({ ...rect.toJSON(), ...style });
|
||||
}
|
||||
start++;
|
||||
}
|
||||
range.setStart(range.startContainer, range.startOffset);
|
||||
range.setEnd(range.endContainer, range.endOffset);
|
||||
range.setStart(startNode, startOffset);
|
||||
range.setEnd(endNode, endOffset);
|
||||
}
|
||||
|
||||
drawBackground(
|
||||
|
|
Loading…
Reference in New Issue