Hiyve Components - v1.0.0
    Preparing search index...

    Interface AssignmentEditorRef

    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>
    );
    }
    interface AssignmentEditorRef {
        addFileReferences: (refs: FileReference[]) => void;
        fileId: string | null;
        hasUnsavedChanges: boolean;
        isSaving: boolean;
        lastSaved: Date | null;
        removeFileReference: (fileId: string) => void;
        save: () => Promise<string | null>;
    }
    Index

    Properties

    addFileReferences: (refs: FileReference[]) => void

    Add file references programmatically

    fileId: string | null

    Current file ID (null if not yet saved)

    hasUnsavedChanges: boolean

    Whether there are unsaved changes

    isSaving: boolean

    Whether a save is in progress

    lastSaved: Date | null

    Last successful save timestamp

    removeFileReference: (fileId: string) => void

    Remove a file reference by file ID

    save: () => Promise<string | null>

    Manually trigger a save, returns file ID