|
@@ -263,7 +263,8 @@ export default class Text extends Base {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- handleClickOutside () {
|
|
|
+ handleClickOutside (element) {
|
|
|
+ if (element === this.annotationContainer || !this.popShow) return
|
|
|
this.popShow = false
|
|
|
this.textEditorContainer.remove()
|
|
|
this.annotationContainer.style.zIndex = 6
|
|
@@ -285,6 +286,7 @@ export default class Text extends Base {
|
|
|
event.stopPropagation()
|
|
|
}
|
|
|
if (this.moving) return
|
|
|
+ this.eventBus.dispatch('closeTextEditor', event.target.closest('.annotation.text'))
|
|
|
if (this.popShow) return
|
|
|
this.popShow = true
|
|
|
this.annotationContainer.append(this.textEditorContainer)
|
|
@@ -426,5 +428,6 @@ export default class Text extends Base {
|
|
|
this.deletetButton = deletetButton
|
|
|
textEditorContainer.append(deletetButton)
|
|
|
this.deletetButton.addEventListener('click', this.onDelete)
|
|
|
+ this.eventBus._on('closeTextEditor', this.handleClickOutside.bind(this))
|
|
|
}
|
|
|
}
|