From 8349d8271c09c6ce2638879ba92a6ef3adcfde9f Mon Sep 17 00:00:00 2001 From: Philip Okugbe Date: Thu, 28 Nov 2024 18:48:08 +0000 Subject: [PATCH] fix: allow space in inline math (#508) --- .../src/features/editor/components/math/math-inline.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/client/src/features/editor/components/math/math-inline.tsx b/apps/client/src/features/editor/components/math/math-inline.tsx index 675b181..a65e432 100644 --- a/apps/client/src/features/editor/components/math/math-inline.tsx +++ b/apps/client/src/features/editor/components/math/math-inline.tsx @@ -38,7 +38,7 @@ export default function MathInlineView(props: NodeViewProps) { renderMath(preview || "", mathPreviewContainer.current); } else if (preview !== null) { queueMicrotask(() => { - updateAttributes({ text: preview }); + updateAttributes({ text: preview.trim() }); }); } }, [preview, isEditing]); @@ -97,7 +97,7 @@ export default function MathInlineView(props: NodeViewProps) { ref={textAreaRef} draggable={false} classNames={{ input: classes.textInput }} - value={preview?.trim() ?? ""} + value={preview ?? ""} placeholder={"E = mc^2"} onKeyDown={(e) => { if (e.key === "Escape" || (e.key === "Enter" && !e.shiftKey)) {