mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
24 lines
634 B
TypeScript
24 lines
634 B
TypeScript
"use client";
|
|
|
|
import { createContext, useContext } from "react";
|
|
|
|
interface EditorSaveContextValue {
|
|
/** Callback to save the current editor content */
|
|
onSave?: () => void;
|
|
/** Whether there are unsaved changes */
|
|
hasUnsavedChanges: boolean;
|
|
/** Whether a save operation is in progress */
|
|
isSaving: boolean;
|
|
/** Whether the user can toggle between editing and viewing modes */
|
|
canToggleMode: boolean;
|
|
}
|
|
|
|
export const EditorSaveContext = createContext<EditorSaveContextValue>({
|
|
hasUnsavedChanges: false,
|
|
isSaving: false,
|
|
canToggleMode: false,
|
|
});
|
|
|
|
export function useEditorSave() {
|
|
return useContext(EditorSaveContext);
|
|
}
|