Merge pull request #351 from Basher0303/feature/translator

Feature/translator
This commit is contained in:
Oleg Korshul
2024-08-06 08:28:23 -07:00
committed by GitHub
3 changed files with 9 additions and 2 deletions

View File

@ -29,3 +29,7 @@
## 1.0.6
* Add message, that plugin doesn't work in user region (if we have some problems with loading necessary data).
## 1.0.7
* Fix problem of repeated translation of the same text.

View File

@ -9,7 +9,7 @@
"si": "පරිවර්තකය"
},
"guid": "asc.{7327FC95-16DA-41D9-9AF2-0E7F449F6800}",
"version": "1.0.6",
"version": "1.0.7",
"variations": [
{

View File

@ -20,6 +20,7 @@
var isInit = false;
var ifr;
const isIE = checkInternetExplorer(); //check IE
var prevTxt;
var txt;
var paste_done = true;
var translated = '';
@ -32,10 +33,12 @@
}
if (window.Asc.plugin.info.editorType === 'word') {
window.Asc.plugin.executeMethod("GetSelectedText", [{Numbering:false}], function(data) {
prevTxt = txt;
txt = (!data) ? "" : ProcessText(data);
ExecPlugin();
});
} else {
prevTxt = txt;
txt = ProcessText(text);
ExecPlugin();
}
@ -160,7 +163,7 @@
ifr.contentWindow.postMessage("update_scroll", '*');
ifr.contentWindow.postMessage({type: 'translate', text: translated}, '*')
}
} else {
} else if(prevTxt != txt) {
ifr.contentWindow.postMessage(txt, '*');
ifr.contentDocument.getElementById("google_translate_element").style.opacity = 0;
}