Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need to clear both clipboard?
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.
I forgot to remove that statement, I've just update the PR.
However I'm going to set the PR as a draft as I realized there's an use case that need to be addressed before wrap this up. If you perform a node paste into workspace, then copy anything from outside Dynamo and paste it into library search it will paste the node as well, as it remains on clipboard.
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.
@Enzo707 this is the approach that I was talking about when implemeting the functionality of copying an external text to Dynamo, then you need to do the next steps to reproduce the bug:
The problem is that is copying the text from Notepad to the Search TextBox in Library and also adding/copying a Number node in workspace.
Then for fixing this problem my approach was to add a variable that holds the focused element, in this case when the SearchTextBox is focused or lost focus a value will be set in the variable.
I've already tested and seems that is working as expected, please double check.
This are the lines used for subcribing to the focus event and lost focus event(I executed it using the DeveloperTools), probably needs to be added in React when the page is already loaded because when I added it to library.html was crashing the webpage.
document.getElementsByClassName("SearchInputText")[0].addEventListener("focusin", (event) => {
window.chrome.webview.postMessage(JSON.stringify({ "func": "FocusUpdated", "data": "Focused" }));
});
document.getElementsByClassName("SearchInputText")[0].addEventListener("focusout", (event) => {
window.chrome.webview.postMessage(JSON.stringify({ "func": "FocusUpdated", "data": "LostFocus" }));
});
This is the branch in which I uploaded the code (the last commit has the updated code):
https://github.com/RobertGlobant20/Dynamo/tree/DYN-6361-CopyPaste-FixProposal