react-native-cn-quill
react-native-cn-quill copied to clipboard
getHtml() returns empty string in react-native-cn-quill version 0.7.18
Description
When calling getHtml()
after editing content in the editor, the method returns an empty string.
Steps to Reproduce
- Set up a
QuillEditor
component in a React Native project. - Add some initial HTML content using the
initialHtml
prop. - Edit the content in the editor.
- 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
/>
);