소스 검색

fix: v2.4.5 一轮测试修复

wzl 3 달 전
부모
커밋
f54c18201f

+ 1 - 0
packages/core/src/editor/image_editor.js

@@ -389,6 +389,7 @@ export class ImageEditor {
   }
 
   handleMouseDown (e) {
+    e.preventDefault()
     if (e.button === 2 || this.hidden) return // 右键点击不执行
 
     if (this.state > 0) {

+ 5 - 1
packages/core/src/editor/text_editor.js

@@ -150,11 +150,12 @@ export class TextEditor {
     let text = await this.getText()
     this.textarea.innerHTML = text
 
-    this.frameContainer.append(this.textContainer)
+    this.frameContainer?.append(this.textContainer)
 
     // this.textContainer.addEventListener('click', this.onClick)
     this.textContainer.addEventListener(this.mousedown, this.onMousedown)
     this.textContainer.addEventListener(this.mouseup, this.onMouseup)
+    isMobileDevice && this.textarea.addEventListener('contextmenu', (event) => event.preventDefault())
 
     this.outerLineContainer = document.createElement('div')
     this.outerLineContainer.className = 'outline-container'
@@ -426,6 +427,7 @@ export class TextEditor {
   }
 
   handleMouseDown (e) {
+    isMobileDevice && e.preventDefault()
     if (e.button === 2 || this.hidden) return // 右键点击不执行
 
     if (this.state === 1) {
@@ -442,6 +444,8 @@ export class TextEditor {
       
     } else if (this.state === 2) {
       if (isMobileDevice) {
+        this.textarea.focus()
+
         const offsetX = e.changedTouches[0].clientX - this.pageViewer.div.getBoundingClientRect().left
         const offsetY = e.changedTouches[0].clientY - this.pageViewer.div.getBoundingClientRect().top
 

+ 16 - 12
packages/core/src/index.js

@@ -2364,17 +2364,15 @@ class ComPDFKitViewer {
       }
     );
 
-    if (toggleButton) {
-      this.pdfSidebar = new PDFSidebar({
-        elements: {
-          toggleButton
-        },
-        pdfViewer: this.pdfViewer,
-        pdfThumbnailViewer: this.pdfThumbnailViewer,
-        eventBus: this.eventBus
-      });
-      this.pdfSidebar.onToggled = this.forceRendering.bind(this);
-    }
+    this.pdfSidebar = new PDFSidebar({
+      elements: {
+        toggleButton
+      },
+      pdfViewer: this.pdfViewer,
+      pdfThumbnailViewer: this.pdfThumbnailViewer,
+      eventBus: this.eventBus
+    });
+    this.pdfSidebar.onToggled = this.forceRendering.bind(this);
 
     this.contentEditManager = new ContentEditManager(this);
   }
@@ -2408,7 +2406,7 @@ class ComPDFKitViewer {
     }
 
     this.pdfViewer.forceRendering()
-    this.pdfSidebar.isOpen && this.pdfThumbnailViewer.forceRendering();
+    this.pdfSidebar?.isOpen && this.pdfThumbnailViewer.forceRendering();
   }
 
   requestFullScreenMode() {
@@ -2438,18 +2436,22 @@ class ComPDFKitViewer {
     if (this.pdfViewer.isInPresentationMode) {
       return;
     }
+    const oldPage = this.page;
     this.pdfViewer.increaseScale({
       drawingDelay: 400
     });
+    this.page = oldPage;
   }
 
   zoomOut(steps) {
     if (this.pdfViewer.isInPresentationMode) {
       return;
     }
+    const oldPage = this.page;
     this.pdfViewer.decreaseScale({
       drawingDelay: 400
     });
+    this.page = oldPage;
   }
 
   nextPage() {
@@ -2764,7 +2766,9 @@ class ComPDFKitViewer {
     }
   }
   webViewerScaleChanged(value) {
+    const oldPage = this.page;
     this.pdfViewer.currentScaleValue = value;
+    this.page = oldPage;
   }
   webViewerRotateCw() {
     this.rotatePages(90);

+ 1 - 1
packages/webview/src/components/Dialogs/Dialog.vue

@@ -45,7 +45,7 @@ const closeDialog = () => {
   display: flex;
   justify-content: center;
   align-items: center;
-  z-index: 3;
+  z-index: 4;
 }
 
 .dialog-container {

+ 1 - 1
packages/webview/src/components/DocumentContainer/DocumentContainer.vue

@@ -56,7 +56,7 @@
   <DeleteSignatureDialog />
   <AddDigitalFileDialog />
   <div v-if="loading && loadingPercent < 100" class="loading-state">{{ $t('loading') }}...</div>
-  <div v-show="!load && loadingPercent <= 0 && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
+  <div v-show="!load && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
     <input id="fileInput" type="file" accept=".pdf" @change="handleUpload" />
     <label for="fileInput">{{ $t('upload') }}</label>
   </div>