wix-incubator / react-native-zss-rich-text-editor

React Native rich text editor based on ZSSRichTextEditor
Other
841 stars 310 forks source link

How to get HTML content #117

Open rasselll opened 6 years ago

rasselll commented 6 years ago

Hi noob question but how do i actually get the HTML content, i have an onPress, but when i try to alert out the content it just gives me the content from when the editor was initialised.

onPressLearnMore(){ alert(titleHtml + ' ' + contentHtml) }

jaspal-singh-gulati commented 6 years ago

Hi,

Make a separate function for that say :

async getHTML() { const contentHtml = await this.richtext.getContentHtml(); return contentHtml }

Now invoke it on onPress.

ZengMX commented 5 years ago

this.richtext.getContentHtml().then((htmlContent)=>{you can get it here})