fix: updateWysiwygStyle updatedElement is undefined TypeError (#4980)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
580e719580
commit
e940aeb1a3
@ -102,9 +102,11 @@ export const textWysiwyg = ({
|
|||||||
|
|
||||||
const updateWysiwygStyle = () => {
|
const updateWysiwygStyle = () => {
|
||||||
const appState = app.state;
|
const appState = app.state;
|
||||||
const updatedElement = Scene.getScene(element)?.getElement(
|
const updatedElement =
|
||||||
id,
|
Scene.getScene(element)?.getElement<ExcalidrawTextElement>(id);
|
||||||
) as ExcalidrawTextElement;
|
if (!updatedElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { textAlign, verticalAlign } = updatedElement;
|
const { textAlign, verticalAlign } = updatedElement;
|
||||||
|
|
||||||
const approxLineHeight = getApproxLineHeight(getFontString(updatedElement));
|
const approxLineHeight = getApproxLineHeight(getFontString(updatedElement));
|
||||||
|
@ -62,8 +62,8 @@ class Scene {
|
|||||||
return this.nonDeletedElements;
|
return this.nonDeletedElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
getElement(id: ExcalidrawElement["id"]): ExcalidrawElement | null {
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null {
|
||||||
return this.elementsMap.get(id) || null;
|
return (this.elementsMap.get(id) as T | undefined) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNonDeletedElement(
|
getNonDeletedElement(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user