fix(bbb-export-annotations): handle missing textbox size in Tldraw (#19672)

This commit is contained in:
Daniel Petri Rocha 2024-02-24 02:20:16 +01:00 committed by GitHub
parent 95d013d645
commit 80d4bdbfef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -703,6 +703,10 @@ function overlay_triangle(svg, annotation) {
} }
function overlay_text(svg, annotation) { function overlay_text(svg, annotation) {
if (annotation.size == null || annotation.size.length < 2) {
return
}
const [textBoxWidth, textBoxHeight] = annotation.size; const [textBoxWidth, textBoxHeight] = annotation.size;
const fontColor = color_to_hex(annotation.style.color); const fontColor = color_to_hex(annotation.style.color);
const font = determine_font_from_family(annotation.style.font); const font = determine_font_from_family(annotation.style.font);
@ -731,6 +735,7 @@ function overlay_text(svg, annotation) {
} }
function overlay_annotation(svg, currentAnnotation) { function overlay_annotation(svg, currentAnnotation) {
try {
switch (currentAnnotation.type) { switch (currentAnnotation.type) {
case 'arrow': case 'arrow':
overlay_arrow(svg, currentAnnotation); overlay_arrow(svg, currentAnnotation);
@ -756,6 +761,9 @@ function overlay_annotation(svg, currentAnnotation) {
default: default:
logger.info(`Unknown annotation type ${currentAnnotation.type}.`); logger.info(`Unknown annotation type ${currentAnnotation.type}.`);
} }
} catch (error) {
logger.warn("Failed to overlay annotation", { failedAnnotation: currentAnnotation, error: error });
}
} }
function overlay_annotations(svg, currentSlideAnnotations) { function overlay_annotations(svg, currentSlideAnnotations) {