Files
landscape-template/src/Components/Inputs/TextEditor/SaveModule.tsx
MTG2000 e46649513d fix: fixing pre-lanuch issues
- store post's body as markdown
- stories page design changes
- thick borders post details page
- make text-editor toolbar sticky
- fix update post api
- change dropdown icons to emojis
- remove vote/comments stats from postDetailsPage
- remove "Type of post" component from createPostPage & replace it with back button
- change insert tags placeholder text
2022-06-13 16:32:31 +03:00

33 lines
790 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;
const md = getMarkdown(state);
console.log(md);
onChange(md);
}, [], 500)
useRemirrorContext(changeCallback)
// useEvent('focus', () => onBlur())
return <></>
}