Skip to content
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

Tag links stopped to respond in table view cells #173

Closed
flvckx opened this issue Feb 9, 2024 · 2 comments
Closed

Tag links stopped to respond in table view cells #173

flvckx opened this issue Feb 9, 2024 · 2 comments

Comments

@flvckx
Copy link

flvckx commented Feb 9, 2024

Hi!

After migrating to 5.0.4 from 4.10.1, tag links stopped to respond in table view cells in particular. I tested by adding it to your demo project and it doesn't respond there either.

I would appreciate your assistance here.

Here's a snippet I added to test on your demo project.

func myStringWithHtml() -> NSAttributedString {
    let all = Attrs()
        .foregroundColor(.black)
    let link = Attrs()
        .foregroundColor(.yellow)
        .font(.boldSystemFont(ofSize: 16))

    let a = TagTuner {
        link.akaLink($0.tag.attributes["href"] ?? "")
    }

    let li = TagTuner(attributes: Attrs().font(.systemFont(ofSize: 12)).foregroundColor(.red),
                      openingTagReplacement: "- ",
                      closingTagReplacement: "\n")
    let em = TagTuner(attributes: Attrs().font(.italicSystemFont(ofSize: 16)).foregroundColor(.brown))

    let str = "<p><strong>About Us</strong><br /><br />Together we’ve created an environment that we’re very proud of.<br />It is in the center of Gothenburg, with the beating heart of the city around the corner.<br />An open space for many of Gothenburgs tech meetups, where we regularly open the doors for interesting topics and workshops. If you’re curious about how we built it check out <a href=\"https://blog.forzafootball.com/the-worlds-best-office/\">our blog</a>!<br /><br />It is a space where we also have a lot of fun working and spending time on weekends; watching football together, playing video games, gathering friends or just hanging out in our great social areas.<br />The office also contains plenty of room for physical activities; sporting a table tennis table and a small football field.<br /></p><ol><li>We do not talk about Fight Club</li><li>We <em>do not</em> talk about Fight Club</li></ol>"
        .style(tags: ["a": a, "li": li, "em": em]).styleBase(all).styleLinks(link).attributedString

    return str
}

...

func allSnippets() -> [NSAttributedString] {
    return [
        myStringWithHtml(),
        stringWithAtributikaLogo(),
        stringWithTagsAndEmoji(),
        stringWithHashTagAndMention(),
        stringWithPhone(),
        stringWithLink(),
        stringWithBoldItalic(),
        stringWithManyDetectables(),
        stringWith3Tags(),
        stringWithGrams(),
        stringWithStrong(),
        stringWithTagAndHashtag(),
        stringWithUnorderedList(),
        stringWithOrderedList(),
        stringWithHref(),
        stringWithBoldItalicUnderline(),
        stringWithImage(),
        stringWithStrikethrough(),
        stringWithColors(),
        stringWithParagraph(),
        stringWithIndentedList(),
    ]
}
@psharanda
Copy link
Owner

Hi @flvckx,

Thanks a lot for reporting this critical issue! I was able to reproduce it; now it is fixed in 5.0.5 release.

One thing, in your example you tried snippets for the first tab where a vanilla UILabel is used, which doesn't support links highlighting. But again, the issue did present for AttributedLabel / AttributedTextView and was a severe one.

@flvckx
Copy link
Author

flvckx commented Feb 14, 2024

Hey @psharanda! Thanks for a quick reply and a quick fix. Everything seems to be working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants