danielsaidi / RichTextKit

RichTextKit is a Swift SDK that helps you use rich text in Swift and SwiftUI.
MIT License
950 stars 126 forks source link

Feature/persist toolbar display #140

Closed r-jarvis closed 9 months ago

r-jarvis commented 9 months ago

Issue: https://github.com/danielsaidi/RichTextKit/issues/115

Added in configuration to RichTextKeyboardToolbar that allows a user to choose if they would like to always display the toolbar. Defaults to false and config in initializer defaults to .standard if no config is defined in init.

One thought I had while doing this. Would you like me to split out RichTextKeyboardToolbarConfiguration and RichTextKeyboardToolbarStyle into their own files? It feels a little off for them to be living inside of the main RichTextKeyboardToolbar file especially if more options/features are added in the future.

danielsaidi commented 9 months ago

This looks great @r-jarvis 🎉

Merging it now and will aim to release a new version soon.

I have also investigated using environment keys for styles and configurations, instead of injecting them into the initializer. This would allow us to apply e.g. .richTextToolbarStyle(...) anywhere within a view hierarchy.

This can help simplify styling e.g. toolbars, side panels etc. since we can inject these values into the view hierarchy instead of having to pass them down into the view that can inject them into the initializer.

If you think this makes sense, I think we should aim to introduce this pattern when going to 1.0.

r-jarvis commented 9 months ago

@danielsaidi Yeah I really like the idea of that architecture pattern. I'll shoot to create a new PR that introduces it to the style/configuration for RichTextKeyboardToolbar.

danielsaidi commented 9 months ago

Sounds great! :)