imnapo / react-native-cn-quill

Quill rich-text editor for react-native
MIT License
185 stars 72 forks source link

Placeholder Multiline Issue #111

Open msultanic opened 1 year ago

msultanic commented 1 year ago

The placeholder attribute in the library component fails to handle line breaks correctly, resulting in component crashes. When using line breaks, such as "placeholder="This\nis\nplaceholder"," the component becomes non-functional.

Steps to Reproduce:

  1. Add the library component to a project.
  2. Set the placeholder attribute with line breaks.
  3. Run the project and observe the component crash.

Impact: The inability to use line breaks in the placeholder attribute limits customization options and hinders user experience.

const placeholderText = "This\nis an\nexample";
...
quill={{
 modules: {
   toolbar: false,
 },
   placeholder: placeholderText,
}}
jakehasler commented 1 year ago

Hey @msultanic, my PR fixes this, https://github.com/imnapo/react-native-cn-quill/pull/117.

If you use a template string (backticks), then this will render properly in conjunction with my PR.

`What's happening today?\nStart typing...`
msultanic commented 1 year ago

Thanks @jakehasler!