mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Update loading dictionaries
This commit is contained in:
@ -79,18 +79,19 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var src_size = 4 * src.length + 1;
|
var dict = new Uint8ClampedArray(src);
|
||||||
|
var dict_size = dict.length;
|
||||||
var lang_size = 4 * lang.length + 1;
|
var lang_size = 4 * lang.length + 1;
|
||||||
|
|
||||||
var _src = hyphenAllocateMemory(src_size);
|
var _dict = hyphenAllocateMemory(dict_size);
|
||||||
var _lang = hyphenAllocateMemory(lang_size);
|
var _lang = hyphenAllocateMemory(lang_size);
|
||||||
|
|
||||||
Module.stringToUTF8(src, _src, src_size);
|
hyphenSetMemory(dict, _dict);
|
||||||
Module.stringToUTF8(lang, _lang, lang_size);
|
Module.stringToUTF8(lang, _lang, lang_size);
|
||||||
|
|
||||||
Module._hyphenLoadDictionary(app, _src, _lang);
|
Module._hyphenLoadDictionary(app, _dict, _lang);
|
||||||
|
|
||||||
hyphenFreeMemory(_src);
|
hyphenFreeMemory(_dict);
|
||||||
hyphenFreeMemory(_lang);
|
hyphenFreeMemory(_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,11 +23,19 @@
|
|||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
var path = '../../../../../../dictionaries/' + lang + '/' + 'hyph_' + lang + '.dic';
|
var path = '../../../../../../dictionaries/' + lang + '/' + 'hyph_' + lang + '.dic';
|
||||||
|
|
||||||
|
request.responseType = 'arraybuffer';
|
||||||
|
|
||||||
|
if (request.overrideMimeType) {
|
||||||
|
request.overrideMimeType('text/plain; charset=x-user-defined');
|
||||||
|
} else {
|
||||||
|
request.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||||
|
}
|
||||||
request.open('GET', path, true);
|
request.open('GET', path, true);
|
||||||
request.send(null);
|
request.send(null);
|
||||||
|
|
||||||
request.onload = function () {
|
request.onload = function () {
|
||||||
var dict = request.responseText;
|
var dict = request.response;
|
||||||
window.hyphen.hyphenLoadDictionary(application, dict, lang);
|
window.hyphen.hyphenLoadDictionary(application, dict, lang);
|
||||||
|
|
||||||
for(var i = 0; i < text.length; i++) {
|
for(var i = 0; i < text.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user