mirror of
https://github.com/logseq/logseq.git
synced 2026-05-25 13:14:39 +00:00
fix: stale editing state
This commit is contained in:
@@ -59,13 +59,13 @@ export class CreatingState extends TLToolState<
|
||||
|
||||
onExit = () => {
|
||||
if (!this.creatingShape) return
|
||||
this.app.clearEditingShape()
|
||||
this.app.history.resume()
|
||||
|
||||
if (this.creatingShape?.props.pageId) {
|
||||
this.app.setSelectedShapes([this.creatingShape.id])
|
||||
} else {
|
||||
this.app.deleteShapes([this.creatingShape.id])
|
||||
this.app.clearEditingShape()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,6 +529,9 @@ export class TLApp<
|
||||
} else {
|
||||
this.selectionRotation = 0
|
||||
}
|
||||
if (shapes.length === 0) {
|
||||
this.clearEditingShape()
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ export class EditingShapeState<
|
||||
onExit = () => {
|
||||
this.app.persist()
|
||||
this.app.clearEditingShape()
|
||||
|
||||
// Blur all inputs when exit idle
|
||||
document.querySelectorAll<HTMLElement>('input,textarea').forEach(el => el.blur())
|
||||
}
|
||||
|
||||
onPointerDown: TLEvents<S>['pointer'] = info => {
|
||||
@@ -51,9 +54,6 @@ export class EditingShapeState<
|
||||
e.stopPropagation()
|
||||
this.app.setSelectedShapes([this.editingShape])
|
||||
this.tool.transition('idle')
|
||||
|
||||
// Blur all inputs when exit idle
|
||||
document.querySelectorAll<HTMLElement>('input,textarea').forEach(el => el.blur())
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user