Skip to content

Commit db20344

Browse files
committed
add constraints on the annotation 'border' style
1 parent a09588d commit db20344

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

streamlit_pdf_viewer/frontend/src/PdfViewer.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { debounce } from 'lodash';
2929
const CMAP_URL = "pdfjs-dist/cmaps/";
3030
const CMAP_PACKED = true;
3131
const ENABLE_XFA = true;
32+
const acceptedBorderStyleAttributes = ['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset', 'none', undefined, null];
3233
3334
export default {
3435
props: ["args"],
@@ -119,7 +120,7 @@ export default {
119120
annotationDiv.style.width = `${annotation.width * scale}px`;
120121
annotationDiv.style.height = `${annotation.height * scale}px`;
121122
let border = annotation.border
122-
if (!annotation.border) {
123+
if (!annotation.border || !acceptedBorderStyleAttributes.includes(annotation.border)) {
123124
border = "solid"
124125
}
125126
annotationDiv.style.outline = `${props.args.annotation_outline_size * scale}px ${border} ${annotation.color}`;

0 commit comments

Comments
 (0)