Parcourir la source

fix: 1.3.1一轮综测bug

wzl il y a 1 an
Parent
commit
7ca368b844

+ 3 - 3
packages/core/src/form/add_check_box.js

@@ -89,7 +89,7 @@ export default class AddCheckBox {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -120,7 +120,7 @@ export default class AddCheckBox {
         fieldName: this.fieldName,
         isHidden: '0',
         borderColor: '#43474D',
-        backgroundColor: '#DDE9FF',
+        backgroundColor: '#93B9FD',
         lineWidth: '1',
         style: '0',
         select: '0'
@@ -171,7 +171,7 @@ export default class AddCheckBox {
     if (this.initStartPoint.x !== this.initEndPoint.x && this.initStartPoint.y !== this.initEndPoint.y) {
       if (!this.shapeEle) {
         const shapeEle = createElement('div', {
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'borderColor': '#43474D',
           'borderWidth': '3',
           'borderStyle': 'solid',

+ 4 - 4
packages/core/src/form/add_combo_box.js

@@ -87,7 +87,7 @@ export default class AddComboBox {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -118,8 +118,8 @@ export default class AddComboBox {
         fieldName: this.fieldName,
         isHidden: '0',
         borderColor: '#43474D',
-        backgroundColor: '#DDE9FF',
-        textColor: '#001A4E',
+        backgroundColor: '#93B9FD',
+        textColor: '#000000',
         fontName: 'Helvetica',
         fontSize: '14',
         lineWidth: '1',
@@ -173,7 +173,7 @@ export default class AddComboBox {
     if (this.initStartPoint.x !== this.initEndPoint.x && this.initStartPoint.y !== this.initEndPoint.y) {
       if (!this.shapeEle) {
         const shapeEle = createElement('div', {
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'borderColor': '#43474D',
           'borderWidth': '1px',
           'borderStyle': 'solid',

+ 4 - 4
packages/core/src/form/add_list_box.js

@@ -87,7 +87,7 @@ export default class AddListBox {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -118,8 +118,8 @@ export default class AddListBox {
         fieldName: this.fieldName,
         isHidden: '0',
         borderColor: '#43474D',
-        backgroundColor: '#DDE9FF',
-        textColor: '#001A4E',
+        backgroundColor: '#93B9FD',
+        textColor: '#000000',
         fontName: 'Helvetica',
         fontSize: '14',
         lineWidth: '1',
@@ -173,7 +173,7 @@ export default class AddListBox {
     if (this.initStartPoint.x !== this.initEndPoint.x && this.initStartPoint.y !== this.initEndPoint.y) {
       if (!this.shapeEle) {
         const shapeEle = createElement('div', {
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'borderColor': '#43474D',
           'borderWidth': '1px',
           'borderStyle': 'solid',

+ 5 - 5
packages/core/src/form/add_push_button.js

@@ -87,7 +87,7 @@ export default class AddPushButton {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -118,9 +118,9 @@ export default class AddPushButton {
 
         fieldName: this.fieldName,
         isHidden: '0',
-        backgroundColor: '#DDE9FF',
+        backgroundColor: '#93B9FD',
         lineWidth: '1',
-        textColor: '#001A4E',
+        textColor: '#000000',
         fontName: 'Helvetica',
         fontSize: '14',
         value: 'OK'
@@ -176,12 +176,12 @@ export default class AddPushButton {
           'display': 'flex',
           'alignItems': 'center',
           'justifyContent': 'center',
-          'color': '#001A4E',
+          'color': '#000000',
           'fontSize': '14px',
           'borderColor': '#001A4E',
           'borderWidth': '1px',
           'borderStyle': 'solid',
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'position': 'absolute',
           'fontFamily': 'Helvetica',
           'overflow': 'hidden'

+ 3 - 3
packages/core/src/form/add_radio_button.js

@@ -89,7 +89,7 @@ export default class AddRadioButton {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -120,7 +120,7 @@ export default class AddRadioButton {
         fieldName: this.fieldName,
         isHidden: '0',
         borderColor: '#43474D',
-        backgroundColor: '#DDE9FF',
+        backgroundColor: '#93B9FD',
         lineWidth: '1',
         style: '1',
         select: '0'
@@ -171,7 +171,7 @@ export default class AddRadioButton {
     if (this.initStartPoint.x !== this.initEndPoint.x && this.initStartPoint.y !== this.initEndPoint.y) {
       if (!this.shapeEle) {
         const shapeEle = createElement('div', {
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'borderColor': '#43474D',
           'borderWidth': '3',
           'borderStyle': 'solid',

+ 3 - 3
packages/core/src/form/add_text_field.js

@@ -89,7 +89,7 @@ export default class AddTextField {
   }
 
   handleMouseDown (event) {
-    if (this.layer.selectedElementName) return
+    if (this.layer.annotationStore.selectedElementName) return
     const { x, y } = getAbsoluteCoordinate(this.container, event)
     this.initStartPoint = { x, y }
 
@@ -120,7 +120,7 @@ export default class AddTextField {
 
         fieldName: this.fieldName,
         isHidden: '0',
-        backgroundColor: '#DDE9FF',
+        backgroundColor: '#93B9FD',
         textColor: '#000000',
         fontName: 'Helvetica',
         fontSize: '14',
@@ -174,7 +174,7 @@ export default class AddTextField {
     if (this.initStartPoint.x !== this.initEndPoint.x && this.initStartPoint.y !== this.initEndPoint.y) {
       if (!this.shapeEle) {
         const shapeEle = createElement('div', {
-          'backgroundColor': '#DDE9FF',
+          'backgroundColor': '#93B9FD',
           'position': "absolute"
         })
         this.shapeEle = shapeEle

+ 1 - 0
packages/webview/index.html

@@ -3,6 +3,7 @@
   <head>
     <meta charset="UTF-8">
     <link rel="icon" href="/favicon.ico">
+    <link rel="stylesheet" data-hid="stylesheet" href="https://fonts.googleapis.com/css?family=Courier|Times|Courier:b,i,bi|Times:b,i,bi">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>ComPDFKit Web Viewer</title>
   </head>

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

@@ -6,7 +6,8 @@
     :style="{
       width: `calc(100% - ${leftPanelSpace}px - ${rightPanelSpace}px)`,
       'margin-left': `${leftPanelSpace}px`,
-      'margin-right': `${rightPanelSpace}px`
+      'margin-right': `${rightPanelSpace}px`,
+      'margin-top': `${topSpace}px`
     }"
   >
     <div ref="viewerContainer" class="document"></div>
@@ -88,6 +89,9 @@
   const rightPanelSpace = computed(() => {
     return (useViewer.isLeftPanelOpen('rightPanel') || useViewer.getActivePanel('pageSetting')) ? 220 : 0
   })
+  const topSpace = computed(() => {
+    return useViewer.getToolMode === 'view' ? 0 : 44
+  })
   const loading = ref(false)
   const activePanel = computed(() => useViewer.getActiveLeftPanel)
   const load = ref(true)

+ 1 - 0
packages/webview/src/components/PageNavOverlay/PageNavOverlay.vue

@@ -19,6 +19,7 @@
         tabIndex=-1
         :style="{ width: pageValue.toString().length * 8 + 'px' }"
         pattern="\d*"
+        onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
       />
       <span>{{ `/${totalPages}` }}</span>
     </div>

+ 14 - 2
packages/webview/src/components/RightPanel/RightPanel.vue

@@ -157,7 +157,7 @@
           </div>
           <div v-show="property.actionType === '1'" class="content-block">
             <h2>Go To Pages</h2>
-            <input type="number" pattern="\d*" placeholder="Add Page" v-model="property.destPage">
+            <input type="text" pattern="\d*" placeholder="Add Page" v-model="property.destPage" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))">
           </div>
           <div v-show="property.actionType === '2'" class="content-block">
             <h2>Open a Web Link</h2>
@@ -245,6 +245,13 @@
   let selectedItemIndex = ref(null)
   let options = ref([])
 
+  // 打开右侧属性面板时,关闭视图面板
+  watch(() => isOpen.value, (newValue, oldValue) => {
+    if (newValue) {
+      useViewer.closeElement('pageSetting')
+    }
+  })
+
   watch(() => property.fieldName, (newValue, oldValue) => {
     console.log(`Name changed from ${oldValue} to ${newValue}`)
     useDocument.setPropertyPanel({'fieldName': newValue})
@@ -352,7 +359,8 @@
   
   watch(() => property.destPage, (newValue, oldValue) => {
     console.log(`destPage changed from ${oldValue} to ${newValue}`)
-    if (newValue !== '' && (newValue > totalPages.value || newValue <= 0)) {
+    const regex = /^\d+$/
+    if ((newValue !== '' && (newValue > totalPages.value || newValue <= 0 || !regex.test(newValue)))) {
       property.destPage = oldValue
     } else if (newValue !== '') {
       useDocument.setPropertyPanel({'actionType': '1'})
@@ -447,6 +455,8 @@
         options.value.splice(i, 1)
         useDocument.setPropertyPanel({'select': '1'})
         useDocument.setPropertyPanel({'options': options.value})
+        editItem.value = ''
+        selectedItemIndex.value = null
       }
     }
   }
@@ -457,6 +467,7 @@
         options.value.splice(i - 1, 2, options.value[i], options.value[i - 1])
         useDocument.setPropertyPanel({'select': '1'})
         useDocument.setPropertyPanel({'options': options.value})
+        selectedItemIndex.value -= 1
         break
       }
     }
@@ -468,6 +479,7 @@
         options.value.splice(i, 2, options.value[i + 1], options.value[i])
         useDocument.setPropertyPanel({'select': '1'})
         useDocument.setPropertyPanel({'options': options.value})
+        selectedItemIndex.value += 1
         break
       }
     }

+ 2 - 2
packages/webview/src/components/ZoomOverlay/ZoomOverlay.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="zoom-overlay">
     <div class="input-container">
-      <input v-model="scaleValue" type="number" pattern="\d*" @input="onChange" @keydown.enter="changeScale" @blur="handleBlur" :style="{ width: inputWidth + 'px' }" />
+      <input v-model="scaleValue" type="text" pattern="\d*" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))" @input="onChange" @keydown.enter="changeScale" @blur="handleBlur" :style="{ width: inputWidth + 'px' }" />
       <div class="drop-down-zoom">
         <span>%</span>
         <!-- <svg data-status="normal" width="16" height="16" viewBox="0 0 16 16"><g fill="none" fill-rule="evenodd"><path d="M0 0h16v16H0z"></path><path fill="#757780" d="M11.06 5.909l.88.815-3.69 3.983-3.69-3.983.88-.815 2.81 3.032z"></path></g></svg> -->
@@ -75,7 +75,7 @@
   }
 
   const onChange = (event) => {
-    const re = /^(\d){0,4}$/;
+    const re = /^(\d){0,4}$/
     const value = event.target.value
     if (re.test(value) || value === '') {
       useViewer.setCurrentScale(value / 100);