add shortcut: Toggle Style

This commit is contained in:
Gabe Yuan
2023-08-21 16:06:21 +08:00
parent f585a43480
commit f4a8251c61
9 changed files with 46 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ import {
TRANS_MAX_LENGTH,
EVENT_KISS,
MSG_TRANS_CURRULE,
OPT_STYLE_DASHLINE,
OPT_STYLE_FUZZY,
} from "../config";
import { queryEls } from ".";
import Content from "../views/Content";
@@ -86,6 +88,14 @@ export class Translator {
}
};
toggleStyle = () => {
const textStyle =
this.rule.textStyle === OPT_STYLE_FUZZY
? OPT_STYLE_DASHLINE
: OPT_STYLE_FUZZY;
this.rule = { ...this.rule, textStyle };
};
_register = () => {
// 监听节点变化
this._mutaObserver.observe(document, {