Open VIJAYARAJSVR opened 1 year ago
Hi,
I'm currently not working actively on this project, but I'm happy to merge any PRs that add this feature.
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)
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 https://github.com/danielsaidi/RichTextKit/issues/145 and https://github.com/danielsaidi/RichTextKit/pull/147 for further understanding of the implementation.
But dont worry, everything is fixable :D
@DominikBucher12 - just a note that there currently seems to be a TextKit 2 bug with using textLists
on macOS 14+, though it seems to be working fine on iOS. I've made some comments on the issue here: https://developer.apple.com/forums/thread/747433
It looks like even their sample code associated with that text list announcement from WWDC (TextKitAndTextViewSampleApp) is no longer available.
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.