mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-04-07 14:04:30 +08:00
Merge pull request #351 from Basher0303/feature/translator
Feature/translator
This commit is contained in:
@ -29,3 +29,7 @@
|
|||||||
## 1.0.6
|
## 1.0.6
|
||||||
|
|
||||||
* Add message, that plugin doesn't work in user region (if we have some problems with loading necessary data).
|
* 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": "පරිවර්තකය"
|
"si": "පරිවර්තකය"
|
||||||
},
|
},
|
||||||
"guid": "asc.{7327FC95-16DA-41D9-9AF2-0E7F449F6800}",
|
"guid": "asc.{7327FC95-16DA-41D9-9AF2-0E7F449F6800}",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
|
|
||||||
"variations": [
|
"variations": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
var isInit = false;
|
var isInit = false;
|
||||||
var ifr;
|
var ifr;
|
||||||
const isIE = checkInternetExplorer(); //check IE
|
const isIE = checkInternetExplorer(); //check IE
|
||||||
|
var prevTxt;
|
||||||
var txt;
|
var txt;
|
||||||
var paste_done = true;
|
var paste_done = true;
|
||||||
var translated = '';
|
var translated = '';
|
||||||
@ -32,10 +33,12 @@
|
|||||||
}
|
}
|
||||||
if (window.Asc.plugin.info.editorType === 'word') {
|
if (window.Asc.plugin.info.editorType === 'word') {
|
||||||
window.Asc.plugin.executeMethod("GetSelectedText", [{Numbering:false}], function(data) {
|
window.Asc.plugin.executeMethod("GetSelectedText", [{Numbering:false}], function(data) {
|
||||||
|
prevTxt = txt;
|
||||||
txt = (!data) ? "" : ProcessText(data);
|
txt = (!data) ? "" : ProcessText(data);
|
||||||
ExecPlugin();
|
ExecPlugin();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
prevTxt = txt;
|
||||||
txt = ProcessText(text);
|
txt = ProcessText(text);
|
||||||
ExecPlugin();
|
ExecPlugin();
|
||||||
}
|
}
|
||||||
@ -160,7 +163,7 @@
|
|||||||
ifr.contentWindow.postMessage("update_scroll", '*');
|
ifr.contentWindow.postMessage("update_scroll", '*');
|
||||||
ifr.contentWindow.postMessage({type: 'translate', text: translated}, '*')
|
ifr.contentWindow.postMessage({type: 'translate', text: translated}, '*')
|
||||||
}
|
}
|
||||||
} else {
|
} else if(prevTxt != txt) {
|
||||||
ifr.contentWindow.postMessage(txt, '*');
|
ifr.contentWindow.postMessage(txt, '*');
|
||||||
ifr.contentDocument.getElementById("google_translate_element").style.opacity = 0;
|
ifr.contentDocument.getElementById("google_translate_element").style.opacity = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user