bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
8.29k stars 1.11k forks source link

[Bluesky Web App] Posting links highlights wrong characters/non link text as a link #1391

Open Hydroponic-Gardener opened 1 year ago

Hydroponic-Gardener commented 1 year ago

While typing out a post, if I post a link (example, google.com), the link highlighting bleeds out into other text. This isn't shown in the actual post, only while typing, or sometimes doesn't show up as a link. Examples below:

image

image

To reproduce:

For non-highlighted link: 1) Write out text 2) Paste the link, embed or not 3) Write something before the link, and don't put a space at the end.

Result:

The link will be registered as normal text.

For highlighted link bleed: 1) Write out text 2) Past the link, embed or not 3) Write text above/below the link, and leave a space before the end of sentence/text.

Result:

The link, depending on how many times one presses enter above the link, will lose the blue highlight, and transfer it on text above/below.

Platform: Linux (Arch, 6.4.12-zen kernel) Browser: Firefox 117.0 64-bit.

mschwendener commented 1 year ago

Related: https://github.com/bluesky-social/social-app/issues/1353

Hydroponic-Gardener commented 1 year ago

Related: #1353

Didn't see it when searching, I'll remove this post then. Thanks on letting me know!

pfrazee commented 1 year ago

Nice, @estrattonbailey this is from that tiptap plugin I added, I'm guessing we need to fix the regex

ganitx commented 1 year ago

Hi, can I work on this? I'd like to fix this issue.

pfrazee commented 1 year ago

Feel free to submit a PR!

andreslucero commented 1 year ago

@gani1000 @pfrazee this may also be related to the encoding of newline characters.

In the first example, it appears the newline isn’t recognized and so the highlight never triggers.

In the second example, the newlines in the middle of the post are ignored, so the highlight starts where the URL should be if the newlines didn’t exist.

estrattonbailey commented 1 year ago

@Hydroponic-Gardener I commented on the other issue, but same thing here: I can't reproduce this 🤔

I know I've seen this kinda thing in the past but perhaps we bumped something and resolved it? Are you able to reproduce this?

mschwendener commented 1 year ago

In the first example, it appears the newline isn’t recognized and so the highlight never triggers.

Yes, that also happened to me at first now that I wanted to test if it was solved: at first the URLs were just black text.

But then after adding some other URLs (because I wanted to make a screenshot), the original issue was back.

screenshot_4567
estrattonbailey commented 1 year ago

Oooh ok, saw in the other ticket that you were using Shift + Return. Apologies, wasn't thinking about the significance of "carriage return" :P

So yep, this is sorta related to character encoding, and it should be fixed by https://github.com/bluesky-social/social-app/pull/1544, which will go out in the next release. Tested these cases locally with that branch and it appears to work fine.

I'll keep this open until then though and we can confirm before closing 👍 thank you all for your help! Appreciate your patience.

mschwendener commented 1 year ago

wasn't thinking about the significance of "carriage return" :P

it's only missing the 'ding' ;-)

(also, English is not my first language)