yanokwa
(Yaw Anokwa)
2018 年3 月 22 日 03:34
1
有时,我会在文本中看到包含 URL 的内容,而该链接已被点击了 9 次。
Lorem ipsum dolor sit amet https://example.com/NQoiffrCbcaZHcKQe5syENZiKWsvEc onsetetur sadipscing elitr.
有人复制这段文本并粘贴到另一篇帖子中,却未注意到末尾的 9。于是,我们得到了一个看似有效但实际上无效的链接。
Lorem ipsum dolor sit amet https://example.com/NQoiffrCbcaZHcKQe5syENZiKWsvEc9 onsetetur sadipscing elitr.
这种情况发生的原因是,我们有一群人轮流撰写社区公告,而每条公告都包含一个指向正在更新的 Google 文档的链接。B 从 A 那里复制了上一份公告,结果导致到处都是失效的链接。是否可以在点击计数前添加一个空格?
11 个赞
I believe that’d be a markup issue @awesomerobot I do like the suggestion if we can do it easily, have seen this before.
3 个赞
sam
(Sam Saffron)
2018 年3 月 22 日 04:18
3
It’s possible we could have a space here inserted, but even copying the number is superfluous imo, it should be in <span class='ignore-copy'> or something like that and we should get it into the clipboard without the number.
Also @yanokwa do you have enable rich text paste enabled, does this resolve your issue?
@vinothkannans we got to spend some time improving internal usage of enable rich text paste, it is a bit flakey.
3 个赞
There’s a way to do prevent copying using psuedo elements, but it’s not great for accessibility (“CSS generated content is not content ”)
Adding a space is a small improvement that shouldn’t impact anything else though.
8 个赞
yanokwa
(Yaw Anokwa)
2018 年3 月 22 日 16:42
6
I do not rich text paste enabled and when I tried, it did not resolve the issue.
PR to add a space before the counter here:
master ← link-space
merged 01:27AM - 23 Mar 18 UTC
Adding a space to click counts in posts so when a user copies text they don't pa… ste a broken URL
See discussion: https://meta.discourse.org/t/copying-a-link-includes-the-click-count/83531
11 个赞
Space is added, so now you can copy & paste without breaking the link… like so:
https://example.com/NQoiffrCbcaZHcKQe5syENZiKWsvEc 2
Still room for future improvement, like not allowing click counts into the clipboard at all.
7 个赞
Confirmed looks good, results in:
dolor sit amet https://example.com/NQoiffrCbcaZHcKQe5syENZiKWsvEc 2 onsetetur
Great idea @yanokwa
1 个赞