-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copyandpaste #1
Copyandpaste #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's chat about the subscription, I could be incorrect.
|
||
copyNode() { | ||
this.stateService.userState.setCopiedNodeId(); | ||
this.subscription = this.stateService.twiglet.nodes.observable.subscribe((response: OrderedMap<string, Map<string, any>>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs an unsubscribe or we can just subscribe to all of the nodes in ngOnInit like we do with the userstate on line 33.
@@ -23,6 +23,14 @@ describe('UserStateService', () => { | |||
}); | |||
}); | |||
|
|||
it('can set the copied node id to the current node id', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet :)
|
||
@HostListener('window:keydown', ['$event']) | ||
handleKeyDown($event) { | ||
if (($event.metaKey || $event.ctrlKey) && $event.code === 'KeyC' && !this.disabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metaKey is the control key on windows so I think you can drop your or $event.ctrlKey
and just use metaKey to support all operating systems.
this.disabled = !response.get('isEditing'); | ||
this.cd.markForCheck(); | ||
userStateServiceResponseToObject.bind(this)(response); | ||
if (!this.userState.currentNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to set current node to an empty string or can you just leave the null?
No description provided.