mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Add workaround for error update
This commit is contained in:
parent
a50ee13589
commit
a5847c64d4
@ -30,9 +30,16 @@ import Topic from './Topic';
|
||||
abstract class ActionDispatcher extends Events {
|
||||
private static _instance: ActionDispatcher;
|
||||
|
||||
private _commandContext: CommandContext;
|
||||
|
||||
constructor(commandContext: CommandContext) {
|
||||
$assert(commandContext, 'commandContext can not be null');
|
||||
super();
|
||||
this._commandContext = commandContext;
|
||||
}
|
||||
|
||||
getCommandContext(): CommandContext {
|
||||
return this._commandContext;
|
||||
}
|
||||
|
||||
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap): void;
|
||||
|
@ -40,7 +40,6 @@ class CommandContext {
|
||||
this._designer = value;
|
||||
}
|
||||
|
||||
/** */
|
||||
findTopics(topicIds: number[]): Topic[] {
|
||||
$assert($defined(topicIds), 'topicsIds can not be null');
|
||||
const topicsIds = Array.isArray(topicIds) ? topicIds : [topicIds];
|
||||
|
@ -22,6 +22,7 @@ import initHotKeyPluggin from '../../../../libraries/jquery.hotkeys';
|
||||
import Events from './Events';
|
||||
import ActionDispatcher from './ActionDispatcher';
|
||||
import Topic from './Topic';
|
||||
import { Designer } from '..';
|
||||
|
||||
initHotKeyPluggin($);
|
||||
|
||||
@ -255,18 +256,25 @@ class MultilineTextEditor extends Events {
|
||||
close(update: boolean): void {
|
||||
if (this.isVisible() && this._topic) {
|
||||
if (!$defined(update) || update) {
|
||||
this._updateModel();
|
||||
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();
|
||||
|
||||
// Let make the visible text in the node ...
|
||||
this._topic.getTextShape().setVisibility(true);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
// Remove it form the screen ...
|
||||
this._containerElem.remove();
|
||||
this._containerElem = null;
|
||||
}
|
||||
|
||||
// Let make the visible text in the node visible again ...
|
||||
this._topic.getTextShape().setVisibility(true);
|
||||
|
||||
// Remove it form the screen ...
|
||||
this._containerElem.remove();
|
||||
this._containerElem = null;
|
||||
this._topic = null;
|
||||
}
|
||||
this._topic = null;
|
||||
}
|
||||
}
|
||||
|
||||
export default MultilineTextEditor;
|
||||
|
Loading…
Reference in New Issue
Block a user