mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47: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 {
|
abstract class ActionDispatcher extends Events {
|
||||||
private static _instance: ActionDispatcher;
|
private static _instance: ActionDispatcher;
|
||||||
|
|
||||||
|
private _commandContext: CommandContext;
|
||||||
|
|
||||||
constructor(commandContext: CommandContext) {
|
constructor(commandContext: CommandContext) {
|
||||||
$assert(commandContext, 'commandContext can not be null');
|
$assert(commandContext, 'commandContext can not be null');
|
||||||
super();
|
super();
|
||||||
|
this._commandContext = commandContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCommandContext(): CommandContext {
|
||||||
|
return this._commandContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap): void;
|
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap): void;
|
||||||
|
@ -40,7 +40,6 @@ class CommandContext {
|
|||||||
this._designer = value;
|
this._designer = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
|
||||||
findTopics(topicIds: number[]): Topic[] {
|
findTopics(topicIds: number[]): Topic[] {
|
||||||
$assert($defined(topicIds), 'topicsIds can not be null');
|
$assert($defined(topicIds), 'topicsIds can not be null');
|
||||||
const topicsIds = Array.isArray(topicIds) ? topicIds : [topicIds];
|
const topicsIds = Array.isArray(topicIds) ? topicIds : [topicIds];
|
||||||
|
@ -22,6 +22,7 @@ import initHotKeyPluggin from '../../../../libraries/jquery.hotkeys';
|
|||||||
import Events from './Events';
|
import Events from './Events';
|
||||||
import ActionDispatcher from './ActionDispatcher';
|
import ActionDispatcher from './ActionDispatcher';
|
||||||
import Topic from './Topic';
|
import Topic from './Topic';
|
||||||
|
import { Designer } from '..';
|
||||||
|
|
||||||
initHotKeyPluggin($);
|
initHotKeyPluggin($);
|
||||||
|
|
||||||
@ -255,12 +256,19 @@ 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) {
|
if (!$defined(update) || update) {
|
||||||
|
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 visible again ...
|
// 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;
|
||||||
@ -268,5 +276,5 @@ class MultilineTextEditor extends Events {
|
|||||||
this._topic = null;
|
this._topic = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
export default MultilineTextEditor;
|
export default MultilineTextEditor;
|
||||||
|
Loading…
Reference in New Issue
Block a user