Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
math_tutor_dev
public_math_tutor
Commits
63632233
Commit
63632233
authored
Jun 30, 2026
by
Kantz
Browse files
new shortkeys
parent
76ecaef2
Changes
1
Hide whitespace changes
Inline
Side-by-side
math-tutor/frontend/src/components/Chat/MessageInput.tsx
View file @
63632233
...
...
@@ -256,12 +256,21 @@ export default function MessageInput({
onSend
(
message
);
},
[
clearEditor
,
isSending
,
onSend
]);
const
saveFormula
=
useCallback
(()
=>
{
saveMathRef
.
current
?.(
mathFieldRef
.
current
?.
value
||
""
);
const
closeMathEditor
=
useCallback
(()
=>
{
saveMathRef
.
current
=
null
;
dialogRef
.
current
?.
close
();
},
[]);
const
saveFormula
=
useCallback
(()
=>
{
const
latex
=
stripMathDelimiters
(
mathFieldRef
.
current
?.
value
||
""
);
if
(
!
latex
)
{
closeMathEditor
();
return
;
}
saveMathRef
.
current
?.(
latex
);
closeMathEditor
();
},
[
closeMathEditor
]);
const
MathNode
=
useMemo
(()
=>
createMathNode
(
openMathEditor
),
[
openMathEditor
]);
const
editor
=
useEditor
({
...
...
@@ -449,7 +458,10 @@ export default function MessageInput({
onClose
=
{
(
event
)
=>
{
const
dialog
=
event
.
currentTarget
;
if
(
dialog
.
returnValue
===
"
save
"
)
{
saveMathRef
.
current
?.(
mathFieldRef
.
current
?.
value
||
""
);
const
latex
=
stripMathDelimiters
(
mathFieldRef
.
current
?.
value
||
""
);
if
(
latex
)
{
saveMathRef
.
current
?.(
latex
);
}
}
saveMathRef
.
current
=
null
;
}
}
...
...
@@ -462,6 +474,10 @@ export default function MessageInput({
event
.
preventDefault
();
saveFormula
();
}
if
(
event
.
key
===
"
Escape
"
)
{
event
.
preventDefault
();
closeMathEditor
();
}
}
}
/>
<
div
className
=
"dialog-actions"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment