refactor: update DialogDelete component to use selectedId and close callback
This commit is contained in:
@@ -8,22 +8,16 @@ import TextStyle from '@tiptap/extension-text-style'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { useEffect, useId, useState } from 'react'
|
||||
import {
|
||||
get,
|
||||
type FieldError,
|
||||
type FieldValues,
|
||||
type Path,
|
||||
type RegisterOptions,
|
||||
} from 'react-hook-form'
|
||||
import { get, type FieldError, type RegisterOptions } from 'react-hook-form'
|
||||
import { useRemixFormContext } from 'remix-hook-form'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
import { EditorMenuBar } from './editor-menubar'
|
||||
import { EditorTextArea } from './editor-textarea'
|
||||
|
||||
type TProperties<TFormValues extends FieldValues> = {
|
||||
type TProperties = {
|
||||
id?: string
|
||||
name: Path<TFormValues>
|
||||
name: string
|
||||
label?: string
|
||||
placeholder?: string
|
||||
labelClassName?: string
|
||||
@@ -36,9 +30,7 @@ type TProperties<TFormValues extends FieldValues> = {
|
||||
category: string
|
||||
}
|
||||
|
||||
export const TextEditor = <TFormValues extends Record<string, unknown>>(
|
||||
properties: TProperties<TFormValues>,
|
||||
) => {
|
||||
export const TextEditor = (properties: TProperties) => {
|
||||
const {
|
||||
id,
|
||||
label,
|
||||
@@ -92,7 +84,7 @@ export const TextEditor = <TFormValues extends Record<string, unknown>>(
|
||||
immediatelyRender: false,
|
||||
content: watchContent,
|
||||
onUpdate: ({ editor }) => {
|
||||
setValue(name, editor.getHTML() as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
setValue(name, editor.getHTML() as string)
|
||||
},
|
||||
})
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user