From 1a877fa8c70ae6d1f7f321372533f4a2202fde31 Mon Sep 17 00:00:00 2001 From: zsviczian Date: Mon, 6 Mar 2023 23:45:11 +0100 Subject: [PATCH] magicOffset only for Firefox and Safari --- src/element/textWysiwyg.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/element/textWysiwyg.tsx b/src/element/textWysiwyg.tsx index 5b146b599..5e47ff3fe 100644 --- a/src/element/textWysiwyg.tsx +++ b/src/element/textWysiwyg.tsx @@ -11,7 +11,7 @@ import { isBoundToContainer, isTextElement, } from "./typeChecks"; -import { CLASSES, VERTICAL_ALIGN } from "../constants"; +import { CLASSES, isFirefox, isSafari, VERTICAL_ALIGN } from "../constants"; import { ExcalidrawElement, ExcalidrawLinearElement, @@ -348,9 +348,11 @@ export const textWysiwyg = ({ }); const magicOffset = - (excalidrawContainer - ? parseFloat(getComputedStyle(excalidrawContainer).fontSize) - : 16) / 8; + isFirefox || isSafari + ? (excalidrawContainer + ? parseFloat(getComputedStyle(excalidrawContainer).fontSize) + : 16) / 16 + : 0; const onEditableInput = () => { const updatedTextElement = Scene.getScene(element)?.getElement(