React-Quill , Instagram embed code setup in editor

59 Views Asked by At

I use React-Quill for my NextJS application as Editor but now I have problem with "Embed"․․․ For correct showing Instagram post's in editor I tried many options to create custom Toolbar for editor for adding embed code but does not working help!!!!!!!!!!!!!!

    async () => {
        const { default: RQ } = await import("react-quill");
        return ({ forwardedRef, ...props }) => <RQ ref={forwardedRef} {...props} />;
    },
    {
        ssr: false
    }
);

    function handleEmbed(){
        let embedCode = prompt()
        const editor = reactQuillRef.current.getEditor();
        const range = editor.getSelection();
        let position = range ? range.index : 0;
        if (embedCode) {
            console.log('position', position)
            console.log('embedCode', embedCode)
            editor.clipboard.dangerouslyPasteHTML(position, embedCode);
        }
    }
0

There are 0 best solutions below