mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-25 23:54:55 +01:00
Fix NPE on remove node.
This commit is contained in:
parent
c9c2194a57
commit
49de0b4945
@ -55,7 +55,8 @@ export class DefaultWidgetManager extends WidgetManager {
|
||||
return topic.getNoteValue();
|
||||
},
|
||||
setValue(value: string) {
|
||||
topic.setNoteValue(value);
|
||||
const note = value && value.trim() !== '' ? value : undefined;
|
||||
topic.setNoteValue(note);
|
||||
},
|
||||
};
|
||||
this.editorContent = noteContent(model, () => this.setPopoverOpen(false));
|
||||
|
@ -16,9 +16,11 @@ const SaveAndDelete = (props: {
|
||||
<Button color="primary" variant="outlined" onClick={props.submitHandler} sx={{ mr: 1 }}>
|
||||
{$msg('ACCEPT')}
|
||||
</Button>
|
||||
|
||||
<Button color="primary" variant="contained" onClick={props.closeModal}>
|
||||
{$msg('CANCEL')}
|
||||
</Button>
|
||||
|
||||
{props.model.getValue() && props.model.getValue().trim() !== '' && (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
|
@ -164,7 +164,11 @@ export class NodePropertyValueModelBuilder {
|
||||
this.linkModel = {
|
||||
getValue: (): string => this.selectedTopic()?.getLinkValue(),
|
||||
setValue: (value: string) => {
|
||||
this.selectedTopic().setLinkValue(value);
|
||||
if (value && value.trim() !== '') {
|
||||
this.selectedTopic().setLinkValue(value);
|
||||
} else {
|
||||
this.selectedTopic().setLinkValue(undefined);
|
||||
}
|
||||
},
|
||||
};
|
||||
return this.linkModel;
|
||||
@ -218,7 +222,8 @@ export class NodePropertyValueModelBuilder {
|
||||
this.noteModel = {
|
||||
getValue: (): string => this.selectedTopic()?.getNoteValue(),
|
||||
setValue: (value: string) => {
|
||||
this.selectedTopic().setNoteValue(value);
|
||||
const note = value && value.trim() !== '' ? value : undefined;
|
||||
this.selectedTopic()?.setNoteValue(note);
|
||||
},
|
||||
};
|
||||
return this.noteModel;
|
||||
|
@ -777,6 +777,7 @@ abstract class Topic extends NodeGraph {
|
||||
const model = this.getModel();
|
||||
const dispatcher = ActionDispatcher.getInstance();
|
||||
const links = model.findFeatureByType(TopicFeatureFactory.Link.id);
|
||||
|
||||
if (!$defined(value)) {
|
||||
const featureId = links[0].getId();
|
||||
dispatcher.removeFeatureFromTopic(topicId, featureId);
|
||||
|
Loading…
Reference in New Issue
Block a user