fix: updateWysiwygStyle updatedElement is undefined TypeError (#4980)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
zsviczian 2022-03-28 00:14:04 +02:00 committed by GitHub
parent 580e719580
commit e940aeb1a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -102,9 +102,11 @@ export const textWysiwyg = ({
const updateWysiwygStyle = () => {
const appState = app.state;
const updatedElement = Scene.getScene(element)?.getElement(
id,
) as ExcalidrawTextElement;
const updatedElement =
Scene.getScene(element)?.getElement<ExcalidrawTextElement>(id);
if (!updatedElement) {
return;
}
const { textAlign, verticalAlign } = updatedElement;
const approxLineHeight = getApproxLineHeight(getFontString(updatedElement));