mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-24 08:44:28 +01:00
feat: Story form, Post content editor, File Input Component, File thumbnail component, change from css to scss
This commit is contained in:
26
src/Components/Inputs/TextEditor/SaveModule.tsx
Normal file
26
src/Components/Inputs/TextEditor/SaveModule.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react'
|
||||
|
||||
import { EditorComponent, Remirror, useHelpers, useRemirror, useEvent, useEditorState } from '@remirror/react';
|
||||
import { Control, useController } from 'react-hook-form';
|
||||
|
||||
interface Props {
|
||||
control?: Control,
|
||||
name?: string
|
||||
}
|
||||
|
||||
export default function SaveModule(props: Props) {
|
||||
|
||||
const state = useEditorState()
|
||||
const { getMarkdown } = useHelpers();
|
||||
const { field: { onChange, onBlur } } = useController({
|
||||
control: props.control,
|
||||
name: props.name ?? 'content'
|
||||
})
|
||||
|
||||
useEvent('blur', () => {
|
||||
onChange(getMarkdown(state));
|
||||
onBlur()
|
||||
})
|
||||
|
||||
return <></>
|
||||
}
|
||||
Reference in New Issue
Block a user