mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-02-10 18:05:06 +08:00
Merge pull request #351 from Basher0303/feature/translator
Feature/translator
This commit is contained in:
@ -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.
|
||||
@ -9,7 +9,7 @@
|
||||
"si": "පරිවර්තකය"
|
||||
},
|
||||
"guid": "asc.{7327FC95-16DA-41D9-9AF2-0E7F449F6800}",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
|
||||
"variations": [
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user