compose-rich-editor icon indicating copy to clipboard operation
compose-rich-editor copied to clipboard

Add images support

Open MohamedRejeb opened this issue 1 year ago • 11 comments

  • Add images support

MohamedRejeb avatar May 20 '23 16:05 MohamedRejeb

Can you give me some ideas how to add images?

jxxfzgy avatar Jun 05 '23 14:06 jxxfzgy

For now it's not possible to display images in the rich editor, so as a start we are going to display images as string, similar to github editor for example: Screenshot 2023-06-05 at 5 13 42 PM

Then in the Rich Text, which is just a representation without editing options we should see the image, the image is going to be passed and displayed as an ImageBitmap then we could implement on top of that painter resource or any other source of images like a url or whatever

MohamedRejeb avatar Jun 05 '23 16:06 MohamedRejeb

I could be wrong and haven't tried it yet but shouldn't it be possible to show a image as inline content of the annotated string in TextFieldValue inside the TextField? Or did you just mean that you won't support images on the textfield for now? 🙂

alirahimpour89 avatar Jun 05 '23 17:06 alirahimpour89

Well AFAIK showing images as inline content of the annotated string is only possible with normal Text, because TextField doesn't support inline content. I had a conversation with a developer working on the new compose text api and I told him about this limitation. So for know it's a limitation from Compose until they improve it or we found a workaround.

MohamedRejeb avatar Jun 05 '23 17:06 MohamedRejeb

Okay weird that they use annotated string but doesn't support all of its features... Hope the new TextField APIs will support this later on, waiting for better support of keeping the TextField and cursor above the keyboard when the text is long when that one is released.

alirahimpour89 avatar Jun 05 '23 18:06 alirahimpour89

Regarding the implementation of Textfield add image, I have some ideas. I can use Image in the position of the picture, and then use Textfield in other areas, like this Column { TextField image TextField ... }

jxxfzgy avatar Jun 06 '23 07:06 jxxfzgy

Yes this could work but the user experience when you try removing text and you reach the image could be bad, I'm thinking also of reserving a place for the image in the TextField then position the Image there.

Box {
    TextField()
    Image()
}

MohamedRejeb avatar Jun 06 '23 07:06 MohamedRejeb

@MohamedRejeb Is this still in the works?

dozy-programmer avatar Mar 24 '24 22:03 dozy-programmer

Seems like a official Compose solution is still not in sight, see: https://issuetracker.google.com/issues/157506938

ln-12 avatar Apr 13 '24 12:04 ln-12

Image support will be added to the RichText soon (Not the editor) For the editor, we're still waiting for Compose to add inline element support in TextField.

MohamedRejeb avatar Apr 14 '24 07:04 MohamedRejeb

Image support will be added to the RichText soon (Not the editor) For the editor, we're still waiting for Compose to add inline element support in TextField.

@MohamedRejeb Any update on this?

abnormalbbk avatar May 09 '24 05:05 abnormalbbk

any progress

vickyleu avatar Jun 12 '24 06:06 vickyleu

This feature is almost there, hopefully it will be available in the next release after 1~2 weeks.

Screenshot 2024-06-15 at 12 55 16 AM

MohamedRejeb avatar Jun 14 '24 23:06 MohamedRejeb