Do not show button when symbol is selected
This commit is contained in:
parent
267b25777e
commit
9571e98671
|
@ -48,7 +48,13 @@ const matchesTargetLang = async selectedText => {
|
||||||
//先頭100字を翻訳にかけて判定
|
//先頭100字を翻訳にかけて判定
|
||||||
const partSelectedText = selectedText.substring(0, 100);
|
const partSelectedText = selectedText.substring(0, 100);
|
||||||
const result = await translateText(partSelectedText);
|
const result = await translateText(partSelectedText);
|
||||||
const matchsLangs = targetLang === result.sourceLanguage && result.percentage > 0;
|
const isError = result.statusText !== "OK";
|
||||||
|
if (isError) return false;
|
||||||
|
|
||||||
|
const isNotText = result.percentage === 0;
|
||||||
|
if (isNotText) return true;
|
||||||
|
|
||||||
|
const matchsLangs = targetLang === result.sourceLanguage;
|
||||||
return matchsLangs;
|
return matchsLangs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue