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

[Deprecation] Listener added for a 'DOMNodeInserted' #4169

Closed
ykkhan1997 opened this issue May 2, 2024 · 2 comments
Closed

[Deprecation] Listener added for a 'DOMNodeInserted' #4169

ykkhan1997 opened this issue May 2, 2024 · 2 comments
Labels

Comments

@ykkhan1997
Copy link

ykkhan1997 commented May 2, 2024

import dynamic from "next/dynamic";
import React, {
  useRef,
  useEffect,
  ForwardRefRenderFunction,
  ForwardedRef,
} from "react";
import ReactQuill, { ReactQuillProps } from "react-quill";

const QuillNoSSRWrapper = dynamic(
  async () => {
    const { default: RQ } = await import("react-quill");
    return React.forwardRef<ReactQuill, ReactQuillProps>((props, ref) => (
      <RQ {...props} ref={ref} />
    ));
  },
  {
    ssr: false,
  }
);

interface EditorProps {
  value: string;
  setValue: (value: string) => void;
}

const MyEditor: ForwardRefRenderFunction<ReactQuill, EditorProps> = (
  { value, setValue },
  ref
) => {
  const qRef = useRef<ReactQuill>(null);

  useEffect(() => {
    setValue(qRef.current?.getEditor().getText() || "");
  }, []);
  const handleChange = (content: string) => {
    setValue(content);
  };
  return typeof window !== "undefined" ? (
    <QuillNoSSRWrapper
      ref={ref}
      value={value}
      onChange={handleChange}
      theme="snow"
      className="h-80 w-full input-bordered-text-area text-area-lg mb-16"
      id="quill"
    />
  ) : (
    <></>
  );
};

export default React.forwardRef(MyEditor);

I am getting warning from browser when I reload the browser DOMNodeInserted

Can anybody fix this error
Warning:
quill.js:4237 [Deprecation] Listener added for a 'DOMNodeInserted' mutation event. This event type is deprecated, and will be removed from this browser very soon. Usage of this event listener will cause performance issues today, and represents a large risk of future site breakage. Consider using MutationObserver instead. See

@shareefalis
Copy link

shareefalis commented May 2, 2024

This is not react Quill issue tracker. React Quill is not using the latest build of Quill.,Fork it and make react quill use quail 2.0

@luin
Copy link
Member

luin commented May 3, 2024

You can also use Quill in a React project without any libraries: https://quilljs.com/playground/react

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

No branches or pull requests

3 participants