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

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

problem with bullets/lists #40

Closed Shujito closed 7 years ago

Shujito commented 7 years ago

If there's only one item and it gets deleted, the cursor disappears and can't be focused again if you touch the editor

I recorded it so you can understand better what is happening

I noticed that, you can still edit if you don't touch the editor. If you add a new line and delete it, the cursor comes back and you can touch the editor without losing the focus

I also recorded when that happens

Maybe there's a way to disable touch or focus?

vonovak commented 7 years ago

it seems that all of what you recorded happened on an emulator, did you test with a device?

Shujito commented 7 years ago

I didn't

Later I used the placeholder, that fixed it, the focus doesn't disappear anymore

JohnHour89 commented 7 years ago

hi, can you share the code of how you use the placeholder? because i use the HTML it doesn't show any title or content and toolbar actions also does not work. Please advice. Thank you

Shujito commented 7 years ago

just add the contentPlaceholder prop to the editor component like this:

/* ... */
render() {
  return (
    <RichTextEditor
      contentPlaceholder={'your placeholder is here'}
      ...otherProps
    />
  );
}
/* ... */
JohnHour89 commented 7 years ago

no need to action or something like this:

async getHTML() {
    const titleHtml = await this.richtext.getTitleHtml();
    const contentHtml = await this.richtext.getContentHtml();
    alert(titleHtml + ' ' + contentHtml)
  }

because I tried your method also does't show any text in the editor...