Ver código fonte

fix: 点击undo redo按钮会触发outside

wzl 7 meses atrás
pai
commit
ff0399c545

+ 8 - 10
packages/core/src/editor/image_editor.js

@@ -481,9 +481,7 @@ export class ImageEditor {
       this.outerLine,
       this.deletetButton,
       document.querySelector('.editor-panel'),
-      document.getElementById('propertyPanelButton'),
-      document.getElementById('undo'),
-      document.getElementById('redo')
+      document.getElementById('propertyPanelButton')
     ], this.handleOutside.bind(this))
   }
 
@@ -1160,9 +1158,7 @@ export class ImageEditor {
       this.outerLine,
       this.deletetButton,
       document.querySelector('.editor-panel'),
-      document.getElementById('propertyPanelButton'),
-      document.getElementById('undo'),
-      document.getElementById('redo')
+      document.getElementById('propertyPanelButton')
     ], this.handleOutside.bind(this))
   }
 
@@ -1514,10 +1510,12 @@ export class ImageEditor {
 
     this.drawCanvas()
     this.saveEdit()
-    this.updateOriginalImageUrl()
 
-    const opacity = await this.messageHandler.sendWithPromise('GetImageTransparency', this.editAreaPtr)
-    this.opacity = Math.round(opacity * 100) / 100
-    this.eventBus.dispatch('contentPropertyChange', { type: 'image', opacity: this.opacity * 100 })
+    if (this.contentContainer.selectedFrameIndex === this.editAreaIndex) {
+      this.updateOriginalImageUrl()
+      const opacity = await this.messageHandler.sendWithPromise('GetImageTransparency', this.editAreaPtr)
+      this.opacity = Math.round(opacity * 100) / 100
+      this.eventBus.dispatch('contentPropertyChange', { type: 'image', opacity: this.opacity * 100 })
+    }
   }
 }

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

@@ -607,9 +607,7 @@ export class TextEditor {
         this.textContainer,
         this.outerLine,
         document.querySelector('.editor-panel'),
-        document.getElementById('propertyPanelButton'),
-        document.getElementById('undo'),
-        document.getElementById('redo')
+        document.getElementById('propertyPanelButton')
       ], this.handleOutside.bind(this))
     }
   }
@@ -797,9 +795,7 @@ export class TextEditor {
         this.textContainer,
         this.outerLine,
         document.querySelector('.editor-panel'),
-        document.getElementById('propertyPanelButton'),
-        document.getElementById('undo'),
-        document.getElementById('redo')
+        document.getElementById('propertyPanelButton')
       ], this.handleOutside.bind(this))
       return
     }
@@ -842,9 +838,7 @@ export class TextEditor {
           this.textContainer,
           this.outerLine,
           document.querySelector('.editor-panel'),
-          document.getElementById('propertyPanelButton'),
-          document.getElementById('undo'),
-          document.getElementById('redo')
+          document.getElementById('propertyPanelButton')
         ], this.handleOutside.bind(this))
       }
     }
@@ -1680,9 +1674,7 @@ export class TextEditor {
       this.textContainer,
       this.outerLine,
       document.querySelector('.editor-panel'),
-      document.getElementById('propertyPanelButton'),
-      document.getElementById('undo'),
-      document.getElementById('redo')
+      document.getElementById('propertyPanelButton')
     ],this.handleOutside.bind(this))
   }
 
@@ -1812,6 +1804,6 @@ export class TextEditor {
 
     this.drawCanvas()
     this.saveEdit()
-    this.getTextStyle()
+    this.contentContainer.selectedFrameIndex === this.editAreaIndex && this.getTextStyle()
   }
 }