diff --git a/src/Components/Facility/ConsultationDoctorNotes/index.tsx b/src/Components/Facility/ConsultationDoctorNotes/index.tsx index dd96ef9af1e..8e39ee04e4e 100644 --- a/src/Components/Facility/ConsultationDoctorNotes/index.tsx +++ b/src/Components/Facility/ConsultationDoctorNotes/index.tsx @@ -11,6 +11,8 @@ import { PatientNoteStateType } from "../models.js"; import routes from "../../../Redux/api.js"; import request from "../../../Utils/request/request.js"; import useQuery from "../../../Utils/request/useQuery.js"; +import useKeyboardShortcut from "use-keyboard-shortcut"; +import { isAppleDevice } from "../../../Utils/utils.js"; interface ConsultationDoctorNotesProps { patientId: string; @@ -26,6 +28,7 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => { const [reload, setReload] = useState(false); const [facilityName, setFacilityName] = useState(""); const [patientName, setPatientName] = useState(""); + const [focused, setFocused] = useState(false); const initialData: PatientNoteStateType = { notes: [], @@ -84,6 +87,18 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => { } }); + useKeyboardShortcut( + [isAppleDevice ? "Meta" : "Shift", "Enter"], + () => { + if (focused) { + onAddNote(); + } + }, + { + ignoreInputFields: false, + } + ); + return ( { errorClassName="hidden" placeholder="Type your Note" disabled={!patientActive} + onFocus={() => setFocused(true)} + onBlur={() => setFocused(false)} /> { + if (focused) { + onAddNote(); + } + }, + { + ignoreInputFields: false, + } + ); + const notesActionIcons = (
{show && ( @@ -157,6 +171,8 @@ export default function PatientNotesSlideover(props: PatientNotesProps) { errorClassName="hidden" placeholder="Type your Note" disabled={!patientActive} + onFocus={() => setFocused(true)} + onBlur={() => setFocused(false)} />