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

Hyperlink and Bulleted List support. #89

Open
VIJAYARAJSVR opened this issue Nov 18, 2023 · 2 comments
Open

Hyperlink and Bulleted List support. #89

VIJAYARAJSVR opened this issue Nov 18, 2023 · 2 comments
Labels
feature New feature or request help-wanted Let's team up and fix this!

Comments

@VIJAYARAJSVR
Copy link

Thank you very much for providing the "RichTextKit" package. It helps my project.

Please kindly add a Hyperlink and bulleted list. Also, kindly take this as a request.

@danielsaidi danielsaidi added the feature New feature or request label Nov 21, 2023
@danielsaidi
Copy link
Owner

Hi,

I'm currently not working actively on this project, but I'm happy to merge any PRs that add this feature.

@danielsaidi danielsaidi added the help-wanted Let's team up and fix this! label Jan 11, 2024
@DominikBucher12
Copy link
Collaborator

DominikBucher12 commented Feb 29, 2024

Hello @VIJAYARAJSVR , just note that I didn't forget about this. I am actively implementing this and I ran into some issues with the current implementation. I want to give you some background:

As you can see, bulleted list were super complicated to implement with TextKit 1, best solution to do this is to create custom NSLayoutManager and NSTextContainer in order to draw bullet points with some offset. I have tried my best to make it work as smooth as possible but I ran into so many issues that I can't actually even name.

With TextKit 2, it is possible to create bullet list on go by adding textList array to NSMutableParagraphStyle as follows:

let list = NSTextList(markerFormat: .decimal, options: 0)
let listLevel1Style = NSMutableParagraphStyle()
listLevel1Style.textLists = [ list ]
        setRichTextAttribute(.paragraphStyle, to: listLevel1Style) 
Screenshot 2024-02-29 at 15 11 42

This will work, but only iOS 16+ (which is the project, that's cool) when using TextKit2... However there is another issue with the project, that custom text alignment setting collides with this a bit.

In order to fix paragraphs, we needed to use textStorage instead of simply just adding paragraph attribute to the text alone since this introduced buggy behaviour.

See #145 and #147 for further understanding of the implementation.

But dont worry, everything is fixable :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help-wanted Let's team up and fix this!
Projects
None yet
Development

No branches or pull requests

3 participants