Skip to content

How can I enforce only lists entry? #4515

Answered by chrisidakwo
chrisidakwo asked this question in Q&A
Discussion options

You must be logged in to vote

Just in case anyone comes to this at a later time, here's how I implemented it. The only issue now is that I'm still trying to get it to allow the backspace key to delete an empty list item.

import React, { type JSX, useEffect, useRef, useState } from 'react';

import { cn } from '@/lib/utils';

interface QuillListEditorProps {
    value: string;
    onChange: (value: string) => void;
    placeholder?: string;
    readOnly?: boolean;
    className?: string;
    error?: boolean;
}

const QuillListEditor = ({
    value,
    onChange,
    placeholder = 'Type your list items...',
    readOnly = false,
    className,
    error,
}: QuillListEditorProps): JSX.Element | null => {
    const editorRef

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by chrisidakwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant