mirror of https://github.com/logseq/logseq
fix: remove text shape if content is empty
parent
1c54e62580
commit
6b3c5bbd2c
|
@ -18,6 +18,21 @@ export class EditingShapeState<
|
|||
}
|
||||
|
||||
onExit = () => {
|
||||
// cleanup text shapes
|
||||
if ('text' in this.editingShape.props) {
|
||||
// @ts-expect-error better typing
|
||||
const newText = this.editingShape.props['text'].trim()
|
||||
|
||||
if (newText === '' && this.editingShape.props.type === 'text') {
|
||||
this.app.deleteShapes([this.editingShape])
|
||||
} else {
|
||||
this.editingShape.onResetBounds()
|
||||
this.editingShape.update({
|
||||
text: newText,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.app.persist()
|
||||
this.app.setEditingShape()
|
||||
|
||||
|
|
Loading…
Reference in New Issue