-
Notifications
You must be signed in to change notification settings - Fork 7
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
Remove leading dollar signs when copying codeblocks #50
Conversation
Signed-off-by: Michael Anderson <anderson@mbari.org>
Signed-off-by: Michael Anderson <anderson@mbari.org>
|
Signed-off-by: Michael Anderson <anderson@mbari.org>
…y_entrypoint into andermi/copy_codeblocks
Signed-off-by: Michael Anderson <anderson@mbari.org>
Since most browsers (other than Firefox) don't allow multiple (non-contiguous) selection ranges, this is the best I can do without getting into some serious hacking to rewrite the codeblocks to place the |
So, to the user it looks as if it only copied the first line, but in fact copied both lines... should I change it to actually copy only what is selected even if they initially selected multiple? |
also, I need someone to test on Safari I suppose... |
Signed-off-by: Michael Anderson <anderson@mbari.org>
Yeah, probably best to only copy what's highlighted, minus the dollar sign of course... I can check on Safari on my mac... |
Signed-off-by: Michael Anderson <anderson@mbari.org>
…y_entrypoint into andermi/copy_codeblocks
ok, fixed to only copy what's highlighted (after copy event modifies selection) |
Signed-off-by: Michael Anderson <anderson@mbari.org>
Signed-off-by: Michael Anderson <anderson@mbari.org>
Don't know if this counts, but I tried it in Safari on my iPhone and it works! |
Totally counts. |
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 doing this
Can merge as is, but there is a weird behavior if I highlight and copy multiple lines, e.g.
The copy button works. But if I highlight both lines and then Ctrl+C, the result is weird - the highlight changes to first line only, and only the first line is copied. This could be a new issue to be addressed in the future. Or if this complicates things, feel free to revert to your previous version that worked better. |
@mabelzhang See these comments. That behavior is working as intended although not ideal... The issue is that none of the browsers allow non-contiguous selection regions (i.e. two lines with a dollar sign in the middle). |
Just a bit of javascript hackery!
Works when "triple-clicking" and also clicking on the copy button for clode blocks.
NOTE: it doesn't limit selection of the dollar signs; it just doesn't copy them
e.g.
selected text: (or contents of code block)
pasted text: