mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-24 16:54:23 +01:00
- topics input component - refactor autocomplete component - create staging slice - fix post details username overflow
30 lines
737 B
TypeScript
30 lines
737 B
TypeScript
import { useHelpers, useEvent, useRemirrorContext } from '@remirror/react';
|
|
import { Control, useController } from 'react-hook-form';
|
|
import { useDebouncedCallback } from '@react-hookz/web';
|
|
|
|
interface Props {
|
|
control?: Control,
|
|
name?: string,
|
|
}
|
|
|
|
export default function SaveModule(props: Props) {
|
|
|
|
const { field: { onChange, onBlur } } = useController({
|
|
control: props.control,
|
|
name: props.name ?? 'content'
|
|
})
|
|
|
|
const { getMarkdown, getHTML } = useHelpers();
|
|
|
|
const changeCallback = useDebouncedCallback(ctx => {
|
|
const { state } = ctx;
|
|
onChange(getHTML(state));
|
|
}, [], 500)
|
|
|
|
useRemirrorContext(changeCallback)
|
|
|
|
// useEvent('focus', () => onBlur())
|
|
|
|
return <></>
|
|
}
|