Ref handle for the AssignmentEditor component.
Use this ref to imperatively control the AssignmentEditor from a parent component, such as triggering a save from a custom header.
import { AssignmentEditor, type AssignmentEditorRef } from '@hiyve/react-assignments';function AssignmentsPanel() { const editorRef = useRef<AssignmentEditorRef>(null); return ( <Box> <Box sx={{ display: 'flex', justifyContent: 'space-between' }}> <Typography>Assignments</Typography> <IconButton onClick={() => editorRef.current?.save()} disabled={editorRef.current?.isSaving || !editorRef.current?.hasUnsavedChanges} > <SaveIcon /> </IconButton> </Box> <AssignmentEditor ref={editorRef} enableAutoSave /> </Box> );} Copy
import { AssignmentEditor, type AssignmentEditorRef } from '@hiyve/react-assignments';function AssignmentsPanel() { const editorRef = useRef<AssignmentEditorRef>(null); return ( <Box> <Box sx={{ display: 'flex', justifyContent: 'space-between' }}> <Typography>Assignments</Typography> <IconButton onClick={() => editorRef.current?.save()} disabled={editorRef.current?.isSaving || !editorRef.current?.hasUnsavedChanges} > <SaveIcon /> </IconButton> </Box> <AssignmentEditor ref={editorRef} enableAutoSave /> </Box> );}
Add file references programmatically
Current file ID (null if not yet saved)
Whether there are unsaved changes
Whether a save is in progress
Last successful save timestamp
Remove a file reference by file ID
Manually trigger a save, returns file ID
Ref handle for the AssignmentEditor component.
Remarks
Use this ref to imperatively control the AssignmentEditor from a parent component, such as triggering a save from a custom header.
Example