Closed zhouhao27 closed 8 months ago
Hi @zhouhao27
Adding images from an image picker is absolutely possible with the existing functionality.
I will however add new buttons for this and add them to the demo.
Regarding resizing with image handles, it's tricky. I don't know how to do this, so I mark this with help needed, so if anyone has any ideas, I'd love to hear them :)
@danielsaidi Actually I'm wondering what else the RichTextKit is able to do. Is it possible to create an editor like Mac TextEdit.app
? That means it needs to support something like:
For now, it supports changing text styles, alignments, colors, image input etc. but I'm adding more stuff as I need it, and am happy to merge any PRs with additional features from the community.
danielsaidi,thank you for RichTextKit,I use it in swiftui, I has select a image from photo album , but how to insert to RichTextKit,my code like this: @State private var text = NSAttributedString(string: "") @StateObject var context = RichTextContext() RichTextEditor(text: $text,context: RichTextContext()) .onTapGesture { // Hide keyboard when tapping outside text editor UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) }
ImagePickerView { image in //image is the selected UIImage from photo album // I do not know how to insert image to RichTextEditor here, I can't find the relevant code in the demo } can you show some code how to insert image,thanks
Hi @chinaTLJ
To insert picked images, you can use the pasteImage
functions in RichTextContext
:
https://danielsaidi.github.io/RichTextKit/documentation/richtextkit/richtextcontext
I will however add more image features to make this even easier.
Hi @danielsaidi
The first letter is automatically capitalized, how to change this?I can't find the api
Maybe you can make it not uppercase by default
Hi @danielsaidi how to resize the image that have been pasteImage I have to let it smaller, width and height
Hi @chinaTLJ
Please keep each issue to a single topic, otherwise the issues become unmanageable.
If you create separate issues for the autocapitalization discussion and for resizing images, I will move those parts of this discussions there.
You should be able to modify the autocapitalization behavior of the underlying text view when you create the text editor.
Regarding resizing, this is not yet possible, and I see no way to add that in the nearest future. If you compare e.g. Pages with Notes, Pages use a physical page reference, which means that you can resize an image in relation to the page size, while Notes just provide a text flow without the concept of a page. As such, Notes have no resizing other than "large" and "small" images.
Since RTK works more like Notes than Pages, it has the same limitation. Storing the size as the current size in points will not make any sense, since the images will behave strange when rotating the device and opening the document on other devices. Storing the size as the current fraction of e.g. the available width has the same limitations.
Hi danielsaidi
Any change to have bullet feature in near future?
Hi @RushangGofynd
No, unfortunately not. I will be away from this project for a while, and will not be able to work on it until later in H2. I will however gladly review any PRs that add this feature, and will update the demo apps to show how the feature can be used if that happens.
I'm closing this due to the original question is already answered. Feel free to create a new issue if you feel like something from this is not yet implemented and has no issue.
I'm wondering if it's possible to add image to the editor from photo album or directly from camera and resize it by gesture.
If you don't support it now, what is your suggestion to add this feature? Thanks.