Selaa lähdekoodia

fix(picture-editor): 修复字体设置时对象方法检查

- 添加了对对象set方法的类型检查
- 防止在非函数对象上调用set方法导致错误
- 确保字体家族设置的安全性
panqiuyao 1 kuukausi sitten
vanhempi
commit
d5a4b8b90a

+ 1 - 0
frontend/src/views/components/PictureEditor/mixin/edit/index.js

@@ -283,6 +283,7 @@ export default  {
 
       await loadFont(font.name,font.src)
       let obj = item || this.editLayer
+      if(typeof obj.set !== 'function') return;
       obj.set({'fontFamily': val});
       obj.setSelectionStyles({'fontFamily': val});
       this.fontFamilyStyle = val