fix: paste and format element boundary error
This commit is contained in:
@@ -76,8 +76,9 @@ export class CursorAgent {
|
||||
const pasteElementList = getElementListByHTML(htmlText, {
|
||||
innerWidth: this.draw.getOriginalInnerWidth()
|
||||
})
|
||||
if (~startIndex) {
|
||||
// 如果是复制到虚拟元素里,则粘贴列表的虚拟元素需扁平化处理
|
||||
// 全选粘贴无需格式化上下文
|
||||
if (~startIndex && !rangeManager.getIsSelectAll()) {
|
||||
// 如果是复制到虚拟元素里,则粘贴列表的虚拟元素需扁平化处理,避免产生新的虚拟元素
|
||||
const anchorElement = elementList[startIndex]
|
||||
if (anchorElement?.titleId || anchorElement?.listId) {
|
||||
let start = 0
|
||||
|
||||
@@ -154,6 +154,12 @@ export class RangeManager {
|
||||
return rangeElementList
|
||||
}
|
||||
|
||||
public getIsSelectAll() {
|
||||
const elementList = this.draw.getElementList()
|
||||
const { startIndex, endIndex } = this.range
|
||||
return startIndex === 0 && elementList.length - 1 === endIndex
|
||||
}
|
||||
|
||||
public getIsPointInRange(x: number, y: number): boolean {
|
||||
const { startIndex, endIndex } = this.range
|
||||
const positionList = this.position.getPositionList()
|
||||
|
||||
Reference in New Issue
Block a user