Closed chinaTLJ closed 1 year ago
Hi @chinaTLJ
I don't know why this problem is, that the font size gets set to 12 immediately after the image.
I did however notice that it's also happening in Apple Notes, so I wonder if it has something to do with how the attributed string is handled?
It should be possible to solve this, though.
Hi @danielsaidi thank you ,how to fix it ? how to resize the font size fater the image ?
print("before pasteImage,fontSize=(richTextContext.fontSize)") richTextContext.pasteImage(resizedImage, at: selectedRange.location, moveCursorToPastedContent: true) print("after pasteImage,fontSize=(richTextContext.fontSize)")
Both prints were 16
hi @danielsaidi ,I find something. richTextContext.pasteImage(resizedImage, at: selectedRange.location, moveCursorToPastedContent: false) if the moveCursorToPastedContent is true,The cursor will be on the right side of the picture, then the font size is 12 if the moveCursorToPastedContent is false,The cursor will start on another line, then the font size is 16, But then the user clicks their finger behind the image, and the font size becomes 12, and they don't know what to do how to do ?help me
Yes, the problem is that the image itself seems to have a "font size" of 12. And since this also happened to me in Notes, I guess it has something to do with the foundational attributed string handling.
What we could investigate is if we, when the cursor is immediately after an image, could use the font size for the text to the right of the input cursor, else the font size before the image, else the default font size.
Here's what I'm doing is : richTextContext.pasteImage(resizedImage, at: selectedRange.location, moveCursorToPastedContent: false) moveCursorToPastedContent is false ,but if the user clicks their finger behind the image, and the font size becomes 12, then can not becomes 16, I do not know how to fix it.
Hi @danielsaidi I read the source code,I find this bug can be fixed, but I don't know why. There is a method in the RichTextViewComponent class: func setCurrentFontSize(to size: CGFloat) {
setFontSize(to: size, at: selectedRange)
setFontSizeAtCurrentPosition(size)
#else
if hasSelectedRange {
setFontSize(to: size, at: selectedRange)
} else {
// setFontSizeAtCurrentPosition(size) setFontSizeAtCurrentPosition(18)//18 works, 16 doesn't, probably because 16 is the same size as the default font in the class "StandardFontSizeProvider" }
}
Thank you, I will try to take a look at this shortly 👍
@chinaTLJ I think I managed to fix this for macOS and iOS. I've pushed it to the main branch.
Hi, Each time after pasting a picture, the input text is the title of the picture by default, the font is relatively small, but I do not want to enter the title by default, just want to enter the text by default, how to do?