fix: get range paragraph info boundary error #758

npr765
Hufe921 2 years ago
parent 500cec3e0b
commit 4653fe7427

@ -171,8 +171,9 @@ export class RangeManager {
} }
start-- start--
} }
const isCollapsed = startIndex === endIndex
// 中间选择 // 中间选择
if (startIndex !== endIndex) { if (!isCollapsed) {
let middle = startIndex + 1 let middle = startIndex + 1
while (middle < endIndex) { while (middle < endIndex) {
const { pageNo, rowNo } = positionList[middle] const { pageNo, rowNo } = positionList[middle]
@ -189,6 +190,10 @@ export class RangeManager {
} }
// 向下查找 // 向下查找
let end = endIndex let end = endIndex
// 闭合选区&&首字符为换行符时继续向下查找
if (isCollapsed && elementList[startIndex].value === ZERO) {
end += 1
}
while (end < positionList.length) { while (end < positionList.length) {
const element = elementList[end] const element = elementList[end]
const nextElement = elementList[end + 1] const nextElement = elementList[end + 1]

Loading…
Cancel
Save