You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a custom Quill blot in React-Quill (Next.js project) but I can't get the custom blot to work properly. I have followed several steps to register and use the blot, but when trying to insert it, nothing happens. I'm looking for guidance to debug this issue.
Files and Code:
1. Editor.tsx
importdynamicfrom'next/dynamic';import{alpha}from'@mui/material/styles';importSkeletonfrom'@mui/material/Skeleton';importToolbar,{formats}from'./toolbar';importReactQuillfrom'react-quill';constBlockEmbed=ReactQuill.Quill.import('blots/block/embed');classDividerBlotextendsBlockEmbed{staticblotName='divider';statictagName='hr';}ReactQuill.Quill.register(DividerBlot)// Register the ButtonBlot with Quill// Dynamically import ReactQuill without server-side renderingconstDynamicReactQuill=dynamic(async()=>Promise.resolve(ReactQuill),{ssr: false,loading: ()=>(<Skeletonsx={{top: 0,left: 0,right: 0,bottom: 0,height: 1,borderRadius: 1,position: 'absolute',}}/>),});// ----------------------------------------------------------------------exportdefaultfunctionEditorQuestion({
id ='question-quill',
error,
simple =false,
helperText,
sx,
...other}: EditorQuestionProps){functionaddCustom(this: any){constquill=this.quill;constcursorPosition=quill.getSelection()?.index;if(cursorPosition!=null){quill.insertEmbed(cursorPosition,'divider');// Move the cursor to after the inserted content quill.setSelection(cursorPosition+1,'silent');// Move to the next position after the button}}constmodules={toolbar: {container: `#${id}`,handlers: {addCustom: addCustom},},history: {delay: 500,maxStack: 100,userOnly: true,},syntax: true,clipboard: {matchVisual: false,},};return(<><Toolbarid={id}/><DynamicReactQuillmodules={modules}formats={formats}placeholder="Write something awesome..."{...other}/></>);}
Problem:
The custom blot (divider) is not showing up as expected when using quill.insertEmbed.
I suspect it might be related to how the blot is registered or imported in React-Quill.
Question:
Is there something wrong with the way I'm registering or inserting the blot in the React-Quill editor?
How can I get the custom divider blot to render properly?
The text was updated successfully, but these errors were encountered:
There's very little support for quill and the community is very small right now.
I'm also struggling with a similar issue and trying to find developers who can help me out with the same.
Currently, I'm thinking of getting rid of react-quill and instead use Quill itself for the editor too.
Issue: Custom Blot in React-Quill Not Working
I'm working on a custom Quill blot in
React-Quill
(Next.js project) but I can't get the custom blot to work properly. I have followed several steps to register and use the blot, but when trying to insert it, nothing happens. I'm looking for guidance to debug this issue.Files and Code:
1.
Editor.tsx
Problem:
Question:
The text was updated successfully, but these errors were encountered: