react-native-cn-quill icon indicating copy to clipboard operation
react-native-cn-quill copied to clipboard

getHtml() returns empty string in react-native-cn-quill version 0.7.18

Open zahrafalah opened this issue 4 months ago • 0 comments

Description

When calling getHtml() after editing content in the editor, the method returns an empty string.

Steps to Reproduce

  1. Set up a QuillEditor component in a React Native project.
  2. Add some initial HTML content using the initialHtml prop.
  3. Edit the content in the editor.
  4. Call getHtml() and observe that it returns an empty string.

Expected Behavior

getHtml() should return the current HTML content in the editor.

Actual Behavior

getHtml() returns an empty string.

Environment

Package version: "react-native-cn-quill": "^0.7.18" React Native version: "react-native": "^0.74.3" Platform: Web WebView version: "react-native-webview": "^11.0.0",

Code Example

const quillRef = useRef(null);

const handleSave = async () => {
  try {
    const htmlContent = await quillRef.current.getHtml();
    console.log("HTML Content: ", htmlContent); // Logs an empty string
  } catch (error) {
    console.error("Error: ", error);
  }
};

return (
  <QuillEditor 
      ref={quillRef} 
      initialHtml="<p>Initial Content</p>" 
      onHtmlChange={({ html }) => console.log("HTML Changed: ", html)} // Does not trigger
/>
);



zahrafalah avatar Oct 01 '24 17:10 zahrafalah