-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fragmentioner default action should copy link instead of nav #1
Comments
@tantek I have not found a good way of copying text to clipboard using vanilla JS. If you know a good documented way I would update the code. Note: the |
<https://github.com/kartikprabhu> according to the linked examples on: <https://indieweb.org/citation#append_to_text_selection_copy> It looks like you can intercept document.oncopy and change the selection (using selection.selectAllChildren) to then cause the copy command itself to copy whatever text you want, rather than having to use execCommand("copy"). (Originally published at: http://tantek.com/2018/178/t1/interecept-document-oncopy-change-selection) |
<https://github.com/kartikprabhu> Looks like you can also use the Clipboard API (<https://caniuse.com/clipboard>) to write directly to the clipboard (using navigator.clipboard.writeText) in response to e.g. a click on a link (or button), see and try the code in Example 10 here: <https://w3c.github.io/clipboard-apis/#clipboard-writetext-data> (Originally published at: http://tantek.com/2018/178/t2/clipboard-api-write-clipboard) |
@tantek thanks for the links. I will look into it. My current thoughts are:
cc: @chrisaldrich @kaushalmodi since you also use fragmentioner |
I agree that if it's possible to copy the fragmention link to the clipboard, that would be a better default. Thanks for copying me here. |
Looks like the Clipboard API has not been implemented yet in FF. Also: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText#Browser_compatibility Will look into hacking around with |
Instead of "Link to Text", I want "Copy link to text" that copies the fragmention to the clipboard rather than navigates to it. Copying the link is a better default desired action than navigation. Why would you want to navigate to the thing you just selected? It's more likely you want to copy a link to what you just selected so you can post a highlight of, or comment on the selected text.
(Originally published at: http://tantek.com/2018/178/b1/fragmentioner-copy-instead-of-nav)
The text was updated successfully, but these errors were encountered: