wenliming 2 лет назад
Родитель
Сommit
c125e584b1
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      src/logic/content/keywordReminder.js

+ 6 - 2
src/logic/content/keywordReminder.js

@@ -43,7 +43,7 @@ export const keywordReminderInit = () => {
 export const listenerKeywordInput = debounce(function() {
   let inputBox = getInputBox();
   if(inputBox) {
-    inputBox.oninput = function () {
+    inputBox.onkeyup = function () {
         highlightKeyword();
     }
   }
@@ -67,6 +67,7 @@ export const highlightKeyword = () => {
             if(checkHasTag({keyword, startPos, endPos, rowIndex: j})) {
               continue;
             }
+            removeTag({rowIndex: j, keyword})
 
             lastRange = window.getSelection().getRangeAt(0)
 
@@ -98,12 +99,15 @@ export const highlightKeyword = () => {
             let top = rectDom.top - inputBoxRect.top + 2;
 
             let cssText = `left: ${left}px;top: ${top}px;width: ${rectDom.width}px;height: ${rectDom.height}px;`;
-            addHighlightDom({cssText, rowIndex: j, keyword})
+            addHighlightDom({cssText, rowIndex: j, keyword});
           } else {
             removeTag({rowIndex: j, keyword})
           }
         }
       }
+    } else {
+      document.getElementById("denet-keword-highlight-wrapper").innerHTML = '';
+      tagData = [];
     }
   }
 }