mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-20 16:00:38 +02:00
fix: repair invalid binding on restore & fix type check (#8133)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawElementType,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawSelectionElement,
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
@@ -21,7 +22,11 @@ import {
|
||||
isInvisiblySmallElement,
|
||||
refreshTextDimensions,
|
||||
} from "../element";
|
||||
import { isTextElement, isUsingAdaptiveRadius } from "../element/typeChecks";
|
||||
import {
|
||||
isLinearElement,
|
||||
isTextElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "../element/typeChecks";
|
||||
import { randomId } from "../random";
|
||||
import {
|
||||
DEFAULT_FONT_FAMILY,
|
||||
@@ -460,6 +465,21 @@ export const restoreElements = (
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (isLinearElement(element)) {
|
||||
if (
|
||||
element.startBinding &&
|
||||
!restoredElementsMap.has(element.startBinding.elementId)
|
||||
) {
|
||||
(element as Mutable<ExcalidrawLinearElement>).startBinding = null;
|
||||
}
|
||||
if (
|
||||
element.endBinding &&
|
||||
!restoredElementsMap.has(element.endBinding.elementId)
|
||||
) {
|
||||
(element as Mutable<ExcalidrawLinearElement>).endBinding = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return restoredElements;
|
||||
|
Reference in New Issue
Block a user