Fix drag issue that leaves editor open

This commit is contained in:
Paulo Gustavo Veiga 2022-02-18 08:11:33 -08:00
parent 0fe100222f
commit df6edba21b

View File

@ -254,26 +254,17 @@ class MultilineTextEditor extends Events {
close(update: boolean): void { close(update: boolean): void {
if (this.isVisible() && this._topic) { if (this.isVisible() && this._topic) {
if (!$defined(update) || update) {
const actionDispatcher = ActionDispatcher.getInstance(); const actionDispatcher = ActionDispatcher.getInstance();
// Workaround. For some reason, close is triggered but the topic has been removed. Temporally, try to validate if exits.
try {
actionDispatcher
.getCommandContext()
.findTopics([this._topic.getId()]);
this._updateModel(); this._updateModel();
}
// Let make the visible text in the node ... // Let make the visible text in the node ...
this._topic.getTextShape().setVisibility(true); this._topic.getTextShape().setVisibility(true);
} catch (e) {
console.log(e);
}
// Remove it form the screen ... // Remove it form the screen ...
this._containerElem.remove(); this._containerElem.remove();
this._containerElem = null; this._containerElem = null;
}
this._topic = null; this._topic = null;
} }
} }
} }
export default MultilineTextEditor; export default MultilineTextEditor;