Skip to content

Commit

Permalink
fix: format error when update element by id #1006
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Feb 12, 2025
1 parent 5442f5e commit 15728e8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/editor/core/command/CommandAdapt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ export class CommandAdapt {
}
}
if (
(id && (element.id === id || element.controlId === id)) ||
(id && element.id === id) ||
(conceptId && element.conceptId === conceptId)
) {
updateElementInfoList.push({
Expand All @@ -1719,14 +1719,18 @@ export class CommandAdapt {
if (!updateElementInfoList.length) return
for (let i = 0; i < updateElementInfoList.length; i++) {
const { elementList, index } = updateElementInfoList[i]
elementList[index] = {
...elementList[index],
...payload.properties
}
formatElementList(zipElementList([elementList[index]]), {
// 重新格式化元素
const newElement = zipElementList([
{
...elementList[index],
...payload.properties
}
])
formatElementList(newElement, {
isHandleFirstElement: false,
editorOptions: this.options
})
elementList[index] = newElement[0]
}
this.draw.render({
isSetCursor: false
Expand All @@ -1753,7 +1757,7 @@ export class CommandAdapt {
}
}
if (
(id && element.controlId !== id && element.id !== id) ||
(id && element.id !== id) ||
(conceptId && element.conceptId !== conceptId)
) {
continue
Expand Down

0 comments on commit 15728e8

Please sign in to comment.