-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Improving copy to clipboard feature- Removing extra lines #34736
Conversation
Signed-off-by: ayushtamra <tamraayush@gmail.com>
|
Welcome @ayushtamra! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -23,6 +23,7 @@ | |||
document.body.appendChild(target); | |||
} | |||
target.value = document.getElementById(elem).innerText; | |||
target.value = target.value.replace(/\n\n/gm,"\n").trim(); |
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.
Thanks @ayushtamra
I think this may be the wrong fix. If the original bug / behavior changes within Hugo then what gets copied could be different from what you get when you download the example.
At a minimum, this needs a clear comment that explains why the replace()
happens.
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.
Thanks for the feedback @sftim I would like to mention that maybe its related to the execCommand()
which is doing the copy here.
Also I have seen an question posted on StackOverflow(don't know if it makes sense): https://stackoverflow.com/questions/34477425/javascript-execcommandcopy-copies-text-but-adds-extra-white-space-to-value
But I am sure to look into and learn if there is any issues related with hugo
Hey @ayushtamra, Any updates on this PR? Seems the fix is stuck here. |
Hello @Sea-n I am actually able to solve this particular issue, by fixing the extra lines on a frontend level(a probable quick fix), but as mentioned I am not able to fix it at the root level, and will need help to solve it |
I gave this a quick research. Based on the HTML source code we get from the browser, my understanding is that something is wrong with Hugo when parsing a YAML file. The extra empty lines are added by the builtin shortcodes invoked here. We need to investigate why the contents of different files under the same directory are processed differently. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
Hello @ayushtamra , are you interested in continuing to work on this PR and investigate per suggestion by @tengqm ? Please confirm in either case since if you aren't, we can open this up to contributors who'd be able to pick this up from here. |
Hey @ayushtamra , since there has been no response to the feedback provided I will be closing the PR. If you wish to continue work, please consider reopening it by issuing a /reopen command. /close |
@divya-mohan0209: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fix: #34447
Hello, this solves the issue of addition of extra lines, on "copy to clipboard". Implemented by making changes in the JavaScript, using JavaScript replace and trim function.
Deploy preview example yaml files which are now without extra lines: