Closed ubarua123 closed 4 years ago
I don't know if I get you correctly.
You can set DownloadImageConfig on editor to download all entered images to local device. E. g. saving them under Pictures/downloaded_images:
editor.downloadImageConfig = DownloadImageConfig(DownloadImageUiSetting.AllowSelectDownloadFolderInCode,
File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "downloaded_images"))
There's no need for you then to adjust src attribute on \ tag manually, RichTextEditor will do this for you.
The same with resizing an image: RichTextEditor will automatically set width and height attribute on \ tag. So you don't have to handle this manually.
Does this answer your question?
When I enter an image URL, the editor downloads the image and renders it on the screen. Now my question is, when I generate the HTML using
getCurrentHtmlAsync
I have no control over that image tag which got downloaded. As in, do i need to implement Jsoup and download that image again or how do i get the local path in which the editor downloaded previously?Or is there a listener that I am unaware of? The preferable method would be to insert the local path in tag post downloading and when I have to render the HTML (say in a preview screen), I use Glide to load the image from the local already downloaded path by implementing
ImageGetter
Also I believe the editor has a facility to resize the image. Which means the img tag has to contain the final image dimensions. Can you help me with the above problems?