react-native-rich-editor icon indicating copy to clipboard operation
react-native-rich-editor copied to clipboard

Inserting images using file:// on iOS

Open cbbernier opened this issue 4 years ago • 2 comments

I'm using the insertImage feature in the editor. If I use the base64 data in the response object from RN Image Picker, the selected image shows up but if I use the uri with file:// it doesn't work, whether is the original uri or the uri after copying the image to an app directory, such as Documents or tmp. This is not ideal because I need to save the resulting html string in to a database and I don't want to clutter the db with base64 strings. Am I missing something or is "file://" not supported in your editor? It would be great if it can work when using img tag sources like <img src="file:///Users/Library/.....jpg">. I read this issue, but it seems that the allowFileAccess parameter in Webview only works on Android, not iOS.

cbbernier avatar Dec 29 '20 03:12 cbbernier

Android path is file://..... It seems that iOS does not need to bring file://

stulip avatar Dec 31 '20 07:12 stulip

Android path is file://..... It seems that iOS does not need to bring file://

Thanks, I tried that but it doesn't work. It seems that in iOS your editor only displays web hosted and base64 images. I have tried a bunch of different things and it doesn't seem to be able to access images locally in Documents, tmp, or the MainBundle paths. Is this the intended behavior? I wonder, where is src in <img src="/path/to/image/..."> pointing to? The app root or somewhere else?

cbbernier avatar Jan 03 '21 08:01 cbbernier