Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: quill.getSelection is not a function Nextjs #977

Open
trinhminhhieu opened this issue May 12, 2024 · 1 comment

Comments

@trinhminhhieu
Copy link

trinhminhhieu commented May 12, 2024

Hello,I using Nextjs
Uncaught (in promise) TypeError: quill.getSelection is not a function Nextjs

here code:

const imageHandler = useCallback(() => {
    const input = document.createElement("input");
    input.setAttribute("type", "file");
    input.setAttribute("accept", "image/*");
    input.click();

    input.onchange = async () => {
      if (input !== null && input.files !== null) {
        const file = input.files[0];
        const url = await uploadImageToServer(file);
        const quill = quillRef.current;
        if (quill) {
          const range = quill.getSelection();
          range && quill.getEditor().insertEmbed(range.index, "image", url);
        }
      }
    };
  }, [quillRef]);

image

@GODZ-k
Copy link

GODZ-k commented May 13, 2024

what the fuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants