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

How to make the HTML in webview look the same or very similar to the same HTML in Richtext ?

Open tomgiam opened this issue 4 years ago • 5 comments

I'm using react-native-webview to view HTML and react-native-pell-rich-editor to edit the same HTML. The problem is that the HTML is rendered differently (i.e. the images are larger and centered, and the zoom is bigger in richText). Any suggestion for how to make them look the same or at least more similar? I'm currently using a workaround where I add and remove some css to adjust font size, zoom etc. At least it looks a little better.

Is there a better way?

tomgiam avatar Sep 29 '20 21:09 tomgiam

I am looking similar thing. Is it possible to turn off editing mode for RichEditor?

karpov-denys avatar Dec 06 '20 17:12 karpov-denys

Duplicate of #65

karpov-denys avatar Dec 06 '20 17:12 karpov-denys

Thanks, I will try to use the RichEditor with "disabled={true}" instead of webview, for displaying HTML. Hopefully is only disables the editing and not the HTML interaction.

tomgiam avatar Dec 06 '20 20:12 tomgiam

@tomgiam disabled disabled just disable the editing function, if you are not satisfied with the style You can use the custom props editorStyle = {cssText: 'img{ width: '100%'}'} to override the existing style

stulip avatar Dec 15 '20 10:12 stulip

@stulip @karpov-denys I tried removing Webview and only using Richtext, in order to avoid the rendering differences between them, but I have 2 issues with that. 1. I need a way to handle my own URL schemes like I do with WebView using onShouldStartLoadWithRequest. 2. With RichText disabled, the page displays with the top 75% white background and content and the bottom 25% gray background and no content. Any way around that? The fix that I have working in Android does not work in iOS, but it may be just a matter of using different values (I hope).

tomgiam avatar Dec 28 '20 14:12 tomgiam