Skip to content

Commit

Permalink
fix: 有时不能朗读翻译原文本
Browse files Browse the repository at this point in the history
改翻译原文本和原语言都会触发网络请求;
当原文本为空时修改原语言不会触发网络请求;
  • Loading branch information
mantou132 committed Feb 22, 2019
1 parent e9511ff commit 763ad23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/renderer/inject/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ const initTranslatePage = async (opt: IInitPageOption) => {
) as HTMLElement;

ipcRenderer.on('translate-clipboard-text', (_: any, arg: string) => {
const { value } = sourceTextAreaEle;
if (value === arg) return;
sourceTextAreaEle.value = '';
targetLabelEle.click();
detectLabelEle.click();
sourceTextAreaEle.value = value;
});

const observer = new MutationObserver(() => {
Expand Down

0 comments on commit 763ad23

Please sign in to comment.