Browse Source

bug 修复

lilei 3 years ago
parent
commit
749aee51cd
1 changed files with 5 additions and 0 deletions
  1. 5 0
      public/menus.js

+ 5 - 0
public/menus.js

@@ -91,6 +91,11 @@ function getContextMenu(){
   
       if (selectStr) { // 如果有选中内容
         flag = true
+        selectStr = selectStr.replace(/\r\n\t\f\v/g,"")
+        selectStr = selectStr.replace(/\n/g,"")
+        selectStr = selectStr.replace(/\t/g,"")
+        selectStr = selectStr.replace(/\f/g,"")
+        selectStr = selectStr.replace(/\v/g,"")
         // 在 选中的元素或者输入框 上面点右键,这样在选中后点别处就不会出现右键复制菜单
         if (text.indexOf(selectStr) !== -1 || value.indexOf(selectStr) !== -1) menu.append(new MenuItem({ label: '复制', click: copyString }))
       }