Open 3nt3 opened 1 year ago
Workaround for now: use an empty string as the default value, then populate manually after 100 miliseconds or so
const [value, setValue] = useState('');
const editorRef = useRef<ReactQuill | null>(null);
useEffect(() => {
if (editorRef) {
setTimeout(() => {
editorRef.current?.getEditor().setText("This is the actual text", "user");
}, 100);
}
}, []);
Just using this code, the spell checking is only done initially with a single "\n" (wherever that comes from) and then after the user changes the text.
The text initially supplied to
<ReactQuill />
is never checked.I checked using a debugger and I think this line https://github.com/vantezzen/quill-languagetool/blob/1bc67cee6c4e0652057dbb12c32e4500de4173fc/src/index.ts#L55 is responsible. The value supplied in
value={...}
ends up in the onTextChange handler, but then ignored because the source is'api'
.Looking at this constructor https://github.com/vantezzen/quill-languagetool/blob/1bc67cee6c4e0652057dbb12c32e4500de4173fc/src/index.ts#L51-L61 and specifically the call to
this.checkSpelling()
it seems to me that the default text is supposed to also be checked.