mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-24 16:54:23 +01:00
- 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
33 lines
790 B
TypeScript
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 <></>
|
|
}
|