From 2d70a3bc17fe94d0bf92d8362b8fda8a2e4a82e1 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 26 Jun 2025 16:41:01 -0400
Subject: fixed rendering pdfs, text selections on pdfs,

---
 src/client/views/nodes/PDFBox.tsx | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

(limited to 'src/client/views/nodes/PDFBox.tsx')

diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index 5501f0a31..4deb1f207 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -72,12 +72,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
         !this.Document._layout_fitWidth && (this.Document._height = NumCast(this.Document._width) * (nh / nw));
         if (this.pdfUrl) {
             this._pdf = PDFBox.pdfcache.get(this.pdfUrl.url.href);
-            !this._pdf &&
-                PDFBox.pdfpromise.get(this.pdfUrl.url.href)?.then(
-                    action(pdf => {
-                        this._pdf = pdf;
-                    })
-                );
+            !this._pdf && PDFBox.pdfpromise.get(this.pdfUrl.url.href)?.then(action(pdf => (this._pdf = pdf)));
         }
     }
 
@@ -150,8 +145,8 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
         this.addDocument(region);
 
         const newDiv = docViewContent.cloneNode(true) as HTMLDivElement;
-        newDiv.style.width = NumCast(this.layoutDoc._width).toString();
-        newDiv.style.height = NumCast(this.layoutDoc._height).toString();
+        newDiv.style.width = NumCast(this.layoutDoc._width).toString() + 'px';
+        newDiv.style.height = NumCast(this.layoutDoc._height).toString() + 'px';
         this.replaceCanvases(docViewContent, newDiv);
         const htmlString = this._pdfViewer?._mainCont.current && new XMLSerializer().serializeToString(newDiv);
 
@@ -409,7 +404,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
             this.layoutDoc._show_sidebar = nativeWidth !== this.layoutDoc._nativeWidth;
         }
     });
-    settingsPanel() {
+    @computed get settingsPanel() {
         const pageBtns = (
             <>
                 <button type="button" className="pdfBox-backBtn" key="back" title="Page Back" onPointerDown={e => e.stopPropagation()} onClick={this.backPage}>
@@ -675,7 +670,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
                 <div className="pdfBox-sidebarContainer" style={{ width: `calc(100 * ${this.sidebarWidth() / this._props.PanelWidth()}%` }}>
                     {this.sidebarCollection}
                 </div>
-                {this.settingsPanel()}
+                {this.settingsPanel}
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2

