Closed DominikBucher12 closed 5 months ago
Also currently on macOS since no configuration with default font is set yet.
Great job! Merging this to give it a go. 😀
@DominikBucher12 This doesn't work for me, see movie. The same problem on both macOS and iOS.
If you want to continue to look at this, I merged it to paragraph-fix
.
@DominikBucher12 Actually, if I just have this in RichTextViewComponent+Alignment
it behaves better than now, at least on macOS:
public extension RichTextViewComponent {
/// Get the rich text alignment at current range.
var richTextAlignment: RichTextAlignment? {
guard let style = richTextParagraphStyle else { return nil }
return RichTextAlignment(style.alignment)
}
/// Set the rich text alignment at current range.
///
/// > Todo: Something's currently off with alignment. It
/// spils over to other paragraphs when moving the input
/// cursor and inserting new text.
func setRichTextAlignment(
_ alignment: RichTextAlignment
) {
if richTextAlignment == alignment { return }
setRichTextAlignment(alignment, at: selectedRange)
}
}
I have pushed a MUCH shorter version of the alignment setter to the new branch. It seems to work pretty well, but please check it out too.
What this PR do:
How to test it
Where you can start
https://github.com/danielsaidi/RichTextKit/assets/17381941/bdc4a5f8-bc34-407c-89b2-769175b4a012