fix: elements in the table cannot be selected #378
This commit is contained in:
@@ -232,13 +232,19 @@ export class RangeManager {
|
|||||||
public getIsSelectAll() {
|
public getIsSelectAll() {
|
||||||
const elementList = this.draw.getElementList()
|
const elementList = this.draw.getElementList()
|
||||||
const { startIndex, endIndex } = this.range
|
const { startIndex, endIndex } = this.range
|
||||||
return startIndex === 0 && elementList.length - 1 === endIndex
|
return (
|
||||||
|
startIndex === 0 &&
|
||||||
|
elementList.length - 1 === endIndex &&
|
||||||
|
!this.position.getPositionContext().isTable
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public getIsPointInRange(x: number, y: number): boolean {
|
public getIsPointInRange(x: number, y: number): boolean {
|
||||||
const { startIndex, endIndex } = this.range
|
const { startIndex, endIndex } = this.range
|
||||||
const positionList = this.position.getPositionList()
|
const positionList = this.position.getPositionList()
|
||||||
for (let p = startIndex + 1; p <= endIndex; p++) {
|
for (let p = startIndex + 1; p <= endIndex; p++) {
|
||||||
|
const position = positionList[p]
|
||||||
|
if (!position) break
|
||||||
const {
|
const {
|
||||||
coordinate: { leftTop, rightBottom }
|
coordinate: { leftTop, rightBottom }
|
||||||
} = positionList[p]
|
} = positionList[p]
|
||||||
|
|||||||
@@ -645,6 +645,8 @@ export function formatElementContext(
|
|||||||
const copyElement = getAnchorElement(sourceElementList, anchorIndex)
|
const copyElement = getAnchorElement(sourceElementList, anchorIndex)
|
||||||
if (!copyElement) return
|
if (!copyElement) return
|
||||||
const { isBreakWhenWrap = false } = options || {}
|
const { isBreakWhenWrap = false } = options || {}
|
||||||
|
// 是否已经换行
|
||||||
|
let isBreakWarped = false
|
||||||
for (let e = 0; e < formatElementList.length; e++) {
|
for (let e = 0; e < formatElementList.length; e++) {
|
||||||
const targetElement = formatElementList[e]
|
const targetElement = formatElementList[e]
|
||||||
if (
|
if (
|
||||||
@@ -652,10 +654,15 @@ export function formatElementContext(
|
|||||||
!copyElement.listId &&
|
!copyElement.listId &&
|
||||||
/^\n/.test(targetElement.value)
|
/^\n/.test(targetElement.value)
|
||||||
) {
|
) {
|
||||||
break
|
isBreakWarped = true
|
||||||
}
|
}
|
||||||
// 定位元素非列表,无需处理粘贴列表的上下文
|
// 1. 即使换行停止也要处理表格上下文信息
|
||||||
if (!copyElement.listId && targetElement.type === ElementType.LIST) {
|
// 2. 定位元素非列表,无需处理粘贴列表的上下文,仅处理表格上下文信息
|
||||||
|
if (
|
||||||
|
isBreakWarped ||
|
||||||
|
(!copyElement.listId && targetElement.type === ElementType.LIST)
|
||||||
|
) {
|
||||||
|
cloneProperty<IElement>(TABLE_CONTEXT_ATTR, copyElement, targetElement)
|
||||||
targetElement.valueList?.forEach(valueItem => {
|
targetElement.valueList?.forEach(valueItem => {
|
||||||
cloneProperty<IElement>(TABLE_CONTEXT_ATTR, copyElement, valueItem)
|
cloneProperty<IElement>(TABLE_CONTEXT_ATTR, copyElement, valueItem)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user