fix: allow space in inline math (#508)

This commit is contained in:
Philip Okugbe
2024-11-28 18:48:08 +00:00
committed by GitHub
parent 2e6d16dbc3
commit 8349d8271c

View File

@ -38,7 +38,7 @@ export default function MathInlineView(props: NodeViewProps) {
renderMath(preview || "", mathPreviewContainer.current); renderMath(preview || "", mathPreviewContainer.current);
} else if (preview !== null) { } else if (preview !== null) {
queueMicrotask(() => { queueMicrotask(() => {
updateAttributes({ text: preview }); updateAttributes({ text: preview.trim() });
}); });
} }
}, [preview, isEditing]); }, [preview, isEditing]);
@ -97,7 +97,7 @@ export default function MathInlineView(props: NodeViewProps) {
ref={textAreaRef} ref={textAreaRef}
draggable={false} draggable={false}
classNames={{ input: classes.textInput }} classNames={{ input: classes.textInput }}
value={preview?.trim() ?? ""} value={preview ?? ""}
placeholder={"E = mc^2"} placeholder={"E = mc^2"}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Escape" || (e.key === "Enter" && !e.shiftKey)) { if (e.key === "Escape" || (e.key === "Enter" && !e.shiftKey)) {