Skip to content
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

Copy functionality not working properly in chrome. #35

Closed
sujeetvkulkarni opened this issue Mar 28, 2022 · 6 comments
Closed

Copy functionality not working properly in chrome. #35

sujeetvkulkarni opened this issue Mar 28, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@sujeetvkulkarni
Copy link

Describe the bug
Copy functionality of GlycoCT sequence does not propelry in all browsers, specifically chrome.

/GlycoGlyphPublic/src/modules/copyTextFromElement.js
/GlycoGlyphPublic/public/js/glycoglyph.js

copyText() function should return promise object and copyTextFromElement should wait on the object. I have added modified code below,

//If you want to copyText from Element
function copyTextFromElement(elementID) {
let element = document.getElementById(elementID); //select the element

let elementText = element.innerText; //get the text content from the element

if (element.tagName == 'INPUT' ) {
  elementText = element.value;
}

elementText = elementText.trim();

if (elementText != '') {
  //use the copyText function below
  copyText(elementText).then(() => {
    alert('Copied: \n' + elementText);
  })
  .catch(() => {
    alert('Could not copy text.');
  });
}else {
  alert('Nothing to copy.');
}

}

//If you only want to put some Text in the Clipboard just use this function
// and pass the string to copied as the argument.
function copyText(text) {
return navigator.clipboard.writeText(text);
}

@akulmehta
Copy link
Owner

Hi @sujeetvkulkarni. I cannot reproduce the error in chrome.

Example: https://glycotoolkit.com/Tools/GlycoGlyph/

image

@sujeetvkulkarni
Copy link
Author

Hi @akulmehta copy pop-up comes but if you try to paste the copied GlycoCT string on text editor it was not working.

@akulmehta
Copy link
Owner

Sorry - can't reproduce yet. It copies it fine for me. I wonder if this is OS related - I am on Windows 10.

@sujeetvkulkarni
Copy link
Author

sujeetvkulkarni commented Apr 7, 2022 via email

@akulmehta
Copy link
Owner

Does the code you proposed fix this for you?

@sujeetvkulkarni
Copy link
Author

sujeetvkulkarni commented Apr 7, 2022 via email

@akulmehta akulmehta added the bug Something isn't working label Apr 7, 2022
akulmehta added a commit that referenced this issue Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants